@tryghost/koenig-lexical 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +36 -0
- package/dist/assets/index.b7cc7759.css +1 -0
- package/dist/koenig-lexical.js +5064 -0
- package/dist/koenig-lexical.js.map +1 -0
- package/dist/koenig-lexical.umd.js +31 -0
- package/dist/koenig-lexical.umd.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
(function(fe,dt){typeof exports=="object"&&typeof module<"u"?dt(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],dt):(fe=typeof globalThis<"u"?globalThis:fe||self,dt(fe["@tryghost/koenig-lexical"]={},fe.React,fe.ReactDOM))})(this,function(fe,dt,nl){"use strict";const Tr=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},se=Tr(dt),rl=Tr(nl);var Sr={},Ut={},Er=se.default;let Or=Er.createContext(null);Ut.LexicalComposerContext=Or,Ut.createLexicalComposerContext=function(t,e){let n=null;return t!=null&&(n=t[1]),{getTheme:function(){return e!=null?e:n!=null?n.getTheme():null}}},Ut.useLexicalComposerContext=function(){let t=Er.useContext(Or);if(t==null)throw Error("Minified Lexical error #8; visit https://lexical.dev/docs/error?code=8 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");return t};var Fe=Ut,_={};let $r={},Mr={},ut={},at={},Tn={},Be={},Sn={},En={},ct={},ft={},ye={},On={},$n={},Dr={},Rr={},Lr={},Ar={},wr={},kr={},Gt={},Pr={},Ir={},Fr={},Br={},Kr={},Wr={},zr={},Yr={},Hr={},Mn={},Dn={},Ur={},Gr={},Jr={};function v(t){throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?code=${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let Ke=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",il=Ke&&"documentMode"in document?document.documentMode:null,Z=Ke&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Oe=Ke&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),ol=Ke&&"InputEvent"in window&&!il?"getTargetRanges"in new window.InputEvent("input"):!1,Jt=Ke&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Vt=Ke&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,jt=Jt||Vt?"\xA0":"\u200B",ll=Oe?"\xA0":jt,sl=/^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]/,dl=/^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]/,$e={bold:1,code:16,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},ul={directionless:1,unmergeable:2},Vr={center:2,justify:4,left:1,right:3},al={2:"center",4:"justify",1:"left",3:"right"},cl={inert:3,normal:0,segmented:2,token:1},fl={3:"inert",0:"normal",2:"segmented",1:"token"},Rn=!1,Ln=0;function gl(t){Ln=t.timeStamp}function An(t,e,n){return e.__lexicalLineBreak===t||t[`__lexicalKey_${n._key}`]!==void 0}function hl(t){return t.getEditorState().read(()=>{let e=w();return e!==null?e.clone():null})}function jr(t,e,n){Rn=!0;let r=100<performance.now()-Ln;try{q(t,()=>{let i=w()||hl(t);var o=new Map,l=t.getRootElement(),s=t._editorState;let d=!1,u="";for(var a=0;a<e.length;a++){var c=e[a],f=c.type,h=c.target,p=gt(h,s);if(!I(p)){if(f==="characterData"){if(c=r&&N(p))e:{c=i,f=h;var x=p;if(E(c)){var T=c.anchor.getNode();if(T.is(x)&&c.format!==T.getFormat()){c=!1;break e}}c=f.nodeType===3&&x.isAttached()}c&&(x=window.getSelection(),f=c=null,x!==null&&x.anchorNode===h&&(c=x.anchorOffset,f=x.focusOffset),h=h.nodeValue,h!==null&&Pn(p,h,c,f,!1))}else if(f==="childList"){for(d=!0,f=c.addedNodes,x=0;x<f.length;x++){T=f[x];var D=ei(T),R=T.parentNode;R==null||D!==null||T.nodeName==="BR"&&An(T,R,t)||(Oe&&(D=T.innerText||T.nodeValue)&&(u+=D),R.removeChild(T))}if(c=c.removedNodes,f=c.length,0<f){for(x=0,T=0;T<f;T++)R=c[T],R.nodeName==="BR"&&An(R,h,t)&&(h.appendChild(R),x++);f!==x&&(h===l&&(p=s._nodeMap.get("root")),o.set(h,p))}}}}if(0<o.size)for(let[P,z]of o)if(m(z))for(o=z.__children,l=P.firstChild,s=0;s<o.length;s++)a=t.getElementByKey(o[s]),a!==null&&(l==null?(P.appendChild(a),l=a):l!==a&&P.replaceChild(a,l),l=l.nextSibling);else N(z)&&z.markDirty();if(o=n.takeRecords(),0<o.length){for(l=0;l<o.length;l++)for(a=o[l],s=a.addedNodes,a=a.target,p=0;p<s.length;p++)h=s[p],c=h.parentNode,c==null||h.nodeName!=="BR"||An(h,a,t)||c.removeChild(h);n.takeRecords()}i!==null&&(d&&(i.dirty=!0,Ye(i)),Oe&&ui(t)&&i.insertRawText(u))})}finally{Rn=!1}}function Xr(t){let e=t._observer;if(e!==null){let n=e.takeRecords();jr(t,n,e)}}function Qr(t){Ln===0&&en(t).addEventListener("textInput",gl,!0),t._observer=new MutationObserver((e,n)=>{jr(t,e,n)})}let _l=1,pl=typeof queueMicrotask=="function"?queueMicrotask:t=>{Promise.resolve().then(t)};function Xt(t,e,n){let r=t.getRootElement();try{var i;if(i=r!==null&&r.contains(e)&&r.contains(n)&&e!==null){let o=document.activeElement,l=o!==null?o.nodeName:null;i=!I(gt(e))||l!=="INPUT"&&l!=="TEXTAREA"}return i&&Zr(e)===t}catch{return!1}}function Zr(t){for(;t!=null;){let e=t.__lexicalEditor;if(e!=null)return e;t=t.parentNode}return null}function wn(t){return ve(t)||t.isSegmented()}function ve(t){return t.isToken()||t.isInert()}function Qt(t){for(;t!=null;){if(t.nodeType===3)return t;t=t.firstChild}return null}function qr(t,e,n){return e=$e[e],t&e&&(n===null||(n&e)===0)?t^e:n===null||n&e?t|e:t}function br(t){return N(t)||Mt(t)||I(t)}function Zt(t){var e=t.getParent();if(e!==null){e=e.getWritable().__children;let n=e.indexOf(t.__key);n===-1&&v(31),ze(t),e.splice(n,1)}}function We(t){99<Et&&v(14);var e=t.getLatest(),n=e.__parent,r=ue();let i=M(),o=r._nodeMap;if(r=i._dirtyElements,n!==null)e:for(;n!==null;){if(r.has(n))break e;let l=o.get(n);if(l===void 0)break;r.set(n,!1),n=l.__parent}e=e.__key,i._dirtyType=1,m(t)?r.set(e,!0):i._dirtyLeaves.add(e)}function ze(t){let e=t.getPreviousSibling();t=t.getNextSibling(),e!==null&&We(e),t!==null&&We(t)}function Y(t){te();var e=M();let n=e._compositionKey;t!==n&&(e._compositionKey=t,n!==null&&(e=L(n),e!==null&&e.getWritable()),t!==null&&(t=L(t),t!==null&&t.getWritable()))}function L(t,e){return t=(e||ue())._nodeMap.get(t),t===void 0?null:t}function ei(t,e){let n=M();return t=t[`__lexicalKey_${n._key}`],t!==void 0?L(t,e):null}function gt(t,e){for(;t!=null;){let n=ei(t,e);if(n!==null)return n;t=t.parentNode}return null}function ti(t){let e=Object.assign({},t._decorators);return t._pendingDecorators=e}function ni(t){return t.read(()=>Me().getTextContent())}function ml(t,e){q(t,()=>{var n=ue();if(!n.isEmpty())if(e==="root")Me().markDirty();else{n=n._nodeMap;for(let[,r]of n)r.markDirty()}},t._pendingEditorState===null?{tag:"history-merge"}:void 0)}function Me(){return ue()._nodeMap.get("root")}function Ye(t){let e=ue();t!==null&&(t.dirty=!0,t._cachedNodes=null),e._selection=t}function He(t){var e=M(),n;e:{for(n=t;n!=null;){let r=n[`__lexicalKey_${e._key}`];if(r!==void 0){n=r;break e}n=n.parentNode}n=null}return n===null?(e=e.getRootElement(),t===e?L("root"):null):L(n)}function ri(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function kn(t){let e=[];for(;t!==null;)e.push(t),t=t._parentEditor;return e}function ii(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function oi(t,e){var n=window.getSelection();if(n!==null){var r=n.anchorNode,{anchorOffset:i,focusOffset:o}=n;if(r!==null&&r.nodeType===3&&(n=gt(r),N(n))){if(r=r.nodeValue,r===jt&&e){let l=e.length;r=e,o=i=l}r!==null&&Pn(n,r,i,o,t)}}}function Pn(t,e,n,r,i){let o=t;if(o.isAttached()&&(i||!o.isDirty())){var l=o.isComposing();if(t=e,(l||i)&&e[e.length-1]===jt&&(t=e.slice(0,-1)),e=o.getTextContent(),i||t!==e)if(t==="")if(Y(null),Jt||Vt)o.remove();else{let s=M();setTimeout(()=>{s.update(()=>{o.isAttached()&&o.remove()})},20)}else i=o.getParent(),e=St(),ve(o)||M()._compositionKey!==null&&!l||i!==null&&E(e)&&!i.canInsertTextBefore()&&e.anchor.offset===0?o.markDirty():(l=w(),E(l)&&n!==null&&r!==null&&(l.setTextNodeRange(o,n,o,r),o.isSegmented()&&(n=o.getTextContent(),n=Q(n),o.replace(n),o=n)),o.setTextContent(t))}}function li(t,e){var n=t.anchor,r=t.focus,i=n.getNode(),o=window.getSelection();o=o!==null?o.anchorNode:null;let l=n.key,s=M().getElementByKey(l),d=e.length;return(e=l!==r.key||!N(i)||(2>d||ri(e))&&n.offset!==r.offset&&!i.isComposing()||wn(i)||i.isDirty()&&1<d||s!==null&&!i.isComposing()&&o!==Qt(s)||i.getFormat()!==t.format)||(i.isSegmented()?e=!0:t.isCollapsed()?(t=t.anchor.offset,e=i.getParentOrThrow(),n=i.isToken(),(r=t===0)&&!(r=!i.canInsertTextBefore()||!e.canInsertTextBefore()||n)&&(r=i.getPreviousSibling(),r=(N(r)||m(r)&&r.isInline())&&!r.canInsertTextAfter()),i=i.getTextContentSize()===t&&(!i.canInsertTextBefore()||!e.canInsertTextBefore()||n),e=r||i):e=!1),e}function qt(t,e){var n=t[e];return typeof n=="string"?(n=n.split(" "),t[e]=n):n}function In(t,e,n,r,i){n.size!==0&&(n=r.__key,e=e.get(r.__type),e===void 0&&v(33),e=e.klass,r=t.get(e),r===void 0&&(r=new Map,t.set(e,r)),r.has(n)||r.set(n,i))}function si(t,e,n){let r=t.getParent(),i=n;return r!==null&&(e&&n===0?(i=t.getIndexWithinParent(),t=r):e||n!==t.getChildrenSize()||(i=t.getIndexWithinParent()+1,t=r)),t.getChildAtIndex(e?i-1:i)}function di(t,e){var n=t.offset;return t.type==="element"?(t=t.getNode(),si(t,e,n)):(t=t.getNode(),e&&n===0||!e&&n===t.getTextContentSize()?(n=e?t.getPreviousSibling():t.getNextSibling(),n===null?si(t.getParentOrThrow(),e,t.getIndexWithinParent()+(e?0:1)):n):null)}function ui(t){return t=(t=en(t).event)&&t.inputType,t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function Fn(t){return!G(t)&&!t.isLastChild()&&!t.isInline()}function bt(t,e){return t=t._keyToDOMMap.get(e),t===void 0&&v(75),t}function yl(t,e=0){if(e!==0&&v(1),e=w(),!E(e)||!m(t))return e;let{anchor:n,focus:r}=e,i=n.getNode(),o=r.getNode();return ai(i,t)&&n.set(t.__key,0,"element"),ai(o,t)&&r.set(t.__key,0,"element"),e}function ai(t,e){for(t=t.getParent();t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function en(t){return t=t._window,t===null&&v(78),t}function ci(t,e,n,r,i){t=t.__children;let o=t.length;for(let l=0;l<o;l++){let s=t[l],d=r.get(s);d!==void 0&&d.__parent===e&&(m(d)&&ci(d,s,n,r,i),n.has(s)||i.delete(s),r.delete(s))}}function vl(t,e,n,r){t=t._nodeMap,e=e._nodeMap;for(let i of n){let o=e.get(i);o===void 0||o.isAttached()||(t.has(i)||n.delete(i),e.delete(i))}for(let[i]of r)n=e.get(i),n===void 0||n.isAttached()||(m(n)&&ci(n,i,t,e,r),t.has(i)||r.delete(i),e.delete(i))}function fi(t,e){let n=t.__mode,r=t.__format;t=t.__style;let i=e.__mode,o=e.__format;return e=e.__style,(n===null||n===i)&&(r===null||r===o)&&(t===null||t===e)}function gi(t,e){let n=t.mergeWithSibling(e),r=M()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function hi(t){if(t.__text===""&&t.isSimpleText()&&!t.isUnmergeable())t.remove();else{for(var e;(e=t.getPreviousSibling())!==null&&N(e)&&e.isSimpleText()&&!e.isUnmergeable();)if(e.__text==="")e.remove();else{fi(e,t)&&(t=gi(e,t));break}for(var n;(n=t.getNextSibling())!==null&&N(n)&&n.isSimpleText()&&!n.isUnmergeable();)if(n.__text==="")n.remove();else{fi(t,n)&&gi(t,n);break}}}let F="",j="",ge="",De,X,ht,_i=!1,Bn=!1,tn,nn=null,Kn,Wn,_t,Ue,zn,pt;function rn(t,e){let n=_t.get(t);if(e!==null){let r=Un(t);e.removeChild(r)}Ue.has(t)||X._keyToDOMMap.delete(t),m(n)&&(t=n.__children,Yn(t,0,t.length-1,null)),n!==void 0&&In(pt,ht,tn,n,"destroyed")}function Yn(t,e,n,r){for(;e<=n;++e){let i=t[e];i!==void 0&&rn(i,r)}}function mt(t,e){t.setProperty("text-align",e)}function pi(t,e){t.style.setProperty("padding-inline-start",e===0?"":20*e+"px")}function mi(t,e){t=t.style,e===0?mt(t,""):e===1?mt(t,"left"):e===2?mt(t,"center"):e===3?mt(t,"right"):e===4&&mt(t,"justify")}function on(t,e,n){let r=Ue.get(t);r===void 0&&v(60);let i=r.createDOM(De,X);var o=X._keyToDOMMap;if(i["__lexicalKey_"+X._key]=t,o.set(t,i),N(r)?i.setAttribute("data-lexical-text","true"):I(r)&&i.setAttribute("data-lexical-decorator","true"),m(r)){t=r.__indent,t!==0&&pi(i,t),t=r.__children;var l=t.length;if(l!==0){o=t,--l;let s=j;j="",Hn(o,0,l,i,null),Ni(r,i),j=s}o=r.__format,o!==0&&mi(i,o),vi(null,t,i),Fn(r)&&(F+=`
|
|
2
|
+
|
|
3
|
+
`,ge+=`
|
|
4
|
+
|
|
5
|
+
`)}else o=r.getTextContent(),I(r)?(l=r.decorate(X,De),l!==null&&xi(t,l),i.contentEditable="false"):N(r)&&(r.isDirectionless()||(j+=o),r.isInert()&&(t=i.style,t.pointerEvents="none",t.userSelect="none",i.contentEditable="false",t.setProperty("-webkit-user-select","none"))),F+=o,ge+=o;return e!==null&&(n!=null?e.insertBefore(i,n):(n=e.__lexicalLineBreak,n!=null?e.insertBefore(i,n):e.appendChild(i))),In(pt,ht,tn,r,"created"),i}function Hn(t,e,n,r,i){let o=F;for(F="";e<=n;++e)on(t[e],r,i);r.__lexicalTextContent=F,F=o+F}function yi(t,e){return t=e.get(t[t.length-1]),Mt(t)||I(t)}function vi(t,e,n){t=t!==null&&(t.length===0||yi(t,_t)),e=e!==null&&(e.length===0||yi(e,Ue)),t?e||(e=n.__lexicalLineBreak,e!=null&&n.removeChild(e),n.__lexicalLineBreak=null):e&&(e=document.createElement("br"),n.__lexicalLineBreak=e,n.appendChild(e))}function Ni(t,e){var n=e.__lexicalDir;if(e.__lexicalDirTextContent!==j||n!==nn){let o=j==="";if(o)var r=nn;else r=j,r=sl.test(r)?"rtl":dl.test(r)?"ltr":null;if(r!==n){let l=e.classList,s=De.theme;var i=n!==null?s[n]:void 0;let d=r!==null?s[r]:void 0;i!==void 0&&(typeof i=="string"&&(i=i.split(" "),i=s[n]=i),l.remove(...i)),r===null||o&&r==="ltr"?e.removeAttribute("dir"):(d!==void 0&&(typeof d=="string"&&(n=d.split(" "),d=s[r]=n),d!==void 0&&l.add(...d)),e.dir=r),Bn||(t.getWritable().__dir=r)}nn=r,e.__lexicalDirTextContent=j,e.__lexicalDir=r}}function yt(t,e){var n=_t.get(t),r=Ue.get(t);n!==void 0&&r!==void 0||v(61);var i=_i||Wn.has(t)||Kn.has(t);let o=bt(X,t);if(n===r&&!i)return m(n)?(r=o.__lexicalTextContent,r!==void 0&&(F+=r,ge+=r),r=o.__lexicalDirTextContent,r!==void 0&&(j+=r)):(r=n.getTextContent(),N(n)&&!n.isDirectionless()&&(j+=r),ge+=r,F+=r),o;if(n!==r&&i&&In(pt,ht,tn,r,"updated"),r.updateDOM(n,o,De))return r=on(t,null,null),e===null&&v(62),e.replaceChild(r,o),rn(t,null),r;if(m(n)&&m(r)){if(t=r.__indent,t!==n.__indent&&pi(o,t),t=r.__format,t!==n.__format&&mi(o,t),t=n.__children,n=r.__children,t!==n||i){var l=t,s=n;i=r,e=j,j="";let h=F;F="";var d=l.length,u=s.length;if(d===1&&u===1){var a=l[0];if(s=s[0],a===s)yt(a,o);else{var c=Un(a);s=on(s,null,null),o.replaceChild(s,c),rn(a,null)}}else if(d===0)u!==0&&Hn(s,0,u-1,o,null);else if(u===0)d!==0&&(a=o.__lexicalLineBreak==null,Yn(l,0,d-1,a?null:o),a&&(o.textContent=""));else{let p=d-1;d=u-1;let x=o.firstChild,T=0;for(u=0;T<=p&&u<=d;){var f=l[T];let D=s[u];if(f===D)x=yt(D,o).nextSibling,T++,u++;else{a===void 0&&(a=new Set(l)),c===void 0&&(c=new Set(s));let R=c.has(f),P=a.has(D);R?(P?(f=bt(X,D),f===x?x=yt(D,o).nextSibling:(x!=null?o.insertBefore(f,x):o.appendChild(f),yt(D,o)),T++):on(D,o,x),u++):(x=Un(f).nextSibling,rn(f,o),T++)}}a=T>p,c=u>d,a&&!c?(a=s[d+1],a=a===void 0?null:X.getElementByKey(a),Hn(s,u,d,o,a)):c&&!a&&Yn(l,T,p,o)}Fn(i)&&(F+=`
|
|
6
|
+
|
|
7
|
+
`),o.__lexicalTextContent=F,F=h+F,Ni(i,o),j=e,G(r)||vi(t,n,o)}Fn(r)&&(F+=`
|
|
8
|
+
|
|
9
|
+
`,ge+=`
|
|
10
|
+
|
|
11
|
+
`)}else n=r.getTextContent(),I(r)?(i=r.decorate(X,De),i!==null&&xi(t,i)):N(r)&&!r.isDirectionless()&&(j+=n),F+=n,ge+=n;return!Bn&&G(r)&&r.__cachedText!==ge&&(r=r.getWritable(),r.__cachedText=ge),o}function xi(t,e){let n=X._pendingDecorators,r=X._decorators;if(n===null){if(r[t]===e)return;n=ti(X)}n[t]=e}function Un(t){return t=zn.get(t),t===void 0&&v(75),t}let he=Object.freeze({}),Gn=[["keydown",Ml],["mousedown",xl],["compositionstart",Ol],["compositionend",$l],["input",El],["click",Nl],["cut",he],["copy",he],["dragstart",he],["dragover",he],["dragend",he],["paste",he],["focus",he],["blur",he],["drop",he]];ol&&Gn.push(["beforeinput",(t,e)=>Sl(t,e)]);let vt=0,Ci=0,Nt=0,Jn=!1,Vn=!1,xt=!1,Ct=!1,Ti=[0,0,"root",0];function Si(t,e){return t!==null&&t.nodeValue!==null&&t.nodeType===3&&e!==0&&e!==t.nodeValue.length}function Ei(t,e,n){let{anchorNode:r,anchorOffset:i,focusNode:o,focusOffset:l}=t;Jn&&(Jn=!1,Si(r,i)&&Si(o,l))||q(e,()=>{if(!n)Ye(null);else if(Xt(e,r,o)){var s=w();if(E(s)){var d=s.anchor,u=d.getNode();if(s.isCollapsed()){t.type==="Range"&&(s.dirty=!0);var a=en(e).event;a=a?a.timeStamp:performance.now();let[c,f,h,p]=Ti;a<p+200&&d.offset===f&&d.key===h?s.format=c:d.type==="text"?s.format=u.getFormat():d.type==="element"&&(s.format=0)}else{d=127,u=!1,a=s.getNodes();let c=a.length;for(let f=0;f<c;f++){let h=a[f];if(N(h)&&(u=!0,d&=h.getFormat(),d===0))break}s.format=u?d:0}}y(e,$r,void 0)}})}function Nl(t,e){q(e,()=>{let n=w(),r=window.getSelection(),i=St();if(E(n)){let o=n.anchor,l=o.getNode();r&&o.type==="element"&&o.offset===0&&n.isCollapsed()&&!G(l)&&Me().getChildrenSize()===1&&l.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i)&&(r.removeAllRanges(),n.dirty=!0)}y(e,Mr,t)})}function xl(t,e){let n=t.target;n instanceof Node&&q(e,()=>{I(gt(n))||(Vn=!0)})}function Cl(t,e){e.getTargetRanges&&(e=e.getTargetRanges()[0])&&t.applyDOMRange(e)}function Tl(t,e){return t!==e||m(t)||m(e)||!ve(t)||!ve(e)}function Sl(t,e){let n=t.inputType;n==="deleteCompositionText"||Oe&&ui(e)||n!=="insertCompositionText"&&q(e,()=>{let r=w();if(n==="deleteContentBackward"){if(r===null){var i=St();if(!E(i))return;Ye(i.clone())}if(E(r)){Ci===229&&t.timeStamp<vt+30&&e.isComposing()&&r.anchor.key===r.focus.key?(Y(null),vt=0,setTimeout(()=>{q(e,()=>{Y(null)})},30),E(r)&&(i=r.anchor.getNode(),i.markDirty(),r.format=i.getFormat())):(t.preventDefault(),y(e,ut,!0));return}}if(E(r)){i=t.data,r.dirty||!r.isCollapsed()||G(r.anchor.getNode())||Cl(r,t);var o=r.focus,l=r.anchor.getNode();if(o=o.getNode(),n==="insertText"||n==="insertTranspose")i===`
|
|
12
|
+
`?(t.preventDefault(),y(e,at,!1)):i===`
|
|
13
|
+
|
|
14
|
+
`?(t.preventDefault(),y(e,Tn,void 0)):i==null&&t.dataTransfer?(i=t.dataTransfer.getData("text/plain"),t.preventDefault(),r.insertRawText(i)):i!=null&&li(r,i)&&(t.preventDefault(),y(e,Be,i));else switch(t.preventDefault(),n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":y(e,Be,t);break;case"insertFromComposition":Y(null),y(e,Be,t);break;case"insertLineBreak":Y(null),y(e,at,!1);break;case"insertParagraph":Y(null),xt?(xt=!1,y(e,at,!1)):y(e,Tn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":y(e,Sn,t);break;case"deleteByComposition":Tl(l,o)&&y(e,En,void 0);break;case"deleteByDrag":case"deleteByCut":y(e,En,void 0);break;case"deleteContent":y(e,ut,!1);break;case"deleteWordBackward":y(e,ct,!0);break;case"deleteWordForward":y(e,ct,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":y(e,ft,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":y(e,ft,!1);break;case"formatStrikeThrough":y(e,ye,"strikethrough");break;case"formatBold":y(e,ye,"bold");break;case"formatItalic":y(e,ye,"italic");break;case"formatUnderline":y(e,ye,"underline");break;case"historyUndo":y(e,On,void 0);break;case"historyRedo":y(e,$n,void 0)}}})}function El(t,e){t.stopPropagation(),q(e,()=>{var n=w(),r=t.data;r!=null&&E(n)&&li(n,r)?(Ct&&(jn(e,r),Ct=!1),y(e,Be,r),r=r.length,Oe&&1<r&&t.inputType==="insertCompositionText"&&!e.isComposing()&&(n.anchor.offset-=r),Jt||Vt||!e.isComposing()||(vt=0,Y(null))):(oi(!1),Ct&&(jn(e,r||void 0),Ct=!1)),te(),n=M(),Xr(n)})}function Ol(t,e){q(e,()=>{let n=w();if(E(n)&&!e.isComposing()){let r=n.anchor;Y(r.key),(t.timeStamp<vt+30||r.type==="element"||!n.isCollapsed()||n.anchor.getNode().getFormat()!==n.format)&&y(e,Be,ll)}})}function jn(t,e){var n=t._compositionKey;if(Y(null),n!==null&&e!=null){if(e===""){e=L(n),t=Qt(t.getElementByKey(n)),t!==null&&t.nodeValue!==null&&N(e)&&Pn(e,t.nodeValue,null,null,!0);return}if(e[e.length-1]===`
|
|
15
|
+
`&&(n=w(),E(n))){e=n.focus,n.anchor.set(e.key,e.offset,e.type),y(t,Gt,null);return}}oi(!0,e)}function $l(t,e){Oe?Ct=!0:q(e,()=>{jn(e,t.data)})}function Ml(t,e){if(t._lexicalHandled!==!0&&(t._lexicalHandled=!0,vt=t.timeStamp,Ci=t.keyCode,!e.isComposing())){var{keyCode:n,shiftKey:r,ctrlKey:i,metaKey:o,altKey:l}=t;if(n!==39||i||o||l)if(n!==39||l||r||!i&&!o)if(n!==37||i||o||l)if(n!==37||l||r||!i&&!o)if(n!==38||i||o)if(n!==40||i||o)if(n===13&&r)xt=!0,y(e,Gt,t);else if(n===32)y(e,Pr,t);else if(Z&&i&&n===79)t.preventDefault(),xt=!0,y(e,at,!0);else if(n!==13||r){var s=Z?l||o?!1:n===8||n===72&&i:i||l||o?!1:n===8;s?n===8?y(e,Ir,t):(t.preventDefault(),y(e,ut,!0)):n===27?y(e,Fr,t):(s=Z?r||l||o?!1:n===46||n===68&&i:i||l||o?!1:n===46,s?n===46?y(e,Br,t):(t.preventDefault(),y(e,ut,!1)):n===8&&(Z?l:i)?(t.preventDefault(),y(e,ct,!0)):n===46&&(Z?l:i)?(t.preventDefault(),y(e,ct,!1)):Z&&o&&n===8?(t.preventDefault(),y(e,ft,!0)):Z&&o&&n===46?(t.preventDefault(),y(e,ft,!1)):n===66&&!l&&(Z?o:i)?(t.preventDefault(),y(e,ye,"bold")):n===85&&!l&&(Z?o:i)?(t.preventDefault(),y(e,ye,"underline")):n===73&&!l&&(Z?o:i)?(t.preventDefault(),y(e,ye,"italic")):n!==9||l||i||o?n===90&&!r&&(Z?o:i)?(t.preventDefault(),y(e,On,void 0)):(s=Z?n===90&&o&&r:n===89&&i||n===90&&i&&r,s?(t.preventDefault(),y(e,$n,void 0)):Tt(e._editorState._selection)&&(s=r?!1:n===67?Z?o:i:!1,s?(t.preventDefault(),y(e,Mn,t)):(s=r?!1:n===88?Z?o:i:!1,s&&(t.preventDefault(),y(e,Dn,t))))):y(e,Kr,t))}else xt=!1,y(e,Gt,t);else y(e,kr,t);else y(e,wr,t);else y(e,Ar,t);else y(e,Lr,t);else y(e,Rr,t);else y(e,Dr,t);(i||r||l||o)&&y(e,Jr,t)}}function Oi(t){let e=t.__lexicalEventHandles;return e===void 0&&(e=[],t.__lexicalEventHandles=e),e}let Ge=new Map;function $i(){let t=window.getSelection();if(t!==null){var e=Zr(t.anchorNode);if(e!==null){Vn&&(Vn=!1,q(e,()=>{var l=St(),s=t.anchorNode;s!==null&&(s=s.nodeType,s===1||s===3)&&(l=Ki(l,t,e),Ye(l))}));var n=kn(e);n=n[n.length-1];var r=n._key,i=Ge.get(r),o=i||n;o!==e&&Ei(t,o,!1),Ei(t,e,!0),e!==n?Ge.set(r,e):i&&Ge.delete(r)}}}function Dl(t,e){Nt===0&&t.ownerDocument.addEventListener("selectionchange",$i),Nt++,t.__lexicalEditor=e;let n=Oi(t);for(let r=0;r<Gn.length;r++){let[i,o]=Gn[r],l=typeof o=="function"?s=>{e.isEditable()&&o(s,e)}:s=>{if(e.isEditable())switch(i){case"cut":return y(e,Dn,s);case"copy":return y(e,Mn,s);case"paste":return y(e,Sn,s);case"dragstart":return y(e,zr,s);case"dragover":return y(e,Yr,s);case"dragend":return y(e,Hr,s);case"focus":return y(e,Ur,s);case"blur":return y(e,Gr,s);case"drop":return y(e,Wr,s)}};t.addEventListener(i,l),n.push(()=>{t.removeEventListener(i,l)})}}class de{constructor(e,n,r){this._selection=null,this.key=e,this.offset=n,this.type=r}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let n=this.getNode(),r=e.getNode(),i=this.offset;if(e=e.offset,m(n)){var o=n.getDescendantByIndex(i);n=o!=null?o:n}return m(r)&&(o=r.getDescendantByIndex(e),r=o!=null?o:r),n===r?i<e:n.isBefore(r)}getNode(){let e=L(this.key);return e===null&&v(20),e}set(e,n,r){let i=this._selection,o=this.key;this.key=e,this.offset=n,this.type=r,K||(M()._compositionKey===o&&Y(e),i!==null&&(i._cachedNodes=null,i.dirty=!0))}}function Xn(t,e){let n=e.__key,r=t.offset,i="element";if(N(e))i="text",e=e.getTextContentSize(),r>e&&(r=e);else if(!m(e)){var o=e.getNextSibling();N(o)?(n=o.__key,r=0):(o=e.getParent())&&(n=o.__key,r=e.getIndexWithinParent()+1)}t.set(n,r,i)}function Mi(t,e){if(m(e)){let n=e.getLastDescendant();m(n)||N(n)?Xn(t,n):Xn(t,e)}else Xn(t,e)}function Di(t,e,n){let r=t.getNode(),i=r.getChildAtIndex(t.offset),o=Q(),l=G(r)?Ze().append(o):o;o.setFormat(n),i===null?r.append(l):i.insertBefore(l),t.is(e)&&e.set(o.__key,0,"text"),t.set(o.__key,0,"text")}function Ne(t,e,n,r){t.key=e,t.offset=n,t.type=r}class ln{constructor(e){this.dirty=!1,this._nodes=e,this._cachedNodes=null}is(e){if(!Tt(e))return!1;let n=this._nodes,r=e._nodes;return n.size===r.size&&Array.from(n).every(i=>r.has(i))}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new ln(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}getNodes(){var e=this._cachedNodes;if(e!==null)return e;var n=this._nodes;e=[];for(let r of n)n=L(r),n!==null&&e.push(n);return K||(this._cachedNodes=e),e}getTextContent(){let e=this.getNodes(),n="";for(let r=0;r<e.length;r++)n+=e[r].getTextContent();return n}}function E(t){return t instanceof Je}class sn{constructor(e,n,r){this.gridKey=e,this.anchor=n,this.focus=r,this.dirty=!1,this._cachedNodes=null,n._selection=this,r._selection=this}is(e){return Qn(e)?this.gridKey===e.gridKey&&this.anchor.is(this.focus):!1}set(e,n,r){this.dirty=!0,this.gridKey=e,this.anchor.key=n,this.focus.key=r,this._cachedNodes=null}clone(){return new sn(this.gridKey,this.anchor,this.focus)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}getCharacterOffsets(){return dn(this)}extract(){return this.getNodes()}insertRawText(){}insertText(){}getShape(){var e=L(this.anchor.key);e===null&&v(21);var n=e.getIndexWithinParent();e=e.getParentOrThrow().getIndexWithinParent();var r=L(this.focus.key);r===null&&v(22);var i=r.getIndexWithinParent();let o=r.getParentOrThrow().getIndexWithinParent();return r=Math.min(n,i),n=Math.max(n,i),i=Math.min(e,o),e=Math.max(e,o),{fromX:Math.min(r,n),fromY:Math.min(i,e),toX:Math.max(r,n),toY:Math.max(i,e)}}getNodes(){var e=this._cachedNodes;if(e!==null)return e;e=new Set;let{fromX:n,fromY:r,toX:i,toY:o}=this.getShape();var l=L(this.gridKey);bi(l)||v(23),e.add(l),l=l.getChildren();for(let u=r;u<=o;u++){var s=l[u];e.add(s),to(s)||v(24),s=s.getChildren();for(let a=n;a<=i;a++){var d=s[a];for(Zi(d)||v(25),e.add(d),d=d.getChildren();0<d.length;){let c=d.shift();e.add(c),m(c)&&d.unshift(...c.getChildren())}}}return e=Array.from(e),K||(this._cachedNodes=e),e}getTextContent(){let e=this.getNodes(),n="";for(let r=0;r<e.length;r++)n+=e[r].getTextContent();return n}}function Qn(t){return t instanceof sn}class Je{constructor(e,n,r){this.anchor=e,this.focus=n,this.dirty=!1,this.format=r,this._cachedNodes=null,e._selection=this,n._selection=this}is(e){return E(e)?this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format:!1}isBackward(){return this.focus.isBefore(this.anchor)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){var e=this._cachedNodes;if(e!==null)return e;var n=this.anchor,r=this.focus;e=n.getNode();let i=r.getNode();return m(e)&&(n=e.getDescendantByIndex(n.offset),e=n!=null?n:e),m(i)&&(r=i.getDescendantByIndex(r.offset),i=r!=null?r:i),e=e.is(i)?m(e)&&(0<e.getChildrenSize()||e.excludeFromCopy())?[]:[e]:e.getNodesBetween(i),K||(this._cachedNodes=e),e}setTextNodeRange(e,n,r,i){Ne(this.anchor,e.__key,n,"text"),Ne(this.focus,r.__key,i,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){let e=this.getNodes();if(e.length===0)return"";let n=e[0],r=e[e.length-1],i=this.anchor.isBefore(this.focus),[o,l]=dn(this),s="",d=!0;for(let u=0;u<e.length;u++){let a=e[u];if(m(a)&&!a.isInline())d||(s+=`
|
|
16
|
+
`),d=!a.isEmpty();else if(d=!1,N(a)){let c=a.getTextContent();a===n?c=a===r?o<l?c.slice(o,l):c.slice(l,o):i?c.slice(o):c.slice(l):a===r&&(c=i?c.slice(0,l):c.slice(0,o)),s+=c}else!I(a)&&!Mt(a)||a===r&&this.isCollapsed()||(s+=a.getTextContent())}return s}applyDOMRange(e){let n=M(),r=n.getEditorState()._selection;if(e=Pi(e.startContainer,e.startOffset,e.endContainer,e.endOffset,n,r),e!==null){var[i,o]=e;Ne(this.anchor,i.key,i.offset,i.type),Ne(this.focus,o.key,o.offset,o.type),this._cachedNodes=null}}clone(){let e=this.anchor,n=this.focus;return new Je(new de(e.key,e.offset,e.type),new de(n.key,n.offset,n.type),this.format)}toggleFormat(e){this.format=qr(this.format,e,null),this.dirty=!0}hasFormat(e){return(this.format&$e[e])!==0}insertRawText(e){let n=e.split(/\r?\n/);if(n.length===1)this.insertText(e);else{e=[];let r=n.length;for(let i=0;i<r;i++){let o=n[i];o!==""&&e.push(Q(o)),i!==r-1&&e.push($t())}this.insertNodes(e)}}insertText(e){var n=this.anchor,r=this.focus,i=this.isCollapsed()||n.isBefore(r),o=this.format;i&&n.type==="element"?Di(n,r,o):i||r.type!=="element"||Di(r,n,o);var l=this.getNodes(),s=l.length,d=i?r:n;r=(i?n:r).offset;var u=d.offset;n=l[0],N(n)||v(26),i=n.getTextContent().length;var a=n.getParentOrThrow(),c=l[s-1];if(this.isCollapsed()&&r===i&&(n.isSegmented()||n.isToken()||!n.canInsertTextAfter()||!a.canInsertTextAfter()&&n.getNextSibling()===null)){var f=n.getNextSibling();if((!N(f)||wn(f))&&(f=Q(),f.setFormat(o),a.canInsertTextAfter()?n.insertAfter(f):a.insertAfter(f)),f.select(0,0),n=f,e!==""){this.insertText(e);return}}else if(this.isCollapsed()&&r===0&&(n.isSegmented()||n.isToken()||!n.canInsertTextBefore()||!a.canInsertTextBefore()&&n.getPreviousSibling()===null)){if(f=n.getPreviousSibling(),(!N(f)||wn(f))&&(f=Q(),f.setFormat(o),a.canInsertTextBefore()?n.insertBefore(f):a.insertBefore(f)),f.select(),n=f,e!==""){this.insertText(e);return}}else if(n.isSegmented()&&r!==i)a=Q(n.getTextContent()),a.setFormat(o),n.replace(a),n=a;else if(!(this.isCollapsed()||e===""||(f=c.getParent(),a.canInsertTextBefore()&&a.canInsertTextAfter()&&(!m(f)||f.canInsertTextBefore()&&f.canInsertTextAfter())))){this.insertText(""),ki(this.anchor,this.focus,null),this.insertText(e);return}if(s===1)if(ve(n))e=Q(e),e.select(),n.replace(e);else{if(l=n.getFormat(),r===u&&l!==o)if(n.getTextContent()==="")n.setFormat(o);else{l=Q(e),l.setFormat(o),l.select(),r===0?n.insertBefore(l):([s]=n.splitText(r),s.insertAfter(l)),l.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);return}n=n.spliceText(r,u-r,e,!0),n.getTextContent()===""?n.remove():this.anchor.type==="text"&&(n.isComposing()?this.anchor.offset-=e.length:this.format=l)}else{o=new Set([...n.getParentKeys(),...c.getParentKeys()]);var h=m(n)?n:n.getParentOrThrow();if(a=m(c)?c:c.getParentOrThrow(),f=c,!h.is(a)&&a.isInline())do f=a,a=a.getParentOrThrow();while(a.isInline());d.type==="text"&&(u!==0||c.getTextContent()==="")||d.type==="element"&&c.getIndexWithinParent()<u?N(c)&&!ve(c)&&u!==c.getTextContentSize()?(c.isSegmented()&&(d=Q(c.getTextContent()),c.replace(d),c=d),c=c.spliceText(0,u,""),o.add(c.__key)):(d=c.getParentOrThrow(),d.canBeEmpty()||d.getChildrenSize()!==1?c.remove():d.remove()):o.add(c.__key),d=a.getChildren(),u=new Set(l),c=h.is(a),h=h.isInline()&&n.getNextSibling()===null?h:n;for(let p=d.length-1;0<=p;p--){let x=d[p];if(x.is(n)||m(x)&&x.isParentOf(n))break;x.isAttached()&&(!u.has(x)||x.is(f)?c||h.insertAfter(x):x.remove())}if(!c)for(d=a,u=null;d!==null;)c=d.getChildren(),a=c.length,(a===0||c[a-1].is(u))&&(o.delete(d.__key),u=d),d=d.getParent();for(ve(n)?r===i?n.select():(e=Q(e),e.select(),n.replace(e)):(n=n.spliceText(r,i-r,e,!0),n.getTextContent()===""?n.remove():n.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length)),e=1;e<s;e++)n=l[e],o.has(n.__key)||n.remove()}}removeText(){this.insertText("")}formatText(e){if(this.isCollapsed())this.toggleFormat(e),Y(null);else{var n=this.getNodes(),r=[];for(var i of n)N(i)&&r.push(i);var o=r.length;if(o===0)this.toggleFormat(e),Y(null);else{i=this.anchor;var l=this.focus,s=this.isBackward();n=s?l:i,i=s?i:l;var d=0,u=r[0];if(l=n.type==="element"?0:n.offset,n.type==="text"&&l===u.getTextContentSize()&&(d=1,u=r[1],l=0),u!=null){s=u.getFormatFlags(e,null);var a=o-1,c=r[a];if(o=i.type==="text"?i.offset:c.getTextContentSize(),u.is(c))l!==o&&(l===0&&o===u.getTextContentSize()?u.setFormat(s):(e=u.splitText(l,o),e=l===0?e[0]:e[1],e.setFormat(s),n.type==="text"&&n.set(e.__key,0,"text"),i.type==="text"&&i.set(e.__key,o-l,"text")),this.format=s);else{l!==0&&([,u]=u.splitText(l),l=0),u.setFormat(s);var f=c.getFormatFlags(e,s);for(0<o&&(o!==c.getTextContentSize()&&([c]=c.splitText(o)),c.setFormat(f)),d+=1;d<a;d++){let h=r[d];if(!h.isToken()){let p=h.getFormatFlags(e,f);h.setFormat(p)}}n.type==="text"&&n.set(u.__key,l,"text"),i.type==="text"&&i.set(c.__key,o,"text"),this.format=s|f}}}}}insertNodes(e,n){this.isCollapsed()||this.removeText();var r=this.anchor,i=r.offset,o=r.getNode(),l=o;r.type==="element"&&(l=r.getNode(),r=l.getChildAtIndex(i-1),l=r===null?l:r),r=[];var s=o.getNextSiblings(),d=G(o)?null:o.getTopLevelElementOrThrow();if(N(o))if(l=o.getTextContent().length,i===0&&l!==0)l=o.getPreviousSibling(),l=l!==null?l:o.getParentOrThrow(),r.push(o);else if(i===l)l=o;else{if(ve(o))return!1;[l,o]=o.splitText(i),r.push(o)}o=l,r.push(...s),s=e[0];var u=!1,a=null;for(let p=0;p<e.length;p++){var c=e[p];if(m(c)&&!c.isInline()){if(c.is(s)){if(m(l)&&l.isEmpty()&&l.canReplaceWith(c)){l.replace(c),l=c,u=!0;continue}var f=c.getFirstDescendant();if(br(f)){for(f=f.getParentOrThrow();f.isInline();)f=f.getParentOrThrow();if(a=f.getChildren(),u=a.length,m(l))for(var h=0;h<u;h++)l.append(a[h]);else{for(h=u-1;0<=h;h--)l.insertAfter(a[h]);l=l.getParentOrThrow()}if(a=a[u-1],f.remove(),u=!0,f.is(c))continue}}N(l)&&(d===null&&v(27),l=d)}else u&&!I(c)&&G(l.getParent())&&v(28);u=!1,m(l)&&!l.isInline()?(a=c,I(c)&&c.isTopLevel()?l=l.insertAfter(c):m(c)?(c.canBeEmpty()||!c.isEmpty())&&(G(l)?(f=l.getChildAtIndex(i),f!==null?f.insertBefore(c):l.append(c),l=c):l=l.insertAfter(c)):(f=l.getFirstChild(),f!==null?f.insertBefore(c):l.append(c),l=c)):!m(c)||m(c)&&c.isInline()||I(l)&&l.isTopLevel()?(a=c,l=l.insertAfter(c)):(c=l.getParentOrThrow(),Mt(l)&&l.remove(),l=c,p--)}if(n&&(N(o)?o.select():(e=l.getPreviousSibling(),N(e)?e.select():(e=l.getIndexWithinParent(),l.getParentOrThrow().select(e,e)))),m(l)){if(e=N(a)?a:m(a)&&a.isInline()?a.getLastDescendant():l.getLastDescendant(),n||(e===null?l.select():N(e)?e.select():e.selectNext()),r.length!==0)for(n=l,e=r.length-1;0<=e;e--)i=r[e],d=i.getParentOrThrow(),!m(l)||Ii(i)||I(i)&&i.isTopLevel()?m(l)||Ii(i)?m(i)&&!i.canInsertAfter(l)?(o=d.constructor.clone(d),m(o)||v(29),o.append(i),l.insertAfter(o)):l.insertAfter(i):(l.insertBefore(i),l=i):(n===l?l.append(i):l.insertBefore(i),l=i),d.isEmpty()&&!d.canBeEmpty()&&d.remove()}else n||(N(l)?l.select():(r=l.getParentOrThrow(),l=l.getIndexWithinParent()+1,r.select(l,l)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var e=this.anchor,n=e.offset,r=[];if(e.type==="text"){var i=e.getNode(),o=i.getNextSiblings().reverse(),l=i.getParentOrThrow(),s=l.isInline(),d=s?l.getTextContentSize():i.getTextContentSize();n===0?o.push(i):(s&&(r=l.getNextSiblings()),n===d||s&&n===i.getTextContentSize()||([,i]=i.splitText(n),o.push(i)))}else{if(l=e.getNode(),G(l)){o=Ze(),r=l.getChildAtIndex(n),o.select(),r!==null?r.insertBefore(o):l.append(o);return}o=l.getChildren().slice(n).reverse()}if(i=o.length,n===0&&0<i&&l.isInline()){if(r=l.getParentOrThrow(),o=r.insertNewAfter(this),m(o))for(r=r.getChildren(),l=0;l<r.length;l++)o.append(r[l])}else if(s=l.insertNewAfter(this),s===null)this.insertLineBreak();else if(m(s))if(d=l.getFirstChild(),n===0&&(l.is(e.getNode())||d&&d.is(e.getNode()))&&0<i)l.insertBefore(s);else{if(l=null,n=r.length,e=s.getParentOrThrow(),0<n)for(d=0;d<n;d++)e.append(r[d]);if(i!==0)for(r=0;r<i;r++)n=o[r],l===null?s.append(n):l.insertBefore(n),l=n;s.canBeEmpty()||s.getChildrenSize()!==0?s.selectStart():(s.selectPrevious(),s.remove())}}insertLineBreak(e){let n=$t();var r=this.anchor;r.type==="element"&&(r=r.getNode(),G(r)&&this.insertParagraph()),e?this.insertNodes([n],!0):this.insertNodes([n])&&n.selectNext(0,0)}getCharacterOffsets(){return dn(this)}extract(){var e=this.getNodes(),n=e.length,r=n-1,i=this.anchor;let o=this.focus;var l=e[0];let s=e[r],[d,u]=dn(this);return n===0?[]:n===1?N(l)&&!this.isCollapsed()?(e=d>u?u:d,r=l.splitText(e,d>u?d:u),e=e===0?r[0]:r[1],e!=null?[e]:[]):[l]:(n=i.isBefore(o),N(l)&&(i=n?d:u,i===l.getTextContentSize()?e.shift():i!==0&&([,l]=l.splitText(i),e[0]=l)),N(s)&&(l=s.getTextContent().length,n=n?u:d,n===0?e.pop():n!==l&&([s]=s.splitText(n),e[r]=s)),e)}modify(e,n,r){var i=this.focus,o=this.anchor,l=e==="move",s=di(i,n);I(s)&&!s.isIsolated()?l?(l=Bi(),l.add(s.__key),Ye(l)):(e=n?s.getPreviousSibling():s.getNextSibling(),N(e)?(s=e.__key,n=n?e.getTextContent().length:0,i.set(s,n,"text"),l&&o.set(s,n,"text")):(r=s.getParentOrThrow(),m(e)?(r=e.__key,s=n?e.getChildrenSize():0):(s=s.getIndexWithinParent(),r=r.__key,n||s++),i.set(r,s,"element"),l&&o.set(r,s,"element"))):(i=window.getSelection())&&(i.modify(e,n?"backward":"forward",r),0<i.rangeCount&&(n=i.getRangeAt(0),this.applyDOMRange(n),this.dirty=!0,l||i.anchorNode===n.startContainer&&i.anchorOffset===n.startOffset||(l=this.focus,n=this.anchor,i=n.key,o=n.offset,s=n.type,Ne(n,l.key,l.offset,l.type),Ne(l,i,o,s),this._cachedNodes=null)))}deleteCharacter(e){if(this.isCollapsed()){var n=this.anchor,r=this.focus,i=n.getNode();if(!e&&(n.type==="element"&&m(i)&&n.offset===i.getChildrenSize()||n.type==="text"&&n.offset===i.getTextContentSize())&&(i=i.getNextSibling()||i.getParentOrThrow().getNextSibling(),m(i)&&!i.canExtractContents()))return;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&n.offset===0&&(n.type==="element"?n.getNode():n.getNode().getParentOrThrow()).collapseAtStart(this))return}else{var o=r.type==="text"?r.getNode():null;if(i=n.type==="text"?n.getNode():null,o!==null&&o.isSegmented()){if(n=r.offset,r=o.getTextContentSize(),o.is(i)||e&&n!==r||!e&&n!==0){Li(o,e,n);return}}else if(i!==null&&i.isSegmented()&&(n=n.offset,r=i.getTextContentSize(),i.is(o)||e&&n!==0||!e&&n!==r)){Li(i,e,n);return}if(i=this.anchor,o=this.focus,n=i.getNode(),r=o.getNode(),n===r&&i.type==="text"&&o.type==="text"){var l=i.offset,s=o.offset;let d=l<s;r=d?l:s,s=d?s:l,l=s-1,r!==l&&(n=n.getTextContent().slice(r,s),ri(n)||(e?o.offset=l:i.offset=l))}}}this.removeText()}deleteLine(e){this.isCollapsed()&&(this.anchor.type==="text"&&this.modify("extend",e,"lineboundary"),(e?this.focus:this.anchor).offset===0&&this.modify("extend",e,"character")),this.removeText()}deleteWord(e){this.isCollapsed()&&this.modify("extend",e,"word"),this.removeText()}}function Tt(t){return t instanceof ln}function Ri(t){let e=t.offset;return t.type==="text"?e:(t=t.getNode(),e===t.getChildrenSize()?t.getTextContent().length:0)}function dn(t){let e=t.anchor;return t=t.focus,e.type==="element"&&t.type==="element"&&e.key===t.key&&e.offset===t.offset?[0,0]:[Ri(e),Ri(t)]}function Li(t,e,n){let r=t.getTextContent().split(/(?=\s)/g),i=r.length,o=0,l=0;for(let s=0;s<i;s++){let d=r[s],u=s===i-1;if(l=o,o+=d.length,e&&o===n||o>n||u){r.splice(s,1),u&&(l=void 0);break}}e=r.join("").trim(),e===""?t.remove():(t.setTextContent(e),t.select(l,l))}function Ai(t,e,n){var r=e;if(t.nodeType===1){let l=!1;var i=t.childNodes,o=i.length;if(r===o&&(l=!0,r=o-1),i=He(i[r]),N(i))r=l?i.getTextContentSize():0;else{if(o=He(t),o===null)return null;if(m(o)?(t=o.getChildAtIndex(r),(e=m(t))&&(e=t.getParent(),e=n===null||e===null||!e.canBeEmpty()||e!==n.getNode()),e&&(n=l?t.getLastDescendant():t.getFirstDescendant(),n===null?(o=t,r=0):(t=n,o=t.getParentOrThrow())),N(t)?(i=t,o=null,r=l?t.getTextContentSize():0):t!==o&&l&&r++):(r=o.getIndexWithinParent(),r=e===0&&I(o)&&He(t)===o?r:r+1,o=o.getParentOrThrow()),m(o))return new de(o.__key,r,"element")}}else i=He(t);return N(i)?new de(i.__key,r,"text"):null}function wi(t,e,n){var r=t.offset,i=t.getNode();r===0?(r=i.getPreviousSibling(),i=i.getParent(),e?(n||!e)&&r===null&&m(i)&&i.isInline()&&(e=i.getPreviousSibling(),N(e)&&(t.key=e.__key,t.offset=e.getTextContent().length)):m(r)&&!n&&r.isInline()?(t.key=r.__key,t.offset=r.getChildrenSize(),t.type="element"):N(r)&&!r.isInert()&&(t.key=r.__key,t.offset=r.getTextContent().length)):r===i.getTextContent().length&&(r=i.getNextSibling(),i=i.getParent(),e&&m(r)&&r.isInline()?(t.key=r.__key,t.offset=0,t.type="element"):(n||e)&&r===null&&m(i)&&i.isInline()&&!i.canInsertTextAfter()&&(e=i.getNextSibling(),N(e)&&(t.key=e.__key,t.offset=0)))}function ki(t,e,n){if(t.type==="text"&&e.type==="text"){var r=t.isBefore(e);let i=t.is(e);wi(t,r,i),wi(e,!r,i),i&&(e.key=t.key,e.offset=t.offset,e.type=t.type),r=M(),r.isComposing()&&r._compositionKey!==t.key&&E(n)&&(r=n.anchor,n=n.focus,Ne(t,r.key,r.offset,r.type),Ne(e,n.key,n.offset,n.type))}}function Pi(t,e,n,r,i,o){return t===null||n===null||!Xt(i,t,n)||(e=Ai(t,e,E(o)?o.anchor:null),e===null)||(r=Ai(n,r,E(o)?o.focus:null),r===null||e.type==="element"&&r.type==="element"&&(t=He(t),n=He(n),I(t)&&I(n)))?null:(ki(e,r,o),[e,r])}function Ii(t){return m(t)&&!t.isInline()}function Fi(t,e,n,r,i,o){let l=ue();return t=new Je(new de(t,e,i),new de(n,r,o),0),t.dirty=!0,l._selection=t}function Bi(){return new ln(new Set)}function Rl(t){let e=t.getEditorState()._selection,n=window.getSelection();return Tt(e)||Qn(e)?e.clone():Ki(e,n,t)}function Ki(t,e,n){var r=n._window;if(r===null)return null;var i=r.event,o=i?i.type:void 0;r=o==="selectionchange",i=!Rn&&(r||o==="beforeinput"||o==="compositionstart"||o==="compositionend"||o==="click"&&i&&i.detail===3||o===void 0);let l;if(!E(t)||i){if(e===null)return null;if(i=e.anchorNode,o=e.focusNode,l=e.anchorOffset,e=e.focusOffset,r&&E(t)&&!Xt(n,i,o))return t.clone()}else return t.clone();if(n=Pi(i,l,o,e,n,t),n===null)return null;let[s,d]=n;return new Je(s,d,E(t)?t.format:0)}function w(){return ue()._selection}function St(){return M()._editorState._selection}function un(t,e,n,r=1){var i=t.anchor,o=t.focus,l=i.getNode(),s=o.getNode();if(e.is(l)||e.is(s))if(l=e.__key,t.isCollapsed())e=i.offset,n<=e&&(n=Math.max(0,e+r),i.set(l,n,"element"),o.set(l,n,"element"),Wi(t));else{var d=t.isBackward();s=d?o:i;var u=s.getNode();i=d?i:o,o=i.getNode(),e.is(u)&&(u=s.offset,n<=u&&s.set(l,Math.max(0,u+r),"element")),e.is(o)&&(e=i.offset,n<=e&&i.set(l,Math.max(0,e+r),"element")),Wi(t)}}function Wi(t){var e=t.anchor,n=e.offset;let r=t.focus;var i=r.offset,o=e.getNode(),l=r.getNode();if(t.isCollapsed())m(o)&&(l=o.getChildrenSize(),l=(i=n>=l)?o.getChildAtIndex(l-1):o.getChildAtIndex(n),N(l)&&(n=0,i&&(n=l.getTextContentSize()),e.set(l.__key,n,"text"),r.set(l.__key,n,"text")));else{if(m(o)){let s=o.getChildrenSize();n=(t=n>=s)?o.getChildAtIndex(s-1):o.getChildAtIndex(n),N(n)&&(o=0,t&&(o=n.getTextContentSize()),e.set(n.__key,o,"text"))}m(l)&&(n=l.getChildrenSize(),i=(e=i>=n)?l.getChildAtIndex(n-1):l.getChildAtIndex(i),N(i)&&(l=0,e&&(l=i.getTextContentSize()),r.set(i.__key,l,"text")))}}function Ll(t,e){if(e=e.getEditorState()._selection,t=t._selection,E(t)){var n=t.anchor;let r=t.focus,i;n.type==="text"&&(i=n.getNode(),i.selectionTransform(e,t)),r.type==="text"&&(n=r.getNode(),i!==n&&n.selectionTransform(e,t))}}function an(t,e,n,r,i){let o=null,l=0,s=null;r!==null?(o=r.__key,N(r)?(l=r.getTextContentSize(),s="text"):m(r)&&(l=r.getChildrenSize(),s="element")):i!==null&&(o=i.__key,N(i)?s="text":m(i)&&(s="element")),o!==null&&s!==null?t.set(o,l,s):(l=e.getIndexWithinParent(),l===-1&&(l=n.getChildrenSize()),t.set(n.__key,l,"element"))}function zi(t,e,n,r,i){t.type==="text"?(t.key=n,e||(t.offset+=i)):t.offset>r.getIndexWithinParent()&&--t.offset}let U=null,B=null,K=!1,Zn=!1,Et=0;function te(){K&&v(13)}function ue(){return U===null&&v(15),U}function M(){return B===null&&v(16),B}function Yi(t,e,n){var r=e.__type;let i=t._nodes.get(r);for(i===void 0&&v(30),t=n.get(r),t===void 0&&(t=Array.from(i.transforms),n.set(r,t)),n=t.length,r=0;r<n&&(t[r](e),e.isAttached());r++);}function Al(t,e){e=e._dirtyLeaves,t=t._nodeMap;for(let n of e)e=t.get(n),N(e)&&e.isAttached()&&e.isSimpleText()&&!e.isUnmergeable()&&hi(e)}function wl(t,e){let n=e._dirtyLeaves,r=e._dirtyElements;t=t._nodeMap;let i=M()._compositionKey,o=new Map;var l=n;let s=l.size;for(var d=r,u=d.size;0<s||0<u;){if(0<s){e._dirtyLeaves=new Set;for(let a of l)l=t.get(a),N(l)&&l.isAttached()&&l.isSimpleText()&&!l.isUnmergeable()&&hi(l),l!==void 0&&l!==void 0&&l.__key!==i&&l.isAttached()&&Yi(e,l,o),n.add(a);if(l=e._dirtyLeaves,s=l.size,0<s){Et++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map;for(let a of d)d=a[0],u=a[1],(d==="root"||u)&&(l=t.get(d),l!==void 0&&l!==void 0&&l.__key!==i&&l.isAttached()&&Yi(e,l,o),r.set(d,u));l=e._dirtyLeaves,s=l.size,d=e._dirtyElements,u=d.size,Et++}e._dirtyLeaves=n,e._dirtyElements=r}function qn(t,e){var n=e.get(t.type);if(n===void 0&&v(17),n=n.klass,t.type!==n.getType()&&v(18),n=n.importJSON(t),t=t.children,m(n)&&Array.isArray(t))for(let r=0;r<t.length;r++){let i=qn(t[r],e);n.append(i)}return n}function Hi(t,e){let n=U,r=K,i=B;U=t,K=!0,B=null;try{return e()}finally{U=n,K=r,B=i}}function Re(t){var e=t._pendingEditorState,n=t._rootElement,r=t._headless;if((n!==null||r)&&e!==null){var i=t._editorState,o=i._selection,l=e._selection,s=t._dirtyType!==0,d=U,u=K,a=B,c=t._updating,f=t._observer,h=null;if(t._pendingEditorState=null,t._editorState=e,!r&&s&&f!==null){B=t,U=e,K=!1,t._updating=!0;try{var p=t._dirtyType,x=t._dirtyElements,T=t._dirtyLeaves;f.disconnect(),j=ge=F="",_i=p===2,nn=null,X=t,De=t._config,ht=t._nodes,tn=X._listeners.mutation,Kn=x,Wn=T,_t=i._nodeMap,Ue=e._nodeMap,Bn=e._readOnly,zn=new Map(t._keyToDOMMap);var D=new Map;pt=D,yt("root",null),pt=zn=De=Ue=_t=Wn=Kn=ht=X=void 0,h=D}catch(ce){if(ce instanceof Error&&t._onError(ce),Zn)throw ce;Xi(t,null,n,e),Qr(t),t._dirtyType=2,Zn=!0,Re(t),Zn=!1;return}finally{f.observe(n,{characterData:!0,childList:!0,subtree:!0}),t._updating=c,U=d,K=u,B=a}}e._readOnly||(e._readOnly=!0),c=t._dirtyLeaves,f=t._dirtyElements,D=t._normalizedNodes,p=t._updateTags,T=t._pendingDecorators,u=t._deferred,s&&(t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements=new Map,t._normalizedNodes=new Set,t._updateTags=new Set),x=t._decorators;var R=t._pendingDecorators||x,P=e._nodeMap;for(Yt in R)P.has(Yt)||(R===x&&(R=ti(t)),delete R[Yt]);if(r=r?null:window.getSelection(),t._editable&&r!==null&&(s||l===null||l.dirty)){B=t,U=e;try{e:{let ce=r.anchorNode,lt=r.focusNode,sd=r.anchorOffset,dd=r.focusOffset,Cn=document.activeElement;if(!p.has("collaboration")||Cn===n)if(E(l)){var z=l.anchor,le=l.focus,zt=z.key,Ee=le.key,ot=bt(t,zt),qo=bt(t,Ee),xr=z.offset,bo=le.offset,Cr=l.format,el=l.isCollapsed();s=ot,Ee=qo;var Yt=!1;if(z.type==="text"&&(s=Qt(ot),Yt=z.getNode().getFormat()!==Cr),le.type==="text"&&(Ee=Qt(qo)),s!==null&&Ee!==null){if(el&&(o===null||Yt||E(o)&&o.format!==Cr)){var ld=performance.now();Ti=[Cr,xr,zt,ld]}if(sd===xr&&dd===bo&&ce===s&<===Ee&&(r.type!=="Range"||!el)&&(n===null||Cn!==null&&n.contains(Cn)||n.focus({preventScroll:!0}),!Vt&&!Jt||z.type!=="element"))break e;try{if(r.setBaseAndExtent(s,xr,Ee,bo),l.isCollapsed()&&n!==null&&n===Cn){let Ht=z.getNode();if(m(Ht)){let Ie=Ht.getDescendantByIndex(z.offset);Ie!==null&&(Ht=Ie)}let st=t.getElementByKey(Ht.__key);if(st!==null){let Ie=st.getBoundingClientRect();if(Ie.bottom>en(t).innerHeight)st.scrollIntoView(!1);else if(0>Ie.top)st.scrollIntoView();else{let tl=n.getBoundingClientRect();Math.floor(Ie.bottom)>Math.floor(tl.bottom)?st.scrollIntoView(!1):Math.floor(Ie.top)<Math.floor(tl.top)&&st.scrollIntoView()}p.add("scroll-into-view")}}Jn=!0}catch{}}}else o!==null&&Xt(t,ce,lt)&&r.removeAllRanges()}}finally{B=a,U=d}}if(h!==null)for(n=h,o=Array.from(t._listeners.mutation),l=o.length,d=0;d<l;d++){let[ce,lt]=o[d];a=n.get(lt),a!==void 0&&ce(a,{dirtyLeaves:c,updateTags:p})}if(T!==null&&(t._decorators=T,t._pendingDecorators=null,Ot("decorator",t,!0,T)),n=ni(i),o=ni(e),n!==o&&Ot("textcontent",t,!0,o),Ot("update",t,!0,{dirtyElements:f,dirtyLeaves:c,editorState:e,normalizedNodes:D,prevEditorState:i,tags:p}),t._deferred=[],u.length!==0){e=t._updating,t._updating=!0;try{for(i=0;i<u.length;i++)u[i]()}finally{t._updating=e}}if(e=t._updates,e.length!==0&&(e=e.shift())){let[ce,lt]=e;Gi(t,ce,lt)}}}function Ot(t,e,n,...r){let i=e._updating;e._updating=n;try{let o=Array.from(e._listeners[t]);for(t=0;t<o.length;t++)o[t].apply(null,r)}finally{e._updating=i}}function y(t,e,n){if(t._updating===!1||B!==t){let o=!1;return t.update(()=>{o=y(t,e,n)}),o}let r=kn(t);for(let o=4;0<=o;o--)for(let l=0;l<r.length;l++){var i=r[l]._commands.get(e);if(i!==void 0&&(i=i[o],i!==void 0)){i=Array.from(i);let s=i.length;for(let d=0;d<s;d++)if(i[d](n,t)===!0)return!0}}return!1}function Ui(t,e){let n=t._updates;for(e=e||!1;n.length!==0;){var r=n.shift();if(r){let[i,o]=r,l;o!==void 0&&(r=o.onUpdate,l=o.tag,o.skipTransforms&&(e=!0),r&&t._deferred.push(r),l&&t._updateTags.add(l)),i()}}return e}function Gi(t,e,n){let r=t._updateTags;var i=!1;if(n!==void 0){var o=n.onUpdate;i=n.tag,i!=null&&r.add(i),i=n.skipTransforms||!1}o&&t._deferred.push(o),n=t._editorState,o=t._pendingEditorState;let l=!1;(o===null||o._readOnly)&&(o=t._pendingEditorState=new fn(new Map(n._nodeMap)),l=!0);let s=U,d=K,u=B,a=t._updating;U=o,K=!1,t._updating=!0,B=t;try{l&&!t._headless&&(o._selection=Rl(t));let c=t._compositionKey;e(),i=Ui(t,i),Ll(o,t),t._dirtyType!==0&&(i?Al(o,t):wl(o,t),Ui(t),vl(n,o,t._dirtyLeaves,t._dirtyElements)),c!==t._compositionKey&&(o._flushSync=!0);let f=o._selection;if(E(f)){let h=o._nodeMap,p=f.focus.key;h.get(f.anchor.key)!==void 0&&h.get(p)!==void 0||v(19)}else Tt(f)&&f._nodes.size===0&&(o._selection=null)}catch(c){c instanceof Error&&t._onError(c),t._pendingEditorState=n,t._dirtyType=2,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),Re(t);return}finally{U=s,K=d,B=u,t._updating=a,Et=0}t._dirtyType!==0||kl(o,t)?o._flushSync?(o._flushSync=!1,Re(t)):l&&pl(()=>{Re(t)}):(o._flushSync=!1,l&&(r.clear(),t._deferred=[],t._pendingEditorState=null))}function q(t,e,n){t._updating?t._updates.push([e,n]):Gi(t,e,n)}function bn(t,e,n){te();var r=t.__key;let i=t.getParent();if(i!==null){var o=yl(t),l=!1;if(E(o)&&e){var s=o.anchor;let d=o.focus;s.key===r&&(an(s,t,i,t.getPreviousSibling(),t.getNextSibling()),l=!0),d.key===r&&(an(d,t,i,t.getPreviousSibling(),t.getNextSibling()),l=!0)}s=i.getWritable().__children,r=s.indexOf(r),r===-1&&v(31),ze(t),s.splice(r,1),t.getWritable().__parent=null,E(o)&&e&&!l&&un(o,i,r,-1),n||i===null||G(i)||i.canBeEmpty()||!i.isEmpty()||bn(i,e),i!==null&&G(i)&&i.isEmpty()&&i.selectEnd()}}function Ji(t){return t=L(t),t===null&&v(63),t}class cn{static getType(){v(64)}static clone(){v(65)}constructor(e){if(this.__type=this.constructor.getType(),this.__parent=null,e!=null)this.__key=e;else{te(),99<Et&&v(14),e=M();var n=ue(),r=""+_l++;n._nodeMap.set(r,this),m(this)?e._dirtyElements.set(r,!0):e._dirtyLeaves.add(r),e._cloneNotNeeded.add(r),e._dirtyType=1,this.__key=r}}getType(){return this.__type}isAttached(){for(var e=this.__key;e!==null;){if(e==="root")return!0;if(e=L(e),e===null)break;e=e.__parent}return!1}isSelected(){let e=w();if(e==null)return!1;let n=e.getNodes().some(r=>r.__key===this.__key);return N(this)?n:E(e)&&e.anchor.type==="element"&&e.focus.type==="element"&&e.anchor.key===e.focus.key&&e.anchor.offset===e.focus.offset?!1:n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();return e===null?-1:e.__children.indexOf(this.__key)}getParent(){let e=this.getLatest().__parent;return e===null?null:L(e)}getParentOrThrow(){let e=this.getParent();return e===null&&v(66),e}getTopLevelElement(){let e=this;for(;e!==null;){let n=e.getParent();if(G(n)&&(m(e)||I(e)&&e.isTopLevel()))return e;e=n}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&v(67),e}getParents(){let e=[],n=this.getParent();for(;n!==null;)e.push(n),n=n.getParent();return e}getParentKeys(){let e=[],n=this.getParent();for(;n!==null;)e.push(n.__key),n=n.getParent();return e}getPreviousSibling(){var e=this.getParent();if(e===null)return null;e=e.__children;let n=e.indexOf(this.__key);return 0>=n?null:L(e[n-1])}getPreviousSiblings(){var e=this.getParent();if(e===null)return[];e=e.__children;let n=e.indexOf(this.__key);return e.slice(0,n).map(r=>Ji(r))}getNextSibling(){var e=this.getParent();if(e===null)return null;e=e.__children;let n=e.length,r=e.indexOf(this.__key);return r>=n-1?null:L(e[r+1])}getNextSiblings(){var e=this.getParent();if(e===null)return[];e=e.__children;let n=e.indexOf(this.__key);return e.slice(n+1).map(r=>Ji(r))}getCommonAncestor(e){let n=this.getParents();var r=e.getParents();m(this)&&n.unshift(this),m(e)&&r.unshift(e),e=n.length;var i=r.length;if(e===0||i===0||n[e-1]!==r[i-1])return null;for(r=new Set(r),i=0;i<e;i++){let o=n[i];if(r.has(o))return o}return null}is(e){return e==null?!1:this.__key===e.__key}isBefore(e){if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;var n=this.getCommonAncestor(e);let r=this;for(;;){var i=r.getParentOrThrow();if(i===n){i=i.__children.indexOf(r.__key);break}r=i}for(r=e;;){if(e=r.getParentOrThrow(),e===n){n=e.__children.indexOf(r.__key);break}r=e}return i<n}isParentOf(e){let n=this.__key;if(n===e.__key)return!1;for(;e!==null;){if(e.__key===n)return!0;e=e.getParent()}return!1}getNodesBetween(e){let n=this.isBefore(e),r=[],i=new Set;for(var o=this;;){var l=o.__key;if(i.has(l)||(i.add(l),r.push(o)),o===e)break;if(l=m(o)?n?o.getFirstChild():o.getLastChild():null,l!==null)o=l;else if(l=n?o.getNextSibling():o.getPreviousSibling(),l!==null)o=l;else{if(o=o.getParentOrThrow(),i.has(o.__key)||r.push(o),o===e)break;l=o;do l===null&&v(68),o=n?l.getNextSibling():l.getPreviousSibling(),l=l.getParent(),l!==null&&(o!==null||i.has(l.__key)||r.push(l));while(o===null)}}return n||r.reverse(),r}isDirty(){let e=M()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){let e=L(this.__key);return e===null&&v(69),e}getWritable(){te();var e=ue(),n=M();e=e._nodeMap;let r=this.__key,i=this.getLatest(),o=i.__parent;n=n._cloneNotNeeded;var l=w();return l!==null&&(l._cachedNodes=null),n.has(r)?(We(i),i):(l=i.constructor.clone(i),l.__parent=o,m(i)&&m(l)?(l.__children=Array.from(i.__children),l.__indent=i.__indent,l.__format=i.__format,l.__dir=i.__dir):N(i)&&N(l)&&(l.__format=i.__format,l.__style=i.__style,l.__mode=i.__mode,l.__detail=i.__detail),n.add(r),l.__key=r,We(l),e.set(r,l),l)}getTextContent(){return""}getTextContentSize(e,n){return this.getTextContent(e,n).length}createDOM(){v(70)}updateDOM(){v(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){v(72)}static importJSON(){v(18)}remove(e){bn(this,!0,e)}replace(e){te();let n=this.__key;e=e.getWritable(),Zt(e);var r=this.getParentOrThrow(),i=r.getWritable().__children;let o=i.indexOf(this.__key),l=e.__key;return o===-1&&v(31),i.splice(o,0,l),e.__parent=r.__key,bn(this,!1),ze(e),i=w(),E(i)&&(r=i.anchor,i=i.focus,r.key===n&&Mi(r,e),i.key===n&&Mi(i,e)),M()._compositionKey===n&&Y(l),e}insertAfter(e){te();var n=this.getWritable(),r=e.getWritable(),i=r.getParent();let o=w();var l=e.getIndexWithinParent(),s=!1,d=!1;i!==null&&(Zt(r),E(o)&&(d=i.__key,s=o.anchor,i=o.focus,s=s.type==="element"&&s.key===d&&s.offset===l+1,d=i.type==="element"&&i.key===d&&i.offset===l+1)),l=this.getParentOrThrow().getWritable(),i=r.__key,r.__parent=n.__parent;let u=l.__children;return n=u.indexOf(n.__key),n===-1&&v(31),u.splice(n+1,0,i),ze(r),E(o)&&(un(o,l,n+1),r=l.__key,s&&o.anchor.set(r,n+2,"element"),d&&o.focus.set(r,n+2,"element")),e}insertBefore(e){var n=this.getWritable(),r=e.getWritable();Zt(r);let i=this.getParentOrThrow().getWritable(),o=r.__key;r.__parent=n.__parent;let l=i.__children;return n=l.indexOf(n.__key),n===-1&&v(31),l.splice(n,0,o),ze(r),r=w(),E(r)&&un(r,i,n),e}selectPrevious(e,n){te();let r=this.getPreviousSibling(),i=this.getParentOrThrow();return r===null?i.select(0,0):m(r)?r.select():N(r)?r.select(e,n):(e=r.getIndexWithinParent()+1,i.select(e,e))}selectNext(e,n){te();let r=this.getNextSibling(),i=this.getParentOrThrow();return r===null?i.select():m(r)?r.select(0,0):N(r)?r.select(e,n):(e=r.getIndexWithinParent(),i.select(e,e))}markDirty(){this.getWritable()}}class Vi extends cn{constructor(e){super(e)}decorate(){v(47)}isIsolated(){return!1}isTopLevel(){return!1}}function I(t){return t instanceof Vi}class Le extends cn{constructor(e){super(e),this.__children=[],this.__indent=this.__format=0,this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let e=this.getFormat();return al[e]||""}getIndent(){return this.getLatest().__indent}getChildren(){let e=this.getLatest().__children,n=[];for(let r=0;r<e.length;r++){let i=L(e[r]);i!==null&&n.push(i)}return n}getChildrenKeys(){return this.getLatest().__children}getChildrenSize(){return this.getLatest().__children.length}isEmpty(){return this.getChildrenSize()===0}isDirty(){let e=M()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest();return e.getParentOrThrow().getLastChild()===e}getAllTextNodes(e){let n=[],r=this.getLatest().__children;for(let o=0;o<r.length;o++){var i=L(r[o]);!N(i)||!e&&i.isInert()?m(i)&&(i=i.getAllTextNodes(e),n.push(...i)):n.push(i)}return n}getFirstDescendant(){let e=this.getFirstChild();for(;e!==null;){if(m(e)){let n=e.getFirstChild();if(n!==null){e=n;continue}}break}return e}getLastDescendant(){let e=this.getLastChild();for(;e!==null;){if(m(e)){let n=e.getLastChild();if(n!==null){e=n;continue}}break}return e}getDescendantByIndex(e){let n=this.getChildren(),r=n.length;return e>=r?(e=n[r-1],m(e)&&e.getLastDescendant()||e||null):(e=n[e],m(e)&&e.getFirstDescendant()||e||null)}getFirstChild(){let e=this.getLatest().__children;return e.length===0?null:L(e[0])}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&v(45),e}getLastChild(){let e=this.getLatest().__children,n=e.length;return n===0?null:L(e[n-1])}getChildAtIndex(e){return e=this.getLatest().__children[e],e===void 0?null:L(e)}getTextContent(e,n){let r="",i=this.getChildren(),o=i.length;for(let l=0;l<o;l++){let s=i[l];r+=s.getTextContent(e,n),m(s)&&l!==o-1&&!s.isInline()&&(r+=`
|
|
17
|
+
|
|
18
|
+
`)}return r}getDirection(){return this.getLatest().__dir}hasFormat(e){return e!==""?(e=Vr[e],(this.getFormat()&e)!==0):!1}select(e,n){te();let r=w();var i=this.getChildrenSize();if(e===void 0&&(e=i),n===void 0&&(n=i),i=this.__key,E(r))r.anchor.set(i,e,"element"),r.focus.set(i,n,"element"),r.dirty=!0;else return Fi(i,e,i,n,"element","element");return r}selectStart(){let e=this.getFirstDescendant();return m(e)||N(e)?e.select(0,0):e!==null?e.selectPrevious():this.select(0,0)}selectEnd(){let e=this.getLastDescendant();return m(e)||N(e)?e.select():e!==null?e.selectNext():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach(n=>n.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let n=this.getWritable();return n.__dir=e,n}setFormat(e){return this.getWritable().__format=e!==""?Vr[e]:0,this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,n,r){let i=this.getWritable();var o=i.__key;let l=i.__children,s=r.length;var d=[];for(let u=0;u<s;u++){let a=r[u],c=a.getWritable();a.__key===o&&v(76),Zt(c),c.__parent=o,d.push(c.__key)}if((r=this.getChildAtIndex(e-1))&&We(r),(o=this.getChildAtIndex(e+n))&&We(o),e===l.length?(l.push(...d),e=[]):e=l.splice(e,n,...d),e.length&&(n=w(),E(n))){let u=new Set(e),a=new Set(d);d=h=>{for(h=h.getNode();h;){const p=h.__key;if(u.has(p)&&!a.has(p))return!0;h=h.getParent()}return!1};let{anchor:c,focus:f}=n;for(d(c)&&an(c,c.getNode(),this,r,o),d(f)&&an(f,f.getNode(),this,r,o),d=e.length,n=0;n<d;n++)r=L(e[n]),r!=null&&(r.getWritable().__parent=null);l.length!==0||this.canBeEmpty()||G(this)||this.remove()}return i}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(){return null}canInsertTab(){return!1}canIndent(){return!0}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}function m(t){return t instanceof Le}class Ve extends Le{static getType(){return"root"}static clone(){return new Ve}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){v(51)}getTextContent(e,n){let r=this.__cachedText;return!K&&M()._dirtyType!==0||r===null||e&&n===!1?super.getTextContent(e,n):r}remove(){v(52)}replace(){v(53)}insertBefore(){v(54)}insertAfter(){v(55)}updateDOM(){return!1}append(...e){for(let n=0;n<e.length;n++){let r=e[n];m(r)||I(r)||v(56)}return super.append(...e)}static importJSON(e){let n=Me();return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}}function G(t){return t instanceof Ve}function kl(t,e){if(e=e.getEditorState()._selection,t=t._selection,t!==null){if(t.dirty||!t.is(e))return!0}else if(e!==null)return!0;return!1}function er(){return new fn(new Map([["root",new Ve]]))}function ji(t){let e=t.exportJSON();e.type!==t.constructor.getType()&&v(58);let n=e.children;if(m(t)){Array.isArray(n)||v(59),t=t.getChildren();for(let r=0;r<t.length;r++){let i=ji(t[r]);n.push(i)}}return e}class fn{constructor(e,n){this._nodeMap=e,this._selection=n||null,this._readOnly=this._flushSync=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e){return Hi(this,e)}clone(e){return e=new fn(this._nodeMap,e===void 0?this._selection:e),e._readOnly=!0,e}toJSON(){return Hi(this,()=>({root:ji(Me())}))}}class je extends cn{static getType(){return"linebreak"}static clone(e){return new je(e.__key)}constructor(e){super(e)}getTextContent(){return`
|
|
19
|
+
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>{let n=e.parentElement;return n!=null&&n.firstChild===e&&n.lastChild===e?null:{conversion:Pl,priority:0}}}}static importJSON(){return $t()}exportJSON(){return{type:"linebreak",version:1}}}function Pl(){return{node:$t()}}function $t(){return new je}function Mt(t){return t instanceof je}function tr(t,e){return e&16?"code":e&32?"sub":e&64?"sup":null}function nr(t,e){return e&1?"strong":e&2?"em":"span"}function rr(t,e,n,r,i){t=r.classList,r=qt(i,"base"),r!==void 0&&t.add(...r),r=qt(i,"underlineStrikethrough");let o=!1,l=e&8&&e&4;var s=n&8&&n&4;r!==void 0&&(s?(o=!0,l||t.add(...r)):l&&t.remove(...r));for(let d in $e)s=$e[d],r=qt(i,d),r!==void 0&&(n&s?!o||d!=="underline"&&d!=="strikethrough"?((e&s)===0||l&&d==="underline"||d==="strikethrough")&&t.add(...r):e&s&&t.remove(...r):e&s&&t.remove(...r))}function ir(t,e,n){let r=e.firstChild;if(n=n.isComposing(),t+=n?jt:"",r==null)e.textContent=t;else if(e=r.nodeValue,e!==t)if(n||Oe){n=e.length;let i=t.length,o=0,l=0;for(;o<n&&o<i&&e[o]===t[o];)o++;for(;l+o<n&&l+o<i&&e[n-l-1]===t[i-l-1];)l++;t=[o,n-o-l,t.slice(o,i-l)];let[s,d,u]=t;d!==0&&r.deleteData(s,d),r.insertData(s,u)}else r.nodeValue=t}class Xe extends cn{static getType(){return"text"}static clone(e){return new Xe(e.__text,e.__key)}constructor(e,n){super(n),this.__text=e,this.__format=0,this.__style="",this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let e=this.getLatest();return fl[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===M()._compositionKey}isSegmented(){return this.getLatest().__mode===2}isInert(){return this.getLatest().__mode===3}isDirectionless(){return(this.getLatest().__detail&1)!==0}isUnmergeable(){return(this.getLatest().__detail&2)!==0}hasFormat(e){return e=$e[e],(this.getFormat()&e)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(e,n){return!e&&this.isInert()||n===!1&&this.isDirectionless()?"":this.getLatest().__text}getFormatFlags(e,n){let r=this.getLatest().__format;return qr(r,e,n)}createDOM(e){var n=this.__format,r=tr(this,n);let i=nr(this,n),o=document.createElement(r===null?i:r),l=o;return r!==null&&(l=document.createElement(i),o.appendChild(l)),r=l,ir(this.__text,r,this),e=e.theme.text,e!==void 0&&rr(i,0,n,r,e),n=this.__style,n!==""&&(o.style.cssText=n),o}updateDOM(e,n,r){let i=this.__text;var o=e.__format,l=this.__format,s=tr(this,o);let d=tr(this,l);var u=nr(this,o);let a=nr(this,l);return(s===null?u:s)!==(d===null?a:d)?!0:s===d&&u!==a?(o=n.firstChild,o==null&&v(48),e=s=document.createElement(a),ir(i,e,this),r=r.theme.text,r!==void 0&&rr(a,0,l,e,r),n.replaceChild(s,o),!1):(u=n,d!==null&&s!==null&&(u=n.firstChild,u==null&&v(49)),ir(i,u,this),r=r.theme.text,r!==void 0&&o!==l&&rr(a,o,l,u,r),l=this.__style,e.__style!==l&&(n.style.cssText=l),!1)}static importDOM(){return{"#text":()=>({conversion:Bl,priority:0}),b:()=>({conversion:Fl,priority:0}),code:()=>({conversion:Dt,priority:0}),em:()=>({conversion:Dt,priority:0}),i:()=>({conversion:Dt,priority:0}),span:()=>({conversion:Il,priority:0}),strong:()=>({conversion:Dt,priority:0}),u:()=>({conversion:Dt,priority:0})}}static importJSON(e){let n=Q(e.text);return n.setFormat(e.format),n.setDetail(e.detail),n.setMode(e.mode),n.setStyle(e.style),n}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(e){let n=this.getWritable();return n.__format=typeof e=="string"?$e[e]:e,n}setDetail(e){let n=this.getWritable();return n.__detail=typeof e=="string"?ul[e]:e,n}setStyle(e){let n=this.getWritable();return n.__style=e,n}toggleFormat(e){return e=$e[e],this.setFormat(this.getFormat()^e)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){e=cl[e];let n=this.getWritable();return n.__mode=e,n}setTextContent(e){let n=this.getWritable();return n.__text=e,n}select(e,n){te();let r=w();var i=this.getTextContent();let o=this.__key;if(typeof i=="string"?(i=i.length,e===void 0&&(e=i),n===void 0&&(n=i)):n=e=0,E(r))i=M()._compositionKey,i!==r.anchor.key&&i!==r.focus.key||Y(o),r.setTextNodeRange(this,e,this,n);else return Fi(o,e,o,n,"text","text");return r}spliceText(e,n,r,i){let o=this.getWritable(),l=o.__text,s=r.length,d=e;0>d&&(d=s+d,0>d&&(d=0));let u=w();return i&&E(u)&&(e+=s,u.setTextNodeRange(o,e,o,e)),n=l.slice(0,d)+r+l.slice(d+n),o.__text=n,o}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){te();var n=this.getLatest(),r=n.getTextContent(),i=n.__key,o=M()._compositionKey,l=new Set(e);e=[];for(var s=r.length,d="",u=0;u<s;u++)d!==""&&l.has(u)&&(e.push(d),d=""),d+=r[u];if(d!==""&&e.push(d),l=e.length,l===0)return[];if(e[0]===r)return[n];var a=e[0];r=n.getParentOrThrow(),u=r.__key;let c=n.getFormat(),f=n.getStyle(),h=n.__detail;s=!1,n.isSegmented()?(d=Q(a),d.__parent=u,d.__format=c,d.__style=f,d.__detail=h,s=!0):(d=n.getWritable(),d.__text=a),n=w(),d=[d],a=a.length;for(let T=1;T<l;T++){var p=e[T],x=p.length;p=Q(p).getWritable(),p.__format=c,p.__style=f,p.__detail=h;let D=p.__key;if(x=a+x,E(n)){let R=n.anchor,P=n.focus;R.key===i&&R.type==="text"&&R.offset>a&&R.offset<=x&&(R.key=D,R.offset-=a,n.dirty=!0),P.key===i&&P.type==="text"&&P.offset>a&&P.offset<=x&&(P.key=D,P.offset-=a,n.dirty=!0)}o===i&&Y(D),a=x,p.__parent=u,d.push(p)}return ze(this),o=r.getWritable().__children,i=o.indexOf(i),e=d.map(T=>T.__key),s?(o.splice(i,0,...e),this.remove()):o.splice(i,1,...e),E(n)&&un(n,r,i,l-1),d}mergeWithSibling(e){var n=e===this.getPreviousSibling();n||e===this.getNextSibling()||v(50);var r=this.__key;let i=e.__key,o=this.__text,l=o.length;M()._compositionKey===i&&Y(r);let s=w();if(E(s)){let d=s.anchor,u=s.focus;d!==null&&d.key===i&&(zi(d,n,r,e,l),s.dirty=!0),u!==null&&u.key===i&&(zi(u,n,r,e,l),s.dirty=!0)}return r=e.__text,this.setTextContent(n?r+o:o+r),n=this.getWritable(),e.remove(),n}isTextEntity(){return!1}}function Il(t){let e=t.style.fontWeight==="700",n=t.style.textDecoration==="line-through",r=t.style.fontStyle==="italic",i=t.style.textDecoration==="underline",o=t.style.verticalAlign;return{forChild:l=>(N(l)&&(e&&l.toggleFormat("bold"),n&&l.toggleFormat("strikethrough"),r&&l.toggleFormat("italic"),i&&l.toggleFormat("underline"),o==="sub"&&l.toggleFormat("subscript"),o==="super"&&l.toggleFormat("superscript")),l),node:null}}function Fl(t){let e=t.style.fontWeight==="normal";return{forChild:n=>(N(n)&&!e&&n.toggleFormat("bold"),n),node:null}}function Bl(t){let{parentElement:e}=t;t=t.textContent||"";let n=t.trim();return e!=null&&e.tagName.toLowerCase()==="pre"||n.length!==0||!t.includes(`
|
|
20
|
+
`)?{node:Q(t)}:{node:null}}let Kl={code:"code",em:"italic",i:"italic",strong:"bold",u:"underline"};function Dt(t){let e=Kl[t.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:n=>(N(n)&&n.toggleFormat(e),n),node:null}}function Q(t=""){return new Xe(t)}function N(t){return t instanceof Xe}class Qe extends Le{static getType(){return"paragraph"}static clone(e){return new Qe(e.__key)}createDOM(e){let n=document.createElement("p");return e=qt(e.theme,"paragraph"),e!==void 0&&n.classList.add(...e),n}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Wl,priority:0})}}exportDOM(e){return{element:e}=super.exportDOM(e),e&&this.isEmpty()&&e.append(document.createElement("br")),{element:e}}static importJSON(e){let n=Ze();return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(){let e=Ze(),n=this.getDirection();return e.setDirection(n),this.insertAfter(e),e}collapseAtStart(){let e=this.getChildren();if(e.length===0||N(e[0])&&e[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 Wl(){return{node:Ze()}}function Ze(){return new Qe}function Xi(t,e,n,r){let i=t._keyToDOMMap;i.clear(),t._editorState=er(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],r=t._observer,r!==null&&(r.disconnect(),t._observer=null),e!==null&&(e.textContent=""),n!==null&&(n.textContent="",i.set("root",n))}function zl(t){let e=new Map,n=new Set;return t.forEach(r=>{if(r=r.klass.importDOM!=null?r.klass.importDOM.bind(r.klass):null,r!=null&&!n.has(r)){n.add(r);var i=r();i!==null&&Object.keys(i).forEach(o=>{let l=e.get(o);l===void 0&&(l=[],e.set(o,l)),l.push(i[o])})}}),e}class Yl{constructor(e,n,r,i,o,l){this._parentEditor=n,this._rootElement=null,this._editorState=e,this._compositionKey=this._pendingEditorState=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=i,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=ii(),this._onError=o,this._htmlConversions=l,this._editable=!0,this._headless=!1,this._window=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){let n=this._listeners.update;return n.add(e),()=>{n.delete(e)}}registerEditableListener(e){let n=this._listeners.editable;return n.add(e),()=>{n.delete(e)}}registerDecoratorListener(e){let n=this._listeners.decorator;return n.add(e),()=>{n.delete(e)}}registerTextContentListener(e){let n=this._listeners.textcontent;return n.add(e),()=>{n.delete(e)}}registerRootListener(e){let n=this._listeners.root;return e(this._rootElement,null),n.add(e),()=>{e(null,this._rootElement),n.delete(e)}}registerCommand(e,n,r){r===void 0&&v(35);let i=this._commands;i.has(e)||i.set(e,[new Set,new Set,new Set,new Set,new Set]);let o=i.get(e);o===void 0&&v(36);let l=o[r];return l.add(n),()=>{l.delete(n),o.every(s=>s.size===0)&&i.delete(e)}}registerMutationListener(e,n){this._nodes.get(e.getType())===void 0&&v(37);let r=this._listeners.mutation;return r.set(n,e),()=>{r.delete(n)}}registerNodeTransform(e,n){e=e.getType();let r=this._nodes.get(e);r===void 0&&v(37);let i=r.transforms;return i.add(n),ml(this,e),()=>{i.delete(n)}}hasNodes(e){for(let n=0;n<e.length;n++){let r=e[n].getType();if(!this._nodes.has(r))return!1}return!0}dispatchCommand(e,n){return y(this,e,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let n=this._rootElement;if(e!==n){var r=this._pendingEditorState||this._editorState;if(this._rootElement=e,Xi(this,n,e,r),n!==null&&!this._config.disableEvents){if(Nt!==0&&(Nt--,Nt===0&&n.ownerDocument.removeEventListener("selectionchange",$i)),r=n.__lexicalEditor,r!=null){if(r._parentEditor!==null){var i=kn(r);i=i[i.length-1]._key,Ge.get(i)===r&&Ge.delete(i)}else Ge.delete(r._key);n.__lexicalEditor=null}for(r=Oi(n),i=0;i<r.length;i++)r[i]();n.__lexicalEventHandles=[]}e!==null?(r=(r=e.ownerDocument)&&r.defaultView||null,i=e.style,i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=r,this._dirtyType=2,Qr(this),this._updateTags.add("history-merge"),Re(this),this._config.disableEvents||Dl(e,this)):this._window=null,Ot("root",this,!1,e,n)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&v(38),Xr(this);let r=this._pendingEditorState,i=this._updateTags;n=n!==void 0?n.tag:null,r===null||r.isEmpty()||(n!=null&&i.add(n),Re(this)),this._pendingEditorState=e,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,n!=null&&i.add(n),Re(this)}parseEditorState(e,n){e=typeof e=="string"?JSON.parse(e):e;let r=er(),i=U,o=K,l=B,s=this._dirtyElements,d=this._dirtyLeaves,u=this._cloneNotNeeded,a=this._dirtyType;this._dirtyElements=new Map,this._dirtyLeaves=new Set,this._cloneNotNeeded=new Set,this._dirtyType=0,U=r,K=!1,B=this;try{qn(e.root,this._nodes),n&&n(),r._readOnly=!0}finally{this._dirtyElements=s,this._dirtyLeaves=d,this._cloneNotNeeded=u,this._dirtyType=a,U=i,K=o,B=l}return r}update(e,n){q(this,e,n)}focus(e,n={}){let r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),q(this,()=>{let i=w(),o=Me();i!==null?i.dirty=!0:o.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?o.selectStart():o.selectEnd())},{onUpdate:()=>{r.removeAttribute("autocapitalize"),e&&e()}}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){var e=this._rootElement;e!==null&&e.blur(),e=window.getSelection(),e!==null&&e.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Ot("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}class Qi extends Le{constructor(e,n){super(n),this.__colSpan=e}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan}}}function Zi(t){return t instanceof Qi}class qi extends Le{}function bi(t){return t instanceof qi}class eo extends Le{}function to(t){return t instanceof eo}_.$createGridSelection=function(){let t=new de("root",0,"element"),e=new de("root",0,"element");return new sn("root",t,e)},_.$createLineBreakNode=$t,_.$createNodeSelection=Bi,_.$createParagraphNode=Ze,_.$createRangeSelection=function(){let t=new de("root",0,"element"),e=new de("root",0,"element");return new Je(t,e,0)},_.$createTextNode=Q,_.$getDecoratorNode=di,_.$getNearestNodeFromDOMNode=gt,_.$getNodeByKey=L,_.$getPreviousSelection=St,_.$getRoot=Me,_.$getSelection=w,_.$isDecoratorNode=I,_.$isElementNode=m,_.$isGridCellNode=Zi,_.$isGridNode=bi,_.$isGridRowNode=to,_.$isGridSelection=Qn,_.$isLeafNode=br,_.$isLineBreakNode=Mt,_.$isNodeSelection=Tt,_.$isParagraphNode=function(t){return t instanceof Qe},_.$isRangeSelection=E,_.$isRootNode=G,_.$isTextNode=N,_.$nodesOfType=function(t){var e=ue();let n=e._readOnly,r=t.getType();e=e._nodeMap;let i=[];for(let[,o]of e)o instanceof t&&o.__type===r&&(n||o.isAttached())&&i.push(o);return i},_.$parseSerializedNode=function(t){return qn(t,M()._nodes)},_.$setCompositionKey=Y,_.$setSelection=Ye,_.BLUR_COMMAND=Gr,_.CAN_REDO_COMMAND={},_.CAN_UNDO_COMMAND={},_.CLEAR_EDITOR_COMMAND={},_.CLEAR_HISTORY_COMMAND={},_.CLICK_COMMAND=Mr,_.COMMAND_PRIORITY_CRITICAL=4,_.COMMAND_PRIORITY_EDITOR=0,_.COMMAND_PRIORITY_HIGH=3,_.COMMAND_PRIORITY_LOW=1,_.COMMAND_PRIORITY_NORMAL=2,_.CONTROLLED_TEXT_INSERTION_COMMAND=Be,_.COPY_COMMAND=Mn,_.CUT_COMMAND=Dn,_.DELETE_CHARACTER_COMMAND=ut,_.DELETE_LINE_COMMAND=ft,_.DELETE_WORD_COMMAND=ct,_.DRAGEND_COMMAND=Hr,_.DRAGOVER_COMMAND=Yr,_.DRAGSTART_COMMAND=zr,_.DROP_COMMAND=Wr,_.DecoratorNode=Vi,_.ElementNode=Le,_.FOCUS_COMMAND=Ur,_.FORMAT_ELEMENT_COMMAND={},_.FORMAT_TEXT_COMMAND=ye,_.GridCellNode=Qi,_.GridNode=qi,_.GridRowNode=eo,_.INDENT_CONTENT_COMMAND={},_.INSERT_LINE_BREAK_COMMAND=at,_.INSERT_PARAGRAPH_COMMAND=Tn,_.KEY_ARROW_DOWN_COMMAND=kr,_.KEY_ARROW_LEFT_COMMAND=Lr,_.KEY_ARROW_RIGHT_COMMAND=Dr,_.KEY_ARROW_UP_COMMAND=wr,_.KEY_BACKSPACE_COMMAND=Ir,_.KEY_DELETE_COMMAND=Br,_.KEY_ENTER_COMMAND=Gt,_.KEY_ESCAPE_COMMAND=Fr,_.KEY_MODIFIER_COMMAND=Jr,_.KEY_SPACE_COMMAND=Pr,_.KEY_TAB_COMMAND=Kr,_.LineBreakNode=je,_.MOVE_TO_END=Rr,_.MOVE_TO_START=Ar,_.OUTDENT_CONTENT_COMMAND={},_.PASTE_COMMAND=Sn,_.ParagraphNode=Qe,_.REDO_COMMAND=$n,_.REMOVE_TEXT_COMMAND=En,_.RootNode=Ve,_.SELECTION_CHANGE_COMMAND=$r,_.TextNode=Xe,_.UNDO_COMMAND=On,_.VERSION="0.4.1",_.createCommand=function(){return{}},_.createEditor=function(t){var e=t||{},n=B,r=e.theme||{};let i=t===void 0?n:e.parentEditor||null,o=e.disableEvents||!1,l=er(),s=e.namespace||(i!==null?i._config.namespace:ii()),d=e.editorState,u=[Ve,Xe,je,Qe,...e.nodes||[]],a=e.onError;if(e=e.editable!==void 0?e.editable:!0,t===void 0&&n!==null)t=n._nodes;else for(t=new Map,n=0;n<u.length;n++){let c=u[n],f=c.getType();t.set(f,{klass:c,transforms:new Set})}return r=new Yl(l,i,t,{disableEvents:o,namespace:s,theme:r},a||console.error,zl(t),e),d!==void 0&&(r._pendingEditorState=d,r._dirtyType=2),r};var ne=_,no=Fe,ro=ne,gn=se.default,Hl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?gn.useLayoutEffect:gn.useEffect;let or={tag:"history-merge"};function Ul(t,e){if(e!=null&&e!==null)switch(typeof e){case"string":let n=t.parseEditorState(e);t.setEditorState(n,or);break;case"object":t.setEditorState(e,or);break;case"function":t.update(()=>{ro.$getRoot().isEmpty()&&e(t)},or)}}Sr.LexicalComposer=function({initialConfig:t,children:e}){let n=gn.useMemo(()=>{const{theme:r,namespace:i,editor__DEPRECATED:o,nodes:l,onError:s,editorState:d}=t,u=no.createLexicalComposerContext(null,r);let a=o||null;if(a===null){const c=ro.createEditor({editable:!1,namespace:i,nodes:l,onError:f=>s(f,c),theme:r});Ul(c,d),a=c}return[a,u]},[]);return Hl(()=>{let r=t.editable,[i]=n;i.setEditable(r!==void 0?r:!0)},[]),gn.createElement(no.LexicalComposerContext.Provider,{value:n},e)};var Gl=Sr,H={},re={},J=ne;function io(t){throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?code=${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function oo(t,e){for(;t!==J.$getRoot()&&t!=null;){if(e(t))return t;t=t.getParent()}return null}function lo(t,e,n,r,i){var o=n._nodes.get(t.__type);o===void 0&&io(5);for(var l in t){var s=t[l];if(s!=null&&typeof s=="object"&&(s=s.editorState,s!=null)){var d=J.createEditor({namespace:s.namespace});d._nodes=n._nodes,d._parentEditor=n._parentEditor,d._pendingEditorState=so(d,s),t[l]=d}}if(o=o.klass,l=t.__key,t.__key=void 0,o=o.clone(t),t.__key=l,l=o.__key,i._nodeMap.set(l,o),o.__parent=r,J.$isElementNode(o)){for(r=t.__children,s=0;s<r.length;s++)d=e.get(r[s]),d!==void 0&&(d=lo(d,e,n,l,i).__key,o.__children.push(d));o.__indent=t.__indent,o.__format=t.__format,o.__dir=t.__dir}else J.$isTextNode(o)&&(o.__format=t.__format,o.__style=t.__style,o.__mode=t.__mode,o.__detail=t.__detail);return o}function Jl(t,e){let n=e._editorState.constructor,r=new Map,i=new n(r),o=new Map(t._nodeMap),l=o.get("root");t=e._updating;try{e._updating=!1,e.update(()=>{let s=e._dirtyElements,d=e._dirtyLeaves,u=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._dirtyType=0;try{lo(l,o,e,null,i)}finally{e._dirtyElements=s,e._dirtyLeaves=d,e._dirtyType=u}})}finally{e._updating=t}return i._readOnly=!0,i}function so(t,e){return e=typeof e=="string"?JSON.parse(e):e,Jl(e,t)}re.$dfs=function(t,e){let n=[];t=(t||J.$getRoot()).getLatest(),e=e||(J.$isElementNode(t)?t.getLastDescendant():t);for(var r=t,i=0;(r=r.getParent())!==null;)i++;for(r=i;t!==null&&!t.is(e);)if(n.push({depth:r,node:t}),J.$isElementNode(t)&&0<t.getChildrenSize())t=t.getFirstChild(),r++;else for(i=null;i===null&&t!==null;)i=t.getNextSibling(),i===null?(t=t.getParent(),r--):t=i;return t!==null&&t.is(e)&&n.push({depth:r,node:t}),n},re.$findMatchingParent=oo,re.$getNearestBlockElementAncestorOrThrow=function(t){return t=oo(t,e=>J.$isElementNode(e)&&!e.isInline()),J.$isElementNode(t)||io(4),t},re.$getNearestNodeOfType=function(t,e){for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null},re.$insertBlockNode=function(t){var e=J.$getSelection();return J.$isRangeSelection(e)?e.focus.getNode().getTopLevelElementOrThrow().insertAfter(t):J.$isNodeSelection(e)||J.$isGridSelection(e)?(e=e.getNodes(),e[e.length-1].getTopLevelElementOrThrow().insertAfter(t)):J.$getRoot().append(t),e=J.$createParagraphNode(),t.insertAfter(e),e.select(),t.getLatest()},re.$restoreEditorState=function(t,e){let n=new Map(e._nodeMap),r=t._pendingEditorState;r&&(r._nodeMap=n),t._dirtyType=2,t=e._selection,J.$setSelection(t===null?null:t.clone())},re.addClassNamesToElement=function(t,...e){e.forEach(n=>{typeof n=="string"&&t.classList.add(...n.split(" "))})},re.mergeRegister=function(...t){return()=>{t.forEach(e=>e())}},re.registerNestedElementResolver=function(t,e,n,r){return t.registerNodeTransform(e,i=>{e:{for(var o=i.getChildren(),l=0;l<o.length;l++)if(o[l]instanceof e){o=null;break e}for(o=i;o!==null;)if(l=o,o=o.getParent(),o instanceof e){o={child:l,parent:o};break e}o=null}if(o!==null){const{child:s,parent:d}=o;if(s.is(i)){if(r(d,i),i=s.getNextSiblings(),o=i.length,d.insertAfter(s),o!==0){l=n(d),s.insertAfter(l);for(let u=0;u<o;u++)l.append(i[u])}d.canBeEmpty()||d.getChildrenSize()!==0||d.remove()}}})},re.removeClassNamesFromElement=function(t,...e){e.forEach(n=>{typeof n=="string"&&t.classList.remove(...n.split(" "))})},re.unstable_convertLegacyJSONEditorState=so;var Ae=re,$=ne,Rt=Ae;function Lt(t){throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?code=${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function uo(t){let e=1;for(t=t.getParent();t!=null;){if(A(t)){if(t=t.getParent(),O(t)){e++,t=t.getParent();continue}Lt(40)}break}return e}function lr(t){t=t.getParent(),O(t)||Lt(40);let e=t;for(;e!==null;)e=e.getParent(),O(e)&&(t=e);return t}function ao(t){let e=[];t=t.getChildren().filter(A);for(let n=0;n<t.length;n++){let r=t[n],i=r.getFirstChild();O(i)?e=e.concat(ao(i)):e.push(r)}return e}function qe(t){return A(t)&&O(t.getFirstChild())}function Vl(t){for(;t.getNextSibling()==null&&t.getPreviousSibling()==null;){let e=t.getParent();if(e==null||!A(t)&&!O(t))break;t=e}t.remove()}function co(t){return ie().append(t)}function fo(t,e){return A(t)&&(e.length===0||e.length===1&&t.is(e[0])&&t.getChildrenSize()===0)}function we(t,e){t.splice(t.getChildrenSize(),0,e)}function go(t,e){if(O(t))return t;let n=t.getPreviousSibling(),r=t.getNextSibling(),i=ie();return i.setFormat(t.getFormatType()),i.setIndent(t.getIndent()),we(i,t.getChildren()),O(n)&&e===n.getListType()?(n.append(i),t.remove(),O(r)&&e===r.getListType()&&(we(n,r.getChildren()),r.remove()),n):O(r)&&e===r.getListType()?(r.getFirstChildOrThrow().insertBefore(i),t.remove(),r):(e=ee(e),e.append(i),t.replace(e),b(e),e)}function b(t,e){(e||t.getChildren()).forEach(n=>{let r=n.getValue();var i=n.getParent(),o=1;i!=null&&(O(i)?o=i.getStart():Lt(44)),i=n.getPreviousSiblings();for(let l=0;l<i.length;l++){let s=i[l];A(s)&&!O(s.getFirstChild())&&o++}r!==o&&n.setValue(o)})}function ho(t){let e=new Set;t.forEach(n=>{if(!qe(n)&&!e.has(n.getKey())){var r=n.getParent(),i=n.getNextSibling(),o=n.getPreviousSibling();if(qe(i)&&qe(o))o=o.getFirstChild(),O(o)&&(o.append(n),n=i.getFirstChild(),O(n)&&(n=n.getChildren(),we(o,n),i.remove(),e.add(i.getKey())),b(o));else if(qe(i))i=i.getFirstChild(),O(i)&&(o=i.getFirstChild(),o!==null&&o.insertBefore(n),b(i));else if(qe(o))i=o.getFirstChild(),O(i)&&(i.append(n),b(i));else if(O(r)){let l=ie(),s=ee(r.getListType());l.append(s),s.append(n),o?o.insertAfter(l):i?i.insertBefore(l):r.append(l)}O(r)&&b(r)}})}function _o(t){t.forEach(e=>{if(!qe(e)){var n=e.getParent(),r=n?n.getParent():void 0,i=r?r.getParent():void 0;if(O(i)&&A(r)&&O(n)){var o=n?n.getFirstChild():void 0,l=n?n.getLastChild():void 0;if(e.is(o))r.insertBefore(e),n.isEmpty()&&r.remove();else if(e.is(l))r.insertAfter(e),n.isEmpty()&&r.remove();else{var s=n.getListType();o=ie();let d=ee(s);o.append(d),e.getPreviousSiblings().forEach(u=>d.append(u)),l=ie(),s=ee(s),l.append(s),we(s,e.getNextSiblings()),r.insertBefore(o),r.insertAfter(l),r.replace(e)}b(n),b(i)}}})}function po(t){var e=$.$getSelection();if($.$isRangeSelection(e)){var n=e.getNodes(),r=[];if(n.length===0&&n.push(e.anchor.getNode()),n.length===1){e:{for(n=n[0];n!==null;){if(A(n))break e;n=n.getParent()}n=null}n!==null&&(r=[n])}else{for(r=new Set,e=0;e<n.length;e++){let i=n[e];A(i)&&r.add(i)}r=Array.from(r)}0<r.length&&(t==="indent"?ho(r):_o(r))}}class ke extends $.ElementNode{static getType(){return"listitem"}static clone(e){return new ke(e.__value,e.__checked,e.__key)}constructor(e,n,r){super(r),this.__value=e===void 0?1:e,this.__checked=n}createDOM(e){let n=document.createElement("li"),r=this.getParent();return O(r)&&(b(r),yo(n,this,null,r)),n.value=this.__value,mo(n,e.theme,this),n}updateDOM(e,n,r){let i=this.getParent();return O(i)&&(b(i),yo(n,this,e,i)),n.value=this.__value,mo(n,r.theme,this),!1}static importDOM(){return{li:()=>({conversion:jl,priority:0})}}static importJSON(e){let n=new ke(e.value,e.checked);return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...e){for(let n=0;n<e.length;n++){let r=e[n];if($.$isElementNode(r)&&this.canMergeWith(r)){let i=r.getChildren();this.append(...i),r.remove()}else super.append(r)}return this}replace(e){if(A(e))return super.replace(e);let n=this.getParentOrThrow();if(O(n)){var r=n.__children;let o=r.length;var i=r.indexOf(this.__key);if(i===0)n.insertBefore(e);else if(i===o-1)n.insertAfter(e);else{r=ee(n.getListType());let l=n.getChildren();for(i+=1;i<o;i++)r.append(l[i]);n.insertAfter(e),e.insertAfter(r)}this.remove(),o===1&&n.remove()}return e}insertAfter(e){var n=this.getParentOrThrow();O(n)||Lt(39);var r=this.getNextSiblings();if(A(e))return n=super.insertAfter(e),e=e.getParentOrThrow(),O(e)&&b(e),n;if(O(e)&&e.getListType()===n.getListType()){for(n=e,e=e.getChildren(),r=e.length-1;0<=r;r--)n=e[r],this.insertAfter(n);return n}if(n.insertAfter(e),r.length!==0){let i=ee(n.getListType());r.forEach(o=>i.append(o)),e.insertAfter(i)}return e}remove(e){let n=this.getNextSibling();super.remove(e),n!==null&&(e=n.getParent(),O(e)&&b(e))}insertNewAfter(){let e=ie(this.__checked==null?void 0:!1);return this.insertAfter(e),e}collapseAtStart(e){let n=$.$createParagraphNode();this.getChildren().forEach(l=>n.append(l));var r=this.getParentOrThrow(),i=r.getParentOrThrow();let o=A(i);return r.getChildrenSize()===1?o?(r.remove(),i.select()):(r.replace(n),r=e.anchor,e=e.focus,i=n.getKey(),r.type==="element"&&r.getNode().is(this)&&r.set(i,r.offset,"element"),e.type==="element"&&e.getNode().is(this)&&e.set(i,e.offset,"element")):(r.insertBefore(n),this.remove()),!0}getValue(){return this.getLatest().__value}setValue(e){this.getWritable().__value=e}getChecked(){return this.getLatest().__checked}setChecked(e){this.getWritable().__checked=e}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){var e=this.getParent();if(e===null)return this.getLatest().__indent;e=e.getParentOrThrow();let n=0;for(;A(e);)e=e.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){let n=this.getIndent();for(;n!==e;)n<e?(ho([this]),n++):(_o([this]),n--);return this}canIndent(){return!1}insertBefore(e){if(A(e)){let n=this.getParentOrThrow();if(O(n)){let r=this.getNextSiblings();b(n,r)}}return super.insertBefore(e)}canInsertAfter(e){return A(e)}canReplaceWith(e){return A(e)}canMergeWith(e){return $.$isParagraphNode(e)||A(e)}extractWithChild(e,n){if(!$.$isRangeSelection(n))return!1;e=n.anchor.getNode();let r=n.focus.getNode();return this.isParentOf(e)&&this.isParentOf(r)&&this.getTextContent().length===n.getTextContent().length}}function mo(t,e,n){let r=[],i=[];var o=(e=e.list)?e.listitem:void 0;if(e&&e.nested)var l=e.nested.listitem;if(o!==void 0&&(o=o.split(" "),r.push(...o)),e){o=n.getParent(),o=O(o)&&o.getListType()==="check";let s=n.getChecked();o&&!s||i.push(e.listitemUnchecked),o&&s||i.push(e.listitemChecked),o&&r.push(s?e.listitemChecked:e.listitemUnchecked)}l!==void 0&&(l=l.split(" "),n.getChildren().some(s=>O(s))?r.push(...l):i.push(...l)),0<i.length&&Rt.removeClassNamesFromElement(t,...i),0<r.length&&Rt.addClassNamesToElement(t,...r)}function yo(t,e,n,r){r.getListType()==="check"?O(e.getFirstChild())?(t.removeAttribute("role"),t.removeAttribute("tabIndex"),t.removeAttribute("aria-checked")):(t.setAttribute("role","checkbox"),t.setAttribute("tabIndex","-1"),n&&e.__checked===n.__checked||t.setAttribute("aria-checked",e.getChecked()?"true":"false")):e.getChecked()!=null&&e.setChecked(void 0)}function jl(){return{node:ie()}}function ie(t){return new ke(void 0,t)}function A(t){return t instanceof ke}class At extends $.ElementNode{static getType(){return"list"}static clone(e){return new At(e.__listType||xo[e.__tag],e.__start,e.__key)}constructor(e,n,r){super(r),this.__listType=e=xo[e]||e,this.__tag=e==="number"?"ol":"ul",this.__start=n}getTag(){return this.__tag}getListType(){return this.__listType}getStart(){return this.__start}createDOM(e){let n=document.createElement(this.__tag);return this.__start!==1&&n.setAttribute("start",String(this.__start)),n.__lexicalListType=this.__listType,vo(n,e.theme,this),n}updateDOM(e,n,r){return e.__tag!==this.__tag?!0:(vo(n,r.theme,this),!1)}static importDOM(){return{ol:()=>({conversion:No,priority:0}),ul:()=>({conversion:No,priority:0})}}static importJSON(e){let n=ee(e.listType,e.start);return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...e){for(let r=0;r<e.length;r++){var n=e[r];if(A(n))super.append(n);else{let i=ie();O(n)||(n=$.$createTextNode(n.getTextContent())),i.append(n),super.append(i)}}return this}extractWithChild(e){return A(e)}}function vo(t,e,n){let r=[],i=[];var o=e.list;if(o!==void 0){let s=o[`${n.__tag}Depth`]||[];e=uo(n)-1;let d=e%s.length;var l=s[d];let u=o[n.__tag],a;if(o=o.nested,o!==void 0&&o.list&&(a=o.list),u!==void 0&&r.push(u),l!==void 0)for(l=l.split(" "),r.push(...l),l=0;l<s.length;l++)l!==d&&i.push(n.__tag+l);a!==void 0&&(n=a.split(" "),1<e?r.push(...n):i.push(...n))}0<i.length&&Rt.removeClassNamesFromElement(t,...i),0<r.length&&Rt.addClassNamesToElement(t,...r)}function Xl(t){let e=[];for(let n=0;n<t.length;n++){let r=t[n];A(r)?(e.push(r),r.getChildren().forEach(i=>{O(i)&&e.push(co(i))})):e.push(co(r))}return e}function No(t){t=t.nodeName.toLowerCase();let e=null;return t==="ol"?e=ee("number"):t==="ul"&&(e=ee("bullet")),{after:Xl,node:e}}let xo={ol:"number",ul:"bullet"};function ee(t,e=1){return new At(t,e)}function O(t){return t instanceof At}let Ql=$.createCommand(),Zl=$.createCommand(),ql=$.createCommand(),bl=$.createCommand();H.$createListItemNode=ie,H.$createListNode=ee,H.$getListDepth=uo,H.$handleListInsertParagraph=function(){var t=$.$getSelection();if(!$.$isRangeSelection(t)||!t.isCollapsed()||(t=t.anchor.getNode(),!A(t)||t.getTextContent()!==""))return!1;var e=lr(t),n=t.getParent();O(n)||Lt(40);let r=n.getParent(),i;if($.$isRootNode(r))i=$.$createParagraphNode(),e.insertAfter(i);else if(A(r))i=ie(),r.insertAfter(i);else return!1;if(i.select(),e=t.getNextSiblings(),0<e.length){let o=ee(n.getListType());$.$isParagraphNode(i)?i.insertAfter(o):(n=ie(),n.append(o),i.insertAfter(n)),e.forEach(l=>{l.remove(),o.append(l)})}return Vl(t),!0},H.$isListItemNode=A,H.$isListNode=O,H.INSERT_CHECK_LIST_COMMAND=ql,H.INSERT_ORDERED_LIST_COMMAND=Zl,H.INSERT_UNORDERED_LIST_COMMAND=Ql,H.ListItemNode=ke,H.ListNode=At,H.REMOVE_LIST_COMMAND=bl,H.indentList=function(){po("indent")},H.insertList=function(t,e){t.update(()=>{var n=$.$getSelection();if($.$isRangeSelection(n)){var r=n.getNodes();n=n.anchor.getNode();var i=n.getParent();if(fo(n,r))r=ee(e),$.$isRootNode(i)?(n.replace(r),i=ie(),$.$isElementNode(n)&&(i.setFormat(n.getFormatType()),i.setIndent(n.getIndent())),r.append(i)):A(n)&&(n=n.getParentOrThrow(),we(r,n.getChildren()),n.replace(r));else for(n=new Set,i=0;i<r.length;i++){var o=r[i];if($.$isElementNode(o)&&o.isEmpty()&&!n.has(o.getKey()))go(o,e);else if($.$isLeafNode(o))for(o=o.getParent();o!=null;){let s=o.getKey();if(O(o)){if(!n.has(s)){var l=ee(e);we(l,o.getChildren()),o.replace(l),b(l),n.add(s)}break}else{if(l=o.getParent(),$.$isRootNode(l)&&!n.has(s)){n.add(s),go(o,e);break}o=l}}}}})},H.outdentList=function(){po("outdent")},H.removeList=function(t){t.update(()=>{let e=$.$getSelection();if($.$isRangeSelection(e)){var n=new Set,r=e.getNodes(),i=e.anchor.getNode();if(fo(i,r))n.add(lr(i));else for(i=0;i<r.length;i++){var o=r[i];$.$isLeafNode(o)&&(o=Rt.$getNearestNodeOfType(o,ke),o!=null&&n.add(lr(o)))}for(let l of n){n=l,r=ao(l);for(let s of r)r=$.$createParagraphNode(),we(r,s.getChildren()),n.insertAfter(r),n=r,s.__key===e.anchor.key&&e.anchor.set(r.getKey(),0,"element"),s.__key===e.focus.key&&e.focus.set(r.getKey(),0,"element"),s.remove();l.remove()}}})};var hn=H,xe={},wt={},sr={},W={},C=ne;let dr=new Map;function _n(t){t=t.getLatest();let e=t.constructor.clone(t);return e.__parent=t.__parent,C.$isElementNode(t)&&C.$isElementNode(e)?(e.__children=Array.from(t.__children),e.__format=t.__format,e.__indent=t.__indent,e.__dir=t.__dir):C.$isTextNode(t)&&C.$isTextNode(e)&&(e.__format=t.__format,e.__style=t.__style,e.__mode=t.__mode,e.__detail=t.__detail),e}function Co(t,e,n,r,i,o){for(var l=e;t!==null;){for(e=t.getParent();e!==null&&e.excludeFromCopy("clone");)e=e.getParent();if(e===null)break;if(!C.$isElementNode(t)||!t.excludeFromCopy("clone")){let s=t.getKey(),d=o.get(s),u=d===void 0;if(u&&(d=_n(t),o.set(s,d)),!C.$isTextNode(d)||d.isSegmented()||d.isToken()?C.$isElementNode(d)&&(d.__children=d.__children.slice(r?l:0,r?void 0:(l||0)+1)):d.__text=d.__text.slice(r?l:0,r?n:l),C.$isRootNode(e)){u&&i.push(s);break}}l=o.get(e.getKey()),l=C.$isElementNode(l)?l.__children.indexOf(t.getKey()):t.getIndexWithinParent(),t=e}}function es(t){if(C.$isRangeSelection(t)){var e=t.anchor,n=t.focus;let[d,u]=t.getCharacterOffsets();if(t=t.getNodes(),t.length===0)return{nodeMap:[],range:[]};let a=t.length;var r=t[0],i=r.getParent();if(i!==null&&(!i.canBeEmpty()||C.$isRootNode(i))){var o=i.__children;if(o.length===a){for(var l=!0,s=0;s<o.length;s++)if(o[s]!==t[s].__key){l=!1;break}l&&(a++,t.push(i))}}for(i=t[a-1],e=e.isBefore(n),n=new Map,o=[],l=C.$isTextNode(r)&&a===1,Co(r,e?d:u,l?e?u:d:void 0,!0,o,n),r=0;r<a;r++){s=t[r];let c=s.getKey();if(!(n.has(c)||C.$isElementNode(s)&&s.excludeFromCopy("clone"))){let f=_n(s);C.$isRootNode(s.getParent())&&o.push(s.getKey()),c!=="root"&&n.set(c,f)}}return Co(i,l?void 0:e?u:d,void 0,!1,o,n),{nodeMap:Array.from(n.entries()),range:o}}if(C.$isGridSelection(t))return{nodeMap:t.getNodes().map(d=>{const u=d.getKey();return d=_n(d),[u,d]}),range:[t.gridKey]};throw Error("Minified Lexical error #1; visit https://lexical.dev/docs/error?code=1 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.")}function ur(t){return dr.get(t)||null}function kt(t,e){var n=ur(t.getStyle());e=n?{...n,...e}:e,n="";for(r in e)r&&(n+=`${r}: ${e[r]};`);var r=n;t.setStyle(r),dr.set(r,e)}function To(t,e,n,r){t.modify(e?"extend":"move",n,r)}function So(t){return t=t.anchor.getNode(),(C.$isRootNode(t)?t:t.getParentOrThrow()).getDirection()==="rtl"}function ts(t){for(;t!==null&&!C.$isRootNode(t);){let e=t.getLatest(),n=t.getParent();e.__children.length===0&&t.remove(!0),t=n}}function Eo(t){for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function Oo(t){let e=t.parentNode;if(e==null)throw Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(t)]}W.$addNodeStyle=function(t){t=t.getStyle();let e={},n=t.split(";");for(let r of n)if(r!==""){let[i,o]=r.split(/:([^]+)/);e[i.trim()]=o.trim()}dr.set(t,e)},W.$cloneContents=function(t){return es(t)},W.$cloneWithProperties=_n,W.$getSelectionStyleValueForProperty=function(t,e,n=""){let r=null,i=t.getNodes();var o=t.anchor,l=t.focus,s=t.isBackward();for(t=s?l.offset:o.offset,o=s?l.getNode():o.getNode(),l=0;l<i.length;l++){var d=i[l];if((l===0||t!==0||!d.is(o))&&C.$isTextNode(d)){s=e;var u=n;if(d=d.getStyle(),d=ur(d),s=d!==null&&d[s]||u,r===null)r=s;else if(r!==s){r="";break}}}return r===null?n:r},W.$isAtNodeEnd=function(t){return t.type==="text"?t.offset===t.getNode().getTextContentSize():t.offset===t.getNode().getChildrenSize()},W.$isParentElementRTL=So,W.$moveCaretSelection=To,W.$moveCharacter=function(t,e,n){let r=So(t);To(t,e,n?!r:r,"character")},W.$patchStyleText=function(t,e){var n=t.getNodes();let r=n.length-1,i=n[0],o=n[r];if(!t.isCollapsed()){var l=t.anchor,s=t.focus;t=i.getTextContent().length;var d=s.offset,u=l.offset;if(l=(s=l.isBefore(s))?u:d,s=s?d:u,l===i.getTextContentSize()){let a=i.getNextSibling();C.$isTextNode(a)&&(l=u=0,i=a)}if(i.is(o))C.$isTextNode(i)&&(l=u>d?d:u,s=u>d?u:d,l!==s&&(l===0&&s===t?(kt(i,e),i.select(l,s)):(n=i.splitText(l,s),n=l===0?n[0]:n[1],kt(n,e),n.select(0,s-l))));else for(C.$isTextNode(i)&&(l!==0&&(i=i.splitText(l)[1]),kt(i,e)),C.$isTextNode(o)&&(t=o.getTextContent().length,s!==t&&([o]=o.splitText(s)),s!==0&&kt(o,e)),t=1;t<r;t++)d=n[t],u=d.getKey(),C.$isTextNode(d)&&u!==i.getKey()&&u!==o.getKey()&&!d.isToken()&&kt(d,e)}},W.$selectAll=function(t){let e=t.anchor;t=t.focus;var n=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();let r=n.getFirstDescendant();n=n.getLastDescendant();let i="element",o="element",l=0;C.$isTextNode(r)?i="text":C.$isElementNode(r)||r===null||(r=r.getParentOrThrow()),C.$isTextNode(n)?(o="text",l=n.getTextContentSize()):C.$isElementNode(n)||n===null||(n=n.getParentOrThrow()),r&&n&&(e.set(r.getKey(),0,i),t.set(n.getKey(),l,o))},W.$shouldOverrideDefaultCharacterSelection=function(t,e){return t=C.$getDecoratorNode(t.focus,e),C.$isDecoratorNode(t)&&!t.isIsolated()},W.$sliceSelectedTextNodeContent=function(t,e){if(e.isSelected()&&!e.isSegmented()&&!e.isToken()&&(C.$isRangeSelection(t)||C.$isGridSelection(t))){var n=t.anchor.getNode(),r=t.focus.getNode(),i=e.is(n),o=e.is(r);if(i||o){i=t.isBackward();let[l,s]=t.getCharacterOffsets();t=n.is(r),o=e.is(i?r:n),r=e.is(i?n:r),n=0;let d;t?(n=l>s?s:l,d=l>s?l:s):o?(n=i?s:l,d=void 0):r&&(i=i?l:s,n=0,d=i),e.__text=e.__text.slice(n,d)}}return e},W.$wrapLeafNodesInElements=function(t,e,n){let r=t.getNodes(),i=r.length;var o=t.anchor;if(i===0||i===1&&o.type==="element"&&o.getNode().getChildrenSize()===0){t=o.type==="text"?o.getNode().getParentOrThrow():o.getNode(),o=t.getChildren();let h=e();h.setFormat(t.getFormatType()),h.setIndent(t.getIndent()),o.forEach(p=>h.append(p)),n&&(h=n.append(h)),t.replace(h)}else{var l=r[0],s=new Map;for(o=[],l=C.$isElementNode(l)?l:l.getParentOrThrow(),l.isInline()&&(l=l.getParentOrThrow());l!==null;){var d=l.getPreviousSibling();if(d!==null){l=d;break}if(l=l.getParentOrThrow(),C.$isRootNode(l))break}d=new Set;for(var u=0;u<i;u++){var a=r[u];C.$isElementNode(a)&&a.getChildrenSize()===0&&d.add(a.getKey())}var c=new Set;for(u=0;u<i;u++){a=r[u];var f=a.getParent();if(f!==null&&f.isInline()&&(f=f.getParent()),f!==null&&C.$isLeafNode(a)&&!c.has(a.getKey())){if(a=f.getKey(),s.get(a)===void 0){let h=e();h.setFormat(f.getFormatType()),h.setIndent(f.getIndent()),o.push(h),s.set(a,h),f.getChildren().forEach(p=>{h.append(p),c.add(p.getKey())}),ts(f)}}else d.has(a.getKey())&&(f=e(),f.setFormat(a.getFormatType()),f.setIndent(a.getIndent()),o.push(f),a.remove())}if(n)for(e=0;e<o.length;e++)n.append(o[e]);if(C.$isRootNode(l))if(e=l.getFirstChild(),C.$isElementNode(e)&&(l=e),e===null)if(n)l.append(n);else for(n=0;n<o.length;n++)l.append(o[n]);else if(n)e.insertBefore(n);else for(n=0;n<o.length;n++)e.insertBefore(o[n]);else if(n)l.insertAfter(n);else for(n=o.length-1;0<=n;n--)l.insertAfter(o[n]);n=C.$getPreviousSelection(),C.$isRangeSelection(n)&&n.anchor.getNode().isAttached()&&n.focus.getNode().isAttached()?C.$setSelection(n.clone()):t.dirty=!0}},W.createDOMRange=function(t,e,n,r,i){let o=e.getKey(),l=r.getKey(),s=document.createRange(),d=t.getElementByKey(o);if(t=t.getElementByKey(l),C.$isTextNode(e)&&(d=Eo(d)),C.$isTextNode(r)&&(t=Eo(t)),e===void 0||r===void 0||d===null||t===null)return null;d.nodeName==="BR"&&([d,n]=Oo(d)),t.nodeName==="BR"&&([t,i]=Oo(t)),e=d.firstChild,d===t&&e!=null&&e.nodeName==="BR"&&n===0&&i===0&&(i=1);try{s.setStart(d,n),s.setEnd(t,i)}catch{return null}return!s.collapsed||n===i&&o===l||(s.setStart(t,i),s.setEnd(d,n)),s},W.createRectsFromDOMRange=function(t,e){var n=t.getRootElement();if(n===null)return[];t=n.getBoundingClientRect(),n=getComputedStyle(n),n=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight),e=Array.from(e.getClientRects());let r=e.length,i;for(let o=0;o<r;o++){let l=e[o],s=l.width+n===t.width;i&&i.top===l.top&&i.left===l.left&&i.width===l.width&&i.height===l.height||s?(e.splice(o--,1),r--):i=l}return e},W.getStyleObjectFromCSS=ur,W.trimTextContentFromAnchor=function(t,e,n){let r=e.getNode();if(C.$isElementNode(r)){var i=r.getDescendantByIndex(e.offset);i!==null&&(r=i)}for(;0<n&&r!==null;){var o=r.getPreviousSibling(),l=0;if(o===null){i=r.getParentOrThrow();for(var s=i.getPreviousSibling();s===null;){if(i=i.getParent(),i===null){o=null;break}s=i.getPreviousSibling()}i!==null&&(l=i.isInline()?0:2,o=C.$isElementNode(s)?s.getLastDescendant():s)}let d=r.getTextContent();d===""&&C.$isElementNode(r)&&!r.isInline()&&(d=`
|
|
21
|
+
|
|
22
|
+
`),i=d.length,s=i-n;let u=d.slice(0,s);if(!C.$isTextNode(r)||n>=i)s=r.getParent(),r.remove(),s!=null&&s.getChildrenSize()===0&&s.remove(),n-=i+l,r=o;else{let a=r.getKey();o=t.getEditorState().read(()=>{const c=C.$getNodeByKey(a);return C.$isTextNode(c)&&c.isSimpleText()?c.getTextContent():null}),o!==null&&o!==d?(n=C.$getPreviousSelection(),i=r,r.isSimpleText()?r.setTextContent(o):(i=C.$createTextNode(o),r.replace(i)),C.$isRangeSelection(n)&&n.isCollapsed()&&(n=n.anchor.offset,i.select(n,n))):r.isSimpleText()?(o=e.key===a,l=e.offset,l<n&&(l=i),n=o?l-n:0,i=o?l:s,o&&n===0?([n]=r.splitText(n,i),n.remove()):([,n]=r.splitText(n,i),n.remove())):(n=C.$createTextNode(u),r.replace(n)),n=0}}};var ar=W,$o=ar,be=ne;function Mo(t,e,n,r){let i=e!=null?n.isSelected():!0,o=be.$isElementNode(n)&&n.excludeFromCopy("html"),l=$o.$cloneWithProperties(n);l=be.$isTextNode(l)&&e!=null?$o.$sliceSelectedTextNodeContent(e,l):l;let s=be.$isElementNode(l)?l.getChildren():[],{element:d,after:u}=l.exportDOM(t);if(!d)return!1;let a=new DocumentFragment;for(let c=0;c<s.length;c++){let f=s[c],h=Mo(t,e,f,a);!i&&be.$isElementNode(n)&&h&&n.extractWithChild(f,e,"html")&&(i=!0)}return i&&!o?(d.append(a),r.append(d),u&&(t=u.call(l,d))&&d.replaceWith(t)):r.append(a),i}let Do=new Set(["STYLE"]);function Ro(t,e,n=new Map,r){let i=[];if(Do.has(t.nodeName))return i;let o=null;var l,{nodeName:s}=t,d=e._htmlConversions.get(s.toLowerCase());if(s=null,d!==void 0)for(l of d)d=l(t),d!==null&&(s===null||s.priority<d.priority)&&(s=d);if(s=(l=s!==null?s.conversion:null)?l(t):null,l=null,s!==null){if(l=s.after,o=s.node,o!==null){for(var[,u]of n)if(o=u(o,r),!o)break;o&&i.push(o)}s.forChild!=null&&n.set(t.nodeName,s.forChild)}for(t=t.childNodes,r=[],u=0;u<t.length;u++)r.push(...Ro(t[u],e,new Map(n),o));return l!=null&&(r=l(r)),o==null?i=i.concat(r):be.$isElementNode(o)&&o.append(...r),i}sr.$generateHtmlFromNodes=function(t,e){if(document==null||window==null)throw Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),r=be.$getRoot().getChildren();for(let i=0;i<r.length;i++){let o=r[i];e!==void 0&&Mo(t,e,o,n)}return n.innerHTML},sr.$generateNodesFromDOM=function(t,e){let n=[];e=e.body?Array.from(e.body.childNodes):[];let r=e.length;for(let o=0;o<r;o++){var i=e[o];Do.has(i.nodeName)||(i=Ro(i,t),i!==null&&(n=n.concat(i)))}return n};var ns=sr,Lo=ns,Ao=hn,cr=ar,Pt=Ae,S=ne;function _e(t){throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?code=${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function wo(t,e,n){(S.$isGridSelection(n)||Pt.$findMatchingParent(n.anchor.getNode(),r=>S.$isGridCellNode(r))!==null&&Pt.$findMatchingParent(n.focus.getNode(),r=>S.$isGridCellNode(r))!==null)&&e.length===1&&S.$isGridNode(e[0])?is(e,n,!1,t):rs(e,n)}function rs(t,e){let n=[],r=null,i=null;for(let o=0;o<t.length;o++){let l=t[o];Ao.$isListItemNode(l)?(i==null&&(i=Ao.$createListNode("bullet"),n.push(i)),i.append(l)):(i!=null&&(i=null),S.$isDecoratorNode(l)&&!l.isTopLevel()||S.$isElementNode(l)&&l.isInline()||S.$isTextNode(l)||S.$isLineBreakNode(l)?(r===null&&(r=S.$createParagraphNode(),n.push(r)),r!==null&&r.append(l)):(n.push(l),r=null))}S.$isRangeSelection(e)?e.insertNodes(n):S.$isGridSelection(e)&&(t=e.anchor.getNode(),S.$isGridCellNode(t)||_e(41),t.append(...n))}function is(t,e,n,r){t.length===1&&S.$isGridNode(t[0])||_e(42);var i=t[0];t=i.getChildren(),n=i.getFirstChildOrThrow().getChildrenSize();var o=i.getChildrenSize(),l=Pt.$findMatchingParent(e.anchor.getNode(),h=>S.$isGridCellNode(h));e=(i=l&&Pt.$findMatchingParent(l,h=>S.$isGridRowNode(h)))&&Pt.$findMatchingParent(i,h=>S.$isGridNode(h)),S.$isGridCellNode(l)&&S.$isGridRowNode(i)&&S.$isGridNode(e)||_e(43);var s=i.getIndexWithinParent(),d=Math.min(e.getChildrenSize()-1,s+o-1);o=l.getIndexWithinParent(),l=Math.min(i.getChildrenSize()-1,o+n-1),n=Math.min(o,l),i=Math.min(s,d),o=Math.max(o,l),s=Math.max(s,d),d=e.getChildren(),l=0;let u,a;for(let h=i;h<=s;h++){var c=d[h];S.$isGridRowNode(c)||_e(24);var f=t[l];S.$isGridRowNode(f)||_e(24),c=c.getChildren(),f=f.getChildren();let p=0;for(let x=n;x<=o;x++){let T=c[x];S.$isGridCellNode(T)||_e(25);let D=f[p];S.$isGridCellNode(D)||_e(25),h===i&&x===n?u=T.getKey():h===s&&x===o&&(a=T.getKey());let R=T.getChildren();D.getChildren().forEach(P=>{S.$isTextNode(P)&&S.$createParagraphNode().append(P),T.append(P)}),R.forEach(P=>P.remove()),p++}l++}u&&a&&(t=S.$createGridSelection(),t.set(e.getKey(),u,a),S.$setSelection(t),r.dispatchCommand(S.SELECTION_CHANGE_COMMAND,void 0))}function ko(t,e,n,r=[]){let i=e!=null?n.isSelected():!0,o=S.$isElementNode(n)&&n.excludeFromCopy("html");var l=cr.$cloneWithProperties(n);l=S.$isTextNode(l)&&e!=null?cr.$sliceSelectedTextNodeContent(e,l):l;let s=S.$isElementNode(l)?l.getChildren():[];var d=l;let u=d.exportJSON();u.type!==d.constructor.getType()&&_e(58);var a=u.children;for(S.$isElementNode(d)&&(Array.isArray(a)||_e(59)),S.$isTextNode(l)&&(u.text=l.__text),l=0;l<s.length;l++)d=s[l],a=ko(t,e,d,u.children),!i&&S.$isElementNode(n)&&a&&n.extractWithChild(d,e,"clone")&&(i=!0);if(i&&!o)r.push(u);else if(Array.isArray(u.children))for(t=0;t<u.children.length;t++)r.push(u.children[t]);return i}wt.$getHtmlContent=function(t){let e=S.$getSelection();if(e==null)throw Error("Expected valid LexicalSelection");return S.$isRangeSelection(e)&&e.isCollapsed()||e.getNodes().length===0?null:Lo.$generateHtmlFromNodes(t,e)},wt.$getLexicalContent=function(t){let e=S.$getSelection();if(e==null)throw Error("Expected valid LexicalSelection");if(S.$isRangeSelection(e)&&e.isCollapsed()||e.getNodes().length===0)return null;var n=JSON,r=n.stringify;let i=[],o=S.$getRoot().getChildren();for(let l=0;l<o.length;l++)ko(t,e,o[l],i);return r.call(n,{namespace:t._config.namespace,nodes:i})},wt.$insertDataTransferForPlainText=function(t,e){t=t.getData("text/plain"),t!=null&&e.insertRawText(t)},wt.$insertDataTransferForRichText=function(t,e,n){var r=t.getData("application/x-lexical-editor");if(r)try{var i=JSON.parse(r);if(i.namespace===n._config.namespace&&Array.isArray(i.nodes)){var o=i.nodes;for(r=[],i=0;i<o.length;i++){let s=S.$parseSerializedNode(o[i]);S.$isTextNode(s)&&cr.$addNodeStyle(s),r.push(s)}return wo(n,r,e)}}catch{}if(o=t.getData("text/html"))try{var l=new DOMParser().parseFromString(o,"text/html");let s=Lo.$generateNodesFromDOM(n,l);return wo(n,s,e)}catch{}if(t=t.getData("text/plain"),t!=null)if(S.$isRangeSelection(e))for(t=t.split(/\r?\n/),n=t.length,l=0;l<n;l++)e.insertText(t[l]),l<n-1&&e.insertParagraph();else e.insertRawText(t)};var os=wt,pn=os,mn=ar,et=Ae,g=ne;let tt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ls=tt&&"documentMode"in document?document.documentMode:null;tt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),tt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);let ss=tt&&"InputEvent"in window&&!ls?"getTargetRanges"in new window.InputEvent("input"):!1,ds=tt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),us=tt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,yn={tag:"history-merge"};class It extends g.ElementNode{static getType(){return"quote"}static clone(e){return new It(e.__key)}constructor(e){super(e)}createDOM(e){let n=document.createElement("blockquote");return et.addClassNamesToElement(n,e.theme.quote),n}updateDOM(){return!1}static importDOM(){return{blockquote:()=>({conversion:as,priority:0})}}static importJSON(e){let n=fr();return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(){let e=g.$createParagraphNode(),n=this.getDirection();return e.setDirection(n),this.insertAfter(e),e}collapseAtStart(){let e=g.$createParagraphNode();return this.getChildren().forEach(n=>e.append(n)),this.replace(e),!0}}function fr(){return new It}class Ft extends g.ElementNode{static getType(){return"heading"}static clone(e){return new Ft(e.__tag,e.__key)}constructor(e,n){super(n),this.__tag=e}getTag(){return this.__tag}createDOM(e){let n=this.__tag,r=document.createElement(n);return e=e.theme.heading,e!==void 0&&et.addClassNamesToElement(r,e[n]),r}updateDOM(){return!1}static importDOM(){return{h1:()=>({conversion:nt,priority:0}),h2:()=>({conversion:nt,priority:0}),h3:()=>({conversion:nt,priority:0}),h4:()=>({conversion:nt,priority:0}),h5:()=>({conversion:nt,priority:0}),h6:()=>({conversion:nt,priority:0}),p:e=>(e=e.firstChild,e!==null&&Po(e)?{conversion:()=>({node:null}),priority:3}:null),span:e=>Po(e)?{conversion:()=>({node:vn("h1")}),priority:3}:null}}static importJSON(e){let n=vn(e.tag);return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(){let e=g.$createParagraphNode(),n=this.getDirection();return e.setDirection(n),this.insertAfter(e),e}collapseAtStart(){let e=g.$createParagraphNode();return this.getChildren().forEach(n=>e.append(n)),this.replace(e),!0}extractWithChild(){return!0}}function Po(t){return t.nodeName.toLowerCase()==="span"?t.style.fontSize==="26pt":!1}function nt(t){t=t.nodeName.toLowerCase();let e=null;return(t==="h1"||t==="h2"||t==="h3"||t==="h4"||t==="h5"||t==="h6")&&(e=vn(t)),{node:e}}function as(){return{node:fr()}}function vn(t){return new Ft(t)}function cs(t,e){if(e!==null){if(e===void 0)t.update(()=>{var n=g.$getRoot();if(n.isEmpty()){let r=g.$createParagraphNode();n.append(r),n=document.activeElement,(g.$getSelection()!==null||n!==null&&n===t.getRootElement())&&r.select()}},yn);else if(e!==null)switch(typeof e){case"string":let n=t.parseEditorState(e);t.setEditorState(n,yn);break;case"object":t.setEditorState(e,yn);break;case"function":t.update(()=>{g.$getRoot().isEmpty()&&e(t)},yn)}}}function fs(t,e){t.preventDefault(),e.update(()=>{let n=g.$getSelection(),r=t instanceof InputEvent?null:t.clipboardData;r!=null&&(g.$isRangeSelection(n)||g.$isGridSelection(n))&&pn.$insertDataTransferForRichText(r,n,e)},{tag:"paste"})}function Io(t,e){var n=g.$getSelection();if(n!==null){t.preventDefault(),t=t instanceof KeyboardEvent?null:t.clipboardData;let r=pn.$getHtmlContent(e);e=pn.$getLexicalContent(e),t!=null?(r!==null&&t.setData("text/html",r),e!==null&&t.setData("application/x-lexical-editor",e),n=n.getTextContent(),t.setData("text/plain",n)):(n=navigator.clipboard,n!=null&&(t=[new ClipboardItem({"text/html":new Blob([r],{type:"text/html"})})],n.write(t)))}}function gs(t,e){Io(t,e),t=g.$getSelection(),g.$isRangeSelection(t)?t.removeText():g.$isNodeSelection(t)&&t.getNodes().forEach(n=>n.remove())}function Fo(t,e){var n=g.$getSelection();if(g.$isRangeSelection(n)){var r=new Set;n=n.getNodes();for(let o=0;o<n.length;o++){let l=n[o];var i=l.getKey();r.has(i)||(r.add(i),i=et.$getNearestBlockElementAncestorOrThrow(l),i.canInsertTab()?t(l):i.canIndent()&&e(i))}}}function rt(t){return t=g.$getNearestNodeFromDOMNode(t),g.$isDecoratorNode(t)}xe.$createHeadingNode=vn,xe.$createQuoteNode=fr,xe.$isHeadingNode=function(t){return t instanceof Ft},xe.$isQuoteNode=function(t){return t instanceof It},xe.HeadingNode=Ft,xe.QuoteNode=It,xe.registerRichText=function(t,e){let n=et.mergeRegister(t.registerCommand(g.CLICK_COMMAND,()=>{const r=g.$getSelection();return g.$isNodeSelection(r)?(r.clear(),!0):!1},0),t.registerCommand(g.DELETE_CHARACTER_COMMAND,r=>{const i=g.$getSelection();return g.$isRangeSelection(i)?(i.deleteCharacter(r),!0):!1},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.DELETE_WORD_COMMAND,r=>{const i=g.$getSelection();return g.$isRangeSelection(i)?(i.deleteWord(r),!0):!1},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.DELETE_LINE_COMMAND,r=>{const i=g.$getSelection();return g.$isRangeSelection(i)?(i.deleteLine(r),!0):!1},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.CONTROLLED_TEXT_INSERTION_COMMAND,r=>{const i=g.$getSelection();if(typeof r=="string")g.$isRangeSelection(i)?i.insertText(r):g.$isGridSelection(i);else{if(!g.$isRangeSelection(i)&&!g.$isGridSelection(i))return!1;const o=r.dataTransfer;o!=null?pn.$insertDataTransferForRichText(o,i,t):g.$isRangeSelection(i)&&(r=r.data)&&i.insertText(r)}return!0},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.REMOVE_TEXT_COMMAND,()=>{const r=g.$getSelection();return g.$isRangeSelection(r)?(r.removeText(),!0):!1},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.FORMAT_TEXT_COMMAND,r=>{const i=g.$getSelection();return g.$isRangeSelection(i)?(i.formatText(r),!0):!1},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.FORMAT_ELEMENT_COMMAND,r=>{var i=g.$getSelection();if(!g.$isRangeSelection(i)&&!g.$isNodeSelection(i))return!1;i=i.getNodes();for(const o of i)et.$getNearestBlockElementAncestorOrThrow(o).setFormat(r);return!0},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.INSERT_LINE_BREAK_COMMAND,r=>{const i=g.$getSelection();return g.$isRangeSelection(i)?(i.insertLineBreak(r),!0):!1},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.INSERT_PARAGRAPH_COMMAND,()=>{const r=g.$getSelection();return g.$isRangeSelection(r)?(r.insertParagraph(),!0):!1},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.INDENT_CONTENT_COMMAND,()=>(Fo(()=>{t.dispatchCommand(g.CONTROLLED_TEXT_INSERTION_COMMAND," ")},r=>{const i=r.getIndent();i!==10&&r.setIndent(i+1)}),!0),g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.OUTDENT_CONTENT_COMMAND,()=>(Fo(r=>{g.$isTextNode(r)&&(r=r.getTextContent(),r[r.length-1]===" "&&t.dispatchCommand(g.DELETE_CHARACTER_COMMAND,!0))},r=>{const i=r.getIndent();i!==0&&r.setIndent(i-1)}),!0),g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.KEY_ARROW_UP_COMMAND,r=>{const i=g.$getSelection();return g.$isNodeSelection(i)&&!rt(r.target)&&(r=i.getNodes(),0<r.length)?(r[0].selectPrevious(),!0):!1},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.KEY_ARROW_DOWN_COMMAND,r=>{const i=g.$getSelection();return g.$isNodeSelection(i)&&!rt(r.target)&&(r=i.getNodes(),0<r.length)?(r[0].selectNext(0,0),!0):!1},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.KEY_ARROW_LEFT_COMMAND,r=>{const i=g.$getSelection();if(g.$isNodeSelection(i)&&!rt(r.target)){var o=i.getNodes();if(0<o.length)return r.preventDefault(),o[0].selectPrevious(),!0}return g.$isRangeSelection(i)&&mn.$shouldOverrideDefaultCharacterSelection(i,!0)?(o=r.shiftKey,r.preventDefault(),mn.$moveCharacter(i,o,!0),!0):!1},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.KEY_ARROW_RIGHT_COMMAND,r=>{const i=g.$getSelection();if(g.$isNodeSelection(i)&&!rt(r.target)){var o=i.getNodes();if(0<o.length)return r.preventDefault(),o[0].selectNext(0,0),!0}return g.$isRangeSelection(i)?(o=r.shiftKey,mn.$shouldOverrideDefaultCharacterSelection(i,!1)?(r.preventDefault(),mn.$moveCharacter(i,o,!1),!0):!1):!1},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.KEY_BACKSPACE_COMMAND,r=>{if(rt(r.target))return!1;const i=g.$getSelection();if(!g.$isRangeSelection(i))return!1;r.preventDefault(),{anchor:r}=i;const o=r.getNode();return i.isCollapsed()&&r.offset===0&&!g.$isRootNode(o)&&0<et.$getNearestBlockElementAncestorOrThrow(o).getIndent()?t.dispatchCommand(g.OUTDENT_CONTENT_COMMAND,void 0):t.dispatchCommand(g.DELETE_CHARACTER_COMMAND,!0)},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.KEY_DELETE_COMMAND,r=>{if(rt(r.target))return!1;const i=g.$getSelection();return g.$isRangeSelection(i)?(r.preventDefault(),t.dispatchCommand(g.DELETE_CHARACTER_COMMAND,!1)):!1},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.KEY_ENTER_COMMAND,r=>{const i=g.$getSelection();if(!g.$isRangeSelection(i))return!1;if(r!==null){if((us||ds)&&ss)return!1;if(r.preventDefault(),r.shiftKey)return t.dispatchCommand(g.INSERT_LINE_BREAK_COMMAND,!1)}return t.dispatchCommand(g.INSERT_PARAGRAPH_COMMAND,void 0)},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.KEY_TAB_COMMAND,r=>{const i=g.$getSelection();return g.$isRangeSelection(i)?(r.preventDefault(),t.dispatchCommand(r.shiftKey?g.OUTDENT_CONTENT_COMMAND:g.INDENT_CONTENT_COMMAND,void 0)):!1},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.KEY_ESCAPE_COMMAND,()=>{const r=g.$getSelection();return g.$isRangeSelection(r)?(t.blur(),!0):!1},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.DROP_COMMAND,r=>{const i=g.$getSelection();return g.$isRangeSelection(i)?(r.preventDefault(),!0):!1},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.DRAGSTART_COMMAND,r=>{const i=g.$getSelection();return g.$isRangeSelection(i)?(r.preventDefault(),!0):!1},g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.COPY_COMMAND,r=>(Io(r,t),!0),g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.CUT_COMMAND,r=>(gs(r,t),!0),g.COMMAND_PRIORITY_EDITOR),t.registerCommand(g.PASTE_COMMAND,r=>{const i=g.$getSelection();return g.$isRangeSelection(i)||g.$isGridSelection(i)?(fs(r,t),!0):!1},g.COMMAND_PRIORITY_EDITOR));return cs(t,e),n};var gr=xe,pe={},hs=Ae,Ce=ne;class it extends Ce.ElementNode{static getType(){return"link"}static clone(e){return new it(e.__url,{rel:e.__rel,target:e.__target},e.__key)}constructor(e,n={},r){super(r);let{target:i=null,rel:o=null}=n;this.__url=e,this.__target=i,this.__rel=o}createDOM(e){let n=document.createElement("a");return n.href=this.__url,this.__target!==null&&(n.target=this.__target),this.__rel!==null&&(n.rel=this.__rel),hs.addClassNamesToElement(n,e.theme.link),n}updateDOM(e,n){let r=this.__url,i=this.__target,o=this.__rel;return r!==e.__url&&(n.href=r),i!==e.__target&&(i?n.target=i:n.removeAttribute("target")),o!==e.__rel&&(o?n.rel=o:n.removeAttribute("rel")),!1}static importDOM(){return{a:()=>({conversion:_s,priority:1})}}static importJSON(e){let n=Bt(e.url,{rel:e.rel,target:e.target});return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){this.getWritable().__url=e}getTarget(){return this.getLatest().__target}setTarget(e){this.getWritable().__target=e}getRel(){return this.getLatest().__rel}setRel(e){this.getWritable().__rel=e}insertNewAfter(e){if(e=this.getParentOrThrow().insertNewAfter(e),Ce.$isElementNode(e)){let n=Bt(this.__url,{rel:this.__rel,target:this.__target});return e.append(n),n}return null}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,n){if(!Ce.$isRangeSelection(n))return!1;e=n.anchor.getNode();let r=n.focus.getNode();return this.isParentOf(e)&&this.isParentOf(r)&&0<n.getTextContent().length}}function _s(t){let e=null;return t instanceof HTMLAnchorElement&&(e=Bt(t.getAttribute("href")||"",{rel:t.getAttribute("rel"),target:t.getAttribute("target")})),{node:e}}function Bt(t,e){return new it(t,e)}function Pe(t){return t instanceof it}class Kt extends it{static getType(){return"autolink"}static clone(e){return new Kt(e.__url,{rel:e.__rel,target:e.__target},e.__key)}static importJSON(e){let n=hr(e.url,{rel:e.rel,target:e.target});return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),type:"autolink",version:1}}insertNewAfter(e){if(e=this.getParentOrThrow().insertNewAfter(e),Ce.$isElementNode(e)){let n=hr(this.__url,{rel:this._rel,target:this.__target});return e.append(n),n}return null}}function hr(t,e){return new Kt(t,e)}let ps=Ce.createCommand();function ms(t){return ys(t,e=>Pe(e))}function ys(t,e){for(;t!==null&&(t=t.getParent())!==null&&!e(t););return t}pe.$createAutoLinkNode=hr,pe.$createLinkNode=Bt,pe.$isAutoLinkNode=function(t){return t instanceof Kt},pe.$isLinkNode=Pe,pe.AutoLinkNode=Kt,pe.LinkNode=it,pe.TOGGLE_LINK_COMMAND=ps,pe.toggleLink=function(t,e={}){let{target:n,rel:r}=e;if(e=Ce.$getSelection(),Ce.$isRangeSelection(e))if(e=e.extract(),t===null)e.forEach(o=>{if(o=o.getParent(),Pe(o)){let l=o.getChildren();for(let s=0;s<l.length;s++)o.insertBefore(l[s]);o.remove()}});else{if(e.length===1){var i=e[0];if(i=Pe(i)?i:ms(i),i!==null){i.setURL(t),n!==void 0&&i.setTarget(n),r!==void 0&&i.setRel(r);return}}let o=null,l=null;e.forEach(s=>{var d=s.getParent();if(d!==l&&d!==null&&(!Ce.$isElementNode(s)||s.isInline()))if(Pe(d))l=d,d.setURL(t),n!==void 0&&d.setTarget(n),r!==void 0&&d.setRel(r);else if(d.is(o)||(o=d,l=Bt(t,{rel:r,target:n}),Pe(d)?s.getPreviousSibling()===null?d.insertBefore(l):d.insertAfter(l):s.insertBefore(l)),Pe(s)){if(!s.is(l)){if(l!==null){d=s.getChildren();for(let u=0;u<d.length;u++)l.append(d[u])}s.remove()}}else l!==null&&l.append(s)})}};var vs=pe;const Ns={paragraph:void 0,heading:{h1:void 0,h2:void 0,h3:void 0,h4:void 0,h5:void 0,h6:void 0},quote:void 0,aside:void 0,list:{nested:{listitem:void 0},ol:void 0,ul:void 0,listitem:void 0},link:void 0,text:{bold:void 0,italic:"italic",overflowed:void 0,hashtag:void 0,underline:void 0,strikethrough:void 0,underlinestrikethrough:void 0,code:void 0},code:void 0};var _r={exports:{}},Nn={};/**
|
|
23
|
+
* @license React
|
|
24
|
+
* react-jsx-runtime.production.min.js
|
|
25
|
+
*
|
|
26
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
27
|
+
*
|
|
28
|
+
* This source code is licensed under the MIT license found in the
|
|
29
|
+
* LICENSE file in the root directory of this source tree.
|
|
30
|
+
*/var xs=se.default,Cs=Symbol.for("react.element"),Ts=Symbol.for("react.fragment"),Ss=Object.prototype.hasOwnProperty,Es=xs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Os={key:!0,ref:!0,__self:!0,__source:!0};function Bo(t,e,n){var r,i={},o=null,l=null;n!==void 0&&(o=""+n),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(l=e.ref);for(r in e)Ss.call(e,r)&&!Os.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Cs,type:t,key:o,ref:l,props:i,_owner:Es.current}}Nn.Fragment=Ts,Nn.jsx=Bo,Nn.jsxs=Bo,function(t){t.exports=Nn}(_r);const Te=_r.exports.jsx,$s=_r.exports.jsxs,Ms=[gr.HeadingNode,hn.ListNode,hn.ListItemNode,gr.QuoteNode,vs.LinkNode];function Ds(t){console.error(t)}const Rs={namespace:"KoenigEditor",theme:Ns},Ls=({nodes:t=[...Ms],onError:e=Ds,children:n})=>{const r=se.default.useMemo(()=>Object.assign({},Rs,{nodes:t,onError:e}),[t,e]);return Te(Gl.LexicalComposer,{initialConfig:r,children:n})};var Ko={},ae={},V=ne;function pr(t,e=!0){return t?!1:(t=Wo(),e&&(t=t.trim()),t==="")}function Wo(){return V.$getRoot().getTextContent()}function zo(t,e=!0){if(!e||!pr(t,!1)||(t=V.$getRoot().getChildren(),e=t.length,1<e))return!1;for(let r=0;r<e;r++){var n=t[r];if(V.$isElementNode(n)){if(n.__type!=="paragraph"||n.__indent!==0)return!1;n=n.getChildren();let i=n.length;for(let o=0;o<i;o++)if(!V.$isTextNode(n[r]))return!1}}return!0}ae.$canShowPlaceholder=zo,ae.$canShowPlaceholderCurry=function(t,e=!0){return()=>zo(t,e)},ae.$findNodeWithOffsetFromJoinedText=function(t,e,n,r){r=r.getChildren();let i=r.length,o=0,l=!1;for(let d=0;d<i&&!(o>e);++d){let u=r[d],a=V.$isTextNode(u);var s=a?u.getTextContent().length:n;if(s=o+s,(l===!1&&o===t||o===0&&o===t||o<t&&t<=s)&&V.$isTextNode(u))return{node:u,offset:t-o};o=s,l=a}return null},ae.$findTextIntersectionFromCharacters=function(t,e){var n=t.getFirstChild();t=0;e:for(;n!==null;){if(V.$isElementNode(n)){var r=n.getFirstChild();if(r!==null){n=r;continue}}else if(V.$isTextNode(n)){if(r=n.getTextContentSize(),t+r>e)return{node:n,offset:e-t};t+=r}if(r=n.getNextSibling(),r!==null)n=r;else{for(n=n.getParent();n!==null;){if(r=n.getNextSibling(),r!==null){n=r;continue e}n=n.getParent()}break}}return null},ae.$isRootTextContentEmpty=pr,ae.$isRootTextContentEmptyCurry=function(t,e){return()=>pr(t,e)},ae.$joinTextNodesInElementNode=function(t,e,n){let r="";t=t.getChildren();let i=t.length;for(let o=0;o<i;++o){let l=t[o];if(V.$isTextNode(l)){let s=l.getTextContent();if(l.is(n.node)){if(n.offset>s.length)throw Error("Minified Lexical error #2; visit https://lexical.dev/docs/error?code=2 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");r+=l.getTextContent().substr(0,n.offset);break}else r+=s}else r+=e}return r},ae.$rootTextContent=Wo,ae.registerLexicalTextEntity=function(t,e,n,r){let i=l=>{const s=V.$createTextNode(l.getTextContent());s.setFormat(l.getFormat()),l.replace(s)},o=t.registerNodeTransform(V.TextNode,l=>{if(l.isSimpleText()){var s=l.getPreviousSibling(),d=l.getTextContent(),u=l;if(V.$isTextNode(s)){var a=s.getTextContent(),c=e(a+d);if(s instanceof n){if(c===null||s.getLatest().__mode!==0){i(s);return}if(c=c.end-a.length,0<c){u=d.slice(0,c),u=a+u,s.select(),s.setTextContent(u),c===d.length?l.remove():(s=d.slice(c),l.setTextContent(s));return}}else if(c===null||c.start<a.length)return}for(;;){if(l=e(d),d=c=l===null?"":d.slice(l.end),c===""){if(a=u.getNextSibling(),V.$isTextNode(a)){if(c=u.getTextContent()+a.getTextContent(),c=e(c),c===null){a instanceof n?i(a):a.markDirty();break}else if(c.start!==0)break}}else if(a=e(c),a!==null&&a.start===0)break;if(l===null)break;if(l.start===0&&V.$isTextNode(s)&&s.isTextEntity())continue;let f;if(l.start===0?[f,u]=u.splitText(l.end):[,f,u]=u.splitText(l.start,l.end),l=r(f),f.replace(l),u==null)break}}});return t=t.registerNodeTransform(n,l=>{var s=l.getTextContent();const d=e(s);d===null||d.start!==0?i(l):s.length>d.end?l.splitText(d.end):(s=l.getPreviousSibling(),V.$isTextNode(s)&&s.isTextEntity()&&(i(s),i(l)),s=l.getNextSibling(),V.$isTextNode(s)&&s.isTextEntity()&&(i(s),l instanceof n&&i(l)))}),[o,t]};var As=ae,Yo={},xn=ne;Yo.registerDragonSupport=function(t){let e=n=>{var r=t.getRootElement();if(document.activeElement===r&&(r=n.data,typeof r=="string")){try{var i=JSON.parse(r)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"&&(i=i.payload)&&i.functionId==="makeChanges"&&(i=i.args)){const[o,l,s,d,u]=i;t.update(()=>{const a=xn.$getSelection();if(xn.$isRangeSelection(a)){var c=a.anchor;let f=c.getNode(),h=0,p=0;xn.$isTextNode(f)&&0<=o&&0<=l&&(h=o,p=o+l,a.setTextNodeRange(f,h,f,p)),(h!==p||s!=="")&&(a.insertRawText(s),f=c.getNode()),xn.$isTextNode(f)&&(h=d,p=d+u,c=f.getTextContentSize(),h=h>c?c:h,p=p>c?c:p,a.setTextNodeRange(f,h,f,p)),n.stopImmediatePropagation()}})}}};return window.addEventListener("message",e,!0),()=>{window.removeEventListener("message",e,!0)}};var ws=Yo,ks=Fe,Se=se.default,Ps=As,Ho=Ae,Uo=rl.default,Is=ws,Fs=gr,mr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Se.useLayoutEffect:Se.useEffect;function Go(t){return t.getEditorState().read(Ps.$canShowPlaceholderCurry(t.isComposing(),t.isEditable()))}function Bs(t){let[e,n]=Se.useState(()=>Go(t));return mr(()=>{function r(){let i=Go(t);n(i)}return r(),Ho.mergeRegister(t.registerUpdateListener(()=>{r()}),t.registerEditableListener(()=>{r()}))},[t]),e}function Ks(t){let[e,n]=Se.useState(()=>t.getDecorators());return mr(()=>t.registerDecoratorListener(r=>{Uo.flushSync(()=>{n(r)})}),[t]),Se.useEffect(()=>{n(t.getDecorators())},[t]),Se.useMemo(()=>{let r=[],i=Object.keys(e);for(let l=0;l<i.length;l++){var o=i[l];let s=e[o];o=t.getElementByKey(o),o!==null&&r.push(Uo.createPortal(s,o))}return r},[e,t])}function Ws(t,e){mr(()=>Ho.mergeRegister(Fs.registerRichText(t,e),Is.registerDragonSupport(t)),[t])}Ko.RichTextPlugin=function({contentEditable:t,placeholder:e,initialEditorState:n}){let[r]=ks.useLexicalComposerContext(),i=Bs(r),o=Ks(r);return Ws(r,n),Se.createElement(Se.Fragment,null,t,i&&e,o)};var zs=Ko,Jo={},Ys=Fe,Wt=se.default,Hs=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Wt.useLayoutEffect:Wt.useEffect;Jo.ContentEditable=function({ariaActiveDescendantID:t,ariaAutoComplete:e,ariaControls:n,ariaDescribedBy:r,ariaExpanded:i,ariaLabel:o,ariaLabelledBy:l,ariaMultiline:s,ariaOwneeID:d,ariaRequired:u,autoCapitalize:a,autoComplete:c,autoCorrect:f,className:h,id:p,role:x="textbox",spellCheck:T=!0,style:D,tabIndex:R,testid:P}){let[z]=Ys.useLexicalComposerContext(),[le,zt]=Wt.useState(!0),Ee=Wt.useCallback(ot=>{z.setRootElement(ot)},[z]);return Hs(()=>(zt(z.isEditable()),z.registerEditableListener(ot=>{zt(ot)})),[z]),Wt.createElement("div",{"aria-activedescendant":le?t:null,"aria-autocomplete":le?e:null,"aria-controls":le?n:null,"aria-describedby":r,"aria-expanded":le&&x==="combobox"?!!i:null,"aria-label":o,"aria-labelledby":l,"aria-multiline":s,"aria-owns":le?d:null,"aria-required":u,autoCapitalize:a!==void 0?String(a):void 0,autoComplete:c,autoCorrect:f!==void 0?String(f):void 0,className:h,contentEditable:le,"data-testid":P,id:p,ref:Ee,role:le?x:void 0,spellCheck:T,style:D,tabIndex:R})};var Us=Jo,yr={},vr={},Gs=Ae,k=ne;function Js(t,e,n,r,i){if(t===null||n.size===0&&r.size===0&&!i)return 0;var o=e._selection,l=t._selection;if(i)return 1;if(!(k.$isRangeSelection(o)&&k.$isRangeSelection(l)&&l.isCollapsed()&&o.isCollapsed()))return 0;i=e._nodeMap;let s=[];for(let d of n)n=i.get(d),n!==void 0&&s.push(n);for(let[d,u]of r)u&&(r=i.get(d),r===void 0||k.$isRootNode(r)||s.push(r));return s.length===0?0:1<s.length?(r=e._nodeMap,e=r.get(o.anchor.key),l=r.get(l.anchor.key),e&&l&&!t._nodeMap.has(e.__key)&&k.$isTextNode(e)&&e.__text.length===1&&o.anchor.offset===1?2:0):(e=s[0],t=t._nodeMap.get(e.__key),!k.$isTextNode(t)||!k.$isTextNode(e)||t.__mode!==e.__mode||(t=t.__text,e=e.__text,t===e)||(o=o.anchor,l=l.anchor,o.key!==l.key||o.type!=="text")?0:(o=o.offset,l=l.offset,t=e.length-t.length,t===1&&l===o-1?2:t===-1&&l===o+1?3:t===-1&&l===o?4:0))}function Vs(t,e){let n=Date.now(),r=0;return(i,o,l,s,d,u)=>{let a=Date.now();if(u.has("historic"))return r=0,n=a,2;let c=Js(i,o,s,d,t.isComposing()),f=(()=>{var h=l===null||l.editor===t,p=u.has("history-push");if(!p&&h&&u.has("history-merge"))return 0;if(i===null)return 1;const x=o._selection,T=i._selection;return 0<s.size||0<d.size?p===!1&&c!==0&&c===r&&a<n+e&&h||s.size===1&&(p=Array.from(s)[0],h=i._nodeMap.get(p),p=o._nodeMap.get(p),h=k.$isTextNode(h)&&k.$isTextNode(p)?h.__type===p.__type&&h.__text===p.__text&&h.__mode===p.__mode&&h.__detail===p.__detail&&h.__style===p.__style&&h.__format===p.__format&&h.__parent===p.__parent:!1,h)?0:1:T===null&&x!==null?0:2})();return n=a,r=c,f}}vr.createEmptyHistoryState=function(){return{current:null,redoStack:[],undoStack:[]}},vr.registerHistory=function(t,e,n){let r=Vs(t,n);n=({editorState:l,prevEditorState:s,dirtyLeaves:d,dirtyElements:u,tags:a})=>{const c=e.current,f=e.redoStack,h=e.undoStack,p=c===null?null:c.editorState;if(c===null||l!==p){if(d=r(s,l,c,d,u,a),d===1)f.length!==0&&(e.redoStack=[]),c!==null&&(h.push({...c,undoSelection:s.read(k.$getSelection)}),t.dispatchCommand(k.CAN_UNDO_COMMAND,!0));else if(d===2)return;e.current={editor:t,editorState:l}}};let i=Gs.mergeRegister(t.registerCommand(k.UNDO_COMMAND,()=>{let l=e.redoStack,s=e.undoStack;if(s.length!==0){let d=e.current,u=s.pop();d!==null&&(l.push(d),t.dispatchCommand(k.CAN_REDO_COMMAND,!0)),s.length===0&&t.dispatchCommand(k.CAN_UNDO_COMMAND,!1),e.current=u||null,u&&u.editor.setEditorState(u.editorState.clone(u.undoSelection),{tag:"historic"})}return!0},k.COMMAND_PRIORITY_EDITOR),t.registerCommand(k.REDO_COMMAND,()=>{let l=e.redoStack;var s=e.undoStack;if(l.length!==0){let d=e.current;d!==null&&(s.push(d),t.dispatchCommand(k.CAN_UNDO_COMMAND,!0)),s=l.pop(),l.length===0&&t.dispatchCommand(k.CAN_REDO_COMMAND,!1),e.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:"historic"})}return!0},k.COMMAND_PRIORITY_EDITOR),t.registerCommand(k.CLEAR_EDITOR_COMMAND,()=>(e.undoStack=[],e.redoStack=[],e.current=null,!1),k.COMMAND_PRIORITY_EDITOR),t.registerCommand(k.CLEAR_HISTORY_COMMAND,()=>(e.undoStack=[],e.redoStack=[],e.current=null,!0),k.COMMAND_PRIORITY_EDITOR),t.registerUpdateListener(n)),o=t.registerUpdateListener(n);return()=>{i(),o()}};var js=vr,Xs=Fe,Nr=js,Vo=se.default;function Qs(t,e,n=1e3){let r=Vo.useMemo(()=>e||Nr.createEmptyHistoryState(),[e]);Vo.useEffect(()=>Nr.registerHistory(t,r,n),[n,t,r])}yr.createEmptyHistoryState=Nr.createEmptyHistoryState,yr.HistoryPlugin=function({externalHistoryState:t}){let[e]=Xs.useLexicalComposerContext();return Qs(e,t),null};var Zs=yr,jo={},qs=Fe,Xo=se.default,bs=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Xo.useLayoutEffect:Xo.useEffect;jo.OnChangePlugin=function({ignoreHistoryMergeTagChange:t=!1,ignoreInitialChange:e=!0,ignoreSelectionChange:n=!1,onChange:r}){let[i]=qs.useLexicalComposerContext();return bs(()=>{if(r)return i.registerUpdateListener(({editorState:o,dirtyElements:l,dirtyLeaves:s,prevEditorState:d,tags:u})=>{n&&l.size===0&&s.size===0||t&&u.has("history-merge")||e&&d.isEmpty()||r(o,i)})},[i,t,e,n,r]),null};var ed=jo,Qo={},oe=hn,td=Fe,Zo=se.default,nd=Ae,me=ne;function rd(t){Zo.useEffect(()=>nd.mergeRegister(t.registerCommand(me.INDENT_CONTENT_COMMAND,()=>(oe.indentList(),!1),me.COMMAND_PRIORITY_LOW),t.registerCommand(me.OUTDENT_CONTENT_COMMAND,()=>(oe.outdentList(),!1),me.COMMAND_PRIORITY_LOW),t.registerCommand(oe.INSERT_ORDERED_LIST_COMMAND,()=>(oe.insertList(t,"number"),!0),me.COMMAND_PRIORITY_LOW),t.registerCommand(oe.INSERT_UNORDERED_LIST_COMMAND,()=>(oe.insertList(t,"bullet"),!0),me.COMMAND_PRIORITY_LOW),t.registerCommand(oe.REMOVE_LIST_COMMAND,()=>(oe.removeList(t),!0),me.COMMAND_PRIORITY_LOW),t.registerCommand(me.INSERT_PARAGRAPH_COMMAND,()=>!!oe.$handleListInsertParagraph(),me.COMMAND_PRIORITY_LOW)),[t])}Qo.ListPlugin=function(){let[t]=td.useLexicalComposerContext();return Zo.useEffect(()=>{if(!t.hasNodes([oe.ListNode,oe.ListItemNode]))throw Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[t]),rd(t),null};var id=Qo;const $d="",od=({onChange:t})=>{const e=se.default.useCallback(n=>{const r=n.toJSON();t==null||t(r)},[t]);return $s("div",{className:"koenig-lexical",children:[Te(zs.RichTextPlugin,{contentEditable:Te("div",{children:Te(Us.ContentEditable,{className:"kg-prose"})}),placeholder:Te("div",{className:"pointer-events-none absolute top-0 left-0 min-w-full cursor-text",children:"Enter some text..."})}),Te(ed.OnChangePlugin,{onChange:e}),Te(Zs.HistoryPlugin,{})," ",Te(id.ListPlugin,{})," "]})};fe.KoenigComposer=Ls,fe.KoenigEditor=od,Object.defineProperties(fe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
31
|
+
//# sourceMappingURL=koenig-lexical.umd.js.map
|