lexical 0.1.8 → 0.1.9
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/Lexical.dev.js +383 -226
- package/Lexical.prod.js +144 -142
- package/LexicalAutoLinkNode.prod.js +1 -1
- package/LexicalCodeHighlightNode.prod.js +1 -1
- package/LexicalCodeNode.prod.js +1 -1
- package/LexicalExtendedNodes.dev.js +2 -4
- package/LexicalExtendedNodes.prod.js +2 -2
- package/LexicalHashtagNode.prod.js +1 -1
- package/LexicalHeadingNode.prod.js +1 -1
- package/LexicalLinkNode.prod.js +1 -1
- package/LexicalOverflowNode.prod.js +1 -1
- package/LexicalQuoteNode.prod.js +1 -1
- package/package.json +1 -1
- package/LexicalTableCellNode.dev.js +0 -81
- package/LexicalTableCellNode.prod.js +0 -9
- package/LexicalTableNode.dev.js +0 -638
- package/LexicalTableNode.prod.js +0 -21
- package/LexicalTableRowNode.dev.js +0 -76
- package/LexicalTableRowNode.prod.js +0 -8
- package/TableCellNode.js +0 -9
- package/TableNode.js +0 -9
- package/TableRowNode.js +0 -9
package/Lexical.prod.js
CHANGED
|
@@ -4,150 +4,152 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
token:1};function q(a){throw Error(`Minified Lexical error #${a}; see codes.json for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
|
|
9
|
-
const
|
|
7
|
+
const ba=RegExp("^[^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]"),ca=RegExp("^[^\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]"),da={bold:1,code:16,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},fa={center:2,justify:4,left:1,right:3},ha={inert:3,normal:0,
|
|
8
|
+
segmented:2,token:1};function q(a){throw Error(`Minified Lexical error #${a}; see codes.json for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
|
|
9
|
+
const ia="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,ja=ia&&"documentMode"in document?document.documentMode:null,r=ia&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ka=ia&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),la=ia&&"InputEvent"in window&&!ja?"getTargetRanges"in new window.InputEvent("input"):!1;let ma=!1,na=0;function pa(a){na=a.timeStamp}
|
|
10
10
|
function qa(a){return a.getEditorState().read(()=>{const b=t();return null!==b?b.clone():null})}
|
|
11
|
-
function ra(a,b,c){
|
|
12
|
-
|
|
13
|
-
else
|
|
14
|
-
function
|
|
15
|
-
function
|
|
16
|
-
function
|
|
17
|
-
function ta(a,b){for(;null!=a;){const c=va(a,b);if(null!==c)return c;a=a.parentNode}return null}function
|
|
18
|
-
function
|
|
19
|
-
function
|
|
20
|
-
function ua(a,b,c,d,e){if(a.isAttached()&&(e||!a.isDirty())){var f=a.isComposing();let g=b;(f||e)&&"\u00a0"===b[b.length-1]&&(g=b.slice(0,-1));b=a.getTextContent();if(e||g!==b)""===g?(f&&
|
|
21
|
-
function
|
|
22
|
-
function
|
|
23
|
-
function Za(a,b,c,d){var e=Array.from(c),f=e.length;const g=Array.from(d),h=g.length;a=a._nodeMap;b=b._nodeMap;for(let l=0;l<f;l++){const k=e[l],m=b.get(k);void 0===m||m.isAttached()||(a.has(k)||c.delete(k),b.delete(k))}for(c=0;c<h;c++)e=g[c][0],f=b.get(e),void 0===f||f.isAttached()||(
|
|
24
|
-
function $a(a,b){const c=a.__mode,d=a.__format;a=a.__style;const e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}function ab(a,b){const c=a.mergeWithSibling(b),d=
|
|
25
|
-
function bb(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
a
|
|
31
|
-
|
|
32
|
-
(this.
|
|
33
|
-
|
|
34
|
-
c.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
f
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
f.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
a=b.
|
|
47
|
-
null;if(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
b,"
|
|
52
|
-
function
|
|
53
|
-
e.
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
function pb(a
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
b){
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
d=
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
class
|
|
76
|
-
Array.from(this._observers);for(let
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
(
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
function Wb(a,b
|
|
84
|
-
function
|
|
11
|
+
function ra(a,b,c){ma=!0;const d=100<performance.now()-na;try{sa(a,()=>{var e=new Map,f=a.getRootElement(),g=a._editorState,h=!1;for(var l=0;l<b.length;l++){var k=b[l],m=k.type,n=k.target,p=ta(n,g);if(!w(p))if("characterData"===m){if(d&&3===n.nodeType&&z(p)&&p.isAttached()){k=window.getSelection();var u=m=null;null!==k&&k.anchorNode===n&&(m=k.anchorOffset,u=k.focusOffset);ua(p,n.nodeValue,m,u,!1)}}else if("childList"===m){h=!0;m=k.addedNodes;for(u=0;u<m.length;u++){var x=m[u],y=va(x);const B=x.parentNode;
|
|
12
|
+
null!=B&&null===y&&B.removeChild(x)}k=k.removedNodes;m=k.length;if(0<m){u=0;for(x=0;x<m;x++)y=k[x],"BR"!==y.nodeName||n.__lexicalLineBreak!==y&&void 0===y["__lexicalKey_"+a._key]||(n.appendChild(y),u++);m!==u&&(n===f&&(p=g._nodeMap.get("root")),e.set(n,p))}}}if(0<e.size)for(e=Array.from(e.entries()),f=0;f<e.length;f++){const [B,v]=e[f];if(A(v))for(g=v.__children,l=B.firstChild,p=0;p<g.length;p++)n=a.getElementByKey(g[p]),null!==n&&(null==l?(B.appendChild(n),l=n):l!==n&&B.replaceChild(n,l),l=l.nextSibling);
|
|
13
|
+
else z(v)&&v.markDirty()}e=c.takeRecords();if(0<e.length){for(f=0;f<e.length;f++)for(l=e[f],g=l.addedNodes,l=l.target,p=0;p<g.length;p++)n=g[p],k=n.parentNode,null!=k&&"BR"===n.nodeName&&l.__lexicalLineBreak!==n&&void 0===n["__lexicalKey_"+a._key]&&k.removeChild(n);c.takeRecords()}h&&(h=t()||qa(a),null!==h&&(h.dirty=!0,wa(h)))})}finally{ma=!1}}function xa(a){const b=a._observer;if(null!==b){const c=b.takeRecords();ra(a,c,b)}}
|
|
14
|
+
function ya(a){0===na&&window.addEventListener("textInput",pa,!0);a._observer=new MutationObserver((b,c)=>{ra(a,b,c)})}let za=0;const Aa=window.Promise,Ba="function"===typeof queueMicrotask?queueMicrotask:a=>Aa.resolve().then(a);function Ca(a,b,c){a=a.getRootElement();try{return null!==a&&a.contains(b)&&a.contains(c)&&null!=b&&!w(ta(b))}catch(d){return!1}}function C(a){return a.isToken()||a.isInert()}function Da(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}
|
|
15
|
+
function Ea(a,b,c){b=da[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function Fa(a){return z(a)||Ka(a)||w(a)}function D(a){99<La&&q(26);var b=a.getLatest(),c=b.__parent,d=E();const e=F(),f=d._nodeMap;d=e._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;const g=f.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;e._dirtyType=1;A(a)?d.set(b,!0):e._dirtyLeaves.add(b)}
|
|
16
|
+
function G(a){const b=a.getPreviousSibling();a=a.getNextSibling();null!==b&&D(b);null!==a&&D(a)}function H(a){I();var b=F();const c=b._compositionKey;b._compositionKey=a;null!==c&&(b=J(c),null!==b&&b.getWritable());null!==a&&(a=J(a),null!==a&&a.getWritable())}function J(a,b){a=(b||E())._nodeMap.get(a);return void 0===a?null:a}function va(a,b){const c=F();a=a["__lexicalKey_"+c._key];return void 0!==a?J(a,b):null}
|
|
17
|
+
function ta(a,b){for(;null!=a;){const c=va(a,b);if(null!==c)return c;a=a.parentNode}return null}function Ma(a){const b=Object.assign({},a._decorators);return a._pendingDecorators=b}function Na(a){return a.read(()=>Oa().getTextContent())}function Pa(a,b){sa(a,()=>{var c=E();if(!c.isEmpty())if("root"===b)Oa().markDirty();else{c=Array.from(c._nodeMap);for(let d=0;d<c.length;d++)c[d][1].markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}
|
|
18
|
+
function Oa(){return E()._nodeMap.get("root")}function wa(a){E()._selection=a}function Qa(a){var b=F(),c;a:{for(c=a;null!=c;){const d=c["__lexicalKey_"+b._key];if(void 0!==d){c=d;break a}c=c.parentNode}c=null}return null===c?(b=b.getRootElement(),a===b?J("root"):null):J(c)}function Ra(a){const b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function Sa(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
|
|
19
|
+
function Ta(a,b){a=window.getSelection();if(null!==a){var {anchorNode:c,anchorOffset:d,focusOffset:e}=a;null!==c&&3===c.nodeType&&(a=ta(c),z(a)&&ua(a,c.nodeValue,d,e,b))}}
|
|
20
|
+
function ua(a,b,c,d,e){if(a.isAttached()&&(e||!a.isDirty())){var f=a.isComposing();let g=b;(f||e)&&"\u00a0"===b[b.length-1]&&(g=b.slice(0,-1));b=a.getTextContent();if(e||g!==b)""===g?(f&&H(null),a.remove()):(e=a.getParent(),b=Ua(),C(a)||null!==F()._compositionKey&&!f||null!==e&&null!==b&&!e.canInsertTextBefore()&&0===b.anchor.offset?a.markDirty():(f=t(),null!==f&&null!==c&&null!==d&&(f.setTextNodeRange(a,c,a,d),a.isSegmented()&&(c=a.getTextContent(),c=K(c),a.replace(c),a=c)),a.setTextContent(g)))}}
|
|
21
|
+
function Va(a,b,c){var d=a.anchor;const e=a.focus;var f=d.getNode();(b=d.key!==e.key||d.offset!==e.offset&&!f.isComposing()||(c||f.isDirty())&&1<b.length||!z(f)||f.getFormat()!==a.format)||(f.isSegmented()?b=!0:a.isCollapsed()?(b=a.anchor.offset,c=f.getParentOrThrow(),d=f.isToken(),a=0===b&&(!f.canInsertTextBefore()||!c.canInsertTextBefore()||d),f=f.getTextContentSize()===b&&(!f.canInsertTextBefore()||!c.canInsertTextBefore()||d),b=a||f):b=!1);return b}
|
|
22
|
+
function Wa(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function Xa(a,b,c,d){b=b.get(c.__type);void 0===b&&q(66,c.__type);b=b.klass;let e=a.get(b);void 0===e&&(e=new Map,a.set(b,e));e.set(c.__key,d)}function Ya(a,b,c,d,e){a=a.__children;const f=a.length;for(let g=0;g<f;g++){const h=a[g],l=d.get(h);void 0!==l&&l.__parent===b&&(A(l)&&Ya(l,h,c,d,e),c.has(h)||e.delete(h),d.delete(h))}}
|
|
23
|
+
function Za(a,b,c,d){var e=Array.from(c),f=e.length;const g=Array.from(d),h=g.length;a=a._nodeMap;b=b._nodeMap;for(let l=0;l<f;l++){const k=e[l],m=b.get(k);void 0===m||m.isAttached()||(a.has(k)||c.delete(k),b.delete(k))}for(c=0;c<h;c++)e=g[c][0],f=b.get(e),void 0===f||f.isAttached()||(A(f)&&Ya(f,e,a,b,d),a.has(e)||d.delete(e),b.delete(e))}
|
|
24
|
+
function $a(a,b){const c=a.__mode,d=a.__format;a=a.__style;const e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}function ab(a,b){const c=a.mergeWithSibling(b),d=F()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}
|
|
25
|
+
function bb(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&z(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{$a(b,a)&&(a=ab(b,a));break}for(var c;null!==(c=a.getNextSibling())&&z(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{$a(a,c)&&ab(a,c);break}}}
|
|
26
|
+
function cb(a,b,c){const d=a.getParent();let e=c;null!==d&&(b&&0===c?(e=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(e=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?e-1:e)}
|
|
27
|
+
class db{constructor(a,b,c){this.key=a;this.offset=b;this.type=c}is(a){return this.key===a.key&&this.offset===a.offset&&this.type===a.type}isBefore(a){let b=this.getNode(),c=a.getNode();const d=this.offset;a=a.offset;A(b)&&(b=b.getDescendantByIndex(d));A(c)&&(c=c.getDescendantByIndex(a));return b===c?d<a:b.isBefore(c)}getCharacterOffset(){return"text"===this.type?this.offset:0}getNode(){const a=J(this.key);null===a&&q(5);return a}set(a,b,c){const d=t(),e=this.key;this.key=a;this.offset=b;this.type=
|
|
28
|
+
c;L||(F()._compositionKey===e&&H(a),null===d||d.anchor!==this&&d.focus!==this||(d.dirty=!0))}}function M(a,b,c){return new db(a,b,c)}function eb(a,b){const c=b.getKey();let d=a.offset,e="element";z(b)&&(e="text",b=b.getTextContentSize(),d>b&&(d=b));a.set(c,d,e)}function fb(a,b){if(A(b)){const c=b.getLastDescendant();A(c)||z(c)?eb(a,c):eb(a,b)}else z(b)&&eb(a,b)}
|
|
29
|
+
function gb(a,b,c){const d=a.getNode(),e=d.getChildAtIndex(a.offset),f=K(),g=N(d)?hb().append(f):f;f.setFormat(c);null===e?d.append(g):e.insertBefore(g);a.is(b)&&b.set(f.getKey(),0,"text");a.set(f.getKey(),0,"text")}function Q(a,b,c,d){a.key=b;a.offset=c;a.type=d}
|
|
30
|
+
class R{constructor(a,b,c){this.anchor=a;this.focus=b;this.dirty=!1;this.format=c}is(a){return null===a?!1:this.anchor.is(a.anchor)&&this.focus.is(a.focus)}isBackward(){return this.focus.isBefore(this.anchor)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const a=this.anchor,b=this.focus;let c=a.getNode(),d=b.getNode();A(c)&&(c=c.getDescendantByIndex(a.offset));A(d)&&(d=d.getDescendantByIndex(b.offset));return c.is(d)?A(c)?[]:[c]:c.getNodesBetween(d)}setTextNodeRange(a,b,c,d){Q(this.anchor,
|
|
31
|
+
a.__key,b,"text");Q(this.focus,c.__key,d,"text");this.dirty=!0}getTextContent(){const a=this.getNodes();if(0===a.length)return"";const b=a[0],c=a[a.length-1];var d=this.anchor,e=this.focus;const f=d.isBefore(e);d=d.getCharacterOffset();e=e.getCharacterOffset();let g="",h=!0;for(let l=0;l<a.length;l++){const k=a[l];if(A(k)&&!k.isInline())h||(g+="\n"),h=k.isEmpty()?!1:!0;else if(h=!1,z(k)){let m=k.getTextContent();k===b?m=k===c?d<e?m.slice(d,e):m.slice(e,d):f?m.slice(d):m.slice(e):k===c&&(m=f?m.slice(0,
|
|
32
|
+
e):m.slice(0,d));g+=m}else!w(k)&&!Ka(k)||k===c&&this.isCollapsed()||(g+=k.getTextContent())}return g}applyDOMRange(a){const b=F(),c=b.getEditorState()._selection;a=ib(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;Q(this.anchor,d.key,d.offset,d.type);Q(this.focus,e.key,e.offset,e.type)}}clone(){const a=this.anchor,b=this.focus;return new R(M(a.key,a.offset,a.type),M(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=Ea(this.format,a,null);this.dirty=
|
|
33
|
+
!0}hasFormat(a){return 0!==(this.format&da[a])}insertRawText(a){const b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];const c=b.length;for(let d=0;d<c;d++){const e=b[d];""!==e&&a.push(K(e));d!==c-1&&a.push(jb())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||b.isBefore(c),e=this.format;d&&"element"===b.type?gb(b,c,e):d||"element"!==c.type||gb(c,b,e);var f=this.getNodes(),g=f.length,h=d?c:b;b=(d?b:c).offset;var l=h.offset;c=f[0];z(c)||q(6);d=
|
|
34
|
+
c.getTextContent().length;var k=c.getParentOrThrow();if(!this.isCollapsed()||b!==d||!c.isSegmented()&&!c.isToken()&&c.canInsertTextAfter()&&k.canInsertTextAfter())if(!this.isCollapsed()||0!==b||!c.isSegmented()&&!c.isToken()&&c.canInsertTextBefore()&&k.canInsertTextBefore())c.isSegmented()&&b!==d&&(k=K(c.getTextContent()),c.replace(k),c=k);else{m=c.getPreviousSibling();if(!z(m)||C(m)||m.isSegmented())m=K(),k.canInsertTextBefore()?c.insertBefore(m):k.insertBefore(m);m.select();c=m;if(""!==a){this.insertText(a);
|
|
35
|
+
return}}else{var m=c.getNextSibling();if(!z(m)||C(m)||m.isSegmented())m=K(),k.canInsertTextAfter()?c.insertAfter(m):k.insertAfter(m);m.select(0,0);c=m;if(""!==a){this.insertText(a);return}}if(1===g)if(C(c))c.remove();else{f=c.getFormat();if(b===l&&f!==e)if(""===c.getTextContent())c.setFormat(e);else{f=K(a);f.setFormat(e);f.select();0===b?c.insertBefore(f):([g]=c.splitText(b),g.insertAfter(f));return}c=c.spliceText(b,l-b,a,!0);""===c.getTextContent()?c.remove():c.isComposing()&&"text"===this.anchor.type&&
|
|
36
|
+
(this.anchor.offset-=a.length)}else{k=f[g-1];e=new Set([...c.getParentKeys(),...k.getParentKeys()]);var n=A(c)?c:c.getParentOrThrow();m=A(k)?k:k.getParentOrThrow();"text"===h.type&&(0!==l||""===k.getTextContent())||"element"===h.type&&k.getIndexWithinParent()<l?z(k)&&!C(k)&&l!==k.getTextContentSize()?(k.isSegmented()&&(h=K(k.getTextContent()),k.replace(h),k=h),k=k.spliceText(0,l,""),e.add(k.getKey())):k.remove():e.add(k.getKey());h=m.getChildren();l=new Set(f);const p=n.is(m);if(m.canBeEmpty()||n===
|
|
37
|
+
m){for(n=h.length-1;0<=n;n--){const u=h[n];if(u.is(c)||A(u)&&u.isParentOf(c))break;u.isAttached()&&(!l.has(u)||u.is(k)?p||c.insertAfter(u):u.remove())}if(!p)for(h=m,l=null;null!==h;){k=h.getChildren();m=k.length;if(0===m||k[m-1].is(l))e.delete(h.getKey()),l=h;h=h.getParent()}}else n.append(m);C(c)?b===d?c.select():c.remove():(c=c.spliceText(b,d-b,a,!0),""===c.getTextContent()?c.remove():c.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<g;a++)b=f[a],c=b.getKey(),
|
|
38
|
+
e.has(c)||b.remove()}}removeText(){this.insertText("")}formatText(a){const b=this.getNodes(),c=b.length-1;let d=b[0],e=b[c];if(this.isCollapsed())this.toggleFormat(a);else{var f=this.anchor,g=this.focus,h=d.getTextContent().length,l=g.offset,k=0;for(var m=0;m<b.length;m++){var n=b[m];if(z(n)){k=n.getFormatFlags(a,null);break}}var p=f.offset;n=(m=f.isBefore(g))?p:l;m=m?l:p;if(n===d.getTextContentSize()){const u=d.getNextSibling();z(u)&&(n=p=0,d=u,k=d.getFormatFlags(a,null))}if(d.is(e))z(d)&&("element"===
|
|
39
|
+
f.type&&"element"===g.type?(d.setFormat(k),d.select(n,m),this.format=k):(n=p>l?l:p,m=p>l?p:l,n!==m&&(0===n&&m===h?(d.setFormat(k),d.select(n,m)):(a=d.splitText(n,m),a=0===n?a[0]:a[1],a.setFormat(k),a.select(0,m-n)),this.format=k)));else for(z(d)&&(0!==n&&([,d]=d.splitText(n)),d.setFormat(k)),f=k,z(e)&&(f=e.getFormatFlags(a,k),k=e.getTextContent().length,0!==m&&(m!==k&&([e]=e.splitText(m)),e.setFormat(f))),k=1;k<c;k++)m=b[k],g=m.getKey(),z(m)&&g!==d.getKey()&&g!==e.getKey()&&!m.isToken()&&(g=m.getFormatFlags(a,
|
|
40
|
+
f),m.setFormat(g))}}insertNodes(a,b){this.isCollapsed()||this.removeText();var c=this.anchor,d=c.offset,e=c.getNode(),f=e;"element"===c.type&&(f=c.getNode(),c=f.getChildAtIndex(d-1),f=null===c?f:c);c=[];var g=e.getNextSiblings(),h=N(e)?null:e.getTopLevelElementOrThrow();if(z(e))if(f=e.getTextContent().length,0===d&&0!==f)f=e.getPreviousSibling(),f=null!==f?f:e.getParentOrThrow(),c.push(e);else if(d===f)f=e;else{if(C(e))return!1;[f,e]=e.splitText(d);c.push(e)}e=f;c.push(...g);g=a[0];var l=!1;for(let n=
|
|
41
|
+
0;n<a.length;n++){const p=a[n];if(A(p)){if(p.is(g)){if(A(f)&&f.isEmpty()&&f.canReplaceWith(p)){f.replace(p);f=p;l=!0;continue}var k=p.getFirstDescendant();if(Fa(k)){for(k=k.getParentOrThrow();k.isInline();)k=k.getParentOrThrow();l=k.getChildren();var m=l.length;if(A(f))for(let u=0;u<m;u++)f.append(l[u]);else{for(--m;0<=m;m--)f.insertAfter(l[m]);f=f.getParentOrThrow()}k.remove();l=!0;if(k.is(p))continue}}if(z(f)){if(null===h)throw Error("insertNode: topLevelElement is root node");f=h}}else l&&!w(p)&&
|
|
42
|
+
N(f.getParent())&&q(7);l=!1;if(A(f))if(w(p)&&p.isTopLevel())f=f.insertAfter(p);else if(A(p)){if(p.canBeEmpty()||!p.isEmpty())N(f)?(k=f.getChildAtIndex(d),null!==k?k.insertBefore(p):f.append(p),f=p):f=f.insertAfter(p)}else k=f.getFirstChild(),null!==k?k.insertBefore(p):f.append(p),f=p;else!A(p)||w(f)&&f.isTopLevel()?f=f.insertAfter(p):(f=p.getParentOrThrow(),n--)}b&&(z(e)?e.select():(a=f.getPreviousSibling(),z(a)?a.select():(a=f.getIndexWithinParent(),f.getParentOrThrow().select(a,a))));if(A(f)){if(a=
|
|
43
|
+
f.getLastDescendant(),b||(null===a?f.select():z(a)?a.select():a.selectNext()),0!==c.length)for(b=c.length-1;0<=b;b--)a=c[b],d=a.getParentOrThrow(),A(f)&&!A(a)?(f.append(a),f=a):A(a)&&!a.canInsertAfter(f)?(h=d.constructor.clone(d),A(h)||q(8),h.append(a),f.insertAfter(h)):f.insertAfter(a),d.isEmpty()&&!d.canBeEmpty()&&d.remove()}else b||(z(f)?f.select():(c=f.getParentOrThrow(),f=f.getIndexWithinParent()+1,c.select(f,f)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var a=this.anchor,
|
|
44
|
+
b=a.offset;if("text"===a.type){var c=a.getNode(),d=c.getTextContent().length;a=c.getNextSiblings().reverse();var e=c.getParentOrThrow();0===b?a.push(c):b!==d&&([,b]=c.splitText(b),a.push(b))}else{e=a.getNode();if(N(e)){a=hb();b=e.getChildAtIndex(b);a.select();null!==b?b.insertBefore(a):e.append(a);return}a=e.getChildren().slice(b).reverse()}e=e.insertNewAfter(this);if(null===e)this.insertLineBreak();else if(A(e)){b=a.length;c=null;if(0!==b)for(d=0;d<b;d++){const f=a[d];null===c?e.append(f):c.insertBefore(f);
|
|
45
|
+
c=f}e.canBeEmpty()||0!==e.getChildrenSize()?e.selectStart():(e.selectPrevious(),e.remove())}}insertLineBreak(a){const b=jb();var c=this.anchor;"element"===c.type&&(c=c.getNode(),N(c)&&this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;const e=this.focus;var f=a[0];let g=a[c];var h=d.getCharacterOffset();const l=e.getCharacterOffset();if(0===b)return[];if(1===b)return z(f)?(a=h>l?l:h,c=f.splitText(a,
|
|
46
|
+
h>l?h:l),a=0===a?c[0]:c[1],null!=a?[a]:[]):[f];b=d.isBefore(e);z(f)&&(d=b?h:l,d===f.getTextContentSize()?a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));z(g)&&(f=g.getTextContent().length,h=b?l:h,0===h?a.pop():h!==f&&([g]=g.splitText(h),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a;var g=d.offset;if("element"===d.type){var h=d.getNode();h=cb(h,b,g)}else h=d.getNode(),b&&0===g||!b&&g===h.getTextContentSize()?(g=b?h.getPreviousSibling():h.getNextSibling(),h=null===g?cb(h.getParentOrThrow(),
|
|
47
|
+
b,h.getIndexWithinParent()+(b?0:1)):g):h=null;g=h;if(w(g)&&!g.isIsolated()&&(h=b?g.getPreviousSibling():g.getNextSibling(),!z(h))){a=g.getParentOrThrow();A(h)?(a=h.getKey(),c=b?h.getChildrenSize():0):(c=g.getIndexWithinParent(),a=a.getKey(),b||c++);d.set(a,c,"element");f&&e.set(a,c,"element");return}d=window.getSelection();d.modify(a,b?"backward":"forward",c);0<d.rangeCount&&(b=d.getRangeAt(0),this.applyDOMRange(b),f||d.anchorNode===b.startContainer&&d.anchorOffset===b.startOffset||(f=this.focus,
|
|
48
|
+
b=this.anchor,d=b.key,e=b.offset,a=b.type,Q(b,f.key,f.offset,f.type),Q(f,d,e,a)))}deleteCharacter(a){if(this.isCollapsed()){var b=this.anchor,c=this.focus,d=b.getNode();if(!a&&("element"===b.type&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())&&(d=d.getNextSibling()||d.getParentOrThrow().getNextSibling(),A(d)&&!d.canExtractContents()))return;this.modify("extend",a,"character");if(!this.isCollapsed()){var e="text"===c.type?c.getNode():null;d="text"===b.type?b.getNode():
|
|
49
|
+
null;if(null!==e&&e.isSegmented()){if(b=c.offset,c=e.getTextContentSize(),e.is(d)||a&&b!==c||!a&&0!==b){kb(e,a);return}}else if(null!==d&&d.isSegmented()&&(b=b.offset,c=d.getTextContentSize(),d.is(e)||a&&0!==b||!a&&b!==c)){kb(d,a);return}d=this.anchor;e=this.focus;b=d.getNode();c=e.getNode();if(b===c&&"text"===d.type&&"text"===e.type){var f=d.offset,g=e.offset;const h=f<g;c=h?f:g;g=h?g:f;f=g-1;c!==f&&(b=b.getTextContent().slice(c,g),/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(b)||(a?e.offset=f:d.offset=
|
|
50
|
+
f))}}else if(a&&0===b.offset&&("element"===b.type?b.getNode():b.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText();a=this.anchor;"text"===a.type&&(a=a.getNode(),d=a.getTextContent(),e=this.anchor.offset,0===e&&a.isSimpleText()?(e=a.getPreviousSibling(),z(e)&&"hashtag"===e.getType()&&(e.select(),b=e.getTextContent(),e.setTextContent(b+d),a.remove())):z(a)&&"hashtag"===a.getType()&&e===a.getTextContentSize()&&(e=a.getNextSibling(),z(e)&&e.isSimpleText()&&(b=e.getTextContent(),
|
|
51
|
+
a.setTextContent(d+b),e.remove())))}deleteLine(a){this.isCollapsed()&&this.modify("extend",a,"lineboundary");this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}function kb(a,b){var c=a.getTextContent().split(/\s/g);b?c.pop():c.shift();c=c.join(" ");""===c?a.remove():(a=a.setTextContent(c),b?a.select():a.select(0,0))}
|
|
52
|
+
function lb(a,b,c){if(1===a.nodeType){let g=!1;var d=a.childNodes;var e=d.length;b===e&&(g=!0,b=e-1);d=Qa(d[b]);if(z(d))b=g?d.getTextContentSize():0;else{e=Qa(a);if(null===e)return null;if(A(e)){a=e.getChildAtIndex(b);var f;if(f=A(a))f=a.getParent(),f=null===c||null===f||!f.canBeEmpty()||f!==c.getNode();f&&(c=g?a.getLastDescendant():a.getFirstDescendant(),null===c?(e=a,b=0):(a=c,e=a.getParentOrThrow()));z(a)?(d=a,e=null,b=g?d.getTextContentSize():0):a!==e&&g&&b++}else b=e.getIndexWithinParent()+1,
|
|
53
|
+
e=e.getParentOrThrow();if(A(e))return M(e.__key,b,"element")}}else d=Qa(a);return z(d)?M(d.__key,b,"text"):null}
|
|
54
|
+
function ib(a,b,c,d,e,f){if(null===a||null===c||!Ca(e,a,c))return null;a=lb(a,b,null!==f?f.anchor:null);if(null===a)return null;c=lb(c,d,null!==f?f.focus:null);if(null===c)return null;if("text"===a.type&&"text"===c.type){d=a.getNode();const g=c.getNode(),h=d.getTextContentSize(),l=a.offset,k=c.offset;d===g&&l===k?0===b&&(d=d.getPreviousSibling(),z(d)&&!d.isInert()&&(b=d.getTextContentSize(),d=d.__key,a.key=d,c.key=d,a.offset=b,c.offset=b)):l===h&&(b=d.getNextSibling(),z(b)&&!b.isInert()&&(a.key=b.__key,
|
|
55
|
+
a.offset=0));e.isComposing()&&e._compositionKey!==a.key&&null!==f&&(e=f.anchor,f=f.focus,Q(a,e.key,e.offset,e.type),Q(c,f.key,f.offset,f.type))}return[a,c]}function mb(a,b,c,d,e,f){const g=E();a=new R(M(a,b,e),M(c,d,f),0);a.dirty=!0;return g._selection=a}
|
|
56
|
+
function nb(a){const b=a.getEditorState()._selection;var c=(c=window.event)&&c.type;c=!ma&&("selectionchange"===c||"beforeinput"===c||"compositionstart"===c||"compositionend"===c||"click"===c&&3===window.event.detail||void 0===c);let d,e;if(null===b||c){var f=window.getSelection();if(null===f)return null;c=f.anchorNode;d=f.focusNode;e=f.anchorOffset;f=f.focusOffset}else return a=b.anchor,c=b.focus,new R(M(a.key,a.offset,a.type),M(c.key,c.offset,c.type),b.format);a=ib(c,e,d,f,a,b);if(null===a)return null;
|
|
57
|
+
const [g,h]=a;return new R(g,h,null===b?0:b.format)}function t(){return E()._selection}function Ua(){return F()._editorState._selection}
|
|
58
|
+
function ob(a,b,c,d=1){var e=a.anchor,f=a.focus,g=e.getNode(),h=f.getNode();if(b.is(g)||b.is(h))if(g=b.getKey(),a.isCollapsed())b=e.offset,c<=b&&(c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),pb(a));else{var l=a.isBackward();h=l?f:e;var k=h.getNode();e=l?e:f;f=e.getNode();b.is(k)&&(k=h.offset,c<=k&&h.set(g,Math.max(0,k+d),"element"));b.is(f)&&(b=e.offset,c<=b&&e.set(g,Math.max(0,b+d),"element"));pb(a)}}
|
|
59
|
+
function pb(a){var b=a.anchor,c=b.offset;const d=a.focus;var e=d.offset,f=b.getNode(),g=d.getNode();if(a.isCollapsed())A(f)&&(g=f.getChildrenSize(),g=(e=c>=g)?f.getChildAtIndex(g-1):f.getChildAtIndex(c),z(g)&&(c=0,e&&(c=g.getTextContentSize()),b.set(g.getKey(),c,"text"),d.set(g.getKey(),c,"text")));else{if(A(f)){const h=f.getChildrenSize();c=(a=c>=h)?f.getChildAtIndex(h-1):f.getChildAtIndex(c);z(c)&&(f=0,a&&(f=c.getTextContentSize()),b.set(c.getKey(),f,"text"))}A(g)&&(c=g.getChildrenSize(),e=(b=e>=
|
|
60
|
+
c)?g.getChildAtIndex(c-1):g.getChildAtIndex(e),z(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.getKey(),g,"text")))}}function qb(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){var c=a.anchor;const d=a.focus;let e;"text"===c.type&&(e=c.getNode(),e.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),e!==c&&c.selectionTransform(b,a))}}
|
|
61
|
+
function rb(a,b,c,d,e){let f=null,g=0,h=null;null!==d?(f=d.__key,z(d)?(g=d.getTextContentSize(),h="text"):A(d)&&(g=d.getChildrenSize(),h="element")):null!==e&&(f=e.__key,z(e)?h="text":A(e)&&(h="element"));null!==f&&null!==h?a.set(f,g,h):(g=b.getIndexWithinParent(),a.set(c.__key,g,"element"))}function sb(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}
|
|
62
|
+
function tb(a,b){I();var c=a.__key;const d=a.getParent();if(null!==d){var e=t(),f=!1;if(null!==e&&b){var g=e.anchor;const h=e.focus;g.key===c&&(rb(g,a,d,a.getPreviousSibling(),a.getNextSibling()),f=!0);h.key===c&&(rb(h,a,d,a.getPreviousSibling(),a.getNextSibling()),f=!0)}g=d.getWritable().__children;c=g.indexOf(c);-1===c&&q(16);G(a);g.splice(c,1);a.getWritable().__parent=null;null!==e&&b&&!f&&ob(e,d,c,-1);null===d||N(d)||d.canBeEmpty()||0!==d.getChildrenSize()||tb(d,b)}}
|
|
63
|
+
class ub{static getType(){q(31,this.name)}static clone(){q(32,this.name)}constructor(a){this.__type=this.constructor.getType();this.__parent=null;if(null!=a)this.__key=a;else{I();99<La&&q(26);a=F();var b=E(),c=""+za++;b._nodeMap.set(c,this);A(this)?a._dirtyElements.set(c,!0):a._dirtyLeaves.add(c);a._cloneNotNeeded.add(c);a._dirtyType=1;this.__key=c}}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=J(a);if(null===a)break;a=a.__parent}return!1}isSelected(){const a=
|
|
64
|
+
t();if(null==a)return!1;const b=(new Set(a.getNodes().map(c=>c.__key))).has(this.__key);return z(this)?b:"element"===a.anchor.type&&"element"===a.focus.type&&a.anchor.key===a.focus.key&&a.anchor.offset===a.focus.offset?!1:b}getKey(){return this.__key}getIndexWithinParent(){const a=this.getParent();return null===a?-1:a.__children.indexOf(this.__key)}getParent(){const a=this.getLatest().__parent;return null===a?null:J(a)}getParentOrThrow(){const a=this.getParent();null===a&&q(33,this.__key);return a}getTopLevelElement(){let a=
|
|
65
|
+
this;for(;null!==a;){const b=a.getParent();if(N(b)&&A(a))return a;a=b}return null}getTopLevelElementOrThrow(){const a=this.getTopLevelElement();null===a&&q(34,this.__key);return a}getParents(){const a=[];let b=this.getParent();for(;null!==b;)a.push(b),b=b.getParent();return a}getParentKeys(){const a=[];let b=this.getParent();for(;null!==b;)a.push(b.__key),b=b.getParent();return a}getPreviousSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;const b=a.indexOf(this.__key);return 0>=
|
|
66
|
+
b?null:J(a[b-1])}getPreviousSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;const b=a.indexOf(this.__key);return a.slice(0,b).map(c=>vb(c))}getNextSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;const b=a.length,c=a.indexOf(this.__key);return c>=b-1?null:J(a[c+1])}getNextSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;const b=a.indexOf(this.__key);return a.slice(b+1).map(c=>vb(c))}getCommonAncestor(a){const b=this.getParents();var c=
|
|
67
|
+
a.getParents();A(this)&&b.unshift(this);A(a)&&c.unshift(a);a=b.length;var d=c.length;if(0===a||0===d||b[a-1]!==c[d-1])return null;c=new Set(c);for(d=0;d<a;d++){const e=b[d];if(c.has(e))return e}return null}is(a){return null==a?!1:this.getKey()===a.getKey()}isBefore(a){if(a.isParentOf(this))return!0;if(this.isParentOf(a))return!1;var b=this.getCommonAncestor(a);let c=this;for(;;){var d=c.getParentOrThrow();if(d===b){d=d.__children.indexOf(c.__key);break}c=d}for(c=a;;){a=c.getParentOrThrow();if(a===
|
|
68
|
+
b){b=a.__children.indexOf(c.__key);break}c=a}return d<b}isParentOf(a){const b=this.__key;if(b===a.__key)return!1;for(;null!==a;){if(a.__key===b)return!0;a=a.getParent()}return!1}getNodesBetween(a){const b=this.isBefore(a),c=[],d=new Set;var e=this;let f=null;for(;;){var g=e.__key;d.has(g)||(d.add(g),c.push(e));if(e===a)break;g=A(e)?b?e.getFirstChild():e.getLastChild():null;if(null!==g)null===f&&(f=e),e=g;else if(g=b?e.getNextSibling():e.getPreviousSibling(),null!==g)e=g;else{g=e.getParentOrThrow();
|
|
69
|
+
d.has(g.__key)||c.push(g);if(g===a)break;e=g;g.is(f)&&(f=null);do null===e&&q(35),g=b?e.getNextSibling():e.getPreviousSibling(),e=e.getParent(),null!==e&&(e.is(f)&&(f=null),null!==g||d.has(e.__key)||c.push(e));while(null===g);e=g}}b||c.reverse();return c}isDirty(){const a=F()._dirtyLeaves;return null!==a&&a.has(this.__key)}isComposing(){return this.__key===F()._compositionKey}getLatest(){const a=J(this.__key);null===a&&q(36);return a}getWritable(){I();var a=E(),b=F();a=a._nodeMap;const c=this.__key,
|
|
70
|
+
d=this.getLatest(),e=d.__parent;b=b._cloneNotNeeded;if(b.has(c))return D(d),d;const f=d.constructor.clone(d);f.__parent=e;A(d)&&A(f)?(f.__children=Array.from(d.__children),f.__indent=d.__indent,f.__format=d.__format,f.__dir=d.__dir):z(d)&&z(f)?(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail):w(d)&&w(f)&&(f.__state=d.__state);b.add(c);f.__key=c;D(f);a.set(c,f);return f}getTextContent(){return""}getTextContentSize(a,b){return this.getTextContent(a,b).length}createDOM(){q(37)}updateDOM(){q(38)}remove(){I();
|
|
71
|
+
tb(this,!0)}replace(a){I();const b=this.__key;a=a.getWritable();var c=a.getParent();if(null!==c){c=c.getWritable().__children;var d=c.indexOf(a.__key);-1===d&&q(16);G(a);c.splice(d,1)}d=this.getParentOrThrow();var e=d.getWritable().__children;const f=e.indexOf(this.__key);c=a.__key;-1===f&&q(16);e.splice(f,0,c);a.__parent=d.__key;tb(this,!1);G(a);e=t();null!==e&&(d=e.anchor,e=e.focus,d.key===b&&fb(d,a),e.key===b&&fb(e,a));F()._compositionKey===b&&H(c);return a}insertAfter(a){I();var b=this.getWritable(),
|
|
72
|
+
c=a.getWritable(),d=c.getParent();const e=t();var f=!1,g=!1;if(null!==d){var h=d.getWritable().__children,l=h.indexOf(c.__key);-1===l&&q(16);G(c);if(null!==e){g=d.getKey();d=a.getIndexWithinParent();f=e.anchor;const k=e.focus;f="element"===f.type&&f.key===g&&f.offset===d+1;g="element"===k.type&&k.key===g&&k.offset===d+1}h.splice(l,1)}h=this.getParentOrThrow().getWritable();l=c.__key;c.__parent=b.__parent;d=h.__children;b=d.indexOf(b.__key);-1===b&&q(16);d.splice(b+1,0,l);G(c);null!==e&&(ob(e,h,b+
|
|
73
|
+
1),c=h.getKey(),f&&e.anchor.set(c,b+2,"element"),g&&e.focus.set(c,b+2,"element"));return a}insertBefore(a){I();var b=this.getWritable(),c=a.getWritable(),d=c.getParent();if(null!==d){d=d.getWritable().__children;var e=d.indexOf(c.__key);-1===e&&q(16);G(c);d.splice(e,1)}d=this.getParentOrThrow().getWritable();e=c.__key;c.__parent=b.__parent;const f=d.__children;b=f.indexOf(b.__key);-1===b&&q(16);f.splice(b,0,e);G(c);c=t();null!==c&&ob(c,d,b);return a}selectPrevious(a,b){I();const c=this.getPreviousSibling(),
|
|
74
|
+
d=this.getParentOrThrow();return null===c?d.select(0,0):A(c)?c.select():z(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){I();const c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():A(c)?c.select(0,0):z(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}function vb(a){const b=J(a);null===b&&q(39,a);return b}
|
|
75
|
+
class wb{constructor(a,b){this.id=a||Sa();this.editorState=b||null;this.editor=null}init(a){let b=this.editorState;"string"===typeof b&&(this.editorState=b=a.parseEditorState(b),null!==b&&a.setEditorState(b,{tag:"history-merge"}))}set(a){this.editor=a;this.editorState=a.getEditorState()}toJSON(){const a=this.editorState;return{editorState:null===a||"string"===typeof a?a:JSON.stringify(a.toJSON()),id:this.id,type:"editor"}}isEmpty(){return null===this.editorState}}
|
|
76
|
+
function xb(a,b){return new wb(a,b)}class yb{constructor(a,b){this._editor=a;this._observers=new Set;this._map=b||new Map}get(a){return this._map.get(a)}has(a){return this._map.has(a)}set(a,b){this._map.set(a,b);const c=Array.from(this._observers);for(let d=0;d<c.length;d++)c[d](a,b)}observe(a){const b=this._observers;b.add(a);return()=>{b.delete(a)}}destroy(){this._observers.clear()}toJSON(){return{map:Array.from(this._map.entries()),type:"map"}}}function zb(a,b){return new yb(a,b)}
|
|
77
|
+
class Ab{constructor(a,b){this._editor=a;this._observers=new Set;this._array=b||[]}observe(a){const b=this._observers;b.add(a);return()=>{b.delete(a)}}getLength(){return this._array.length}map(a){const b=[],c=this._array;for(let d=0;d<c.length;d++)b.push(a(c[d],d,c));return b}reduce(a,b){const c=this._array;for(let d=0;d<c.length;d++){const e=c[d];b=void 0!==b?a(b,e):e}return b}push(a){this.splice(this._array.length,0,a)}splice(a,b,c){void 0===c?this._array.splice(a,b):this._array.splice(a,b,c);const d=
|
|
78
|
+
Array.from(this._observers);for(let e=0;e<d.length;e++)d[e](a,b,c)}indexOf(a){return this._array.indexOf(a)}destroy(){this._observers.clear()}toJSON(){return{array:this._array,type:"array"}}}function Bb(a,b){return new Ab(a,b)}class Cb extends ub{constructor(a,b){super(b);b=F();this.__state=a||zb(b)}decorate(){q(4)}isIsolated(){return!1}isTopLevel(){return!1}}function w(a){return a instanceof Cb}
|
|
79
|
+
function Db(a,b){if("string"===typeof b||"number"===typeof b||"boolean"===typeof b||null===b)var c=b;else if("object"===typeof b)if(c=b.type,"editor"===c)c=xb(b.id,b.editorState);else if("array"===c){b=b.array;c=[];for(let d=0;d<b.length;d++)c.push(Db(a,b[d]));c=Bb(a,c)}else c=Eb(a,b);else q(48);return c}function Eb(a,b){b=b.map;const c=new Map;for(let d=0;d<b.length;d++){const [e,f]=b[d];c.set(e,Db(a,f))}return zb(a,c)}
|
|
80
|
+
function Fb(a,b,c,d,e={originalSelection:null}){var f=a.__type,g=c._nodes.get(f);void 0===g&&q(24,f);f=g.klass;g=a.__key;a.__key=void 0;f=f.clone(a);a.__key=g;g=f.__key;N(f)&&E()._nodeMap.set("root",f);f.__parent=d;if(A(f)){d=a.__children;for(let l=0;l<d.length;l++){var h=b.get(d[l]);void 0!==h&&(h=Fb(h,b,c,g,e).getKey(),f.__children.push(h))}f.__indent=a.__indent;f.__format=a.__format;f.__dir=a.__dir}else z(f)?(f.__format=a.__format,f.__style=a.__style,f.__mode=a.__mode,f.__detail=a.__detail):w(f)&&
|
|
81
|
+
(f.__state=Eb(c,a.__state));b=null!=e?e.originalSelection:void 0;null!=b&&(a.__key===b.anchor.key&&(e.remappedSelection=e.remappedSelection||{anchor:{...b.anchor},focus:{...b.focus}},e.remappedSelection.anchor.key=f.__key),a.__key===b.focus.key&&(e.remappedSelection=e.remappedSelection||{anchor:{...b.anchor},focus:{...b.focus}},e.remappedSelection.focus.key=f.__key));return f}let S="",T="",U="",Gb,V,Hb,Ib=!1,Jb=!1,Kb=null,Lb,Mb,Nb,Ob,Pb,Qb;
|
|
82
|
+
function Rb(a,b){const c=Nb.get(a);if(null!==b){const d=Sb(a);b.removeChild(d)}Ob.has(a)||V._keyToDOMMap.delete(a);A(c)&&(a=c.__children,Tb(a,0,a.length-1,null));void 0!==c&&Xa(Qb,Hb,c,"destroyed")}function Tb(a,b,c,d){for(;b<=c;++b){const e=a[b];void 0!==e&&Rb(e,d)}}function Ub(a,b){a.setProperty("text-align",b)}function Vb(a,b){a.style.setProperty("padding-inline-start",0===b?"":40*b+"px")}
|
|
83
|
+
function Wb(a,b){a=a.style;0===b?Ub(a,""):1===b?Ub(a,"left"):2===b?Ub(a,"center"):3===b?Ub(a,"right"):4===b&&Ub(a,"justify")}
|
|
84
|
+
function Xb(a,b,c){const d=Ob.get(a);void 0===d&&q(42);const e=d.createDOM(Gb,V);var f=V._keyToDOMMap;e["__lexicalKey_"+V._key]=a;f.set(a,e);z(d)?e.setAttribute("data-lexical-text","true"):w(d)&&e.setAttribute("data-lexical-decorator","true");if(A(d)){a=d.__indent;0!==a&&Vb(e,a);a=d.__children;var g=a.length;if(0!==g){f=a;--g;const h=T;T="";Yb(f,0,g,e,null);Zb(d,e);T=h}f=d.__format;0!==f&&Wb(e,f);$b(null,a,e)}else w(d)?(f=d.decorate(V),g=d.getTextContent(),null!==f&&ac(a,f),e.contentEditable="false",
|
|
85
|
+
S+=g,U+=g):(a=d.getTextContent(),z(d)&&(d.isDirectionless()||(T+=a),d.isInert()&&(f=e.style,f.pointerEvents="none",f.userSelect="none",e.contentEditable="false",f.setProperty("-webkit-user-select","none"))),S+=a,U+=a);null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));Xa(Qb,Hb,d,"created");return e}function Yb(a,b,c,d,e){const f=S;for(S="";b<=c;++b)Xb(a[b],d,e);d.__lexicalTextContent=S;S=f+S}
|
|
86
|
+
function bc(a,b){a=b.get(a[a.length-1]);return Ka(a)||w(a)}function $b(a,b,c){a=null!==a&&(0===a.length||bc(a,Nb));b=null!==b&&(0===b.length||bc(b,Ob));a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
|
|
87
|
+
function Zb(a,b){const c=b.__lexicalDir;if(b.__lexicalDirTextContent!==T||c!==Kb){var d=""===T;if(d)var e=Kb;else e=T,e=ba.test(e)?"rtl":ca.test(e)?"ltr":null;if(e!==c){const f=b.classList,g=Gb.theme;null===e||d&&"ltr"===e?(b.removeAttribute("dir"),d=g[c],void 0!==d&&("string"===typeof d&&(d=d.split(" "),d=g[c]=d),f.remove(...d))):null!==e&&(d=g[e],void 0!==d&&("string"===typeof d&&(d=d.split(" "),d=g[c]=d),f.add(...d)),b.dir=e);Jb||(a.getWritable().__dir=e)}Kb=e;b.__lexicalDirTextContent=T;b.__lexicalDir=
|
|
85
88
|
e}}
|
|
86
|
-
function
|
|
87
|
-
a),c=c.__children,a=d.__children,c!==a||e){var g=c,h=a;e=d;b=
|
|
88
|
-
m&&(m=new Set(g));void 0===n&&(n=new Set(h));const
|
|
89
|
-
c);!
|
|
90
|
-
function
|
|
91
|
-
function
|
|
92
|
-
m=m[1],"root"!==g&&m&&(m=h[l][1],n=a.get(g),void 0!==n&&void 0!==n&&n.__key!==e&&n.isAttached()&&
|
|
93
|
-
function
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
g;
|
|
98
|
-
|
|
99
|
-
function
|
|
100
|
-
function
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
class
|
|
104
|
-
|
|
105
|
-
this.getChildren(),c=b.length;if(0===c)return this;if(a>=c)return a=b[c-1],
|
|
106
|
-
b){let c="";const d=this.getChildren(),e=d.length;for(let f=0;f<e;f++){const g=d[f];c+=g.getTextContent(a,b);
|
|
107
|
-
return
|
|
108
|
-
const l=h.indexOf(g.__key);-1===l&&q(16);h.splice(l,1)}g.__parent=c;d.push(g.__key)}return b}setDirection(a){
|
|
109
|
-
const p=l.indexOf(n.__key);-1===p&&q(16);
|
|
110
|
-
null);0!==f.length||this.canBeEmpty()||
|
|
111
|
-
class
|
|
112
|
-
function
|
|
113
|
-
class
|
|
114
|
-
type:a.anchor.type},focus:{key:a.focus.key,offset:a.focus.offset,type:a.focus.type}}}}}const
|
|
115
|
-
function
|
|
116
|
-
function
|
|
117
|
-
function
|
|
118
|
-
"\n\n"===e?(a.preventDefault(),b.execCommand("insertParagraph")):null==e&&a.dataTransfer?(e=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(e)):null!=e&&
|
|
119
|
-
break;case "insertParagraph":
|
|
89
|
+
function cc(a,b){var c=Nb.get(a),d=Ob.get(a);void 0!==c&&void 0!==d||q(43);var e=Ib||Mb.has(a)||Lb.has(a);const f=dc(V,a);if(c===d&&!e)return A(c)?(d=f.__lexicalTextContent,void 0!==d&&(S+=d,U+=d),d=f.__lexicalDirTextContent,void 0!==d&&(T+=d)):w(c)||(d=c.getTextContent(),z(c)&&!c.isDirectionless()&&(T+=d),U+=d,S+=d),f;if(d.updateDOM(c,f,Gb))return d=Xb(a,null,null),null===b&&q(44),b.replaceChild(d,f),Rb(a,null),d;if(A(c)&&A(d)){if(a=d.__indent,a!==c.__indent&&Vb(f,a),a=d.__format,a!==c.__format&&Wb(f,
|
|
90
|
+
a),c=c.__children,a=d.__children,c!==a||e){var g=c,h=a;e=d;b=T;T="";const u=S;S="";var l=g.length,k=h.length;if(1===l&&1===k){var m=g[0];h=h[0];if(m===h)cc(m,f);else{var n=Sb(m);h=Xb(h,null,null);f.replaceChild(h,n);Rb(m,null)}}else if(0===l)0!==k&&Yb(h,0,k-1,f,null);else if(0===k)0!==l&&(m=null==f.__lexicalLineBreak,Tb(g,0,l-1,m?null:f),m&&(f.textContent=""));else{const x=l-1;l=k-1;let y=f.firstChild,B=0;for(k=0;B<=x&&k<=l;){var p=g[B];const v=h[k];if(p===v)y=cc(v,f).nextSibling,B++,k++;else{void 0===
|
|
91
|
+
m&&(m=new Set(g));void 0===n&&(n=new Set(h));const O=n.has(p),Ga=m.has(v);O?(Ga?(p=dc(V,v),p===y?y=cc(v,f).nextSibling:(null!=y?f.insertBefore(p,y):f.appendChild(p),cc(v,f)),B++):Xb(v,f,y),k++):(y=Sb(p).nextSibling,Rb(p,f),B++)}}m=B>x;n=k>l;m&&!n?(m=h[l+1],m=void 0===m?null:V.getElementByKey(m),Yb(h,k,l,f,m)):n&&!m&&Tb(g,B,x,f)}f.__lexicalTextContent=S;S=u+S;Zb(e,f);T=b;N(d)||$b(c,a,f)}}else w(d)?(c=d.decorate(V),null!==c&&ac(a,c)):(c=d.getTextContent(),z(d)&&!d.isDirectionless()&&(T+=c),S+=c,U+=
|
|
92
|
+
c);!Jb&&N(d)&&d.__cachedText!==U&&(d=d.getWritable(),d.__cachedText=U);return f}function ac(a,b){let c=V._pendingDecorators;const d=V._decorators;if(null===c){if(d[a]===b)return;c=Ma(V)}c[a]=b}function Sb(a){a=Pb.get(a);void 0===a&&q(45);return a}function dc(a,b){a=a._keyToDOMMap.get(b);void 0===a&&q(45);return a}let W=null,X=null,L=!1,ec=!1,La=0;function I(){L&&q(25)}function E(){null===W&&q(27);return W}function F(){null===X&&q(28);return X}
|
|
93
|
+
function kc(a,b,c){var d=b.__type;const e=a._nodes.get(d);void 0===e&&q(23,d);a=c.get(d);void 0===a&&(a=Array.from(e.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function lc(a,b){var c=b._dirtyLeaves;a=a._nodeMap;b=c.size;c=Array.from(c);for(let d=0;d<b;d++){const e=a.get(c[d]);z(e)&&e.isSimpleText()&&!e.isUnmergeable()&&bb(e)}}
|
|
94
|
+
function mc(a,b){const c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;const e=F()._compositionKey,f=new Map;var g=c,h=g.size,l=d;let k=l.size;for(;0<h||0<k;){if(0<h){b._dirtyLeaves=new Set;g=Array.from(g);for(var m=0;m<h;m++){var n=g[m];const p=a.get(n);z(p)&&p.isSimpleText()&&!p.isUnmergeable()&&bb(p);void 0!==p&&void 0!==p&&p.__key!==e&&p.isAttached()&&kc(b,p,f);c.add(n)}g=b._dirtyLeaves;h=g.size;if(0<h){La++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;h=Array.from(l);for(l=0;l<
|
|
95
|
+
k;l++)m=h[l],g=m[0],m=m[1],"root"!==g&&m&&(m=h[l][1],n=a.get(g),void 0!==n&&void 0!==n&&n.__key!==e&&n.isAttached()&&kc(b,n,f),d.set(g,m));g=b._dirtyLeaves;h=g.size;l=b._dirtyElements;k=l.size;La++}b._dirtyLeaves=c;b._dirtyElements=d}
|
|
96
|
+
function Y(a){var b=a._pendingEditorState,c=a._rootElement;if(null!==c&&null!==b){var d=a._editorState,e=d._selection,f=b._selection,g=0!==a._dirtyType;a._pendingEditorState=null;a._editorState=b;var h=W,l=L,k=X,m=a._updating;X=a;W=b;L=!1;a._updating=!0;try{var n=a._observer;let ea=null;if(g&&null!==n){var p=a._dirtyType,u=a._dirtyElements,x=a._dirtyLeaves;n.disconnect();try{T=U=S="";Ib=2===p;Kb=null;V=a;Gb=a._config;Hb=a._nodes;Lb=u;Mb=x;Nb=d._nodeMap;Ob=b._nodeMap;Jb=b._readOnly;Pb=new Map(a._keyToDOMMap);
|
|
97
|
+
const oa=new Map;Qb=oa;cc("root",null);Qb=Pb=Gb=Ob=Nb=Mb=Lb=Hb=V=void 0;ea=oa}finally{n.observe(c,{characterData:!0,childList:!0,subtree:!0})}}const Ha=window.getSelection();if(null!==Ha&&(g||null===f||f.dirty)){n=Ha;const oa=n.anchorNode,fc=n.focusNode,Mc=n.anchorOffset,Nc=n.focusOffset,Ia=document.activeElement,Z=a._rootElement;if(!a._updateTags.has("collaboration")||Ia===Z)if(null===f)null!==e&&Ca(a,oa,fc)&&n.removeAllRanges();else{var y=f.anchor,B=f.focus,v=B.key,O=dc(a,y.key),Ga=dc(a,v),gc=y.offset,
|
|
98
|
+
hc=B.offset;e=O;v=Ga;"text"===y.type&&(e=Da(O));"text"===B.type&&(v=Da(Ga));if(null!==e&&null!==v)if(Mc===gc&&Nc===hc&&oa===e&&fc===v)null===Z||null!==Ia&&Z.contains(Ia)||Z.focus({preventScroll:!0});else try{if(n.setBaseAndExtent(e,gc,v,hc),f.isCollapsed()&&Z===Ia){const aa=3===e.nodeType?e.parentNode:e;if(null!==aa){const Ja=aa.getBoundingClientRect();if(Ja.bottom>window.innerHeight)aa.scrollIntoView(!1);else if(0>Ja.top)aa.scrollIntoView();else if(Z){const ic=Z.getBoundingClientRect();Ja.bottom>
|
|
99
|
+
ic.bottom?aa.scrollIntoView(!1):Ja.top<ic.top&&aa.scrollIntoView()}}}}catch(aa){}}}var jc=ea;null!==jc&&nc(a,d,b,jc)}catch(ea){oc("error",a,!1,ea);ec||(pc(a,null,c,b),ya(a),a._dirtyType=2,ec=!0,Y(a),ec=!1);return}finally{a._updating=m,W=h,L=l,X=k}b._readOnly=!0;c=a._dirtyLeaves;f=a._dirtyElements;h=a._normalizedNodes;l=a._updateTags;g&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=new Map,a._normalizedNodes=new Set,a._updateTags=new Set);g=a._decorators;k=a._pendingDecorators||
|
|
100
|
+
g;m=b._nodeMap;for(var P in k)m.has(P)||(k===g&&(k=Ma(a)),delete k[P]);P=a._pendingDecorators;null!==P&&(a._decorators=P,a._pendingDecorators=null,oc("decorator",a,!0,P));P=Na(d);g=Na(b);P!==g&&oc("textcontent",a,!0,g);oc("update",a,!0,{dirtyElements:f,dirtyLeaves:c,editorState:b,normalizedNodes:h,prevEditorState:d,tags:l});b=a._deferred;a._deferred=[];if(0!==b.length){d=a._updating;a._updating=!0;try{for(P=0;P<b.length;P++)b[P]()}finally{a._updating=d}}b=a._updates;if(0!==b.length){const [ea,Ha]=
|
|
101
|
+
b.shift();qc(a,ea,Ha)}}}function nc(a,b,c,d){a._listeners.mutation.forEach((e,f)=>{e=d.get(e);void 0!==e&&f(e)})}function oc(a,b,c,...d){const e=b._updating;b._updating=c;try{const f=Array.from(b._listeners[a]);for(a=0;a<f.length;a++)f[a](...d)}finally{b._updating=e}}
|
|
102
|
+
function rc(a,b,c){if(!1===a._updating||X!==a){let e=!1;a.update(()=>{e=rc(a,b,c)});return e}const d=Ra(a);for(let e=4;0<=e;e--)for(let f=0;f<d.length;f++){const g=Array.from(d[f]._listeners.command[e]);for(let h=0;h<g.length;h++)if(!0===g[h](b,c,a))return!0}return!1}function sc(a){const b=a._updates;let c=!1;for(;0!==b.length;){const [d,e]=b.shift();let f,g;void 0!==e&&(f=e.onUpdate,g=e.tag,e.skipTransforms&&(c=!0),f&&a._deferred.push(f),g&&a._updateTags.add(g));d()}return c}
|
|
103
|
+
function qc(a,b,c){const d=a._updateTags;var e=!1;if(void 0!==c){var f=c.onUpdate;e=c.tag;null!=e&&d.add(e);e=c.skipTransforms}f&&a._deferred.push(f);c=a._editorState;f=a._pendingEditorState;let g=!1;null===f&&(f=a._pendingEditorState=new tc(new Map(c._nodeMap)),g=!0);const h=W,l=L,k=X,m=a._updating;W=f;L=!1;a._updating=!0;X=a;try{g&&(f._selection=nb(a));const n=a._compositionKey;b();e=sc(a);qb(f,a);0!==a._dirtyType&&(e?lc(f,a):mc(f,a),sc(a),Za(c,f,a._dirtyLeaves,a._dirtyElements));n!==a._compositionKey&&
|
|
104
|
+
(f._flushSync=!0);const p=f._selection;if(null!==p){const u=f._nodeMap,x=p.focus.key;void 0!==u.get(p.anchor.key)&&void 0!==u.get(x)||q(30)}}catch(n){oc("error",a,!1,n);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();Y(a);return}finally{W=h,L=l,X=k,a._updating=m,La=0}0!==a._dirtyType||uc(f,a)?f._flushSync?(f._flushSync=!1,Y(a)):g&&Ba(()=>{Y(a)}):(f._flushSync=!1,g&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}
|
|
105
|
+
function sa(a,b,c){a._updating?a._updates.push([b,c]):qc(a,b,c)}
|
|
106
|
+
class vc extends ub{constructor(a){super(a);this.__children=[];this.__indent=this.__format=0;this.__dir=null}getFormat(){return this.getLatest().__format}getIndent(){return this.getLatest().__indent}getChildren(){const a=this.getLatest().__children,b=[];for(let c=0;c<a.length;c++){const d=J(a[c]);null!==d&&b.push(d)}return b}getChildrenKeys(){return this.getLatest().__children}getChildrenSize(){return this.getLatest().__children.length}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const a=
|
|
107
|
+
F()._dirtyElements;return null!==a&&a.has(this.__key)}getAllTextNodes(a){const b=[],c=this.getLatest().__children;for(let e=0;e<c.length;e++){var d=J(c[e]);!z(d)||!a&&d.isInert()?A(d)&&(d=d.getAllTextNodes(a),b.push(...d)):b.push(d)}return b}getFirstDescendant(){let a=this.getFirstChild();for(;null!==a;){if(A(a)){const b=a.getFirstChild();if(null!==b){a=b;continue}}break}return a}getLastDescendant(){let a=this.getLastChild();for(;null!==a;){if(A(a)){const b=a.getLastChild();if(null!==b){a=b;continue}}break}return a}getDescendantByIndex(a){const b=
|
|
108
|
+
this.getChildren(),c=b.length;if(0===c)return this;if(a>=c)return a=b[c-1],A(a)&&a.getLastDescendant()||a;a=b[a];return A(a)&&a.getFirstDescendant()||a}getFirstChild(){const a=this.getLatest().__children;return 0===a.length?null:J(a[0])}getFirstChildOrThrow(){const a=this.getFirstChild();null===a&&q(15,this.__key);return a}getLastChild(){const a=this.getLatest().__children,b=a.length;return 0===b?null:J(a[b-1])}getChildAtIndex(a){a=this.getLatest().__children[a];return void 0===a?null:J(a)}getTextContent(a,
|
|
109
|
+
b){let c="";const d=this.getChildren(),e=d.length;for(let f=0;f<e;f++){const g=d[f];c+=g.getTextContent(a,b);A(g)&&f!==e-1&&!g.isInline()&&(c+="\n\n")}return c}getDirection(){return this.__dir}hasFormat(a){a=fa[a];return 0!==(this.getFormat()&a)}select(a,b){I();const c=t();var d=this.getChildrenSize();void 0===a&&(a=d);void 0===b&&(b=d);d=this.__key;if(null===c)return mb(d,a,d,b,"element","element");c.anchor.set(d,a,"element");c.focus.set(d,b,"element");c.dirty=!0;return c}selectStart(){const a=this.getFirstDescendant();
|
|
110
|
+
return A(a)||z(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){const a=this.getLastDescendant();return A(a)||z(a)?a.select():null!==a?a.selectNext():this.select()}clear(){I();const a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){I();const b=this.getWritable(),c=b.__key,d=b.__children,e=a.length;var f=this.getLastChild();null!==f&&D(f);for(f=0;f<e;f++){var g=a[f];g.__key===c&&q(49);g=g.getWritable();var h=g.getParent();if(null!==h){h=h.getWritable().__children;
|
|
111
|
+
const l=h.indexOf(g.__key);-1===l&&q(16);h.splice(l,1)}g.__parent=c;d.push(g.__key)}return b}setDirection(a){I();const b=this.getWritable();b.__dir=a;return b}setFormat(a){I();this.getWritable().__format=fa[a];return this}setIndent(a){I();this.getWritable().__indent=a;return this}splice(a,b,c){I();const d=this.getWritable();var e=d.__key;const f=d.__children,g=c.length;var h=[];for(let k=0;k<g;k++){const m=c[k],n=m.getWritable();m.__key===e&&q(49);var l=n.getParent();if(null!==l){l=l.getWritable().__children;
|
|
112
|
+
const p=l.indexOf(n.__key);-1===p&&q(16);G(m);l.splice(p,1)}n.__parent=e;h.push(n.__key)}(c=this.getChildAtIndex(a-1))&&D(c);(e=this.getChildAtIndex(a+b))&&D(e);a=f.splice(a,b,...h);if(b&&(b=t(),null!==b)){const k=new Set(a),m=new Set(h);h=u=>{for(u=u.getNode();u;){const x=u.__key;if(k.has(x)&&!m.has(x))return!0;u=u.getParent()}return!1};const {anchor:n,focus:p}=b;h(n)&&rb(n,n.getNode(),this,c,e);h(p)&&rb(p,p.getNode(),this,c,e);h=a.length;for(b=0;b<h;b++)c=J(a[b]),null!=c&&(c.getWritable().__parent=
|
|
113
|
+
null);0!==f.length||this.canBeEmpty()||N(this)||this.remove()}return d}insertNewAfter(){return null}canInsertTab(){return!1}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}}function A(a){return a instanceof vc}
|
|
114
|
+
class wc extends vc{static getType(){return"root"}static clone(){return new wc}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){throw Error("getTopLevelElementOrThrow: root nodes are not top level elements");}getTextContent(a,b){const c=this.__cachedText;return!L&&0!==F()._dirtyType||null===c||a&&!1===b?super.getTextContent(a,b):c}remove(){q(10)}replace(){q(11)}insertBefore(){q(12)}insertAfter(){q(13)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){const c=
|
|
115
|
+
a[b];A(c)||w(c)||q(46)}return super.append(...a)}}function N(a){return a instanceof wc}function uc(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){if(a.dirty||!a.is(b))return!0}else if(null!==b)return!0;return!1}function xc(){return new tc(new Map([["root",new wc]]))}
|
|
116
|
+
class tc{constructor(a,b){this._nodeMap=a;this._selection=b||null;this._readOnly=this._flushSync=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(a){a:{const c=W,d=L,e=X;W=this;L=!0;X=null;try{var b=a();break a}finally{W=c,L=d,X=e}b=void 0}return b}clone(a){a=new tc(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){const a=this._selection;return{_nodeMap:Array.from(this._nodeMap.entries()),_selection:null===a?null:{anchor:{key:a.anchor.key,offset:a.anchor.offset,
|
|
117
|
+
type:a.anchor.type},focus:{key:a.focus.key,offset:a.focus.offset,type:a.focus.type}}}}}const yc=Object.freeze({}),Ec=[["keydown",zc],["compositionstart",Ac],["compositionend",Bc],["input",Cc],["click",Dc],["cut",yc],["copy",yc],["dragstart",yc],["paste",yc],["focus",yc],["blur",yc]];la?Ec.push(["beforeinput",Fc]):Ec.push(["drop",yc]);let Gc=!1,Hc=0;
|
|
118
|
+
function Ic(a,b){a.update(()=>{if(b){var c=t();if(null!==c&&c.isCollapsed()){var d=c.anchor;"text"===d.type?(d=d.getNode(),c.format=d.getFormat()):"element"===d.type&&(c.format=0)}a.execCommand("selectionChange")}else wa(null)})}
|
|
119
|
+
function Dc(a,b){b.update(()=>{const c=t();if(null!==c){var d=c.anchor;"element"===d.type&&0===d.offset&&c.isCollapsed()&&1===Oa().getChildrenSize()&&d.getNode().getTopLevelElementOrThrow().isEmpty()&&(d=b.getEditorState()._selection,null!==d&&c.is(d)&&(window.getSelection().removeAllRanges(),c.dirty=!0))}})}
|
|
120
|
+
function Fc(a,b){const c=a.inputType;"deleteCompositionText"!==c&&"insertCompositionText"!==c&&b.update(()=>{const d=t();if(null!==d)if("deleteContentBackward"===c)H(null),a.preventDefault(),b.execCommand("deleteCharacter",!0);else{var e=a.data;if(!d.dirty&&d.isCollapsed()&&!N(d.anchor.getNode())&&a.getTargetRanges){var f=a.getTargetRanges()[0];f&&d.applyDOMRange(f)}var g=d.focus;f=d.anchor.getNode();g=g.getNode();if("insertText"===c)"\n"===e?(a.preventDefault(),b.execCommand("insertLineBreak")):
|
|
121
|
+
"\n\n"===e?(a.preventDefault(),b.execCommand("insertParagraph")):null==e&&a.dataTransfer?(e=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(e)):null!=e&&Va(d,e,!0)&&(a.preventDefault(),b.execCommand("insertText",e));else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":b.execCommand("insertText",a);break;case "insertFromComposition":H(null);b.execCommand("insertText",a);break;case "insertLineBreak":H(null);b.execCommand("insertLineBreak");
|
|
122
|
+
break;case "insertParagraph":H(null);b.execCommand("insertParagraph");break;case "insertFromPaste":case "insertFromPasteAsQuotation":b.execCommand("paste",a);break;case "deleteByComposition":f===g&&!A(f)&&!A(g)&&C(f)&&C(g)||b.execCommand("removeText");break;case "deleteByDrag":case "deleteByCut":b.execCommand("removeText");break;case "deleteContent":b.execCommand("deleteCharacter",!1);break;case "deleteWordBackward":b.execCommand("deleteWord",!0);break;case "deleteWordForward":b.execCommand("deleteWord",
|
|
120
123
|
!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":b.execCommand("deleteLine",!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":b.execCommand("deleteLine",!1);break;case "formatStrikeThrough":b.execCommand("formatText","strikethrough");break;case "formatBold":b.execCommand("formatText","bold");break;case "formatItalic":b.execCommand("formatText","italic");break;case "formatUnderline":b.execCommand("formatText","underline");break;case "historyUndo":b.execCommand("undo");
|
|
121
|
-
break;case "historyRedo":b.execCommand("redo")}}})}function
|
|
122
|
-
function
|
|
123
|
-
function uc(a,b){Bc="Unidentified"===a.key&&229===a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(39!==c||e||f||g)if(37!==c||e||f||g)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)b.execCommand("keyEnter",a);else if(r&&e&&79===c)a.preventDefault(),b.execCommand("insertLineBreak",!0);else if(13!==c||d){var h=r?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?b.execCommand("keyBackspace",a):b.execCommand("deleteCharacter",!0):27===c?b.execCommand("keyEscape",
|
|
124
|
+
break;case "historyRedo":b.execCommand("redo")}}})}function Cc(a,b){a.stopPropagation();b.update(()=>{var c=t();const d=a.data;null!=d&&null!==c&&Va(c,d,!1)?b.execCommand("insertText",d):Ta(b,!1);I();c=F();xa(c)})}function Ac(a,b){b.update(()=>{const c=t();if(null!==c&&!b.isComposing()){const d=c.anchor;H(d.key);Gc&&"element"!==d.type&&c.isCollapsed()||b.execCommand("insertText"," ")}})}function Jc(a,b){b.update(()=>{H(null);Ta(b,!0)})}function Bc(a,b){ka?setTimeout(()=>{Jc(a,b)},0):Jc(a,b)}
|
|
125
|
+
function zc(a,b){Gc="Unidentified"===a.key&&229===a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(39!==c||e||f||g)if(37!==c||e||f||g)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)b.execCommand("keyEnter",a);else if(r&&e&&79===c)a.preventDefault(),b.execCommand("insertLineBreak",!0);else if(13!==c||d){var h=r?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?b.execCommand("keyBackspace",a):b.execCommand("deleteCharacter",!0):27===c?b.execCommand("keyEscape",
|
|
124
126
|
a):(h=r?d||g||f?!1:46===c||68===c&&e:e||g||f?!1:46===c,h?46===c?b.execCommand("keyDelete",a):(a.preventDefault(),b.execCommand("deleteCharacter",!1)):8===c&&(r?g:e)?(a.preventDefault(),b.execCommand("deleteWord",!0)):46===c&&(r?g:e)?(a.preventDefault(),b.execCommand("deleteWord",!1)):r&&f&&8===c?(a.preventDefault(),b.execCommand("deleteLine",!0)):r&&f&&46===c?(a.preventDefault(),b.execCommand("deleteLine",!1)):66===c&&(r?f:e)?(a.preventDefault(),b.execCommand("formatText","bold")):85===c&&(r?f:e)?
|
|
125
127
|
(a.preventDefault(),b.execCommand("formatText","underline")):73===c&&(r?f:e)?(a.preventDefault(),b.execCommand("formatText","italic")):9!==c||g||e||f?90===c&&!d&&(r?f:e)?(a.preventDefault(),b.execCommand("undo")):(h=r?90===c&&f&&d:89===c&&e||90===c&&e&&d,h&&(a.preventDefault(),b.execCommand("redo"))):b.execCommand("keyTab",a))}else b.execCommand("keyEnter",a);else b.execCommand("keyArrowDown",a);else b.execCommand("keyArrowUp",a);else b.execCommand("keyArrowLeft",a);else b.execCommand("keyArrowRight",
|
|
126
|
-
a)}}function
|
|
127
|
-
function
|
|
128
|
-
|
|
129
|
-
function
|
|
130
|
-
function
|
|
131
|
-
class
|
|
132
|
-
(this.getLatest().__detail&2)}hasFormat(a){a=
|
|
133
|
-
c,this);a=a.theme.text;void 0!==a&&
|
|
134
|
-
l&&q(21));
|
|
135
|
-
a.__detail^=2;return a}setMode(a){a=
|
|
136
|
-
g=c.length;let h=a;0>h&&(h=g+h,0>h&&(h=0));const l=t();d&&null!==l&&(a+=g,l.setTextNodeRange(e,a,e,a));b=f.slice(0,h)+c+f.slice(h+b);return e.setTextContent(b)}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){
|
|
137
|
-
l=c.__key;const m=b.getFormat(),n=b.getStyle(),p=b.__detail;g=!1;b.isSegmented()?(h=
|
|
138
|
-
(
|
|
139
|
-
l&&l.key===d&&(
|
|
140
|
-
class
|
|
141
|
-
|
|
142
|
-
function
|
|
143
|
-
class
|
|
144
|
-
new Set;this._dirtyLeaves=new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this.
|
|
145
|
-
b){const c=a.getType(),d=this._nodes.get(c);
|
|
146
|
-
this._pendingEditorState||this._editorState;this._rootElement=a;
|
|
147
|
-
|
|
148
|
-
JSON.parse(a);a=new Map;a=new
|
|
149
|
-
t(),d=
|
|
150
|
-
exports.$createRangeSelection=function(){const a=
|
|
151
|
-
exports.$
|
|
152
|
-
exports.createEditor=function(a){var b=a||{},c=b.namespace||
|
|
153
|
-
exports.isDecoratorArray=function(a){return a instanceof
|
|
128
|
+
a)}}function Kc(a){a=a.getRootElement();return null!==a&&"true"===a.contentEditable}function Lc(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}const Oc=new Map;function Pc(){for(var a=window.getSelection().anchorNode;null!=a;){if("true"===a.contentEditable){const b=a.__lexicalEditor;if(void 0!==b){a=Ra(b);a=a[a.length-1];const c=a._key,d=Oc.get(c),e=d||a;e!==b&&Ic(e,!1);Ic(b,!0);b!==a?Oc.set(c,b):d&&Oc.delete(c);break}}a=a.parentNode}}
|
|
129
|
+
function Qc(a,b){0===Hc&&a.ownerDocument.addEventListener("selectionchange",Pc);Hc++;a.__lexicalEditor=b;const c=Lc(a);for(let d=0;d<Ec.length;d++){const [e,f]=Ec[d],g="function"===typeof f?h=>{Kc(b)&&f(h,b)}:h=>{Kc(b)&&b.execCommand(e,h)};a.addEventListener(e,g);c.push(()=>{a.removeEventListener(e,g)})}}
|
|
130
|
+
class Rc extends ub{static getType(){return"linebreak"}static clone(a){return new Rc(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}}function jb(){return new Rc}function Ka(a){return a instanceof Rc}function Sc(a,b){return b&1?"strong":b&2?"em":"span"}
|
|
131
|
+
function Tc(a,b,c,d,e){a=d.classList;d=Wa(e,"base");void 0!==d&&a.add(...d);d=Wa(e,"underlineStrikethrough");let f=!1;const g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(f=!0,g||a.add(...d)):g&&a.remove(...d));for(const l in da)h=da[l],d=Wa(e,l),void 0!==d&&(c&h?!f||"underline"!==l&&"strikethrough"!==l?(0===(b&h)||g&&"underline"===l||"strikethrough"===l)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
|
|
132
|
+
function Uc(a,b,c){const d=b.firstChild;c=c.isComposing();a+=c?"\u00a0":"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c){c=b.length;const e=a.length;let f=0,g=0;for(;f<c&&f<e&&b[f]===a[f];)f++;for(;g+f<c&&g+f<e&&b[c-g-1]===a[e-g-1];)g++;a=[f,c-f-g,a.slice(f,e-g)];const [h,l,k]=a;0!==l&&d.deleteData(h,l);d.insertData(h,k)}else d.nodeValue=a}
|
|
133
|
+
class Vc extends ub{static getType(){return"text"}static clone(a){return new Vc(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isSegmented(){return 2===this.getLatest().__mode}isInert(){return 3===this.getLatest().__mode}isDirectionless(){return 0!==(this.getLatest().__detail&1)}isUnmergeable(){return 0!==
|
|
134
|
+
(this.getLatest().__detail&2)}hasFormat(a){a=da[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(a,b){return!a&&this.isInert()||!1===b&&this.isDirectionless()?"":this.getLatest().__text}getFormatFlags(a,b){const c=this.getLatest().__format;return Ea(c,a,b)}createDOM(a){var b=this.__format,c=b&16?"code":null;const d=Sc(this,b),e=document.createElement(null===c?d:c);let f=e;null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;Uc(this.__text,
|
|
135
|
+
c,this);a=a.theme.text;void 0!==a&&Tc(d,0,b,c,a);b=this.__style;""!==b&&(e.style.cssText=b);return e}updateDOM(a,b,c){const d=this.__text;var e=a.__format,f=this.__format,g=e&16?"code":null;const h=f&16?"code":null;var l=Sc(this,e);const k=Sc(this,f);if((null===g?l:g)!==(null===h?k:h))return!0;if(g===h&&l!==k)return e=b.firstChild,null==e&&q(20),a=g=document.createElement(k),Uc(d,a,this),c=c.theme.text,void 0!==c&&Tc(k,0,f,a,c),b.replaceChild(g,e),!1;l=b;null!==h&&null!==g&&(l=b.firstChild,null==
|
|
136
|
+
l&&q(21));Uc(d,l,this);c=c.theme.text;void 0!==c&&e!==f&&Tc(k,e,f,l,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}selectionTransform(){}setFormat(a){I();const b=this.getWritable();this.getWritable().__format=a;return b}setStyle(a){I();const b=this.getWritable();this.getWritable().__style=a;return b}toggleFormat(a){a=da[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){const a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){const a=this.getWritable();
|
|
137
|
+
a.__detail^=2;return a}setMode(a){a=ha[a];const b=this.getWritable();b.__mode=a;return b}setTextContent(a){I();const b=this.getWritable();b.__text=a;return b}select(a,b){I();const c=t();var d=this.getTextContent();const e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(null===c)return mb(e,a,e,b,"text","text");d=F()._compositionKey;d!==c.anchor.key&&d!==c.focus.key||H(e);c.setTextNodeRange(this,a,this,b);return c}spliceText(a,b,c,d){I();const e=this.getWritable(),
|
|
138
|
+
f=e.__text,g=c.length;let h=a;0>h&&(h=g+h,0>h&&(h=0));const l=t();d&&null!==l&&(a+=g,l.setTextNodeRange(e,a,e,a));b=f.slice(0,h)+c+f.slice(h+b);return e.setTextContent(b)}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){I();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,e=F()._compositionKey,f=new Set(a);a=[];var g=c.length,h="";for(var l=0;l<g;l++)""!==h&&f.has(l)&&(a.push(h),h=""),h+=c[l];""!==h&&a.push(h);f=a.length;if(0===f)return[];if(a[0]===c)return[b];var k=
|
|
139
|
+
a[0];c=b.getParentOrThrow();l=c.__key;const m=b.getFormat(),n=b.getStyle(),p=b.__detail;g=!1;b.isSegmented()?(h=K(k),h.__parent=l,h.__format=m,h.__style=n,h.__detail=p,g=!0):(h=b.getWritable(),h.__text=k);b=t();h=[h];k=k.length;for(let y=1;y<f;y++){var u=a[y],x=u.length;u=K(u).getWritable();u.__format=m;u.__style=n;u.__detail=p;const B=u.__key;x=k+x;if(null!==b){const v=b.anchor,O=b.focus;v.key===d&&"text"===v.type&&v.offset>k&&v.offset<=x&&(v.key=B,v.offset-=k,b.dirty=!0);O.key===d&&"text"===O.type&&
|
|
140
|
+
O.offset>k&&O.offset<=x&&(O.key=B,O.offset-=k,b.dirty=!0)}e===d&&H(B);k=x;u.__parent=l;h.push(u)}G(this);e=c.getWritable().__children;d=e.indexOf(d);a=h.map(y=>y.__key);g?(e.splice(d,0,...a),this.remove()):e.splice(d,1,...a);null!==b&&ob(b,c,d,f-1);return h}mergeWithSibling(a){const b=a===this.getPreviousSibling();b||a===this.getNextSibling()||q(22);const c=this.__key,d=a.__key,e=this.__text,f=e.length;F()._compositionKey===d&&H(c);const g=t();if(null!==g){const h=g.anchor,l=g.focus;null!==h&&h.key===
|
|
141
|
+
d&&(sb(h,b,c,a,f),g.dirty=!0);null!==l&&l.key===d&&(sb(l,b,c,a,f),g.dirty=!0)}this.setTextContent(b?a.__text+e:e+a.__text);a.remove();return this.getLatest()}}function K(a=""){return new Vc(a)}function z(a){return a instanceof Vc}
|
|
142
|
+
class Wc extends vc{static getType(){return"paragraph"}static clone(a){return new Wc(a.__key)}constructor(a){super(a)}createDOM(a){const b=document.createElement("p");a=Wa(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}insertNewAfter(){const a=hb(),b=this.getDirection();a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){const a=this.getChildren();if(0===a.length||z(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),
|
|
143
|
+
this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function hb(){return new Wc}
|
|
144
|
+
function pc(a,b,c,d){const e=a._keyToDOMMap;e.clear();a._editorState=xc();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._updates=[];d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",e.set("root",c))}
|
|
145
|
+
class Xc{constructor(a,b,c,d){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={command:[new Set,new Set,new Set,new Set,new Set],decorator:new Set,error:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set};this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=
|
|
146
|
+
new Set;this._dirtyLeaves=new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=""+za++}isComposing(){return null!=this._compositionKey}addListener(a,b,c){const d=this._listeners[a];if("command"===a){void 0===c&&q(56);const f=d[c];f.add(b);return()=>{f.delete(b)}}if("mutation"===a){void 0===this._nodes.get(b.getType())&&q(57,b.name);const f=this._listeners.mutation;f.set(c,b);return()=>{f.delete(c)}}d.add(b);const e="root"===a;e&&
|
|
147
|
+
b(this._rootElement,null);return()=>{d.delete(b);e&&b(null,this._rootElement)}}addTransform(a,b){const c=a.getType(),d=this._nodes.get(c);void 0===d&&q(57,a.name);const e=d.transforms;e.add(b);Pa(this,c);return()=>{e.delete(b)}}hasNodes(a){for(let b=0;b<a.length;b++){const c=a[b].getType();if(!this._nodes.has(c))return!1}return!0}execCommand(a,b){return rc(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}setRootElement(a){const b=this._rootElement;if(a!==
|
|
148
|
+
b){var c=this._pendingEditorState||this._editorState;this._rootElement=a;pc(this,b,a,c);if(null!==b&&!this._config.disableEvents){Hc--;0===Hc&&b.ownerDocument.removeEventListener("selectionchange",Pc);c=b.__lexicalEditor;if(c._parentEditor){var d=Ra(c);d=d[d.length-1]._key;Oc.get(d)===c&&Oc.delete(d)}else Oc.delete(c._key);b.__lexicalEditor=null;c=Lc(b);for(d=0;d<c.length;d++)c[d]();b._lexicalEventHandles=[]}null!==a&&(c=a.style,c.userSelect="text",c.whiteSpace="pre-wrap",c.overflowWrap="break-word",
|
|
149
|
+
a.setAttribute("data-lexical-editor","true"),this._dirtyType=2,ya(this),this._updateTags.add("history-merge"),Y(this),this._config.disableEvents||Qc(a,this));oc("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&q(19);xa(this);const c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),Y(this));this._pendingEditorState=a;this._dirtyType=2;
|
|
150
|
+
this._compositionKey=null;null!=b&&d.add(b);Y(this)}parseEditorState(a){const b=JSON.parse(a);a=new Map;a=new tc(a);const c={originalSelection:b._selection},d=L,e=X;W=a;L=!1;X=this;try{var f=new Map(b._nodeMap);const g=f.get("root");Fb(g,f,this,null,c)}finally{W=a,L=d,X=e}f=c.remappedSelection||c.originalSelection;f=null===f?null:new R(M(f.anchor.key,f.anchor.offset,f.anchor.type),M(f.focus.key,f.focus.offset,f.focus.type),0);a._selection=f;return a}update(a,b){sa(this,a,b)}focus(a){const b=this._rootElement;
|
|
151
|
+
null!==b&&(b.setAttribute("autocapitalize","off"),sa(this,()=>{const c=t(),d=Oa();null!==c?c.dirty=!0:0!==d.getChildrenSize()&&d.selectEnd()},{onUpdate:()=>{b.removeAttribute("autocapitalize");a&&a()}}))}blur(){const a=this._rootElement;null!==a&&a.blur()}}exports.$createLineBreakNode=jb;exports.$createNodeFromParse=function(a,b){I();const c=F();return Fb(a,b,c,null)};exports.$createParagraphNode=hb;
|
|
152
|
+
exports.$createRangeSelection=function(){const a=M("root",0,"element"),b=M("root",0,"element");return new R(a,b,0)};exports.$createTextNode=K;exports.$getNearestNodeFromDOMNode=ta;exports.$getNodeByKey=J;exports.$getPreviousSelection=Ua;exports.$getRoot=Oa;exports.$getSelection=t;exports.$isDecoratorNode=w;exports.$isElementNode=A;exports.$isLeafNode=Fa;exports.$isLineBreakNode=Ka;exports.$isParagraphNode=function(a){return a instanceof Wc};
|
|
153
|
+
exports.$isRangeSelection=function(a){return a instanceof R};exports.$isRootNode=N;exports.$isTextNode=z;exports.$setCompositionKey=H;exports.$setSelection=wa;exports.DecoratorNode=Cb;exports.ElementNode=vc;exports.ParagraphNode=Wc;exports.TextNode=Vc;exports.VERSION="0.1.9";exports.createDecoratorArray=Bb;exports.createDecoratorEditor=xb;exports.createDecoratorMap=zb;
|
|
154
|
+
exports.createEditor=function(a){var b=a||{},c=b.namespace||Sa();const d=b.theme||{},e=b.context||{},f=b.parentEditor||null,g=b.htmlTransforms||{},h=b.disableEvents||!1,l=xc();a=b.editorState;b=[wc,Vc,Rc,Wc,...(b.nodes||[])];const k=new Map;for(let m=0;m<b.length;m++){const n=b[m],p=n.getType();k.set(p,{klass:n,transforms:new Set})}c=new Xc(l,f,k,{context:e,disableEvents:h,htmlTransforms:g,namespace:c,theme:d});void 0!==a&&(c._pendingEditorState=a,c._dirtyType=2);return c};
|
|
155
|
+
exports.isDecoratorArray=function(a){return a instanceof Ab};exports.isDecoratorEditor=function(a){return a instanceof wb};exports.isDecoratorMap=function(a){return a instanceof yb};
|