@lexical/table 0.16.2-nightly.20240726.0 → 0.16.2-nightly.20240730.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1732,16 +1732,10 @@ function applyTableHandlers(tableNode, tableElement, editor, hasTabHandler) {
1732
1732
  if (!parentNode) {
1733
1733
  return false;
1734
1734
  }
1735
- const nextNode = table.getNextSibling() || table.getPreviousSibling();
1736
1735
  table.remove();
1737
- if (nextNode) {
1738
- nextNode.selectStart();
1739
- } else {
1740
- parentNode.selectStart();
1741
- }
1742
1736
  }
1743
1737
  }
1744
- return true;
1738
+ return false;
1745
1739
  }
1746
1740
  if ($isTableSelection(selection)) {
1747
1741
  event.preventDefault();
@@ -1730,16 +1730,10 @@ function applyTableHandlers(tableNode, tableElement, editor, hasTabHandler) {
1730
1730
  if (!parentNode) {
1731
1731
  return false;
1732
1732
  }
1733
- const nextNode = table.getNextSibling() || table.getPreviousSibling();
1734
1733
  table.remove();
1735
- if (nextNode) {
1736
- nextNode.selectStart();
1737
- } else {
1738
- parentNode.selectStart();
1739
- }
1740
1734
  }
1741
1735
  }
1742
- return true;
1736
+ return false;
1743
1737
  }
