/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
'use strict';var t=require("lexical"),v=require("yjs"),y=require("@lexical/selection"),z=require("@lexical/offset");function B(a){throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?code=${a} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
class C{constructor(a,b){this._key="";this._map=a;this._parent=b;this._type="linebreak"}getNode(){let a=t.$getNodeByKey(this._key);return t.$isLineBreakNode(a)?a:null}getKey(){return this._key}getSharedType(){return this._map}getType(){return this._type}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}destroy(a){a.collabNodeMap.delete(this._key)}}function D(a,b){b=new C(a,b);return a._collabNode=b}
class E{constructor(a,b,c,d){this._key="";this._map=a;this._parent=c;this._text=b;this._type=d;this._normalized=!1}getPrevNode(a){if(null===a)return null;a=a.get(this._key);return t.$isTextNode(a)?a:null}getNode(){let a=t.$getNodeByKey(this._key);return t.$isTextNode(a)?a:null}getSharedType(){return this._map}getType(){return this._type}getKey(){return this._key}getSize(){return this._text.length+(this._normalized?0:1)}getOffset(){return this._parent.getChildOffset(this)}spliceText(a,b,c){let d=this._parent._xmlText;
a=this.getOffset()+1+a;0!==b&&d.delete(a,b);""!==c&&d.insert(a,c)}syncPropertiesAndTextFromLexical(a,b,c){var d=this.getPrevNode(c);c=b.__text;F(a,this._map,d,b);if(null!==d&&(a=d.__text,a!==c)){d=b.__key;b=a;var e=t.$getSelection();a=c.length;t.$isRangeSelection(e)&&e.isCollapsed()&&(e=e.anchor,e.key===d&&(a=e.offset));d=b.length;let f=c.length,h=e=0;for(;e<d&&e<f&&b[e]===c[e]&&e<a;)e++;for(;h+e<d&&h+e<f&&b[d-h-1]===c[f-h-1];)h++;for(;h+e<d&&h+e<f&&b[e]===c[e];)e++;b=e;a=c.slice(e,f-h);d=d-e-h;this.spliceText(b,
d,a);this._text=c}}syncPropertiesAndTextFromYjs(a,b){let c=this.getNode();null===c&&B(84);G(a,this._map,c,b);a=this._text;c.__text!==a&&(c.getWritable().__text=a)}destroy(a){a.collabNodeMap.delete(this._key)}}function I(a,b,c,d){b=new E(a,b,c,d);return a._collabNode=b}let J=new Set("__key __parent __cachedText __text __size __next __prev __first __last".split(" "));function K(a){a=t.$getNodeByKey(a);null===a&&B(85);return a}
function L(a,b,c){let d=b.__type;if(t.$isElementNode(b)){var e=new v.XmlText;e=M(e,c,d);e.syncPropertiesFromLexical(a,b,null);e.syncChildrenFromLexical(a,b,null,null,null)}else t.$isTextNode(b)?(e=new v.Map,e=I(e,b.__text,c,d),e.syncPropertiesAndTextFromLexical(a,b,null)):t.$isLineBreakNode(b)?(a=new v.Map,a.set("__type","linebreak"),e=D(a,c)):t.$isDecoratorNode(b)?(e=new v.XmlElement,e=N(e,c,d),e.syncPropertiesFromLexical(a,b,null)):B(86);e._key=b.__key;return e}
function O(a,b,c){let d=b._collabNode;if(void 0===d){var e=a.editor._nodes;let f=b instanceof v.Map?b.get("__type"):b.getAttribute("__type");null==f&&B(87);void 0===e.get(f)&&B(88);e=b.parent;a=void 0===c&&null!==e?O(a,e):c||null;a instanceof P||B(89);if(b instanceof v.XmlText)return M(b,a,f);if(b instanceof v.Map)return"linebreak"===f?D(b,a):I(b,"",a,f);if(b instanceof v.XmlElement)return N(b,a,f)}return d}
function G(a,b,c,d){d=null===d?b instanceof v.Map?Array.from(b.keys()):Object.keys(b.getAttributes()):Array.from(d);let e;for(let h=0;h<d.length;h++){let g=d[h];if(J.has(g))continue;var f=c[g];let k=b instanceof v.Map?b.get(g):b.getAttribute(g);if(f!==k){if(k instanceof v.Doc){let n=a.docMap;f instanceof v.Doc&&n.delete(f.guid);f=t.createEditor();let q=k.guid;f._key=q;n.set(q,k);k=f}void 0===e&&(e=c.getWritable());e[g]=k}}}
function F(a,b,c,d){var e=d.__type,f=a.nodeProperties;let h=f.get(e);void 0===h&&(h=Object.keys(d).filter(k=>!J.has(k)),f.set(e,h));e=a.editor.constructor;for(f=0;f<h.length;f++){let k=h[f];var g=null===c?void 0:c[k];let n=d[k];if(g!==n){if(n instanceof e){let q=a.docMap,m;g instanceof e&&(g=g._key,m=q.get(g),q.delete(g));g=m||new v.Doc;let l=g.guid;n._key=l;q.set(l,g);n=g;a.editor.update(()=>{d.markDirty()})}b instanceof v.Map?b.set(k,n):b.setAttribute(k,n)}}}
function Q(a,b,c){let d=0,e=0,f=a._children,h=f.length;for(;e<h;e++){a=f[e];let g=d,k=a.getSize();d+=k;if((c?d>=b:d>b)&&a instanceof E)return c=b-g-1,0>c&&(c=0),{length:d-b,node:a,nodeIndex:e,offset:c};if(d>b)return{length:0,node:a,nodeIndex:e,offset:g};if(e===h-1)return{length:0,node:null,nodeIndex:e+1,offset:g+1}}return{length:0,node:null,nodeIndex:0,offset:0}}
function R(a){let b=a.anchor;a=a.focus;let c=!1;try{let d=b.getNode(),e=a.getNode();if(!d.isAttached()||!e.isAttached()||t.$isTextNode(d)&&b.offset>d.getTextContentSize()||t.$isTextNode(e)&&a.offset>e.getTextContentSize())c=!0}catch(d){c=!0}return c}function aa(a,b){a.doc.transact(b,a)}
function S(a,b){let c=[];for(a=a.__first;null!==a;){let d=null===b?t.$getNodeByKey(a):b.get(a);if(null===d||void 0===d)throw Error("createChildrenArray: node does not exist in nodeMap");c.push(a);a=d.__next}return c}
function T(a){var b=a.getParent();if(null!==b){let e=a.getWritable();b=b.getWritable();var c=a.getPreviousSibling();a=a.getNextSibling();if(null===c)if(null!==a){var d=a.getWritable();b.__first=a.__key;d.__prev=null}else b.__first=null;else{d=c.getWritable();if(null!==a){let f=a.getWritable();f.__prev=d.__key;d.__next=f.__key}else d.__next=null;e.__prev=null}null===a?null!==c?(a=c.getWritable(),b.__last=c.__key,a.__next=null):b.__last=null:(a=a.getWritable(),null!==c?(c=c.getWritable(),c.__next=a.__key,
a.__prev=c.__key):a.__prev=null,e.__next=null);b.__size--;e.__parent=null}}
class U{constructor(a,b,c){this._key="";this._xmlElem=a;this._parent=b;this._type=c;this._unobservers=new Set}getPrevNode(a){if(null===a)return null;a=a.get(this._key);return t.$isDecoratorNode(a)?a:null}getNode(){let a=t.$getNodeByKey(this._key);return t.$isDecoratorNode(a)?a:null}getSharedType(){return this._xmlElem}getType(){return this._type}getKey(){return this._key}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}syncPropertiesFromLexical(a,b,c){c=this.getPrevNode(c);
F(a,this._xmlElem,c,b)}syncPropertiesFromYjs(a,b){let c=this.getNode();null===c&&B(83);G(a,this._xmlElem,c,b)}destroy(a){a.collabNodeMap.delete(this._key);this._unobservers.forEach(b=>b());this._unobservers.clear()}}function N(a,b,c){b=new U(a,b,c);return a._collabNode=b}
class P{constructor(a,b,c){this._key="";this._children=[];this._xmlText=a;this._type=c;this._parent=b}getPrevNode(a){if(null===a)return null;a=a.get(this._key);return t.$isElementNode(a)?a:null}getNode(){let a=t.$getNodeByKey(this._key);return t.$isElementNode(a)?a:null}getSharedType(){return this._xmlText}getType(){return this._type}getKey(){return this._key}isEmpty(){return 0===this._children.length}getSize(){return 1}getOffset(){let a=this._parent;null===a&&B(90);return a.getChildOffset(this)}syncPropertiesFromYjs(a,
b){let c=this.getNode();null===c&&B(91);G(a,this._xmlText,c,b)}applyChildrenYjsDelta(a,b){let c=this._children,d=0;for(let q=0;q<b.length;q++){var e=b[q],f=e.insert,h=e.delete;if(null!=e.retain)d+=e.retain;else if("number"===typeof h)for(f=h;0<f;){let {node:m,nodeIndex:l,offset:p,length:u}=Q(this,d,!1);if(m instanceof P||m instanceof C||m instanceof U)c.splice(l,1),--f;else if(m instanceof E){e=Math.min(f,u);h=0!==l?c[l-1]:null;var g=m.getSize();if(0===p&&1===e&&0<l&&h instanceof E&&u===g&&0===Array.from(m._map.keys()).length)h._text+=
m._text,c.splice(l,1);else if(0===p&&e===g)c.splice(l,1);else{h=m;g=m._text;var k=p,n=e;g=g.slice(0,k)+""+g.slice(k+n);h._text=g}f-=e}else break}else if(null!=f)if("string"===typeof f){let {node:m,offset:l}=Q(this,d,!0);m instanceof E?(e=m,h=m._text,g=l,k=f,h=h.slice(0,g)+k+h.slice(g+0),e._text=h):this._xmlText.delete(l,f.length);d+=f.length}else e=f,{nodeIndex:f}=Q(this,d,!1),e=O(a,e,this),c.splice(f,0,e),d+=1;else throw Error("Unexpected delta format");}}syncChildrenFromYjs(a){var b=this.getNode();
null===b&&B(92);var c=b.__key;let d=S(b,null),e=d.length;var f=this._children;let h=f.length,g=a.collabNodeMap,k=new Set,n;let q=0;var m=null;h!==e&&b.getWritable();for(let x=0;x<h;x++){var l=d[q],p=f[x];var u=p.getNode();var r=p._key;if(null!==u&&l===r)m=t.$isTextNode(u),k.add(l),m&&(p._key=l,p instanceof P?(m=p._xmlText,p.syncPropertiesFromYjs(a,null),p.applyChildrenYjsDelta(a,m.toDelta()),p.syncChildrenFromYjs(a)):p instanceof E?p.syncPropertiesAndTextFromYjs(a,null):p instanceof U?p.syncPropertiesFromYjs(a,
null):p instanceof C||B(93)),m=u,q++;else{if(void 0===n)for(n=new Set,r=0;r<h;r++){var w=f[r]._key;""!==w&&n.add(w)}if(null===u||void 0===l||n.has(l)){u=b.getWritable();l=a;r=p;w=c;var A=r.getType();A=l.editor._nodes.get(A);void 0===A&&B(88);A=new A.klass;A.__parent=w;r._key=A.__key;r instanceof P?(w=r._xmlText,r.syncPropertiesFromYjs(l,null),r.applyChildrenYjsDelta(l,w.toDelta()),r.syncChildrenFromYjs(l)):r instanceof E?r.syncPropertiesAndTextFromYjs(l,null):r instanceof U&&r.syncPropertiesFromYjs(l,
null);l.collabNodeMap.set(A.__key,r);l=A;r=l.__key;g.set(r,p);null===m?(m=u.getFirstChild(),u.__first=r,null!==m&&(m=m.getWritable(),m.__prev=r,l.__next=m.__key)):(p=m.getWritable(),w=m.getNextSibling(),p.__next=r,l.__prev=m.__key,null!==w&&(m=w.getWritable(),m.__prev=r,l.__next=m.__key));x===h-1&&(u.__last=r);u.__size++;m=l}else p=K(l),T(p),x--,q++}}for(b=0;b<e;b++)f=d[b],k.has(f)||(c=K(f),f=a.collabNodeMap.get(f),void 0!==f&&f.destroy(a),T(c))}syncPropertiesFromLexical(a,b,c){F(a,this._xmlText,
this.getPrevNode(c),b)}_syncChildFromLexical(a,b,c,d,e,f){b=this._children[b];c=K(c);b instanceof P&&t.$isElementNode(c)?(b.syncPropertiesFromLexical(a,c,d),b.syncChildrenFromLexical(a,c,d,e,f)):b instanceof E&&t.$isTextNode(c)?b.syncPropertiesAndTextFromLexical(a,c,d):b instanceof U&&t.$isDecoratorNode(c)&&b.syncPropertiesFromLexical(a,c,d)}syncChildrenFromLexical(a,b,c,d,e){var f=this.getPrevNode(c);let h=null===f?[]:S(f,c);f=S(b,null);let g=h.length-1,k=f.length-1,n=a.collabNodeMap,q,m,l=0;for(b=
0;l<=g&&b<=k;){var p=h[l];let r=f[b];if(p===r)this._syncChildFromLexical(a,b,r,c,d,e),l++,b++;else{void 0===q&&(q=new Set(h));void 0===m&&(m=new Set(f));var u=m.has(p);p=q.has(r);u?(u=K(r),u=L(a,u,this),n.set(r,u),p?(this.splice(a,b,1,u),l++):this.splice(a,b,0,u),b++):(this.splice(a,b,1),l++)}}c=l>g;d=b>k;if(c&&!d)for(;b<=k;++b)c=f[b],d=K(c),d=L(a,d,this),this.append(d),n.set(c,d);else if(d&&!c)for(f=this._children.length-1;f>=b;f--)this.splice(a,f,1)}append(a){let b=this._xmlText;var c=this._children;
c=c[c.length-1];c=void 0!==c?c.getOffset()+c.getSize():0;if(a instanceof P)b.insertEmbed(c,a._xmlText);else if(a instanceof E){let d=a._map;null===d.parent&&b.insertEmbed(c,d);b.insert(c+1,a._text)}else a instanceof C?b.insertEmbed(c,a._map):a instanceof U&&b.insertEmbed(c,a._xmlElem);this._children.push(a)}splice(a,b,c,d){let e=this._children;var f=e[b];if(void 0===f)void 0===d&&B(94),this.append(d);else{var h=f.getOffset();-1===h&&B(95);var g=this._xmlText;0!==c&&g.delete(h,f.getSize());d instanceof
P?g.insertEmbed(h,d._xmlText):d instanceof E?(f=d._map,null===f.parent&&g.insertEmbed(h,f),g.insert(h+1,d._text)):d instanceof C?g.insertEmbed(h,d._map):d instanceof U&&g.insertEmbed(h,d._xmlElem);if(0!==c)for(h=e.slice(b,b+c),g=0;g<h.length;g++)h[g].destroy(a);void 0!==d?e.splice(b,c,d):e.splice(b,c)}}getChildOffset(a){let b=0,c=this._children;for(let d=0;d<c.length;d++){let e=c[d];if(e===a)return b;b+=e.getSize()}return-1}destroy(a){let b=a.collabNodeMap,c=this._children;for(let d=0;d<c.length;d++)c[d].destroy(a);
b.delete(this._key)}}function M(a,b,c){b=new P(a,b,c);return a._collabNode=b}
function V(a,b){var c=b.collabNodeMap.get(a.key);if(void 0===c)return null;b=a.offset;let d=c.getSharedType();if(c instanceof E){d=c._parent._xmlText;a=c.getOffset();if(-1===a)return null;b=a+1+b}else if(c instanceof P&&"element"===a.type){let e=c=0;for(a=a.getNode().getFirstChild();null!==a&&e++<b;)t.$isTextNode(a)?c+=a.getTextContentSize()+1:c++,a=a.getNextSibling();b=c}return v.createRelativePositionFromTypeIndex(d,b)}
function W(a,b){if(null==a){if(null!=b)return!0}else if(null==b||!v.compareRelativePositions(a,b))return!0;return!1}function X(a,b){a=a.cursorsContainer;if(null!==a){b=b.selections;let c=b.length;for(let d=0;d<c;d++)a.removeChild(b[d])}}
function Y(a,b){var c=b.awareness.getLocalState();if(null!==c&&(b=c.anchorPos,c=c.focusPos,null!==b&&null!==c&&(b=v.createAbsolutePositionFromRelativePosition(b,a.doc),a=v.createAbsolutePositionFromRelativePosition(c,a.doc),null!==b&&null!==a))){let [d,e]=Z(b.type,b.index),[f,h]=Z(a.type,a.index);if(null!==d&&null!==f){b=d.getKey();c=f.getKey();let g=t.$getSelection();t.$isRangeSelection(g)&&(a=g.focus,ba(g.anchor,b,e),ba(a,c,h))}}}
function ba(a,b,c){if(a.key!==b||a.offset!==c){let d=t.$getNodeByKey(b);if(null!==d&&!t.$isElementNode(d)&&!t.$isTextNode(d)){let e=d.getParentOrThrow();b=e.getKey();c=d.getIndexWithinParent();d=e}a.set(b,c,t.$isElementNode(d)?"element":"text")}}function Z(a,b){a=a._collabNode;if(void 0===a)return[null,0];if(a instanceof P){let {node:c,offset:d}=Q(a,b,!0);return null===c?[a,0]:[c,d]}return[null,0]}
function ja(a,b){var c=Array.from(b.awareness.getStates()),d=a.clientID;b=a.cursors;var e=a.editor._editorState._nodeMap;let f=new Set;for(var h=0;h<c.length;h++){let [H,la]=c[h];if(H!==d){f.add(H);let {anchorPos:ca,focusPos:da,name:ma,color:na,focusing:oa}=la;var g=null,k=b.get(H);void 0===k&&(k={color:na,name:ma,selection:null},b.set(H,k));if(null!==ca&&null!==da&&oa){var n=v.createAbsolutePositionFromRelativePosition(ca,a.doc),q=v.createAbsolutePositionFromRelativePosition(da,a.doc);if(null!==
n&&null!==q){let [ea,fa]=Z(n.type,n.index),[ha,ia]=Z(q.type,q.index);if(null!==ea&&null!==ha){n=ea.getKey();var m=ha.getKey();g=k.selection;if(null===g){g=k;q=fa;var l=ia,p=g.color,u=document.createElement("span");u.style.cssText=`position:absolute;top:0;bottom:0;right:-1px;width:1px;background-color:${p};z-index:10;`;var r=document.createElement("span");r.textContent=g.name;r.style.cssText=`position:absolute;left:-2px;top:-16px;background-color:${p};color:#fff;line-height:12px;font-size:12px;padding:2px;font-family:Arial;font-weight:bold;white-space:nowrap;`;
u.appendChild(r);g={anchor:{key:n,offset:q},caret:u,color:p,focus:{key:m,offset:l},name:r,selections:[]}}else q=g.anchor,l=g.focus,q.key=n,q.offset=fa,l.key=m,l.offset=ia}}}a:if(n=a,q=k,u=g,p=e,l=n.editor,g=l.getRootElement(),k=n.cursorsContainer,null!==k&&null!==g&&(g=k.offsetParent,null!==g))if(g=g.getBoundingClientRect(),m=q.selection,null===u)null!==m&&(q.selection=null,X(n,m));else{q.selection=u;q=u.caret;m=u.color;n=u.selections;r=u.anchor;u=u.focus;var w=r.key,A=u.key,x=p.get(w);p=p.get(A);
if(null!=x&&null!=p){if(x===p&&t.$isLineBreakNode(x))p=[l.getElementByKey(w).getBoundingClientRect()];else{p=y.createDOMRange(l,x,r.offset,p,u.offset);if(null===p)break a;p=y.createRectsFromDOMRange(l,p)}u=n.length;l=p.length;for(r=0;r<l;r++)x=p[r],w=n[r],void 0===w&&(w=document.createElement("span"),n[r]=w,A=document.createElement("span"),w.appendChild(A),k.appendChild(w)),x=`position:absolute;top:${x.top-g.top}px;left:${x.left-g.left}px;height:${x.height}px;width:${x.width}px;pointer-events:none;z-index:5;`,
w.style.cssText=x,w.firstChild.style.cssText=`${x}left:0;top:0;background-color:${m};opacity:0.3;`,r===l-1&&q.parentNode!==w&&w.appendChild(q);for(g=u-1;g>=l;g--)k.removeChild(n[g]),n.pop()}}}}c=Array.from(b.keys());for(d=0;d<c.length;d++)e=c[d],f.has(e)||(h=b.get(e),void 0!==h&&(h=h.selection,null!==h&&X(a,h),b.delete(e)))}
function ka(a,b,c,d){b=b.awareness;var e=b.getLocalState();if(null!==e){var {anchorPos:f,focusPos:h,name:g,color:k,focusing:n}=e,q=e=null;if(null!==d&&(null===f||d.is(c))||null!==c)t.$isRangeSelection(d)&&(e=V(d.anchor,a),q=V(d.focus,a)),(W(f,e)||W(h,q))&&b.setLocalState({anchorPos:e,color:k,focusPos:q,focusing:n,name:g})}}let pa=t.createCommand("CONNECTED_COMMAND"),qa=t.createCommand("TOGGLE_CONNECT_COMMAND");exports.CONNECTED_COMMAND=pa;exports.TOGGLE_CONNECT_COMMAND=qa;
exports.createBinding=function(a,b,c,d,e){void 0!==d&&null!==d||B(81);b=d.get("root",v.XmlText);b=M(b,null,"root");b._key="root";return{clientID:d.clientID,collabNodeMap:new Map,cursors:new Map,cursorsContainer:null,doc:d,docMap:e,editor:a,id:c,nodeProperties:new Map,root:b}};exports.createUndoManager=function(a,b){return new v.UndoManager(b,{trackedOrigins:new Set([a,null])})};exports.initLocalState=function(a,b,c,d){a.awareness.setLocalState({anchorPos:null,color:c,focusPos:null,focusing:d,name:b})};
exports.setLocalStateFocus=function(a,b,c,d){({awareness:a}=a);let e=a.getLocalState();null===e&&(e={anchorPos:null,color:c,focusPos:null,focusing:d,name:b});e.focusing=d;a.setLocalState(e)};exports.syncCursorPositions=ja;
exports.syncLexicalUpdateToYjs=function(a,b,c,d,e,f,h,g){aa(a,()=>{d.read(()=>{if(g.has("collaboration")){if(0<h.size){var k=Array.from(h),n=a.collabNodeMap,q=[];for(let u=0;u<k.length;u++){var m=k[u],l=t.$getNodeByKey(m),p=n.get(m);if(p instanceof E)if(t.$isTextNode(l))q.push([p,l.__text]);else{l=p.getOffset();if(-1===l)continue;let r=p._parent;p._normalized=!0;r._xmlText.delete(l,1);n.delete(m);m=r._children;p=m.indexOf(p);m.splice(p,1)}}for(k=0;k<q.length;k++){let [u,r]=q[k];u instanceof E&&"string"===
typeof r&&(u._text=r)}}}else e.has("root")&&(q=c._nodeMap,k=t.$getRoot(),n=a.root,n.syncPropertiesFromLexical(a,k,q),n.syncChildrenFromLexical(a,k,q,e,f)),q=t.$getSelection(),ka(a,b,c._selection,q)})})};
exports.syncYjsChangesToLexical=function(a,b,c){let d=a.editor,e=d._editorState;d.update(()=>{var f=d._pendingEditorState;for(var h=0;h<c.length;h++){var g=a,k=c[h],{target:n}=k;n=O(g,n);if(n instanceof P&&k instanceof v.YTextEvent){let {keysChanged:q,childListChanged:m,delta:l}=k;0<q.size&&n.syncPropertiesFromYjs(g,q);m&&(n.applyChildrenYjsDelta(g,l),n.syncChildrenFromYjs(g))}else n instanceof E&&k instanceof v.YMapEvent?({keysChanged:k}=k,0<k.size&&n.syncPropertiesAndTextFromYjs(g,k)):n instanceof
U&&k instanceof v.YXmlEvent?({attributesChanged:k}=k,0<k.size&&n.syncPropertiesFromYjs(g,k)):B(82)}h=t.$getSelection();if(t.$isRangeSelection(h))if(R(h)){g=e._selection;if(t.$isRangeSelection(g)){n=z.$createOffsetView(d,0,e);f=z.$createOffsetView(d,0,f);let [q,m]=n.getOffsetsFromSelection(g);f=f.createSelectionFromOffsets(q,m,n);null!==f?t.$setSelection(f):(Y(a,b),R(h)&&(f=t.$getRoot(),0===f.getChildrenSize()&&f.append(t.$createParagraphNode()),t.$getRoot().selectEnd()))}ka(a,b,g,t.$getSelection())}else Y(a,
b)},{onUpdate:()=>{ja(a,b)},skipTransforms:!0,tag:"collaboration"})}