1744
1738
  if ($isTableSelection(selection)) {
1745
1739
  event.preventDefault();
@@ -83,15 +83,14 @@ k),m.removeEventListener("mousemove",l);else{var q=ua(n.target);null===q||g.anch
83
83
  {const l=v.$getSelection(),n=k.target;R(l)&&l.tableKey===g.tableNodeKey&&f.contains(n)&&g.clearHighlight()})};m.addEventListener("mousedown",p);g.listenersToRemove.add(()=>m.removeEventListener("mousedown",p));g.listenersToRemove.add(c.registerCommand(v.KEY_ARROW_DOWN_COMMAND,k=>V(c,k,"down",a,g),v.COMMAND_PRIORITY_HIGH));g.listenersToRemove.add(c.registerCommand(v.KEY_ARROW_UP_COMMAND,k=>V(c,k,"up",a,g),v.COMMAND_PRIORITY_HIGH));g.listenersToRemove.add(c.registerCommand(v.KEY_ARROW_LEFT_COMMAND,
84
84
  k=>V(c,k,"backward",a,g),v.COMMAND_PRIORITY_HIGH));g.listenersToRemove.add(c.registerCommand(v.KEY_ARROW_RIGHT_COMMAND,k=>V(c,k,"forward",a,g),v.COMMAND_PRIORITY_HIGH));g.listenersToRemove.add(c.registerCommand(v.KEY_ESCAPE_COMMAND,k=>{var l=v.$getSelection();return R(l)&&(l=h.$findMatchingParent(l.focus.getNode(),A),A(l))?(Z(k),l.selectEnd(),!0):!1},v.COMMAND_PRIORITY_HIGH));let t=k=>()=>{var l=v.$getSelection();if(!U(l,a))return!1;if(R(l))return g.clearText(),!0;if(v.$isRangeSelection(l)){var n=
85
85
  h.$findMatchingParent(l.anchor.getNode(),u=>A(u));if(!A(n))return!1;var q=l.anchor.getNode();n=l.focus.getNode();q=a.isParentOf(q);n=a.isParentOf(n);if(q&&!n||n&&!q)return g.clearText(),!0;n=(l=h.$findMatchingParent(l.anchor.getNode(),u=>v.$isElementNode(u)))&&h.$findMatchingParent(l,u=>v.$isElementNode(u)&&A(u.getParent()));if(!v.$isElementNode(n)||!v.$isElementNode(l))return!1;if(k===v.DELETE_LINE_COMMAND&&null===n.getPreviousSibling())return!0}return!1};[v.DELETE_WORD_COMMAND,v.DELETE_LINE_COMMAND,
86
- v.DELETE_CHARACTER_COMMAND].forEach(k=>{g.listenersToRemove.add(c.registerCommand(k,t(k),v.COMMAND_PRIORITY_CRITICAL))});b=k=>{var l=v.$getSelection();if(!U(l,a)){if(k=l?l.getNodes():null)if(k=k.find(n=>N(n)&&n.getKey()===g.tableNodeKey),N(k)){l=k.getParent();if(!l)return!1;const n=k.getNextSibling()||k.getPreviousSibling();k.remove();n?n.selectStart():l.selectStart()}return!0}if(R(l))return k.preventDefault(),k.stopPropagation(),g.clearText(),!0;v.$isRangeSelection(l)&&(k=h.$findMatchingParent(l.anchor.getNode(),
87
- n=>A(n)),A(k));return!1};g.listenersToRemove.add(c.registerCommand(v.KEY_BACKSPACE_COMMAND,b,v.COMMAND_PRIORITY_CRITICAL));g.listenersToRemove.add(c.registerCommand(v.KEY_DELETE_COMMAND,b,v.COMMAND_PRIORITY_CRITICAL));g.listenersToRemove.add(c.registerCommand(v.FORMAT_TEXT_COMMAND,k=>{let l=v.$getSelection();if(!U(l,a))return!1;if(R(l))return g.formatCells(k),!0;v.$isRangeSelection(l)&&(k=h.$findMatchingParent(l.anchor.getNode(),n=>A(n)),A(k));return!1},v.COMMAND_PRIORITY_CRITICAL));g.listenersToRemove.add(c.registerCommand(v.FORMAT_ELEMENT_COMMAND,
88
- k=>{var l=v.$getSelection();if(!R(l)||!U(l,a))return!1;var n=l.anchor.getNode();l=l.focus.getNode();if(!A(n)||!A(l))return!1;let [q,u,w]=P(a,n,l);n=Math.max(u.startRow,w.startRow);l=Math.max(u.startColumn,w.startColumn);var B=Math.min(u.startRow,w.startRow);let E=Math.min(u.startColumn,w.startColumn);for(;B<=n;B++)for(let H=E;H<=l;H++){var F=q[B][H].cell;F.setFormat(k);F=F.getChildren();for(let L=0;L<F.length;L++){let M=F[L];v.$isElementNode(M)&&!M.isInline()&&M.setFormat(k)}}return!0},v.COMMAND_PRIORITY_CRITICAL));
89
- g.listenersToRemove.add(c.registerCommand(v.CONTROLLED_TEXT_INSERTION_COMMAND,k=>{var l=v.$getSelection();if(!U(l,a))return!1;if(R(l))g.clearHighlight();else if(v.$isRangeSelection(l)){let n=h.$findMatchingParent(l.anchor.getNode(),q=>A(q));if(!A(n))return!1;if("string"===typeof k&&(l=Ka(c,l,a)))return Ja(l,a,[v.$createTextNode(k)]),!0}return!1},v.COMMAND_PRIORITY_CRITICAL));d&&g.listenersToRemove.add(c.registerCommand(v.KEY_TAB_COMMAND,k=>{var l=v.$getSelection();if(!v.$isRangeSelection(l)||!l.isCollapsed()||
90
- !U(l,a))return!1;l=Da(l.anchor.getNode());if(null===l)return!1;Z(k);l=a.getCordsFromCellNode(l,g.table);Aa(g,a,l.x,l.y,k.shiftKey?"backward":"forward");return!0},v.COMMAND_PRIORITY_CRITICAL));g.listenersToRemove.add(c.registerCommand(v.FOCUS_COMMAND,()=>a.isSelected(),v.COMMAND_PRIORITY_HIGH));g.listenersToRemove.add(c.registerCommand(v.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,k=>{let {nodes:l,selection:n}=k;k=n.getStartEndPoints();var q=R(n);q=v.$isRangeSelection(n)&&null!==h.$findMatchingParent(n.anchor.getNode(),
91
- J=>A(J))&&null!==h.$findMatchingParent(n.focus.getNode(),J=>A(J))||q;if(1!==l.length||!N(l[0])||!q||null===k)return!1;var [u]=k,w=l[0];k=w.getChildren();q=w.getFirstChildOrThrow().getChildrenSize();w=w.getChildrenSize();var B=h.$findMatchingParent(u.getNode(),J=>A(J)),E=(u=B&&h.$findMatchingParent(B,J=>G(J)))&&h.$findMatchingParent(u,J=>N(J));if(!A(B)||!G(u)||!N(E))return!1;var F=u.getIndexWithinParent(),H=Math.min(E.getChildrenSize()-1,F+w-1);w=B.getIndexWithinParent();B=Math.min(u.getChildrenSize()-
92
- 1,w+q-1);q=Math.min(w,B);u=Math.min(F,H);w=Math.max(w,B);F=Math.max(F,H);E=E.getChildren();H=0;let L,M;for(B=u;B<=F;B++){var fa=E[B];if(!G(fa))return!1;var ha=k[H];if(!G(ha))return!1;fa=fa.getChildren();ha=ha.getChildren();let J=0;for(let W=q;W<=w;W++){let X=fa[W];if(!A(X))return!1;let Ca=ha[J];if(!A(Ca))return!1;B===u&&W===q?L=X.getKey():B===F&&W===w&&(M=X.getKey());let Oa=X.getChildren();Ca.getChildren().forEach(Y=>{v.$isTextNode(Y)&&v.$createParagraphNode().append(Y);X.append(Y)});Oa.forEach(Y=>
93
- Y.remove());J++}H++}L&&M&&(k=ra(),k.set(l[0].getKey(),L,M),v.$setSelection(k));return!0},v.COMMAND_PRIORITY_CRITICAL));g.listenersToRemove.add(c.registerCommand(v.SELECTION_CHANGE_COMMAND,()=>{let k=v.$getSelection(),l=v.$getPreviousSelection();if(v.$isRangeSelection(k)){let {anchor:B,focus:E}=k;var n=B.getNode(),q=E.getNode();n=Da(n);var u=Da(q);q=!(!n||!a.is(T(n)));var w=!(!u||!a.is(T(u)));let F=q!==w,H=q&&w;q=k.isBackward();F?(n=k.clone(),w?([w]=P(a,u,u),u=w[0][0].cell,w=w[w.length-1].at(-1).cell,
94
- n.focus.set(q?u.getKey():w.getKey(),q?u.getChildrenSize():w.getChildrenSize(),"element")):n.anchor.set(a.getParentOrThrow().getKey(),q?a.getIndexWithinParent()+1:a.getIndexWithinParent(),"element"),v.$setSelection(n),ya(c,g)):H&&!n.is(u)&&(g.setAnchorCellForSelection(e(n)),g.setFocusCellForSelection(e(u),!0),g.isSelecting||setTimeout(()=>{let {onMouseUp:L,onMouseMove:M}=r();g.isSelecting=!0;m.addEventListener("mouseup",L);m.addEventListener("mousemove",M)},0))}else k&&R(k)&&k.is(l)&&k.tableKey===
95
- a.getKey()&&(q=ea?(c._window||window).getSelection():null)&&q.anchorNode&&q.focusNode&&(n=(n=v.$getNearestNodeFromDOMNode(q.focusNode))&&!a.is(T(n)),u=(u=v.$getNearestNodeFromDOMNode(q.anchorNode))&&a.is(T(u)),n&&u&&0<q.rangeCount&&(n=v.$createRangeSelectionFromDom(q,c)))&&(n.anchor.set(a.getKey(),k.isBackward()?a.getChildrenSize():0,"element"),q.removeAllRanges(),v.$setSelection(n));if(k&&!k.is(l)&&(R(k)||R(l))&&g.tableSelection&&!g.tableSelection.is(l))return R(k)&&k.tableKey===g.tableNodeKey?g.updateTableTableSelection(k):
96
- !R(k)&&R(l)&&l.tableKey===g.tableNodeKey&&g.updateTableTableSelection(null),!1;g.hasHijackedSelectionStyles&&!a.isSelected()?za(c,g):!g.hasHijackedSelectionStyles&&a.isSelected()&&ya(c,g);return!1},v.COMMAND_PRIORITY_CRITICAL));g.listenersToRemove.add(c.registerCommand(v.INSERT_PARAGRAPH_COMMAND,()=>{var k=v.$getSelection();return v.$isRangeSelection(k)&&k.isCollapsed()&&U(k,a)?(k=Ka(c,k,a))?(Ja(k,a),!0):!1:!1},v.COMMAND_PRIORITY_CRITICAL));return g};exports.getDOMCellFromTarget=ua;
97
- exports.getTableObserverFromTableElement=function(a){return a.__lexicalTableSelection}
86
+ v.DELETE_CHARACTER_COMMAND].forEach(k=>{g.listenersToRemove.add(c.registerCommand(k,t(k),v.COMMAND_PRIORITY_CRITICAL))});b=k=>{const l=v.$getSelection();if(!U(l,a)){if(k=l?l.getNodes():null)if(k=k.find(n=>N(n)&&n.getKey()===g.tableNodeKey),N(k)){if(!k.getParent())return!1;k.remove()}return!1}if(R(l))return k.preventDefault(),k.stopPropagation(),g.clearText(),!0;v.$isRangeSelection(l)&&(k=h.$findMatchingParent(l.anchor.getNode(),n=>A(n)),A(k));return!1};g.listenersToRemove.add(c.registerCommand(v.KEY_BACKSPACE_COMMAND,
87
+ b,v.COMMAND_PRIORITY_CRITICAL));g.listenersToRemove.add(c.registerCommand(v.KEY_DELETE_COMMAND,b,v.COMMAND_PRIORITY_CRITICAL));g.listenersToRemove.add(c.registerCommand(v.FORMAT_TEXT_COMMAND,k=>{let l=v.$getSelection();if(!U(l,a))return!1;if(R(l))return g.formatCells(k),!0;v.$isRangeSelection(l)&&(k=h.$findMatchingParent(l.anchor.getNode(),n=>A(n)),A(k));return!1},v.COMMAND_PRIORITY_CRITICAL));g.listenersToRemove.add(c.registerCommand(v.FORMAT_ELEMENT_COMMAND,k=>{var l=v.$getSelection();if(!R(l)||
88
+ !U(l,a))return!1;var n=l.anchor.getNode();l=l.focus.getNode();if(!A(n)||!A(l))return!1;let [q,u,w]=P(a,n,l);n=Math.max(u.startRow,w.startRow);l=Math.max(u.startColumn,w.startColumn);var B=Math.min(u.startRow,w.startRow);let E=Math.min(u.startColumn,w.startColumn);for(;B<=n;B++)for(let H=E;H<=l;H++){var F=q[B][H].cell;F.setFormat(k);F=F.getChildren();for(let L=0;L<F.length;L++){let M=F[L];v.$isElementNode(M)&&!M.isInline()&&M.setFormat(k)}}return!0},v.COMMAND_PRIORITY_CRITICAL));g.listenersToRemove.add(c.registerCommand(v.CONTROLLED_TEXT_INSERTION_COMMAND,
89
+ k=>{var l=v.$getSelection();if(!U(l,a))return!1;if(R(l))g.clearHighlight();else if(v.$isRangeSelection(l)){let n=h.$findMatchingParent(l.anchor.getNode(),q=>A(q));if(!A(n))return!1;if("string"===typeof k&&(l=Ka(c,l,a)))return Ja(l,a,[v.$createTextNode(k)]),!0}return!1},v.COMMAND_PRIORITY_CRITICAL));d&&g.listenersToRemove.add(c.registerCommand(v.KEY_TAB_COMMAND,k=>{var l=v.$getSelection();if(!v.$isRangeSelection(l)||!l.isCollapsed()||!U(l,a))return!1;l=Da(l.anchor.getNode());if(null===l)return!1;Z(k);
90
+ l=a.getCordsFromCellNode(l,g.table);Aa(g,a,l.x,l.y,k.shiftKey?"backward":"forward");return!0},v.COMMAND_PRIORITY_CRITICAL));g.listenersToRemove.add(c.registerCommand(v.FOCUS_COMMAND,()=>a.isSelected(),v.COMMAND_PRIORITY_HIGH));g.listenersToRemove.add(c.registerCommand(v.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,k=>{let {nodes:l,selection:n}=k;k=n.getStartEndPoints();var q=R(n);q=v.$isRangeSelection(n)&&null!==h.$findMatchingParent(n.anchor.getNode(),J=>A(J))&&null!==h.$findMatchingParent(n.focus.getNode(),
91
+ J=>A(J))||q;if(1!==l.length||!N(l[0])||!q||null===k)return!1;var [u]=k,w=l[0];k=w.getChildren();q=w.getFirstChildOrThrow().getChildrenSize();w=w.getChildrenSize();var B=h.$findMatchingParent(u.getNode(),J=>A(J)),E=(u=B&&h.$findMatchingParent(B,J=>G(J)))&&h.$findMatchingParent(u,J=>N(J));if(!A(B)||!G(u)||!N(E))return!1;var F=u.getIndexWithinParent(),H=Math.min(E.getChildrenSize()-1,F+w-1);w=B.getIndexWithinParent();B=Math.min(u.getChildrenSize()-1,w+q-1);q=Math.min(w,B);u=Math.min(F,H);w=Math.max(w,
92
+ B);F=Math.max(F,H);E=E.getChildren();H=0;let L,M;for(B=u;B<=F;B++){var fa=E[B];if(!G(fa))return!1;var ha=k[H];if(!G(ha))return!1;fa=fa.getChildren();ha=ha.getChildren();let J=0;for(let W=q;W<=w;W++){let X=fa[W];if(!A(X))return!1;let Ca=ha[J];if(!A(Ca))return!1;B===u&&W===q?L=X.getKey():B===F&&W===w&&(M=X.getKey());let Oa=X.getChildren();Ca.getChildren().forEach(Y=>{v.$isTextNode(Y)&&v.$createParagraphNode().append(Y);X.append(Y)});Oa.forEach(Y=>Y.remove());J++}H++}L&&M&&(k=ra(),k.set(l[0].getKey(),
93
+ L,M),v.$setSelection(k));return!0},v.COMMAND_PRIORITY_CRITICAL));g.listenersToRemove.add(c.registerCommand(v.SELECTION_CHANGE_COMMAND,()=>{let k=v.$getSelection(),l=v.$getPreviousSelection();if(v.$isRangeSelection(k)){let {anchor:B,focus:E}=k;var n=B.getNode(),q=E.getNode();n=Da(n);var u=Da(q);q=!(!n||!a.is(T(n)));var w=!(!u||!a.is(T(u)));let F=q!==w,H=q&&w;q=k.isBackward();F?(n=k.clone(),w?([w]=P(a,u,u),u=w[0][0].cell,w=w[w.length-1].at(-1).cell,n.focus.set(q?u.getKey():w.getKey(),q?u.getChildrenSize():
94
+ w.getChildrenSize(),"element")):n.anchor.set(a.getParentOrThrow().getKey(),q?a.getIndexWithinParent()+1:a.getIndexWithinParent(),"element"),v.$setSelection(n),ya(c,g)):H&&!n.is(u)&&(g.setAnchorCellForSelection(e(n)),g.setFocusCellForSelection(e(u),!0),g.isSelecting||setTimeout(()=>{let {onMouseUp:L,onMouseMove:M}=r();g.isSelecting=!0;m.addEventListener("mouseup",L);m.addEventListener("mousemove",M)},0))}else k&&R(k)&&k.is(l)&&k.tableKey===a.getKey()&&(q=ea?(c._window||window).getSelection():null)&&
95
+ q.anchorNode&&q.focusNode&&(n=(n=v.$getNearestNodeFromDOMNode(q.focusNode))&&!a.is(T(n)),u=(u=v.$getNearestNodeFromDOMNode(q.anchorNode))&&a.is(T(u)),n&&u&&0<q.rangeCount&&(n=v.$createRangeSelectionFromDom(q,c)))&&(n.anchor.set(a.getKey(),k.isBackward()?a.getChildrenSize():0,"element"),q.removeAllRanges(),v.$setSelection(n));if(k&&!k.is(l)&&(R(k)||R(l))&&g.tableSelection&&!g.tableSelection.is(l))return R(k)&&k.tableKey===g.tableNodeKey?g.updateTableTableSelection(k):!R(k)&&R(l)&&l.tableKey===g.tableNodeKey&&
96
+ g.updateTableTableSelection(null),!1;g.hasHijackedSelectionStyles&&!a.isSelected()?za(c,g):!g.hasHijackedSelectionStyles&&a.isSelected()&&ya(c,g);return!1},v.COMMAND_PRIORITY_CRITICAL));g.listenersToRemove.add(c.registerCommand(v.INSERT_PARAGRAPH_COMMAND,()=>{var k=v.$getSelection();return v.$isRangeSelection(k)&&k.isCollapsed()&&U(k,a)?(k=Ka(c,k,a))?(Ja(k,a),!0):!1:!1},v.COMMAND_PRIORITY_CRITICAL));return g};exports.getDOMCellFromTarget=ua;exports.getTableObserverFromTableElement=function(a){return a.__lexicalTableSelection}
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{addClassNamesToElement as e,$findMatchingParent as t,removeClassNamesFromElement as n,isHTMLElement as o}from"@lexical/utils";import{ElementNode as r,$createParagraphNode as l,$isElementNode as s,$isLineBreakNode as i,$isTextNode as c,$applyNodeReplacement as a,createCommand as d,$createTextNode as u,$getSelection as h,$isRangeSelection as g,$createPoint as f,$normalizeSelection__EXPERIMENTAL as m,$getNodeByKey as p,isCurrentlyReadOnlyMode as C,$setSelection as S,SELECTION_CHANGE_COMMAND as _,$getNearestNodeFromDOMNode as w,$createRangeSelection as b,$getRoot as y,KEY_ARROW_DOWN_COMMAND as N,COMMAND_PRIORITY_HIGH as T,KEY_ARROW_UP_COMMAND as x,KEY_ARROW_LEFT_COMMAND as v,KEY_ARROW_RIGHT_COMMAND as E,KEY_ESCAPE_COMMAND as O,DELETE_WORD_COMMAND as M,DELETE_LINE_COMMAND as R,DELETE_CHARACTER_COMMAND as K,COMMAND_PRIORITY_CRITICAL as F,KEY_BACKSPACE_COMMAND as k,KEY_DELETE_COMMAND as A,FORMAT_TEXT_COMMAND as P,FORMAT_ELEMENT_COMMAND as H,CONTROLLED_TEXT_INSERTION_COMMAND as D,KEY_TAB_COMMAND as B,FOCUS_COMMAND as L,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND as I,$getPreviousSelection as W,$createRangeSelectionFromDom as U,INSERT_PARAGRAPH_COMMAND as z,$isRootOrShadowRoot as Y,$isDecoratorNode as X}from"lexical";const J=/^(\d+(?:\.\d+)?)px$/,$={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class j extends r{static getType(){return"tablecell"}static clone(e){const t=new j(e.__headerState,e.__colSpan,e.__width,e.__key);return t.__rowSpan=e.__rowSpan,t.__backgroundColor=e.__backgroundColor,t}static importDOM(){return{td:e=>({conversion:q,priority:0}),th:e=>({conversion:q,priority:0})}}static importJSON(e){const t=e.colSpan||1,n=e.rowSpan||1,o=G(e.headerState,t,e.width||void 0);return o.__rowSpan=n,o.__backgroundColor=e.backgroundColor||null,o}constructor(e=$.NO_STATUS,t=1,n,o){super(o),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=n,this.__backgroundColor=null}createDOM(t){const n=document.createElement(this.getTag());return this.__width&&(n.style.width=`${this.__width}px`),this.__colSpan>1&&(n.colSpan=this.__colSpan),this.__rowSpan>1&&(n.rowSpan=this.__rowSpan),null!==this.__backgroundColor&&(n.style.backgroundColor=this.__backgroundColor),e(n,t.theme.tableCell,this.hasHeader()&&t.theme.tableCellHeader),n}exportDOM(e){const{element:t}=super.exportDOM(e);if(t){const e=t;e.style.border="1px solid black",this.__colSpan>1&&(e.colSpan=this.__colSpan),this.__rowSpan>1&&(e.rowSpan=this.__rowSpan),e.style.width=`${this.getWidth()||75}px`,e.style.verticalAlign="top",e.style.textAlign="start";const n=this.getBackgroundColor();null!==n?e.style.backgroundColor=n:this.hasHeader()&&(e.style.backgroundColor="#f2f3f5")}return{element:t}}exportJSON(){return{...super.exportJSON(),backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,type:"tablecell",width:this.getWidth()}}getColSpan(){return this.__colSpan}setColSpan(e){return this.getWritable().__colSpan=e,this}getRowSpan(){return this.__rowSpan}setRowSpan(e){return this.getWritable().__rowSpan=e,this}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e){return this.getWritable().__headerState=e,this.__headerState}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){return this.getWritable().__width=e,this.__width}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){this.getWritable().__backgroundColor=e}toggleHeaderStyle(e){const t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==$.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function q(e){const t=e,n=e.nodeName.toLowerCase();let o;J.test(t.style.width)&&(o=parseFloat(t.style.width));const r=G("th"===n?$.ROW:$.NO_STATUS,t.colSpan,o);r.__rowSpan=t.rowSpan;const a=t.style.backgroundColor;""!==a&&(r.__backgroundColor=a);const d=t.style,u=d.textDecoration.split(" "),h="700"===d.fontWeight||"bold"===d.fontWeight,g=u.includes("line-through"),f="italic"===d.fontStyle,m=u.includes("underline");return{after:e=>(0===e.length&&e.push(l()),e),forChild:(e,t)=>{if(Q(t)&&!s(e)){const t=l();return i(e)&&"\n"===e.getTextContent()?null:(c(e)&&(h&&e.toggleFormat("bold"),g&&e.toggleFormat("strikethrough"),f&&e.toggleFormat("italic"),m&&e.toggleFormat("underline")),t.append(e),t)}return e},node:r}}function G(e,t=1,n){return a(new j(e,t,n))}function Q(e){return e instanceof j}const V=d("INSERT_TABLE_COMMAND");class Z extends r{static getType(){return"tablerow"}static clone(e){return new Z(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:ee,priority:0})}}static importJSON(e){return te(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){return{...super.exportJSON(),...this.getHeight()&&{height:this.getHeight()},type:"tablerow",version:1}}createDOM(t){const n=document.createElement("tr");return this.__height&&(n.style.height=`${this.__height}px`),e(n,t.theme.tableRow),n}isShadowRoot(){return!0}setHeight(e){return this.getWritable().__height=e,this.__height}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function ee(e){const t=e;let n;return J.test(t.style.height)&&(n=parseFloat(t.style.height)),{node:te(n)}}function te(e){return a(new Z(e))}function ne(e){return e instanceof Z}function oe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var re=oe((function(e){const t=new URLSearchParams;t.append("code",e);for(let e=1;e<arguments.length;e++)t.append("v",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));const le="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function se(e,t,n=!0){const o=lt();for(let r=0;r<e;r++){const e=te();for(let o=0;o<t;o++){let t=$.NO_STATUS;"object"==typeof n?(0===r&&n.rows&&(t|=$.ROW),0===o&&n.columns&&(t|=$.COLUMN)):n&&(0===r&&(t|=$.ROW),0===o&&(t|=$.COLUMN));const s=G(t),i=l();i.append(u()),s.append(i),e.append(s)}o.append(e)}return o}function ie(e){const n=t(e,(e=>Q(e)));return Q(n)?n:null}function ce(e){const n=t(e,(e=>ne(e)));if(ne(n))return n;throw new Error("Expected table cell to be inside of table row.")}function ae(e){const n=t(e,(e=>st(e)));if(st(n))return n;throw new Error("Expected table cell to be inside of table.")}function de(e){const t=ce(e);return ae(t).getChildren().findIndex((e=>e.is(t)))}function ue(e){return ce(e).getChildren().findIndex((t=>t.is(e)))}function he(e,t){const n=ae(e),{x:o,y:r}=n.getCordsFromCellNode(e,t);return{above:n.getCellNodeFromCords(o,r-1,t),below:n.getCellNodeFromCords(o,r+1,t),left:n.getCellNodeFromCords(o-1,r,t),right:n.getCellNodeFromCords(o+1,r,t)}}function ge(e,t){const n=e.getChildren();if(t>=n.length||t<0)throw new Error("Expected table cell to be inside of table row.");return n[t].remove(),e}function fe(e,t,n=!0,o,r){const s=e.getChildren();if(t>=s.length||t<0)throw new Error("Table row target index out of range");const i=s[t];if(!ne(i))throw new Error("Row before insertion index does not exist.");for(let e=0;e<o;e++){const e=i.getChildren(),t=e.length,o=te();for(let n=0;n<t;n++){const t=e[n];Q(t)||re(12);const{above:s,below:i}=he(t,r);let c=$.NO_STATUS;const a=s&&s.getWidth()||i&&i.getWidth()||void 0;(s&&s.hasHeaderState($.COLUMN)||i&&i.hasHeaderState($.COLUMN))&&(c|=$.COLUMN);const d=G(c,1,a);d.append(l()),o.append(d)}n?i.insertAfter(o):i.insertBefore(o)}return e}const me=(e,t)=>e===$.BOTH||e===t?t:$.NO_STATUS;function pe(e=!0){const t=h();g(t)||Re(t)||re(188);const n=t.focus.getNode(),[o,,r]=Ee(n),[s,i]=xe(r,o,o),c=s[0].length,{startRow:a}=i;if(e){const e=a+o.__rowSpan-1,t=s[e],n=te();for(let o=0;o<c;o++){const{cell:r,startRow:s}=t[o];if(s+r.__rowSpan-1<=e){const e=t[o].cell.__headerState,r=me(e,$.COLUMN);n.append(G(r).append(l()))}else r.setRowSpan(r.__rowSpan+1)}const i=r.getChildAtIndex(e);ne(i)||re(145),i.insertAfter(n)}else{const e=s[a],t=te();for(let n=0;n<c;n++){const{cell:o,startRow:r}=e[n];if(r===a){const o=e[n].cell.__headerState,r=me(o,$.COLUMN);t.append(G(r).append(l()))}else o.setRowSpan(o.__rowSpan+1)}const n=r.getChildAtIndex(a);ne(n)||re(145),n.insertBefore(t)}}function Ce(e,t,n=!0,o,r){const s=e.getChildren(),i=[];for(let e=0;e<s.length;e++){const n=s[e];if(ne(n))for(let e=0;e<o;e++){const e=n.getChildren();if(t>=e.length||t<0)throw new Error("Table column target index out of range");const o=e[t];Q(o)||re(12);const{left:s,right:c}=he(o,r);let a=$.NO_STATUS;(s&&s.hasHeaderState($.ROW)||c&&c.hasHeaderState($.ROW))&&(a|=$.ROW);const d=G(a);d.append(l()),i.push({newTableCell:d,targetCell:o})}}return i.forEach((({newTableCell:e,targetCell:t})=>{n?t.insertAfter(e):t.insertBefore(e)})),e}function Se(e=!0){const t=h();g(t)||Re(t)||re(188);const n=t.anchor.getNode(),o=t.focus.getNode(),[r]=Ee(n),[s,,i]=Ee(o),[c,a,d]=xe(i,s,r),u=c.length,f=e?Math.max(a.startColumn,d.startColumn):Math.min(a.startColumn,d.startColumn),m=e?f+s.__colSpan-1:f-1,p=i.getFirstChild();ne(p)||re(120);let C=null;function S(e=$.NO_STATUS){const t=G(e).append(l());return null===C&&(C=t),t}let _=p;e:for(let e=0;e<u;e++){if(0!==e){const e=_.getNextSibling();ne(e)||re(121),_=e}const t=c[e],n=t[m<0?0:m].cell.__headerState,o=me(n,$.ROW);if(m<0){Ne(_,S(o));continue}const{cell:r,startColumn:l,startRow:s}=t[m];if(l+r.__colSpan-1<=m){let n=r,l=s,i=m;for(;l!==e&&n.__rowSpan>1;){if(i-=r.__colSpan,!(i>=0)){_.append(S(o));continue e}{const{cell:e,startRow:o}=t[i];n=e,l=o}}n.insertAfter(S(o))}else r.setColSpan(r.__colSpan+1)}null!==C&&ye(C)}function _e(e,t){const n=e.getChildren();for(let e=0;e<n.length;e++){const o=n[e];if(ne(o)){const e=o.getChildren();if(t>=e.length||t<0)throw new Error("Table column target index out of range");e[t].remove()}}return e}function we(){const e=h();g(e)||Re(e)||re(188);const t=e.anchor.getNode(),n=e.focus.getNode(),[o,,r]=Ee(t),[l]=Ee(n),[s,i,c]=xe(r,o,l),{startRow:a}=i,{startRow:d}=c,u=d+l.__rowSpan-1;if(s.length===u-a+1)return void r.remove();const f=s[0].length,m=s[u+1],p=r.getChildAtIndex(u+1);for(let e=u;e>=a;e--){for(let t=f-1;t>=0;t--){const{cell:n,startRow:o,startColumn:r}=s[e][t];if(r===t&&(e===a&&o<a&&n.setRowSpan(n.__rowSpan-(o-a)),o>=a&&o+n.__rowSpan-1>u))if(n.setRowSpan(n.__rowSpan-(u-o+1)),null===p&&re(122),0===t)Ne(p,n);else{const{cell:e}=m[t-1];e.insertAfter(n)}}const t=r.getChildAtIndex(e);ne(t)||re(123,String(e)),t.remove()}if(void 0!==m){const{cell:e}=m[0];ye(e)}else{const e=s[a-1],{cell:t}=e[0];ye(t)}}function be(){const e=h();g(e)||Re(e)||re(188);const t=e.anchor.getNode(),n=e.focus.getNode(),[o,,r]=Ee(t),[l]=Ee(n),[s,i,c]=xe(r,o,l),{startColumn:a}=i,{startRow:d,startColumn:u}=c,f=Math.min(a,u),m=Math.max(a+o.__colSpan-1,u+l.__colSpan-1),p=m-f+1;if(s[0].length===m-f+1)return r.selectPrevious(),void r.remove();const C=s.length;for(let e=0;e<C;e++)for(let t=f;t<=m;t++){const{cell:n,startColumn:o}=s[e][t];if(o<f){if(t===f){const e=f-o;n.setColSpan(n.__colSpan-Math.min(p,n.__colSpan-e))}}else if(o+n.__colSpan-1>m){if(t===m){const e=m-o+1;n.setColSpan(n.__colSpan-e)}}else n.remove()}const S=s[d],_=a>u?S[a+o.__colSpan]:S[u+l.__colSpan];if(void 0!==_){const{cell:e}=_;ye(e)}else{const e=u<a?S[u-1]:S[a-1],{cell:t}=e;ye(t)}}function ye(e){const t=e.getFirstDescendant();null==t?e.selectStart():t.getParentOrThrow().selectStart()}function Ne(e,t){const n=e.getFirstChild();null!==n?n.insertBefore(t):e.append(t)}function Te(){const e=h();g(e)||Re(e)||re(188);const t=e.anchor.getNode(),[n,o,r]=Ee(t),l=n.__colSpan,s=n.__rowSpan;if(l>1){for(let e=1;e<l;e++)n.insertAfter(G($.NO_STATUS));n.setColSpan(1)}if(s>1){const[e,t]=xe(r,n,n),{startColumn:i,startRow:c}=t;let a;for(let t=1;t<s;t++){const n=c+t,r=e[n];a=(a||o).getNextSibling(),ne(a)||re(125);let s=null;for(let e=0;e<i;e++){const t=r[e],o=t.cell;t.startRow===n&&(s=o),o.__colSpan>1&&(e+=o.__colSpan-1)}if(null===s)for(let e=0;e<l;e++)Ne(a,G($.NO_STATUS));else for(let e=0;e<l;e++)s.insertAfter(G($.NO_STATUS))}n.setRowSpan(1)}}function xe(e,t,n){const[o,r,l]=ve(e,t,n);return null===r&&re(110),null===l&&re(111),[o,r,l]}function ve(e,t,n){const o=[];let r=null,l=null;function s(e,s,i){const c={cell:i,startColumn:s,startRow:e},a=i.__rowSpan,d=i.__colSpan;for(let t=0;t<a;t++){void 0===o[e+t]&&(o[e+t]=[]);for(let n=0;n<d;n++)o[e+t][s+n]=c}null!==t&&t.is(i)&&(r=c),null!==n&&n.is(i)&&(l=c)}function i(e,t){return void 0===o[e]||void 0===o[e][t]}const c=e.getChildren();for(let e=0;e<c.length;e++){const t=c[e];ne(t)||re(146);const n=t.getChildren();let o=0;for(const t of n){for(Q(t)||re(147);!i(e,o);)o++;s(e,o,t),o+=t.__colSpan}}return[o,r,l]}function Ee(e){let n;if(e instanceof j)n=e;else if("__type"in e){const o=t(e,Q);Q(o)||re(148),n=o}else{const o=t(e.getNode(),Q);Q(o)||re(148),n=o}const o=n.getParent();ne(o)||re(149);const r=o.getParent();return st(r)||re(150),[n,o,r]}function Oe(e){const[t,,n]=Ee(e),o=n.getChildren(),r=o.length,l=o[0].getChildren().length,s=new Array(r);for(let e=0;e<r;e++)s[e]=new Array(l);for(let e=0;e<r;e++){const n=o[e].getChildren();let r=0;for(let o=0;o<n.length;o++){for(;s[e][r];)r++;const l=n[o],i=l.__rowSpan||1,c=l.__colSpan||1;for(let t=0;t<i;t++)for(let n=0;n<c;n++)s[e+t][r+n]=l;if(t===l)return{colSpan:c,columnIndex:r,rowIndex:e,rowSpan:i};r+=c}}return null}class Me{constructor(e,t,n){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!Re(e)&&(this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus))}set(e,t,n){this.dirty=!0,this.tableKey=e,this.anchor.key=t,this.focus.key=n,this._cachedNodes=null}clone(){return new Me(this.tableKey,this.anchor,this.focus)}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.focus.getNode();s(t)||re(151);m(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const e=p(this.anchor.key);Q(e)||re(152);const t=Oe(e);null===t&&re(153);const n=p(this.focus.key);Q(n)||re(154);const o=Oe(n);null===o&&re(155);const r=Math.min(t.columnIndex,o.columnIndex),l=Math.max(t.columnIndex,o.columnIndex),s=Math.min(t.rowIndex,o.rowIndex),i=Math.max(t.rowIndex,o.rowIndex);return{fromX:Math.min(r,l),fromY:Math.min(s,i),toX:Math.max(r,l),toY:Math.max(s,i)}}getNodes(){const e=this._cachedNodes;if(null!==e)return e;const n=this.anchor.getNode(),o=this.focus.getNode(),r=t(n,Q),l=t(o,Q);Q(r)||re(152),Q(l)||re(154);const s=r.getParent();ne(s)||re(156);const i=s.getParent();st(i)||re(157);const c=l.getParents()[1];if(c!==i){if(i.isParentOf(l)){const e=c.getParent();null==e&&re(159),this.set(this.tableKey,l.getKey(),e.getKey())}else{const e=i.getParent();null==e&&re(158),this.set(this.tableKey,e.getKey(),l.getKey())}return this.getNodes()}const[a,d,u]=xe(i,r,l);let h=Math.min(d.startColumn,u.startColumn),g=Math.min(d.startRow,u.startRow),f=Math.max(d.startColumn+d.cell.__colSpan-1,u.startColumn+u.cell.__colSpan-1),m=Math.max(d.startRow+d.cell.__rowSpan-1,u.startRow+u.cell.__rowSpan-1),p=h,S=g,_=h,w=g;function b(e){const{cell:t,startColumn:n,startRow:o}=e;h=Math.min(h,n),g=Math.min(g,o),f=Math.max(f,n+t.__colSpan-1),m=Math.max(m,o+t.__rowSpan-1)}for(;h<p||g<S||f>_||m>w;){if(h<p){const e=w-S,t=p-1;for(let n=0;n<=e;n++)b(a[S+n][t]);p=t}if(g<S){const e=_-p,t=S-1;for(let n=0;n<=e;n++)b(a[t][p+n]);S=t}if(f>_){const e=w-S,t=_+1;for(let n=0;n<=e;n++)b(a[S+n][t]);_=t}if(m>w){const e=_-p,t=w+1;for(let n=0;n<=e;n++)b(a[t][p+n]);w=t}}const y=[i];let N=null;for(let e=g;e<=m;e++)for(let t=h;t<=f;t++){const{cell:n}=a[e][t],o=n.getParent();ne(o)||re(160),o!==N&&y.push(o),y.push(n,...Fe(n)),N=o}return C()||(this._cachedNodes=y),y}getTextContent(){const e=this.getNodes();let t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}}function Re(e){return e instanceof Me}function Ke(){const e=f("root",0,"element"),t=f("root",0,"element");return new Me("root",e,t)}function Fe(e){const t=[],n=[e];for(;n.length>0;){const o=n.pop();void 0===o&&re(112),s(o)&&n.unshift(...o.getChildren()),o!==e&&t.push(o)}return t}class ke{constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.trackTable(),this.isSelecting=!1}getTable(){return this.table}removeListeners(){Array.from(this.listenersToRemove).forEach((e=>e()))}trackTable(){const e=new MutationObserver((e=>{this.editor.update((()=>{let t=!1;for(let n=0;n<e.length;n++){const o=e[n].target.nodeName;if("TABLE"===o||"TBODY"===o||"THEAD"===o||"TR"===o){t=!0;break}}if(!t)return;const n=this.editor.getElementByKey(this.tableNodeKey);if(!n)throw new Error("Expected to find TableElement in DOM");this.table=Le(n)}))}));this.editor.update((()=>{const t=this.editor.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");this.table=Le(t),e.observe(t,{childList:!0,subtree:!0})}))}clearHighlight(){const e=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.enableHighlightStyle(),e.update((()=>{if(!st(p(this.tableNodeKey)))throw new Error("Expected TableNode.");const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");const n=Le(t);Ie(e,n,null),S(null),e.dispatchCommand(_,void 0)}))}enableHighlightStyle(){const e=this.editor;e.update((()=>{const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");n(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}))}disableHighlightStyle(){const t=this.editor;t.update((()=>{const n=t.getElementByKey(this.tableNodeKey);if(!n)throw new Error("Expected to find TableElement in DOM");e(n,t._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}))}updateTableTableSelection(e){if(null!==e&&e.tableKey===this.tableNodeKey){const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.disableHighlightStyle(),Ie(t,this.table,this.tableSelection)}else null==e?this.clearHighlight():(this.tableNodeKey=e.tableKey,this.updateTableTableSelection(e))}setFocusCellForSelection(e,t=!1){const n=this.editor;n.update((()=>{const o=p(this.tableNodeKey);if(!st(o))throw new Error("Expected TableNode.");if(!n.getElementByKey(this.tableNodeKey))throw new Error("Expected to find TableElement in DOM");const r=e.x,l=e.y;if(this.focusCell=e,null!==this.anchorCell){const e=Pe(n._window);e&&e.setBaseAndExtent(this.anchorCell.elem,0,this.focusCell.elem,0)}if(this.isHighlightingCells||this.anchorX===r&&this.anchorY===l&&!t){if(r===this.focusX&&l===this.focusY)return}else this.isHighlightingCells=!0,this.disableHighlightStyle();if(this.focusX=r,this.focusY=l,this.isHighlightingCells){const t=w(e.elem);if(null!=this.tableSelection&&null!=this.anchorCellNodeKey&&Q(t)&&o.is(Qe(t))){const e=t.getKey();this.tableSelection=this.tableSelection.clone()||Ke(),this.focusCellNodeKey=e,this.tableSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey),S(this.tableSelection),n.dispatchCommand(_,void 0),Ie(n,this.table,this.tableSelection)}}}))}setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.editor.update((()=>{const t=w(e.elem);if(Q(t)){const e=t.getKey();this.tableSelection=null!=this.tableSelection?this.tableSelection.clone():Ke(),this.anchorCellNodeKey=e}}))}formatCells(e){this.editor.update((()=>{const t=h();Re(t)||re(11);const n=b(),o=n.anchor,r=n.focus;t.getNodes().forEach((t=>{Q(t)&&0!==t.getTextContentSize()&&(o.set(t.getKey(),0,"element"),r.set(t.getKey(),t.getChildrenSize(),"element"),n.formatText(e))})),S(t),this.editor.dispatchCommand(_,void 0)}))}clearText(){const e=this.editor;e.update((()=>{const t=p(this.tableNodeKey);if(!st(t))throw new Error("Expected TableNode.");const n=h();Re(n)||re(11);const o=n.getNodes().filter(Q);if(o.length!==this.table.columns*this.table.rows)o.forEach((e=>{if(s(e)){const t=l(),n=u();t.append(n),e.append(t),e.getChildren().forEach((e=>{e!==t&&e.remove()}))}})),Ie(e,this.table,null),S(null),e.dispatchCommand(_,void 0);else{t.selectPrevious(),t.remove();y().selectStart()}}))}}const Ae="__lexicalTableSelection",Pe=e=>le?(e||window).getSelection():null;function He(e,n,o,r){const i=o.getRootElement();if(null===i)throw new Error("No root element.");const a=new ke(o,e.getKey()),d=o._window||window;!function(e,t){e[Ae]=t}(n,a);const f=()=>{const e=()=>{a.isSelecting=!1,d.removeEventListener("mouseup",e),d.removeEventListener("mousemove",t)},t=n=>{setTimeout((()=>{if(1&~n.buttons&&a.isSelecting)return a.isSelecting=!1,d.removeEventListener("mouseup",e),void d.removeEventListener("mousemove",t);const o=Be(n.target);null===o||a.anchorX===o.x&&a.anchorY===o.y||(n.preventDefault(),a.setFocusCellForSelection(o))}),0)};return{onMouseMove:t,onMouseUp:e}};n.addEventListener("mousedown",(e=>{setTimeout((()=>{if(0!==e.button)return;if(!d)return;const t=Be(e.target);null!==t&&(Ze(e),a.setAnchorCellForSelection(t));const{onMouseUp:n,onMouseMove:o}=f();a.isSelecting=!0,d.addEventListener("mouseup",n),d.addEventListener("mousemove",o)}),0)}));const m=e=>{0===e.button&&o.update((()=>{const t=h(),n=e.target;Re(t)&&t.tableKey===a.tableNodeKey&&i.contains(n)&&a.clearHighlight()}))};d.addEventListener("mousedown",m),a.listenersToRemove.add((()=>d.removeEventListener("mousedown",m))),a.listenersToRemove.add(o.registerCommand(N,(t=>Ve(o,t,"down",e,a)),T)),a.listenersToRemove.add(o.registerCommand(x,(t=>Ve(o,t,"up",e,a)),T)),a.listenersToRemove.add(o.registerCommand(v,(t=>Ve(o,t,"backward",e,a)),T)),a.listenersToRemove.add(o.registerCommand(E,(t=>Ve(o,t,"forward",e,a)),T)),a.listenersToRemove.add(o.registerCommand(O,(e=>{const n=h();if(Re(n)){const o=t(n.focus.getNode(),Q);if(Q(o))return Ze(e),o.selectEnd(),!0}return!1}),T));[M,R,K].forEach((n=>{a.listenersToRemove.add(o.registerCommand(n,(n=>()=>{const o=h();if(!Xe(o,e))return!1;if(Re(o))return a.clearText(),!0;if(g(o)){const r=t(o.anchor.getNode(),(e=>Q(e)));if(!Q(r))return!1;const l=o.anchor.getNode(),i=o.focus.getNode(),c=e.isParentOf(l),d=e.isParentOf(i);if(c&&!d||d&&!c)return a.clearText(),!0;const u=t(o.anchor.getNode(),(e=>s(e))),h=u&&t(u,(e=>s(e)&&Q(e.getParent())));if(!s(h)||!s(u))return!1;if(n===R&&null===h.getPreviousSibling())return!0}return!1})(n),F))}));const p=n=>{const o=h();if(!Xe(o,e)){const e=o?o.getNodes():null;if(e){const t=e.find((e=>st(e)&&e.getKey()===a.tableNodeKey));if(st(t)){const e=t.getParent();if(!e)return!1;const n=t.getNextSibling()||t.getPreviousSibling();t.remove(),n?n.selectStart():e.selectStart()}}return!0}if(Re(o))return n.preventDefault(),n.stopPropagation(),a.clearText(),!0;if(g(o)){const e=t(o.anchor.getNode(),(e=>Q(e)));if(!Q(e))return!1}return!1};function C(t){const n=e.getCordsFromCellNode(t,a.table);return e.getDOMCellFromCordsOrThrow(n.x,n.y,a.table)}return a.listenersToRemove.add(o.registerCommand(k,p,F)),a.listenersToRemove.add(o.registerCommand(A,p,F)),a.listenersToRemove.add(o.registerCommand(P,(n=>{const o=h();if(!Xe(o,e))return!1;if(Re(o))return a.formatCells(n),!0;if(g(o)){const e=t(o.anchor.getNode(),(e=>Q(e)));if(!Q(e))return!1}return!1}),F)),a.listenersToRemove.add(o.registerCommand(H,(t=>{const n=h();if(!Re(n)||!Xe(n,e))return!1;const o=n.anchor.getNode(),r=n.focus.getNode();if(!Q(o)||!Q(r))return!1;const[l,i,c]=xe(e,o,r),a=Math.max(i.startRow,c.startRow),d=Math.max(i.startColumn,c.startColumn),u=Math.min(i.startRow,c.startRow),g=Math.min(i.startColumn,c.startColumn);for(let e=u;e<=a;e++)for(let n=g;n<=d;n++){const o=l[e][n].cell;o.setFormat(t);const r=o.getChildren();for(let e=0;e<r.length;e++){const n=r[e];s(n)&&!n.isInline()&&n.setFormat(t)}}return!0}),F)),a.listenersToRemove.add(o.registerCommand(D,(n=>{const r=h();if(!Xe(r,e))return!1;if(Re(r))return a.clearHighlight(),!1;if(g(r)){const l=t(r.anchor.getNode(),(e=>Q(e)));if(!Q(l))return!1;if("string"==typeof n){const t=tt(o,r,e);if(t)return et(t,e,[u(n)]),!0}}return!1}),F)),r&&a.listenersToRemove.add(o.registerCommand(B,(t=>{const n=h();if(!g(n)||!n.isCollapsed()||!Xe(n,e))return!1;const o=Ge(n.anchor.getNode());if(null===o)return!1;Ze(t);const r=e.getCordsFromCellNode(o,a.table);return ze(a,e,r.x,r.y,t.shiftKey?"backward":"forward"),!0}),F)),a.listenersToRemove.add(o.registerCommand(L,(t=>e.isSelected()),T)),a.listenersToRemove.add(o.registerCommand(I,(e=>{const{nodes:n,selection:o}=e,r=o.getStartEndPoints(),s=Re(o),i=g(o)&&null!==t(o.anchor.getNode(),(e=>Q(e)))&&null!==t(o.focus.getNode(),(e=>Q(e)))||s;if(1!==n.length||!st(n[0])||!i||null===r)return!1;const[a]=r,d=n[0],u=d.getChildren(),h=d.getFirstChildOrThrow().getChildrenSize(),f=d.getChildrenSize(),m=t(a.getNode(),(e=>Q(e))),p=m&&t(m,(e=>ne(e))),C=p&&t(p,(e=>st(e)));if(!Q(m)||!ne(p)||!st(C))return!1;const _=p.getIndexWithinParent(),w=Math.min(C.getChildrenSize()-1,_+f-1),b=m.getIndexWithinParent(),y=Math.min(p.getChildrenSize()-1,b+h-1),N=Math.min(b,y),T=Math.min(_,w),x=Math.max(b,y),v=Math.max(_,w),E=C.getChildren();let O,M,R=0;for(let e=T;e<=v;e++){const t=E[e];if(!ne(t))return!1;const n=u[R];if(!ne(n))return!1;const o=t.getChildren(),r=n.getChildren();let s=0;for(let t=N;t<=x;t++){const n=o[t];if(!Q(n))return!1;const i=r[s];if(!Q(i))return!1;e===T&&t===N?O=n.getKey():e===v&&t===x&&(M=n.getKey());const a=n.getChildren();i.getChildren().forEach((e=>{if(c(e)){l().append(e),n.append(e)}else n.append(e)})),a.forEach((e=>e.remove())),s++}R++}if(O&&M){const e=Ke();e.set(n[0].getKey(),O,M),S(e)}return!0}),F)),a.listenersToRemove.add(o.registerCommand(_,(()=>{const t=h(),n=W();if(g(t)){const{anchor:n,focus:r}=t,l=n.getNode(),s=r.getNode(),i=Ge(l),c=Ge(s),u=!(!i||!e.is(Qe(i))),h=!(!c||!e.is(Qe(c))),g=u!==h,m=u&&h,p=t.isBackward();if(g){const n=t.clone();if(h){const[t]=xe(e,c,c),o=t[0][0].cell,r=t[t.length-1].at(-1).cell;n.focus.set(p?o.getKey():r.getKey(),p?o.getChildrenSize():r.getChildrenSize(),"element")}else n.anchor.set(e.getParentOrThrow().getKey(),p?e.getIndexWithinParent()+1:e.getIndexWithinParent(),"element");S(n),Ue(o,a)}else m&&(i.is(c)||(a.setAnchorCellForSelection(C(i)),a.setFocusCellForSelection(C(c),!0),a.isSelecting||setTimeout((()=>{const{onMouseUp:e,onMouseMove:t}=f();a.isSelecting=!0,d.addEventListener("mouseup",e),d.addEventListener("mousemove",t)}),0)))}else if(t&&Re(t)&&t.is(n)&&t.tableKey===e.getKey()){const n=Pe(o._window);if(n&&n.anchorNode&&n.focusNode){const r=w(n.focusNode),l=r&&!e.is(Qe(r)),s=w(n.anchorNode),i=s&&e.is(Qe(s));if(l&&i&&n.rangeCount>0){const r=U(n,o);r&&(r.anchor.set(e.getKey(),t.isBackward()?e.getChildrenSize():0,"element"),n.removeAllRanges(),S(r))}}}return t&&!t.is(n)&&(Re(t)||Re(n))&&a.tableSelection&&!a.tableSelection.is(n)?(Re(t)&&t.tableKey===a.tableNodeKey?a.updateTableTableSelection(t):!Re(t)&&Re(n)&&n.tableKey===a.tableNodeKey&&a.updateTableTableSelection(null),!1):(a.hasHijackedSelectionStyles&&!e.isSelected()?function(e,t){t.enableHighlightStyle(),We(t.table,(t=>{const n=t.elem;t.highlighted=!1,qe(e,t),n.getAttribute("style")||n.removeAttribute("style")}))}(o,a):!a.hasHijackedSelectionStyles&&e.isSelected()&&Ue(o,a),!1)}),F)),a.listenersToRemove.add(o.registerCommand(z,(()=>{const t=h();if(!g(t)||!t.isCollapsed()||!Xe(t,e))return!1;const n=tt(o,t,e);return!!n&&(et(n,e),!0)}),F)),a}function De(e){return e[Ae]}function Be(e){let t=e;for(;null!=t;){const e=t.nodeName;if("TD"===e||"TH"===e){const e=t._cell;return void 0===e?null:e}t=t.parentNode}return null}function Le(e){const t=[],n={columns:0,domRows:t,rows:0};let o=e.firstChild,r=0,l=0;for(t.length=0;null!=o;){const e=o.nodeName;if("TD"===e||"TH"===e){const e={elem:o,hasBackgroundColor:""!==o.style.backgroundColor,highlighted:!1,x:r,y:l};o._cell=e;let n=t[l];void 0===n&&(n=t[l]=[]),n[r]=e}else{const e=o.firstChild;if(null!=e){o=e;continue}}const n=o.nextSibling;if(null!=n){r++,o=n;continue}const s=o.parentNode;if(null!=s){const e=s.nextSibling;if(null==e)break;l++,r=0,o=e}}return n.columns=r+1,n.rows=l+1,n}function Ie(e,t,n){const o=new Set(n?n.getNodes():[]);We(t,((t,n)=>{const r=t.elem;o.has(n)?(t.highlighted=!0,je(e,t)):(t.highlighted=!1,qe(e,t),r.getAttribute("style")||r.removeAttribute("style"))}))}function We(e,t){const{domRows:n}=e;for(let e=0;e<n.length;e++){const o=n[e];if(o)for(let n=0;n<o.length;n++){const r=o[n];if(!r)continue;const l=w(r.elem);null!==l&&t(r,l,{x:n,y:e})}}}function Ue(e,t){t.disableHighlightStyle(),We(t.table,(t=>{t.highlighted=!0,je(e,t)}))}const ze=(e,t,n,o,r)=>{const l="forward"===r;switch(r){case"backward":case"forward":return n!==(l?e.table.columns-1:0)?Je(t.getCellNodeFromCordsOrThrow(n+(l?1:-1),o,e.table),l):o!==(l?e.table.rows-1:0)?Je(t.getCellNodeFromCordsOrThrow(l?0:e.table.columns-1,o+(l?1:-1),e.table),l):l?t.selectNext():t.selectPrevious(),!0;case"up":return 0!==o?Je(t.getCellNodeFromCordsOrThrow(n,o-1,e.table),!1):t.selectPrevious(),!0;case"down":return o!==e.table.rows-1?Je(t.getCellNodeFromCordsOrThrow(n,o+1,e.table),!0):t.selectNext(),!0;default:return!1}},Ye=(e,t,n,o,r)=>{const l="forward"===r;switch(r){case"backward":case"forward":return n!==(l?e.table.columns-1:0)&&e.setFocusCellForSelection(t.getDOMCellFromCordsOrThrow(n+(l?1:-1),o,e.table)),!0;case"up":return 0!==o&&(e.setFocusCellForSelection(t.getDOMCellFromCordsOrThrow(n,o-1,e.table)),!0);case"down":return o!==e.table.rows-1&&(e.setFocusCellForSelection(t.getDOMCellFromCordsOrThrow(n,o+1,e.table)),!0);default:return!1}};function Xe(e,t){if(g(e)||Re(e)){const n=t.isParentOf(e.anchor.getNode()),o=t.isParentOf(e.focus.getNode());return n&&o}return!1}function Je(e,t){t?e.selectStart():e.selectEnd()}const $e="172,206,247";function je(e,t){const n=t.elem,o=w(n);Q(o)||re(131);null===o.getBackgroundColor()?n.style.setProperty("background-color",`rgb(${$e})`):n.style.setProperty("background-image",`linear-gradient(to right, rgba(${$e},0.85), rgba(${$e},0.85))`),n.style.setProperty("caret-color","transparent")}function qe(e,t){const n=t.elem,o=w(n);Q(o)||re(131);null===o.getBackgroundColor()&&n.style.removeProperty("background-color"),n.style.removeProperty("background-image"),n.style.removeProperty("caret-color")}function Ge(e){const n=t(e,Q);return Q(n)?n:null}function Qe(e){const n=t(e,st);return st(n)?n:null}function Ve(e,n,o,r,l){if(("up"===o||"down"===o)&&function(e){const t=e.getRootElement();if(!t)return!1;return t.hasAttribute("aria-controls")&&"typeahead-menu"===t.getAttribute("aria-controls")}(e))return!1;const i=h();if(!Xe(i,r)){if(g(i)){if(i.isCollapsed()&&"backward"===o){const e=i.anchor.type,o=i.anchor.offset;if("element"!==e&&("text"!==e||0!==o))return!1;const r=i.anchor.getNode();if(!r)return!1;const l=t(r,(e=>s(e)&&!e.isInline()));if(!l)return!1;const c=l.getPreviousSibling();return!(!c||!st(c))&&(Ze(n),c.selectEnd(),!0)}if(n.shiftKey&&("up"===o||"down"===o)){const e=i.focus.getNode();if(Y(e)){const e=i.getNodes()[0];if(e){const n=t(e,Q);if(n&&r.isParentOf(n)){const e=r.getFirstDescendant(),t=r.getLastDescendant();if(!e||!t)return!1;const[n]=Ee(e),[o]=Ee(t),s=r.getCordsFromCellNode(n,l.table),i=r.getCordsFromCellNode(o,l.table),c=r.getDOMCellFromCordsOrThrow(s.x,s.y,l.table),a=r.getDOMCellFromCordsOrThrow(i.x,i.y,l.table);return l.setAnchorCellForSelection(c),l.setFocusCellForSelection(a,!0),!0}}return!1}{const n=t(e,(e=>s(e)&&!e.isInline()));if(!n)return!1;const r="down"===o?n.getNextSibling():n.getPreviousSibling();if(st(r)&&l.tableNodeKey===r.getKey()){const e=r.getFirstDescendant(),t=r.getLastDescendant();if(!e||!t)return!1;const[n]=Ee(e),[l]=Ee(t),s=i.clone();return s.focus.set(("up"===o?n:l).getKey(),"up"===o?0:l.getChildrenSize(),"element"),S(s),!0}}}}return!1}if(g(i)&&i.isCollapsed()){const{anchor:c,focus:a}=i,d=t(c.getNode(),Q),u=t(a.getNode(),Q);if(!Q(d)||!d.is(u))return!1;const h=Qe(d);if(h!==r&&null!=h){const t=e.getElementByKey(h.getKey());if(null!=t)return l.table=Le(t),Ve(e,n,o,h,l)}if("backward"===o||"forward"===o){const e=c.type,l=c.offset,a=c.getNode();if(!a)return!1;const d=i.getNodes();return(1!==d.length||!X(d[0]))&&(!!function(e,n,o,r){return function(e,t,n){return"element"===e&&("backward"===n?null===t.getPreviousSibling():null===t.getNextSibling())}(e,o,r)||function(e,n,o,r){const l=t(o,(e=>s(e)&&!e.isInline()));if(!l)return!1;const i="backward"===r?0===n:n===o.getTextContentSize();return"text"===e&&i&&("backward"===r?null===l.getPreviousSibling():null===l.getNextSibling())}(e,n,o,r)}(e,l,a,o)&&function(e,n,o,r){const l=t(n,Q);if(!Q(l))return!1;const[i,c]=xe(o,l,l);if(!function(e,t,n){const o=e[0][0],r=e[e.length-1][e[0].length-1],{startColumn:l,startRow:s}=t;return"backward"===n?l===o.startColumn&&s===o.startRow:l===r.startColumn&&s===r.startRow}(i,c,r))return!1;const a=function(e,n,o){const r=t(e,(e=>s(e)&&!e.isInline()));if(!r)return;const l="backward"===n?r.getPreviousSibling():r.getNextSibling();return l&&st(l)?l:"backward"===n?o.getPreviousSibling():o.getNextSibling()}(n,r,o);if(!a||st(a))return!1;Ze(e),"backward"===r?a.selectEnd():a.selectStart();return!0}(n,a,r,o))}const g=e.getElementByKey(d.__key),f=e.getElementByKey(c.key);if(null==f||null==g)return!1;let m;if("element"===c.type)m=f.getBoundingClientRect();else{const e=window.getSelection();if(null===e||0===e.rangeCount)return!1;m=e.getRangeAt(0).getBoundingClientRect()}const p="up"===o?d.getFirstChild():d.getLastChild();if(null==p)return!1;const C=e.getElementByKey(p.__key);if(null==C)return!1;const S=C.getBoundingClientRect();if("up"===o?S.top>m.top-m.height:m.bottom+m.height>S.bottom){Ze(n);const e=r.getCordsFromCellNode(d,l.table);if(!n.shiftKey)return ze(l,r,e.x,e.y,o);{const t=r.getDOMCellFromCordsOrThrow(e.x,e.y,l.table);l.setAnchorCellForSelection(t),l.setFocusCellForSelection(t,!0)}return!0}}else if(Re(i)){const{anchor:s,focus:c}=i,a=t(s.getNode(),Q),d=t(c.getNode(),Q),[u]=i.getNodes(),h=e.getElementByKey(u.getKey());if(!Q(a)||!Q(d)||!st(u)||null==h)return!1;l.updateTableTableSelection(i);const g=Le(h),f=r.getCordsFromCellNode(a,g),m=r.getDOMCellFromCordsOrThrow(f.x,f.y,g);if(l.setAnchorCellForSelection(m),Ze(n),n.shiftKey){const e=r.getCordsFromCellNode(d,g);return Ye(l,u,e.x,e.y,o)}return d.selectEnd(),!0}return!1}function Ze(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()}function et(e,t,n){const o=l();"first"===e?t.insertBefore(o):t.insertAfter(o),o.append(...n||[]),o.selectEnd()}function tt(e,n,o){const r=o.getParent();if(!r)return;const l=e.getElementByKey(r.getKey());if(!l)return;const s=window.getSelection();if(!s||s.anchorNode!==l)return;const i=t(n.anchor.getNode(),(e=>Q(e)));if(!i)return;const c=t(i,(e=>st(e)));if(!st(c)||!c.is(o))return;const[a,d]=xe(o,i,i),u=a[0][0],h=a[a.length-1][a[0].length-1],{startRow:g,startColumn:f}=d,m=g===u.startRow&&f===u.startColumn,p=g===h.startRow&&f===h.startColumn;return m?"first":p?"last":void 0}class nt extends r{static getType(){return"table"}static clone(e){return new nt(e.__key)}static importDOM(){return{table:e=>({conversion:rt,priority:1})}}static importJSON(e){return lt()}constructor(e){super(e)}exportJSON(){return{...super.exportJSON(),type:"table",version:1}}createDOM(t,n){const o=document.createElement("table");return e(o,t.theme.table),o}updateDOM(){return!1}exportDOM(e){return{...super.exportDOM(e),after:e=>{if(e){const t=e.cloneNode(),n=document.createElement("colgroup"),r=document.createElement("tbody");o(e)&&r.append(...e.children);const l=this.getFirstChildOrThrow();if(!ne(l))throw new Error("Expected to find row node.");const s=l.getChildrenSize();for(let e=0;e<s;e++){const e=document.createElement("col");n.append(e)}return t.replaceChildren(n,r),t}}}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:n,domRows:o}=t;for(let t=0;t<n;t++){const n=o[t];if(null==n)continue;const r=n.findIndex((t=>{if(!t)return;const{elem:n}=t;return w(n)===e}));if(-1!==r)return{x:r,y:t}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,n){const{domRows:o}=n,r=o[t];if(null==r)return null;const l=r[e];return null==l?null:l}getDOMCellFromCordsOrThrow(e,t,n){const o=this.getDOMCellFromCords(e,t,n);if(!o)throw new Error("Cell not found at cords.");return o}getCellNodeFromCords(e,t,n){const o=this.getDOMCellFromCords(e,t,n);if(null==o)return null;const r=w(o.elem);return Q(r)?r:null}getCellNodeFromCordsOrThrow(e,t,n){const o=this.getCellNodeFromCords(e,t,n);if(!o)throw new Error("Node at cords not TableCellNode.");return o}canSelectBefore(){return!0}canIndent(){return!1}}function ot(e,t){const n=e.getElementByKey(t.getKey());if(null==n)throw new Error("Table Element Not Found");return Le(n)}function rt(e){return{node:lt()}}function lt(){return a(new nt)}function st(e){return e instanceof nt}export{xe as $computeTableMap,ve as $computeTableMapSkipCellCheck,G as $createTableCellNode,lt as $createTableNode,se as $createTableNodeWithDimensions,te as $createTableRowNode,Ke as $createTableSelection,_e as $deleteTableColumn,be as $deleteTableColumn__EXPERIMENTAL,we as $deleteTableRow__EXPERIMENTAL,Ge as $findCellNode,Qe as $findTableNode,ot as $getElementForTableNode,Ee as $getNodeTriplet,ie as $getTableCellNodeFromLexicalNode,Oe as $getTableCellNodeRect,ue as $getTableColumnIndexFromTableCellNode,ae as $getTableNodeFromLexicalNodeOrThrow,de as $getTableRowIndexFromTableCellNode,ce as $getTableRowNodeFromTableCellNodeOrThrow,Ce as $insertTableColumn,Se as $insertTableColumn__EXPERIMENTAL,fe as $insertTableRow,pe as $insertTableRow__EXPERIMENTAL,Q as $isTableCellNode,st as $isTableNode,ne as $isTableRowNode,Re as $isTableSelection,ge as $removeTableRowAtIndex,Te as $unmergeCell,V as INSERT_TABLE_COMMAND,$ as TableCellHeaderStates,j as TableCellNode,nt as TableNode,ke as TableObserver,Z as TableRowNode,He as applyTableHandlers,Be as getDOMCellFromTarget,De as getTableObserverFromTableElement};
9
+ import{addClassNamesToElement as e,$findMatchingParent as t,removeClassNamesFromElement as n,isHTMLElement as o}from"@lexical/utils";import{ElementNode as r,$createParagraphNode as l,$isElementNode as s,$isLineBreakNode as i,$isTextNode as c,$applyNodeReplacement as a,createCommand as d,$createTextNode as u,$getSelection as h,$isRangeSelection as g,$createPoint as f,$normalizeSelection__EXPERIMENTAL as m,$getNodeByKey as p,isCurrentlyReadOnlyMode as C,$setSelection as S,SELECTION_CHANGE_COMMAND as _,$getNearestNodeFromDOMNode as w,$createRangeSelection as b,$getRoot as y,KEY_ARROW_DOWN_COMMAND as N,COMMAND_PRIORITY_HIGH as T,KEY_ARROW_UP_COMMAND as x,KEY_ARROW_LEFT_COMMAND as v,KEY_ARROW_RIGHT_COMMAND as E,KEY_ESCAPE_COMMAND as O,DELETE_WORD_COMMAND as M,DELETE_LINE_COMMAND as R,DELETE_CHARACTER_COMMAND as K,COMMAND_PRIORITY_CRITICAL as F,KEY_BACKSPACE_COMMAND as k,KEY_DELETE_COMMAND as A,FORMAT_TEXT_COMMAND as H,FORMAT_ELEMENT_COMMAND as P,CONTROLLED_TEXT_INSERTION_COMMAND as D,KEY_TAB_COMMAND as B,FOCUS_COMMAND as L,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND as I,$getPreviousSelection as W,$createRangeSelectionFromDom as U,INSERT_PARAGRAPH_COMMAND as z,$isRootOrShadowRoot as Y,$isDecoratorNode as X}from"lexical";const J=/^(\d+(?:\.\d+)?)px$/,$={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class j extends r{static getType(){return"tablecell"}static clone(e){const t=new j(e.__headerState,e.__colSpan,e.__width,e.__key);return t.__rowSpan=e.__rowSpan,t.__backgroundColor=e.__backgroundColor,t}static importDOM(){return{td:e=>({conversion:q,priority:0}),th:e=>({conversion:q,priority:0})}}static importJSON(e){const t=e.colSpan||1,n=e.rowSpan||1,o=G(e.headerState,t,e.width||void 0);return o.__rowSpan=n,o.__backgroundColor=e.backgroundColor||null,o}constructor(e=$.NO_STATUS,t=1,n,o){super(o),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=n,this.__backgroundColor=null}createDOM(t){const n=document.createElement(this.getTag());return this.__width&&(n.style.width=`${this.__width}px`),this.__colSpan>1&&(n.colSpan=this.__colSpan),this.__rowSpan>1&&(n.rowSpan=this.__rowSpan),null!==this.__backgroundColor&&(n.style.backgroundColor=this.__backgroundColor),e(n,t.theme.tableCell,this.hasHeader()&&t.theme.tableCellHeader),n}exportDOM(e){const{element:t}=super.exportDOM(e);if(t){const e=t;e.style.border="1px solid black",this.__colSpan>1&&(e.colSpan=this.__colSpan),this.__rowSpan>1&&(e.rowSpan=this.__rowSpan),e.style.width=`${this.getWidth()||75}px`,e.style.verticalAlign="top",e.style.textAlign="start";const n=this.getBackgroundColor();null!==n?e.style.backgroundColor=n:this.hasHeader()&&(e.style.backgroundColor="#f2f3f5")}return{element:t}}exportJSON(){return{...super.exportJSON(),backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,type:"tablecell",width:this.getWidth()}}getColSpan(){return this.__colSpan}setColSpan(e){return this.getWritable().__colSpan=e,this}getRowSpan(){return this.__rowSpan}setRowSpan(e){return this.getWritable().__rowSpan=e,this}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e){return this.getWritable().__headerState=e,this.__headerState}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){return this.getWritable().__width=e,this.__width}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){this.getWritable().__backgroundColor=e}toggleHeaderStyle(e){const t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==$.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function q(e){const t=e,n=e.nodeName.toLowerCase();let o;J.test(t.style.width)&&(o=parseFloat(t.style.width));const r=G("th"===n?$.ROW:$.NO_STATUS,t.colSpan,o);r.__rowSpan=t.rowSpan;const a=t.style.backgroundColor;""!==a&&(r.__backgroundColor=a);const d=t.style,u=d.textDecoration.split(" "),h="700"===d.fontWeight||"bold"===d.fontWeight,g=u.includes("line-through"),f="italic"===d.fontStyle,m=u.includes("underline");return{after:e=>(0===e.length&&e.push(l()),e),forChild:(e,t)=>{if(Q(t)&&!s(e)){const t=l();return i(e)&&"\n"===e.getTextContent()?null:(c(e)&&(h&&e.toggleFormat("bold"),g&&e.toggleFormat("strikethrough"),f&&e.toggleFormat("italic"),m&&e.toggleFormat("underline")),t.append(e),t)}return e},node:r}}function G(e,t=1,n){return a(new j(e,t,n))}function Q(e){return e instanceof j}const V=d("INSERT_TABLE_COMMAND");class Z extends r{static getType(){return"tablerow"}static clone(e){return new Z(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:ee,priority:0})}}static importJSON(e){return te(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){return{...super.exportJSON(),...this.getHeight()&&{height:this.getHeight()},type:"tablerow",version:1}}createDOM(t){const n=document.createElement("tr");return this.__height&&(n.style.height=`${this.__height}px`),e(n,t.theme.tableRow),n}isShadowRoot(){return!0}setHeight(e){return this.getWritable().__height=e,this.__height}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function ee(e){const t=e;let n;return J.test(t.style.height)&&(n=parseFloat(t.style.height)),{node:te(n)}}function te(e){return a(new Z(e))}function ne(e){return e instanceof Z}function oe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var re=oe((function(e){const t=new URLSearchParams;t.append("code",e);for(let e=1;e<arguments.length;e++)t.append("v",arguments[e]);throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));const le="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function se(e,t,n=!0){const o=lt();for(let r=0;r<e;r++){const e=te();for(let o=0;o<t;o++){let t=$.NO_STATUS;"object"==typeof n?(0===r&&n.rows&&(t|=$.ROW),0===o&&n.columns&&(t|=$.COLUMN)):n&&(0===r&&(t|=$.ROW),0===o&&(t|=$.COLUMN));const s=G(t),i=l();i.append(u()),s.append(i),e.append(s)}o.append(e)}return o}function ie(e){const n=t(e,(e=>Q(e)));return Q(n)?n:null}function ce(e){const n=t(e,(e=>ne(e)));if(ne(n))return n;throw new Error("Expected table cell to be inside of table row.")}function ae(e){const n=t(e,(e=>st(e)));if(st(n))return n;throw new Error("Expected table cell to be inside of table.")}function de(e){const t=ce(e);return ae(t).getChildren().findIndex((e=>e.is(t)))}function ue(e){return ce(e).getChildren().findIndex((t=>t.is(e)))}function he(e,t){const n=ae(e),{x:o,y:r}=n.getCordsFromCellNode(e,t);return{above:n.getCellNodeFromCords(o,r-1,t),below:n.getCellNodeFromCords(o,r+1,t),left:n.getCellNodeFromCords(o-1,r,t),right:n.getCellNodeFromCords(o+1,r,t)}}function ge(e,t){const n=e.getChildren();if(t>=n.length||t<0)throw new Error("Expected table cell to be inside of table row.");return n[t].remove(),e}function fe(e,t,n=!0,o,r){const s=e.getChildren();if(t>=s.length||t<0)throw new Error("Table row target index out of range");const i=s[t];if(!ne(i))throw new Error("Row before insertion index does not exist.");for(let e=0;e<o;e++){const e=i.getChildren(),t=e.length,o=te();for(let n=0;n<t;n++){const t=e[n];Q(t)||re(12);const{above:s,below:i}=he(t,r);let c=$.NO_STATUS;const a=s&&s.getWidth()||i&&i.getWidth()||void 0;(s&&s.hasHeaderState($.COLUMN)||i&&i.hasHeaderState($.COLUMN))&&(c|=$.COLUMN);const d=G(c,1,a);d.append(l()),o.append(d)}n?i.insertAfter(o):i.insertBefore(o)}return e}const me=(e,t)=>e===$.BOTH||e===t?t:$.NO_STATUS;function pe(e=!0){const t=h();g(t)||Re(t)||re(188);const n=t.focus.getNode(),[o,,r]=Ee(n),[s,i]=xe(r,o,o),c=s[0].length,{startRow:a}=i;if(e){const e=a+o.__rowSpan-1,t=s[e],n=te();for(let o=0;o<c;o++){const{cell:r,startRow:s}=t[o];if(s+r.__rowSpan-1<=e){const e=t[o].cell.__headerState,r=me(e,$.COLUMN);n.append(G(r).append(l()))}else r.setRowSpan(r.__rowSpan+1)}const i=r.getChildAtIndex(e);ne(i)||re(145),i.insertAfter(n)}else{const e=s[a],t=te();for(let n=0;n<c;n++){const{cell:o,startRow:r}=e[n];if(r===a){const o=e[n].cell.__headerState,r=me(o,$.COLUMN);t.append(G(r).append(l()))}else o.setRowSpan(o.__rowSpan+1)}const n=r.getChildAtIndex(a);ne(n)||re(145),n.insertBefore(t)}}function Ce(e,t,n=!0,o,r){const s=e.getChildren(),i=[];for(let e=0;e<s.length;e++){const n=s[e];if(ne(n))for(let e=0;e<o;e++){const e=n.getChildren();if(t>=e.length||t<0)throw new Error("Table column target index out of range");const o=e[t];Q(o)||re(12);const{left:s,right:c}=he(o,r);let a=$.NO_STATUS;(s&&s.hasHeaderState($.ROW)||c&&c.hasHeaderState($.ROW))&&(a|=$.ROW);const d=G(a);d.append(l()),i.push({newTableCell:d,targetCell:o})}}return i.forEach((({newTableCell:e,targetCell:t})=>{n?t.insertAfter(e):t.insertBefore(e)})),e}function Se(e=!0){const t=h();g(t)||Re(t)||re(188);const n=t.anchor.getNode(),o=t.focus.getNode(),[r]=Ee(n),[s,,i]=Ee(o),[c,a,d]=xe(i,s,r),u=c.length,f=e?Math.max(a.startColumn,d.startColumn):Math.min(a.startColumn,d.startColumn),m=e?f+s.__colSpan-1:f-1,p=i.getFirstChild();ne(p)||re(120);let C=null;function S(e=$.NO_STATUS){const t=G(e).append(l());return null===C&&(C=t),t}let _=p;e:for(let e=0;e<u;e++){if(0!==e){const e=_.getNextSibling();ne(e)||re(121),_=e}const t=c[e],n=t[m<0?0:m].cell.__headerState,o=me(n,$.ROW);if(m<0){Ne(_,S(o));continue}const{cell:r,startColumn:l,startRow:s}=t[m];if(l+r.__colSpan-1<=m){let n=r,l=s,i=m;for(;l!==e&&n.__rowSpan>1;){if(i-=r.__colSpan,!(i>=0)){_.append(S(o));continue e}{const{cell:e,startRow:o}=t[i];n=e,l=o}}n.insertAfter(S(o))}else r.setColSpan(r.__colSpan+1)}null!==C&&ye(C)}function _e(e,t){const n=e.getChildren();for(let e=0;e<n.length;e++){const o=n[e];if(ne(o)){const e=o.getChildren();if(t>=e.length||t<0)throw new Error("Table column target index out of range");e[t].remove()}}return e}function we(){const e=h();g(e)||Re(e)||re(188);const t=e.anchor.getNode(),n=e.focus.getNode(),[o,,r]=Ee(t),[l]=Ee(n),[s,i,c]=xe(r,o,l),{startRow:a}=i,{startRow:d}=c,u=d+l.__rowSpan-1;if(s.length===u-a+1)return void r.remove();const f=s[0].length,m=s[u+1],p=r.getChildAtIndex(u+1);for(let e=u;e>=a;e--){for(let t=f-1;t>=0;t--){const{cell:n,startRow:o,startColumn:r}=s[e][t];if(r===t&&(e===a&&o<a&&n.setRowSpan(n.__rowSpan-(o-a)),o>=a&&o+n.__rowSpan-1>u))if(n.setRowSpan(n.__rowSpan-(u-o+1)),null===p&&re(122),0===t)Ne(p,n);else{const{cell:e}=m[t-1];e.insertAfter(n)}}const t=r.getChildAtIndex(e);ne(t)||re(123,String(e)),t.remove()}if(void 0!==m){const{cell:e}=m[0];ye(e)}else{const e=s[a-1],{cell:t}=e[0];ye(t)}}function be(){const e=h();g(e)||Re(e)||re(188);const t=e.anchor.getNode(),n=e.focus.getNode(),[o,,r]=Ee(t),[l]=Ee(n),[s,i,c]=xe(r,o,l),{startColumn:a}=i,{startRow:d,startColumn:u}=c,f=Math.min(a,u),m=Math.max(a+o.__colSpan-1,u+l.__colSpan-1),p=m-f+1;if(s[0].length===m-f+1)return r.selectPrevious(),void r.remove();const C=s.length;for(let e=0;e<C;e++)for(let t=f;t<=m;t++){const{cell:n,startColumn:o}=s[e][t];if(o<f){if(t===f){const e=f-o;n.setColSpan(n.__colSpan-Math.min(p,n.__colSpan-e))}}else if(o+n.__colSpan-1>m){if(t===m){const e=m-o+1;n.setColSpan(n.__colSpan-e)}}else n.remove()}const S=s[d],_=a>u?S[a+o.__colSpan]:S[u+l.__colSpan];if(void 0!==_){const{cell:e}=_;ye(e)}else{const e=u<a?S[u-1]:S[a-1],{cell:t}=e;ye(t)}}function ye(e){const t=e.getFirstDescendant();null==t?e.selectStart():t.getParentOrThrow().selectStart()}function Ne(e,t){const n=e.getFirstChild();null!==n?n.insertBefore(t):e.append(t)}function Te(){const e=h();g(e)||Re(e)||re(188);const t=e.anchor.getNode(),[n,o,r]=Ee(t),l=n.__colSpan,s=n.__rowSpan;if(l>1){for(let e=1;e<l;e++)n.insertAfter(G($.NO_STATUS));n.setColSpan(1)}if(s>1){const[e,t]=xe(r,n,n),{startColumn:i,startRow:c}=t;let a;for(let t=1;t<s;t++){const n=c+t,r=e[n];a=(a||o).getNextSibling(),ne(a)||re(125);let s=null;for(let e=0;e<i;e++){const t=r[e],o=t.cell;t.startRow===n&&(s=o),o.__colSpan>1&&(e+=o.__colSpan-1)}if(null===s)for(let e=0;e<l;e++)Ne(a,G($.NO_STATUS));else for(let e=0;e<l;e++)s.insertAfter(G($.NO_STATUS))}n.setRowSpan(1)}}function xe(e,t,n){const[o,r,l]=ve(e,t,n);return null===r&&re(110),null===l&&re(111),[o,r,l]}function ve(e,t,n){const o=[];let r=null,l=null;function s(e,s,i){const c={cell:i,startColumn:s,startRow:e},a=i.__rowSpan,d=i.__colSpan;for(let t=0;t<a;t++){void 0===o[e+t]&&(o[e+t]=[]);for(let n=0;n<d;n++)o[e+t][s+n]=c}null!==t&&t.is(i)&&(r=c),null!==n&&n.is(i)&&(l=c)}function i(e,t){return void 0===o[e]||void 0===o[e][t]}const c=e.getChildren();for(let e=0;e<c.length;e++){const t=c[e];ne(t)||re(146);const n=t.getChildren();let o=0;for(const t of n){for(Q(t)||re(147);!i(e,o);)o++;s(e,o,t),o+=t.__colSpan}}return[o,r,l]}function Ee(e){let n;if(e instanceof j)n=e;else if("__type"in e){const o=t(e,Q);Q(o)||re(148),n=o}else{const o=t(e.getNode(),Q);Q(o)||re(148),n=o}const o=n.getParent();ne(o)||re(149);const r=o.getParent();return st(r)||re(150),[n,o,r]}function Oe(e){const[t,,n]=Ee(e),o=n.getChildren(),r=o.length,l=o[0].getChildren().length,s=new Array(r);for(let e=0;e<r;e++)s[e]=new Array(l);for(let e=0;e<r;e++){const n=o[e].getChildren();let r=0;for(let o=0;o<n.length;o++){for(;s[e][r];)r++;const l=n[o],i=l.__rowSpan||1,c=l.__colSpan||1;for(let t=0;t<i;t++)for(let n=0;n<c;n++)s[e+t][r+n]=l;if(t===l)return{colSpan:c,columnIndex:r,rowIndex:e,rowSpan:i};r+=c}}return null}class Me{constructor(e,t,n){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!Re(e)&&(this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus))}set(e,t,n){this.dirty=!0,this.tableKey=e,this.anchor.key=t,this.focus.key=n,this._cachedNodes=null}clone(){return new Me(this.tableKey,this.anchor,this.focus)}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.focus.getNode();s(t)||re(151);m(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const e=p(this.anchor.key);Q(e)||re(152);const t=Oe(e);null===t&&re(153);const n=p(this.focus.key);Q(n)||re(154);const o=Oe(n);null===o&&re(155);const r=Math.min(t.columnIndex,o.columnIndex),l=Math.max(t.columnIndex,o.columnIndex),s=Math.min(t.rowIndex,o.rowIndex),i=Math.max(t.rowIndex,o.rowIndex);return{fromX:Math.min(r,l),fromY:Math.min(s,i),toX:Math.max(r,l),toY:Math.max(s,i)}}getNodes(){const e=this._cachedNodes;if(null!==e)return e;const n=this.anchor.getNode(),o=this.focus.getNode(),r=t(n,Q),l=t(o,Q);Q(r)||re(152),Q(l)||re(154);const s=r.getParent();ne(s)||re(156);const i=s.getParent();st(i)||re(157);const c=l.getParents()[1];if(c!==i){if(i.isParentOf(l)){const e=c.getParent();null==e&&re(159),this.set(this.tableKey,l.getKey(),e.getKey())}else{const e=i.getParent();null==e&&re(158),this.set(this.tableKey,e.getKey(),l.getKey())}return this.getNodes()}const[a,d,u]=xe(i,r,l);let h=Math.min(d.startColumn,u.startColumn),g=Math.min(d.startRow,u.startRow),f=Math.max(d.startColumn+d.cell.__colSpan-1,u.startColumn+u.cell.__colSpan-1),m=Math.max(d.startRow+d.cell.__rowSpan-1,u.startRow+u.cell.__rowSpan-1),p=h,S=g,_=h,w=g;function b(e){const{cell:t,startColumn:n,startRow:o}=e;h=Math.min(h,n),g=Math.min(g,o),f=Math.max(f,n+t.__colSpan-1),m=Math.max(m,o+t.__rowSpan-1)}for(;h<p||g<S||f>_||m>w;){if(h<p){const e=w-S,t=p-1;for(let n=0;n<=e;n++)b(a[S+n][t]);p=t}if(g<S){const e=_-p,t=S-1;for(let n=0;n<=e;n++)b(a[t][p+n]);S=t}if(f>_){const e=w-S,t=_+1;for(let n=0;n<=e;n++)b(a[S+n][t]);_=t}if(m>w){const e=_-p,t=w+1;for(let n=0;n<=e;n++)b(a[t][p+n]);w=t}}const y=[i];let N=null;for(let e=g;e<=m;e++)for(let t=h;t<=f;t++){const{cell:n}=a[e][t],o=n.getParent();ne(o)||re(160),o!==N&&y.push(o),y.push(n,...Fe(n)),N=o}return C()||(this._cachedNodes=y),y}getTextContent(){const e=this.getNodes();let t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}}function Re(e){return e instanceof Me}function Ke(){const e=f("root",0,"element"),t=f("root",0,"element");return new Me("root",e,t)}function Fe(e){const t=[],n=[e];for(;n.length>0;){const o=n.pop();void 0===o&&re(112),s(o)&&n.unshift(...o.getChildren()),o!==e&&t.push(o)}return t}class ke{constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.trackTable(),this.isSelecting=!1}getTable(){return this.table}removeListeners(){Array.from(this.listenersToRemove).forEach((e=>e()))}trackTable(){const e=new MutationObserver((e=>{this.editor.update((()=>{let t=!1;for(let n=0;n<e.length;n++){const o=e[n].target.nodeName;if("TABLE"===o||"TBODY"===o||"THEAD"===o||"TR"===o){t=!0;break}}if(!t)return;const n=this.editor.getElementByKey(this.tableNodeKey);if(!n)throw new Error("Expected to find TableElement in DOM");this.table=Le(n)}))}));this.editor.update((()=>{const t=this.editor.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");this.table=Le(t),e.observe(t,{childList:!0,subtree:!0})}))}clearHighlight(){const e=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.enableHighlightStyle(),e.update((()=>{if(!st(p(this.tableNodeKey)))throw new Error("Expected TableNode.");const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");const n=Le(t);Ie(e,n,null),S(null),e.dispatchCommand(_,void 0)}))}enableHighlightStyle(){const e=this.editor;e.update((()=>{const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");n(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}))}disableHighlightStyle(){const t=this.editor;t.update((()=>{const n=t.getElementByKey(this.tableNodeKey);if(!n)throw new Error("Expected to find TableElement in DOM");e(n,t._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}))}updateTableTableSelection(e){if(null!==e&&e.tableKey===this.tableNodeKey){const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.disableHighlightStyle(),Ie(t,this.table,this.tableSelection)}else null==e?this.clearHighlight():(this.tableNodeKey=e.tableKey,this.updateTableTableSelection(e))}setFocusCellForSelection(e,t=!1){const n=this.editor;n.update((()=>{const o=p(this.tableNodeKey);if(!st(o))throw new Error("Expected TableNode.");if(!n.getElementByKey(this.tableNodeKey))throw new Error("Expected to find TableElement in DOM");const r=e.x,l=e.y;if(this.focusCell=e,null!==this.anchorCell){const e=He(n._window);e&&e.setBaseAndExtent(this.anchorCell.elem,0,this.focusCell.elem,0)}if(this.isHighlightingCells||this.anchorX===r&&this.anchorY===l&&!t){if(r===this.focusX&&l===this.focusY)return}else this.isHighlightingCells=!0,this.disableHighlightStyle();if(this.focusX=r,this.focusY=l,this.isHighlightingCells){const t=w(e.elem);if(null!=this.tableSelection&&null!=this.anchorCellNodeKey&&Q(t)&&o.is(Qe(t))){const e=t.getKey();this.tableSelection=this.tableSelection.clone()||Ke(),this.focusCellNodeKey=e,this.tableSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey),S(this.tableSelection),n.dispatchCommand(_,void 0),Ie(n,this.table,this.tableSelection)}}}))}setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.editor.update((()=>{const t=w(e.elem);if(Q(t)){const e=t.getKey();this.tableSelection=null!=this.tableSelection?this.tableSelection.clone():Ke(),this.anchorCellNodeKey=e}}))}formatCells(e){this.editor.update((()=>{const t=h();Re(t)||re(11);const n=b(),o=n.anchor,r=n.focus;t.getNodes().forEach((t=>{Q(t)&&0!==t.getTextContentSize()&&(o.set(t.getKey(),0,"element"),r.set(t.getKey(),t.getChildrenSize(),"element"),n.formatText(e))})),S(t),this.editor.dispatchCommand(_,void 0)}))}clearText(){const e=this.editor;e.update((()=>{const t=p(this.tableNodeKey);if(!st(t))throw new Error("Expected TableNode.");const n=h();Re(n)||re(11);const o=n.getNodes().filter(Q);if(o.length!==this.table.columns*this.table.rows)o.forEach((e=>{if(s(e)){const t=l(),n=u();t.append(n),e.append(t),e.getChildren().forEach((e=>{e!==t&&e.remove()}))}})),Ie(e,this.table,null),S(null),e.dispatchCommand(_,void 0);else{t.selectPrevious(),t.remove();y().selectStart()}}))}}const Ae="__lexicalTableSelection",He=e=>le?(e||window).getSelection():null;function Pe(e,n,o,r){const i=o.getRootElement();if(null===i)throw new Error("No root element.");const a=new ke(o,e.getKey()),d=o._window||window;!function(e,t){e[Ae]=t}(n,a);const f=()=>{const e=()=>{a.isSelecting=!1,d.removeEventListener("mouseup",e),d.removeEventListener("mousemove",t)},t=n=>{setTimeout((()=>{if(1&~n.buttons&&a.isSelecting)return a.isSelecting=!1,d.removeEventListener("mouseup",e),void d.removeEventListener("mousemove",t);const o=Be(n.target);null===o||a.anchorX===o.x&&a.anchorY===o.y||(n.preventDefault(),a.setFocusCellForSelection(o))}),0)};return{onMouseMove:t,onMouseUp:e}};n.addEventListener("mousedown",(e=>{setTimeout((()=>{if(0!==e.button)return;if(!d)return;const t=Be(e.target);null!==t&&(Ze(e),a.setAnchorCellForSelection(t));const{onMouseUp:n,onMouseMove:o}=f();a.isSelecting=!0,d.addEventListener("mouseup",n),d.addEventListener("mousemove",o)}),0)}));const m=e=>{0===e.button&&o.update((()=>{const t=h(),n=e.target;Re(t)&&t.tableKey===a.tableNodeKey&&i.contains(n)&&a.clearHighlight()}))};d.addEventListener("mousedown",m),a.listenersToRemove.add((()=>d.removeEventListener("mousedown",m))),a.listenersToRemove.add(o.registerCommand(N,(t=>Ve(o,t,"down",e,a)),T)),a.listenersToRemove.add(o.registerCommand(x,(t=>Ve(o,t,"up",e,a)),T)),a.listenersToRemove.add(o.registerCommand(v,(t=>Ve(o,t,"backward",e,a)),T)),a.listenersToRemove.add(o.registerCommand(E,(t=>Ve(o,t,"forward",e,a)),T)),a.listenersToRemove.add(o.registerCommand(O,(e=>{const n=h();if(Re(n)){const o=t(n.focus.getNode(),Q);if(Q(o))return Ze(e),o.selectEnd(),!0}return!1}),T));[M,R,K].forEach((n=>{a.listenersToRemove.add(o.registerCommand(n,(n=>()=>{const o=h();if(!Xe(o,e))return!1;if(Re(o))return a.clearText(),!0;if(g(o)){const r=t(o.anchor.getNode(),(e=>Q(e)));if(!Q(r))return!1;const l=o.anchor.getNode(),i=o.focus.getNode(),c=e.isParentOf(l),d=e.isParentOf(i);if(c&&!d||d&&!c)return a.clearText(),!0;const u=t(o.anchor.getNode(),(e=>s(e))),h=u&&t(u,(e=>s(e)&&Q(e.getParent())));if(!s(h)||!s(u))return!1;if(n===R&&null===h.getPreviousSibling())return!0}return!1})(n),F))}));const p=n=>{const o=h();if(!Xe(o,e)){const e=o?o.getNodes():null;if(e){const t=e.find((e=>st(e)&&e.getKey()===a.tableNodeKey));if(st(t)){if(!t.getParent())return!1;t.remove()}}return!1}if(Re(o))return n.preventDefault(),n.stopPropagation(),a.clearText(),!0;if(g(o)){const e=t(o.anchor.getNode(),(e=>Q(e)));if(!Q(e))return!1}return!1};function C(t){const n=e.getCordsFromCellNode(t,a.table);return e.getDOMCellFromCordsOrThrow(n.x,n.y,a.table)}return a.listenersToRemove.add(o.registerCommand(k,p,F)),a.listenersToRemove.add(o.registerCommand(A,p,F)),a.listenersToRemove.add(o.registerCommand(H,(n=>{const o=h();if(!Xe(o,e))return!1;if(Re(o))return a.formatCells(n),!0;if(g(o)){const e=t(o.anchor.getNode(),(e=>Q(e)));if(!Q(e))return!1}return!1}),F)),a.listenersToRemove.add(o.registerCommand(P,(t=>{const n=h();if(!Re(n)||!Xe(n,e))return!1;const o=n.anchor.getNode(),r=n.focus.getNode();if(!Q(o)||!Q(r))return!1;const[l,i,c]=xe(e,o,r),a=Math.max(i.startRow,c.startRow),d=Math.max(i.startColumn,c.startColumn),u=Math.min(i.startRow,c.startRow),g=Math.min(i.startColumn,c.startColumn);for(let e=u;e<=a;e++)for(let n=g;n<=d;n++){const o=l[e][n].cell;o.setFormat(t);const r=o.getChildren();for(let e=0;e<r.length;e++){const n=r[e];s(n)&&!n.isInline()&&n.setFormat(t)}}return!0}),F)),a.listenersToRemove.add(o.registerCommand(D,(n=>{const r=h();if(!Xe(r,e))return!1;if(Re(r))return a.clearHighlight(),!1;if(g(r)){const l=t(r.anchor.getNode(),(e=>Q(e)));if(!Q(l))return!1;if("string"==typeof n){const t=tt(o,r,e);if(t)return et(t,e,[u(n)]),!0}}return!1}),F)),r&&a.listenersToRemove.add(o.registerCommand(B,(t=>{const n=h();if(!g(n)||!n.isCollapsed()||!Xe(n,e))return!1;const o=Ge(n.anchor.getNode());if(null===o)return!1;Ze(t);const r=e.getCordsFromCellNode(o,a.table);return ze(a,e,r.x,r.y,t.shiftKey?"backward":"forward"),!0}),F)),a.listenersToRemove.add(o.registerCommand(L,(t=>e.isSelected()),T)),a.listenersToRemove.add(o.registerCommand(I,(e=>{const{nodes:n,selection:o}=e,r=o.getStartEndPoints(),s=Re(o),i=g(o)&&null!==t(o.anchor.getNode(),(e=>Q(e)))&&null!==t(o.focus.getNode(),(e=>Q(e)))||s;if(1!==n.length||!st(n[0])||!i||null===r)return!1;const[a]=r,d=n[0],u=d.getChildren(),h=d.getFirstChildOrThrow().getChildrenSize(),f=d.getChildrenSize(),m=t(a.getNode(),(e=>Q(e))),p=m&&t(m,(e=>ne(e))),C=p&&t(p,(e=>st(e)));if(!Q(m)||!ne(p)||!st(C))return!1;const _=p.getIndexWithinParent(),w=Math.min(C.getChildrenSize()-1,_+f-1),b=m.getIndexWithinParent(),y=Math.min(p.getChildrenSize()-1,b+h-1),N=Math.min(b,y),T=Math.min(_,w),x=Math.max(b,y),v=Math.max(_,w),E=C.getChildren();let O,M,R=0;for(let e=T;e<=v;e++){const t=E[e];if(!ne(t))return!1;const n=u[R];if(!ne(n))return!1;const o=t.getChildren(),r=n.getChildren();let s=0;for(let t=N;t<=x;t++){const n=o[t];if(!Q(n))return!1;const i=r[s];if(!Q(i))return!1;e===T&&t===N?O=n.getKey():e===v&&t===x&&(M=n.getKey());const a=n.getChildren();i.getChildren().forEach((e=>{if(c(e)){l().append(e),n.append(e)}else n.append(e)})),a.forEach((e=>e.remove())),s++}R++}if(O&&M){const e=Ke();e.set(n[0].getKey(),O,M),S(e)}return!0}),F)),a.listenersToRemove.add(o.registerCommand(_,(()=>{const t=h(),n=W();if(g(t)){const{anchor:n,focus:r}=t,l=n.getNode(),s=r.getNode(),i=Ge(l),c=Ge(s),u=!(!i||!e.is(Qe(i))),h=!(!c||!e.is(Qe(c))),g=u!==h,m=u&&h,p=t.isBackward();if(g){const n=t.clone();if(h){const[t]=xe(e,c,c),o=t[0][0].cell,r=t[t.length-1].at(-1).cell;n.focus.set(p?o.getKey():r.getKey(),p?o.getChildrenSize():r.getChildrenSize(),"element")}else n.anchor.set(e.getParentOrThrow().getKey(),p?e.getIndexWithinParent()+1:e.getIndexWithinParent(),"element");S(n),Ue(o,a)}else m&&(i.is(c)||(a.setAnchorCellForSelection(C(i)),a.setFocusCellForSelection(C(c),!0),a.isSelecting||setTimeout((()=>{const{onMouseUp:e,onMouseMove:t}=f();a.isSelecting=!0,d.addEventListener("mouseup",e),d.addEventListener("mousemove",t)}),0)))}else if(t&&Re(t)&&t.is(n)&&t.tableKey===e.getKey()){const n=He(o._window);if(n&&n.anchorNode&&n.focusNode){const r=w(n.focusNode),l=r&&!e.is(Qe(r)),s=w(n.anchorNode),i=s&&e.is(Qe(s));if(l&&i&&n.rangeCount>0){const r=U(n,o);r&&(r.anchor.set(e.getKey(),t.isBackward()?e.getChildrenSize():0,"element"),n.removeAllRanges(),S(r))}}}return t&&!t.is(n)&&(Re(t)||Re(n))&&a.tableSelection&&!a.tableSelection.is(n)?(Re(t)&&t.tableKey===a.tableNodeKey?a.updateTableTableSelection(t):!Re(t)&&Re(n)&&n.tableKey===a.tableNodeKey&&a.updateTableTableSelection(null),!1):(a.hasHijackedSelectionStyles&&!e.isSelected()?function(e,t){t.enableHighlightStyle(),We(t.table,(t=>{const n=t.elem;t.highlighted=!1,qe(e,t),n.getAttribute("style")||n.removeAttribute("style")}))}(o,a):!a.hasHijackedSelectionStyles&&e.isSelected()&&Ue(o,a),!1)}),F)),a.listenersToRemove.add(o.registerCommand(z,(()=>{const t=h();if(!g(t)||!t.isCollapsed()||!Xe(t,e))return!1;const n=tt(o,t,e);return!!n&&(et(n,e),!0)}),F)),a}function De(e){return e[Ae]}function Be(e){let t=e;for(;null!=t;){const e=t.nodeName;if("TD"===e||"TH"===e){const e=t._cell;return void 0===e?null:e}t=t.parentNode}return null}function Le(e){const t=[],n={columns:0,domRows:t,rows:0};let o=e.firstChild,r=0,l=0;for(t.length=0;null!=o;){const e=o.nodeName;if("TD"===e||"TH"===e){const e={elem:o,hasBackgroundColor:""!==o.style.backgroundColor,highlighted:!1,x:r,y:l};o._cell=e;let n=t[l];void 0===n&&(n=t[l]=[]),n[r]=e}else{const e=o.firstChild;if(null!=e){o=e;continue}}const n=o.nextSibling;if(null!=n){r++,o=n;continue}const s=o.parentNode;if(null!=s){const e=s.nextSibling;if(null==e)break;l++,r=0,o=e}}return n.columns=r+1,n.rows=l+1,n}function Ie(e,t,n){const o=new Set(n?n.getNodes():[]);We(t,((t,n)=>{const r=t.elem;o.has(n)?(t.highlighted=!0,je(e,t)):(t.highlighted=!1,qe(e,t),r.getAttribute("style")||r.removeAttribute("style"))}))}function We(e,t){const{domRows:n}=e;for(let e=0;e<n.length;e++){const o=n[e];if(o)for(let n=0;n<o.length;n++){const r=o[n];if(!r)continue;const l=w(r.elem);null!==l&&t(r,l,{x:n,y:e})}}}function Ue(e,t){t.disableHighlightStyle(),We(t.table,(t=>{t.highlighted=!0,je(e,t)}))}const ze=(e,t,n,o,r)=>{const l="forward"===r;switch(r){case"backward":case"forward":return n!==(l?e.table.columns-1:0)?Je(t.getCellNodeFromCordsOrThrow(n+(l?1:-1),o,e.table),l):o!==(l?e.table.rows-1:0)?Je(t.getCellNodeFromCordsOrThrow(l?0:e.table.columns-1,o+(l?1:-1),e.table),l):l?t.selectNext():t.selectPrevious(),!0;case"up":return 0!==o?Je(t.getCellNodeFromCordsOrThrow(n,o-1,e.table),!1):t.selectPrevious(),!0;case"down":return o!==e.table.rows-1?Je(t.getCellNodeFromCordsOrThrow(n,o+1,e.table),!0):t.selectNext(),!0;default:return!1}},Ye=(e,t,n,o,r)=>{const l="forward"===r;switch(r){case"backward":case"forward":return n!==(l?e.table.columns-1:0)&&e.setFocusCellForSelection(t.getDOMCellFromCordsOrThrow(n+(l?1:-1),o,e.table)),!0;case"up":return 0!==o&&(e.setFocusCellForSelection(t.getDOMCellFromCordsOrThrow(n,o-1,e.table)),!0);case"down":return o!==e.table.rows-1&&(e.setFocusCellForSelection(t.getDOMCellFromCordsOrThrow(n,o+1,e.table)),!0);default:return!1}};function Xe(e,t){if(g(e)||Re(e)){const n=t.isParentOf(e.anchor.getNode()),o=t.isParentOf(e.focus.getNode());return n&&o}return!1}function Je(e,t){t?e.selectStart():e.selectEnd()}const $e="172,206,247";function je(e,t){const n=t.elem,o=w(n);Q(o)||re(131);null===o.getBackgroundColor()?n.style.setProperty("background-color",`rgb(${$e})`):n.style.setProperty("background-image",`linear-gradient(to right, rgba(${$e},0.85), rgba(${$e},0.85))`),n.style.setProperty("caret-color","transparent")}function qe(e,t){const n=t.elem,o=w(n);Q(o)||re(131);null===o.getBackgroundColor()&&n.style.removeProperty("background-color"),n.style.removeProperty("background-image"),n.style.removeProperty("caret-color")}function Ge(e){const n=t(e,Q);return Q(n)?n:null}function Qe(e){const n=t(e,st);return st(n)?n:null}function Ve(e,n,o,r,l){if(("up"===o||"down"===o)&&function(e){const t=e.getRootElement();if(!t)return!1;return t.hasAttribute("aria-controls")&&"typeahead-menu"===t.getAttribute("aria-controls")}(e))return!1;const i=h();if(!Xe(i,r)){if(g(i)){if(i.isCollapsed()&&"backward"===o){const e=i.anchor.type,o=i.anchor.offset;if("element"!==e&&("text"!==e||0!==o))return!1;const r=i.anchor.getNode();if(!r)return!1;const l=t(r,(e=>s(e)&&!e.isInline()));if(!l)return!1;const c=l.getPreviousSibling();return!(!c||!st(c))&&(Ze(n),c.selectEnd(),!0)}if(n.shiftKey&&("up"===o||"down"===o)){const e=i.focus.getNode();if(Y(e)){const e=i.getNodes()[0];if(e){const n=t(e,Q);if(n&&r.isParentOf(n)){const e=r.getFirstDescendant(),t=r.getLastDescendant();if(!e||!t)return!1;const[n]=Ee(e),[o]=Ee(t),s=r.getCordsFromCellNode(n,l.table),i=r.getCordsFromCellNode(o,l.table),c=r.getDOMCellFromCordsOrThrow(s.x,s.y,l.table),a=r.getDOMCellFromCordsOrThrow(i.x,i.y,l.table);return l.setAnchorCellForSelection(c),l.setFocusCellForSelection(a,!0),!0}}return!1}{const n=t(e,(e=>s(e)&&!e.isInline()));if(!n)return!1;const r="down"===o?n.getNextSibling():n.getPreviousSibling();if(st(r)&&l.tableNodeKey===r.getKey()){const e=r.getFirstDescendant(),t=r.getLastDescendant();if(!e||!t)return!1;const[n]=Ee(e),[l]=Ee(t),s=i.clone();return s.focus.set(("up"===o?n:l).getKey(),"up"===o?0:l.getChildrenSize(),"element"),S(s),!0}}}}return!1}if(g(i)&&i.isCollapsed()){const{anchor:c,focus:a}=i,d=t(c.getNode(),Q),u=t(a.getNode(),Q);if(!Q(d)||!d.is(u))return!1;const h=Qe(d);if(h!==r&&null!=h){const t=e.getElementByKey(h.getKey());if(null!=t)return l.table=Le(t),Ve(e,n,o,h,l)}if("backward"===o||"forward"===o){const e=c.type,l=c.offset,a=c.getNode();if(!a)return!1;const d=i.getNodes();return(1!==d.length||!X(d[0]))&&(!!function(e,n,o,r){return function(e,t,n){return"element"===e&&("backward"===n?null===t.getPreviousSibling():null===t.getNextSibling())}(e,o,r)||function(e,n,o,r){const l=t(o,(e=>s(e)&&!e.isInline()));if(!l)return!1;const i="backward"===r?0===n:n===o.getTextContentSize();return"text"===e&&i&&("backward"===r?null===l.getPreviousSibling():null===l.getNextSibling())}(e,n,o,r)}(e,l,a,o)&&function(e,n,o,r){const l=t(n,Q);if(!Q(l))return!1;const[i,c]=xe(o,l,l);if(!function(e,t,n){const o=e[0][0],r=e[e.length-1][e[0].length-1],{startColumn:l,startRow:s}=t;return"backward"===n?l===o.startColumn&&s===o.startRow:l===r.startColumn&&s===r.startRow}(i,c,r))return!1;const a=function(e,n,o){const r=t(e,(e=>s(e)&&!e.isInline()));if(!r)return;const l="backward"===n?r.getPreviousSibling():r.getNextSibling();return l&&st(l)?l:"backward"===n?o.getPreviousSibling():o.getNextSibling()}(n,r,o);if(!a||st(a))return!1;Ze(e),"backward"===r?a.selectEnd():a.selectStart();return!0}(n,a,r,o))}const g=e.getElementByKey(d.__key),f=e.getElementByKey(c.key);if(null==f||null==g)return!1;let m;if("element"===c.type)m=f.getBoundingClientRect();else{const e=window.getSelection();if(null===e||0===e.rangeCount)return!1;m=e.getRangeAt(0).getBoundingClientRect()}const p="up"===o?d.getFirstChild():d.getLastChild();if(null==p)return!1;const C=e.getElementByKey(p.__key);if(null==C)return!1;const S=C.getBoundingClientRect();if("up"===o?S.top>m.top-m.height:m.bottom+m.height>S.bottom){Ze(n);const e=r.getCordsFromCellNode(d,l.table);if(!n.shiftKey)return ze(l,r,e.x,e.y,o);{const t=r.getDOMCellFromCordsOrThrow(e.x,e.y,l.table);l.setAnchorCellForSelection(t),l.setFocusCellForSelection(t,!0)}return!0}}else if(Re(i)){const{anchor:s,focus:c}=i,a=t(s.getNode(),Q),d=t(c.getNode(),Q),[u]=i.getNodes(),h=e.getElementByKey(u.getKey());if(!Q(a)||!Q(d)||!st(u)||null==h)return!1;l.updateTableTableSelection(i);const g=Le(h),f=r.getCordsFromCellNode(a,g),m=r.getDOMCellFromCordsOrThrow(f.x,f.y,g);if(l.setAnchorCellForSelection(m),Ze(n),n.shiftKey){const e=r.getCordsFromCellNode(d,g);return Ye(l,u,e.x,e.y,o)}return d.selectEnd(),!0}return!1}function Ze(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()}function et(e,t,n){const o=l();"first"===e?t.insertBefore(o):t.insertAfter(o),o.append(...n||[]),o.selectEnd()}function tt(e,n,o){const r=o.getParent();if(!r)return;const l=e.getElementByKey(r.getKey());if(!l)return;const s=window.getSelection();if(!s||s.anchorNode!==l)return;const i=t(n.anchor.getNode(),(e=>Q(e)));if(!i)return;const c=t(i,(e=>st(e)));if(!st(c)||!c.is(o))return;const[a,d]=xe(o,i,i),u=a[0][0],h=a[a.length-1][a[0].length-1],{startRow:g,startColumn:f}=d,m=g===u.startRow&&f===u.startColumn,p=g===h.startRow&&f===h.startColumn;return m?"first":p?"last":void 0}class nt extends r{static getType(){return"table"}static clone(e){return new nt(e.__key)}static importDOM(){return{table:e=>({conversion:rt,priority:1})}}static importJSON(e){return lt()}constructor(e){super(e)}exportJSON(){return{...super.exportJSON(),type:"table",version:1}}createDOM(t,n){const o=document.createElement("table");return e(o,t.theme.table),o}updateDOM(){return!1}exportDOM(e){return{...super.exportDOM(e),after:e=>{if(e){const t=e.cloneNode(),n=document.createElement("colgroup"),r=document.createElement("tbody");o(e)&&r.append(...e.children);const l=this.getFirstChildOrThrow();if(!ne(l))throw new Error("Expected to find row node.");const s=l.getChildrenSize();for(let e=0;e<s;e++){const e=document.createElement("col");n.append(e)}return t.replaceChildren(n,r),t}}}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:n,domRows:o}=t;for(let t=0;t<n;t++){const n=o[t];if(null==n)continue;const r=n.findIndex((t=>{if(!t)return;const{elem:n}=t;return w(n)===e}));if(-1!==r)return{x:r,y:t}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,n){const{domRows:o}=n,r=o[t];if(null==r)return null;const l=r[e];return null==l?null:l}getDOMCellFromCordsOrThrow(e,t,n){const o=this.getDOMCellFromCords(e,t,n);if(!o)throw new Error("Cell not found at cords.");return o}getCellNodeFromCords(e,t,n){const o=this.getDOMCellFromCords(e,t,n);if(null==o)return null;const r=w(o.elem);return Q(r)?r:null}getCellNodeFromCordsOrThrow(e,t,n){const o=this.getCellNodeFromCords(e,t,n);if(!o)throw new Error("Node at cords not TableCellNode.");return o}canSelectBefore(){return!0}canIndent(){return!1}}function ot(e,t){const n=e.getElementByKey(t.getKey());if(null==n)throw new Error("Table Element Not Found");return Le(n)}function rt(e){return{node:lt()}}function lt(){return a(new nt)}function st(e){return e instanceof nt}export{xe as $computeTableMap,ve as $computeTableMapSkipCellCheck,G as $createTableCellNode,lt as $createTableNode,se as $createTableNodeWithDimensions,te as $createTableRowNode,Ke as $createTableSelection,_e as $deleteTableColumn,be as $deleteTableColumn__EXPERIMENTAL,we as $deleteTableRow__EXPERIMENTAL,Ge as $findCellNode,Qe as $findTableNode,ot as $getElementForTableNode,Ee as $getNodeTriplet,ie as $getTableCellNodeFromLexicalNode,Oe as $getTableCellNodeRect,ue as $getTableColumnIndexFromTableCellNode,ae as $getTableNodeFromLexicalNodeOrThrow,de as $getTableRowIndexFromTableCellNode,ce as $getTableRowNodeFromTableCellNodeOrThrow,Ce as $insertTableColumn,Se as $insertTableColumn__EXPERIMENTAL,fe as $insertTableRow,pe as $insertTableRow__EXPERIMENTAL,Q as $isTableCellNode,st as $isTableNode,ne as $isTableRowNode,Re as $isTableSelection,ge as $removeTableRowAtIndex,Te as $unmergeCell,V as INSERT_TABLE_COMMAND,$ as TableCellHeaderStates,j as TableCellNode,nt as TableNode,ke as TableObserver,Z as TableRowNode,Pe as applyTableHandlers,Be as getDOMCellFromTarget,De as getTableObserverFromTableElement};
package/package.json CHANGED
@@ -8,12 +8,12 @@
8
8
  "table"
9
9
  ],
10
10
  "license": "MIT",
11
- "version": "0.16.2-nightly.20240726.0",
11
+ "version": "0.16.2-nightly.20240730.0",
12
12
  "main": "LexicalTable.js",
13
13
  "types": "index.d.ts",
14
14
  "dependencies": {
15
- "@lexical/utils": "0.16.2-nightly.20240726.0",
16
- "lexical": "0.16.2-nightly.20240726.0"
15
+ "@lexical/utils": "0.16.2-nightly.20240730.0",
16
+ "lexical": "0.16.2-nightly.20240730.0"
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",