sykpcomposer 0.0.68 → 0.0.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1426,7 +1426,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1426
1426
  animation: ${this.isEditingInProgress?er.tooltipAnimations.hideAtOnce:er.tooltipAnimations.hideWithDelay};
1427
1427
  left: ${n?"0px":"100%"};
1428
1428
  z-index: 10;
1429
- `,A.append(q),_=q}!R&&w.width<1&&r.length>1&&(A.style.width="3px")}v.forEach(x=>{this.hoverList.push([x,_,e])})});this.remoteSelections=[],this.isEditingInProgress=!1,this.hoverList=[],this.trackedNodesKeys=new Set,this.remoteSelectionDOMsMap={},this.activeEditorsKeys={},this.keyboardBindedListener=this._keyboardEventsListener.bind(this),this.mouseBindedListener=this._mouseEventsListener.bind(this),this.resizeBindedListener=this._resizeEventListener.bind(this),this.hideInUI=!1}_mouseEventsListener(d){let p=!1,t=d.target,f=!1,r=3;for(;r&&t;){if(t.__codox_track){p=!0;break}if(t.__lexicalEditor){p=!0,f=!0;break}t=t.parentNode,r--}if(!p)return;let n=null;for(let i in this.activeEditorsKeys){if(t[`__lexicalKey_${i}`]){n=i;break}t.__lexicalEditor&&(n=t.__lexicalEditor._key)}if(!n)return;let e=f?"root":t[`__lexicalKey_${n}`];if(!e||!this.trackedNodesKeys.has(`${e}__${n}`))return;let s=new Set;for(let i=0;i<this.hoverList.length;i++){let l=this.hoverList[i],[o,a,u]=l;if(s.has(u))continue;let c=er.isMousePositionWithinElementCords(d,o);d.type===wr.mouseover&&c&&(a.style.animation=this.isEditingInProgress?er.tooltipAnimations.hideAtOnce:er.tooltipAnimations.showAtOnce,s.add(u)),d.type===wr.mouseout&&(a.style.animation=er.tooltipAnimations.hideWithDelay,s.add(u)),d.type===wr.mousemove&&c&&(a.style.animation=this.isEditingInProgress?er.tooltipAnimations.hideAtOnce:er.tooltipAnimations.showAtOnce,s.add(u))}}_keyboardEventsListener(d){d.type===wr.keypress&&(this.isEditingInProgress||(this.isEditingInProgress=!0)),d.type===wr.keyup&&this.isEditingInProgress&&(this.isEditingInProgress=!1)}_resizeEventListener(d){we.mainEditorExists()&&this.paintRemoteSelections(this.remoteSelections)}mount(){window.addEventListener(wr.keypress,this.keyboardBindedListener),window.addEventListener(wr.keyup,this.keyboardBindedListener),window.addEventListener(wr.resize,this.resizeBindedListener),window.addEventListener(wr.scroll,this.resizeBindedListener);for(const d of M0)window.addEventListener(d,this.mouseBindedListener)}unmount(){window.removeEventListener(wr.keypress,this.keyboardBindedListener),window.removeEventListener(wr.keyup,this.keyboardBindedListener),window.removeEventListener(wr.resize,this.resizeBindedListener),window.removeEventListener(wr.scroll,this.resizeBindedListener);for(const d of M0)window.removeEventListener(d,this.mouseBindedListener);this.gcPrevPaintedRemoteSelections()}shouldUpdateRemoteSelections(){return!0}gcPrevPaintedRemoteSelections(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];for(let p in this.remoteSelectionDOMsMap)this.remoteSelectionDOMsMap[p].remove();this.hoverList=[],this.trackedNodesKeys=new Set,this.remoteSelections=d||[],this.remoteSelectionDOMsMap={},this.activeEditorsKeys={}}paintRemoteSelections(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];this.gcPrevPaintedRemoteSelections(d);let p=we.getMainEditorState();p.read&&p.read(()=>{for(let t of this.remoteSelections)if(ap.validateJSONSelection(t,np.remote))if($e.isNestedSelectionJSON(t)){let{nestedSelectionJSON:f,nestedEditor:r}=$e.getNestedSelectionJSONFromMainSelectionJSON(t);if(!r)continue;r.getEditorState().read(()=>{let n=$e.JSONToLexical(f);if(n)try{this.paintSingleRemoteSelection({editor:r,selectionJSON:t,lexicalSelection:n,selectedNodes:n.getNodes(),isBackward:n.isBackward()})}catch(e){le.warn("[PAINT REMOTE SELECTION] failed for nested editor - ",{error:e,nestedSelectionJSON:f,fullSelection:t,lexicalSelection:n})}else le.error("DEBUGGER: [paintRemoteSelections] nested selection from json to lexical is null: ",{selection:t,nestedSelectionJSON:f,lexicalSelection:n})})}else{let f=$e.JSONToLexical(t);if(!f){le.error("DEBUGGER: [paintRemoteSelections] selection from json to lexical is null: ",{selection:t,lexicalSelection:f});continue}try{this.paintSingleRemoteSelection({editor:we.getMainEditor(),selectionJSON:t,lexicalSelection:f,selectedNodes:f.getNodes(),isBackward:f.isBackward()})}catch(r){le.warn("[PAINT REMOTE SELECTION] failed - ",{error:r,fullSelection:t,lexicalSelection:f})}}})}updateRemoteSelections(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";this.shouldUpdateRemoteSelections(d)&&(le.log("[updateRemoteSelections] "+p,{newRemoteSelections:d}),Promise.resolve().then(()=>{this.paintRemoteSelections(d),this.hideInUI&&this.hideRemoteSelectionsFromUI()}))}clear(){this.gcPrevPaintedRemoteSelections()}getCurrentRemoteSelections(){return this.remoteSelections}hideRemoteSelectionsFromUI(){this.hideInUI||(this.hideInUI=!0);const d=document.querySelectorAll(".codox_remote_selection");for(let p of d)p.classList.add("hidden_codox_remote_selection")}showHiddenRemoteSelectionsInUI(){this.hideInUI=!1;const d=document.querySelectorAll(".hidden_codox_remote_selection");for(let p of d)p.classList.remove("hidden_codox_remote_selection")}}const xo=new aS;function sS(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).findIndex(m=>m===ka.editorState)}function Au(m){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,p=we.getMainEditorNodesClassesMap();const{klass:t}=p.get(m.type)||{};if(!t)return;const f=t.importJSON(m);if(m.children&&m.children.length)for(const r of m.children)Au(r,f);return d&&d.getChildrenSize&&d.splice(d.getChildrenSize(),0,[f]),f}function ju(m){if(m.getChildren)for(let d of m.getChildren())ju(d);m.remove()}function Q0(m){m.__parent=null,m.__next=null,m.__prev=null}function ty(m,d){return!!we.isLexicalEditorInstance(m)&&!(typeof d!="object"||!d.editorState||(m.update(()=>{try{let p=(0,ve.$getSelection)();const t=m.parseEditorState(d.editorState);if(t.isEmpty())return(0,ve.$getRoot)().clear(),!0;(0,ve.$setSelection)(p),m.setEditorState(t)}catch(p){le.error("[stateUpdates][updateNestedEditorState] update nested state and selection error: ",p)}}),0))}function lS(m,d){let p=d;for(const t of m)p=p[t];return p}function Ta(m){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,p=arguments.length>2&&arguments[2]!==void 0&&arguments[2],t=null,f=lS(m,p?d:we.getMainEditorState().toJSON());return f&&(t=Aa(f)?(0,ve.$getRoot)():Pn.get(f.codoxId)),t||le.debug("[WARNING][getLexicalNodeByPathOutOfJSONState] lexical node not found: ",{jsonNode:f,lexicalNode:t,pathArray:m,currentStateJSON:we.getMainEditorState().toJSON(),newStateJSON:d,codoxNodes:Pn.nodesToArray(),searchInNewState:p}),t||(p?t:Ta(m,d,!0))}function ey(m){le.log("[applyFullLexicalStateReplace] clear current state and apply new");const d=(0,ve.$getRoot)();d.clear();let p=we.getMainEditorNodesClassesMap();function t(f){const r=p.get(f.type).klass.importJSON(f);if(f.children)for(const n of f.children)r.append(t(n));return r}for(const f of m.root.children)d.append(t(f))}function cS(m){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(d.length){le.log("[applyDeltasToLexicalState] Original Deltas: ",{newStateJSON:m,deltas:JSON.parse(JSON.stringify(d))});for(const p of d){let{p:t}=p;const f=t[t.length-1],r=f==="children",n=typeof f=="number",e=!n&&!r,s=sS(t),i=s!==-1,l=p.hasOwnProperty("lm")&&typeof p.lm=="number";if(t.length)if(i){let o=s-1,a=Ta(t.slice(0,o),m);if(a){let u=t.slice(0,s),c=m;for(const h of u)c=c[h];let g=Wl(t[o]);ty(a.getWritable()[g],c)}}else{if(r){let o=p.oi;if(!o){le.warn("[applyDeltasToLexicalState][====WARNING====] SKIPPED. Delta oi attr expected for path",{delta:p});continue}if(o.some(u=>!(!u.hasOwnProperty("text")||typeof u.text=="string"))){le.warn("[applyDeltasToLexicalState][====WARNING====] SKIPPED. Delta oi children contain invalid text value",{delta:p});continue}t.length=t.length-1;let a=Ta(t,m);if(!a)continue;if(o.some(u=>!!u.codoxDId)){try{a=a.getWritable()}catch(h){le.debug("[applyDeltasToLexicalState][shouldUpdateLeaves] getWritable error: ",{err:h,delta:p,fullStateJSON:m});continue}let u={};for(let h of a.getChildren())h.codoxDId?u[h.codoxDId]=h:ju(h);let c=[],g=["codoxDId","codoxId","__key","__parent","__prev","__next"];for(let h=0;h<o.length;h++){let y=o[h],v=h===0,_=h===o.length-1,b=null,x=h>=0?c[h-1]:null;if(y.codoxDId){let w=u[y.codoxDId];if(w){w=w.getWritable();let S=Au(y);if(le.debug("[DELTA_DECORATOR_UPDATE]: ",{exisingDecorator:w,tmpDecorator:S}),!S){le.debug("[DELTA_DECORATOR_UPDATE] UPADATE SKIPPED: ",{exisingDecorator:w,tmpDecorator:S});continue}for(let C in S)if(S.hasOwnProperty(C)&&!g.includes(C))if(we.isLexicalEditorInstance(S[C])){let k={editorState:S[C].getEditorState().toJSON()};ty(w[C],k)}else{let k=ep(C),D=y[k];if(D===w[C]||!y.hasOwnProperty(k))continue;let N=D!==void 0&&S[C]!==D?D:S[C];k!=="height"&&k!=="width"||S[C]==="inherit"&&D===0&&(N=S[C]),w[C]=N}S.remove(),Q0(w),b=w,delete u[y.codoxDId]}}b||(b=Au(y),b.codoxDId&&b.__type==="excalidraw"&&b.__data==="[]"&&(b.__data="{}")),b=b.getWritable(),c.push(b),b.__parent=a.__key,v?(a.__first=b.__key,b.__prev=null,_&&(a.__last=b.__key)):_?(a.__last=b.__key,b.__next=null,b.__prev=x.__key,x.__next=b.__key):(b.__prev=x.__key,x.__next=b.__key),a.__size=c.length}for(let h in u){let y=u[h];y=y.getWritable(),Q0(y),ju(y),delete u[h]}}else{let u=o.map(c=>Au(c));a.splice(0,a.getChildrenSize(),u)}}if(n){if(p.ld){const o=p.ld,a=Pn.get(o.codoxId);a.getChildrenSize&&a.getChildrenSize()?ju(a):a.remove()}if(p.li){let o=we.getMainEditorNodesClassesMap();const a=p.li,u=o.get(a.type).klass.importJSON(a);if(t.length===1&&t[0]==="root")(0,ve.$getRoot)().splice(0,0,[u]);else{const c=t[t.length-1];t.length=t.length-2;let g=Ta(t,m);g&&g.splice(c,0,[u])}if(a.children&&a.children.length){let c=function(g,h){const y=o.get(g.type).klass.importJSON(g);if(h.splice(h.getChildrenSize(),0,[y]),g.children&&g.children.length)for(const v of g.children)c(v,y)};for(const g of a.children)c(g,u)}}if(p.oi||p.od){let{p:o,oi:a,od:u}=p,c=Ta(o,m);if(c)try{let g=c.getWritable();if(a){let h=Object.keys(a);for(let y of h)g[Wl(y)]=a[y]}if(u){let h=Object.keys(u);for(let y of h)delete g[Wl(y)]}}catch(g){le.debug("[applyDeltasToLexicalState][delta oi/od] getWritable error: ",{err:g,delta:p})}}if(l){let{p:o,lm:a}=p,u=o[o.length-1],c=a,g=c<u,h=Ta(o,m);if(h){let y=h.getParent().getChildren(),v=y[u],_=y[c];g?_.insertBefore(v):_.insertAfter(v)}}}if(e){const o=t[t.length-1];let a=Wl(o);t.length=t.length-1;let u,c=Ta(t,m);if(!c){le.error("Missing node when update node attr from delta: ",{path:t,delta:p,fullStateJSON:m,currentEditorState:we.getMainEditorState().toJSON()});continue}try{u=c.getWritable()}catch(h){le.debug("[applyDeltasToLexicalState][shouldUpdateBlockAttr] getWritable error: ",{err:h,delta:p})}if(!u)continue;let g=p.oi;if(o==="format"&&(g=lw(g)),o==="direction"&&(c.hasOwnProperty(a)||(a="__dir")),!u.hasOwnProperty(a)){let h=Object.keys(u);for(let y of h){let v=ep(y);if(o.startsWith(v)){a=y;break}}}u[a]=g}}else if(p.oi&&p.oi.root)return ey(p.oi)}}else le.log("[applyDeltasToLexicalState] stop, no deltas: ",d)}function uS(m){let d=m.clipboardData.getData(uw.paste),p=!1;try{d=JSON.parse(d),typeof d=="object"&&d.nodes&&Array.isArray(d.nodes)&&(p=!0)}catch{return!1}if(!p)return!1;if(p){Pn.clearPastedIds();const t=f=>{if(f.codoxId&&Pn.addPastedId(f.codoxId),f.children&&f.children.length)for(const r of f.children)t(r)};for(const f of d.nodes)t(f)}return!1}var dS=m=>{var d={};return on.d(d,m),d};const ny=dS({useCollaborationContext:()=>Sx});var fS=m=>{var d={};return on.d(d,m),d};const $i=fS({LexicalComposerContext:()=>Uf,useLexicalComposerContext:()=>Pr});class ry{constructor(){this.blacklist=Object.keys(D0).reduce((d,p)=>{let t=D0[p];return d[p]=t.reduce((f,r)=>(f[r]=r,f),{}),d},{}),this._isBlacklistedFound=!1,this._clientCallback=null}_shouldSkipNode(d){return d instanceof ve.TextNode||d instanceof ve.ParagraphNode||d instanceof ve.RootNode}setClientCallback(d){this._clientCallback=d}removeClientCallback(){this._clientCallback=null}invokeClientCallback(){this._clientCallback&&this._clientCallback()}trackBlacklisted(d){let p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>2?arguments[2]:void 0;if(sp||p!==Vr.created||this._isBlacklistedFound||!d||!d.__type||this._shouldSkipNode(d))return;let f=t||we.getMainEditorState(),r=d.__type,n=this.blacklist[r];n&&f.read(()=>{let e=d.getParent();for(;e!==null;){let s=e?e.__type:null;if(!s)return;if(n[s])return le.warn("[ContentNestingsWatcher][trackBlacklisted] FOUND: ",{targetNode:d,targetType:r,parent:e,parentType:s,mutationType:p}),void(this._isBlacklistedFound=!0);e=e.getParent()}})}trackBlacklistedInNestedEditor(d){let p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>3?arguments[3]:void 0;if(p!==Vr.created||this._isBlacklistedFound||this._shouldSkipNode(d))return;let f=t.__type,r=d.__type;if(!f||!r)return;let n=this.blacklist[r];n&&n[f]&&(this._isBlacklistedFound=!0,le.warn("[ContentNestingsWatcher][trackBlacklistedInNestedEditor] FOUND: ",{targetNode:d,targetType:r,rootNode:t,rootType:f,mutationType:p}))}isBlacklistedFound(){let d=this._isBlacklistedFound;return d&&(this._isBlacklistedFound=!1),d}}const pS=new ry,Hi=pS,hS=["editorState","prevEditorState","dirtyElements","dirtyLeaves"];function gS(m,d){if(m==null)return{};var p,t,f=mS(m,d);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);for(t=0;t<r.length;t++)p=r[t],d.indexOf(p)>=0||{}.propertyIsEnumerable.call(m,p)&&(f[p]=m[p])}return f}function mS(m,d){if(m==null)return{};var p={};for(var t in m)if({}.hasOwnProperty.call(m,t)){if(d.indexOf(t)>=0)continue;p[t]=m[t]}return p}class yS{constructor(){this.nestedEditorsListenersMap={}}_createNestedEditorUpdatesListener(d,p){let t=!1;return function(f){let{editorState:r,prevEditorState:n,dirtyElements:e,dirtyLeaves:s}=f,i=(gS(f,hS),we.getMainEditor()),l=we.getMainEditorState(),o=r.toJSON(),a=n.toJSON(),u=ip(o,a),c=r._selection,g=n._selection,h=!1,y=null,v=we.isOnlySelectionChanged(e,s),_=d[p];if(le.debug("[NESTED EDITOR LISTENER] invoked: ",{lexicalNode:d,key:d.__key,onlySelectionChanged:v,newEditorStateJSON:o,prevEditorStateJSON:a,isSameState:u,lexicalSelection:c,prevLexicalSelection:g,mainDirtyLeaves:i._dirtyLeaves.size,mainDirtyElements:i._dirtyElements.size,nestedDirtyLeaves:_._dirtyLeaves.size,nestedDirtyElements:_._dirtyElements.size,nestedEditorKey:_._key}),Hi.isBlacklistedFound())return t=!0,le.debug("[NESTED EDITOR LISTENER] BLACKLISTED FOUND - revert to prev state"),we.scanLexicalNodeForNestedEditorAttribute(d)?(_.update(()=>{try{const b=_.parseEditorState(a);if(b.isEmpty())return(0,ve.$getRoot)().clear(),!0;_.setEditorState(b)}catch(b){le.error("[NESTED EDITOR LISTENER] BLACKLISTED FOUND - ROLLBACK ERROR: ",b)}}),void Hi.invokeClientCallback()):void 0;if(t)t=!1;else{if(d.codoxId||d.codoxDId){let b=null;l.read(()=>{b=$e.getNodeAncestorsCodoxIds(d),!d.codoxId&&d.codoxDId&&b.push(d.codoxDId)}),r.read(()=>{let x=ep(p),w=$e.lexicalToJSONNested(c,x,b);y=we.getCurrentNestedSelectionJSON(),h=$e.equalSelectionsJSON(y,w),h||we.setNestedSelectionJSON(w)})}u&&h||i.update(()=>{try{le.debug("[NESTED EDITOR LISTENER] MARKING DIRTY TO TRIGGER UPDATE",{mainTags:i._updateTags,nestedTags:_&&_._updateTags,isSameState:u,isSameSelection:h,onlyNestedSelectionChanged:v,mainDirtyLeaves:i._dirtyLeaves.size,mainDirtyElements:i._dirtyElements.size,nestedDirtyLeaves:_._dirtyLeaves.size,nestedDirtyElements:_._dirtyElements.size,lexicalNode:d,lexicalSelection:c,prevLexicalSelection:g,mainEditorTags:i._updateTags,mainEditorTagsSize:i._updateTags.size}),we.addUpdateTag({fromNestedEditor:!0}),d.markDirty()}catch(b){le.error("[NESTED EDITOR LISTENER] MARKING DIRTY TO TRIGGER UPDATE - ERROR: ",b)}})}}}_isNestedEditorManaged(d){return!!this.nestedEditorsListenersMap[d]}gc(){for(let d in this.nestedEditorsListenersMap)if(!we.getLexicalNodeByKey(d)){let p=this.nestedEditorsListenersMap[d];p&&p(),delete this.nestedEditorsListenersMap[d]}}manageNestedEditorInLexicalNode(d){if(this._isNestedEditorManaged(d.getKey()))return;let p=we.scanLexicalNodeForNestedEditorAttribute(d);if(p){let t=d[p],f=this._createNestedEditorUpdatesListener(d,p),r=[];t._nodes.forEach((s,i,l)=>{let{klass:o}=s,a=t.registerMutationListener(o,u=>{for(let[c,g]of u)if(g===Vr.created){let h=t.getEditorState()._nodeMap.get(c);h&&Hi.trackBlacklistedInNestedEditor(h,g,t.getEditorState(),d)}});r.push(a)});let n=(0,ws.mergeRegister)(t.registerUpdateListener(f),...r),e=d.getKey();this.nestedEditorsListenersMap[e]=n}}gcNestedEditorListenerInLexicalNode(d){let p=d.getKey(),t=this.nestedEditorsListenersMap[p];t&&(t(),delete this.nestedEditorsListenersMap[p])}manageNestedEditorInClonedLexicalNode(d,p){let t=d.getKey();t!==p.getKey()&&this._isNestedEditorManaged(t)&&(this.gcNestedEditorListenerInLexicalNode(d),this.manageNestedEditorInLexicalNode(p))}setNestedEditorSelection(d){let{nestedSelectionJSON:p,nestedEditor:t}=$e.getNestedSelectionJSONFromMainSelectionJSON(d);if(!t)return!1;let f=!0;return t.update(()=>{try{let r=$e.JSONToLexical(p);(0,ve.$setSelection)(r),le.debug("[setNestedEditorSelection]: lexical nested selection: ",r)}catch(r){le.error("[setNestedEditorSelection] set nested selection error: ",r),f=!1}}),f}clearListeners(){for(let d in this.nestedEditorsListenersMap){let p=this.nestedEditorsListenersMap[d];p&&p(),delete this.nestedEditorsListenersMap[d]}}}const vS=new yS,li=vS,bS=function(m){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];try{let p=(0,ve.createEditor)({namespace:"validation",nodes:[...d],onError:e=>{throw e},parentEditor:null});const t=new ry,f=p.parseEditorState(m);if(f.isEmpty())return;p.setEditorState(f);let r=p.getEditorState();const n=r._nodeMap[Symbol.iterator]();for(const e of n){let[s,i]=e;if(i&&(t.trackBlacklisted(i,Vr.created,r),t.isBlacklistedFound()))throw new Error(dw)}}catch(p){throw p}};class _S{constructor(){this.removeCandidateTableKeys=new Set,this.validateTableCandidateKeys=new Set,this.tableFixActions=[]}_scanForCellHeaderState(d,p,t,f){if(p.length<f)return null;let r,n=p.some(s=>s.__headerState===zi.BOTH||s.__headerState===zi.ROW),e=d.some((s,i)=>{if(s.__size<f)return!1;let l=s.getChildAtIndex(t);return!(!l||l.__headerState!==zi.BOTH&&l.__headerState!==zi.COLUMN)});return n&&e?r=zi.BOTH:n&&!e?r=zi.ROW:e&&!n&&(r=zi.COLUMN),r}_isValidCellChildren(d){for(let p of d)if(Ts(p)||!Os(p)&&On(p))return!1;return!0}_createEmptyCell(){let d=(0,Tn.$createTableCellNode)();return d.append((0,ve.$createParagraphNode)()),d}_wrapInvalidCellChildrenIntoParagraph(d){let p=(0,ve.$createParagraphNode)().getWritable(),t=d.getChildren();(d=d.getWritable()).__first=p.__key,d.__last=p.__key,d.__size=1,p.__parent=d.__key,t.forEach((f,r)=>{(f=f.getWritable()).__parent=null,p.append(f)})}_createFixAction_APPEND_CELLS_TO_ROW(d,p){return()=>{le.debug("[TablesValidator][FIX TABLE ACTION - APPEND_CELLS_TO_ROW] invoked: ",{rowKey:d,numOfCellsToAppend:p});let t=(0,ve.$getNodeByKey)(d);for(;p;){let f=(0,Tn.$createTableCellNode)().append((0,ve.$createParagraphNode)());f.setRowSpan(1).setColSpan(1),t.append(f),p--}}}_createFixAction_ADD_PARAGRAPH_TO_EMPTY_CELL(d){return()=>{le.debug("[TablesValidator][FIX TABLE ACTION - ADD_PARAGRAPH_TO_EMPTY_CELL] invoked: ",{cellKey:d}),(0,ve.$getNodeByKey)(d).append((0,ve.$createParagraphNode)())}}_createFixAction_WRAP_CELL_CHILDREN_IN_PARAGRAPH(d){return()=>{le.debug("[TablesValidator][FIX TABLE ACTION - WRAP_CELL_CHILDREN_IN_PARAGRAPH] invoked: ",{cellKey:d});let p=(0,ve.$getNodeByKey)(d);this._wrapInvalidCellChildrenIntoParagraph(p)}}_createFixAction_ADD_ROW_CELL_TO_TABLE_NODE(d){return()=>{le.debug("[TablesValidator][FIX TABLE ACTION - ADD_ROW_CELL_TO_EMPTY_TABLE_NODE] invoked: ",{tableKey:d});let p=(0,ve.$getNodeByKey)(d),t=(0,Tn.$createTableRowNode)();t.append(this._createEmptyCell()),p.append(t)}}_createFixAction_ADD_CELL_TO_EMPTY_ROW_NODE(d,p){return()=>{for(p||(p=1);p;)(0,ve.$getNodeByKey)(d).append(this._createEmptyCell()),p--}}_createFixAction_WRAP_INVALID_ROW_NODE(d,p){return()=>{le.debug("[TablesValidator][FIX TABLE ACTION - WRAP_INVALID_ROW_NODE] invoked: ",{tableKey:d,rowKey:p});let t=(0,ve.$getNodeByKey)(d);if(!t)return;let f=(0,ve.$getNodeByKey)(p);if(!f)return;t=t.getWritable(),f=f.getWritable();let r=f.getPreviousSibling(),n=f.getNextSibling();f.__parent=null,f.__prev=null,f.__next=null;let e=(0,Tn.$createTableRowNode)();if((0,Tn.$isTableCellNode)(f))f.getChildren().length?this._isValidCellChildren()||this._wrapInvalidCellChildrenIntoParagraph(f):f.append((0,ve.$createParagraphNode)()),e.append(f);else{let s=this._isValidCellChildren([f]),i=(0,Tn.$createTableCellNode)();if(e.append(i),s)i.append(f);else{let l=(0,ve.$createParagraphNode)();l.append(f),i.append(l)}}e.__parent=t.__key,t.__first===f.__key&&(t.__first=e.__key),t.__last===f.__key&&(t.__last=e.__key),r&&(r=r.getWritable(),r.__next=e.__key,e.__prev=r.__key),n&&(n=n.getWritable(),n.__prev=e.__key,e.__next=n.__key)}}_createFixAction_WRAP_INVALID_CELL_NODE(d,p){return()=>{le.debug("[TablesValidator][FIX TABLE ACTION - WRAP_INVALID_CELL_NODE] invoked: ",{rowKey:d,cellKey:p});let t=(0,ve.$getNodeByKey)(d);if(!t)return;let f=(0,ve.$getNodeByKey)(p);if(f.remove(),f=(0,ve.$createParagraphNode)(),!f)return;t=t.getWritable(),f=f.getWritable();let r=f.getPreviousSibling(),n=f.getNextSibling(),e=(0,Tn.$createTableCellNode)();if(e.__parent=t.__key,t.__first===f.__key&&(t.__first=e.__key),t.__last===f.__key&&(t.__last=e.__key),r&&(r=r.getWritable(),r.__next=e.__key,e.__prev=r.__key),n&&(n=n.getWritable(),n.__prev=e.__key,e.__next=n.__key),f.__parent=null,f.__prev=null,f.__next=null,this._isValidCellChildren([f]))e.append(f);else{let s=(0,ve.$createParagraphNode)();s.append(f),e.append(s)}}}_createFixAction_APPLY_HEADER_STATE_TO_CELL(d,p){return()=>{le.debug("[TablesValidator][FIX TABLE ACTION - APPLY_HEADER_STATE_TO_CELL] invoked: ",{cellKey:d,headerStateToApply:p});let t=(0,ve.$getNodeByKey)(d);t&&(t=t.getWritable(),t.__headerState=p)}}clear(){this.removeCandidateTableKeys=new Set,this.validateTableCandidateKeys=new Set,this.tableFixActions=[]}tableRemoveEventListener(d){let p=we.getMainEditorState()._selection;if(le.debug(`[${d}]`,{selection:p}),!(0,ve.$isRangeSelection)(p))return;let t=[];try{let f=we.getLexicalNodeByKey(p.anchor.key),r=we.getLexicalNodeByKey(p.focus.key);f&&r&&(t=p.isBackward()?r.getNodesBetween(f):f.getNodesBetween(r))}catch(f){le.warn("[TablesValidator][tableRemoveEventListener] get range selection nodes internal lexical error: ",f)}t.forEach(f=>{(0,Tn.$isTableNode)(f)&&this.removeCandidateTableKeys.add(f.__key)})}tableNodeRemoveListener(d){this.removeCandidateTableKeys.has(d)&&this.removeCandidateTableKeys.delete(d)}shouldGCRemovedTables(){return!!this.removeCandidateTableKeys.size}gcRemovedTables(){le.debug("[TablesValidator][gcRemovedTable] candidate table keys ",{tableKeys:this.removeCandidateTableKeys}),we.getMainEditor().update(()=>{Array.from(this.removeCandidateTableKeys).forEach(d=>{let p=(0,ve.$getNodeByKey)(d);p&&p.remove()}),this.removeCandidateTableKeys.clear(),(0,ve.$addUpdateTag)(oo.historic)})}tableUpdateListener(d){this.validateTableCandidateKeys.add(d)}tableRowNodeChangesListener(d){let p=arguments.length>1&&arguments[1]!==void 0&&arguments[1],t=we.getLexicalNodeByKey(d);if(!t)return void(p&&le.debug("[TablesValidator][tableRowNodeChangesListener] no row node found in lexical: ",{tableRowNodeKey:d}));let f=t.__parent;f?this.validateTableCandidateKeys.add(f):le.debug("[tableRowNodeChangesListener] no parent table for row node found in lexical: ",{rowNode:t})}tableCellNodeChangesListener(d){let p=we.getLexicalNodeByKey(d);if(!p||!p.__parent)return;let t=we.getLexicalNodeByKey(p.__parent);t&&t.__parent&&this.validateTableCandidateKeys.add(t.__parent)}shouldValidateUpdatedTables(){return!!this.validateTableCandidateKeys.size}validateUpdatedTables(){let d=Array.from(this.validateTableCandidateKeys);return we.getMainEditorState().read(()=>{for(let p of d){let t=we.getLexicalNodeByKey(p);if(!t)continue;let f=t.getChildren();if(!f.length){this.tableFixActions.push(this._createFixAction_ADD_ROW_CELL_TO_TABLE_NODE(p));continue}let r=0;f.forEach(i=>{i.__size>r&&(r=i.__size)});let n=[],e=f.map((i,l)=>{if(!(0,Tn.$isTableRowNode)(i))return this.tableFixActions.push(this._createFixAction_WRAP_INVALID_ROW_NODE(p,i.__key)),"invalid_row_node";let o=i.getChildren();if(!o.length&&!n.length)return this.tableFixActions.push(this._createFixAction_ADD_CELL_TO_EMPTY_ROW_NODE(i.__key,r)),"empty_row_should_add_cell";if(!o.length&&n.length)return n=[],"empty_row_should_be_empty";let a=0;if(n.length){let c=[];n.forEach(g=>{let[h,y]=g;a+=y,h--,h&&c.push([h,y])}),n=[...c]}let u=o.map((c,g)=>{if(!(0,Tn.$isTableCellNode)(c))return this.tableFixActions.push(this._createFixAction_WRAP_INVALID_CELL_NODE(i.__key,c.__key)),a++,"invalid_cell_node_should_wrap_in_cell";let h,y=c.getChildren(),v=!y.length;if(v?this.tableFixActions.push(this._createFixAction_ADD_PARAGRAPH_TO_EMPTY_CELL(c.__key)):(h=this._isValidCellChildren(y),h||this.tableFixActions.push(this._createFixAction_WRAP_CELL_CHILDREN_IN_PARAGRAPH(c.__key))),c.__rowSpan>1){let _=c.__rowSpan,b=c.__colSpan;n.push([_-1,b])}if(a+=c.__colSpan,c.__headerState===zi.NO_STATUS){let _=this._scanForCellHeaderState(f,o,g,r);_&&this.tableFixActions.push(this._createFixAction_APPLY_HEADER_STATE_TO_CELL(c.__key,_))}return{cellKey:c.__key,rowKey:i.__key,tableKey:p,colSpan:c.__colSpan,rowSpan:c.__rowSpan,headerState:c.__headerState,childrenAreValid:h,isEmptyCell:v}});if(a<r){let c=r-a;this.tableFixActions.push(this._createFixAction_APPEND_CELLS_TO_ROW(i.__key,c))}return{realRowLength:a,rowKey:i.__key,tableKey:p,cells:u}}),s=!this.tableFixActions.length;le[s?"debug":"warn"](`[TablesValidator][validateUpdatedTables] IS TABLE VALID: ${s}`,{tableNodeKey:p,tableValidationMatrix:e,requiredRowLength:r}),this.validateTableCandidateKeys.delete(p)}}),!this.tableFixActions.length}shouldFixTablesStructure(){return!!this.tableFixActions.length}fixTablesStructure(){if(!this.tableFixActions.length)return;let d=we.getMainEditor();le.log("[TablesValidator][fixTablesStructure]: fix actions to apply - count: ",this.tableFixActions.length),d.update(()=>{for(let p of this.tableFixActions)p();this.tableFixActions=[],(0,ve.$addUpdateTag)(oo.historic)})}ensureDocTablesAreValid(d){return this.shouldGCRemovedTables()?(le.warn("[TablesValidator][GARBAGE COLLECT TABLE NODES AFTER TABLE REMOVAL ATTEMPT]"),this.gcRemovedTables(),!1):!(this.shouldValidateUpdatedTables()&&(le.debug("[TablesValidator][shouldValidateUpdatedTables] invoked"),!this.validateUpdatedTables()))||(le.warn("[TablesValidator][shouldValidateUpdatedTables] INVALID LEXICAL TABLE(S) STRUCTURE FOUND - FIXING",{state:JSON.parse(JSON.stringify(d.toJSON()))}),this.fixTablesStructure(),!1)}}const Io=new _S,xS=["contentChanged"],wS=["state","remoteSelection"];function oy(m,d){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(m);d&&(t=t.filter(function(f){return Object.getOwnPropertyDescriptor(m,f).enumerable})),p.push.apply(p,t)}return p}function Cs(m){for(var d=1;d<arguments.length;d++){var p=arguments[d]!=null?arguments[d]:{};d%2?oy(Object(p),!0).forEach(function(t){SS(m,t,p[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):oy(Object(p)).forEach(function(t){Object.defineProperty(m,t,Object.getOwnPropertyDescriptor(p,t))})}return m}function SS(m,d,p){return(d=ES(d))in m?Object.defineProperty(m,d,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[d]=p,m}function ES(m){var d=CS(m,"string");return typeof d=="symbol"?d:d+""}function CS(m,d){if(typeof m!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var t=p.call(m,d||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(d==="string"?String:Number)(m)}function iy(m,d){if(m==null)return{};var p,t,f=kS(m,d);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);for(t=0;t<r.length;t++)p=r[t],d.indexOf(p)>=0||{}.propertyIsEnumerable.call(m,p)&&(f[p]=m[p])}return f}function kS(m,d){if(m==null)return{};var p={};for(var t in m)if({}.hasOwnProperty.call(m,t)){if(d.indexOf(t)>=0)continue;p[t]=m[t]}return p}const sp={DEBUG:!1,VERSION:"1.0.2",NAME:"@codoxhq/lexical-provider",SDKUI_SOURCE_PATH:"../../../sdkui/dist-production2/codox.bundle.js"}.LOCAL==="true";le.info("MODE: ","production");const OS=m=>async()=>{const{state:d,timestamp:p}=await m();if(!we.isValidJSONState(d))throw new Error("Invalid state received from fetchDocOnNetworkReconnect hook");const{commentThreads:t,root:f}=d,r={content:{comments:t,root:f},timestamp:p};return le.info("[decorateFetchOnReconnctHook] hook invoked: ",{returnObj:r}),r};let Pu=0,ci=null,lp=!1,wo={},cp={};const TS=(0,Gt.forwardRef)((m,d)=>{let{onBlacklistedInsert:p}=m;const t=(0,Gt.useContext)($i.LexicalComposerContext);if(!t)throw new Error("[CodoxCollabPlugin] CodoxCollabPlugin must be inited inside <LexicalComposer> component - LexicalComposerContext is missing");const[f]=(0,$i.useLexicalComposerContext)(),r=(0,ny.useCollaborationContext)();(0,Gt.useEffect)(()=>{if(le.debug("[INIT] lexical context check: ",{lexicalContext:t,editor:f}),!f)return;le.log("[useEffect][editor] Editor instance changed: ",{editor:f,key:f._key}),we.setMainEditor(f),Pn.gcAbandonedNodes(),li.gc(),Io.clear(),le.log("[useEffect][editor] subscribe to editor changes");const v=(0,ws.mergeRegister)(f.registerUpdateListener(g),f.registerCommand(ve.PASTE_COMMAND,uS,ve.COMMAND_PRIORITY_CRITICAL),f.registerCommand(ve.UNDO_COMMAND,()=>{we.setUndoInvoked(!0)},ve.COMMAND_PRIORITY_CRITICAL),f.registerCommand(ve.REDO_COMMAND,()=>{we.setRedoInvoked(!0)},ve.COMMAND_PRIORITY_CRITICAL),f.registerCommand(ve.KEY_DELETE_COMMAND,(b,x)=>{Io.tableRemoveEventListener("KEY_DELETE_COMMAND")},ve.COMMAND_PRIORITY_CRITICAL),f.registerCommand(ve.KEY_BACKSPACE_COMMAND,(b,x)=>{Io.tableRemoveEventListener("KEY_BACKSPACE_COMMAND")},ve.COMMAND_PRIORITY_CRITICAL),f.registerCommand(ve.CUT_COMMAND,(b,x)=>{Io.tableRemoveEventListener("CUT_COMMAND")},ve.COMMAND_PRIORITY_CRITICAL),...h());xo.mount(),we.alignStateSelectionJSONsFromLatestEditor(),le.debug("New editor mounted: ",{isCodoxStarted:we.isCodoxStarted,codoxLexicalEditorManager:we,nestedEditorsProcessor:li});let _=f._onError;return f._onError=b=>{le.error("[ERROR HANDLER WRAPPER] error from editor: ",b),_&&_(b),c()},p&&Hi.setClientCallback(p),()=>{we.getMainEditorKey()&&(le.debug("Unmount prev editor"),v(),we.removeMainEditor(),xo.unmount(),we.clearJSONs(),kn.clear(),Io.clear(),we.isCodoxStarted&&(le.debug("EDITOR USE_EFFECT stopping codox"),n(),we.setIsCodoxStarted(!1)),Hi.removeClientCallback())}},[f]);const n=()=>{we.isCodoxStarted&&(le.log("[stopCodoxInstance] stopping codox"),we.setIsCodoxStarted(!1),sp||ei().stop(),we.clearJSONs(),Pn.clearAll(),xo.clear(),kn.resetComments(),li.clearListeners())},e=async v=>{le.debug("[startCodoxInstance] invoked"),ei().createNewInstance(),le.debug("[startCodoxInstance] instance created");for(let O in cp)ei().instance.on(O,cp[O]);if(le.debug("[startCodoxInstance] events subscribed"),wo=v,ci=wo.docId,!ci)return le.error("[startCodoxInstance] - start codox skipped - docId is missing",{docId:ci});let _=kn.initialCommentsExist();le.debug("[startCodoxInstance] initCommentsExist: ",_),_&&(kn.activateInitialComments(f,Pn),le.log("[activateInitialComments] "));let b=we.getMainEditorState().toJSON();if(!we.isValidJSONState(b))throw le.error("[startCodoxInstance] - start codox skipped - invalid init state",{docId:ci,initJSONState:b}),new Error("start codox skipped - invalid init state");le.log("[startCodoxInstance] starting codox with: ",{docId:ci,initJSONState:b,config:wo,codoxComments:kn}),we.currentContentStateJSON||we.setCurrentContentStateJSON(b),we.isCodoxStarted&&n();let{username:x,apiKey:w,getServerState:S,domain:C="",demo:k=!1,hooks:D}=wo;D&&D.fetchDocOnNetworkReconnect&&(D.fetchDocOnNetworkReconnect=OS(D.fetchDocOnNetworkReconnect));const N=iy(D,xS);await ei().start(ei().createConfig(Cs(Cs({},wo),{},{docId:ci,username:x,apiKey:w,domain:C,hooks:Cs({syncState:l,getState:i,getServerState:async()=>await S(ci)},N),editorInstanceHooks:{getSelection:()=>we.getCurrentActiveSelectionJSON(),setSelection:O=>o(O),getState:i,setState:O=>{const{root:R,comments:A}=O;le.info("DEBUG: EDITOR INSTANCE setState:",{fullState:O}),a({state:{root:R},selection:we.getCurrentActiveSelectionJSON()},xo.getCurrentRemoteSelections()),kn.setAllComments(A)},enableEditor:()=>{we.disableEditorReadOnlyMode()},disableEditor:()=>{we.enableEditorReadOnlyMode(),xo.updateRemoteSelections([])},getContent:()=>{let O=we.composeFullStateWithRootAndComments();return le.info("[getContent]: ",O),{state:O}}},appServer:wo.appServer,demo:k}))),le.log("[startCodoxInstance] codox started - first sync invoking"),we.setIsCodoxStarted(!0),r.clientID=wo.username,r.name=wo.username,u()},s=()=>{let v=we.composeFullStateWithRootAndComments({directlyFromEditor:!0});e(v)},i=()=>({state:Cs(Cs({},we.getMainEditorState().toJSON()),{},{comments:kn.getAllComments()}),docId:ci}),l=v=>{if(!we.isCodoxStarted)return;le.log("[SYNC_STATE]: Before sync payload = ",v);const _=ei().sync({meta:v}),{state:b,remoteSelection:x=[]}=_,w=iy(_,wS);if(le.log("[SYNC_STATE]: After sync",{state:b,remoteSelection:x,rest:w}),!b)return le.error("[SYNC_STATE] abort apply - synced state is not valid - restarting codox"),s();const S=b.state;le.log("[SYNC_STATE] synced state: ",{synced:JSON.parse(JSON.stringify(S))});let{stateFromSync:C,commentsFromSync:k}=we.extractStateAndCommentsFromSynced(S);if(!we.isValidJSONState(C.state))return le.error("[SYNC_STATE] - invalid state from sync - local update skipped - restarting codox",{contentState:C.state}),s();a(C,x),kn.setAllComments(k)},o=v=>{if(!we.isCodoxStarted||(le.log("[setLocalSelectionFromSync] synced selection: ",{syncedSelectionJSON:v}),!ap.validateJSONSelection(v,np.local)))return;let _=we.getCurrentActiveSelectionJSON();if($e.equalSelectionsJSON(_,v))return void le.log("[setLocalSelectionFromSync] STOP - local and synced selections are equal");let b=$e.isNestedSelectionJSON(v);f.update(()=>{le.log("[setLocalSelectionFromSync] json selection to apply: ",{syncedSelectionJSON:v});const x=$e.JSONToLexical(v);if(le.log("[setLocalSelectionFromSync] lexical selection to apply: ",x),b){let w=li.setNestedEditorSelection(v);we.setNestedSelectionJSON(w?v:null)}else(0,ve.$setSelection)(x),we.setMainSelectionJSON(v);le.log("[setLocalSelectionFromSync] selection updated. latest selection: ",{latestSelectionJSON:we.getCurrentActiveSelectionJSON()})})},a=function(){let{state:v,selection:_,stateReplace:b}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",S=we.getCurrentContentStateJSON();le.log("[updateEditor] invoked: ",{currentContentStateJSON:JSON.parse(JSON.stringify(S)),newStateJSON:JSON.parse(JSON.stringify(v)),newSelectionJSON:_,remoteSelection:x,stateReplace:b,editor:f}),_===void 0&&le.error("SELECTION FROm SYNC IS UNDEFINED - will default prev selection",_);const C=ip(S,v),k=$e.equalSelectionsJSON(we.getCurrentActiveSelectionJSON(),_);f.update(()=>{if(we.addUpdateTag({isSameState:C,isSameSelection:k,updateTag:w}),b)le.log("[updateEditor] invoke full stateReplace after sync"),ey(v),S=we.setCurrentContentStateJSON(v),(0,ve.$addUpdateTag)("codox_sync_state_changes"),le.log("[updateEditor] state updated: ",S);else{le.log("[updateEditor] invoke deltas diff");let N=ei().diff(S,v,{keyNames:{default:"codoxId"}});le.log("JSON_DIFF_ANALYSIS: ",{currentContentStateJSON:JSON.parse(JSON.stringify(S)),newStateJSON:v,deltas:N&&JSON.parse(JSON.stringify(N))}),N&&N.length&&(le.log("[updateEditor] apply deltas to lexical state"),cS(v,N),S=we.setCurrentContentStateJSON(v),(0,ve.$addUpdateTag)("codox_sync_state_changes"),le.log("[updateEditor] state updated: ",S))}let D=$e.isNestedSelectionJSON(_);if(ap.validateJSONSelection(_,np.local)||(_=we.getCurrentActiveSelectionJSON()),D){let N=li.setNestedEditorSelection(_);we.setNestedSelectionJSON(N?_:null),le.log("[updateEditor] nested selection updated",N?_:null)}else if(_!==void 0){const N=$e.JSONToLexical(_);le.log("[updateEditor] updated selection to apply: ",{isSameSelection:k,newSelectionJSON:_,lexicalSelection:N}),(0,ve.$setSelection)(N),we.setMainSelectionJSON(_),le.log("[updateEditor] selection updated",_)}},{onUpdate:()=>{C||xo.updateRemoteSelections(x,"from onUpdate hook")}}),C&&xo.updateRemoteSelections(x,"from direct updateEditor")},u=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(!we.isCodoxStarted)return;le.log("[invokeSync] SYNC INVOKED ",{upd_call_counter:v});let _=we.composeFullStateWithRootAndComments();const b={docId:ci,state:{state:_,selection:we.getCurrentActiveSelectionJSON()}};le.log("[codoxSync]: Before sync",{local:b,upd_call_counter:v}),le.log("[codoxSync]: Before sync state",JSON.parse(JSON.stringify(b.state)));let{state:x,remoteSelection:w=[],changes:S}=ei().sync({state:b,meta:{}});if(le.log("[codoxSync]: After sync",{afterSyncState:JSON.parse(JSON.stringify(x)),remoteSelection:w,changes:S}),!x)return le.error("[codoxSync] abort apply - synced state is not valid - restarting codox "),s();const C=x.state;le.log("[codoxSync]: synced state: ",JSON.parse(JSON.stringify(C)),v);let{stateFromSync:k,commentsFromSync:D}=we.extractStateAndCommentsFromSynced(C);if(!we.isValidJSONState(k.state))return le.error("[invokeSync] - invalid state from sync - local update skipped - restarting codox",{contentState:k.state}),s();a(k,w),kn.setAllComments(D)},c=()=>{le.warn("[rollbackStateDuringUpdateError] rollback invoked"),le.log("[rollbackStateDuringUpdateError] values: ",{prevState:we.getPrevContentStateJSON(),currentState:we.getCurrentContentStateJSON(),prevSelection:we.getPrevMainSelectionJSON(),currentSelection:we.getCurrentActiveSelectionJSON(),codoxComments:kn});let v=we.getPrevContentStateJSON(),_=we.getPrevMainSelectionJSON();a({state:v,selection:_},xo.getCurrentRemoteSelections(),oo.historic);let b=we.undoInvoked(),x=we.redoInvoked();kn.gcAbandonedNodeKeys(we.getMainEditorState()._nodeMap),b&&f.dispatchCommand(ve.CAN_REDO_COMMAND,!1),x&&f.dispatchCommand(ve.CAN_UNDO_COMMAND,!1)},g=v=>{let{editorState:_,prevEditorState:b,tags:x,dirtyElements:w,dirtyLeaves:S}=v;if(lp)return lp=!1,void le.debug("[editorUpdatesListener] invoked blacklisted queued selection change - stop");if(Hi.isBlacklistedFound())return lp=!0,le.warn("[editorUpdatesListener] BLACKLISTED CHANGES FOUND - revert back to prev state"),((V,K)=>{let z=null,F=null;K.read(()=>{z=$e.lexicalToJSON(K._selection),F=K.toJSON()});let T=null,P=null;V.read(()=>{let L=(0,ve.$getSelection)();P=$e.lexicalToJSON(L),T=V.toJSON()}),we.setCurrentContentStateJSON(T),we.setMainSelectionJSON(P),a({state:F,selection:z},xo.getCurrentRemoteSelections(),oo.historic),f.dispatchCommand(ve.CAN_REDO_COMMAND,!1),f.dispatchCommand(ve.CAN_UNDO_COMMAND,!1)})(_,b),void Hi.invokeClientCallback();if(!Io.ensureDocTablesAreValid(_))return;Pu++,le.log("[editorUpdatesListener] invoked by lexical. call counter: ",{upd_call_counter:Pu,isCodoxStarted:we.isCodoxStarted});let C=we.isOnlySelectionChanged(w,S),k=null,D=null,N=null,O=null,R=we.getCurrentContentStateJSON(),A=x.has("codox_sync_state_changes"),$=x.has(Jl),q=we.undoInvoked(),H=we.redoInvoked(),M=we.canUndo(),W=we.canRedo();k=_.toJSON(),D=b.toJSON(),b.read(()=>{O=$e.lexicalToJSON(b._selection)}),_.read(()=>{let V=(0,ve.$getSelection)();N=$e.lexicalToJSON(V);let K=$e.JSONToLexical(N),z=V===null&&K===null||V.is(K);le.log("[editorUpdatesListener] new values: ",{newContentStateJSON:k,currentContentStateJSON:JSON.parse(JSON.stringify(R)),prevContentStateJSON:JSON.parse(JSON.stringify(D)),currentCommentsJSON:JSON.parse(JSON.stringify(kn.getAllComments())),newSelectionJSON:JSON.parse(JSON.stringify(N)),currentMainSelectionJSON:JSON.parse(JSON.stringify(we.getCurrentMainSelectionJSON())),currentNestedSelectionJSON:JSON.parse(JSON.stringify(we.getCurrentNestedSelectionJSON())),currentActiveSelectionJSON:JSON.parse(JSON.stringify(we.getCurrentActiveSelectionJSON())),lexicalSelection:V,convertedBackMainSelection:K,isMainSelectionConvertionCorrect:z,nodes:f._editorState._nodeMap,fullEditor:f,codoxNodesMap:Pn.toArray(),codoxComments:kn,isUpdateFromSync:A,isUpdateFromComments:$,tags:x,onlySelectionChanged:C,undoInvoked:q,redoInvoked:H,canUndo:M,canRedo:W})});let G=ip(R,k),I=$e.equalSelectionsJSON(we.getCurrentActiveSelectionJSON(),N);le.log("[editorUpdatesListener] compares: ",{isStateSame:G,isSelectionSame:I});let U=G&&I&&!$;if(!G||$||A){let V=Cs({},G?R:k),K=kn.getAllComments();K.length&&(V.commentThreads=K);let z={source:A?L0.remote:L0.local,content:V};wo.hooks&&wo.hooks.contentChanged&&wo.hooks.contentChanged(z),ei().instance.emit("content_changed",z)}if(U)le.log("[editorUpdatesListener] STOP - state and selection and comments are same ",Pu);else if(we.undoInvoked()&&we.setUndoInvoked(!1),we.redoInvoked()&&we.setRedoInvoked(!1),we.setCurrentContentStateJSON(k),we.setPrevContentStateJSON(D),we.setMainSelectionJSON(N),we.setPrevMainSelectionJSON(O),sp){let V=we.getCurrentActiveSelectionJSON();a({state:we.getCurrentContentStateJSON(),selection:V},[])}else u(Pu)},h=()=>{let v=[];return we.getMainEditorNodesClassesMap().forEach((_,b,x)=>{let{klass:w}=_,S=f.registerMutationListener(w,C=>{for(let[k,D]of C){if(!Vr[D])continue;const N=we.getLexicalNodeByKey(k);if(D===Vr.created&&N&&Hi.trackBlacklisted(N,D),w.name===Tn.TableNode.name&&(D===Vr.destroyed?Io.tableNodeRemoveListener(k):Io.tableUpdateListener(k)),w.name===Tn.TableRowNode.name&&D!==Vr.destroyed&&Io.tableRowNodeChangesListener(k,D===Vr.updated),w.name===Tn.TableCellNode.name&&D===Vr.updated&&Io.tableCellNodeChangesListener(k),w.name===ro.MarkNode.name&&(le.debug("[MUTATION LISTENER] MARK node: ",{nodeKey:k,node:N,mutationType:D,codoxComments:kn}),D===Vr.destroyed?kn.removeRelatedNodeKey(k):N&&kn.addRelatedNodeKey(N.__key,N.__ids,D===Vr.created)),N&&N.codoxId){if(D===Vr.destroyed)return void(N.codoxId&&Pn.remove(N.codoxId));py(N)||le.warn("[MutationListener Error] duplicating codoxId detected - such codoxId already exists in codoxNodesMap - updating node ref to latest: ",{mutationType:D,node:N}),Pn.add(N.codoxId,N)}}v.push(S)})}),v},y={start:e,stop:n,on:(v,_)=>{le.info(`Subscribing client to codox ${v} event`),cp[v]=_},cursor:{hide:()=>{xo.hideRemoteSelectionsFromUI()},show:()=>{xo.showHiddenRemoteSelectionsInUI()}},initComments:v=>{kn.setInitialComments(v)}};return(0,Gt.useImperativeHandle)(d,()=>y),null}),AS=TS,jS=["comments"];function ay(m,d){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(m);d&&(t=t.filter(function(f){return Object.getOwnPropertyDescriptor(m,f).enumerable})),p.push.apply(p,t)}return p}function up(m){for(var d=1;d<arguments.length;d++){var p=arguments[d]!=null?arguments[d]:{};d%2?ay(Object(p),!0).forEach(function(t){PS(m,t,p[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):ay(Object(p)).forEach(function(t){Object.defineProperty(m,t,Object.getOwnPropertyDescriptor(p,t))})}return m}function PS(m,d,p){return(d=NS(d))in m?Object.defineProperty(m,d,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[d]=p,m}function NS(m){var d=IS(m,"string");return typeof d=="symbol"?d:d+""}function IS(m,d){if(typeof m!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var t=p.call(m,d||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(d==="string"?String:Number)(m)}function RS(m,d){if(m==null)return{};var p,t,f=MS(m,d);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);for(t=0;t<r.length;t++)p=r[t],d.indexOf(p)>=0||{}.propertyIsEnumerable.call(m,p)&&(f[p]=m[p])}return f}function MS(m,d){if(m==null)return{};var p={};for(var t in m)if({}.hasOwnProperty.call(m,t)){if(d.indexOf(t)>=0)continue;p[t]=m[t]}return p}class DS extends R0{constructor(){super(),this.mainEditor=null,this.mainEditorKey=null,this.currentContentStateJSON=null,this.currentMainSelectionJSON=null,this.currentNestedSelectionJSON=null,this._isCodoxStarted=!1,this.prevContentStateJSON=null,this.prevMainSelectionJSON=null,this._undoInvoked=!1,this._redoInvoked=!1,this._canUndo=!1,this._canRedo=!1}setCanUndo(d){this._canUndo=d}setCanRedo(d){this._canRedo=d}canUndo(){return this._canUndo}canRedo(){return this._canRedo}setUndoInvoked(d){this._undoInvoked=d}setRedoInvoked(d){this._redoInvoked=d}undoInvoked(){return this._undoInvoked}redoInvoked(){return this._redoInvoked}setIsCodoxStarted(){let d=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this._isCodoxStarted=d}get isCodoxStarted(){return this._isCodoxStarted}getMainEditorKey(){return this.mainEditorKey}setMainEditor(d){this.mainEditor=d,this.mainEditorKey=d._key}clearJSONs(){le.debug("[CodoxLexicalEditorManager][clearJSONs] invoked"),this.currentContentStateJSON=null,this.currentMainSelectionJSON=null,this.currentNestedSelectionJSON=null,this.prevContentStateJSON=null,this.prevMainSelectionJSON=null}removeMainEditor(){this.mainEditor=null,this.mainEditorKey=null,this._undoInvoked=!1,this._redoInvoked=!1,this._canUndo=!1,this._canRedo=!1,super.clear()}getMainEditor(){return this.mainEditor}alignStateSelectionJSONsFromLatestEditor(){this.getMainEditorState().read(()=>{this.setCurrentContentStateJSON(this.getMainEditorState().toJSON()),this.setMainSelectionJSON($e.lexicalToJSON((0,ve.$getSelection)()))})}mainEditorExists(){return!!this.mainEditor}getMainEditorState(){return this.mainEditor?this.mainEditor.getEditorState():{}}getMainEditorNodesClassesMap(){return this.mainEditor?this.mainEditor._nodes:new Map}getLexicalNodeByKey(d){return this.mainEditor?this.getMainEditorState()._nodeMap.get(d):null}isLexicalEditorInstance(d){return d&&typeof d=="object"&&!!d.setEditorState}setCurrentContentStateJSON(d){return this.currentContentStateJSON=d,this.currentContentStateJSON}getCurrentContentStateJSON(){return this.currentContentStateJSON}setPrevContentStateJSON(d){this.prevContentStateJSON=d}getPrevContentStateJSON(){return this.prevContentStateJSON}setMainSelectionJSON(d){this.currentMainSelectionJSON=d,this.currentMainSelectionJSON&&this.currentNestedSelectionJSON&&(this.currentNestedSelectionJSON=null)}setNestedSelectionJSON(d){this.currentNestedSelectionJSON=d,this.currentNestedSelectionJSON&&this.currentMainSelectionJSON&&(this.currentMainSelectionJSON=null)}getCurrentMainSelectionJSON(){return this.currentMainSelectionJSON}getCurrentNestedSelectionJSON(){return this.currentNestedSelectionJSON}getCurrentActiveSelectionJSON(){return!this.currentMainSelectionJSON&&this.currentNestedSelectionJSON?this.currentNestedSelectionJSON:this.currentMainSelectionJSON}clearSelectionJSON(){this.currentMainSelectionJSON=null,this.currentNestedSelectionJSON=null}setPrevMainSelectionJSON(d){this.prevMainSelectionJSON=d}getPrevMainSelectionJSON(){return this.prevMainSelectionJSON}extractStateAndCommentsFromSynced(d){let{state:{comments:p},selection:t,stateReplace:f}=d;return{stateFromSync:{state:up({},RS(d.state,jS)),selection:t,stateReplace:f},commentsFromSync:p}}composeFullStateWithRootAndComments(){let{directlyFromEditor:d=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return up(up({},d?this.getMainEditorState().toJSON():this.currentContentStateJSON),{},{comments:kn.getAllComments()})}isValidJSONState(d){let p=!1;try{if(!d)throw new Error("State is undefined");if(!d.root)throw new Error("State 'root' node is missing");let t=this.getMainEditorNodesClassesMap(),f=function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",e=r,s=t.get(e.type);if(!s)throw new Error(`Node with type "${e.type}" is not registered in editor`);let{klass:i}=s;if(n==="root"){let l=i.prototype instanceof ve.ElementNode,o=i.prototype instanceof ve.DecoratorNode;if(!l&&!o)throw new Error("State root node can have only element nodes as children")}if(e.children)for(let l of e.children)f(l,e.type)};f(d.root),p=!0}catch(t){le.error("[isValidJSONState] invalid state found: ",t.message),p=!1}return p}scanLexicalNodeForNestedEditorAttribute(d){for(let p in d){let t=d[p];if(this.isLexicalEditorInstance(t))return p}return""}isOnlySelectionChanged(d,p){return d.size===0&&p.size===0}addUpdateTag(){let{isSameState:d,isSameSelection:p,fromNestedEditor:t=!1,updateTag:f=""}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return f?(le.log(`[addUpdateTag] explicit add of tag "${f}" `),void(0,ve.$addUpdateTag)(f)):t?(le.log(`[addUpdateTag] add "${oo.historic}" tag - change invoked by nested editor`),void(0,ve.$addUpdateTag)(oo.historic)):void(d?(le.log(`[addUpdateTag] add "${oo.historic}" tag - state is same`),(0,ve.$addUpdateTag)(oo.historic)):(le.log(`[addUpdateTag] add "${oo.historyMerge}" tag - state is different`),(0,ve.$addUpdateTag)(oo.historyMerge)))}enableEditorReadOnlyMode(){this.mainEditor&&this.mainEditor.isEditable()&&this.mainEditor.setEditable(!1)}disableEditorReadOnlyMode(){this.mainEditor&&(this.mainEditor.isEditable()||this.mainEditor.setEditable(!0))}}const LS=new DS,we=LS;class BS{constructor(){this._nodesMap=new Map,this._pastedNodesCodoxIds=new Set}get size(){return this._nodesMap.size}add(d,p){this._nodesMap.set(d,p)}get(d){return this._nodesMap.get(d)||null}remove(d){this._nodesMap.delete(d)}has(d){return this._nodesMap.has(d)}nodesToArray(){return Array.from(this._nodesMap.values())}keysToArray(){return Array.from(this._nodesMap.keys())}toArray(){return Array.from(this._nodesMap.entries())}addPastedId(d){this._pastedNodesCodoxIds.add(d)}removePastedId(d){this._pastedNodesCodoxIds.delete(d)}hasPastedId(d){return this._pastedNodesCodoxIds.has(d)}clearPastedIds(){this._pastedNodesCodoxIds.size>0&&this._pastedNodesCodoxIds.clear()}isEmptyPastedIds(){return this._pastedNodesCodoxIds.size===0}getPastedIdsSize(){return this._pastedNodesCodoxIds.size}clearAll(){this._nodesMap.clear(),this._pastedNodesCodoxIds.clear()}gcAbandonedNodes(){let d=we.getMainEditorState();if(!d._nodeMap)return;let p=this.nodesToArray();for(let t of p)d._nodeMap.has(t.__key)||this.remove(t.codoxId)}}const FS=new BS,Pn=FS;function sy(m,d){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(m);d&&(t=t.filter(function(f){return Object.getOwnPropertyDescriptor(m,f).enumerable})),p.push.apply(p,t)}return p}function ly(m){for(var d=1;d<arguments.length;d++){var p=arguments[d]!=null?arguments[d]:{};d%2?sy(Object(p),!0).forEach(function(t){zS(m,t,p[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):sy(Object(p)).forEach(function(t){Object.defineProperty(m,t,Object.getOwnPropertyDescriptor(p,t))})}return m}function zS(m,d,p){return(d=US(d))in m?Object.defineProperty(m,d,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[d]=p,m}function US(m){var d=$S(m,"string");return typeof d=="symbol"?d:d+""}function $S(m,d){if(typeof m!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var t=p.call(m,d||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(d==="string"?String:Number)(m)}const dp=()=>Yx(),cy=m=>typeof m=="number";function ks(m){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const p=function(){for(var t=arguments.length,f=new Array(t),r=0;r<t;r++)f[r]=arguments[r];return m.apply(this,f)};return Object.defineProperty(p,"name",{value:d,writable:!0}),p}const Aa=m=>m.__type==="root"||m.type==="root",uy=m=>Aa(m.getParent()),qn=m=>m.__type===Cu.text||m.type===Cu.text||m.hasOwnProperty("__text")||m.hasOwnProperty("text"),Os=m=>(0,ve.$isElementNode)(m),Ts=m=>(0,Tn.$isTableNode)(m)||(0,Tn.$isTableRowNode)(m)||(0,Tn.$isTableCellNode)(m),HS=m=>!m.getChildren,dy=m=>!!m.getChildren,On=m=>(0,ve.$isDecoratorNode)(m),Kl=m=>(0,$x.$isLinkNode)(m),Gl=m=>m.__type==="mark"||m.type==="mark",fp=m=>(0,ve.$isLineBreakNode)(m),qi=m=>qn(m)||fp(m),pp=m=>m.__type===Cu.horizontalrule||m.type===Cu.horizontalrule,fy=m=>{if(qi(m)||Kl(m)||Gl(m))return!1;if(!m.__parent||m.__parent==="root"||(0,ve.$isParagraphNode)(m))return!0;let d=m.getParent().getChildren();return d.length===1&&d[0].__key===m.__key?!((On(m)||Kl(m)||Gl(m))&&!pp(m)):!d.some(p=>{let t=pp(p);return p.__key!==m.__key&&(qi(p)||On(p)&&!t||Kl(p)||Gl(p))})},py=m=>{const d=Pn.get(m.codoxId);return!d||m.__key===d.__key},As=function(m){const d=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:null)||dp();m.codoxId=d,Pn.add(d,m)},hy=m=>{Pn.remove(m.codoxId),delete m.codoxId},qS=m=>{if(!dy(m)||!m.getChildrenSize())return;const d=m.getChildren();if(d.some(f=>!!(0,ve.$isParagraphNode)(f)))return;let p=!1,t=[];for(let f of d)(qi(f)||On(f)||Kl(f)||Gl(f))&&!p&&(pp(f)||(p=!0)),(dy(f)||On(f))&&t.push(f);for(let f of t)p||f.codoxId?p&&f.codoxId&&(f=f.getWritable(),hy(f)):(f=f.getWritable(),As(f))},WS=m=>{const d=ly({},m);for(const p in m)m[p]===void 0&&m.hasOwnProperty(p)&&delete d[p];return d},JS=m=>{const d=`__nativeCreateDOM_${m.name}`;m.prototype[d]=ks(m.prototype.createDOM,d),m.prototype.createDOM=function(p,t){if(fy(this))if(this.codoxId){if(!py(this)){let r=Pn.get(this.codoxId);r.__type===this.__type&&this.isAttached()&&!r.isAttached()?(le.warn("[createDOM][Non-unique codoxId] overwrite abandoned existing node with latest: ",{latestNode:this,existingNode:r}),Pn.add(this.codoxId,this)):As(this)}}else As(this);else this.codoxId&&hy(this);On(this)&&!this.codoxDId&&(this.codoxDId=dp()),li.manageNestedEditorInLexicalNode(this);let f=this[d](p,t);return f.__codox_track=!0,f}},VS=m=>{const d=`__nativeUpdateDOM_${m.name}`;return m.prototype[d]=ks(m.prototype.updateDOM,d),m.prototype.updateDOM=function(){const p=this[d](...arguments);return qS(this),p},m},KS=m=>{const d=`__nativeRemove_${m.name}`;return m.prototype[d]=ks(m.prototype.remove,d),m.prototype.remove=function(){const p=this.codoxId;return p&&Pn.remove(p),li.gcNestedEditorListenerInLexicalNode(this),this[d](...arguments)},m},GS=m=>{const d=`__nativeExportJSON_${m.name}`;m.prototype[d]=ks(m.prototype.exportJSON,d),m.prototype.exportJSON=function(){const p=this[d]();return this.codoxId&&(p.codoxId=this.codoxId),this.codoxDId&&(p.codoxDId=this.codoxDId),qn(this)&&cy(p.format)&&this.hasFormat&&(p.format=sw(this)),WS(p)}},YS=m=>{const d="__nativeImportJSON";m[d]=ks(m.importJSON,d),m.importJSON=function(p){const t=ly({},p);qn(t)&&!cy(t.format)&&(t.format=aw(t.format));const f=m[d](t);li.manageNestedEditorInLexicalNode(f);const r=fy(f);return r&&t.codoxId&&(Pn.hasPastedId(t.codoxId)&&Pn.has(t.codoxId)?(Pn.removePastedId(t.codoxId),As(f)):As(f,t.codoxId)),r&&!f.codoxId&&As(f),t.codoxDId&&(f.codoxDId=t.codoxDId),f}},ZS=m=>{const d="__nativeClone";m[d]=ks(m.clone,d),m.clone=function(p){const t=m[d](p);return p.codoxId&&(t.codoxId=p.codoxId),p.codoxDId&&(t.codoxDId=p.codoxDId),li.manageNestedEditorInClonedLexicalNode(p,t),t}},XS=m=>{let d=!1,p=!1,t=!1,f=!1;m.forEach(n=>{n.name===ve.TextNode.name?d=!0:n.name===ve.ParagraphNode.name?p=!0:n.name===ve.LineBreakNode.name?t=!0:n.name===ro.MarkNode.name&&(f=!0)});let r=[];return d||r.push(ve.TextNode),p||r.push(ve.ParagraphNode),t||r.push(ve.LineBreakNode),f||r.push(ro.MarkNode),r.length?[...r,...m]:m},QS=function(){return XS(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).map(m=>(m.hasOwnProperty("__isCodoxExtended")||(JS(m),VS(m),GS(m),KS(m),YS(m),ZS(m),Object.defineProperty(m,"__isCodoxExtended",{value:!0,writable:!1})),m))};var Nu=on(777),js={};js.styleTagTransform=si(),js.setAttributes=ii(),js.insert=oi().bind(null,"head"),js.domAPI=ri(),js.insertStyleElement=ai(),ni()(Nu.A,js),Nu.A&&Nu.A.locals&&Nu.A.locals;var t2=m=>{var d={};return on.d(d,m),d};const e2=t2({AutoFocusPlugin:()=>km});var n2=m=>{var d={};return on.d(d,m),d};const r2=n2({ClearEditorPlugin:()=>Cx});var o2=m=>{var d={};return on.d(d,m),d};const i2=o2({LexicalComposer:()=>Cm});var a2=m=>{var d={};return on.d(d,m),d};const gy=a2({default:()=>Ox});var s2=m=>{var d={};return on.d(d,m),d};const l2=s2({HistoryPlugin:()=>$m});var c2=m=>{var d={};return on.d(d,m),d};const u2=c2({OnChangePlugin:()=>Ax});var d2=m=>{var d={};return on.d(d,m),d};const f2=d2({PlainTextPlugin:()=>Lx});var p2=m=>{var d={};return on.d(d,m),d};const my=p2({$isRootTextContentEmpty:()=>qm,$rootTextContent:()=>Hm});var h2=m=>{var d={};return on.d(d,m),d};const Ps=h2({createPortal:()=>Xb.createPortal}),g2=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,m2=g2?Gt.useLayoutEffect:Gt.useEffect,yy=m2;var Iu=on(253),Ns={};Ns.styleTagTransform=si(),Ns.setAttributes=ii(),Ns.insert=oi().bind(null,"head"),Ns.domAPI=ri(),Ns.insertStyleElement=ai(),ni()(Iu.A,Ns),Iu.A&&Iu.A.locals&&Iu.A.locals;function y2(m){let{onClose:d,children:p,title:t,closeOnClickOutside:f}=m;const r=(0,Gt.useRef)(null);return(0,Gt.useEffect)(()=>{r.current!==null&&r.current.focus()},[]),(0,Gt.useEffect)(()=>{let n=null;const e=l=>{l.key==="Escape"&&d()},s=l=>{const o=l.target;r.current!==null&&!r.current.contains(o)&&f&&d()},i=r.current;return i!==null&&(n=i.parentElement,n!==null&&n.addEventListener("click",s)),window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e),n!==null&&(n==null||n.removeEventListener("click",s))}},[f,d]),Gt.createElement("div",{className:"Modal__overlay",role:"dialog"},Gt.createElement("div",{className:"Modal__modal",tabIndex:-1,ref:r},Gt.createElement("h2",{className:"Modal__title"},t),Gt.createElement("button",{className:"Modal__closeButton","aria-label":"Close modal",type:"button",onClick:d},"X"),Gt.createElement("div",{className:"Modal__content"},p)))}function v2(m){let{onClose:d,children:p,title:t,closeOnClickOutside:f=!1}=m;return(0,Ps.createPortal)(Gt.createElement(y2,{onClose:d,title:t,closeOnClickOutside:f},p),document.body)}function vy(){const[m,d]=(0,Gt.useState)(null),p=(0,Gt.useCallback)(()=>{d(null)},[]),t=(0,Gt.useMemo)(()=>{if(m===null)return null;const{title:r,content:n,closeOnClickOutside:e}=m;return Gt.createElement(v2,{onClose:p,title:r,closeOnClickOutside:e},n)},[m,p]),f=(0,Gt.useCallback)(function(r,n){d({closeOnClickOutside:arguments.length>2&&arguments[2]!==void 0&&arguments[2],content:n(p),title:r})},[p]);return[t,f]}var Ru=on(191),Is={};Is.styleTagTransform=si(),Is.setAttributes=ii(),Is.insert=oi().bind(null,"head"),Is.domAPI=ri(),Is.insertStyleElement=ai(),ni()(Ru.A,Is),Ru.A&&Ru.A.locals&&Ru.A.locals;const b2={blockCursor:"CommentEditorTheme__blockCursor",characterLimit:"CommentEditorTheme__characterLimit",code:"CommentEditorTheme__code",codeHighlight:{atrule:"CommentEditorTheme__tokenAttr",attr:"CommentEditorTheme__tokenAttr",boolean:"CommentEditorTheme__tokenProperty",builtin:"CommentEditorTheme__tokenSelector",cdata:"CommentEditorTheme__tokenComment",char:"CommentEditorTheme__tokenSelector",class:"CommentEditorTheme__tokenFunction","class-name":"CommentEditorTheme__tokenFunction",comment:"CommentEditorTheme__tokenComment",constant:"CommentEditorTheme__tokenProperty",deleted:"CommentEditorTheme__tokenProperty",doctype:"CommentEditorTheme__tokenComment",entity:"CommentEditorTheme__tokenOperator",function:"CommentEditorTheme__tokenFunction",important:"CommentEditorTheme__tokenVariable",inserted:"CommentEditorTheme__tokenSelector",keyword:"CommentEditorTheme__tokenAttr",namespace:"CommentEditorTheme__tokenVariable",number:"CommentEditorTheme__tokenProperty",operator:"CommentEditorTheme__tokenOperator",prolog:"CommentEditorTheme__tokenComment",property:"CommentEditorTheme__tokenProperty",punctuation:"CommentEditorTheme__tokenPunctuation",regex:"CommentEditorTheme__tokenVariable",selector:"CommentEditorTheme__tokenSelector",string:"CommentEditorTheme__tokenSelector",symbol:"CommentEditorTheme__tokenProperty",tag:"CommentEditorTheme__tokenProperty",url:"CommentEditorTheme__tokenOperator",variable:"CommentEditorTheme__tokenVariable"},embedBlock:{base:"CommentEditorTheme__embedBlock",focus:"CommentEditorTheme__embedBlockFocus"},hashtag:"CommentEditorTheme__hashtag",heading:{h1:"CommentEditorTheme__h1",h2:"CommentEditorTheme__h2",h3:"CommentEditorTheme__h3",h4:"CommentEditorTheme__h4",h5:"CommentEditorTheme__h5",h6:"CommentEditorTheme__h6"},image:"editor-image",indent:"CommentEditorTheme__indent",inlineImage:"inline-editor-image",layoutContainer:"CommentEditorTheme__layoutContainer",layoutItem:"CommentEditorTheme__layoutItem",link:"CommentEditorTheme__link",list:{checklist:"CommentEditorTheme__checklist",listitem:"CommentEditorTheme__listItem",listitemChecked:"CommentEditorTheme__listItemChecked",listitemUnchecked:"CommentEditorTheme__listItemUnchecked",nested:{listitem:"CommentEditorTheme__nestedListItem"},olDepth:["CommentEditorTheme__ol1","CommentEditorTheme__ol2","CommentEditorTheme__ol3","CommentEditorTheme__ol4","CommentEditorTheme__ol5"],ul:"CommentEditorTheme__ul"},ltr:"CommentEditorTheme__ltr",mark:"CommentEditorTheme__mark",markOverlap:"CommentEditorTheme__markOverlap",paragraph:"CommentEditorTheme__paragraph",quote:"CommentEditorTheme__quote",rtl:"CommentEditorTheme__rtl",table:"CommentEditorTheme__table",tableCell:"CommentEditorTheme__tableCell",tableCellActionButton:"CommentEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"CommentEditorTheme__tableCellActionButtonContainer",tableCellEditing:"CommentEditorTheme__tableCellEditing",tableCellHeader:"CommentEditorTheme__tableCellHeader",tableCellPrimarySelected:"CommentEditorTheme__tableCellPrimarySelected",tableCellResizer:"CommentEditorTheme__tableCellResizer",tableCellSelected:"CommentEditorTheme__tableCellSelected",tableCellSortedIndicator:"CommentEditorTheme__tableCellSortedIndicator",tableResizeRuler:"CommentEditorTheme__tableCellResizeRuler",tableSelected:"CommentEditorTheme__tableSelected",tableSelection:"CommentEditorTheme__tableSelection",text:{bold:"CommentEditorTheme__textBold",code:"CommentEditorTheme__textCode",italic:"CommentEditorTheme__textItalic",strikethrough:"CommentEditorTheme__textStrikethrough",subscript:"CommentEditorTheme__textSubscript",superscript:"CommentEditorTheme__textSuperscript",underline:"CommentEditorTheme__textUnderline",underlineStrikethrough:"CommentEditorTheme__textUnderlineStrikethrough"}},_2=b2;var Mu=on(72),Rs={};Rs.styleTagTransform=si(),Rs.setAttributes=ii(),Rs.insert=oi().bind(null,"head"),Rs.domAPI=ri(),Rs.insertStyleElement=ai(),ni()(Mu.A,Rs),Mu.A&&Mu.A.locals&&Mu.A.locals;function x2(){for(var m=arguments.length,d=new Array(m),p=0;p<m;p++)d[p]=arguments[p];return d.filter(Boolean).join(" ")}function hp(){return hp=Object.assign?Object.assign.bind():function(m){for(var d=1;d<arguments.length;d++){var p=arguments[d];for(var t in p)({}).hasOwnProperty.call(p,t)&&(m[t]=p[t])}return m},hp.apply(null,arguments)}function Wi(m){let{"data-test-id":d,children:p,className:t,onClick:f,disabled:r,small:n,title:e}=m;return Gt.createElement("button",hp({disabled:r,className:x2("Button__root",r&&"Button__disabled",n&&"Button__small",t),onClick:f,title:e,"aria-label":e},d&&{"data-test-id":d}),p)}var Du=on(129),Ms={};Ms.styleTagTransform=si(),Ms.setAttributes=ii(),Ms.insert=oi().bind(null,"head"),Ms.domAPI=ri(),Ms.insertStyleElement=ai(),ni()(Du.A,Ms),Du.A&&Du.A.locals&&Du.A.locals;var w2=m=>{var d={};return on.d(d,m),d};const S2=w2({ContentEditable:()=>Om});function E2(m){let{className:d}=m;return Gt.createElement(S2.ContentEditable,{className:d||"ContentEditable__root"})}var Lu=on(457),Ds={};Ds.styleTagTransform=si(),Ds.setAttributes=ii(),Ds.insert=oi().bind(null,"head"),Ds.domAPI=ri(),Ds.insertStyleElement=ai(),ni()(Lu.A,Ds),Lu.A&&Lu.A.locals&&Lu.A.locals;function C2(m){let{children:d,className:p}=m;return Gt.createElement("div",{className:p||"Placeholder__root"},d)}const k2=gy.default.LexicalErrorBoundary||gy.default,O2=()=>Gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"#050505",className:"codox-add-comment-right"},Gt.createElement("path",{d:"M14 1a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H4.414A2 2 0 0 0 3 11.586l-2 2V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12.793a.5.5 0 0 0 .854.353l2.853-2.853A1 1 0 0 1 4.414 12H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"}),Gt.createElement("path",{d:"M3 3.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5zM3 6a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9A.5.5 0 0 1 3 6zm0 2.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5z"})),by=()=>Gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",className:"codox-remove-comment"},Gt.createElement("path",{d:"M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5ZM11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H2.506a.58.58 0 0 0-.01 0H1.5a.5.5 0 0 0 0 1h.538l.853 10.66A2 2 0 0 0 4.885 16h6.23a2 2 0 0 0 1.994-1.84l.853-10.66h.538a.5.5 0 0 0 0-1h-.995a.59.59 0 0 0-.01 0H11Zm1.958 1-.846 10.58a1 1 0 0 1-.997.92h-6.23a1 1 0 0 1-.997-.92L3.042 3.5h9.916Zm-7.487 1a.5.5 0 0 1 .528.47l.5 8.5a.5.5 0 0 1-.998.06L5 5.03a.5.5 0 0 1 .47-.53Zm5.058 0a.5.5 0 0 1 .47.53l-.5 8.5a.5.5 0 1 1-.998-.06l.5-8.5a.5.5 0 0 1 .528-.47ZM8 4.5a.5.5 0 0 1 .5.5v8.5a.5.5 0 0 1-1 0V5a.5.5 0 0 1 .5-.5Z"})),T2=()=>Gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",className:"codox-add-comment"},Gt.createElement("path",{d:"M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576 6.636 10.07Zm6.787-8.201L1.591 6.602l4.339 2.76 7.494-7.493Z"})),A2=()=>Gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"#0000008c",className:"codox-hide-show-comments"},Gt.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13 5.885v1.166a3.95 3.95 0 0 1-3.949 3.95H6.917a.748.748 0 0 0-.45.15l-1.345 1.007a.752.752 0 0 0-.032 1.181A2.933 2.933 0 0 0 6.95 14h2.716l2.534 1.901a.506.506 0 0 0 .524.047A.501.501 0 0 0 13 15.5V14h.051a2.949 2.949 0 0 0 2.95-2.949v-3.05a3.002 3.002 0 0 0-2.002-2.83.756.756 0 0 0-.999.714"}),Gt.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.05 1H2.95A2.952 2.952 0 0 0 0 3.949v3.102A2.952 2.952 0 0 0 2.949 10H3v1.5a.502.502 0 0 0 .8.4L6.334 10H9.05A2.952 2.952 0 0 0 12 7.05V3.95A2.952 2.952 0 0 0 9.05 1"}));function _y(m,d,p){let t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:performance.now(),f=arguments.length>4&&arguments[4]!==void 0&&arguments[4];return kn.createNewCommentObj({content:m,author:d,codoxId:p,timeStamp:t,deleted:f})}function j2(m,d,p){return kn.createNewThreadObj({quote:m,comments:d,codoxId:p})}function P2(m){let{anchorKey:d,editor:p,onAddComment:t}=m;const f=(0,Gt.useRef)(null),r=(0,Gt.useCallback)(()=>{const n=f.current,e=p.getRootElement(),s=p.getElementByKey(d);if(n!==null&&e!==null&&s!==null){const{right:i}=e.getBoundingClientRect(),{top:l}=s.getBoundingClientRect();n.style.left=i-20+"px",n.style.top=l-30+"px"}},[d,p]);return(0,Gt.useEffect)(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[p,r]),yy(()=>{r()},[d,p,r]),Gt.createElement("div",{className:"CodoxCommentPlugin_AddCommentBox",ref:f},Gt.createElement("button",{className:"CodoxCommentPlugin_AddCommentBox_button",onClick:t},Gt.createElement(O2,null)))}function N2(m){let{onEscape:d}=m;const[p]=(0,$i.useLexicalComposerContext)();return(0,Gt.useEffect)(()=>p.registerCommand(ve.KEY_ESCAPE_COMMAND,t=>d(t),2),[p,d]),null}function I2(m){let{editorRef:d}=m;const[p]=(0,$i.useLexicalComposerContext)();return typeof d=="function"?d(p):typeof d=="object"&&(d.current=p),null}function xy(m){let{className:d,autoFocus:p,onEscape:t,onChange:f,editorRef:r,placeholder:n="Type a comment...",onEditorClick:e=()=>{}}=m;const s={namespace:"Commenting",nodes:[],onError:i=>{throw i},theme:_2};return Gt.createElement(i2.LexicalComposer,{initialConfig:s},Gt.createElement("div",{className:"CodoxCommentPlugin_CommentInputBox_EditorContainer",onClick:e},Gt.createElement(f2.PlainTextPlugin,{contentEditable:Gt.createElement(E2,{className:d}),placeholder:Gt.createElement(C2,null,n),ErrorBoundary:k2}),Gt.createElement(u2.OnChangePlugin,{onChange:f}),Gt.createElement(l2.HistoryPlugin,null),p!==!1&&Gt.createElement(e2.AutoFocusPlugin,null),Gt.createElement(N2,{onEscape:t}),Gt.createElement(r2.ClearEditorPlugin,null),r!==void 0&&Gt.createElement(I2,{editorRef:r})))}function wy(m,d){return(0,Gt.useCallback)((p,t)=>{p.read(()=>{m((0,my.$rootTextContent)()),d(!(0,my.$isRootTextContentEmpty)(t.isComposing(),!0))})},[d,m])}function R2(m){let{editor:d,cancelAddComment:p,submitAddComment:t}=m;const[f,r]=(0,Gt.useState)(""),[n,e]=(0,Gt.useState)(!1),s=(0,Gt.useRef)(null),i=(0,Gt.useMemo)(()=>({container:document.createElement("div"),elements:[]}),[]),l=(0,Gt.useRef)(null),o=Cy(),a=(0,Gt.useCallback)(()=>{d.getEditorState().read(()=>{const c=(0,ve.$getSelection)();if((0,ve.$isRangeSelection)(c)){l.current=c.clone();const g=c.anchor,h=c.focus,y=(0,Oa.createDOMRange)(d,g.getNode(),g.offset,h.getNode(),h.offset),v=s.current;if(y!==null&&v!==null){const{left:_,bottom:b,width:x}=y.getBoundingClientRect(),w=(0,Oa.createRectsFromDOMRange)(d,y);let S=w.length===1?_+x/2-125:_-125;S<10&&(S=10),v.style.left=`${S}px`,v.style.top=`${b+20+(window.pageYOffset||document.documentElement.scrollTop)}px`;const C=w.length,{container:k}=i,D=i.elements,N=D.length;for(let O=0;O<C;O++){const R=w[O];let A=D[O];A===void 0&&(A=document.createElement("span"),D[O]=A,k.appendChild(A));const $="255, 212, 0",q=`position:absolute;top:${R.top+(window.pageYOffset||document.documentElement.scrollTop)}px;left:${R.left}px;height:${R.height}px;width:${R.width}px;background-color:rgba(${$}, 0.3);pointer-events:none;z-index:5;`;A.style.cssText=q}for(let O=N-1;O>=C;O--){const R=D[O];k.removeChild(R),D.pop()}}}})},[d,i]);yy(()=>{a();const c=i.container,g=document.body;if(g!==null)return g.appendChild(c),()=>{g.removeChild(c)}},[i.container,a]),(0,Gt.useEffect)(()=>(window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}),[a]);const u=wy(r,e);return Gt.createElement("div",{className:"CodoxCommentPlugin_CommentInputBox",ref:s},Gt.createElement(xy,{className:"CodoxCommentPlugin_CommentInputBox_Editor",onEscape:c=>(c.preventDefault(),p(),!0),onChange:u}),Gt.createElement("div",{className:"CodoxCommentPlugin_CommentInputBox_Buttons"},Gt.createElement(Wi,{onClick:p,className:"CodoxCommentPlugin_CommentInputBox_Button"},"Cancel"),Gt.createElement(Wi,{onClick:()=>{if(n){let c=d.getEditorState().read(()=>{const g=l.current;return g?g.getTextContent():""});c.length>100&&(c=c.slice(0,99)+"…"),t(j2(c,[_y(f,o)]),!0,void 0,l.current),l.current=null}},disabled:!n,className:"CodoxCommentPlugin_CommentInputBox_Button primary"},"Comment")))}function M2(m){let{submitAddComment:d,thread:p,placeholder:t}=m;const[f,r]=(0,Gt.useState)(""),[n,e]=(0,Gt.useState)(!1),s=(0,Gt.useRef)(null),i=Cy(),l=wy(r,e);return Gt.createElement(Gt.Fragment,null,Gt.createElement(xy,{className:"CodoxCommentPlugin_CommentsPanel_Editor",autoFocus:!1,onEscape:()=>!0,onChange:l,editorRef:s,placeholder:t}),Gt.createElement(Wi,{className:"CodoxCommentPlugin_CommentsPanel_SendButton",onClick:()=>{if(n){d(_y(f,i),!1,p);const o=s.current;o!==null&&o.dispatchCommand(ve.CLEAR_EDITOR_COMMAND,void 0)}},disabled:!n},Gt.createElement(T2,null)))}function Sy(m){let{commentOrThread:d,deleteCommentOrThread:p,onClose:t,thread:f}=m;return Gt.createElement(Gt.Fragment,null,"Are you sure you want to delete this ",d.type,"?",Gt.createElement("div",{className:"Modal__content"},Gt.createElement(Wi,{onClick:()=>{p(d,f),t()}},"Delete")," ",Gt.createElement(Wi,{onClick:()=>{t()}},"Cancel")))}function Ey(m){let{comment:d,deleteComment:p,thread:t,rtf:f}=m;const r=Math.round((d.timeStamp-performance.now())/1e3),n=Math.round(r/60),[e,s]=vy();return Gt.createElement("li",{className:"CodoxCommentPlugin_CommentsPanel_List_Comment"},Gt.createElement("div",{className:"CodoxCommentPlugin_CommentsPanel_List_Details"},Gt.createElement("span",{className:"CodoxCommentPlugin_CommentsPanel_List_Comment_Author"},d.author),Gt.createElement("span",{className:"CodoxCommentPlugin_CommentsPanel_List_Comment_Time"},"· ",r>-10?"Just now":f.format(n,"minute"))),Gt.createElement("p",{className:d.deleted?"CodoxCommentPlugin_CommentsPanel_DeletedComment":""},d.content),!d.deleted&&Gt.createElement(Gt.Fragment,null,Gt.createElement(Wi,{onClick:()=>{s("Delete Comment",i=>Gt.createElement(Sy,{commentOrThread:d,deleteCommentOrThread:p,thread:t,onClose:i}))},className:"CodoxCommentPlugin_CommentsPanel_List_DeleteButton"},Gt.createElement(by,null)),e))}function D2(m){let{activeIDs:d,comments:p,deleteCommentOrThread:t,listRef:f,submitAddComment:r,markNodeMap:n}=m;const[e]=(0,$i.useLexicalComposerContext)(),[s,i]=(0,Gt.useState)(0),[l,o]=vy(),a=(0,Gt.useMemo)(()=>new Intl.RelativeTimeFormat("en",{localeMatcher:"best fit",numeric:"auto",style:"short"}),[]);return(0,Gt.useEffect)(()=>{const u=setTimeout(()=>{i(s+1)},1e4);return()=>{clearTimeout(u)}},[s]),Gt.createElement("ul",{className:"CodoxCommentPlugin_CommentsPanel_List",ref:f},p.map(u=>{const c=u.codoxId;if(!c)return null;if(u.type==="thread"){const g=()=>{if(n.get(c)!==void 0&&(d===null||d.indexOf(c)===-1)){const h=document.activeElement;e.update(()=>{(0,ve.$setSelection)(null)},{onUpdate(){h!==null&&h.focus()}})}};return Gt.createElement("li",{key:c,onClick:g,className:`CodoxCommentPlugin_CommentsPanel_List_Thread ${n.has(c)?"interactive":""} ${d.indexOf(c)===-1?"":"active"}`},Gt.createElement("div",{className:"CodoxCommentPlugin_CommentsPanel_List_Thread_QuoteBox"},Gt.createElement("blockquote",{className:"CodoxCommentPlugin_CommentsPanel_List_Thread_Quote"},"> ",Gt.createElement("span",null,u.quote)),Gt.createElement(Wi,{onClick:()=>{o("Delete Thread",h=>Gt.createElement(Sy,{commentOrThread:u,deleteCommentOrThread:t,onClose:h}))},className:"CodoxCommentPlugin_CommentsPanel_List_DeleteButton"},Gt.createElement(by,null)),l),Gt.createElement("ul",{className:"CodoxCommentPlugin_CommentsPanel_List_Thread_Comments"},u.comments.map(h=>Gt.createElement(Ey,{key:h.codoxId,comment:h,deleteComment:t,thread:u,rtf:a}))),Gt.createElement("div",{className:"CodoxCommentPlugin_CommentsPanel_List_Thread_Editor"},Gt.createElement(M2,{submitAddComment:r,thread:u,placeholder:"Reply to comment..."})))}return Gt.createElement(Ey,{key:c,comment:u,deleteComment:t,rtf:a})}))}function L2(m){let{activeIDs:d,deleteCommentOrThread:p,comments:t,submitAddComment:f,markNodeMap:r}=m;const n=(0,Gt.useRef)(null),e=t.length===0;return Gt.createElement("div",{className:"CodoxCommentPlugin_CommentsPanel"},Gt.createElement("h2",{className:"CodoxCommentPlugin_CommentsPanel_Heading"},"Comments"),e?Gt.createElement("div",{className:"CodoxCommentPlugin_CommentsPanel_Empty"},"No Comments"):Gt.createElement(D2,{activeIDs:d,comments:t,deleteCommentOrThread:p,listRef:n,submitAddComment:f,markNodeMap:r}))}function Cy(){const m=(0,ny.useCollaborationContext)(),{yjsDocMap:d,name:p}=m;return p||"Playground User"}function B2(m){const[d]=(0,$i.useLexicalComposerContext)(),p=_w(),t=(0,Gt.useMemo)(()=>new Map,[]),[f,r]=(0,Gt.useState)(),[n,e]=(0,Gt.useState)([]),[s,i]=(0,Gt.useState)(!1),[l,o]=(0,Gt.useState)(!1);(0,Gt.useEffect)(()=>{!p.length&&l?o(!1):p.length},[p]);const a=(0,Gt.useCallback)(()=>{d.update(()=>{const g=(0,ve.$getSelection)();g!==null&&(g.dirty=!0)}),i(!1)},[d]),u=(0,Gt.useCallback)((g,h)=>{if(g.type==="comment"){if(le.log("[deleteCommentOrThread]: type comment new values",{comment:g,thread:h,markNodeMap:t}),kn.removeComment(h.codoxId,g.codoxId),!h)return;const y=h.codoxId,v=t.get(y);d.update(()=>{v?v.forEach((_,b)=>{const x=(0,ve.$getNodeByKey)(b);le.log("[deleteCommentOrThread]: type comment new values",{lexicalNode:x}),x&&x.markDirty()}):(0,ve.$getRoot)().markDirty(),(0,ve.$addUpdateTag)(oo.historic),(0,ve.$addUpdateTag)(Jl)})}else{le.log("[deleteCommentOrThread]: type thread new values",{comment:g,markNodeMap:t});const y=h!==void 0?h.codoxId:g.codoxId,v=t.get(y);setTimeout(()=>{d.update(()=>{if(v)for(const _ of v){const b=(0,ve.$getNodeByKey)(_);le.log("[deleteCommentOrThread]: type thread new values",{node:b}),(0,ro.$isMarkNode)(b)&&(b.deleteID(y),b.getIDs().length===0&&(0,ro.$unwrapMarkNode)(b))}else(0,ve.$getRoot)().markDirty(),le.debug("[deleteCommentOrThread][refreshComments]");kn.refreshComments(!0),(0,ve.$addUpdateTag)(Jl)})})}},[d,t]),c=(0,Gt.useCallback)((g,h,y,v)=>{if(le.log("[submitAddComment]: new values",{commentOrThread:g,isInlineComment:h,thread:y,markNodeMap:t}),y?kn.addComment(y.codoxId,g):kn.addCommentThread(g),h)d.update(()=>{if((0,ve.$isRangeSelection)(v)){const _=v.isBackward(),b=g.codoxId;(0,ro.$wrapSelectionInMarkNode)(v,_,b),(0,ve.$addUpdateTag)(Jl)}}),i(!1);else if(!h&&y){const _=y.codoxId,b=t.get(_);if(!b)return void kn.removeComment(y.codoxId,g.codoxId);d.update(()=>{b.forEach((x,w)=>{let S=(0,ve.$getNodeByKey)(w);S&&S.markDirty()}),(0,ve.$addUpdateTag)(oo.historic),(0,ve.$addUpdateTag)(Jl)})}},[d]);return(0,Gt.useEffect)(()=>{const g=[];for(let h=0;h<n.length;h++){const y=n[h],v=t.get(y);if(v!==void 0)for(const _ of v){const b=d.getElementByKey(_);b!==null&&(b.classList.add("selected"),g.push(b),o(!0))}}return()=>{for(let h=0;h<g.length;h++)g[h].classList.remove("selected")}},[n,d,t]),(0,Gt.useEffect)(()=>{const g=new Map;return(0,ws.mergeRegister)((0,ws.registerNestedElementResolver)(d,ro.MarkNode,h=>(0,ro.$createMarkNode)(h.getIDs()),(h,y)=>{h.getIDs().forEach(v=>{y.addID(v)})}),d.registerMutationListener(ro.MarkNode,h=>{d.getEditorState().read(()=>{for(const[y,v]of h){const _=(0,ve.$getNodeByKey)(y);let b=[];v==="destroyed"?b=g.get(y)||[]:(0,ro.$isMarkNode)(_)&&(b=_.getIDs());for(let x=0;x<b.length;x++){const w=b[x];let S=t.get(w);g.set(y,b),v==="destroyed"?S!==void 0&&(S.delete(y),S.size===0&&t.delete(w)):(S===void 0&&(S=new Set,t.set(w,S)),S.has(y)||S.add(y))}}})}),d.registerUpdateListener(h=>{let{editorState:y,tags:v}=h;y.read(()=>{const _=(0,ve.$getSelection)();let b=!1,x=!1;if((0,ve.$isRangeSelection)(_)){const w=_.anchor.getNode();if((0,ve.$isTextNode)(w)){const S=(0,ro.$getMarkIDs)(w,_.anchor.offset);S!==null&&(e(S),b=!0),_.isCollapsed()||(r(w.getKey()),x=!0)}}b||e(w=>w.length===0?w:[]),x||r(null),(0,ve.$isRangeSelection)(_)&&i(!1)})}),d.registerCommand(op,()=>{const h=window.getSelection();return h!==null&&h.removeAllRanges(),i(!0),!0},ve.COMMAND_PRIORITY_EDITOR))},[d,t]),Gt.createElement(Gt.Fragment,null,s&&(0,Ps.createPortal)(Gt.createElement(R2,{editor:d,cancelAddComment:a,submitAddComment:c}),document.body),f!=null&&!s&&(0,Ps.createPortal)(Gt.createElement(P2,{anchorKey:f,editor:d,onAddComment:()=>{d.dispatchCommand(op,void 0)}}),document.body),(0,Ps.createPortal)(Gt.createElement(Wi,{className:"CodoxCommentPlugin_ShowCommentsButton "+(l?"active":""),onClick:()=>o(!l),title:l?"Hide Comments":"Show Comments"},Gt.createElement(A2,null)),document.body),l&&(0,Ps.createPortal)(Gt.createElement(L2,{comments:p,submitAddComment:c,deleteCommentOrThread:u,activeIDs:n,markNodeMap:t}),document.body))}var Bu=on(766),Ls={};Ls.styleTagTransform=si(),Ls.setAttributes=ii(),Ls.insert=oi().bind(null,"head"),Ls.domAPI=ri(),Ls.insertStyleElement=ai(),ni()(Bu.A,Ls),Bu.A&&Bu.A.locals&&Bu.A.locals;var Fu=on(225),Bs={};Bs.styleTagTransform=si(),Bs.setAttributes=ii(),Bs.insert=oi().bind(null,"head"),Bs.domAPI=ri(),Bs.insertStyleElement=ai(),ni()(Fu.A,Bs),Fu.A&&Fu.A.locals&&Fu.A.locals;function F2(m){let{label:d,value:p,onChange:t,placeholder:f="","data-test-id":r,type:n="text"}=m;return Gt.createElement("div",{className:"CodoxInput__wrapper"},Gt.createElement("label",{className:"CodoxInput__label"},d),Gt.createElement("input",{type:n,className:"CodoxInput__input",placeholder:f,value:p,onChange:e=>{t(e.target.value)},"data-test-id":r}))}function ky(m,d){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(m);d&&(t=t.filter(function(f){return Object.getOwnPropertyDescriptor(m,f).enumerable})),p.push.apply(p,t)}return p}function zu(m){for(var d=1;d<arguments.length;d++){var p=arguments[d]!=null?arguments[d]:{};d%2?ky(Object(p),!0).forEach(function(t){z2(m,t,p[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):ky(Object(p)).forEach(function(t){Object.defineProperty(m,t,Object.getOwnPropertyDescriptor(p,t))})}return m}function z2(m,d,p){return(d=U2(d))in m?Object.defineProperty(m,d,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[d]=p,m}function U2(m){var d=$2(m,"string");return typeof d=="symbol"?d:d+""}function $2(m,d){if(typeof m!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var t=p.call(m,d||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(d==="string"?String:Number)(m)}let Yl=!1;const H2=["#d0021b","#f5a623","#f8e71c","#8b572a","#7ed321","#417505","#bd10e0","#9013fe","#4a90e2","#50e3c2","#b8e986","#000000","#4a4a4a","#9b9b9b","#ffffff"],Zl=214,Oy=150;function q2(m){let{color:d,onChange:p}=m;const[t,f]=(0,Gt.useState)(Fs("hex",d)),[r,n]=(0,Gt.useState)(d),e=(0,Gt.useRef)(null),s=(0,Gt.useMemo)(()=>({x:t.hsv.s/100*Zl,y:(100-t.hsv.v)/100*Oy}),[t.hsv.s,t.hsv.v]),i=(0,Gt.useMemo)(()=>({x:t.hsv.h/360*Zl}),[t.hsv]);return(0,Gt.useEffect)(()=>{e.current!==null&&p&&n(t.hex)},[t,p]),(0,Gt.useEffect)(()=>{if(d===void 0)return;const l=Fs("hex",d);f(l),n(l.hex)},[d]),Gt.createElement("div",{className:"codox-color-picker-wrapper",style:{width:Zl},ref:e},Gt.createElement(F2,{label:"Hex",onChange:l=>{if(n(l),/^#[0-9A-Fa-f]{6}$/i.test(l)){const o=Fs("hex",l);f(o)}},value:r}),Gt.createElement("div",{className:"codox-color-picker-basic-color"},H2.map(l=>Gt.createElement("button",{className:l===t.hex?" active":"",key:l,style:{backgroundColor:l},onClick:()=>(o=>{n(o);let a=Fs("hex",o);f(a),p(a.hex,Yl)})(l)}))),Gt.createElement(Ty,{className:"codox-color-picker-saturation",style:{backgroundColor:`hsl(${t.hsv.h}, 100%, 50%)`},onChange:l=>{let{x:o,y:a}=l;const u=Fs("hsv",zu(zu({},t.hsv),{},{s:o/Zl*100,v:100-a/Oy*100}));f(u),n(u.hex),p(u.hex,Yl)}},Gt.createElement("div",{className:"codox-color-picker-saturation_cursor",style:{backgroundColor:t.hex,left:s.x,top:s.y}})),Gt.createElement(Ty,{className:"codox-color-picker-hue",onChange:l=>{let{x:o}=l;const a=Fs("hsv",zu(zu({},t.hsv),{},{h:o/Zl*360}));f(a),n(a.hex),p(a.hex,Yl)}},Gt.createElement("div",{className:"codox-color-picker-hue_cursor",style:{backgroundColor:`hsl(${t.hsv.h}, 100%, 50%)`,left:i.x}})),Gt.createElement("div",{className:"codox-color-picker-color",style:{backgroundColor:t.hex}}))}function Ty(m){let{className:d,style:p,onChange:t,children:f}=m;const r=(0,Gt.useRef)(null),n=(0,Gt.useRef)(!1),e=s=>{if(r.current){const{current:i}=r,{width:l,height:o,left:a,top:u}=i.getBoundingClientRect(),c=Ay(s.clientX-a,l,0),g=Ay(s.clientY-u,o,0);t({x:c,y:g})}};return Gt.createElement("div",{ref:r,className:d,style:p,onMouseDown:s=>{if(s.button!==0)return;e(s);const i=o=>{n.current=!0,Yl=!0,e(o)},l=o=>{n.current&&(Yl=!1),document.removeEventListener("mousemove",i,!1),document.removeEventListener("mouseup",l,!1),e(o),n.current=!1};document.addEventListener("mousemove",i,!1),document.addEventListener("mouseup",l,!1)}},f)}function Ay(m,d,p){return m>d?d:m<p?p:m}function jy(m){if(!m.startsWith("#")){const d=document.createElement("canvas").getContext("2d");if(!d)throw new Error("2d context not supported or canvas already initialized");return d.fillStyle=m,d.fillStyle}return m.length===4||m.length===5?m=m.split("").map((d,p)=>p?d+d:"#").join(""):m.length===7||m.length===9?m:"#000000"}function Py(m){const d=(m.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(p,t,f,r)=>"#"+t+t+f+f+r+r).substring(1).match(/.{2}/g)||[]).map(p=>parseInt(p,16));return{b:d[2],g:d[1],r:d[0]}}function gp(m){let{r:d,g:p,b:t}=m;d/=255,p/=255,t/=255;const f=Math.max(d,p,t),r=f-Math.min(d,p,t);return{h:r?60*(f===d?(p-t)/r+(p<t?6:0):f===p?2+(t-d)/r:4+(d-p)/r):0,s:f?r/f*100:0,v:100*f}}function W2(m){let{h:d,s:p,v:t}=m;p/=100,t/=100;const f=~~(d/60),r=d/60-f,n=t*(1-p),e=t*(1-p*r),s=t*(1-p*(1-r)),i=f%6,l=Math.round(255*[t,e,n,n,s,t][i]),o=Math.round(255*[s,t,t,e,n,n][i]);return{b:Math.round(255*[n,n,s,t,t,e][i]),g:o,r:l}}function Ny(m){let{b:d,g:p,r:t}=m;return"#"+[t,p,d].map(f=>f.toString(16).padStart(2,"0")).join("")}function Fs(m,d){let p=jy("#121212"),t=Py(p),f=gp(t);return m==="hex"?(p=jy(d),t=Py(p),f=gp(t)):m==="rgb"?(t=d,p=Ny(t),f=gp(t)):m==="hsv"&&(f=d,t=W2(f),p=Ny(t)),{hex:p,hsv:f,rgb:t}}const J2=Gt.createContext(null),Iy=4;function V2(m){let{children:d,dropDownRef:p,onClose:t,dropdownClassName:f}=m;const[r,n]=(0,Gt.useState)(),[e,s]=(0,Gt.useState)(),i=(0,Gt.useCallback)(o=>{n(a=>a?[...a,o]:[o])},[n]),l=(0,Gt.useMemo)(()=>({registerItem:i}),[i]);return(0,Gt.useEffect)(()=>{r&&!e&&s(r[0]),e&&e.current&&e.current.focus()},[r,e]),Gt.createElement(J2.Provider,{value:l},Gt.createElement("div",{className:f,ref:p,onKeyDown:o=>{if(!r)return;const a=o.key;["Escape","ArrowUp","ArrowDown","Tab"].includes(a)&&o.preventDefault(),a==="Escape"||a==="Tab"?t():a==="ArrowUp"?s(u=>{if(!u)return r[0];const c=r.indexOf(u)-1;return r[c===-1?r.length-1:c]}):a==="ArrowDown"&&s(u=>u?r[r.indexOf(u)+1]:r[0])}},d))}function K2(m){let{disabled:d=!1,buttonLabel:p,buttonAriaLabel:t,buttonClassName:f,buttonIconClassName:r,children:n,stopCloseOnClickSelf:e,dropdownClassName:s,buttonLabelClassName:i,dropdownChevronClassName:l}=m;const o=(0,Gt.useRef)(null),a=(0,Gt.useRef)(null),[u,c]=(0,Gt.useState)(!1);return(0,Gt.useEffect)(()=>{const g=a.current,h=o.current;if(u&&g!==null&&h!==null){const{top:y,left:v}=g.getBoundingClientRect();h.style.top=`${y+g.offsetHeight+Iy}px`,h.style.left=`${Math.min(v,window.innerWidth-h.offsetWidth-20)}px`}},[o,a,u]),(0,Gt.useEffect)(()=>{const g=a.current;if(g!==null&&u){const h=y=>{const v=y.target;e&&o.current&&o.current.contains(v)||g.contains(v)||c(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[o,a,u,e]),(0,Gt.useEffect)(()=>{const g=()=>{if(u){const h=a.current,y=o.current;if(h!==null&&y!==null){const{top:v}=h.getBoundingClientRect(),_=v+h.offsetHeight+Iy;_!==y.getBoundingClientRect().top&&(y.style.top=`${_}px`)}}};return document.addEventListener("scroll",g),()=>{document.removeEventListener("scroll",g)}},[a,o,u]),Gt.createElement(Gt.Fragment,null,Gt.createElement("button",{type:"button",disabled:d,"aria-label":t||p,className:f,onClick:()=>c(!u),ref:a},r&&Gt.createElement("span",{className:r}),p&&Gt.createElement("span",{className:i},p),Gt.createElement("i",{className:l})),u&&(0,Ps.createPortal)(Gt.createElement(V2,{dropDownRef:o,onClose:()=>{c(!1),a&&a.current&&a.current.focus()},dropdownClassName:s},n),document.body))}const G2=["disabled","stopCloseOnClickSelf","color","onChange"];function mp(){return mp=Object.assign?Object.assign.bind():function(m){for(var d=1;d<arguments.length;d++){var p=arguments[d];for(var t in p)({}).hasOwnProperty.call(p,t)&&(m[t]=p[t])}return m},mp.apply(null,arguments)}function Y2(m,d){if(m==null)return{};var p,t,f=Z2(m,d);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);for(t=0;t<r.length;t++)p=r[t],d.indexOf(p)>=0||{}.propertyIsEnumerable.call(m,p)&&(f[p]=m[p])}return f}function Z2(m,d){if(m==null)return{};var p={};for(var t in m)if({}.hasOwnProperty.call(m,t)){if(d.indexOf(t)>=0)continue;p[t]=m[t]}return p}function Ry(m){let{disabled:d=!1,stopCloseOnClickSelf:p=!0,color:t,onChange:f}=m,r=Y2(m,G2);return Gt.createElement(K2,mp({},r,{disabled:d,stopCloseOnClickSelf:p}),Gt.createElement(q2,{color:t,onChange:f}))}const X2=m=>{let{onColorChange:d,buttonClassName:p,buttonIconClassName:t,buttonAriaLabel:f,buttonLabel:r,dropdownClassName:n,buttonLabelClassName:e,dropdownChevronClassName:s}=m;const[i]=(0,$i.useLexicalComposerContext)(),[l,o]=(0,Gt.useState)(()=>i.isEditable()),[a,u]=(0,Gt.useState)("");(0,Gt.useEffect)(()=>(0,ws.mergeRegister)(i.registerEditableListener(g=>{o(g)}),i.registerUpdateListener(g=>{let{editorState:h}=g;h.read(()=>{const y=(0,ve.$getSelection)();if((0,ve.$isRangeSelection)(y)){let v=(0,Oa.$getSelectionStyleValueForProperty)(y,"color");v!==a&&(u(v||""),d(v))}})})),[i]);const c=(0,Gt.useCallback)((g,h)=>{i.update(()=>{const y=(0,ve.$getSelection)();y!==null&&(0,Oa.$patchStyleText)(y,{color:g})})},[i]);return Gt.createElement(Ry,{disabled:!l,color:a,onChange:c,buttonClassName:p||"",buttonIconClassName:t||"",buttonAriaLabel:f||"",buttonLabel:r||"",dropdownClassName:n||"",buttonLabelClassName:e||"",dropdownChevronClassName:s||""})},Q2=X2,tE=m=>{let{onColorChange:d,buttonClassName:p,buttonIconClassName:t,buttonAriaLabel:f,buttonLabel:r,dropdownClassName:n,buttonLabelClassName:e,dropdownChevronClassName:s}=m;const[i]=(0,$i.useLexicalComposerContext)(),[l,o]=(0,Gt.useState)(()=>i.isEditable()),[a,u]=(0,Gt.useState)("#fff");(0,Gt.useEffect)(()=>(0,ws.mergeRegister)(i.registerEditableListener(g=>{o(g)}),i.registerUpdateListener(g=>{let{editorState:h}=g;h.read(()=>{const y=(0,ve.$getSelection)();if((0,ve.$isRangeSelection)(y)){let v=(0,Oa.$getSelectionStyleValueForProperty)(y,"background-color");v!==a&&(u(v||""),d(v))}})})),[i]);const c=(0,Gt.useCallback)((g,h)=>{i.update(()=>{const y=(0,ve.$getSelection)();y!==null&&(0,Oa.$patchStyleText)(y,{"background-color":g})})},[i]);return Gt.createElement(Ry,{disabled:!l,color:a,onChange:c,buttonClassName:p||"",buttonIconClassName:t||"",buttonAriaLabel:f||"",buttonLabel:r||"",dropdownClassName:n||"",buttonLabelClassName:e||"",dropdownChevronClassName:s||""})},eE=tE;var nE=Bi.yy;Bi._U,Bi.a8,Bi.Vs,Bi.Cn;var rE=Bi.gK,oE=Bi.vv;function iE(m){return m&&m.__esModule&&Object.prototype.hasOwnProperty.call(m,"default")?m.default:m}var Uu=iE(function(m){const d=new URLSearchParams;d.append("code",m);for(let p=1;p<arguments.length;p++)d.append("v",arguments[p]);throw Error(`Minified Lexical error #${m}; visit https://lexical.dev/docs/error?${d} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function aE({hasCellMerge:m=!0,hasCellBackgroundColor:d=!0,hasTabHandler:p=!0}){const[t]=Pr();return Se.useEffect(()=>(t.hasNodes([_o,Di,zl])||Uu(10),vo(t.registerCommand(ax,({columns:f,rows:r,includeHeaders:n})=>{const e=d0(Number(r),Number(f),n);Bm(e);const s=e.getFirstDescendant();return Ne(s)&&s.select(),!0},an),t.registerNodeTransform(_o,f=>{const[r]=g0(f,null,null),n=r.reduce((e,s)=>Math.max(e,s.length),0);for(let e=0;e<r.length;++e){const s=r[e].length;if(s===n)continue;const i=r[e][s-1].cell;for(let l=s;l<n;++l){const o=ti(0);o.append(Hn()),i!==null?i.insertAfter(o):Fm(i,o)}}}))),[t]),Se.useEffect(()=>{const f=new Map,r=e=>{const s=e.getKey(),i=t.getElementByKey(s);if(i&&!f.has(s)){const l=bx(e,i,t,p);f.set(s,l)}};t.getEditorState().read(()=>{const e=Og(_o);for(const s of e)In(s)&&r(s)});const n=t.registerMutationListener(_o,e=>{for(const[s,i]of e)if(i==="created")t.getEditorState().read(()=>{const l=Kn(s);In(l)&&r(l)});else if(i==="destroyed"){const l=f.get(s);l!==void 0&&(l.removeListeners(),f.delete(s))}});return()=>{n();for(const[,e]of f)e.removeListeners()}},[t,p]),Se.useEffect(()=>{if(!m)return t.registerNodeTransform(Di,f=>{if(f.getColSpan()>1||f.getRowSpan()>1){const[,,r]=Jr(f),[n]=No(r,f,f),e=n.length,s=n[0].length;let i=r.getFirstChild();cr(i)||Uu(175);const l=[];for(let o=0;o<e;o++){o!==0&&(i=i.getNextSibling(),cr(i)||Uu(175));let a=null;for(let u=0;u<s;u++){const c=n[o][u],g=c.cell;if(c.startRow===o&&c.startColumn===u)a=g,l.push(g);else if(g.getColSpan()>1||g.getRowSpan()>1){rn(g)||Uu(176);const h=ti(g.__headerState);a!==null?a.insertAfter(h):Fm(i,h)}}}for(const o of l)o.setColSpan(1),o.setRowSpan(1)}})},[t,m]),Se.useEffect(()=>{if(!d)return t.registerNodeTransform(Di,f=>{f.getBackgroundColor()!==null&&f.setBackgroundColor(null)})},[t,d,m]),null}const sE={code:"editor-code",heading:{h1:"editor-heading-h1",h2:"editor-heading-h2",h3:"editor-heading-h3",h4:"editor-heading-h4",h5:"editor-heading-h5"},image:"editor-image",link:"editor-link",list:{listitem:"editor-listitem",nested:{listitem:"editor-nested-listitem"},ol:"editor-list-ol",ul:"editor-list-ul"},ltr:"ltr",paragraph:"editor-paragraph",placeholder:"editor-placeholder",quote:"editor-quote",rtl:"rtl",text:{bold:"editor-text-bold",code:"editor-text-code",hashtag:"editor-text-hashtag",italic:"editor-text-italic",overflowed:"editor-text-overflowed",strikethrough:"editor-text-strikethrough",underline:"editor-text-underline",underlineStrikethrough:"editor-text-underlineStrikethrough"},table:"PlaygroundEditorTheme__table",tableAddColumns:"PlaygroundEditorTheme__tableAddColumns",tableAddRows:"PlaygroundEditorTheme__tableAddRows",tableCell:"PlaygroundEditorTheme__tableCell",tableCellActionButton:"PlaygroundEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"PlaygroundEditorTheme__tableCellActionButtonContainer",tableCellEditing:"PlaygroundEditorTheme__tableCellEditing",tableCellHeader:"PlaygroundEditorTheme__tableCellHeader",tableCellPrimarySelected:"PlaygroundEditorTheme__tableCellPrimarySelected",tableCellResizer:"PlaygroundEditorTheme__tableCellResizer",tableCellSelected:"PlaygroundEditorTheme__tableCellSelected",tableCellSortedIndicator:"PlaygroundEditorTheme__tableCellSortedIndicator",tableResizeRuler:"PlaygroundEditorTheme__tableCellResizeRuler",tableSelected:"PlaygroundEditorTheme__tableSelected",tableSelection:"PlaygroundEditorTheme__tableSelection"},lE="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDE1IDE1IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTYuMDAwMDEgOC4zMzMzM0wxLjkwMDAxIDEzLjhMMS4xMDAwMSAxMy4yTDUuMzc1MDEgNy41TDEuMTAwMDEgMS44TDEuOTAwMDEgMS4yTDYuMDAwMDEgNi42NjY2N0wxMC4xIDEuMkwxMC45IDEuOEw2LjYyNTAxIDcuNUwxMC45IDEzLjJMMTAuMSAxMy44TDYuMDAwMDEgOC4zMzMzM1pNMTIgMTIuNUMxMiAxMS42NzE2IDEyLjY3MTYgMTEgMTMuNSAxMUgxMy43OTI5QzE0LjQ1OTYgMTEgMTUgMTEuNTQwNCAxNSAxMi4yMDcxQzE1IDEyLjUyNzMgMTQuODcyOCAxMi44MzQzIDE0LjY0NjUgMTMuMDYwN0wxMy43MDcxIDE0SDE1VjE1SDEyLjVDMTIuMjk3OCAxNSAxMi4xMTU1IDE0Ljg3ODIgMTIuMDM4MSAxNC42OTEzQzExLjk2MDcgMTQuNTA0NSAxMi4wMDM1IDE0LjI4OTQgMTIuMTQ2NSAxNC4xNDY0TDEzLjkzOTMgMTIuMzUzNkMxMy45NzgyIDEyLjMxNDcgMTQgMTIuMjYyIDE0IDEyLjIwNzFDMTQgMTIuMDkyNyAxMy45MDczIDEyIDEzLjc5MjkgMTJIMTMuNUMxMy4yMjM5IDEyIDEzIDEyLjIyMzkgMTMgMTIuNUgxMloiIGZpbGw9IiMwMDAwMDAiLz4KPC9zdmc+",cE="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIiB0ZXh0LXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIiBpbWFnZS1yZW5kZXJpbmc9Im9wdGltaXplUXVhbGl0eSIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIHZpZXdCb3g9IjAgMCA1MDQgNTEyLjM2Ij48cGF0aCBmaWxsLXJ1bGU9Im5vbnplcm8iIGQ9Ik00OTkuNDMgMjMxLjM2SDM2OC40Yy0yLjUzIDAtNC41OC0yLjA1LTQuNTgtNC41N3YtOC4xMWMwLTEuMjYuNTItMi40IDEuMzQtMy4yMmw3MS41Ny04Mi41M2M2LjczLTcuNzUgMTIuNTctMTQuOTcgMTcuNDgtMjEuNjggNC44OC02LjY0IDguODMtMTIuNzQgMTEuODUtMTguMjggMi45Ny01LjQzIDUuMTgtMTAuNjEgNi42NC0xNS41NSAxLjQyLTQuODUgMi4xMy05LjUzIDIuMTMtMTQgMC0xNC42OC0zLjk4LTI2LjA1LTExLjkyLTM0LjA5LTMuOTItMy45Ni04Ljc1LTYuOTMtMTQuNDktOC45Mi01Ljk1LTIuMDMtMTIuOTEtMy4wNS0yMC44Ny0zLjA1LTguNDUgMC0xNS44OCAxLjIxLTIyLjI5IDMuNjItNi4yNyAyLjM2LTExLjYzIDUuOTItMTYuMDcgMTAuNjNhNDcuODg0IDQ3Ljg4NCAwIDAgMC0xMC4xNCAxNi42Yy0yLjI3IDYuMjktMy40MSAxMy4zOS0zLjQxIDIxLjI2IDAgMi41Mi0yLjA1IDQuNTctNC41NyA0LjU3aC02Ljg5Yy0yLjA1IDAtMy44LTEuMzYtNC4zNy0zLjI0bC0uMjctLjgyYy0uMTgtLjU2LS4yNS0xLjEzLS4yMi0xLjY3LS4yMy05LjMyIDEuMTQtMTcuOTkgNC4xMi0yNS45NyAzLjAyLTguMTMgNy42OC0xNS41NCAxMy45NC0yMi4xOSA2LjI2LTYuNyAxMy42My0xMS43NiAyMi4xLTE1LjEzQzQwNy44NCAxLjY4IDQxNy4yIDAgNDI3LjU1IDBjOS41OSAwIDE4LjI2IDEuMzggMjYuMDMgNC4xMyA3Ljg2IDIuNzkgMTQuNzcgNyAyMC43MiAxMi42MSA2LjAyIDUuNjMgMTAuNTUgMTIuNCAxMy41NSAyMC4yOCAyLjk2IDcuNzUgNC40NSAxNi41NiA0LjQ1IDI2LjQgMCA2LjUtMS4wNyAxMy4wOC0zLjE3IDE5LjY5bC0uMTQuMzhjLTIuMDkgNi40Ni01LjE3IDEyLjk3LTkuMiAxOS40OWwtLjE0LjIxYy00LjA4IDYuNTEtOC45IDEzLjQzLTE0LjQzIDIwLjc0LTUuNTYgNy4zMy0xMS45NiAxNS4yMy0xOS4yMiAyMy42N2wtNTYuOTEgNjYuNTFoMTEwLjM0YzIuNTIgMCA0LjU3IDIuMDUgNC41NyA0LjU3djguMTFjMCAyLjUyLTIuMDUgNC41Ny00LjU3IDQuNTd6bS0zMjcuMjUgNjguNzUgMTM3Ljk2LTE2Ny43NmMuODktMS4wNyAyLjMtMS42NSAzLjc0LTEuNjVsMjAuMTMtLjAyYzIuNTIgMCA0LjU3IDEuNzQgNC41NyAzLjg4IDAgLjkxLS4zNyAxLjc1LS45OCAyLjQxTDE4OC4zMiAzMTcuNjYgMzQ0LjEgNTA2LjI0YzEuNDUgMS43NS45NSA0LjE3LTEuMSA1LjQtLjguNDgtMS43Mi43MS0yLjYzLjcxbC0yMC4xMy4wMWMtMS43IDAtMy4xOC0uNzktMy45Ny0xLjk2bC0xNDQuMS0xNzUuMkwyOC4yMyA1MTAuNjljLS44OCAxLjA3LTIuMyAxLjY0LTMuNzMgMS42NWwtMTkuOTMuMDJjLTIuNTIgMC00LjU3LTEuNzQtNC41Ny0zLjg5IDAtLjkuMzctMS43NC45OC0yLjRsMTU1LjY1LTE4OC40TDYuOSAxMzYuOGMtMS40NS0xLjc1LS45NS00LjE4IDEuMTEtNS40MS43OS0uNDcgMS43MS0uNyAyLjYyLS43bDIwLjQ0LS4wMWMxLjYzIDAgMy4wNi43MiAzLjg3IDEuODFsMTM3LjI0IDE2Ny42MnoiLz48L3N2Zz4=",My=tr.createContext(null),Dy=4;function $u({children:m,className:d,onClick:p,title:t}){const f=Se.useRef(null),r=tr.useContext(My);if(r===null)throw new Error("DropDownItem must be used within a DropDown");const{registerItem:n}=r;return Se.useEffect(()=>{f&&f.current&&n(f)},[f,n]),pe.jsx("button",{className:d,onClick:p,ref:f,title:t,type:"button",children:m})}function uE({children:m,dropDownRef:d,onClose:p}){const[t,f]=Se.useState(),[r,n]=Se.useState(),e=Se.useCallback(l=>{f(o=>o?[...o,l]:[l])},[f]),s=l=>{if(!t)return;const o=l.key;["Escape","ArrowUp","ArrowDown","Tab"].includes(o)&&l.preventDefault(),o==="Escape"||o==="Tab"?p():o==="ArrowUp"?n(a=>{if(!a)return t[0];const u=t.indexOf(a)-1;return t[u===-1?t.length-1:u]}):o==="ArrowDown"&&n(a=>a?t[t.indexOf(a)+1]:t[0])},i=Se.useMemo(()=>({registerItem:e}),[e]);return Se.useEffect(()=>{t&&!r&&n(t[0]),r&&r.current&&r.current.focus()},[t,r]),pe.jsx(My.Provider,{value:i,children:pe.jsx("div",{className:"dropdown",ref:d,onKeyDown:s,children:m})})}function dE({disabled:m=!1,buttonLabel:d,buttonAriaLabel:p,buttonClassName:t,buttonIconClassName:f,children:r,stopCloseOnClickSelf:n}){const e=Se.useRef(null),s=Se.useRef(null),[i,l]=Se.useState(!1),o=()=>{l(!1),s&&s.current&&s.current.focus()};return Se.useEffect(()=>{const a=s.current,u=e.current;if(i&&a!==null&&u!==null){const{top:c,left:g}=a.getBoundingClientRect();u.style.top=`${c+a.offsetHeight+Dy}px`,u.style.left=`${Math.min(g,window.innerWidth-u.offsetWidth-20)}px`}},[e,s,i]),Se.useEffect(()=>{const a=s.current;if(a!==null&&i){const u=c=>{const g=c.target;n&&e.current&&e.current.contains(g)||a.contains(g)||l(!1)};return document.addEventListener("click",u),()=>{document.removeEventListener("click",u)}}},[e,s,i,n]),Se.useEffect(()=>{const a=()=>{if(i){const u=s.current,c=e.current;if(u!==null&&c!==null){const{top:g}=u.getBoundingClientRect(),h=g+u.offsetHeight+Dy;h!==c.getBoundingClientRect().top&&(c.style.top=`${h}px`)}}};return document.addEventListener("scroll",a),()=>{document.removeEventListener("scroll",a)}},[s,e,i]),pe.jsxs(pe.Fragment,{children:[pe.jsxs("button",{type:"button",disabled:m,"aria-label":p||d,className:t,onClick:()=>l(!i),ref:s,children:[f&&pe.jsx("span",{className:f}),d&&pe.jsx("span",{className:"text dropdown-button-text",children:d}),pe.jsx("i",{className:"chevron-down"})]}),i&&qr.createPortal(pe.jsx(uE,{dropDownRef:e,onClose:o,children:r}),document.body)]})}function Ly(){return pe.jsx("div",{className:"divider"})}const yp=8,vp=72,zs={h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",paragraph:"Normal"};function fE({selectionFontSize:m,disabled:d,editor:p,blockType:t,styleConfig:f}){const[r,n]=tr.useState(m),[e,s]=tr.useState(t),i=c=>{p.update(()=>{if(p.isEditable()){const g=Oe();g!==null&&Im(g,c)}})},l=c=>{n(c.target.value)},o=()=>{const c=Number(r);if(!isNaN(c)){const g=Math.min(Math.max(c,yp),vp);n(String(g)),i({"font-size":`${g}px`})}},a=c=>{const g=f[e].fontSize,h=c?Math.min(g+2,vp):Math.max(g-2,yp);n(String(h)),i({"font-size":`${h}px`})},u=c=>{if(s(c),c==="paragraph"){const g=f.paragraph;n(String(g.fontSize)),i({"font-size":`${g.fontSize}px`,color:g.fontColor,"font-family":g.fontFamily,"line-height":`${1+g.leadingSpace}em`,"margin-bottom":`${g.trailingSpace}em`})}else{const{fontSize:g,fontColor:h,fontFamily:y,leadingSpace:v,trailingSpace:_}=f[c];n(String(g)),i({"font-size":`${g}px`,color:h,"font-family":y,"line-height":`${1+v}em`,"margin-bottom":`${_}em`})}};return tr.useEffect(()=>{const c=()=>{p.update(()=>{const g=Oe();if(g!==null){const y=g.getNodes()[0];if(!Ne(y)){const v=y.getType();v in zs&&s(v)}}})};return p.registerUpdateListener(c),()=>{p.registerUpdateListener(c)}},[p]),pe.jsxs(pe.Fragment,{children:[pe.jsx("button",{type:"button",disabled:d,onClick:()=>a(!1),className:"toolbar-item font-decrement"}),pe.jsx("input",{type:"number",value:r,disabled:d,readOnly:!0,className:"toolbar-item font-size-input",min:yp,max:vp,onChange:l,onBlur:o}),pe.jsx("button",{type:"button",disabled:d,onClick:()=>a(!0),className:"toolbar-item font-increment"}),pe.jsx(Ly,{}),pe.jsxs("div",{className:"symbol-dropdown cust-head-dropDown",children:[pe.jsxs(dE,{disabled:d,buttonClassName:"toolbar-item block-controls",buttonAriaLabel:"Formatting options for text style",buttonIconClassName:"icon block-type "+e,buttonLabel:zs[e],children:[pe.jsxs($u,{className:`item ${e==="paragraph"?"active":""}`,onClick:()=>u("paragraph"),children:[pe.jsx("i",{className:"icon paragraph"}),pe.jsx("span",{className:"text",children:zs.paragraph})]}),pe.jsxs($u,{className:`item ${e==="h1"?"active":""}`,onClick:()=>u("h1"),children:[pe.jsx("i",{className:"icon h1"}),pe.jsx("span",{className:"text",children:zs.h1})]}),pe.jsxs($u,{className:`item ${e==="h2"?"active":""}`,onClick:()=>u("h2"),children:[pe.jsx("i",{className:"icon h2"}),pe.jsx("span",{className:"text",children:zs.h2})]}),pe.jsxs($u,{className:`item ${e==="h3"?"active":""}`,onClick:()=>u("h3"),children:[pe.jsx("i",{className:"icon h3"}),pe.jsx("span",{className:"text",children:zs.h3})]})]}),pe.jsx(Ly,{})]})]})}const pE="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48IS0tISBGb250IEF3ZXNvbWUgUHJvIDYuMS4xIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlIChDb21tZXJjaWFsIExpY2Vuc2UpIENvcHlyaWdodCAyMDIyIEZvbnRpY29ucywgSW5jLi0tPjxwYXRoIGQ9Ik0wIDI1NkMwIDExNC42IDExNC42IDAgMjU2IDBzMjU2IDExNC42IDI1NiAyNTYtMTE0LjYgMjU2LTI1NiAyNTZTMCAzOTcuNCAwIDI1NnptMTc1LTQ3LjkgNDcuMSA0N0wxNzUgMzAzYy05LjMgOS40LTkuMyAyNC42IDAgMzMuMSA5LjQgMTAuMiAyNC42IDEwLjIgMzMuMSAwbDQ3LTQ2LjIgNDcuOSA0Ni4yYzkuNCAxMC4yIDI0LjYgMTAuMiAzMy4xIDAgMTAuMi04LjUgMTAuMi0yMy43IDAtMzMuMWwtNDYuMi00Ny45IDQ2LjItNDdjMTAuMi04LjUgMTAuMi0yMy43IDAtMzMuMS04LjUtOS4zLTIzLjctOS4zLTMzLjEgMGwtNDcuOSA0Ny4xLTQ3LTQ3LjFjLTguNS05LjMtMjMuNy05LjMtMzMuMSAwLTkuMyA5LjQtOS4zIDI0LjYgMCAzMy4xeiIvPjwvc3ZnPg==",hE="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iY3VycmVudENvbG9yIiBjbGFzcz0iYmkgYmktdGFibGUiPjxwYXRoIGQ9Ik0wIDJhMiAyIDAgMCAxIDItMmgxMmEyIDIgMCAwIDEgMiAydjEyYTIgMiAwIDAgMS0yIDJIMmEyIDIgMCAwIDEtMi0yVjJ6bTE1IDJoLTR2M2g0VjR6bTAgNGgtNHYzaDRWOHptMCA0aC00djNoM2ExIDEgMCAwIDAgMS0xdi0yem0tNSAzdi0zSDZ2M2g0em0tNSAwdi0zSDF2MmExIDEgMCAwIDAgMSAxaDN6bS00LTRoNFY4SDF2M3ptMC00aDRWNEgxdjN6bTUtM3YzaDRWNEg2em00IDRINnYzaDRWOHoiLz48L3N2Zz4=";function gE(){const[m,d]=Se.useState("4"),[p,t]=Se.useState("4"),[f,r]=Se.useState(!1),[n,e]=Se.useState(),[s]=Pr(),i=()=>{!m||!p||(s.update(()=>{const l=d0(m,p,!0),o=Bm(l);e(o)}),r(!1))};return pe.jsxs(pe.Fragment,{children:[pe.jsx("button",{className:"toolbar-item ",onClick:()=>r(!0),children:pe.jsx("img",{className:"add-toolbar-table-icon",src:hE,alt:"Add Table"})}),f&&pe.jsx("div",{className:"modal-overlay",children:pe.jsxs("div",{className:"modal-content",children:[pe.jsx("h3",{children:"Select Table Dimensions"}),pe.jsx("button",{className:"modal-buttons-close",onClick:()=>r(!1),children:pe.jsx("img",{src:pE,height:16,width:16,style:{margin:"0 0 29px 10px"}})}),pe.jsxs("div",{className:"select-table-container",children:[pe.jsx("label",{children:"Rows"}),pe.jsx("input",{type:"number",value:m,onChange:l=>d(Number(l.target.value))})]}),pe.jsxs("div",{className:"select-table-container",children:[pe.jsx("label",{children:"Column"}),pe.jsx("input",{type:"number",value:p,onChange:l=>t(Number(l.target.value))})]}),pe.jsx("div",{children:pe.jsx("div",{className:"modal-buttons",children:pe.jsx("button",{className:"toolbar-item",onClick:i,children:"Confirm"})})})]})})]})}const By="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik00IDEySDIwTTEyIDRWMjAiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4NCjwvc3ZnPg==",Fy="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik02IDEyTDE4IDEyIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+DQo8L3N2Zz4=";var mE=typeof global=="object"&&global&&global.Object===Object&&global;const yE=mE;var vE=typeof self=="object"&&self&&self.Object===Object&&self,bE=yE||vE||Function("return this")();const zy=bE;var _E=zy.Symbol;const Hu=_E;var Uy=Object.prototype,xE=Uy.hasOwnProperty,wE=Uy.toString,Xl=Hu?Hu.toStringTag:void 0;function SE(m){var d=xE.call(m,Xl),p=m[Xl];try{m[Xl]=void 0;var t=!0}catch{}var f=wE.call(m);return t&&(d?m[Xl]=p:delete m[Xl]),f}var EE=Object.prototype,CE=EE.toString;function kE(m){return CE.call(m)}var OE="[object Null]",TE="[object Undefined]",$y=Hu?Hu.toStringTag:void 0;function AE(m){return m==null?m===void 0?TE:OE:$y&&$y in Object(m)?SE(m):kE(m)}function jE(m){return m!=null&&typeof m=="object"}var PE="[object Symbol]";function NE(m){return typeof m=="symbol"||jE(m)&&AE(m)==PE}var IE=/\s/;function RE(m){for(var d=m.length;d--&&IE.test(m.charAt(d)););return d}var ME=/^\s+/;function DE(m){return m&&m.slice(0,RE(m)+1).replace(ME,"")}function bp(m){var d=typeof m;return m!=null&&(d=="object"||d=="function")}var Hy=0/0,LE=/^[-+]0x[0-9a-f]+$/i,BE=/^0b[01]+$/i,FE=/^0o[0-7]+$/i,zE=parseInt;function qy(m){if(typeof m=="number")return m;if(NE(m))return Hy;if(bp(m)){var d=typeof m.valueOf=="function"?m.valueOf():m;m=bp(d)?d+"":d}if(typeof m!="string")return m===0?m:+m;m=DE(m);var p=BE.test(m);return p||FE.test(m)?zE(m.slice(2),p?2:8):LE.test(m)?Hy:+m}var UE=function(){return zy.Date.now()};const _p=UE;var $E="Expected a function",HE=Math.max,qE=Math.min;function WE(m,d,p){var t,f,r,n,e,s,i=0,l=!1,o=!1,a=!0;if(typeof m!="function")throw new TypeError($E);d=qy(d)||0,bp(p)&&(l=!!p.leading,o="maxWait"in p,r=o?HE(qy(p.maxWait)||0,d):r,a="trailing"in p?!!p.trailing:a);function u(w){var S=t,C=f;return t=f=void 0,i=w,n=m.apply(C,S),n}function c(w){return i=w,e=setTimeout(y,d),l?u(w):n}function g(w){var S=w-s,C=w-i,k=d-S;return o?qE(k,r-C):k}function h(w){var S=w-s,C=w-i;return s===void 0||S>=d||S<0||o&&C>=r}function y(){var w=_p();if(h(w))return v(w);e=setTimeout(y,g(w))}function v(w){return e=void 0,a&&t?u(w):(t=f=void 0,n)}function _(){e!==void 0&&clearTimeout(e),i=0,t=s=f=e=void 0}function b(){return e===void 0?n:v(_p())}function x(){var w=_p(),S=h(w);if(t=arguments,f=this,s=w,S){if(e===void 0)return c(s);if(o)return clearTimeout(e),e=setTimeout(y,d),u(s)}return e===void 0&&(e=setTimeout(y,d)),n}return x.cancel=_,x.flush=b,x}function JE(m,d,p){const t=Se.useRef(null);return t.current=m,Se.useMemo(()=>WE((...f)=>{t.current&&t.current(...f)},d,{maxWait:p}),[d,p])}const Wy=20;function VE({anchorElem:m}){const[d]=Pr(),p=mu(),[t,f]=Se.useState(!1),[r,n]=Se.useState(!1),[e,s]=Se.useState(!1),[i,l]=Se.useState({}),o=Se.useRef(new Set),a=Se.useRef(null),u=JE(y=>{const{isOutside:v,tableDOMNode:_}=KE(y);if(v){f(!1),n(!1);return}if(!_)return;a.current=_;let b=null,x=null,w=null;if(d.update(()=>{var C;const S=ir(_);if(rn(S)){const k=bn(S,D=>In(D));if(!In(k))return;if(w=d.getElementByKey(k==null?void 0:k.getKey()),w){const D=k.getChildrenSize(),N=(C=k.getChildAtIndex(0))==null?void 0:C.getChildrenSize(),O=dx(S),R=p0(S);O===D-1?b=S:R===N-1&&(x=S)}}}),w){const{width:S,y:C,right:k,left:D,bottom:N,height:O}=w.getBoundingClientRect(),{y:R,left:A}=m.getBoundingClientRect();b?(n(!1),f(!0),l({height:Wy,left:D-A,top:N-R+5,width:S})):x&&(n(!0),f(!1),l({height:O,left:k-A+5,top:C-R,width:Wy}))}},50,250),c=Se.useMemo(()=>new ResizeObserver(()=>{f(!1),n(!1)}),[]);Se.useEffect(()=>{if(e)return document.addEventListener("mousemove",u),()=>{f(!1),n(!1),u.cancel(),document.removeEventListener("mousemove",u)}},[e,u]),Se.useEffect(()=>vo(d.registerMutationListener(_o,y=>{d.getEditorState().read(()=>{for(const[v,_]of y){const b=d.getElementByKey(v);switch(_){case"created":o.current.add(v),s(o.current.size>0),b&&c.observe(b);break;case"destroyed":o.current.delete(v),s(o.current.size>0),c.disconnect(),o.current.forEach(x=>{const w=d.getElementByKey(x);w&&c.observe(w)});break}}})})),[d,c]);const g=y=>{d.update(()=>{if(a.current){const v=ir(a.current);v==null||v.selectEnd(),y?(fx(),f(!1)):(px(),n(!1))}})},h=y=>{d.update(()=>{if(a.current){const v=ir(a.current);v==null||v.selectEnd(),y?(hx(),f(!1)):(gx(),n(!1))}})};return p?pe.jsxs(pe.Fragment,{children:[t&&pe.jsxs("div",{children:[pe.jsx("button",{className:"PlaygroundEditorTheme__tableAddRows",style:{...i,flex:"50%",padding:"20px"},onClick:()=>g(!0),children:pe.jsx("img",{src:By,height:14,width:14,style:{color:"grey",marginLeft:"-3px"}})}),pe.jsx("button",{className:"PlaygroundEditorTheme__tableAddRows",style:{...i,flex:"50%"},onClick:()=>h(!0),children:pe.jsx("img",{src:Fy,height:14,width:14,style:{color:"grey",marginLeft:"-3px"}})})]}),r&&pe.jsxs("div",{className:"table-add-row-flex-container",children:[pe.jsx("button",{className:"PlaygroundEditorTheme__tableAddColumns table-add-row-flex-children",style:{...i,flex:"50%",padding:"20px"},onClick:()=>g(!1),children:pe.jsx("img",{src:By,height:14,width:14,style:{color:"grey",marginLeft:"-3px"}})}),pe.jsx("button",{className:"PlaygroundEditorTheme__tableAddColumns table-add-row-flex-children",style:{...i,flex:"50%"},onClick:()=>h(!1),children:pe.jsx("img",{src:Fy,height:14,width:14,style:{color:"grey",marginLeft:"-3px"}})})]})]}):null}function KE(m){const d=m.target;if(d&&d instanceof HTMLElement){const p=d.closest("td.PlaygroundEditorTheme__tableCell, th.PlaygroundEditorTheme__tableCell");return{isOutside:!(p||d.closest("button.PlaygroundEditorTheme__tableAddRows")||d.closest("button.PlaygroundEditorTheme__tableAddColumns")||d.closest("div.TableCellResizer__resizer")),tableDOMNode:p}}else return{isOutside:!0,tableDOMNode:null}}function GE({anchorElem:m=document.body}){return mu()?qr.createPortal(pe.jsx(VE,{anchorElem:m}),m):null}const xp=1;function wp(){return pe.jsx("div",{className:"divider"})}function YE({renderOnlineUsers:m,styleConfig:d}){const[p]=Pr(),t=Se.useRef(null),[f,r]=Se.useState(!1),[n,e]=Se.useState(!1),[s,i]=Se.useState(!1),[l,o]=Se.useState(!1),[a,u]=Se.useState(!1),[c,g]=Se.useState(!1),[h,y]=Se.useState(!1),[v,_]=Se.useState(!1),[b,x]=Se.useState("11px"),[w,S]=Se.useState(()=>p.isEditable()),C=Se.useCallback(()=>{const k=Oe();xe(k)&&(i(k.hasFormat("bold")),o(k.hasFormat("italic")),u(k.hasFormat("underline")),g(k.hasFormat("strikethrough")),y(k.hasFormat("subscript")),_(k.hasFormat("superscript")),x(Rm(k,"font-size","11px")))},[]);return Se.useEffect(()=>vo(p.registerUpdateListener(({editorState:k})=>{k.read(()=>{C()})}),p.registerCommand(Ko,(k,D)=>(C(),!1),xp),p.registerCommand(os,k=>(r(k),!1),xp),p.registerCommand(rs,k=>(e(k),!1),xp)),[p,C]),pe.jsxs("div",{className:"toolbar",ref:t,children:[pe.jsx("button",{disabled:!f,onClick:()=>{p.dispatchCommand(ml,void 0)},className:"toolbar-item spaced","aria-label":"Undo",children:pe.jsx("i",{className:"format undo"})}),pe.jsx("button",{disabled:!n,onClick:()=>{p.dispatchCommand(yl,void 0)},className:"toolbar-item","aria-label":"Redo",children:pe.jsx("i",{className:"format redo"})}),pe.jsx(wp,{}),pe.jsx(fE,{selectionFontSize:b.slice(0,-2),editor:p,disabled:!w,blockType:"paragraph",styleConfig:d}),pe.jsx(wp,{}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(Or,"bold")},className:"toolbar-item spaced "+(s?"active":""),"aria-label":"Format Bold",children:pe.jsx("i",{className:"format bold"})}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(Or,"italic")},className:"toolbar-item spaced "+(l?"active":""),"aria-label":"Format Italics",children:pe.jsx("i",{className:"format italic"})}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(Or,"underline")},className:"toolbar-item spaced "+(a?"active":""),"aria-label":"Format Underline",children:pe.jsx("i",{className:"format underline"})}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(Or,"strikethrough")},className:"toolbar-item spaced "+(c?"active":""),"aria-label":"Format Strikethrough",children:pe.jsx("i",{className:"format strikethrough"})}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(Or,"superscript")},className:"toolbar-item spaced "+(v?"active":""),"aria-label":"Format SuperScript",children:pe.jsx("img",{src:cE,height:16,width:16,style:{marginTop:"1px"}})}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(Or,"subscript")},className:"toolbar-item spaced "+(h?"active":""),"aria-label":"Format SubScript",children:pe.jsx("img",{src:lE,height:16,width:16,style:{marginTop:"1px"}})}),pe.jsx(wp,{}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(ns,"left")},className:"toolbar-item spaced","aria-label":"Left Align",children:pe.jsx("i",{className:"format left-align"})}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(ns,"center")},className:"toolbar-item spaced","aria-label":"Center Align",children:pe.jsx("i",{className:"format center-align"})}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(ns,"right")},className:"toolbar-item spaced","aria-label":"Right Align",children:pe.jsx("i",{className:"format right-align"})}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(ns,"justify")},className:"toolbar-item","aria-label":"Justify Align",children:pe.jsx("i",{className:"format justify-align"})}),pe.jsx(gE,{}),pe.jsx(GE,{}),pe.jsx("div",{className:"avtar-outer-div",children:m()})]})}var Sp={exports:{}},Sn={};/** @license React v16.13.1
1429
+ `,A.append(q),_=q}!R&&w.width<1&&r.length>1&&(A.style.width="3px")}v.forEach(x=>{this.hoverList.push([x,_,e])})});this.remoteSelections=[],this.isEditingInProgress=!1,this.hoverList=[],this.trackedNodesKeys=new Set,this.remoteSelectionDOMsMap={},this.activeEditorsKeys={},this.keyboardBindedListener=this._keyboardEventsListener.bind(this),this.mouseBindedListener=this._mouseEventsListener.bind(this),this.resizeBindedListener=this._resizeEventListener.bind(this),this.hideInUI=!1}_mouseEventsListener(d){let p=!1,t=d.target,f=!1,r=3;for(;r&&t;){if(t.__codox_track){p=!0;break}if(t.__lexicalEditor){p=!0,f=!0;break}t=t.parentNode,r--}if(!p)return;let n=null;for(let i in this.activeEditorsKeys){if(t[`__lexicalKey_${i}`]){n=i;break}t.__lexicalEditor&&(n=t.__lexicalEditor._key)}if(!n)return;let e=f?"root":t[`__lexicalKey_${n}`];if(!e||!this.trackedNodesKeys.has(`${e}__${n}`))return;let s=new Set;for(let i=0;i<this.hoverList.length;i++){let l=this.hoverList[i],[o,a,u]=l;if(s.has(u))continue;let c=er.isMousePositionWithinElementCords(d,o);d.type===wr.mouseover&&c&&(a.style.animation=this.isEditingInProgress?er.tooltipAnimations.hideAtOnce:er.tooltipAnimations.showAtOnce,s.add(u)),d.type===wr.mouseout&&(a.style.animation=er.tooltipAnimations.hideWithDelay,s.add(u)),d.type===wr.mousemove&&c&&(a.style.animation=this.isEditingInProgress?er.tooltipAnimations.hideAtOnce:er.tooltipAnimations.showAtOnce,s.add(u))}}_keyboardEventsListener(d){d.type===wr.keypress&&(this.isEditingInProgress||(this.isEditingInProgress=!0)),d.type===wr.keyup&&this.isEditingInProgress&&(this.isEditingInProgress=!1)}_resizeEventListener(d){we.mainEditorExists()&&this.paintRemoteSelections(this.remoteSelections)}mount(){window.addEventListener(wr.keypress,this.keyboardBindedListener),window.addEventListener(wr.keyup,this.keyboardBindedListener),window.addEventListener(wr.resize,this.resizeBindedListener),window.addEventListener(wr.scroll,this.resizeBindedListener);for(const d of M0)window.addEventListener(d,this.mouseBindedListener)}unmount(){window.removeEventListener(wr.keypress,this.keyboardBindedListener),window.removeEventListener(wr.keyup,this.keyboardBindedListener),window.removeEventListener(wr.resize,this.resizeBindedListener),window.removeEventListener(wr.scroll,this.resizeBindedListener);for(const d of M0)window.removeEventListener(d,this.mouseBindedListener);this.gcPrevPaintedRemoteSelections()}shouldUpdateRemoteSelections(){return!0}gcPrevPaintedRemoteSelections(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];for(let p in this.remoteSelectionDOMsMap)this.remoteSelectionDOMsMap[p].remove();this.hoverList=[],this.trackedNodesKeys=new Set,this.remoteSelections=d||[],this.remoteSelectionDOMsMap={},this.activeEditorsKeys={}}paintRemoteSelections(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];this.gcPrevPaintedRemoteSelections(d);let p=we.getMainEditorState();p.read&&p.read(()=>{for(let t of this.remoteSelections)if(ap.validateJSONSelection(t,np.remote))if($e.isNestedSelectionJSON(t)){let{nestedSelectionJSON:f,nestedEditor:r}=$e.getNestedSelectionJSONFromMainSelectionJSON(t);if(!r)continue;r.getEditorState().read(()=>{let n=$e.JSONToLexical(f);if(n)try{this.paintSingleRemoteSelection({editor:r,selectionJSON:t,lexicalSelection:n,selectedNodes:n.getNodes(),isBackward:n.isBackward()})}catch(e){le.warn("[PAINT REMOTE SELECTION] failed for nested editor - ",{error:e,nestedSelectionJSON:f,fullSelection:t,lexicalSelection:n})}else le.error("DEBUGGER: [paintRemoteSelections] nested selection from json to lexical is null: ",{selection:t,nestedSelectionJSON:f,lexicalSelection:n})})}else{let f=$e.JSONToLexical(t);if(!f){le.error("DEBUGGER: [paintRemoteSelections] selection from json to lexical is null: ",{selection:t,lexicalSelection:f});continue}try{this.paintSingleRemoteSelection({editor:we.getMainEditor(),selectionJSON:t,lexicalSelection:f,selectedNodes:f.getNodes(),isBackward:f.isBackward()})}catch(r){le.warn("[PAINT REMOTE SELECTION] failed - ",{error:r,fullSelection:t,lexicalSelection:f})}}})}updateRemoteSelections(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";this.shouldUpdateRemoteSelections(d)&&(le.log("[updateRemoteSelections] "+p,{newRemoteSelections:d}),Promise.resolve().then(()=>{this.paintRemoteSelections(d),this.hideInUI&&this.hideRemoteSelectionsFromUI()}))}clear(){this.gcPrevPaintedRemoteSelections()}getCurrentRemoteSelections(){return this.remoteSelections}hideRemoteSelectionsFromUI(){this.hideInUI||(this.hideInUI=!0);const d=document.querySelectorAll(".codox_remote_selection");for(let p of d)p.classList.add("hidden_codox_remote_selection")}showHiddenRemoteSelectionsInUI(){this.hideInUI=!1;const d=document.querySelectorAll(".hidden_codox_remote_selection");for(let p of d)p.classList.remove("hidden_codox_remote_selection")}}const xo=new aS;function sS(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).findIndex(m=>m===ka.editorState)}function Au(m){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,p=we.getMainEditorNodesClassesMap();const{klass:t}=p.get(m.type)||{};if(!t)return;const f=t.importJSON(m);if(m.children&&m.children.length)for(const r of m.children)Au(r,f);return d&&d.getChildrenSize&&d.splice(d.getChildrenSize(),0,[f]),f}function ju(m){if(m.getChildren)for(let d of m.getChildren())ju(d);m.remove()}function Q0(m){m.__parent=null,m.__next=null,m.__prev=null}function ty(m,d){return!!we.isLexicalEditorInstance(m)&&!(typeof d!="object"||!d.editorState||(m.update(()=>{try{let p=(0,ve.$getSelection)();const t=m.parseEditorState(d.editorState);if(t.isEmpty())return(0,ve.$getRoot)().clear(),!0;(0,ve.$setSelection)(p),m.setEditorState(t)}catch(p){le.error("[stateUpdates][updateNestedEditorState] update nested state and selection error: ",p)}}),0))}function lS(m,d){let p=d;for(const t of m)p=p[t];return p}function Ta(m){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,p=arguments.length>2&&arguments[2]!==void 0&&arguments[2],t=null,f=lS(m,p?d:we.getMainEditorState().toJSON());return f&&(t=Aa(f)?(0,ve.$getRoot)():Pn.get(f.codoxId)),t||le.debug("[WARNING][getLexicalNodeByPathOutOfJSONState] lexical node not found: ",{jsonNode:f,lexicalNode:t,pathArray:m,currentStateJSON:we.getMainEditorState().toJSON(),newStateJSON:d,codoxNodes:Pn.nodesToArray(),searchInNewState:p}),t||(p?t:Ta(m,d,!0))}function ey(m){le.log("[applyFullLexicalStateReplace] clear current state and apply new");const d=(0,ve.$getRoot)();d.clear();let p=we.getMainEditorNodesClassesMap();function t(f){const r=p.get(f.type).klass.importJSON(f);if(f.children)for(const n of f.children)r.append(t(n));return r}for(const f of m.root.children)d.append(t(f))}function cS(m){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(d.length){le.log("[applyDeltasToLexicalState] Original Deltas: ",{newStateJSON:m,deltas:JSON.parse(JSON.stringify(d))});for(const p of d){let{p:t}=p;const f=t[t.length-1],r=f==="children",n=typeof f=="number",e=!n&&!r,s=sS(t),i=s!==-1,l=p.hasOwnProperty("lm")&&typeof p.lm=="number";if(t.length)if(i){let o=s-1,a=Ta(t.slice(0,o),m);if(a){let u=t.slice(0,s),c=m;for(const h of u)c=c[h];let g=Wl(t[o]);ty(a.getWritable()[g],c)}}else{if(r){let o=p.oi;if(!o){le.warn("[applyDeltasToLexicalState][====WARNING====] SKIPPED. Delta oi attr expected for path",{delta:p});continue}if(o.some(u=>!(!u.hasOwnProperty("text")||typeof u.text=="string"))){le.warn("[applyDeltasToLexicalState][====WARNING====] SKIPPED. Delta oi children contain invalid text value",{delta:p});continue}t.length=t.length-1;let a=Ta(t,m);if(!a)continue;if(o.some(u=>!!u.codoxDId)){try{a=a.getWritable()}catch(h){le.debug("[applyDeltasToLexicalState][shouldUpdateLeaves] getWritable error: ",{err:h,delta:p,fullStateJSON:m});continue}let u={};for(let h of a.getChildren())h.codoxDId?u[h.codoxDId]=h:ju(h);let c=[],g=["codoxDId","codoxId","__key","__parent","__prev","__next"];for(let h=0;h<o.length;h++){let y=o[h],v=h===0,_=h===o.length-1,b=null,x=h>=0?c[h-1]:null;if(y.codoxDId){let w=u[y.codoxDId];if(w){w=w.getWritable();let S=Au(y);if(le.debug("[DELTA_DECORATOR_UPDATE]: ",{exisingDecorator:w,tmpDecorator:S}),!S){le.debug("[DELTA_DECORATOR_UPDATE] UPADATE SKIPPED: ",{exisingDecorator:w,tmpDecorator:S});continue}for(let C in S)if(S.hasOwnProperty(C)&&!g.includes(C))if(we.isLexicalEditorInstance(S[C])){let k={editorState:S[C].getEditorState().toJSON()};ty(w[C],k)}else{let k=ep(C),D=y[k];if(D===w[C]||!y.hasOwnProperty(k))continue;let N=D!==void 0&&S[C]!==D?D:S[C];k!=="height"&&k!=="width"||S[C]==="inherit"&&D===0&&(N=S[C]),w[C]=N}S.remove(),Q0(w),b=w,delete u[y.codoxDId]}}b||(b=Au(y),b.codoxDId&&b.__type==="excalidraw"&&b.__data==="[]"&&(b.__data="{}")),b=b.getWritable(),c.push(b),b.__parent=a.__key,v?(a.__first=b.__key,b.__prev=null,_&&(a.__last=b.__key)):_?(a.__last=b.__key,b.__next=null,b.__prev=x.__key,x.__next=b.__key):(b.__prev=x.__key,x.__next=b.__key),a.__size=c.length}for(let h in u){let y=u[h];y=y.getWritable(),Q0(y),ju(y),delete u[h]}}else{let u=o.map(c=>Au(c));a.splice(0,a.getChildrenSize(),u)}}if(n){if(p.ld){const o=p.ld,a=Pn.get(o.codoxId);a.getChildrenSize&&a.getChildrenSize()?ju(a):a.remove()}if(p.li){let o=we.getMainEditorNodesClassesMap();const a=p.li,u=o.get(a.type).klass.importJSON(a);if(t.length===1&&t[0]==="root")(0,ve.$getRoot)().splice(0,0,[u]);else{const c=t[t.length-1];t.length=t.length-2;let g=Ta(t,m);g&&g.splice(c,0,[u])}if(a.children&&a.children.length){let c=function(g,h){const y=o.get(g.type).klass.importJSON(g);if(h.splice(h.getChildrenSize(),0,[y]),g.children&&g.children.length)for(const v of g.children)c(v,y)};for(const g of a.children)c(g,u)}}if(p.oi||p.od){let{p:o,oi:a,od:u}=p,c=Ta(o,m);if(c)try{let g=c.getWritable();if(a){let h=Object.keys(a);for(let y of h)g[Wl(y)]=a[y]}if(u){let h=Object.keys(u);for(let y of h)delete g[Wl(y)]}}catch(g){le.debug("[applyDeltasToLexicalState][delta oi/od] getWritable error: ",{err:g,delta:p})}}if(l){let{p:o,lm:a}=p,u=o[o.length-1],c=a,g=c<u,h=Ta(o,m);if(h){let y=h.getParent().getChildren(),v=y[u],_=y[c];g?_.insertBefore(v):_.insertAfter(v)}}}if(e){const o=t[t.length-1];let a=Wl(o);t.length=t.length-1;let u,c=Ta(t,m);if(!c){le.error("Missing node when update node attr from delta: ",{path:t,delta:p,fullStateJSON:m,currentEditorState:we.getMainEditorState().toJSON()});continue}try{u=c.getWritable()}catch(h){le.debug("[applyDeltasToLexicalState][shouldUpdateBlockAttr] getWritable error: ",{err:h,delta:p})}if(!u)continue;let g=p.oi;if(o==="format"&&(g=lw(g)),o==="direction"&&(c.hasOwnProperty(a)||(a="__dir")),!u.hasOwnProperty(a)){let h=Object.keys(u);for(let y of h){let v=ep(y);if(o.startsWith(v)){a=y;break}}}u[a]=g}}else if(p.oi&&p.oi.root)return ey(p.oi)}}else le.log("[applyDeltasToLexicalState] stop, no deltas: ",d)}function uS(m){let d=m.clipboardData.getData(uw.paste),p=!1;try{d=JSON.parse(d),typeof d=="object"&&d.nodes&&Array.isArray(d.nodes)&&(p=!0)}catch{return!1}if(!p)return!1;if(p){Pn.clearPastedIds();const t=f=>{if(f.codoxId&&Pn.addPastedId(f.codoxId),f.children&&f.children.length)for(const r of f.children)t(r)};for(const f of d.nodes)t(f)}return!1}var dS=m=>{var d={};return on.d(d,m),d};const ny=dS({useCollaborationContext:()=>Sx});var fS=m=>{var d={};return on.d(d,m),d};const $i=fS({LexicalComposerContext:()=>Uf,useLexicalComposerContext:()=>Pr});class ry{constructor(){this.blacklist=Object.keys(D0).reduce((d,p)=>{let t=D0[p];return d[p]=t.reduce((f,r)=>(f[r]=r,f),{}),d},{}),this._isBlacklistedFound=!1,this._clientCallback=null}_shouldSkipNode(d){return d instanceof ve.TextNode||d instanceof ve.ParagraphNode||d instanceof ve.RootNode}setClientCallback(d){this._clientCallback=d}removeClientCallback(){this._clientCallback=null}invokeClientCallback(){this._clientCallback&&this._clientCallback()}trackBlacklisted(d){let p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>2?arguments[2]:void 0;if(sp||p!==Vr.created||this._isBlacklistedFound||!d||!d.__type||this._shouldSkipNode(d))return;let f=t||we.getMainEditorState(),r=d.__type,n=this.blacklist[r];n&&f.read(()=>{let e=d.getParent();for(;e!==null;){let s=e?e.__type:null;if(!s)return;if(n[s])return le.warn("[ContentNestingsWatcher][trackBlacklisted] FOUND: ",{targetNode:d,targetType:r,parent:e,parentType:s,mutationType:p}),void(this._isBlacklistedFound=!0);e=e.getParent()}})}trackBlacklistedInNestedEditor(d){let p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>3?arguments[3]:void 0;if(p!==Vr.created||this._isBlacklistedFound||this._shouldSkipNode(d))return;let f=t.__type,r=d.__type;if(!f||!r)return;let n=this.blacklist[r];n&&n[f]&&(this._isBlacklistedFound=!0,le.warn("[ContentNestingsWatcher][trackBlacklistedInNestedEditor] FOUND: ",{targetNode:d,targetType:r,rootNode:t,rootType:f,mutationType:p}))}isBlacklistedFound(){let d=this._isBlacklistedFound;return d&&(this._isBlacklistedFound=!1),d}}const pS=new ry,Hi=pS,hS=["editorState","prevEditorState","dirtyElements","dirtyLeaves"];function gS(m,d){if(m==null)return{};var p,t,f=mS(m,d);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);for(t=0;t<r.length;t++)p=r[t],d.indexOf(p)>=0||{}.propertyIsEnumerable.call(m,p)&&(f[p]=m[p])}return f}function mS(m,d){if(m==null)return{};var p={};for(var t in m)if({}.hasOwnProperty.call(m,t)){if(d.indexOf(t)>=0)continue;p[t]=m[t]}return p}class yS{constructor(){this.nestedEditorsListenersMap={}}_createNestedEditorUpdatesListener(d,p){let t=!1;return function(f){let{editorState:r,prevEditorState:n,dirtyElements:e,dirtyLeaves:s}=f,i=(gS(f,hS),we.getMainEditor()),l=we.getMainEditorState(),o=r.toJSON(),a=n.toJSON(),u=ip(o,a),c=r._selection,g=n._selection,h=!1,y=null,v=we.isOnlySelectionChanged(e,s),_=d[p];if(le.debug("[NESTED EDITOR LISTENER] invoked: ",{lexicalNode:d,key:d.__key,onlySelectionChanged:v,newEditorStateJSON:o,prevEditorStateJSON:a,isSameState:u,lexicalSelection:c,prevLexicalSelection:g,mainDirtyLeaves:i._dirtyLeaves.size,mainDirtyElements:i._dirtyElements.size,nestedDirtyLeaves:_._dirtyLeaves.size,nestedDirtyElements:_._dirtyElements.size,nestedEditorKey:_._key}),Hi.isBlacklistedFound())return t=!0,le.debug("[NESTED EDITOR LISTENER] BLACKLISTED FOUND - revert to prev state"),we.scanLexicalNodeForNestedEditorAttribute(d)?(_.update(()=>{try{const b=_.parseEditorState(a);if(b.isEmpty())return(0,ve.$getRoot)().clear(),!0;_.setEditorState(b)}catch(b){le.error("[NESTED EDITOR LISTENER] BLACKLISTED FOUND - ROLLBACK ERROR: ",b)}}),void Hi.invokeClientCallback()):void 0;if(t)t=!1;else{if(d.codoxId||d.codoxDId){let b=null;l.read(()=>{b=$e.getNodeAncestorsCodoxIds(d),!d.codoxId&&d.codoxDId&&b.push(d.codoxDId)}),r.read(()=>{let x=ep(p),w=$e.lexicalToJSONNested(c,x,b);y=we.getCurrentNestedSelectionJSON(),h=$e.equalSelectionsJSON(y,w),h||we.setNestedSelectionJSON(w)})}u&&h||i.update(()=>{try{le.debug("[NESTED EDITOR LISTENER] MARKING DIRTY TO TRIGGER UPDATE",{mainTags:i._updateTags,nestedTags:_&&_._updateTags,isSameState:u,isSameSelection:h,onlyNestedSelectionChanged:v,mainDirtyLeaves:i._dirtyLeaves.size,mainDirtyElements:i._dirtyElements.size,nestedDirtyLeaves:_._dirtyLeaves.size,nestedDirtyElements:_._dirtyElements.size,lexicalNode:d,lexicalSelection:c,prevLexicalSelection:g,mainEditorTags:i._updateTags,mainEditorTagsSize:i._updateTags.size}),we.addUpdateTag({fromNestedEditor:!0}),d.markDirty()}catch(b){le.error("[NESTED EDITOR LISTENER] MARKING DIRTY TO TRIGGER UPDATE - ERROR: ",b)}})}}}_isNestedEditorManaged(d){return!!this.nestedEditorsListenersMap[d]}gc(){for(let d in this.nestedEditorsListenersMap)if(!we.getLexicalNodeByKey(d)){let p=this.nestedEditorsListenersMap[d];p&&p(),delete this.nestedEditorsListenersMap[d]}}manageNestedEditorInLexicalNode(d){if(this._isNestedEditorManaged(d.getKey()))return;let p=we.scanLexicalNodeForNestedEditorAttribute(d);if(p){let t=d[p],f=this._createNestedEditorUpdatesListener(d,p),r=[];t._nodes.forEach((s,i,l)=>{let{klass:o}=s,a=t.registerMutationListener(o,u=>{for(let[c,g]of u)if(g===Vr.created){let h=t.getEditorState()._nodeMap.get(c);h&&Hi.trackBlacklistedInNestedEditor(h,g,t.getEditorState(),d)}});r.push(a)});let n=(0,ws.mergeRegister)(t.registerUpdateListener(f),...r),e=d.getKey();this.nestedEditorsListenersMap[e]=n}}gcNestedEditorListenerInLexicalNode(d){let p=d.getKey(),t=this.nestedEditorsListenersMap[p];t&&(t(),delete this.nestedEditorsListenersMap[p])}manageNestedEditorInClonedLexicalNode(d,p){let t=d.getKey();t!==p.getKey()&&this._isNestedEditorManaged(t)&&(this.gcNestedEditorListenerInLexicalNode(d),this.manageNestedEditorInLexicalNode(p))}setNestedEditorSelection(d){let{nestedSelectionJSON:p,nestedEditor:t}=$e.getNestedSelectionJSONFromMainSelectionJSON(d);if(!t)return!1;let f=!0;return t.update(()=>{try{let r=$e.JSONToLexical(p);(0,ve.$setSelection)(r),le.debug("[setNestedEditorSelection]: lexical nested selection: ",r)}catch(r){le.error("[setNestedEditorSelection] set nested selection error: ",r),f=!1}}),f}clearListeners(){for(let d in this.nestedEditorsListenersMap){let p=this.nestedEditorsListenersMap[d];p&&p(),delete this.nestedEditorsListenersMap[d]}}}const vS=new yS,li=vS,bS=function(m){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];try{let p=(0,ve.createEditor)({namespace:"validation",nodes:[...d],onError:e=>{throw e},parentEditor:null});const t=new ry,f=p.parseEditorState(m);if(f.isEmpty())return;p.setEditorState(f);let r=p.getEditorState();const n=r._nodeMap[Symbol.iterator]();for(const e of n){let[s,i]=e;if(i&&(t.trackBlacklisted(i,Vr.created,r),t.isBlacklistedFound()))throw new Error(dw)}}catch(p){throw p}};class _S{constructor(){this.removeCandidateTableKeys=new Set,this.validateTableCandidateKeys=new Set,this.tableFixActions=[]}_scanForCellHeaderState(d,p,t,f){if(p.length<f)return null;let r,n=p.some(s=>s.__headerState===zi.BOTH||s.__headerState===zi.ROW),e=d.some((s,i)=>{if(s.__size<f)return!1;let l=s.getChildAtIndex(t);return!(!l||l.__headerState!==zi.BOTH&&l.__headerState!==zi.COLUMN)});return n&&e?r=zi.BOTH:n&&!e?r=zi.ROW:e&&!n&&(r=zi.COLUMN),r}_isValidCellChildren(d){for(let p of d)if(Ts(p)||!Os(p)&&On(p))return!1;return!0}_createEmptyCell(){let d=(0,Tn.$createTableCellNode)();return d.append((0,ve.$createParagraphNode)()),d}_wrapInvalidCellChildrenIntoParagraph(d){let p=(0,ve.$createParagraphNode)().getWritable(),t=d.getChildren();(d=d.getWritable()).__first=p.__key,d.__last=p.__key,d.__size=1,p.__parent=d.__key,t.forEach((f,r)=>{(f=f.getWritable()).__parent=null,p.append(f)})}_createFixAction_APPEND_CELLS_TO_ROW(d,p){return()=>{le.debug("[TablesValidator][FIX TABLE ACTION - APPEND_CELLS_TO_ROW] invoked: ",{rowKey:d,numOfCellsToAppend:p});let t=(0,ve.$getNodeByKey)(d);for(;p;){let f=(0,Tn.$createTableCellNode)().append((0,ve.$createParagraphNode)());f.setRowSpan(1).setColSpan(1),t.append(f),p--}}}_createFixAction_ADD_PARAGRAPH_TO_EMPTY_CELL(d){return()=>{le.debug("[TablesValidator][FIX TABLE ACTION - ADD_PARAGRAPH_TO_EMPTY_CELL] invoked: ",{cellKey:d}),(0,ve.$getNodeByKey)(d).append((0,ve.$createParagraphNode)())}}_createFixAction_WRAP_CELL_CHILDREN_IN_PARAGRAPH(d){return()=>{le.debug("[TablesValidator][FIX TABLE ACTION - WRAP_CELL_CHILDREN_IN_PARAGRAPH] invoked: ",{cellKey:d});let p=(0,ve.$getNodeByKey)(d);this._wrapInvalidCellChildrenIntoParagraph(p)}}_createFixAction_ADD_ROW_CELL_TO_TABLE_NODE(d){return()=>{le.debug("[TablesValidator][FIX TABLE ACTION - ADD_ROW_CELL_TO_EMPTY_TABLE_NODE] invoked: ",{tableKey:d});let p=(0,ve.$getNodeByKey)(d),t=(0,Tn.$createTableRowNode)();t.append(this._createEmptyCell()),p.append(t)}}_createFixAction_ADD_CELL_TO_EMPTY_ROW_NODE(d,p){return()=>{for(p||(p=1);p;)(0,ve.$getNodeByKey)(d).append(this._createEmptyCell()),p--}}_createFixAction_WRAP_INVALID_ROW_NODE(d,p){return()=>{le.debug("[TablesValidator][FIX TABLE ACTION - WRAP_INVALID_ROW_NODE] invoked: ",{tableKey:d,rowKey:p});let t=(0,ve.$getNodeByKey)(d);if(!t)return;let f=(0,ve.$getNodeByKey)(p);if(!f)return;t=t.getWritable(),f=f.getWritable();let r=f.getPreviousSibling(),n=f.getNextSibling();f.__parent=null,f.__prev=null,f.__next=null;let e=(0,Tn.$createTableRowNode)();if((0,Tn.$isTableCellNode)(f))f.getChildren().length?this._isValidCellChildren()||this._wrapInvalidCellChildrenIntoParagraph(f):f.append((0,ve.$createParagraphNode)()),e.append(f);else{let s=this._isValidCellChildren([f]),i=(0,Tn.$createTableCellNode)();if(e.append(i),s)i.append(f);else{let l=(0,ve.$createParagraphNode)();l.append(f),i.append(l)}}e.__parent=t.__key,t.__first===f.__key&&(t.__first=e.__key),t.__last===f.__key&&(t.__last=e.__key),r&&(r=r.getWritable(),r.__next=e.__key,e.__prev=r.__key),n&&(n=n.getWritable(),n.__prev=e.__key,e.__next=n.__key)}}_createFixAction_WRAP_INVALID_CELL_NODE(d,p){return()=>{le.debug("[TablesValidator][FIX TABLE ACTION - WRAP_INVALID_CELL_NODE] invoked: ",{rowKey:d,cellKey:p});let t=(0,ve.$getNodeByKey)(d);if(!t)return;let f=(0,ve.$getNodeByKey)(p);if(f.remove(),f=(0,ve.$createParagraphNode)(),!f)return;t=t.getWritable(),f=f.getWritable();let r=f.getPreviousSibling(),n=f.getNextSibling(),e=(0,Tn.$createTableCellNode)();if(e.__parent=t.__key,t.__first===f.__key&&(t.__first=e.__key),t.__last===f.__key&&(t.__last=e.__key),r&&(r=r.getWritable(),r.__next=e.__key,e.__prev=r.__key),n&&(n=n.getWritable(),n.__prev=e.__key,e.__next=n.__key),f.__parent=null,f.__prev=null,f.__next=null,this._isValidCellChildren([f]))e.append(f);else{let s=(0,ve.$createParagraphNode)();s.append(f),e.append(s)}}}_createFixAction_APPLY_HEADER_STATE_TO_CELL(d,p){return()=>{le.debug("[TablesValidator][FIX TABLE ACTION - APPLY_HEADER_STATE_TO_CELL] invoked: ",{cellKey:d,headerStateToApply:p});let t=(0,ve.$getNodeByKey)(d);t&&(t=t.getWritable(),t.__headerState=p)}}clear(){this.removeCandidateTableKeys=new Set,this.validateTableCandidateKeys=new Set,this.tableFixActions=[]}tableRemoveEventListener(d){let p=we.getMainEditorState()._selection;if(le.debug(`[${d}]`,{selection:p}),!(0,ve.$isRangeSelection)(p))return;let t=[];try{let f=we.getLexicalNodeByKey(p.anchor.key),r=we.getLexicalNodeByKey(p.focus.key);f&&r&&(t=p.isBackward()?r.getNodesBetween(f):f.getNodesBetween(r))}catch(f){le.warn("[TablesValidator][tableRemoveEventListener] get range selection nodes internal lexical error: ",f)}t.forEach(f=>{(0,Tn.$isTableNode)(f)&&this.removeCandidateTableKeys.add(f.__key)})}tableNodeRemoveListener(d){this.removeCandidateTableKeys.has(d)&&this.removeCandidateTableKeys.delete(d)}shouldGCRemovedTables(){return!!this.removeCandidateTableKeys.size}gcRemovedTables(){le.debug("[TablesValidator][gcRemovedTable] candidate table keys ",{tableKeys:this.removeCandidateTableKeys}),we.getMainEditor().update(()=>{Array.from(this.removeCandidateTableKeys).forEach(d=>{let p=(0,ve.$getNodeByKey)(d);p&&p.remove()}),this.removeCandidateTableKeys.clear(),(0,ve.$addUpdateTag)(oo.historic)})}tableUpdateListener(d){this.validateTableCandidateKeys.add(d)}tableRowNodeChangesListener(d){let p=arguments.length>1&&arguments[1]!==void 0&&arguments[1],t=we.getLexicalNodeByKey(d);if(!t)return void(p&&le.debug("[TablesValidator][tableRowNodeChangesListener] no row node found in lexical: ",{tableRowNodeKey:d}));let f=t.__parent;f?this.validateTableCandidateKeys.add(f):le.debug("[tableRowNodeChangesListener] no parent table for row node found in lexical: ",{rowNode:t})}tableCellNodeChangesListener(d){let p=we.getLexicalNodeByKey(d);if(!p||!p.__parent)return;let t=we.getLexicalNodeByKey(p.__parent);t&&t.__parent&&this.validateTableCandidateKeys.add(t.__parent)}shouldValidateUpdatedTables(){return!!this.validateTableCandidateKeys.size}validateUpdatedTables(){let d=Array.from(this.validateTableCandidateKeys);return we.getMainEditorState().read(()=>{for(let p of d){let t=we.getLexicalNodeByKey(p);if(!t)continue;let f=t.getChildren();if(!f.length){this.tableFixActions.push(this._createFixAction_ADD_ROW_CELL_TO_TABLE_NODE(p));continue}let r=0;f.forEach(i=>{i.__size>r&&(r=i.__size)});let n=[],e=f.map((i,l)=>{if(!(0,Tn.$isTableRowNode)(i))return this.tableFixActions.push(this._createFixAction_WRAP_INVALID_ROW_NODE(p,i.__key)),"invalid_row_node";let o=i.getChildren();if(!o.length&&!n.length)return this.tableFixActions.push(this._createFixAction_ADD_CELL_TO_EMPTY_ROW_NODE(i.__key,r)),"empty_row_should_add_cell";if(!o.length&&n.length)return n=[],"empty_row_should_be_empty";let a=0;if(n.length){let c=[];n.forEach(g=>{let[h,y]=g;a+=y,h--,h&&c.push([h,y])}),n=[...c]}let u=o.map((c,g)=>{if(!(0,Tn.$isTableCellNode)(c))return this.tableFixActions.push(this._createFixAction_WRAP_INVALID_CELL_NODE(i.__key,c.__key)),a++,"invalid_cell_node_should_wrap_in_cell";let h,y=c.getChildren(),v=!y.length;if(v?this.tableFixActions.push(this._createFixAction_ADD_PARAGRAPH_TO_EMPTY_CELL(c.__key)):(h=this._isValidCellChildren(y),h||this.tableFixActions.push(this._createFixAction_WRAP_CELL_CHILDREN_IN_PARAGRAPH(c.__key))),c.__rowSpan>1){let _=c.__rowSpan,b=c.__colSpan;n.push([_-1,b])}if(a+=c.__colSpan,c.__headerState===zi.NO_STATUS){let _=this._scanForCellHeaderState(f,o,g,r);_&&this.tableFixActions.push(this._createFixAction_APPLY_HEADER_STATE_TO_CELL(c.__key,_))}return{cellKey:c.__key,rowKey:i.__key,tableKey:p,colSpan:c.__colSpan,rowSpan:c.__rowSpan,headerState:c.__headerState,childrenAreValid:h,isEmptyCell:v}});if(a<r){let c=r-a;this.tableFixActions.push(this._createFixAction_APPEND_CELLS_TO_ROW(i.__key,c))}return{realRowLength:a,rowKey:i.__key,tableKey:p,cells:u}}),s=!this.tableFixActions.length;le[s?"debug":"warn"](`[TablesValidator][validateUpdatedTables] IS TABLE VALID: ${s}`,{tableNodeKey:p,tableValidationMatrix:e,requiredRowLength:r}),this.validateTableCandidateKeys.delete(p)}}),!this.tableFixActions.length}shouldFixTablesStructure(){return!!this.tableFixActions.length}fixTablesStructure(){if(!this.tableFixActions.length)return;let d=we.getMainEditor();le.log("[TablesValidator][fixTablesStructure]: fix actions to apply - count: ",this.tableFixActions.length),d.update(()=>{for(let p of this.tableFixActions)p();this.tableFixActions=[],(0,ve.$addUpdateTag)(oo.historic)})}ensureDocTablesAreValid(d){return this.shouldGCRemovedTables()?(le.warn("[TablesValidator][GARBAGE COLLECT TABLE NODES AFTER TABLE REMOVAL ATTEMPT]"),this.gcRemovedTables(),!1):!(this.shouldValidateUpdatedTables()&&(le.debug("[TablesValidator][shouldValidateUpdatedTables] invoked"),!this.validateUpdatedTables()))||(le.warn("[TablesValidator][shouldValidateUpdatedTables] INVALID LEXICAL TABLE(S) STRUCTURE FOUND - FIXING",{state:JSON.parse(JSON.stringify(d.toJSON()))}),this.fixTablesStructure(),!1)}}const Io=new _S,xS=["contentChanged"],wS=["state","remoteSelection"];function oy(m,d){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(m);d&&(t=t.filter(function(f){return Object.getOwnPropertyDescriptor(m,f).enumerable})),p.push.apply(p,t)}return p}function Cs(m){for(var d=1;d<arguments.length;d++){var p=arguments[d]!=null?arguments[d]:{};d%2?oy(Object(p),!0).forEach(function(t){SS(m,t,p[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):oy(Object(p)).forEach(function(t){Object.defineProperty(m,t,Object.getOwnPropertyDescriptor(p,t))})}return m}function SS(m,d,p){return(d=ES(d))in m?Object.defineProperty(m,d,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[d]=p,m}function ES(m){var d=CS(m,"string");return typeof d=="symbol"?d:d+""}function CS(m,d){if(typeof m!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var t=p.call(m,d||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(d==="string"?String:Number)(m)}function iy(m,d){if(m==null)return{};var p,t,f=kS(m,d);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);for(t=0;t<r.length;t++)p=r[t],d.indexOf(p)>=0||{}.propertyIsEnumerable.call(m,p)&&(f[p]=m[p])}return f}function kS(m,d){if(m==null)return{};var p={};for(var t in m)if({}.hasOwnProperty.call(m,t)){if(d.indexOf(t)>=0)continue;p[t]=m[t]}return p}const sp={DEBUG:!1,VERSION:"1.0.2",NAME:"@codoxhq/lexical-provider",SDKUI_SOURCE_PATH:"../../../sdkui/dist-production2/codox.bundle.js"}.LOCAL==="true";le.info("MODE: ","production");const OS=m=>async()=>{const{state:d,timestamp:p}=await m();if(!we.isValidJSONState(d))throw new Error("Invalid state received from fetchDocOnNetworkReconnect hook");const{commentThreads:t,root:f}=d,r={content:{comments:t,root:f},timestamp:p};return le.info("[decorateFetchOnReconnctHook] hook invoked: ",{returnObj:r}),r};let Pu=0,ci=null,lp=!1,wo={},cp={};const TS=(0,Gt.forwardRef)((m,d)=>{let{onBlacklistedInsert:p}=m;const t=(0,Gt.useContext)($i.LexicalComposerContext);if(!t)throw new Error("[CodoxCollabPlugin] CodoxCollabPlugin must be inited inside <LexicalComposer> component - LexicalComposerContext is missing");const[f]=(0,$i.useLexicalComposerContext)(),r=(0,ny.useCollaborationContext)();(0,Gt.useEffect)(()=>{if(le.debug("[INIT] lexical context check: ",{lexicalContext:t,editor:f}),!f)return;le.log("[useEffect][editor] Editor instance changed: ",{editor:f,key:f._key}),we.setMainEditor(f),Pn.gcAbandonedNodes(),li.gc(),Io.clear(),le.log("[useEffect][editor] subscribe to editor changes");const v=(0,ws.mergeRegister)(f.registerUpdateListener(g),f.registerCommand(ve.PASTE_COMMAND,uS,ve.COMMAND_PRIORITY_CRITICAL),f.registerCommand(ve.UNDO_COMMAND,()=>{we.setUndoInvoked(!0)},ve.COMMAND_PRIORITY_CRITICAL),f.registerCommand(ve.REDO_COMMAND,()=>{we.setRedoInvoked(!0)},ve.COMMAND_PRIORITY_CRITICAL),f.registerCommand(ve.KEY_DELETE_COMMAND,(b,x)=>{Io.tableRemoveEventListener("KEY_DELETE_COMMAND")},ve.COMMAND_PRIORITY_CRITICAL),f.registerCommand(ve.KEY_BACKSPACE_COMMAND,(b,x)=>{Io.tableRemoveEventListener("KEY_BACKSPACE_COMMAND")},ve.COMMAND_PRIORITY_CRITICAL),f.registerCommand(ve.CUT_COMMAND,(b,x)=>{Io.tableRemoveEventListener("CUT_COMMAND")},ve.COMMAND_PRIORITY_CRITICAL),...h());xo.mount(),we.alignStateSelectionJSONsFromLatestEditor(),le.debug("New editor mounted: ",{isCodoxStarted:we.isCodoxStarted,codoxLexicalEditorManager:we,nestedEditorsProcessor:li});let _=f._onError;return f._onError=b=>{le.error("[ERROR HANDLER WRAPPER] error from editor: ",b),_&&_(b),c()},p&&Hi.setClientCallback(p),()=>{we.getMainEditorKey()&&(le.debug("Unmount prev editor"),v(),we.removeMainEditor(),xo.unmount(),we.clearJSONs(),kn.clear(),Io.clear(),we.isCodoxStarted&&(le.debug("EDITOR USE_EFFECT stopping codox"),n(),we.setIsCodoxStarted(!1)),Hi.removeClientCallback())}},[f]);const n=()=>{we.isCodoxStarted&&(le.log("[stopCodoxInstance] stopping codox"),we.setIsCodoxStarted(!1),sp||ei().stop(),we.clearJSONs(),Pn.clearAll(),xo.clear(),kn.resetComments(),li.clearListeners())},e=async v=>{le.debug("[startCodoxInstance] invoked"),ei().createNewInstance(),le.debug("[startCodoxInstance] instance created");for(let O in cp)ei().instance.on(O,cp[O]);if(le.debug("[startCodoxInstance] events subscribed"),wo=v,ci=wo.docId,!ci)return le.error("[startCodoxInstance] - start codox skipped - docId is missing",{docId:ci});let _=kn.initialCommentsExist();le.debug("[startCodoxInstance] initCommentsExist: ",_),_&&(kn.activateInitialComments(f,Pn),le.log("[activateInitialComments] "));let b=we.getMainEditorState().toJSON();if(!we.isValidJSONState(b))throw le.error("[startCodoxInstance] - start codox skipped - invalid init state",{docId:ci,initJSONState:b}),new Error("start codox skipped - invalid init state");le.log("[startCodoxInstance] starting codox with: ",{docId:ci,initJSONState:b,config:wo,codoxComments:kn}),we.currentContentStateJSON||we.setCurrentContentStateJSON(b),we.isCodoxStarted&&n();let{username:x,apiKey:w,getServerState:S,domain:C="",demo:k=!1,hooks:D}=wo;D&&D.fetchDocOnNetworkReconnect&&(D.fetchDocOnNetworkReconnect=OS(D.fetchDocOnNetworkReconnect));const N=iy(D,xS);await ei().start(ei().createConfig(Cs(Cs({},wo),{},{docId:ci,username:x,apiKey:w,domain:C,hooks:Cs({syncState:l,getState:i,getServerState:async()=>await S(ci)},N),editorInstanceHooks:{getSelection:()=>we.getCurrentActiveSelectionJSON(),setSelection:O=>o(O),getState:i,setState:O=>{const{root:R,comments:A}=O;le.info("DEBUG: EDITOR INSTANCE setState:",{fullState:O}),a({state:{root:R},selection:we.getCurrentActiveSelectionJSON()},xo.getCurrentRemoteSelections()),kn.setAllComments(A)},enableEditor:()=>{we.disableEditorReadOnlyMode()},disableEditor:()=>{we.enableEditorReadOnlyMode(),xo.updateRemoteSelections([])},getContent:()=>{let O=we.composeFullStateWithRootAndComments();return le.info("[getContent]: ",O),{state:O}}},appServer:wo.appServer,demo:k}))),le.log("[startCodoxInstance] codox started - first sync invoking"),we.setIsCodoxStarted(!0),r.clientID=wo.username,r.name=wo.username,u()},s=()=>{let v=we.composeFullStateWithRootAndComments({directlyFromEditor:!0});e(v)},i=()=>({state:Cs(Cs({},we.getMainEditorState().toJSON()),{},{comments:kn.getAllComments()}),docId:ci}),l=v=>{if(!we.isCodoxStarted)return;le.log("[SYNC_STATE]: Before sync payload = ",v);const _=ei().sync({meta:v}),{state:b,remoteSelection:x=[]}=_,w=iy(_,wS);if(le.log("[SYNC_STATE]: After sync",{state:b,remoteSelection:x,rest:w}),!b)return le.error("[SYNC_STATE] abort apply - synced state is not valid - restarting codox"),s();const S=b.state;le.log("[SYNC_STATE] synced state: ",{synced:JSON.parse(JSON.stringify(S))});let{stateFromSync:C,commentsFromSync:k}=we.extractStateAndCommentsFromSynced(S);if(!we.isValidJSONState(C.state))return le.error("[SYNC_STATE] - invalid state from sync - local update skipped - restarting codox",{contentState:C.state}),s();a(C,x),kn.setAllComments(k)},o=v=>{if(!we.isCodoxStarted||(le.log("[setLocalSelectionFromSync] synced selection: ",{syncedSelectionJSON:v}),!ap.validateJSONSelection(v,np.local)))return;let _=we.getCurrentActiveSelectionJSON();if($e.equalSelectionsJSON(_,v))return void le.log("[setLocalSelectionFromSync] STOP - local and synced selections are equal");let b=$e.isNestedSelectionJSON(v);f.update(()=>{le.log("[setLocalSelectionFromSync] json selection to apply: ",{syncedSelectionJSON:v});const x=$e.JSONToLexical(v);if(le.log("[setLocalSelectionFromSync] lexical selection to apply: ",x),b){let w=li.setNestedEditorSelection(v);we.setNestedSelectionJSON(w?v:null)}else(0,ve.$setSelection)(x),we.setMainSelectionJSON(v);le.log("[setLocalSelectionFromSync] selection updated. latest selection: ",{latestSelectionJSON:we.getCurrentActiveSelectionJSON()})})},a=function(){let{state:v,selection:_,stateReplace:b}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",S=we.getCurrentContentStateJSON();le.log("[updateEditor] invoked: ",{currentContentStateJSON:JSON.parse(JSON.stringify(S)),newStateJSON:JSON.parse(JSON.stringify(v)),newSelectionJSON:_,remoteSelection:x,stateReplace:b,editor:f}),_===void 0&&le.error("SELECTION FROm SYNC IS UNDEFINED - will default prev selection",_);const C=ip(S,v),k=$e.equalSelectionsJSON(we.getCurrentActiveSelectionJSON(),_);f.update(()=>{if(we.addUpdateTag({isSameState:C,isSameSelection:k,updateTag:w}),b)le.log("[updateEditor] invoke full stateReplace after sync"),ey(v),S=we.setCurrentContentStateJSON(v),(0,ve.$addUpdateTag)("codox_sync_state_changes"),le.log("[updateEditor] state updated: ",S);else{le.log("[updateEditor] invoke deltas diff");let N=ei().diff(S,v,{keyNames:{default:"codoxId"}});le.log("JSON_DIFF_ANALYSIS: ",{currentContentStateJSON:JSON.parse(JSON.stringify(S)),newStateJSON:v,deltas:N&&JSON.parse(JSON.stringify(N))}),N&&N.length&&(le.log("[updateEditor] apply deltas to lexical state"),cS(v,N),S=we.setCurrentContentStateJSON(v),(0,ve.$addUpdateTag)("codox_sync_state_changes"),le.log("[updateEditor] state updated: ",S))}let D=$e.isNestedSelectionJSON(_);if(ap.validateJSONSelection(_,np.local)||(_=we.getCurrentActiveSelectionJSON()),D){let N=li.setNestedEditorSelection(_);we.setNestedSelectionJSON(N?_:null),le.log("[updateEditor] nested selection updated",N?_:null)}else if(_!==void 0){const N=$e.JSONToLexical(_);le.log("[updateEditor] updated selection to apply: ",{isSameSelection:k,newSelectionJSON:_,lexicalSelection:N}),(0,ve.$setSelection)(N),we.setMainSelectionJSON(_),le.log("[updateEditor] selection updated",_)}},{onUpdate:()=>{C||xo.updateRemoteSelections(x,"from onUpdate hook")}}),C&&xo.updateRemoteSelections(x,"from direct updateEditor")},u=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(!we.isCodoxStarted)return;le.log("[invokeSync] SYNC INVOKED ",{upd_call_counter:v});let _=we.composeFullStateWithRootAndComments();const b={docId:ci,state:{state:_,selection:we.getCurrentActiveSelectionJSON()}};le.log("[codoxSync]: Before sync",{local:b,upd_call_counter:v}),le.log("[codoxSync]: Before sync state",JSON.parse(JSON.stringify(b.state)));let{state:x,remoteSelection:w=[],changes:S}=ei().sync({state:b,meta:{}});if(le.log("[codoxSync]: After sync",{afterSyncState:JSON.parse(JSON.stringify(x)),remoteSelection:w,changes:S}),!x)return le.error("[codoxSync] abort apply - synced state is not valid - restarting codox "),s();const C=x.state;le.log("[codoxSync]: synced state: ",JSON.parse(JSON.stringify(C)),v);let{stateFromSync:k,commentsFromSync:D}=we.extractStateAndCommentsFromSynced(C);if(!we.isValidJSONState(k.state))return le.error("[invokeSync] - invalid state from sync - local update skipped - restarting codox",{contentState:k.state}),s();a(k,w),kn.setAllComments(D)},c=()=>{le.warn("[rollbackStateDuringUpdateError] rollback invoked"),le.log("[rollbackStateDuringUpdateError] values: ",{prevState:we.getPrevContentStateJSON(),currentState:we.getCurrentContentStateJSON(),prevSelection:we.getPrevMainSelectionJSON(),currentSelection:we.getCurrentActiveSelectionJSON(),codoxComments:kn});let v=we.getPrevContentStateJSON(),_=we.getPrevMainSelectionJSON();a({state:v,selection:_},xo.getCurrentRemoteSelections(),oo.historic);let b=we.undoInvoked(),x=we.redoInvoked();kn.gcAbandonedNodeKeys(we.getMainEditorState()._nodeMap),b&&f.dispatchCommand(ve.CAN_REDO_COMMAND,!1),x&&f.dispatchCommand(ve.CAN_UNDO_COMMAND,!1)},g=v=>{let{editorState:_,prevEditorState:b,tags:x,dirtyElements:w,dirtyLeaves:S}=v;if(lp)return lp=!1,void le.debug("[editorUpdatesListener] invoked blacklisted queued selection change - stop");if(Hi.isBlacklistedFound())return lp=!0,le.warn("[editorUpdatesListener] BLACKLISTED CHANGES FOUND - revert back to prev state"),((V,K)=>{let z=null,F=null;K.read(()=>{z=$e.lexicalToJSON(K._selection),F=K.toJSON()});let T=null,P=null;V.read(()=>{let L=(0,ve.$getSelection)();P=$e.lexicalToJSON(L),T=V.toJSON()}),we.setCurrentContentStateJSON(T),we.setMainSelectionJSON(P),a({state:F,selection:z},xo.getCurrentRemoteSelections(),oo.historic),f.dispatchCommand(ve.CAN_REDO_COMMAND,!1),f.dispatchCommand(ve.CAN_UNDO_COMMAND,!1)})(_,b),void Hi.invokeClientCallback();if(!Io.ensureDocTablesAreValid(_))return;Pu++,le.log("[editorUpdatesListener] invoked by lexical. call counter: ",{upd_call_counter:Pu,isCodoxStarted:we.isCodoxStarted});let C=we.isOnlySelectionChanged(w,S),k=null,D=null,N=null,O=null,R=we.getCurrentContentStateJSON(),A=x.has("codox_sync_state_changes"),$=x.has(Jl),q=we.undoInvoked(),H=we.redoInvoked(),M=we.canUndo(),W=we.canRedo();k=_.toJSON(),D=b.toJSON(),b.read(()=>{O=$e.lexicalToJSON(b._selection)}),_.read(()=>{let V=(0,ve.$getSelection)();N=$e.lexicalToJSON(V);let K=$e.JSONToLexical(N),z=V===null&&K===null||V.is(K);le.log("[editorUpdatesListener] new values: ",{newContentStateJSON:k,currentContentStateJSON:JSON.parse(JSON.stringify(R)),prevContentStateJSON:JSON.parse(JSON.stringify(D)),currentCommentsJSON:JSON.parse(JSON.stringify(kn.getAllComments())),newSelectionJSON:JSON.parse(JSON.stringify(N)),currentMainSelectionJSON:JSON.parse(JSON.stringify(we.getCurrentMainSelectionJSON())),currentNestedSelectionJSON:JSON.parse(JSON.stringify(we.getCurrentNestedSelectionJSON())),currentActiveSelectionJSON:JSON.parse(JSON.stringify(we.getCurrentActiveSelectionJSON())),lexicalSelection:V,convertedBackMainSelection:K,isMainSelectionConvertionCorrect:z,nodes:f._editorState._nodeMap,fullEditor:f,codoxNodesMap:Pn.toArray(),codoxComments:kn,isUpdateFromSync:A,isUpdateFromComments:$,tags:x,onlySelectionChanged:C,undoInvoked:q,redoInvoked:H,canUndo:M,canRedo:W})});let G=ip(R,k),I=$e.equalSelectionsJSON(we.getCurrentActiveSelectionJSON(),N);le.log("[editorUpdatesListener] compares: ",{isStateSame:G,isSelectionSame:I});let U=G&&I&&!$;if(!G||$||A){let V=Cs({},G?R:k),K=kn.getAllComments();K.length&&(V.commentThreads=K);let z={source:A?L0.remote:L0.local,content:V};wo.hooks&&wo.hooks.contentChanged&&wo.hooks.contentChanged(z),ei().instance.emit("content_changed",z)}if(U)le.log("[editorUpdatesListener] STOP - state and selection and comments are same ",Pu);else if(we.undoInvoked()&&we.setUndoInvoked(!1),we.redoInvoked()&&we.setRedoInvoked(!1),we.setCurrentContentStateJSON(k),we.setPrevContentStateJSON(D),we.setMainSelectionJSON(N),we.setPrevMainSelectionJSON(O),sp){let V=we.getCurrentActiveSelectionJSON();a({state:we.getCurrentContentStateJSON(),selection:V},[])}else u(Pu)},h=()=>{let v=[];return we.getMainEditorNodesClassesMap().forEach((_,b,x)=>{let{klass:w}=_,S=f.registerMutationListener(w,C=>{for(let[k,D]of C){if(!Vr[D])continue;const N=we.getLexicalNodeByKey(k);if(D===Vr.created&&N&&Hi.trackBlacklisted(N,D),w.name===Tn.TableNode.name&&(D===Vr.destroyed?Io.tableNodeRemoveListener(k):Io.tableUpdateListener(k)),w.name===Tn.TableRowNode.name&&D!==Vr.destroyed&&Io.tableRowNodeChangesListener(k,D===Vr.updated),w.name===Tn.TableCellNode.name&&D===Vr.updated&&Io.tableCellNodeChangesListener(k),w.name===ro.MarkNode.name&&(le.debug("[MUTATION LISTENER] MARK node: ",{nodeKey:k,node:N,mutationType:D,codoxComments:kn}),D===Vr.destroyed?kn.removeRelatedNodeKey(k):N&&kn.addRelatedNodeKey(N.__key,N.__ids,D===Vr.created)),N&&N.codoxId){if(D===Vr.destroyed)return void(N.codoxId&&Pn.remove(N.codoxId));py(N)||le.warn("[MutationListener Error] duplicating codoxId detected - such codoxId already exists in codoxNodesMap - updating node ref to latest: ",{mutationType:D,node:N}),Pn.add(N.codoxId,N)}}v.push(S)})}),v},y={start:e,stop:n,on:(v,_)=>{le.info(`Subscribing client to codox ${v} event`),cp[v]=_},cursor:{hide:()=>{xo.hideRemoteSelectionsFromUI()},show:()=>{xo.showHiddenRemoteSelectionsInUI()}},initComments:v=>{kn.setInitialComments(v)}};return(0,Gt.useImperativeHandle)(d,()=>y),null}),AS=TS,jS=["comments"];function ay(m,d){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(m);d&&(t=t.filter(function(f){return Object.getOwnPropertyDescriptor(m,f).enumerable})),p.push.apply(p,t)}return p}function up(m){for(var d=1;d<arguments.length;d++){var p=arguments[d]!=null?arguments[d]:{};d%2?ay(Object(p),!0).forEach(function(t){PS(m,t,p[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):ay(Object(p)).forEach(function(t){Object.defineProperty(m,t,Object.getOwnPropertyDescriptor(p,t))})}return m}function PS(m,d,p){return(d=NS(d))in m?Object.defineProperty(m,d,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[d]=p,m}function NS(m){var d=IS(m,"string");return typeof d=="symbol"?d:d+""}function IS(m,d){if(typeof m!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var t=p.call(m,d||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(d==="string"?String:Number)(m)}function RS(m,d){if(m==null)return{};var p,t,f=MS(m,d);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);for(t=0;t<r.length;t++)p=r[t],d.indexOf(p)>=0||{}.propertyIsEnumerable.call(m,p)&&(f[p]=m[p])}return f}function MS(m,d){if(m==null)return{};var p={};for(var t in m)if({}.hasOwnProperty.call(m,t)){if(d.indexOf(t)>=0)continue;p[t]=m[t]}return p}class DS extends R0{constructor(){super(),this.mainEditor=null,this.mainEditorKey=null,this.currentContentStateJSON=null,this.currentMainSelectionJSON=null,this.currentNestedSelectionJSON=null,this._isCodoxStarted=!1,this.prevContentStateJSON=null,this.prevMainSelectionJSON=null,this._undoInvoked=!1,this._redoInvoked=!1,this._canUndo=!1,this._canRedo=!1}setCanUndo(d){this._canUndo=d}setCanRedo(d){this._canRedo=d}canUndo(){return this._canUndo}canRedo(){return this._canRedo}setUndoInvoked(d){this._undoInvoked=d}setRedoInvoked(d){this._redoInvoked=d}undoInvoked(){return this._undoInvoked}redoInvoked(){return this._redoInvoked}setIsCodoxStarted(){let d=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this._isCodoxStarted=d}get isCodoxStarted(){return this._isCodoxStarted}getMainEditorKey(){return this.mainEditorKey}setMainEditor(d){this.mainEditor=d,this.mainEditorKey=d._key}clearJSONs(){le.debug("[CodoxLexicalEditorManager][clearJSONs] invoked"),this.currentContentStateJSON=null,this.currentMainSelectionJSON=null,this.currentNestedSelectionJSON=null,this.prevContentStateJSON=null,this.prevMainSelectionJSON=null}removeMainEditor(){this.mainEditor=null,this.mainEditorKey=null,this._undoInvoked=!1,this._redoInvoked=!1,this._canUndo=!1,this._canRedo=!1,super.clear()}getMainEditor(){return this.mainEditor}alignStateSelectionJSONsFromLatestEditor(){this.getMainEditorState().read(()=>{this.setCurrentContentStateJSON(this.getMainEditorState().toJSON()),this.setMainSelectionJSON($e.lexicalToJSON((0,ve.$getSelection)()))})}mainEditorExists(){return!!this.mainEditor}getMainEditorState(){return this.mainEditor?this.mainEditor.getEditorState():{}}getMainEditorNodesClassesMap(){return this.mainEditor?this.mainEditor._nodes:new Map}getLexicalNodeByKey(d){return this.mainEditor?this.getMainEditorState()._nodeMap.get(d):null}isLexicalEditorInstance(d){return d&&typeof d=="object"&&!!d.setEditorState}setCurrentContentStateJSON(d){return this.currentContentStateJSON=d,this.currentContentStateJSON}getCurrentContentStateJSON(){return this.currentContentStateJSON}setPrevContentStateJSON(d){this.prevContentStateJSON=d}getPrevContentStateJSON(){return this.prevContentStateJSON}setMainSelectionJSON(d){this.currentMainSelectionJSON=d,this.currentMainSelectionJSON&&this.currentNestedSelectionJSON&&(this.currentNestedSelectionJSON=null)}setNestedSelectionJSON(d){this.currentNestedSelectionJSON=d,this.currentNestedSelectionJSON&&this.currentMainSelectionJSON&&(this.currentMainSelectionJSON=null)}getCurrentMainSelectionJSON(){return this.currentMainSelectionJSON}getCurrentNestedSelectionJSON(){return this.currentNestedSelectionJSON}getCurrentActiveSelectionJSON(){return!this.currentMainSelectionJSON&&this.currentNestedSelectionJSON?this.currentNestedSelectionJSON:this.currentMainSelectionJSON}clearSelectionJSON(){this.currentMainSelectionJSON=null,this.currentNestedSelectionJSON=null}setPrevMainSelectionJSON(d){this.prevMainSelectionJSON=d}getPrevMainSelectionJSON(){return this.prevMainSelectionJSON}extractStateAndCommentsFromSynced(d){let{state:{comments:p},selection:t,stateReplace:f}=d;return{stateFromSync:{state:up({},RS(d.state,jS)),selection:t,stateReplace:f},commentsFromSync:p}}composeFullStateWithRootAndComments(){let{directlyFromEditor:d=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return up(up({},d?this.getMainEditorState().toJSON():this.currentContentStateJSON),{},{comments:kn.getAllComments()})}isValidJSONState(d){let p=!1;try{if(!d)throw new Error("State is undefined");if(!d.root)throw new Error("State 'root' node is missing");let t=this.getMainEditorNodesClassesMap(),f=function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",e=r,s=t.get(e.type);if(!s)throw new Error(`Node with type "${e.type}" is not registered in editor`);let{klass:i}=s;if(n==="root"){let l=i.prototype instanceof ve.ElementNode,o=i.prototype instanceof ve.DecoratorNode;if(!l&&!o)throw new Error("State root node can have only element nodes as children")}if(e.children)for(let l of e.children)f(l,e.type)};f(d.root),p=!0}catch(t){le.error("[isValidJSONState] invalid state found: ",t.message),p=!1}return p}scanLexicalNodeForNestedEditorAttribute(d){for(let p in d){let t=d[p];if(this.isLexicalEditorInstance(t))return p}return""}isOnlySelectionChanged(d,p){return d.size===0&&p.size===0}addUpdateTag(){let{isSameState:d,isSameSelection:p,fromNestedEditor:t=!1,updateTag:f=""}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return f?(le.log(`[addUpdateTag] explicit add of tag "${f}" `),void(0,ve.$addUpdateTag)(f)):t?(le.log(`[addUpdateTag] add "${oo.historic}" tag - change invoked by nested editor`),void(0,ve.$addUpdateTag)(oo.historic)):void(d?(le.log(`[addUpdateTag] add "${oo.historic}" tag - state is same`),(0,ve.$addUpdateTag)(oo.historic)):(le.log(`[addUpdateTag] add "${oo.historyMerge}" tag - state is different`),(0,ve.$addUpdateTag)(oo.historyMerge)))}enableEditorReadOnlyMode(){this.mainEditor&&this.mainEditor.isEditable()&&this.mainEditor.setEditable(!1)}disableEditorReadOnlyMode(){this.mainEditor&&(this.mainEditor.isEditable()||this.mainEditor.setEditable(!0))}}const LS=new DS,we=LS;class BS{constructor(){this._nodesMap=new Map,this._pastedNodesCodoxIds=new Set}get size(){return this._nodesMap.size}add(d,p){this._nodesMap.set(d,p)}get(d){return this._nodesMap.get(d)||null}remove(d){this._nodesMap.delete(d)}has(d){return this._nodesMap.has(d)}nodesToArray(){return Array.from(this._nodesMap.values())}keysToArray(){return Array.from(this._nodesMap.keys())}toArray(){return Array.from(this._nodesMap.entries())}addPastedId(d){this._pastedNodesCodoxIds.add(d)}removePastedId(d){this._pastedNodesCodoxIds.delete(d)}hasPastedId(d){return this._pastedNodesCodoxIds.has(d)}clearPastedIds(){this._pastedNodesCodoxIds.size>0&&this._pastedNodesCodoxIds.clear()}isEmptyPastedIds(){return this._pastedNodesCodoxIds.size===0}getPastedIdsSize(){return this._pastedNodesCodoxIds.size}clearAll(){this._nodesMap.clear(),this._pastedNodesCodoxIds.clear()}gcAbandonedNodes(){let d=we.getMainEditorState();if(!d._nodeMap)return;let p=this.nodesToArray();for(let t of p)d._nodeMap.has(t.__key)||this.remove(t.codoxId)}}const FS=new BS,Pn=FS;function sy(m,d){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(m);d&&(t=t.filter(function(f){return Object.getOwnPropertyDescriptor(m,f).enumerable})),p.push.apply(p,t)}return p}function ly(m){for(var d=1;d<arguments.length;d++){var p=arguments[d]!=null?arguments[d]:{};d%2?sy(Object(p),!0).forEach(function(t){zS(m,t,p[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):sy(Object(p)).forEach(function(t){Object.defineProperty(m,t,Object.getOwnPropertyDescriptor(p,t))})}return m}function zS(m,d,p){return(d=US(d))in m?Object.defineProperty(m,d,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[d]=p,m}function US(m){var d=$S(m,"string");return typeof d=="symbol"?d:d+""}function $S(m,d){if(typeof m!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var t=p.call(m,d||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(d==="string"?String:Number)(m)}const dp=()=>Yx(),cy=m=>typeof m=="number";function ks(m){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const p=function(){for(var t=arguments.length,f=new Array(t),r=0;r<t;r++)f[r]=arguments[r];return m.apply(this,f)};return Object.defineProperty(p,"name",{value:d,writable:!0}),p}const Aa=m=>m.__type==="root"||m.type==="root",uy=m=>Aa(m.getParent()),qn=m=>m.__type===Cu.text||m.type===Cu.text||m.hasOwnProperty("__text")||m.hasOwnProperty("text"),Os=m=>(0,ve.$isElementNode)(m),Ts=m=>(0,Tn.$isTableNode)(m)||(0,Tn.$isTableRowNode)(m)||(0,Tn.$isTableCellNode)(m),HS=m=>!m.getChildren,dy=m=>!!m.getChildren,On=m=>(0,ve.$isDecoratorNode)(m),Kl=m=>(0,$x.$isLinkNode)(m),Gl=m=>m.__type==="mark"||m.type==="mark",fp=m=>(0,ve.$isLineBreakNode)(m),qi=m=>qn(m)||fp(m),pp=m=>m.__type===Cu.horizontalrule||m.type===Cu.horizontalrule,fy=m=>{if(qi(m)||Kl(m)||Gl(m))return!1;if(!m.__parent||m.__parent==="root"||(0,ve.$isParagraphNode)(m))return!0;let d=m.getParent().getChildren();return d.length===1&&d[0].__key===m.__key?!((On(m)||Kl(m)||Gl(m))&&!pp(m)):!d.some(p=>{let t=pp(p);return p.__key!==m.__key&&(qi(p)||On(p)&&!t||Kl(p)||Gl(p))})},py=m=>{const d=Pn.get(m.codoxId);return!d||m.__key===d.__key},As=function(m){const d=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:null)||dp();m.codoxId=d,Pn.add(d,m)},hy=m=>{Pn.remove(m.codoxId),delete m.codoxId},qS=m=>{if(!dy(m)||!m.getChildrenSize())return;const d=m.getChildren();if(d.some(f=>!!(0,ve.$isParagraphNode)(f)))return;let p=!1,t=[];for(let f of d)(qi(f)||On(f)||Kl(f)||Gl(f))&&!p&&(pp(f)||(p=!0)),(dy(f)||On(f))&&t.push(f);for(let f of t)p||f.codoxId?p&&f.codoxId&&(f=f.getWritable(),hy(f)):(f=f.getWritable(),As(f))},WS=m=>{const d=ly({},m);for(const p in m)m[p]===void 0&&m.hasOwnProperty(p)&&delete d[p];return d},JS=m=>{const d=`__nativeCreateDOM_${m.name}`;m.prototype[d]=ks(m.prototype.createDOM,d),m.prototype.createDOM=function(p,t){if(fy(this))if(this.codoxId){if(!py(this)){let r=Pn.get(this.codoxId);r.__type===this.__type&&this.isAttached()&&!r.isAttached()?(le.warn("[createDOM][Non-unique codoxId] overwrite abandoned existing node with latest: ",{latestNode:this,existingNode:r}),Pn.add(this.codoxId,this)):As(this)}}else As(this);else this.codoxId&&hy(this);On(this)&&!this.codoxDId&&(this.codoxDId=dp()),li.manageNestedEditorInLexicalNode(this);let f=this[d](p,t);return f.__codox_track=!0,f}},VS=m=>{const d=`__nativeUpdateDOM_${m.name}`;return m.prototype[d]=ks(m.prototype.updateDOM,d),m.prototype.updateDOM=function(){const p=this[d](...arguments);return qS(this),p},m},KS=m=>{const d=`__nativeRemove_${m.name}`;return m.prototype[d]=ks(m.prototype.remove,d),m.prototype.remove=function(){const p=this.codoxId;return p&&Pn.remove(p),li.gcNestedEditorListenerInLexicalNode(this),this[d](...arguments)},m},GS=m=>{const d=`__nativeExportJSON_${m.name}`;m.prototype[d]=ks(m.prototype.exportJSON,d),m.prototype.exportJSON=function(){const p=this[d]();return this.codoxId&&(p.codoxId=this.codoxId),this.codoxDId&&(p.codoxDId=this.codoxDId),qn(this)&&cy(p.format)&&this.hasFormat&&(p.format=sw(this)),WS(p)}},YS=m=>{const d="__nativeImportJSON";m[d]=ks(m.importJSON,d),m.importJSON=function(p){const t=ly({},p);qn(t)&&!cy(t.format)&&(t.format=aw(t.format));const f=m[d](t);li.manageNestedEditorInLexicalNode(f);const r=fy(f);return r&&t.codoxId&&(Pn.hasPastedId(t.codoxId)&&Pn.has(t.codoxId)?(Pn.removePastedId(t.codoxId),As(f)):As(f,t.codoxId)),r&&!f.codoxId&&As(f),t.codoxDId&&(f.codoxDId=t.codoxDId),f}},ZS=m=>{const d="__nativeClone";m[d]=ks(m.clone,d),m.clone=function(p){const t=m[d](p);return p.codoxId&&(t.codoxId=p.codoxId),p.codoxDId&&(t.codoxDId=p.codoxDId),li.manageNestedEditorInClonedLexicalNode(p,t),t}},XS=m=>{let d=!1,p=!1,t=!1,f=!1;m.forEach(n=>{n.name===ve.TextNode.name?d=!0:n.name===ve.ParagraphNode.name?p=!0:n.name===ve.LineBreakNode.name?t=!0:n.name===ro.MarkNode.name&&(f=!0)});let r=[];return d||r.push(ve.TextNode),p||r.push(ve.ParagraphNode),t||r.push(ve.LineBreakNode),f||r.push(ro.MarkNode),r.length?[...r,...m]:m},QS=function(){return XS(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).map(m=>(m.hasOwnProperty("__isCodoxExtended")||(JS(m),VS(m),GS(m),KS(m),YS(m),ZS(m),Object.defineProperty(m,"__isCodoxExtended",{value:!0,writable:!1})),m))};var Nu=on(777),js={};js.styleTagTransform=si(),js.setAttributes=ii(),js.insert=oi().bind(null,"head"),js.domAPI=ri(),js.insertStyleElement=ai(),ni()(Nu.A,js),Nu.A&&Nu.A.locals&&Nu.A.locals;var t2=m=>{var d={};return on.d(d,m),d};const e2=t2({AutoFocusPlugin:()=>km});var n2=m=>{var d={};return on.d(d,m),d};const r2=n2({ClearEditorPlugin:()=>Cx});var o2=m=>{var d={};return on.d(d,m),d};const i2=o2({LexicalComposer:()=>Cm});var a2=m=>{var d={};return on.d(d,m),d};const gy=a2({default:()=>Ox});var s2=m=>{var d={};return on.d(d,m),d};const l2=s2({HistoryPlugin:()=>$m});var c2=m=>{var d={};return on.d(d,m),d};const u2=c2({OnChangePlugin:()=>Ax});var d2=m=>{var d={};return on.d(d,m),d};const f2=d2({PlainTextPlugin:()=>Lx});var p2=m=>{var d={};return on.d(d,m),d};const my=p2({$isRootTextContentEmpty:()=>qm,$rootTextContent:()=>Hm});var h2=m=>{var d={};return on.d(d,m),d};const Ps=h2({createPortal:()=>Xb.createPortal}),g2=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,m2=g2?Gt.useLayoutEffect:Gt.useEffect,yy=m2;var Iu=on(253),Ns={};Ns.styleTagTransform=si(),Ns.setAttributes=ii(),Ns.insert=oi().bind(null,"head"),Ns.domAPI=ri(),Ns.insertStyleElement=ai(),ni()(Iu.A,Ns),Iu.A&&Iu.A.locals&&Iu.A.locals;function y2(m){let{onClose:d,children:p,title:t,closeOnClickOutside:f}=m;const r=(0,Gt.useRef)(null);return(0,Gt.useEffect)(()=>{r.current!==null&&r.current.focus()},[]),(0,Gt.useEffect)(()=>{let n=null;const e=l=>{l.key==="Escape"&&d()},s=l=>{const o=l.target;r.current!==null&&!r.current.contains(o)&&f&&d()},i=r.current;return i!==null&&(n=i.parentElement,n!==null&&n.addEventListener("click",s)),window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e),n!==null&&(n==null||n.removeEventListener("click",s))}},[f,d]),Gt.createElement("div",{className:"Modal__overlay",role:"dialog"},Gt.createElement("div",{className:"Modal__modal",tabIndex:-1,ref:r},Gt.createElement("h2",{className:"Modal__title"},t),Gt.createElement("button",{className:"Modal__closeButton","aria-label":"Close modal",type:"button",onClick:d},"X"),Gt.createElement("div",{className:"Modal__content"},p)))}function v2(m){let{onClose:d,children:p,title:t,closeOnClickOutside:f=!1}=m;return(0,Ps.createPortal)(Gt.createElement(y2,{onClose:d,title:t,closeOnClickOutside:f},p),document.body)}function vy(){const[m,d]=(0,Gt.useState)(null),p=(0,Gt.useCallback)(()=>{d(null)},[]),t=(0,Gt.useMemo)(()=>{if(m===null)return null;const{title:r,content:n,closeOnClickOutside:e}=m;return Gt.createElement(v2,{onClose:p,title:r,closeOnClickOutside:e},n)},[m,p]),f=(0,Gt.useCallback)(function(r,n){d({closeOnClickOutside:arguments.length>2&&arguments[2]!==void 0&&arguments[2],content:n(p),title:r})},[p]);return[t,f]}var Ru=on(191),Is={};Is.styleTagTransform=si(),Is.setAttributes=ii(),Is.insert=oi().bind(null,"head"),Is.domAPI=ri(),Is.insertStyleElement=ai(),ni()(Ru.A,Is),Ru.A&&Ru.A.locals&&Ru.A.locals;const b2={blockCursor:"CommentEditorTheme__blockCursor",characterLimit:"CommentEditorTheme__characterLimit",code:"CommentEditorTheme__code",codeHighlight:{atrule:"CommentEditorTheme__tokenAttr",attr:"CommentEditorTheme__tokenAttr",boolean:"CommentEditorTheme__tokenProperty",builtin:"CommentEditorTheme__tokenSelector",cdata:"CommentEditorTheme__tokenComment",char:"CommentEditorTheme__tokenSelector",class:"CommentEditorTheme__tokenFunction","class-name":"CommentEditorTheme__tokenFunction",comment:"CommentEditorTheme__tokenComment",constant:"CommentEditorTheme__tokenProperty",deleted:"CommentEditorTheme__tokenProperty",doctype:"CommentEditorTheme__tokenComment",entity:"CommentEditorTheme__tokenOperator",function:"CommentEditorTheme__tokenFunction",important:"CommentEditorTheme__tokenVariable",inserted:"CommentEditorTheme__tokenSelector",keyword:"CommentEditorTheme__tokenAttr",namespace:"CommentEditorTheme__tokenVariable",number:"CommentEditorTheme__tokenProperty",operator:"CommentEditorTheme__tokenOperator",prolog:"CommentEditorTheme__tokenComment",property:"CommentEditorTheme__tokenProperty",punctuation:"CommentEditorTheme__tokenPunctuation",regex:"CommentEditorTheme__tokenVariable",selector:"CommentEditorTheme__tokenSelector",string:"CommentEditorTheme__tokenSelector",symbol:"CommentEditorTheme__tokenProperty",tag:"CommentEditorTheme__tokenProperty",url:"CommentEditorTheme__tokenOperator",variable:"CommentEditorTheme__tokenVariable"},embedBlock:{base:"CommentEditorTheme__embedBlock",focus:"CommentEditorTheme__embedBlockFocus"},hashtag:"CommentEditorTheme__hashtag",heading:{h1:"CommentEditorTheme__h1",h2:"CommentEditorTheme__h2",h3:"CommentEditorTheme__h3",h4:"CommentEditorTheme__h4",h5:"CommentEditorTheme__h5",h6:"CommentEditorTheme__h6"},image:"editor-image",indent:"CommentEditorTheme__indent",inlineImage:"inline-editor-image",layoutContainer:"CommentEditorTheme__layoutContainer",layoutItem:"CommentEditorTheme__layoutItem",link:"CommentEditorTheme__link",list:{checklist:"CommentEditorTheme__checklist",listitem:"CommentEditorTheme__listItem",listitemChecked:"CommentEditorTheme__listItemChecked",listitemUnchecked:"CommentEditorTheme__listItemUnchecked",nested:{listitem:"CommentEditorTheme__nestedListItem"},olDepth:["CommentEditorTheme__ol1","CommentEditorTheme__ol2","CommentEditorTheme__ol3","CommentEditorTheme__ol4","CommentEditorTheme__ol5"],ul:"CommentEditorTheme__ul"},ltr:"CommentEditorTheme__ltr",mark:"CommentEditorTheme__mark",markOverlap:"CommentEditorTheme__markOverlap",paragraph:"CommentEditorTheme__paragraph",quote:"CommentEditorTheme__quote",rtl:"CommentEditorTheme__rtl",table:"CommentEditorTheme__table",tableCell:"CommentEditorTheme__tableCell",tableCellActionButton:"CommentEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"CommentEditorTheme__tableCellActionButtonContainer",tableCellEditing:"CommentEditorTheme__tableCellEditing",tableCellHeader:"CommentEditorTheme__tableCellHeader",tableCellPrimarySelected:"CommentEditorTheme__tableCellPrimarySelected",tableCellResizer:"CommentEditorTheme__tableCellResizer",tableCellSelected:"CommentEditorTheme__tableCellSelected",tableCellSortedIndicator:"CommentEditorTheme__tableCellSortedIndicator",tableResizeRuler:"CommentEditorTheme__tableCellResizeRuler",tableSelected:"CommentEditorTheme__tableSelected",tableSelection:"CommentEditorTheme__tableSelection",text:{bold:"CommentEditorTheme__textBold",code:"CommentEditorTheme__textCode",italic:"CommentEditorTheme__textItalic",strikethrough:"CommentEditorTheme__textStrikethrough",subscript:"CommentEditorTheme__textSubscript",superscript:"CommentEditorTheme__textSuperscript",underline:"CommentEditorTheme__textUnderline",underlineStrikethrough:"CommentEditorTheme__textUnderlineStrikethrough"}},_2=b2;var Mu=on(72),Rs={};Rs.styleTagTransform=si(),Rs.setAttributes=ii(),Rs.insert=oi().bind(null,"head"),Rs.domAPI=ri(),Rs.insertStyleElement=ai(),ni()(Mu.A,Rs),Mu.A&&Mu.A.locals&&Mu.A.locals;function x2(){for(var m=arguments.length,d=new Array(m),p=0;p<m;p++)d[p]=arguments[p];return d.filter(Boolean).join(" ")}function hp(){return hp=Object.assign?Object.assign.bind():function(m){for(var d=1;d<arguments.length;d++){var p=arguments[d];for(var t in p)({}).hasOwnProperty.call(p,t)&&(m[t]=p[t])}return m},hp.apply(null,arguments)}function Wi(m){let{"data-test-id":d,children:p,className:t,onClick:f,disabled:r,small:n,title:e}=m;return Gt.createElement("button",hp({disabled:r,className:x2("Button__root",r&&"Button__disabled",n&&"Button__small",t),onClick:f,title:e,"aria-label":e},d&&{"data-test-id":d}),p)}var Du=on(129),Ms={};Ms.styleTagTransform=si(),Ms.setAttributes=ii(),Ms.insert=oi().bind(null,"head"),Ms.domAPI=ri(),Ms.insertStyleElement=ai(),ni()(Du.A,Ms),Du.A&&Du.A.locals&&Du.A.locals;var w2=m=>{var d={};return on.d(d,m),d};const S2=w2({ContentEditable:()=>Om});function E2(m){let{className:d}=m;return Gt.createElement(S2.ContentEditable,{className:d||"ContentEditable__root"})}var Lu=on(457),Ds={};Ds.styleTagTransform=si(),Ds.setAttributes=ii(),Ds.insert=oi().bind(null,"head"),Ds.domAPI=ri(),Ds.insertStyleElement=ai(),ni()(Lu.A,Ds),Lu.A&&Lu.A.locals&&Lu.A.locals;function C2(m){let{children:d,className:p}=m;return Gt.createElement("div",{className:p||"Placeholder__root"},d)}const k2=gy.default.LexicalErrorBoundary||gy.default,O2=()=>Gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"#050505",className:"codox-add-comment-right"},Gt.createElement("path",{d:"M14 1a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H4.414A2 2 0 0 0 3 11.586l-2 2V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12.793a.5.5 0 0 0 .854.353l2.853-2.853A1 1 0 0 1 4.414 12H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"}),Gt.createElement("path",{d:"M3 3.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5zM3 6a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9A.5.5 0 0 1 3 6zm0 2.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5z"})),by=()=>Gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",className:"codox-remove-comment"},Gt.createElement("path",{d:"M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5ZM11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H2.506a.58.58 0 0 0-.01 0H1.5a.5.5 0 0 0 0 1h.538l.853 10.66A2 2 0 0 0 4.885 16h6.23a2 2 0 0 0 1.994-1.84l.853-10.66h.538a.5.5 0 0 0 0-1h-.995a.59.59 0 0 0-.01 0H11Zm1.958 1-.846 10.58a1 1 0 0 1-.997.92h-6.23a1 1 0 0 1-.997-.92L3.042 3.5h9.916Zm-7.487 1a.5.5 0 0 1 .528.47l.5 8.5a.5.5 0 0 1-.998.06L5 5.03a.5.5 0 0 1 .47-.53Zm5.058 0a.5.5 0 0 1 .47.53l-.5 8.5a.5.5 0 1 1-.998-.06l.5-8.5a.5.5 0 0 1 .528-.47ZM8 4.5a.5.5 0 0 1 .5.5v8.5a.5.5 0 0 1-1 0V5a.5.5 0 0 1 .5-.5Z"})),T2=()=>Gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",className:"codox-add-comment"},Gt.createElement("path",{d:"M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576 6.636 10.07Zm6.787-8.201L1.591 6.602l4.339 2.76 7.494-7.493Z"})),A2=()=>Gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"#0000008c",className:"codox-hide-show-comments"},Gt.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13 5.885v1.166a3.95 3.95 0 0 1-3.949 3.95H6.917a.748.748 0 0 0-.45.15l-1.345 1.007a.752.752 0 0 0-.032 1.181A2.933 2.933 0 0 0 6.95 14h2.716l2.534 1.901a.506.506 0 0 0 .524.047A.501.501 0 0 0 13 15.5V14h.051a2.949 2.949 0 0 0 2.95-2.949v-3.05a3.002 3.002 0 0 0-2.002-2.83.756.756 0 0 0-.999.714"}),Gt.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.05 1H2.95A2.952 2.952 0 0 0 0 3.949v3.102A2.952 2.952 0 0 0 2.949 10H3v1.5a.502.502 0 0 0 .8.4L6.334 10H9.05A2.952 2.952 0 0 0 12 7.05V3.95A2.952 2.952 0 0 0 9.05 1"}));function _y(m,d,p){let t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:performance.now(),f=arguments.length>4&&arguments[4]!==void 0&&arguments[4];return kn.createNewCommentObj({content:m,author:d,codoxId:p,timeStamp:t,deleted:f})}function j2(m,d,p){return kn.createNewThreadObj({quote:m,comments:d,codoxId:p})}function P2(m){let{anchorKey:d,editor:p,onAddComment:t}=m;const f=(0,Gt.useRef)(null),r=(0,Gt.useCallback)(()=>{const n=f.current,e=p.getRootElement(),s=p.getElementByKey(d);if(n!==null&&e!==null&&s!==null){const{right:i}=e.getBoundingClientRect(),{top:l}=s.getBoundingClientRect();n.style.left=i-20+"px",n.style.top=l-30+"px"}},[d,p]);return(0,Gt.useEffect)(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[p,r]),yy(()=>{r()},[d,p,r]),Gt.createElement("div",{className:"CodoxCommentPlugin_AddCommentBox",ref:f},Gt.createElement("button",{className:"CodoxCommentPlugin_AddCommentBox_button",onClick:t},Gt.createElement(O2,null)))}function N2(m){let{onEscape:d}=m;const[p]=(0,$i.useLexicalComposerContext)();return(0,Gt.useEffect)(()=>p.registerCommand(ve.KEY_ESCAPE_COMMAND,t=>d(t),2),[p,d]),null}function I2(m){let{editorRef:d}=m;const[p]=(0,$i.useLexicalComposerContext)();return typeof d=="function"?d(p):typeof d=="object"&&(d.current=p),null}function xy(m){let{className:d,autoFocus:p,onEscape:t,onChange:f,editorRef:r,placeholder:n="Type a comment...",onEditorClick:e=()=>{}}=m;const s={namespace:"Commenting",nodes:[],onError:i=>{throw i},theme:_2};return Gt.createElement(i2.LexicalComposer,{initialConfig:s},Gt.createElement("div",{className:"CodoxCommentPlugin_CommentInputBox_EditorContainer",onClick:e},Gt.createElement(f2.PlainTextPlugin,{contentEditable:Gt.createElement(E2,{className:d}),placeholder:Gt.createElement(C2,null,n),ErrorBoundary:k2}),Gt.createElement(u2.OnChangePlugin,{onChange:f}),Gt.createElement(l2.HistoryPlugin,null),p!==!1&&Gt.createElement(e2.AutoFocusPlugin,null),Gt.createElement(N2,{onEscape:t}),Gt.createElement(r2.ClearEditorPlugin,null),r!==void 0&&Gt.createElement(I2,{editorRef:r})))}function wy(m,d){return(0,Gt.useCallback)((p,t)=>{p.read(()=>{m((0,my.$rootTextContent)()),d(!(0,my.$isRootTextContentEmpty)(t.isComposing(),!0))})},[d,m])}function R2(m){let{editor:d,cancelAddComment:p,submitAddComment:t}=m;const[f,r]=(0,Gt.useState)(""),[n,e]=(0,Gt.useState)(!1),s=(0,Gt.useRef)(null),i=(0,Gt.useMemo)(()=>({container:document.createElement("div"),elements:[]}),[]),l=(0,Gt.useRef)(null),o=Cy(),a=(0,Gt.useCallback)(()=>{d.getEditorState().read(()=>{const c=(0,ve.$getSelection)();if((0,ve.$isRangeSelection)(c)){l.current=c.clone();const g=c.anchor,h=c.focus,y=(0,Oa.createDOMRange)(d,g.getNode(),g.offset,h.getNode(),h.offset),v=s.current;if(y!==null&&v!==null){const{left:_,bottom:b,width:x}=y.getBoundingClientRect(),w=(0,Oa.createRectsFromDOMRange)(d,y);let S=w.length===1?_+x/2-125:_-125;S<10&&(S=10),v.style.left=`${S}px`,v.style.top=`${b+20+(window.pageYOffset||document.documentElement.scrollTop)}px`;const C=w.length,{container:k}=i,D=i.elements,N=D.length;for(let O=0;O<C;O++){const R=w[O];let A=D[O];A===void 0&&(A=document.createElement("span"),D[O]=A,k.appendChild(A));const $="255, 212, 0",q=`position:absolute;top:${R.top+(window.pageYOffset||document.documentElement.scrollTop)}px;left:${R.left}px;height:${R.height}px;width:${R.width}px;background-color:rgba(${$}, 0.3);pointer-events:none;z-index:5;`;A.style.cssText=q}for(let O=N-1;O>=C;O--){const R=D[O];k.removeChild(R),D.pop()}}}})},[d,i]);yy(()=>{a();const c=i.container,g=document.body;if(g!==null)return g.appendChild(c),()=>{g.removeChild(c)}},[i.container,a]),(0,Gt.useEffect)(()=>(window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}),[a]);const u=wy(r,e);return Gt.createElement("div",{className:"CodoxCommentPlugin_CommentInputBox",ref:s},Gt.createElement(xy,{className:"CodoxCommentPlugin_CommentInputBox_Editor",onEscape:c=>(c.preventDefault(),p(),!0),onChange:u}),Gt.createElement("div",{className:"CodoxCommentPlugin_CommentInputBox_Buttons"},Gt.createElement(Wi,{onClick:p,className:"CodoxCommentPlugin_CommentInputBox_Button"},"Cancel"),Gt.createElement(Wi,{onClick:()=>{if(n){let c=d.getEditorState().read(()=>{const g=l.current;return g?g.getTextContent():""});c.length>100&&(c=c.slice(0,99)+"…"),t(j2(c,[_y(f,o)]),!0,void 0,l.current),l.current=null}},disabled:!n,className:"CodoxCommentPlugin_CommentInputBox_Button primary"},"Comment")))}function M2(m){let{submitAddComment:d,thread:p,placeholder:t}=m;const[f,r]=(0,Gt.useState)(""),[n,e]=(0,Gt.useState)(!1),s=(0,Gt.useRef)(null),i=Cy(),l=wy(r,e);return Gt.createElement(Gt.Fragment,null,Gt.createElement(xy,{className:"CodoxCommentPlugin_CommentsPanel_Editor",autoFocus:!1,onEscape:()=>!0,onChange:l,editorRef:s,placeholder:t}),Gt.createElement(Wi,{className:"CodoxCommentPlugin_CommentsPanel_SendButton",onClick:()=>{if(n){d(_y(f,i),!1,p);const o=s.current;o!==null&&o.dispatchCommand(ve.CLEAR_EDITOR_COMMAND,void 0)}},disabled:!n},Gt.createElement(T2,null)))}function Sy(m){let{commentOrThread:d,deleteCommentOrThread:p,onClose:t,thread:f}=m;return Gt.createElement(Gt.Fragment,null,"Are you sure you want to delete this ",d.type,"?",Gt.createElement("div",{className:"Modal__content"},Gt.createElement(Wi,{onClick:()=>{p(d,f),t()}},"Delete")," ",Gt.createElement(Wi,{onClick:()=>{t()}},"Cancel")))}function Ey(m){let{comment:d,deleteComment:p,thread:t,rtf:f}=m;const r=Math.round((d.timeStamp-performance.now())/1e3),n=Math.round(r/60),[e,s]=vy();return Gt.createElement("li",{className:"CodoxCommentPlugin_CommentsPanel_List_Comment"},Gt.createElement("div",{className:"CodoxCommentPlugin_CommentsPanel_List_Details"},Gt.createElement("span",{className:"CodoxCommentPlugin_CommentsPanel_List_Comment_Author"},d.author),Gt.createElement("span",{className:"CodoxCommentPlugin_CommentsPanel_List_Comment_Time"},"· ",r>-10?"Just now":f.format(n,"minute"))),Gt.createElement("p",{className:d.deleted?"CodoxCommentPlugin_CommentsPanel_DeletedComment":""},d.content),!d.deleted&&Gt.createElement(Gt.Fragment,null,Gt.createElement(Wi,{onClick:()=>{s("Delete Comment",i=>Gt.createElement(Sy,{commentOrThread:d,deleteCommentOrThread:p,thread:t,onClose:i}))},className:"CodoxCommentPlugin_CommentsPanel_List_DeleteButton"},Gt.createElement(by,null)),e))}function D2(m){let{activeIDs:d,comments:p,deleteCommentOrThread:t,listRef:f,submitAddComment:r,markNodeMap:n}=m;const[e]=(0,$i.useLexicalComposerContext)(),[s,i]=(0,Gt.useState)(0),[l,o]=vy(),a=(0,Gt.useMemo)(()=>new Intl.RelativeTimeFormat("en",{localeMatcher:"best fit",numeric:"auto",style:"short"}),[]);return(0,Gt.useEffect)(()=>{const u=setTimeout(()=>{i(s+1)},1e4);return()=>{clearTimeout(u)}},[s]),Gt.createElement("ul",{className:"CodoxCommentPlugin_CommentsPanel_List",ref:f},p.map(u=>{const c=u.codoxId;if(!c)return null;if(u.type==="thread"){const g=()=>{if(n.get(c)!==void 0&&(d===null||d.indexOf(c)===-1)){const h=document.activeElement;e.update(()=>{(0,ve.$setSelection)(null)},{onUpdate(){h!==null&&h.focus()}})}};return Gt.createElement("li",{key:c,onClick:g,className:`CodoxCommentPlugin_CommentsPanel_List_Thread ${n.has(c)?"interactive":""} ${d.indexOf(c)===-1?"":"active"}`},Gt.createElement("div",{className:"CodoxCommentPlugin_CommentsPanel_List_Thread_QuoteBox"},Gt.createElement("blockquote",{className:"CodoxCommentPlugin_CommentsPanel_List_Thread_Quote"},"> ",Gt.createElement("span",null,u.quote)),Gt.createElement(Wi,{onClick:()=>{o("Delete Thread",h=>Gt.createElement(Sy,{commentOrThread:u,deleteCommentOrThread:t,onClose:h}))},className:"CodoxCommentPlugin_CommentsPanel_List_DeleteButton"},Gt.createElement(by,null)),l),Gt.createElement("ul",{className:"CodoxCommentPlugin_CommentsPanel_List_Thread_Comments"},u.comments.map(h=>Gt.createElement(Ey,{key:h.codoxId,comment:h,deleteComment:t,thread:u,rtf:a}))),Gt.createElement("div",{className:"CodoxCommentPlugin_CommentsPanel_List_Thread_Editor"},Gt.createElement(M2,{submitAddComment:r,thread:u,placeholder:"Reply to comment..."})))}return Gt.createElement(Ey,{key:c,comment:u,deleteComment:t,rtf:a})}))}function L2(m){let{activeIDs:d,deleteCommentOrThread:p,comments:t,submitAddComment:f,markNodeMap:r}=m;const n=(0,Gt.useRef)(null),e=t.length===0;return Gt.createElement("div",{className:"CodoxCommentPlugin_CommentsPanel"},Gt.createElement("h2",{className:"CodoxCommentPlugin_CommentsPanel_Heading"},"Comments"),e?Gt.createElement("div",{className:"CodoxCommentPlugin_CommentsPanel_Empty"},"No Comments"):Gt.createElement(D2,{activeIDs:d,comments:t,deleteCommentOrThread:p,listRef:n,submitAddComment:f,markNodeMap:r}))}function Cy(){const m=(0,ny.useCollaborationContext)(),{yjsDocMap:d,name:p}=m;return p||"Playground User"}function B2(m){const[d]=(0,$i.useLexicalComposerContext)(),p=_w(),t=(0,Gt.useMemo)(()=>new Map,[]),[f,r]=(0,Gt.useState)(),[n,e]=(0,Gt.useState)([]),[s,i]=(0,Gt.useState)(!1),[l,o]=(0,Gt.useState)(!1);(0,Gt.useEffect)(()=>{!p.length&&l?o(!1):p.length},[p]);const a=(0,Gt.useCallback)(()=>{d.update(()=>{const g=(0,ve.$getSelection)();g!==null&&(g.dirty=!0)}),i(!1)},[d]),u=(0,Gt.useCallback)((g,h)=>{if(g.type==="comment"){if(le.log("[deleteCommentOrThread]: type comment new values",{comment:g,thread:h,markNodeMap:t}),kn.removeComment(h.codoxId,g.codoxId),!h)return;const y=h.codoxId,v=t.get(y);d.update(()=>{v?v.forEach((_,b)=>{const x=(0,ve.$getNodeByKey)(b);le.log("[deleteCommentOrThread]: type comment new values",{lexicalNode:x}),x&&x.markDirty()}):(0,ve.$getRoot)().markDirty(),(0,ve.$addUpdateTag)(oo.historic),(0,ve.$addUpdateTag)(Jl)})}else{le.log("[deleteCommentOrThread]: type thread new values",{comment:g,markNodeMap:t});const y=h!==void 0?h.codoxId:g.codoxId,v=t.get(y);setTimeout(()=>{d.update(()=>{if(v)for(const _ of v){const b=(0,ve.$getNodeByKey)(_);le.log("[deleteCommentOrThread]: type thread new values",{node:b}),(0,ro.$isMarkNode)(b)&&(b.deleteID(y),b.getIDs().length===0&&(0,ro.$unwrapMarkNode)(b))}else(0,ve.$getRoot)().markDirty(),le.debug("[deleteCommentOrThread][refreshComments]");kn.refreshComments(!0),(0,ve.$addUpdateTag)(Jl)})})}},[d,t]),c=(0,Gt.useCallback)((g,h,y,v)=>{if(le.log("[submitAddComment]: new values",{commentOrThread:g,isInlineComment:h,thread:y,markNodeMap:t}),y?kn.addComment(y.codoxId,g):kn.addCommentThread(g),h)d.update(()=>{if((0,ve.$isRangeSelection)(v)){const _=v.isBackward(),b=g.codoxId;(0,ro.$wrapSelectionInMarkNode)(v,_,b),(0,ve.$addUpdateTag)(Jl)}}),i(!1);else if(!h&&y){const _=y.codoxId,b=t.get(_);if(!b)return void kn.removeComment(y.codoxId,g.codoxId);d.update(()=>{b.forEach((x,w)=>{let S=(0,ve.$getNodeByKey)(w);S&&S.markDirty()}),(0,ve.$addUpdateTag)(oo.historic),(0,ve.$addUpdateTag)(Jl)})}},[d]);return(0,Gt.useEffect)(()=>{const g=[];for(let h=0;h<n.length;h++){const y=n[h],v=t.get(y);if(v!==void 0)for(const _ of v){const b=d.getElementByKey(_);b!==null&&(b.classList.add("selected"),g.push(b),o(!0))}}return()=>{for(let h=0;h<g.length;h++)g[h].classList.remove("selected")}},[n,d,t]),(0,Gt.useEffect)(()=>{const g=new Map;return(0,ws.mergeRegister)((0,ws.registerNestedElementResolver)(d,ro.MarkNode,h=>(0,ro.$createMarkNode)(h.getIDs()),(h,y)=>{h.getIDs().forEach(v=>{y.addID(v)})}),d.registerMutationListener(ro.MarkNode,h=>{d.getEditorState().read(()=>{for(const[y,v]of h){const _=(0,ve.$getNodeByKey)(y);let b=[];v==="destroyed"?b=g.get(y)||[]:(0,ro.$isMarkNode)(_)&&(b=_.getIDs());for(let x=0;x<b.length;x++){const w=b[x];let S=t.get(w);g.set(y,b),v==="destroyed"?S!==void 0&&(S.delete(y),S.size===0&&t.delete(w)):(S===void 0&&(S=new Set,t.set(w,S)),S.has(y)||S.add(y))}}})}),d.registerUpdateListener(h=>{let{editorState:y,tags:v}=h;y.read(()=>{const _=(0,ve.$getSelection)();let b=!1,x=!1;if((0,ve.$isRangeSelection)(_)){const w=_.anchor.getNode();if((0,ve.$isTextNode)(w)){const S=(0,ro.$getMarkIDs)(w,_.anchor.offset);S!==null&&(e(S),b=!0),_.isCollapsed()||(r(w.getKey()),x=!0)}}b||e(w=>w.length===0?w:[]),x||r(null),(0,ve.$isRangeSelection)(_)&&i(!1)})}),d.registerCommand(op,()=>{const h=window.getSelection();return h!==null&&h.removeAllRanges(),i(!0),!0},ve.COMMAND_PRIORITY_EDITOR))},[d,t]),Gt.createElement(Gt.Fragment,null,s&&(0,Ps.createPortal)(Gt.createElement(R2,{editor:d,cancelAddComment:a,submitAddComment:c}),document.body),f!=null&&!s&&(0,Ps.createPortal)(Gt.createElement(P2,{anchorKey:f,editor:d,onAddComment:()=>{d.dispatchCommand(op,void 0)}}),document.body),(0,Ps.createPortal)(Gt.createElement(Wi,{className:"CodoxCommentPlugin_ShowCommentsButton "+(l?"active":""),onClick:()=>o(!l),title:l?"Hide Comments":"Show Comments"},Gt.createElement(A2,null)),document.body),l&&(0,Ps.createPortal)(Gt.createElement(L2,{comments:p,submitAddComment:c,deleteCommentOrThread:u,activeIDs:n,markNodeMap:t}),document.body))}var Bu=on(766),Ls={};Ls.styleTagTransform=si(),Ls.setAttributes=ii(),Ls.insert=oi().bind(null,"head"),Ls.domAPI=ri(),Ls.insertStyleElement=ai(),ni()(Bu.A,Ls),Bu.A&&Bu.A.locals&&Bu.A.locals;var Fu=on(225),Bs={};Bs.styleTagTransform=si(),Bs.setAttributes=ii(),Bs.insert=oi().bind(null,"head"),Bs.domAPI=ri(),Bs.insertStyleElement=ai(),ni()(Fu.A,Bs),Fu.A&&Fu.A.locals&&Fu.A.locals;function F2(m){let{label:d,value:p,onChange:t,placeholder:f="","data-test-id":r,type:n="text"}=m;return Gt.createElement("div",{className:"CodoxInput__wrapper"},Gt.createElement("label",{className:"CodoxInput__label"},d),Gt.createElement("input",{type:n,className:"CodoxInput__input",placeholder:f,value:p,onChange:e=>{t(e.target.value)},"data-test-id":r}))}function ky(m,d){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(m);d&&(t=t.filter(function(f){return Object.getOwnPropertyDescriptor(m,f).enumerable})),p.push.apply(p,t)}return p}function zu(m){for(var d=1;d<arguments.length;d++){var p=arguments[d]!=null?arguments[d]:{};d%2?ky(Object(p),!0).forEach(function(t){z2(m,t,p[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):ky(Object(p)).forEach(function(t){Object.defineProperty(m,t,Object.getOwnPropertyDescriptor(p,t))})}return m}function z2(m,d,p){return(d=U2(d))in m?Object.defineProperty(m,d,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[d]=p,m}function U2(m){var d=$2(m,"string");return typeof d=="symbol"?d:d+""}function $2(m,d){if(typeof m!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var t=p.call(m,d||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(d==="string"?String:Number)(m)}let Yl=!1;const H2=["#d0021b","#f5a623","#f8e71c","#8b572a","#7ed321","#417505","#bd10e0","#9013fe","#4a90e2","#50e3c2","#b8e986","#000000","#4a4a4a","#9b9b9b","#ffffff"],Zl=214,Oy=150;function q2(m){let{color:d,onChange:p}=m;const[t,f]=(0,Gt.useState)(Fs("hex",d)),[r,n]=(0,Gt.useState)(d),e=(0,Gt.useRef)(null),s=(0,Gt.useMemo)(()=>({x:t.hsv.s/100*Zl,y:(100-t.hsv.v)/100*Oy}),[t.hsv.s,t.hsv.v]),i=(0,Gt.useMemo)(()=>({x:t.hsv.h/360*Zl}),[t.hsv]);return(0,Gt.useEffect)(()=>{e.current!==null&&p&&n(t.hex)},[t,p]),(0,Gt.useEffect)(()=>{if(d===void 0)return;const l=Fs("hex",d);f(l),n(l.hex)},[d]),Gt.createElement("div",{className:"codox-color-picker-wrapper",style:{width:Zl},ref:e},Gt.createElement(F2,{label:"Hex",onChange:l=>{if(n(l),/^#[0-9A-Fa-f]{6}$/i.test(l)){const o=Fs("hex",l);f(o)}},value:r}),Gt.createElement("div",{className:"codox-color-picker-basic-color"},H2.map(l=>Gt.createElement("button",{className:l===t.hex?" active":"",key:l,style:{backgroundColor:l},onClick:()=>(o=>{n(o);let a=Fs("hex",o);f(a),p(a.hex,Yl)})(l)}))),Gt.createElement(Ty,{className:"codox-color-picker-saturation",style:{backgroundColor:`hsl(${t.hsv.h}, 100%, 50%)`},onChange:l=>{let{x:o,y:a}=l;const u=Fs("hsv",zu(zu({},t.hsv),{},{s:o/Zl*100,v:100-a/Oy*100}));f(u),n(u.hex),p(u.hex,Yl)}},Gt.createElement("div",{className:"codox-color-picker-saturation_cursor",style:{backgroundColor:t.hex,left:s.x,top:s.y}})),Gt.createElement(Ty,{className:"codox-color-picker-hue",onChange:l=>{let{x:o}=l;const a=Fs("hsv",zu(zu({},t.hsv),{},{h:o/Zl*360}));f(a),n(a.hex),p(a.hex,Yl)}},Gt.createElement("div",{className:"codox-color-picker-hue_cursor",style:{backgroundColor:`hsl(${t.hsv.h}, 100%, 50%)`,left:i.x}})),Gt.createElement("div",{className:"codox-color-picker-color",style:{backgroundColor:t.hex}}))}function Ty(m){let{className:d,style:p,onChange:t,children:f}=m;const r=(0,Gt.useRef)(null),n=(0,Gt.useRef)(!1),e=s=>{if(r.current){const{current:i}=r,{width:l,height:o,left:a,top:u}=i.getBoundingClientRect(),c=Ay(s.clientX-a,l,0),g=Ay(s.clientY-u,o,0);t({x:c,y:g})}};return Gt.createElement("div",{ref:r,className:d,style:p,onMouseDown:s=>{if(s.button!==0)return;e(s);const i=o=>{n.current=!0,Yl=!0,e(o)},l=o=>{n.current&&(Yl=!1),document.removeEventListener("mousemove",i,!1),document.removeEventListener("mouseup",l,!1),e(o),n.current=!1};document.addEventListener("mousemove",i,!1),document.addEventListener("mouseup",l,!1)}},f)}function Ay(m,d,p){return m>d?d:m<p?p:m}function jy(m){if(!m.startsWith("#")){const d=document.createElement("canvas").getContext("2d");if(!d)throw new Error("2d context not supported or canvas already initialized");return d.fillStyle=m,d.fillStyle}return m.length===4||m.length===5?m=m.split("").map((d,p)=>p?d+d:"#").join(""):m.length===7||m.length===9?m:"#000000"}function Py(m){const d=(m.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(p,t,f,r)=>"#"+t+t+f+f+r+r).substring(1).match(/.{2}/g)||[]).map(p=>parseInt(p,16));return{b:d[2],g:d[1],r:d[0]}}function gp(m){let{r:d,g:p,b:t}=m;d/=255,p/=255,t/=255;const f=Math.max(d,p,t),r=f-Math.min(d,p,t);return{h:r?60*(f===d?(p-t)/r+(p<t?6:0):f===p?2+(t-d)/r:4+(d-p)/r):0,s:f?r/f*100:0,v:100*f}}function W2(m){let{h:d,s:p,v:t}=m;p/=100,t/=100;const f=~~(d/60),r=d/60-f,n=t*(1-p),e=t*(1-p*r),s=t*(1-p*(1-r)),i=f%6,l=Math.round(255*[t,e,n,n,s,t][i]),o=Math.round(255*[s,t,t,e,n,n][i]);return{b:Math.round(255*[n,n,s,t,t,e][i]),g:o,r:l}}function Ny(m){let{b:d,g:p,r:t}=m;return"#"+[t,p,d].map(f=>f.toString(16).padStart(2,"0")).join("")}function Fs(m,d){let p=jy("#121212"),t=Py(p),f=gp(t);return m==="hex"?(p=jy(d),t=Py(p),f=gp(t)):m==="rgb"?(t=d,p=Ny(t),f=gp(t)):m==="hsv"&&(f=d,t=W2(f),p=Ny(t)),{hex:p,hsv:f,rgb:t}}const J2=Gt.createContext(null),Iy=4;function V2(m){let{children:d,dropDownRef:p,onClose:t,dropdownClassName:f}=m;const[r,n]=(0,Gt.useState)(),[e,s]=(0,Gt.useState)(),i=(0,Gt.useCallback)(o=>{n(a=>a?[...a,o]:[o])},[n]),l=(0,Gt.useMemo)(()=>({registerItem:i}),[i]);return(0,Gt.useEffect)(()=>{r&&!e&&s(r[0]),e&&e.current&&e.current.focus()},[r,e]),Gt.createElement(J2.Provider,{value:l},Gt.createElement("div",{className:f,ref:p,onKeyDown:o=>{if(!r)return;const a=o.key;["Escape","ArrowUp","ArrowDown","Tab"].includes(a)&&o.preventDefault(),a==="Escape"||a==="Tab"?t():a==="ArrowUp"?s(u=>{if(!u)return r[0];const c=r.indexOf(u)-1;return r[c===-1?r.length-1:c]}):a==="ArrowDown"&&s(u=>u?r[r.indexOf(u)+1]:r[0])}},d))}function K2(m){let{disabled:d=!1,buttonLabel:p,buttonAriaLabel:t,buttonClassName:f,buttonIconClassName:r,children:n,stopCloseOnClickSelf:e,dropdownClassName:s,buttonLabelClassName:i,dropdownChevronClassName:l}=m;const o=(0,Gt.useRef)(null),a=(0,Gt.useRef)(null),[u,c]=(0,Gt.useState)(!1);return(0,Gt.useEffect)(()=>{const g=a.current,h=o.current;if(u&&g!==null&&h!==null){const{top:y,left:v}=g.getBoundingClientRect();h.style.top=`${y+g.offsetHeight+Iy}px`,h.style.left=`${Math.min(v,window.innerWidth-h.offsetWidth-20)}px`}},[o,a,u]),(0,Gt.useEffect)(()=>{const g=a.current;if(g!==null&&u){const h=y=>{const v=y.target;e&&o.current&&o.current.contains(v)||g.contains(v)||c(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[o,a,u,e]),(0,Gt.useEffect)(()=>{const g=()=>{if(u){const h=a.current,y=o.current;if(h!==null&&y!==null){const{top:v}=h.getBoundingClientRect(),_=v+h.offsetHeight+Iy;_!==y.getBoundingClientRect().top&&(y.style.top=`${_}px`)}}};return document.addEventListener("scroll",g),()=>{document.removeEventListener("scroll",g)}},[a,o,u]),Gt.createElement(Gt.Fragment,null,Gt.createElement("button",{type:"button",disabled:d,"aria-label":t||p,className:f,onClick:()=>c(!u),ref:a},r&&Gt.createElement("span",{className:r}),p&&Gt.createElement("span",{className:i},p),Gt.createElement("i",{className:l})),u&&(0,Ps.createPortal)(Gt.createElement(V2,{dropDownRef:o,onClose:()=>{c(!1),a&&a.current&&a.current.focus()},dropdownClassName:s},n),document.body))}const G2=["disabled","stopCloseOnClickSelf","color","onChange"];function mp(){return mp=Object.assign?Object.assign.bind():function(m){for(var d=1;d<arguments.length;d++){var p=arguments[d];for(var t in p)({}).hasOwnProperty.call(p,t)&&(m[t]=p[t])}return m},mp.apply(null,arguments)}function Y2(m,d){if(m==null)return{};var p,t,f=Z2(m,d);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);for(t=0;t<r.length;t++)p=r[t],d.indexOf(p)>=0||{}.propertyIsEnumerable.call(m,p)&&(f[p]=m[p])}return f}function Z2(m,d){if(m==null)return{};var p={};for(var t in m)if({}.hasOwnProperty.call(m,t)){if(d.indexOf(t)>=0)continue;p[t]=m[t]}return p}function Ry(m){let{disabled:d=!1,stopCloseOnClickSelf:p=!0,color:t,onChange:f}=m,r=Y2(m,G2);return Gt.createElement(K2,mp({},r,{disabled:d,stopCloseOnClickSelf:p}),Gt.createElement(q2,{color:t,onChange:f}))}const X2=m=>{let{onColorChange:d,buttonClassName:p,buttonIconClassName:t,buttonAriaLabel:f,buttonLabel:r,dropdownClassName:n,buttonLabelClassName:e,dropdownChevronClassName:s}=m;const[i]=(0,$i.useLexicalComposerContext)(),[l,o]=(0,Gt.useState)(()=>i.isEditable()),[a,u]=(0,Gt.useState)("");(0,Gt.useEffect)(()=>(0,ws.mergeRegister)(i.registerEditableListener(g=>{o(g)}),i.registerUpdateListener(g=>{let{editorState:h}=g;h.read(()=>{const y=(0,ve.$getSelection)();if((0,ve.$isRangeSelection)(y)){let v=(0,Oa.$getSelectionStyleValueForProperty)(y,"color");v!==a&&(u(v||""),d(v))}})})),[i]);const c=(0,Gt.useCallback)((g,h)=>{i.update(()=>{const y=(0,ve.$getSelection)();y!==null&&(0,Oa.$patchStyleText)(y,{color:g})})},[i]);return Gt.createElement(Ry,{disabled:!l,color:a,onChange:c,buttonClassName:p||"",buttonIconClassName:t||"",buttonAriaLabel:f||"",buttonLabel:r||"",dropdownClassName:n||"",buttonLabelClassName:e||"",dropdownChevronClassName:s||""})},Q2=X2,tE=m=>{let{onColorChange:d,buttonClassName:p,buttonIconClassName:t,buttonAriaLabel:f,buttonLabel:r,dropdownClassName:n,buttonLabelClassName:e,dropdownChevronClassName:s}=m;const[i]=(0,$i.useLexicalComposerContext)(),[l,o]=(0,Gt.useState)(()=>i.isEditable()),[a,u]=(0,Gt.useState)("#fff");(0,Gt.useEffect)(()=>(0,ws.mergeRegister)(i.registerEditableListener(g=>{o(g)}),i.registerUpdateListener(g=>{let{editorState:h}=g;h.read(()=>{const y=(0,ve.$getSelection)();if((0,ve.$isRangeSelection)(y)){let v=(0,Oa.$getSelectionStyleValueForProperty)(y,"background-color");v!==a&&(u(v||""),d(v))}})})),[i]);const c=(0,Gt.useCallback)((g,h)=>{i.update(()=>{const y=(0,ve.$getSelection)();y!==null&&(0,Oa.$patchStyleText)(y,{"background-color":g})})},[i]);return Gt.createElement(Ry,{disabled:!l,color:a,onChange:c,buttonClassName:p||"",buttonIconClassName:t||"",buttonAriaLabel:f||"",buttonLabel:r||"",dropdownClassName:n||"",buttonLabelClassName:e||"",dropdownChevronClassName:s||""})},eE=tE;var nE=Bi.yy;Bi._U,Bi.a8,Bi.Vs,Bi.Cn;var rE=Bi.gK,oE=Bi.vv;function iE(m){return m&&m.__esModule&&Object.prototype.hasOwnProperty.call(m,"default")?m.default:m}var Uu=iE(function(m){const d=new URLSearchParams;d.append("code",m);for(let p=1;p<arguments.length;p++)d.append("v",arguments[p]);throw Error(`Minified Lexical error #${m}; visit https://lexical.dev/docs/error?${d} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function aE({hasCellMerge:m=!0,hasCellBackgroundColor:d=!0,hasTabHandler:p=!0}){const[t]=Pr();return Se.useEffect(()=>(t.hasNodes([_o,Di,zl])||Uu(10),vo(t.registerCommand(ax,({columns:f,rows:r,includeHeaders:n})=>{const e=d0(Number(r),Number(f),n);Bm(e);const s=e.getFirstDescendant();return Ne(s)&&s.select(),!0},an),t.registerNodeTransform(_o,f=>{const[r]=g0(f,null,null),n=r.reduce((e,s)=>Math.max(e,s.length),0);for(let e=0;e<r.length;++e){const s=r[e].length;if(s===n)continue;const i=r[e][s-1].cell;for(let l=s;l<n;++l){const o=ti(0);o.append(Hn()),i!==null?i.insertAfter(o):Fm(i,o)}}}))),[t]),Se.useEffect(()=>{const f=new Map,r=e=>{const s=e.getKey(),i=t.getElementByKey(s);if(i&&!f.has(s)){const l=bx(e,i,t,p);f.set(s,l)}};t.getEditorState().read(()=>{const e=Og(_o);for(const s of e)In(s)&&r(s)});const n=t.registerMutationListener(_o,e=>{for(const[s,i]of e)if(i==="created")t.getEditorState().read(()=>{const l=Kn(s);In(l)&&r(l)});else if(i==="destroyed"){const l=f.get(s);l!==void 0&&(l.removeListeners(),f.delete(s))}});return()=>{n();for(const[,e]of f)e.removeListeners()}},[t,p]),Se.useEffect(()=>{if(!m)return t.registerNodeTransform(Di,f=>{if(f.getColSpan()>1||f.getRowSpan()>1){const[,,r]=Jr(f),[n]=No(r,f,f),e=n.length,s=n[0].length;let i=r.getFirstChild();cr(i)||Uu(175);const l=[];for(let o=0;o<e;o++){o!==0&&(i=i.getNextSibling(),cr(i)||Uu(175));let a=null;for(let u=0;u<s;u++){const c=n[o][u],g=c.cell;if(c.startRow===o&&c.startColumn===u)a=g,l.push(g);else if(g.getColSpan()>1||g.getRowSpan()>1){rn(g)||Uu(176);const h=ti(g.__headerState);a!==null?a.insertAfter(h):Fm(i,h)}}}for(const o of l)o.setColSpan(1),o.setRowSpan(1)}})},[t,m]),Se.useEffect(()=>{if(!d)return t.registerNodeTransform(Di,f=>{f.getBackgroundColor()!==null&&f.setBackgroundColor(null)})},[t,d,m]),null}const sE={code:"editor-code",heading:{h1:"editor-heading-h1",h2:"editor-heading-h2",h3:"editor-heading-h3",h4:"editor-heading-h4",h5:"editor-heading-h5"},image:"editor-image",link:"editor-link",list:{listitem:"editor-listitem",nested:{listitem:"editor-nested-listitem"},ol:"editor-list-ol",ul:"editor-list-ul"},ltr:"ltr",paragraph:"editor-paragraph",placeholder:"editor-placeholder",quote:"editor-quote",rtl:"rtl",text:{bold:"editor-text-bold",code:"editor-text-code",hashtag:"editor-text-hashtag",italic:"editor-text-italic",overflowed:"editor-text-overflowed",strikethrough:"editor-text-strikethrough",underline:"editor-text-underline",underlineStrikethrough:"editor-text-underlineStrikethrough"},table:"PlaygroundEditorTheme__table",tableAddColumns:"PlaygroundEditorTheme__tableAddColumns",tableAddRows:"PlaygroundEditorTheme__tableAddRows",tableCell:"PlaygroundEditorTheme__tableCell",tableCellActionButton:"PlaygroundEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"PlaygroundEditorTheme__tableCellActionButtonContainer",tableCellEditing:"PlaygroundEditorTheme__tableCellEditing",tableCellHeader:"PlaygroundEditorTheme__tableCellHeader",tableCellPrimarySelected:"PlaygroundEditorTheme__tableCellPrimarySelected",tableCellResizer:"PlaygroundEditorTheme__tableCellResizer",tableCellSelected:"PlaygroundEditorTheme__tableCellSelected",tableCellSortedIndicator:"PlaygroundEditorTheme__tableCellSortedIndicator",tableResizeRuler:"PlaygroundEditorTheme__tableCellResizeRuler",tableSelected:"PlaygroundEditorTheme__tableSelected",tableSelection:"PlaygroundEditorTheme__tableSelection"},lE="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDE1IDE1IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTYuMDAwMDEgOC4zMzMzM0wxLjkwMDAxIDEzLjhMMS4xMDAwMSAxMy4yTDUuMzc1MDEgNy41TDEuMTAwMDEgMS44TDEuOTAwMDEgMS4yTDYuMDAwMDEgNi42NjY2N0wxMC4xIDEuMkwxMC45IDEuOEw2LjYyNTAxIDcuNUwxMC45IDEzLjJMMTAuMSAxMy44TDYuMDAwMDEgOC4zMzMzM1pNMTIgMTIuNUMxMiAxMS42NzE2IDEyLjY3MTYgMTEgMTMuNSAxMUgxMy43OTI5QzE0LjQ1OTYgMTEgMTUgMTEuNTQwNCAxNSAxMi4yMDcxQzE1IDEyLjUyNzMgMTQuODcyOCAxMi44MzQzIDE0LjY0NjUgMTMuMDYwN0wxMy43MDcxIDE0SDE1VjE1SDEyLjVDMTIuMjk3OCAxNSAxMi4xMTU1IDE0Ljg3ODIgMTIuMDM4MSAxNC42OTEzQzExLjk2MDcgMTQuNTA0NSAxMi4wMDM1IDE0LjI4OTQgMTIuMTQ2NSAxNC4xNDY0TDEzLjkzOTMgMTIuMzUzNkMxMy45NzgyIDEyLjMxNDcgMTQgMTIuMjYyIDE0IDEyLjIwNzFDMTQgMTIuMDkyNyAxMy45MDczIDEyIDEzLjc5MjkgMTJIMTMuNUMxMy4yMjM5IDEyIDEzIDEyLjIyMzkgMTMgMTIuNUgxMloiIGZpbGw9IiMwMDAwMDAiLz4KPC9zdmc+",cE="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIiB0ZXh0LXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIiBpbWFnZS1yZW5kZXJpbmc9Im9wdGltaXplUXVhbGl0eSIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIHZpZXdCb3g9IjAgMCA1MDQgNTEyLjM2Ij48cGF0aCBmaWxsLXJ1bGU9Im5vbnplcm8iIGQ9Ik00OTkuNDMgMjMxLjM2SDM2OC40Yy0yLjUzIDAtNC41OC0yLjA1LTQuNTgtNC41N3YtOC4xMWMwLTEuMjYuNTItMi40IDEuMzQtMy4yMmw3MS41Ny04Mi41M2M2LjczLTcuNzUgMTIuNTctMTQuOTcgMTcuNDgtMjEuNjggNC44OC02LjY0IDguODMtMTIuNzQgMTEuODUtMTguMjggMi45Ny01LjQzIDUuMTgtMTAuNjEgNi42NC0xNS41NSAxLjQyLTQuODUgMi4xMy05LjUzIDIuMTMtMTQgMC0xNC42OC0zLjk4LTI2LjA1LTExLjkyLTM0LjA5LTMuOTItMy45Ni04Ljc1LTYuOTMtMTQuNDktOC45Mi01Ljk1LTIuMDMtMTIuOTEtMy4wNS0yMC44Ny0zLjA1LTguNDUgMC0xNS44OCAxLjIxLTIyLjI5IDMuNjItNi4yNyAyLjM2LTExLjYzIDUuOTItMTYuMDcgMTAuNjNhNDcuODg0IDQ3Ljg4NCAwIDAgMC0xMC4xNCAxNi42Yy0yLjI3IDYuMjktMy40MSAxMy4zOS0zLjQxIDIxLjI2IDAgMi41Mi0yLjA1IDQuNTctNC41NyA0LjU3aC02Ljg5Yy0yLjA1IDAtMy44LTEuMzYtNC4zNy0zLjI0bC0uMjctLjgyYy0uMTgtLjU2LS4yNS0xLjEzLS4yMi0xLjY3LS4yMy05LjMyIDEuMTQtMTcuOTkgNC4xMi0yNS45NyAzLjAyLTguMTMgNy42OC0xNS41NCAxMy45NC0yMi4xOSA2LjI2LTYuNyAxMy42My0xMS43NiAyMi4xLTE1LjEzQzQwNy44NCAxLjY4IDQxNy4yIDAgNDI3LjU1IDBjOS41OSAwIDE4LjI2IDEuMzggMjYuMDMgNC4xMyA3Ljg2IDIuNzkgMTQuNzcgNyAyMC43MiAxMi42MSA2LjAyIDUuNjMgMTAuNTUgMTIuNCAxMy41NSAyMC4yOCAyLjk2IDcuNzUgNC40NSAxNi41NiA0LjQ1IDI2LjQgMCA2LjUtMS4wNyAxMy4wOC0zLjE3IDE5LjY5bC0uMTQuMzhjLTIuMDkgNi40Ni01LjE3IDEyLjk3LTkuMiAxOS40OWwtLjE0LjIxYy00LjA4IDYuNTEtOC45IDEzLjQzLTE0LjQzIDIwLjc0LTUuNTYgNy4zMy0xMS45NiAxNS4yMy0xOS4yMiAyMy42N2wtNTYuOTEgNjYuNTFoMTEwLjM0YzIuNTIgMCA0LjU3IDIuMDUgNC41NyA0LjU3djguMTFjMCAyLjUyLTIuMDUgNC41Ny00LjU3IDQuNTd6bS0zMjcuMjUgNjguNzUgMTM3Ljk2LTE2Ny43NmMuODktMS4wNyAyLjMtMS42NSAzLjc0LTEuNjVsMjAuMTMtLjAyYzIuNTIgMCA0LjU3IDEuNzQgNC41NyAzLjg4IDAgLjkxLS4zNyAxLjc1LS45OCAyLjQxTDE4OC4zMiAzMTcuNjYgMzQ0LjEgNTA2LjI0YzEuNDUgMS43NS45NSA0LjE3LTEuMSA1LjQtLjguNDgtMS43Mi43MS0yLjYzLjcxbC0yMC4xMy4wMWMtMS43IDAtMy4xOC0uNzktMy45Ny0xLjk2bC0xNDQuMS0xNzUuMkwyOC4yMyA1MTAuNjljLS44OCAxLjA3LTIuMyAxLjY0LTMuNzMgMS42NWwtMTkuOTMuMDJjLTIuNTIgMC00LjU3LTEuNzQtNC41Ny0zLjg5IDAtLjkuMzctMS43NC45OC0yLjRsMTU1LjY1LTE4OC40TDYuOSAxMzYuOGMtMS40NS0xLjc1LS45NS00LjE4IDEuMTEtNS40MS43OS0uNDcgMS43MS0uNyAyLjYyLS43bDIwLjQ0LS4wMWMxLjYzIDAgMy4wNi43MiAzLjg3IDEuODFsMTM3LjI0IDE2Ny42MnoiLz48L3N2Zz4=",My=tr.createContext(null),Dy=4;function $u({children:m,className:d,onClick:p,title:t}){const f=Se.useRef(null),r=tr.useContext(My);if(r===null)throw new Error("DropDownItem must be used within a DropDown");const{registerItem:n}=r;return Se.useEffect(()=>{f&&f.current&&n(f)},[f,n]),pe.jsx("button",{className:d,onClick:p,ref:f,title:t,type:"button",children:m})}function uE({children:m,dropDownRef:d,onClose:p}){const[t,f]=Se.useState(),[r,n]=Se.useState(),e=Se.useCallback(l=>{f(o=>o?[...o,l]:[l])},[f]),s=l=>{if(!t)return;const o=l.key;["Escape","ArrowUp","ArrowDown","Tab"].includes(o)&&l.preventDefault(),o==="Escape"||o==="Tab"?p():o==="ArrowUp"?n(a=>{if(!a)return t[0];const u=t.indexOf(a)-1;return t[u===-1?t.length-1:u]}):o==="ArrowDown"&&n(a=>a?t[t.indexOf(a)+1]:t[0])},i=Se.useMemo(()=>({registerItem:e}),[e]);return Se.useEffect(()=>{t&&!r&&n(t[0]),r&&r.current&&r.current.focus()},[t,r]),pe.jsx(My.Provider,{value:i,children:pe.jsx("div",{className:"dropdown",ref:d,onKeyDown:s,children:m})})}function dE({disabled:m=!1,buttonLabel:d,buttonAriaLabel:p,buttonClassName:t,buttonIconClassName:f,children:r,stopCloseOnClickSelf:n}){const e=Se.useRef(null),s=Se.useRef(null),[i,l]=Se.useState(!1),o=()=>{l(!1),s&&s.current&&s.current.focus()};return Se.useEffect(()=>{const a=s.current,u=e.current;if(i&&a!==null&&u!==null){const{top:c,left:g}=a.getBoundingClientRect();u.style.top=`${c+a.offsetHeight+Dy}px`,u.style.left=`${Math.min(g,window.innerWidth-u.offsetWidth-20)}px`}},[e,s,i]),Se.useEffect(()=>{const a=s.current;if(a!==null&&i){const u=c=>{const g=c.target;n&&e.current&&e.current.contains(g)||a.contains(g)||l(!1)};return document.addEventListener("click",u),()=>{document.removeEventListener("click",u)}}},[e,s,i,n]),Se.useEffect(()=>{const a=()=>{if(i){const u=s.current,c=e.current;if(u!==null&&c!==null){const{top:g}=u.getBoundingClientRect(),h=g+u.offsetHeight+Dy;h!==c.getBoundingClientRect().top&&(c.style.top=`${h}px`)}}};return document.addEventListener("scroll",a),()=>{document.removeEventListener("scroll",a)}},[s,e,i]),pe.jsxs(pe.Fragment,{children:[pe.jsxs("button",{type:"button",disabled:m,"aria-label":p||d,className:t,onClick:()=>l(!i),ref:s,children:[f&&pe.jsx("span",{className:f}),d&&pe.jsx("span",{className:"text dropdown-button-text",children:d}),pe.jsx("i",{className:"chevron-down"})]}),i&&qr.createPortal(pe.jsx(uE,{dropDownRef:e,onClose:o,children:r}),document.body)]})}function Ly(){return pe.jsx("div",{className:"divider"})}const yp=8,vp=72,zs={h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",paragraph:"Normal"};function fE({selectionFontSize:m,disabled:d,editor:p,blockType:t,styleConfig:f}){const[r,n]=tr.useState(m),[e,s]=tr.useState(t),i=c=>{p.update(()=>{if(p.isEditable()){const g=Oe();g!==null&&Im(g,c)}})},l=c=>{n(c.target.value)},o=()=>{const c=Number(r);if(!isNaN(c)){const g=Math.min(Math.max(c,yp),vp);n(String(g)),i({"font-size":`${g}px`})}},a=c=>{const g=f[e].fontSize,h=c?Math.min(g+2,vp):Math.max(g-2,yp);n(String(h)),i({"font-size":`${h}px`})},u=c=>{if(s(c),c==="paragraph"){const g=f.paragraph;n(String(g.fontSize)),i({"font-size":`${g.fontSize}px`,color:g.fontColor,"font-family":g.fontFamily,"line-height":`${1+g.leadingSpace}em`,"margin-bottom":`${g.trailingSpace}em`})}else{const{fontSize:g,fontColor:h,fontFamily:y,leadingSpace:v,trailingSpace:_}=f[c];n(String(g)),i({"font-size":`${g}px`,color:h,"font-family":y,"line-height":`${1+v}em`,"margin-bottom":`${_}em`})}};return tr.useEffect(()=>{const c=()=>{p.update(()=>{const g=Oe();if(g!==null){const y=g.getNodes()[0];if(!Ne(y)){const v=y.getType();v in zs&&s(v)}}})};return p.registerUpdateListener(c),()=>{p.registerUpdateListener(c)}},[p]),pe.jsxs(pe.Fragment,{children:[pe.jsx("button",{type:"button",disabled:d,onClick:()=>a(!1),className:"toolbar-item font-decrement"}),pe.jsx("input",{type:"number",value:r,disabled:d,readOnly:!0,className:"toolbar-item font-size-input",min:yp,max:vp,onChange:l,onBlur:o}),pe.jsx("button",{type:"button",disabled:d,onClick:()=>a(!0),className:"toolbar-item font-increment"}),pe.jsx(Ly,{}),pe.jsxs("div",{className:"symbol-dropdown cust-head-dropDown",children:[pe.jsxs(dE,{disabled:d,buttonClassName:"toolbar-item block-controls",buttonAriaLabel:"Formatting options for text style",buttonIconClassName:"icon block-type "+e,buttonLabel:zs[e],children:[pe.jsxs($u,{className:`item ${e==="paragraph"?"active":""}`,onClick:()=>u("paragraph"),children:[pe.jsx("i",{className:"icon paragraph"}),pe.jsx("span",{className:"text",children:zs.paragraph})]}),pe.jsxs($u,{className:`item ${e==="h1"?"active":""}`,onClick:()=>u("h1"),children:[pe.jsx("i",{className:"icon h1"}),pe.jsx("span",{className:"text",children:zs.h1})]}),pe.jsxs($u,{className:`item ${e==="h2"?"active":""}`,onClick:()=>u("h2"),children:[pe.jsx("i",{className:"icon h2"}),pe.jsx("span",{className:"text",children:zs.h2})]}),pe.jsxs($u,{className:`item ${e==="h3"?"active":""}`,onClick:()=>u("h3"),children:[pe.jsx("i",{className:"icon h3"}),pe.jsx("span",{className:"text",children:zs.h3})]})]}),pe.jsx(Ly,{})]})]})}const pE="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48IS0tISBGb250IEF3ZXNvbWUgUHJvIDYuMS4xIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlIChDb21tZXJjaWFsIExpY2Vuc2UpIENvcHlyaWdodCAyMDIyIEZvbnRpY29ucywgSW5jLi0tPjxwYXRoIGQ9Ik0wIDI1NkMwIDExNC42IDExNC42IDAgMjU2IDBzMjU2IDExNC42IDI1NiAyNTYtMTE0LjYgMjU2LTI1NiAyNTZTMCAzOTcuNCAwIDI1NnptMTc1LTQ3LjkgNDcuMSA0N0wxNzUgMzAzYy05LjMgOS40LTkuMyAyNC42IDAgMzMuMSA5LjQgMTAuMiAyNC42IDEwLjIgMzMuMSAwbDQ3LTQ2LjIgNDcuOSA0Ni4yYzkuNCAxMC4yIDI0LjYgMTAuMiAzMy4xIDAgMTAuMi04LjUgMTAuMi0yMy43IDAtMzMuMWwtNDYuMi00Ny45IDQ2LjItNDdjMTAuMi04LjUgMTAuMi0yMy43IDAtMzMuMS04LjUtOS4zLTIzLjctOS4zLTMzLjEgMGwtNDcuOSA0Ny4xLTQ3LTQ3LjFjLTguNS05LjMtMjMuNy05LjMtMzMuMSAwLTkuMyA5LjQtOS4zIDI0LjYgMCAzMy4xeiIvPjwvc3ZnPg==",hE="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iY3VycmVudENvbG9yIiBjbGFzcz0iYmkgYmktdGFibGUiPjxwYXRoIGQ9Ik0wIDJhMiAyIDAgMCAxIDItMmgxMmEyIDIgMCAwIDEgMiAydjEyYTIgMiAwIDAgMS0yIDJIMmEyIDIgMCAwIDEtMi0yVjJ6bTE1IDJoLTR2M2g0VjR6bTAgNGgtNHYzaDRWOHptMCA0aC00djNoM2ExIDEgMCAwIDAgMS0xdi0yem0tNSAzdi0zSDZ2M2g0em0tNSAwdi0zSDF2MmExIDEgMCAwIDAgMSAxaDN6bS00LTRoNFY4SDF2M3ptMC00aDRWNEgxdjN6bTUtM3YzaDRWNEg2em00IDRINnYzaDRWOHoiLz48L3N2Zz4=";function gE(){const[m,d]=Se.useState("4"),[p,t]=Se.useState("4"),[f,r]=Se.useState(!1),[n,e]=Se.useState(),[s]=Pr(),i=()=>{!m||!p||(s.update(()=>{const l=d0(m,p,!0),o=Bm(l);e(o)}),r(!1))};return pe.jsxs(pe.Fragment,{children:[pe.jsx("button",{className:"toolbar-item ",onClick:()=>r(!0),children:pe.jsx("img",{className:"add-toolbar-table-icon",src:hE,alt:"Add Table"})}),f&&pe.jsx("div",{className:"modal-overlay",children:pe.jsxs("div",{className:"modal-content",children:[pe.jsx("h3",{children:"Select Table Dimensions"}),pe.jsx("button",{className:"modal-buttons-close",onClick:()=>r(!1),children:pe.jsx("img",{src:pE,height:16,width:16,style:{margin:"0 0 29px 10px"}})}),pe.jsxs("div",{className:"select-table-container",children:[pe.jsx("label",{children:"Rows"}),pe.jsx("input",{type:"number",value:m,onChange:l=>d(Number(l.target.value))})]}),pe.jsxs("div",{className:"select-table-container",children:[pe.jsx("label",{children:"Column"}),pe.jsx("input",{type:"number",value:p,onChange:l=>t(Number(l.target.value))})]}),pe.jsx("div",{children:pe.jsx("div",{className:"modal-buttons",children:pe.jsx("button",{className:"toolbar-item",onClick:i,children:"Confirm"})})})]})})]})}const By="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNNCAxMkgyME0xMiA0VjIwIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPg==",Fy="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNNiAxMkwxOCAxMiIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4=";var mE=typeof global=="object"&&global&&global.Object===Object&&global;const yE=mE;var vE=typeof self=="object"&&self&&self.Object===Object&&self,bE=yE||vE||Function("return this")();const zy=bE;var _E=zy.Symbol;const Hu=_E;var Uy=Object.prototype,xE=Uy.hasOwnProperty,wE=Uy.toString,Xl=Hu?Hu.toStringTag:void 0;function SE(m){var d=xE.call(m,Xl),p=m[Xl];try{m[Xl]=void 0;var t=!0}catch{}var f=wE.call(m);return t&&(d?m[Xl]=p:delete m[Xl]),f}var EE=Object.prototype,CE=EE.toString;function kE(m){return CE.call(m)}var OE="[object Null]",TE="[object Undefined]",$y=Hu?Hu.toStringTag:void 0;function AE(m){return m==null?m===void 0?TE:OE:$y&&$y in Object(m)?SE(m):kE(m)}function jE(m){return m!=null&&typeof m=="object"}var PE="[object Symbol]";function NE(m){return typeof m=="symbol"||jE(m)&&AE(m)==PE}var IE=/\s/;function RE(m){for(var d=m.length;d--&&IE.test(m.charAt(d)););return d}var ME=/^\s+/;function DE(m){return m&&m.slice(0,RE(m)+1).replace(ME,"")}function bp(m){var d=typeof m;return m!=null&&(d=="object"||d=="function")}var Hy=0/0,LE=/^[-+]0x[0-9a-f]+$/i,BE=/^0b[01]+$/i,FE=/^0o[0-7]+$/i,zE=parseInt;function qy(m){if(typeof m=="number")return m;if(NE(m))return Hy;if(bp(m)){var d=typeof m.valueOf=="function"?m.valueOf():m;m=bp(d)?d+"":d}if(typeof m!="string")return m===0?m:+m;m=DE(m);var p=BE.test(m);return p||FE.test(m)?zE(m.slice(2),p?2:8):LE.test(m)?Hy:+m}var UE=function(){return zy.Date.now()};const _p=UE;var $E="Expected a function",HE=Math.max,qE=Math.min;function WE(m,d,p){var t,f,r,n,e,s,i=0,l=!1,o=!1,a=!0;if(typeof m!="function")throw new TypeError($E);d=qy(d)||0,bp(p)&&(l=!!p.leading,o="maxWait"in p,r=o?HE(qy(p.maxWait)||0,d):r,a="trailing"in p?!!p.trailing:a);function u(w){var S=t,C=f;return t=f=void 0,i=w,n=m.apply(C,S),n}function c(w){return i=w,e=setTimeout(y,d),l?u(w):n}function g(w){var S=w-s,C=w-i,k=d-S;return o?qE(k,r-C):k}function h(w){var S=w-s,C=w-i;return s===void 0||S>=d||S<0||o&&C>=r}function y(){var w=_p();if(h(w))return v(w);e=setTimeout(y,g(w))}function v(w){return e=void 0,a&&t?u(w):(t=f=void 0,n)}function _(){e!==void 0&&clearTimeout(e),i=0,t=s=f=e=void 0}function b(){return e===void 0?n:v(_p())}function x(){var w=_p(),S=h(w);if(t=arguments,f=this,s=w,S){if(e===void 0)return c(s);if(o)return clearTimeout(e),e=setTimeout(y,d),u(s)}return e===void 0&&(e=setTimeout(y,d)),n}return x.cancel=_,x.flush=b,x}function JE(m,d,p){const t=Se.useRef(null);return t.current=m,Se.useMemo(()=>WE((...f)=>{t.current&&t.current(...f)},d,{maxWait:p}),[d,p])}const Wy=20;function VE({anchorElem:m}){const[d]=Pr(),p=mu(),[t,f]=Se.useState(!1),[r,n]=Se.useState(!1),[e,s]=Se.useState(!1),[i,l]=Se.useState({}),o=Se.useRef(new Set),a=Se.useRef(null),u=JE(y=>{const{isOutside:v,tableDOMNode:_}=KE(y);if(v){f(!1),n(!1);return}if(!_)return;a.current=_;let b=null,x=null,w=null;if(d.update(()=>{var C;const S=ir(_);if(rn(S)){const k=bn(S,D=>In(D));if(!In(k))return;if(w=d.getElementByKey(k==null?void 0:k.getKey()),w){const D=k.getChildrenSize(),N=(C=k.getChildAtIndex(0))==null?void 0:C.getChildrenSize(),O=dx(S),R=p0(S);O===D-1?b=S:R===N-1&&(x=S)}}}),w){const{width:S,y:C,right:k,left:D,bottom:N,height:O}=w.getBoundingClientRect(),{y:R,left:A}=m.getBoundingClientRect();b?(n(!1),f(!0),l({height:Wy,left:D-A,top:N-R+5,width:S})):x&&(n(!0),f(!1),l({height:O,left:k-A+5,top:C-R,width:Wy}))}},50,250),c=Se.useMemo(()=>new ResizeObserver(()=>{f(!1),n(!1)}),[]);Se.useEffect(()=>{if(e)return document.addEventListener("mousemove",u),()=>{f(!1),n(!1),u.cancel(),document.removeEventListener("mousemove",u)}},[e,u]),Se.useEffect(()=>vo(d.registerMutationListener(_o,y=>{d.getEditorState().read(()=>{for(const[v,_]of y){const b=d.getElementByKey(v);switch(_){case"created":o.current.add(v),s(o.current.size>0),b&&c.observe(b);break;case"destroyed":o.current.delete(v),s(o.current.size>0),c.disconnect(),o.current.forEach(x=>{const w=d.getElementByKey(x);w&&c.observe(w)});break}}})})),[d,c]);const g=y=>{d.update(()=>{if(a.current){const v=ir(a.current);v==null||v.selectEnd(),y?(fx(),f(!1)):(px(),n(!1))}})},h=y=>{d.update(()=>{if(a.current){const v=ir(a.current);v==null||v.selectEnd(),y?(hx(),f(!1)):(gx(),n(!1))}})};return p?pe.jsxs(pe.Fragment,{children:[t&&pe.jsxs("div",{children:[pe.jsx("button",{className:"PlaygroundEditorTheme__tableAddRows",style:{...i,flex:"50%",padding:"20px"},onClick:()=>g(!0),children:pe.jsx("img",{src:By,height:14,width:14,style:{color:"grey",marginLeft:"-3px"}})}),pe.jsx("button",{className:"PlaygroundEditorTheme__tableAddRows",style:{...i,flex:"50%"},onClick:()=>h(!0),children:pe.jsx("img",{src:Fy,height:14,width:14,style:{color:"grey",marginLeft:"-3px"}})})]}),r&&pe.jsxs("div",{className:"table-add-row-flex-container",children:[pe.jsx("button",{className:"PlaygroundEditorTheme__tableAddColumns table-add-row-flex-children",style:{...i,flex:"50%",padding:"20px"},onClick:()=>g(!1),children:pe.jsx("img",{src:By,height:14,width:14,style:{color:"grey",marginLeft:"-3px"}})}),pe.jsx("button",{className:"PlaygroundEditorTheme__tableAddColumns table-add-row-flex-children",style:{...i,flex:"50%"},onClick:()=>h(!1),children:pe.jsx("img",{src:Fy,height:14,width:14,style:{color:"grey",marginLeft:"-3px"}})})]})]}):null}function KE(m){const d=m.target;if(d&&d instanceof HTMLElement){const p=d.closest("td.PlaygroundEditorTheme__tableCell, th.PlaygroundEditorTheme__tableCell");return{isOutside:!(p||d.closest("button.PlaygroundEditorTheme__tableAddRows")||d.closest("button.PlaygroundEditorTheme__tableAddColumns")||d.closest("div.TableCellResizer__resizer")),tableDOMNode:p}}else return{isOutside:!0,tableDOMNode:null}}function GE({anchorElem:m=document.body}){return mu()?qr.createPortal(pe.jsx(VE,{anchorElem:m}),m):null}const xp=1;function wp(){return pe.jsx("div",{className:"divider"})}function YE({renderOnlineUsers:m,styleConfig:d}){const[p]=Pr(),t=Se.useRef(null),[f,r]=Se.useState(!1),[n,e]=Se.useState(!1),[s,i]=Se.useState(!1),[l,o]=Se.useState(!1),[a,u]=Se.useState(!1),[c,g]=Se.useState(!1),[h,y]=Se.useState(!1),[v,_]=Se.useState(!1),[b,x]=Se.useState("11px"),[w,S]=Se.useState(()=>p.isEditable()),C=Se.useCallback(()=>{const k=Oe();xe(k)&&(i(k.hasFormat("bold")),o(k.hasFormat("italic")),u(k.hasFormat("underline")),g(k.hasFormat("strikethrough")),y(k.hasFormat("subscript")),_(k.hasFormat("superscript")),x(Rm(k,"font-size","11px")))},[]);return Se.useEffect(()=>vo(p.registerUpdateListener(({editorState:k})=>{k.read(()=>{C()})}),p.registerCommand(Ko,(k,D)=>(C(),!1),xp),p.registerCommand(os,k=>(r(k),!1),xp),p.registerCommand(rs,k=>(e(k),!1),xp)),[p,C]),console.log("styleConfig is",d),pe.jsxs("div",{className:"toolbar",ref:t,children:[pe.jsx("button",{disabled:!f,onClick:()=>{p.dispatchCommand(ml,void 0)},className:"toolbar-item spaced","aria-label":"Undo",children:pe.jsx("i",{className:"format undo"})}),pe.jsx("button",{disabled:!n,onClick:()=>{p.dispatchCommand(yl,void 0)},className:"toolbar-item","aria-label":"Redo",children:pe.jsx("i",{className:"format redo"})}),pe.jsx(wp,{}),pe.jsx(fE,{selectionFontSize:b.slice(0,-2),editor:p,disabled:!w,blockType:"paragraph",styleConfig:d}),pe.jsx(wp,{}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(Or,"bold")},className:"toolbar-item spaced "+(s?"active":""),"aria-label":"Format Bold",children:pe.jsx("i",{className:"format bold"})}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(Or,"italic")},className:"toolbar-item spaced "+(l?"active":""),"aria-label":"Format Italics",children:pe.jsx("i",{className:"format italic"})}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(Or,"underline")},className:"toolbar-item spaced "+(a?"active":""),"aria-label":"Format Underline",children:pe.jsx("i",{className:"format underline"})}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(Or,"strikethrough")},className:"toolbar-item spaced "+(c?"active":""),"aria-label":"Format Strikethrough",children:pe.jsx("i",{className:"format strikethrough"})}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(Or,"superscript")},className:"toolbar-item spaced "+(v?"active":""),"aria-label":"Format SuperScript",children:pe.jsx("img",{src:cE,height:16,width:16,style:{marginTop:"1px"}})}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(Or,"subscript")},className:"toolbar-item spaced "+(h?"active":""),"aria-label":"Format SubScript",children:pe.jsx("img",{src:lE,height:16,width:16,style:{marginTop:"1px"}})}),pe.jsx(wp,{}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(ns,"left")},className:"toolbar-item spaced","aria-label":"Left Align",children:pe.jsx("i",{className:"format left-align"})}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(ns,"center")},className:"toolbar-item spaced","aria-label":"Center Align",children:pe.jsx("i",{className:"format center-align"})}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(ns,"right")},className:"toolbar-item spaced","aria-label":"Right Align",children:pe.jsx("i",{className:"format right-align"})}),pe.jsx("button",{onClick:()=>{p.dispatchCommand(ns,"justify")},className:"toolbar-item","aria-label":"Justify Align",children:pe.jsx("i",{className:"format justify-align"})}),pe.jsx(gE,{}),pe.jsx(GE,{}),pe.jsx("div",{className:"avtar-outer-div",children:m()})]})}var Sp={exports:{}},Sn={};/** @license React v16.13.1
1430
1430
  * react-is.production.min.js
1431
1431
  *
1432
1432
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -1440,7 +1440,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1440
1440
  *
1441
1441
  * This source code is licensed under the MIT license found in the
1442
1442
  * LICENSE file in the root directory of this source tree.
1443
- */var Vy;function XE(){return Vy||(Vy=1,process.env.NODE_ENV!=="production"&&function(){var m=typeof Symbol=="function"&&Symbol.for,d=m?Symbol.for("react.element"):60103,p=m?Symbol.for("react.portal"):60106,t=m?Symbol.for("react.fragment"):60107,f=m?Symbol.for("react.strict_mode"):60108,r=m?Symbol.for("react.profiler"):60114,n=m?Symbol.for("react.provider"):60109,e=m?Symbol.for("react.context"):60110,s=m?Symbol.for("react.async_mode"):60111,i=m?Symbol.for("react.concurrent_mode"):60111,l=m?Symbol.for("react.forward_ref"):60112,o=m?Symbol.for("react.suspense"):60113,a=m?Symbol.for("react.suspense_list"):60120,u=m?Symbol.for("react.memo"):60115,c=m?Symbol.for("react.lazy"):60116,g=m?Symbol.for("react.block"):60121,h=m?Symbol.for("react.fundamental"):60117,y=m?Symbol.for("react.responder"):60118,v=m?Symbol.for("react.scope"):60119;function _(Z){return typeof Z=="string"||typeof Z=="function"||Z===t||Z===i||Z===r||Z===f||Z===o||Z===a||typeof Z=="object"&&Z!==null&&(Z.$$typeof===c||Z.$$typeof===u||Z.$$typeof===n||Z.$$typeof===e||Z.$$typeof===l||Z.$$typeof===h||Z.$$typeof===y||Z.$$typeof===v||Z.$$typeof===g)}function b(Z){if(typeof Z=="object"&&Z!==null){var rt=Z.$$typeof;switch(rt){case d:var X=Z.type;switch(X){case s:case i:case t:case r:case f:case o:return X;default:var Q=X&&X.$$typeof;switch(Q){case e:case l:case c:case u:case n:return Q;default:return rt}}case p:return rt}}}var x=s,w=i,S=e,C=n,k=d,D=l,N=t,O=c,R=u,A=p,$=r,q=f,H=o,M=!1;function W(Z){return M||(M=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),G(Z)||b(Z)===s}function G(Z){return b(Z)===i}function I(Z){return b(Z)===e}function U(Z){return b(Z)===n}function V(Z){return typeof Z=="object"&&Z!==null&&Z.$$typeof===d}function K(Z){return b(Z)===l}function z(Z){return b(Z)===t}function F(Z){return b(Z)===c}function T(Z){return b(Z)===u}function P(Z){return b(Z)===p}function L(Z){return b(Z)===r}function B(Z){return b(Z)===f}function Y(Z){return b(Z)===o}En.AsyncMode=x,En.ConcurrentMode=w,En.ContextConsumer=S,En.ContextProvider=C,En.Element=k,En.ForwardRef=D,En.Fragment=N,En.Lazy=O,En.Memo=R,En.Portal=A,En.Profiler=$,En.StrictMode=q,En.Suspense=H,En.isAsyncMode=W,En.isConcurrentMode=G,En.isContextConsumer=I,En.isContextProvider=U,En.isElement=V,En.isForwardRef=K,En.isFragment=z,En.isLazy=F,En.isMemo=T,En.isPortal=P,En.isProfiler=L,En.isStrictMode=B,En.isSuspense=Y,En.isValidElementType=_,En.typeOf=b}()),En}process.env.NODE_ENV==="production"?Sp.exports=ZE():Sp.exports=XE();var qu=Sp.exports;function QE(m){function d(U,V,K,z,F){for(var T=0,P=0,L=0,B=0,Y,Z,rt=0,X=0,Q,nt=Q=Y=0,et=0,at=0,lt=0,ht=0,wt=K.length,St=wt-1,Rt,Ct="",At="",mt="",Nt="",Pt;et<wt;){if(Z=K.charCodeAt(et),et===St&&P+B+L+T!==0&&(P!==0&&(Z=P===47?10:47),B=L=T=0,wt++,St++),P+B+L+T===0){if(et===St&&(0<at&&(Ct=Ct.replace(a,"")),0<Ct.trim().length)){switch(Z){case 32:case 9:case 59:case 13:case 10:break;default:Ct+=K.charAt(et)}Z=59}switch(Z){case 123:for(Ct=Ct.trim(),Y=Ct.charCodeAt(0),Q=1,ht=++et;et<wt;){switch(Z=K.charCodeAt(et)){case 123:Q++;break;case 125:Q--;break;case 47:switch(Z=K.charCodeAt(et+1)){case 42:case 47:t:{for(nt=et+1;nt<St;++nt)switch(K.charCodeAt(nt)){case 47:if(Z===42&&K.charCodeAt(nt-1)===42&&et+2!==nt){et=nt+1;break t}break;case 10:if(Z===47){et=nt+1;break t}}et=nt}}break;case 91:Z++;case 40:Z++;case 34:case 39:for(;et++<St&&K.charCodeAt(et)!==Z;);}if(Q===0)break;et++}switch(Q=K.substring(ht,et),Y===0&&(Y=(Ct=Ct.replace(o,"").trim()).charCodeAt(0)),Y){case 64:switch(0<at&&(Ct=Ct.replace(a,"")),Z=Ct.charCodeAt(1),Z){case 100:case 109:case 115:case 45:at=V;break;default:at=q}if(Q=d(V,at,Q,Z,F+1),ht=Q.length,0<M&&(at=p(q,Ct,lt),Pt=e(3,Q,at,V,R,O,ht,Z,F,z),Ct=at.join(""),Pt!==void 0&&(ht=(Q=Pt.trim()).length)===0&&(Z=0,Q="")),0<ht)switch(Z){case 115:Ct=Ct.replace(w,n);case 100:case 109:case 45:Q=Ct+"{"+Q+"}";break;case 107:Ct=Ct.replace(v,"$1 $2"),Q=Ct+"{"+Q+"}",Q=$===1||$===2&&r("@"+Q,3)?"@-webkit-"+Q+"@"+Q:"@"+Q;break;default:Q=Ct+Q,z===112&&(Q=(At+=Q,""))}else Q="";break;default:Q=d(V,p(V,Ct,lt),Q,z,F+1)}mt+=Q,Q=lt=at=nt=Y=0,Ct="",Z=K.charCodeAt(++et);break;case 125:case 59:if(Ct=(0<at?Ct.replace(a,""):Ct).trim(),1<(ht=Ct.length))switch(nt===0&&(Y=Ct.charCodeAt(0),Y===45||96<Y&&123>Y)&&(ht=(Ct=Ct.replace(" ",":")).length),0<M&&(Pt=e(1,Ct,V,U,R,O,At.length,z,F,z))!==void 0&&(ht=(Ct=Pt.trim()).length)===0&&(Ct="\0\0"),Y=Ct.charCodeAt(0),Z=Ct.charCodeAt(1),Y){case 0:break;case 64:if(Z===105||Z===99){Nt+=Ct+K.charAt(et);break}default:Ct.charCodeAt(ht-1)!==58&&(At+=f(Ct,Y,Z,Ct.charCodeAt(2)))}lt=at=nt=Y=0,Ct="",Z=K.charCodeAt(++et)}}switch(Z){case 13:case 10:P===47?P=0:1+Y===0&&z!==107&&0<Ct.length&&(at=1,Ct+="\0"),0<M*G&&e(0,Ct,V,U,R,O,At.length,z,F,z),O=1,R++;break;case 59:case 125:if(P+B+L+T===0){O++;break}default:switch(O++,Rt=K.charAt(et),Z){case 9:case 32:if(B+T+P===0)switch(rt){case 44:case 58:case 9:case 32:Rt="";break;default:Z!==32&&(Rt=" ")}break;case 0:Rt="\\0";break;case 12:Rt="\\f";break;case 11:Rt="\\v";break;case 38:B+P+T===0&&(at=lt=1,Rt="\f"+Rt);break;case 108:if(B+P+T+A===0&&0<nt)switch(et-nt){case 2:rt===112&&K.charCodeAt(et-3)===58&&(A=rt);case 8:X===111&&(A=X)}break;case 58:B+P+T===0&&(nt=et);break;case 44:P+L+B+T===0&&(at=1,Rt+="\r");break;case 34:case 39:P===0&&(B=B===Z?0:B===0?Z:B);break;case 91:B+P+L===0&&T++;break;case 93:B+P+L===0&&T--;break;case 41:B+P+T===0&&L--;break;case 40:if(B+P+T===0){if(Y===0)switch(2*rt+3*X){case 533:break;default:Y=1}L++}break;case 64:P+L+B+T+nt+Q===0&&(Q=1);break;case 42:case 47:if(!(0<B+T+L))switch(P){case 0:switch(2*Z+3*K.charCodeAt(et+1)){case 235:P=47;break;case 220:ht=et,P=42}break;case 42:Z===47&&rt===42&&ht+2!==et&&(K.charCodeAt(ht+2)===33&&(At+=K.substring(ht,et+1)),Rt="",P=0)}}P===0&&(Ct+=Rt)}X=rt,rt=Z,et++}if(ht=At.length,0<ht){if(at=V,0<M&&(Pt=e(2,At,at,U,R,O,ht,z,F,z),Pt!==void 0&&(At=Pt).length===0))return Nt+At+mt;if(At=at.join(",")+"{"+At+"}",$*A!==0){switch($!==2||r(At,2)||(A=0),A){case 111:At=At.replace(b,":-moz-$1")+At;break;case 112:At=At.replace(_,"::-webkit-input-$1")+At.replace(_,"::-moz-$1")+At.replace(_,":-ms-input-$1")+At}A=0}}return Nt+At+mt}function p(U,V,K){var z=V.trim().split(h);V=z;var F=z.length,T=U.length;switch(T){case 0:case 1:var P=0;for(U=T===0?"":U[0]+" ";P<F;++P)V[P]=t(U,V[P],K).trim();break;default:var L=P=0;for(V=[];P<F;++P)for(var B=0;B<T;++B)V[L++]=t(U[B]+" ",z[P],K).trim()}return V}function t(U,V,K){var z=V.charCodeAt(0);switch(33>z&&(z=(V=V.trim()).charCodeAt(0)),z){case 38:return V.replace(y,"$1"+U.trim());case 58:return U.trim()+V.replace(y,"$1"+U.trim());default:if(0<1*K&&0<V.indexOf("\f"))return V.replace(y,(U.charCodeAt(0)===58?"":"$1")+U.trim())}return U+V}function f(U,V,K,z){var F=U+";",T=2*V+3*K+4*z;if(T===944){U=F.indexOf(":",9)+1;var P=F.substring(U,F.length-1).trim();return P=F.substring(0,U).trim()+P+";",$===1||$===2&&r(P,1)?"-webkit-"+P+P:P}if($===0||$===2&&!r(F,1))return F;switch(T){case 1015:return F.charCodeAt(10)===97?"-webkit-"+F+F:F;case 951:return F.charCodeAt(3)===116?"-webkit-"+F+F:F;case 963:return F.charCodeAt(5)===110?"-webkit-"+F+F:F;case 1009:if(F.charCodeAt(4)!==100)break;case 969:case 942:return"-webkit-"+F+F;case 978:return"-webkit-"+F+"-moz-"+F+F;case 1019:case 983:return"-webkit-"+F+"-moz-"+F+"-ms-"+F+F;case 883:if(F.charCodeAt(8)===45)return"-webkit-"+F+F;if(0<F.indexOf("image-set(",11))return F.replace(N,"$1-webkit-$2")+F;break;case 932:if(F.charCodeAt(4)===45)switch(F.charCodeAt(5)){case 103:return"-webkit-box-"+F.replace("-grow","")+"-webkit-"+F+"-ms-"+F.replace("grow","positive")+F;case 115:return"-webkit-"+F+"-ms-"+F.replace("shrink","negative")+F;case 98:return"-webkit-"+F+"-ms-"+F.replace("basis","preferred-size")+F}return"-webkit-"+F+"-ms-"+F+F;case 964:return"-webkit-"+F+"-ms-flex-"+F+F;case 1023:if(F.charCodeAt(8)!==99)break;return P=F.substring(F.indexOf(":",15)).replace("flex-","").replace("space-between","justify"),"-webkit-box-pack"+P+"-webkit-"+F+"-ms-flex-pack"+P+F;case 1005:return c.test(F)?F.replace(u,":-webkit-")+F.replace(u,":-moz-")+F:F;case 1e3:switch(P=F.substring(13).trim(),V=P.indexOf("-")+1,P.charCodeAt(0)+P.charCodeAt(V)){case 226:P=F.replace(x,"tb");break;case 232:P=F.replace(x,"tb-rl");break;case 220:P=F.replace(x,"lr");break;default:return F}return"-webkit-"+F+"-ms-"+P+F;case 1017:if(F.indexOf("sticky",9)===-1)break;case 975:switch(V=(F=U).length-10,P=(F.charCodeAt(V)===33?F.substring(0,V):F).substring(U.indexOf(":",7)+1).trim(),T=P.charCodeAt(0)+(P.charCodeAt(7)|0)){case 203:if(111>P.charCodeAt(8))break;case 115:F=F.replace(P,"-webkit-"+P)+";"+F;break;case 207:case 102:F=F.replace(P,"-webkit-"+(102<T?"inline-":"")+"box")+";"+F.replace(P,"-webkit-"+P)+";"+F.replace(P,"-ms-"+P+"box")+";"+F}return F+";";case 938:if(F.charCodeAt(5)===45)switch(F.charCodeAt(6)){case 105:return P=F.replace("-items",""),"-webkit-"+F+"-webkit-box-"+P+"-ms-flex-"+P+F;case 115:return"-webkit-"+F+"-ms-flex-item-"+F.replace(C,"")+F;default:return"-webkit-"+F+"-ms-flex-line-pack"+F.replace("align-content","").replace(C,"")+F}break;case 973:case 989:if(F.charCodeAt(3)!==45||F.charCodeAt(4)===122)break;case 931:case 953:if(D.test(U)===!0)return(P=U.substring(U.indexOf(":")+1)).charCodeAt(0)===115?f(U.replace("stretch","fill-available"),V,K,z).replace(":fill-available",":stretch"):F.replace(P,"-webkit-"+P)+F.replace(P,"-moz-"+P.replace("fill-",""))+F;break;case 962:if(F="-webkit-"+F+(F.charCodeAt(5)===102?"-ms-"+F:"")+F,K+z===211&&F.charCodeAt(13)===105&&0<F.indexOf("transform",10))return F.substring(0,F.indexOf(";",27)+1).replace(g,"$1-webkit-$2")+F}return F}function r(U,V){var K=U.indexOf(V===1?":":"{"),z=U.substring(0,V!==3?K:10);return K=U.substring(K+1,U.length-1),W(V!==2?z:z.replace(k,"$1"),K,V)}function n(U,V){var K=f(V,V.charCodeAt(0),V.charCodeAt(1),V.charCodeAt(2));return K!==V+";"?K.replace(S," or ($1)").substring(4):"("+V+")"}function e(U,V,K,z,F,T,P,L,B,Y){for(var Z=0,rt=V,X;Z<M;++Z)switch(X=H[Z].call(l,U,rt,K,z,F,T,P,L,B,Y)){case void 0:case!1:case!0:case null:break;default:rt=X}if(rt!==V)return rt}function s(U){switch(U){case void 0:case null:M=H.length=0;break;default:if(typeof U=="function")H[M++]=U;else if(typeof U=="object")for(var V=0,K=U.length;V<K;++V)s(U[V]);else G=!!U|0}return s}function i(U){return U=U.prefix,U!==void 0&&(W=null,U?typeof U!="function"?$=1:($=2,W=U):$=0),i}function l(U,V){var K=U;if(33>K.charCodeAt(0)&&(K=K.trim()),I=K,K=[I],0<M){var z=e(-1,V,K,K,R,O,0,0,0,0);z!==void 0&&typeof z=="string"&&(V=z)}var F=d(q,K,V,0,0);return 0<M&&(z=e(-2,F,K,K,R,O,F.length,0,0,0),z!==void 0&&(F=z)),I="",A=0,O=R=1,F}var o=/^\0+/g,a=/[\0\r\f]/g,u=/: */g,c=/zoo|gra/,g=/([,: ])(transform)/g,h=/,\r+?/g,y=/([\t\r\n ])*\f?&/g,v=/@(k\w+)\s*(\S*)\s*/,_=/::(place)/g,b=/:(read-only)/g,x=/[svh]\w+-[tblr]{2}/,w=/\(\s*(.*)\s*\)/g,S=/([\s\S]*?);/g,C=/-self|flex-/g,k=/[^]*?(:[rp][el]a[\w-]+)[^]*/,D=/stretch|:\s*\w+\-(?:conte|avail)/,N=/([^-])(image-set\()/,O=1,R=1,A=0,$=1,q=[],H=[],M=0,W=null,G=0,I="";return l.use=s,l.set=i,m!==void 0&&i(m),l}var tC={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function eC(m){var d=Object.create(null);return function(p){return d[p]===void 0&&(d[p]=m(p)),d[p]}}var nC=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Ky=eC(function(m){return nC.test(m)||m.charCodeAt(0)===111&&m.charCodeAt(1)===110&&m.charCodeAt(2)<91}),Ep=qu,rC={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},oC={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},iC={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Gy={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Cp={};Cp[Ep.ForwardRef]=iC,Cp[Ep.Memo]=Gy;function Yy(m){return Ep.isMemo(m)?Gy:Cp[m.$$typeof]||rC}var aC=Object.defineProperty,sC=Object.getOwnPropertyNames,Zy=Object.getOwnPropertySymbols,lC=Object.getOwnPropertyDescriptor,cC=Object.getPrototypeOf,Xy=Object.prototype;function Qy(m,d,p){if(typeof d!="string"){if(Xy){var t=cC(d);t&&t!==Xy&&Qy(m,t,p)}var f=sC(d);Zy&&(f=f.concat(Zy(d)));for(var r=Yy(m),n=Yy(d),e=0;e<f.length;++e){var s=f[e];if(!oC[s]&&!(p&&p[s])&&!(n&&n[s])&&!(r&&r[s])){var i=lC(d,s);try{aC(m,s,i)}catch{}}}}return m}var uC=Qy;const dC=Qb(uC);function ui(){return(ui=Object.assign||function(m){for(var d=1;d<arguments.length;d++){var p=arguments[d];for(var t in p)Object.prototype.hasOwnProperty.call(p,t)&&(m[t]=p[t])}return m}).apply(this,arguments)}var tv=function(m,d){for(var p=[m[0]],t=0,f=d.length;t<f;t+=1)p.push(d[t],m[t+1]);return p},kp=function(m){return m!==null&&typeof m=="object"&&(m.toString?m.toString():Object.prototype.toString.call(m))==="[object Object]"&&!qu.typeOf(m)},Wu=Object.freeze([]),Ji=Object.freeze({});function Ql(m){return typeof m=="function"}function Op(m){return process.env.NODE_ENV!=="production"&&typeof m=="string"&&m||m.displayName||m.name||"Component"}function Tp(m){return m&&typeof m.styledComponentId=="string"}var Us=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",Ap=typeof window<"u"&&"HTMLElement"in window,fC=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==""?process.env.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&process.env.REACT_APP_SC_DISABLE_SPEEDY:process.env.SC_DISABLE_SPEEDY!==void 0&&process.env.SC_DISABLE_SPEEDY!==""?process.env.SC_DISABLE_SPEEDY!=="false"&&process.env.SC_DISABLE_SPEEDY:process.env.NODE_ENV!=="production")),pC=process.env.NODE_ENV!=="production"?{1:`Cannot create styled-component for component: %s.
1443
+ */var Vy;function XE(){return Vy||(Vy=1,process.env.NODE_ENV!=="production"&&function(){var m=typeof Symbol=="function"&&Symbol.for,d=m?Symbol.for("react.element"):60103,p=m?Symbol.for("react.portal"):60106,t=m?Symbol.for("react.fragment"):60107,f=m?Symbol.for("react.strict_mode"):60108,r=m?Symbol.for("react.profiler"):60114,n=m?Symbol.for("react.provider"):60109,e=m?Symbol.for("react.context"):60110,s=m?Symbol.for("react.async_mode"):60111,i=m?Symbol.for("react.concurrent_mode"):60111,l=m?Symbol.for("react.forward_ref"):60112,o=m?Symbol.for("react.suspense"):60113,a=m?Symbol.for("react.suspense_list"):60120,u=m?Symbol.for("react.memo"):60115,c=m?Symbol.for("react.lazy"):60116,g=m?Symbol.for("react.block"):60121,h=m?Symbol.for("react.fundamental"):60117,y=m?Symbol.for("react.responder"):60118,v=m?Symbol.for("react.scope"):60119;function _(Z){return typeof Z=="string"||typeof Z=="function"||Z===t||Z===i||Z===r||Z===f||Z===o||Z===a||typeof Z=="object"&&Z!==null&&(Z.$$typeof===c||Z.$$typeof===u||Z.$$typeof===n||Z.$$typeof===e||Z.$$typeof===l||Z.$$typeof===h||Z.$$typeof===y||Z.$$typeof===v||Z.$$typeof===g)}function b(Z){if(typeof Z=="object"&&Z!==null){var rt=Z.$$typeof;switch(rt){case d:var X=Z.type;switch(X){case s:case i:case t:case r:case f:case o:return X;default:var Q=X&&X.$$typeof;switch(Q){case e:case l:case c:case u:case n:return Q;default:return rt}}case p:return rt}}}var x=s,w=i,S=e,C=n,k=d,D=l,N=t,O=c,R=u,A=p,$=r,q=f,H=o,M=!1;function W(Z){return M||(M=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),G(Z)||b(Z)===s}function G(Z){return b(Z)===i}function I(Z){return b(Z)===e}function U(Z){return b(Z)===n}function V(Z){return typeof Z=="object"&&Z!==null&&Z.$$typeof===d}function K(Z){return b(Z)===l}function z(Z){return b(Z)===t}function F(Z){return b(Z)===c}function T(Z){return b(Z)===u}function P(Z){return b(Z)===p}function L(Z){return b(Z)===r}function B(Z){return b(Z)===f}function Y(Z){return b(Z)===o}En.AsyncMode=x,En.ConcurrentMode=w,En.ContextConsumer=S,En.ContextProvider=C,En.Element=k,En.ForwardRef=D,En.Fragment=N,En.Lazy=O,En.Memo=R,En.Portal=A,En.Profiler=$,En.StrictMode=q,En.Suspense=H,En.isAsyncMode=W,En.isConcurrentMode=G,En.isContextConsumer=I,En.isContextProvider=U,En.isElement=V,En.isForwardRef=K,En.isFragment=z,En.isLazy=F,En.isMemo=T,En.isPortal=P,En.isProfiler=L,En.isStrictMode=B,En.isSuspense=Y,En.isValidElementType=_,En.typeOf=b}()),En}process.env.NODE_ENV==="production"?Sp.exports=ZE():Sp.exports=XE();var qu=Sp.exports;function QE(m){function d(U,V,K,z,F){for(var T=0,P=0,L=0,B=0,Y,Z,rt=0,X=0,Q,nt=Q=Y=0,et=0,at=0,lt=0,ht=0,wt=K.length,St=wt-1,Rt,Ct="",At="",mt="",Nt="",Pt;et<wt;){if(Z=K.charCodeAt(et),et===St&&P+B+L+T!==0&&(P!==0&&(Z=P===47?10:47),B=L=T=0,wt++,St++),P+B+L+T===0){if(et===St&&(0<at&&(Ct=Ct.replace(a,"")),0<Ct.trim().length)){switch(Z){case 32:case 9:case 59:case 13:case 10:break;default:Ct+=K.charAt(et)}Z=59}switch(Z){case 123:for(Ct=Ct.trim(),Y=Ct.charCodeAt(0),Q=1,ht=++et;et<wt;){switch(Z=K.charCodeAt(et)){case 123:Q++;break;case 125:Q--;break;case 47:switch(Z=K.charCodeAt(et+1)){case 42:case 47:t:{for(nt=et+1;nt<St;++nt)switch(K.charCodeAt(nt)){case 47:if(Z===42&&K.charCodeAt(nt-1)===42&&et+2!==nt){et=nt+1;break t}break;case 10:if(Z===47){et=nt+1;break t}}et=nt}}break;case 91:Z++;case 40:Z++;case 34:case 39:for(;et++<St&&K.charCodeAt(et)!==Z;);}if(Q===0)break;et++}switch(Q=K.substring(ht,et),Y===0&&(Y=(Ct=Ct.replace(o,"").trim()).charCodeAt(0)),Y){case 64:switch(0<at&&(Ct=Ct.replace(a,"")),Z=Ct.charCodeAt(1),Z){case 100:case 109:case 115:case 45:at=V;break;default:at=q}if(Q=d(V,at,Q,Z,F+1),ht=Q.length,0<M&&(at=p(q,Ct,lt),Pt=e(3,Q,at,V,R,O,ht,Z,F,z),Ct=at.join(""),Pt!==void 0&&(ht=(Q=Pt.trim()).length)===0&&(Z=0,Q="")),0<ht)switch(Z){case 115:Ct=Ct.replace(w,n);case 100:case 109:case 45:Q=Ct+"{"+Q+"}";break;case 107:Ct=Ct.replace(v,"$1 $2"),Q=Ct+"{"+Q+"}",Q=$===1||$===2&&r("@"+Q,3)?"@-webkit-"+Q+"@"+Q:"@"+Q;break;default:Q=Ct+Q,z===112&&(Q=(At+=Q,""))}else Q="";break;default:Q=d(V,p(V,Ct,lt),Q,z,F+1)}mt+=Q,Q=lt=at=nt=Y=0,Ct="",Z=K.charCodeAt(++et);break;case 125:case 59:if(Ct=(0<at?Ct.replace(a,""):Ct).trim(),1<(ht=Ct.length))switch(nt===0&&(Y=Ct.charCodeAt(0),Y===45||96<Y&&123>Y)&&(ht=(Ct=Ct.replace(" ",":")).length),0<M&&(Pt=e(1,Ct,V,U,R,O,At.length,z,F,z))!==void 0&&(ht=(Ct=Pt.trim()).length)===0&&(Ct="\0\0"),Y=Ct.charCodeAt(0),Z=Ct.charCodeAt(1),Y){case 0:break;case 64:if(Z===105||Z===99){Nt+=Ct+K.charAt(et);break}default:Ct.charCodeAt(ht-1)!==58&&(At+=f(Ct,Y,Z,Ct.charCodeAt(2)))}lt=at=nt=Y=0,Ct="",Z=K.charCodeAt(++et)}}switch(Z){case 13:case 10:P===47?P=0:1+Y===0&&z!==107&&0<Ct.length&&(at=1,Ct+="\0"),0<M*G&&e(0,Ct,V,U,R,O,At.length,z,F,z),O=1,R++;break;case 59:case 125:if(P+B+L+T===0){O++;break}default:switch(O++,Rt=K.charAt(et),Z){case 9:case 32:if(B+T+P===0)switch(rt){case 44:case 58:case 9:case 32:Rt="";break;default:Z!==32&&(Rt=" ")}break;case 0:Rt="\\0";break;case 12:Rt="\\f";break;case 11:Rt="\\v";break;case 38:B+P+T===0&&(at=lt=1,Rt="\f"+Rt);break;case 108:if(B+P+T+A===0&&0<nt)switch(et-nt){case 2:rt===112&&K.charCodeAt(et-3)===58&&(A=rt);case 8:X===111&&(A=X)}break;case 58:B+P+T===0&&(nt=et);break;case 44:P+L+B+T===0&&(at=1,Rt+="\r");break;case 34:case 39:P===0&&(B=B===Z?0:B===0?Z:B);break;case 91:B+P+L===0&&T++;break;case 93:B+P+L===0&&T--;break;case 41:B+P+T===0&&L--;break;case 40:if(B+P+T===0){if(Y===0)switch(2*rt+3*X){case 533:break;default:Y=1}L++}break;case 64:P+L+B+T+nt+Q===0&&(Q=1);break;case 42:case 47:if(!(0<B+T+L))switch(P){case 0:switch(2*Z+3*K.charCodeAt(et+1)){case 235:P=47;break;case 220:ht=et,P=42}break;case 42:Z===47&&rt===42&&ht+2!==et&&(K.charCodeAt(ht+2)===33&&(At+=K.substring(ht,et+1)),Rt="",P=0)}}P===0&&(Ct+=Rt)}X=rt,rt=Z,et++}if(ht=At.length,0<ht){if(at=V,0<M&&(Pt=e(2,At,at,U,R,O,ht,z,F,z),Pt!==void 0&&(At=Pt).length===0))return Nt+At+mt;if(At=at.join(",")+"{"+At+"}",$*A!==0){switch($!==2||r(At,2)||(A=0),A){case 111:At=At.replace(b,":-moz-$1")+At;break;case 112:At=At.replace(_,"::-webkit-input-$1")+At.replace(_,"::-moz-$1")+At.replace(_,":-ms-input-$1")+At}A=0}}return Nt+At+mt}function p(U,V,K){var z=V.trim().split(h);V=z;var F=z.length,T=U.length;switch(T){case 0:case 1:var P=0;for(U=T===0?"":U[0]+" ";P<F;++P)V[P]=t(U,V[P],K).trim();break;default:var L=P=0;for(V=[];P<F;++P)for(var B=0;B<T;++B)V[L++]=t(U[B]+" ",z[P],K).trim()}return V}function t(U,V,K){var z=V.charCodeAt(0);switch(33>z&&(z=(V=V.trim()).charCodeAt(0)),z){case 38:return V.replace(y,"$1"+U.trim());case 58:return U.trim()+V.replace(y,"$1"+U.trim());default:if(0<1*K&&0<V.indexOf("\f"))return V.replace(y,(U.charCodeAt(0)===58?"":"$1")+U.trim())}return U+V}function f(U,V,K,z){var F=U+";",T=2*V+3*K+4*z;if(T===944){U=F.indexOf(":",9)+1;var P=F.substring(U,F.length-1).trim();return P=F.substring(0,U).trim()+P+";",$===1||$===2&&r(P,1)?"-webkit-"+P+P:P}if($===0||$===2&&!r(F,1))return F;switch(T){case 1015:return F.charCodeAt(10)===97?"-webkit-"+F+F:F;case 951:return F.charCodeAt(3)===116?"-webkit-"+F+F:F;case 963:return F.charCodeAt(5)===110?"-webkit-"+F+F:F;case 1009:if(F.charCodeAt(4)!==100)break;case 969:case 942:return"-webkit-"+F+F;case 978:return"-webkit-"+F+"-moz-"+F+F;case 1019:case 983:return"-webkit-"+F+"-moz-"+F+"-ms-"+F+F;case 883:if(F.charCodeAt(8)===45)return"-webkit-"+F+F;if(0<F.indexOf("image-set(",11))return F.replace(N,"$1-webkit-$2")+F;break;case 932:if(F.charCodeAt(4)===45)switch(F.charCodeAt(5)){case 103:return"-webkit-box-"+F.replace("-grow","")+"-webkit-"+F+"-ms-"+F.replace("grow","positive")+F;case 115:return"-webkit-"+F+"-ms-"+F.replace("shrink","negative")+F;case 98:return"-webkit-"+F+"-ms-"+F.replace("basis","preferred-size")+F}return"-webkit-"+F+"-ms-"+F+F;case 964:return"-webkit-"+F+"-ms-flex-"+F+F;case 1023:if(F.charCodeAt(8)!==99)break;return P=F.substring(F.indexOf(":",15)).replace("flex-","").replace("space-between","justify"),"-webkit-box-pack"+P+"-webkit-"+F+"-ms-flex-pack"+P+F;case 1005:return c.test(F)?F.replace(u,":-webkit-")+F.replace(u,":-moz-")+F:F;case 1e3:switch(P=F.substring(13).trim(),V=P.indexOf("-")+1,P.charCodeAt(0)+P.charCodeAt(V)){case 226:P=F.replace(x,"tb");break;case 232:P=F.replace(x,"tb-rl");break;case 220:P=F.replace(x,"lr");break;default:return F}return"-webkit-"+F+"-ms-"+P+F;case 1017:if(F.indexOf("sticky",9)===-1)break;case 975:switch(V=(F=U).length-10,P=(F.charCodeAt(V)===33?F.substring(0,V):F).substring(U.indexOf(":",7)+1).trim(),T=P.charCodeAt(0)+(P.charCodeAt(7)|0)){case 203:if(111>P.charCodeAt(8))break;case 115:F=F.replace(P,"-webkit-"+P)+";"+F;break;case 207:case 102:F=F.replace(P,"-webkit-"+(102<T?"inline-":"")+"box")+";"+F.replace(P,"-webkit-"+P)+";"+F.replace(P,"-ms-"+P+"box")+";"+F}return F+";";case 938:if(F.charCodeAt(5)===45)switch(F.charCodeAt(6)){case 105:return P=F.replace("-items",""),"-webkit-"+F+"-webkit-box-"+P+"-ms-flex-"+P+F;case 115:return"-webkit-"+F+"-ms-flex-item-"+F.replace(C,"")+F;default:return"-webkit-"+F+"-ms-flex-line-pack"+F.replace("align-content","").replace(C,"")+F}break;case 973:case 989:if(F.charCodeAt(3)!==45||F.charCodeAt(4)===122)break;case 931:case 953:if(D.test(U)===!0)return(P=U.substring(U.indexOf(":")+1)).charCodeAt(0)===115?f(U.replace("stretch","fill-available"),V,K,z).replace(":fill-available",":stretch"):F.replace(P,"-webkit-"+P)+F.replace(P,"-moz-"+P.replace("fill-",""))+F;break;case 962:if(F="-webkit-"+F+(F.charCodeAt(5)===102?"-ms-"+F:"")+F,K+z===211&&F.charCodeAt(13)===105&&0<F.indexOf("transform",10))return F.substring(0,F.indexOf(";",27)+1).replace(g,"$1-webkit-$2")+F}return F}function r(U,V){var K=U.indexOf(V===1?":":"{"),z=U.substring(0,V!==3?K:10);return K=U.substring(K+1,U.length-1),W(V!==2?z:z.replace(k,"$1"),K,V)}function n(U,V){var K=f(V,V.charCodeAt(0),V.charCodeAt(1),V.charCodeAt(2));return K!==V+";"?K.replace(S," or ($1)").substring(4):"("+V+")"}function e(U,V,K,z,F,T,P,L,B,Y){for(var Z=0,rt=V,X;Z<M;++Z)switch(X=H[Z].call(l,U,rt,K,z,F,T,P,L,B,Y)){case void 0:case!1:case!0:case null:break;default:rt=X}if(rt!==V)return rt}function s(U){switch(U){case void 0:case null:M=H.length=0;break;default:if(typeof U=="function")H[M++]=U;else if(typeof U=="object")for(var V=0,K=U.length;V<K;++V)s(U[V]);else G=!!U|0}return s}function i(U){return U=U.prefix,U!==void 0&&(W=null,U?typeof U!="function"?$=1:($=2,W=U):$=0),i}function l(U,V){var K=U;if(33>K.charCodeAt(0)&&(K=K.trim()),I=K,K=[I],0<M){var z=e(-1,V,K,K,R,O,0,0,0,0);z!==void 0&&typeof z=="string"&&(V=z)}var F=d(q,K,V,0,0);return 0<M&&(z=e(-2,F,K,K,R,O,F.length,0,0,0),z!==void 0&&(F=z)),I="",A=0,O=R=1,F}var o=/^\0+/g,a=/[\0\r\f]/g,u=/: */g,c=/zoo|gra/,g=/([,: ])(transform)/g,h=/,\r+?/g,y=/([\t\r\n ])*\f?&/g,v=/@(k\w+)\s*(\S*)\s*/,_=/::(place)/g,b=/:(read-only)/g,x=/[svh]\w+-[tblr]{2}/,w=/\(\s*(.*)\s*\)/g,S=/([\s\S]*?);/g,C=/-self|flex-/g,k=/[^]*?(:[rp][el]a[\w-]+)[^]*/,D=/stretch|:\s*\w+\-(?:conte|avail)/,N=/([^-])(image-set\()/,O=1,R=1,A=0,$=1,q=[],H=[],M=0,W=null,G=0,I="";return l.use=s,l.set=i,m!==void 0&&i(m),l}var tC={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function eC(m){var d=Object.create(null);return function(p){return d[p]===void 0&&(d[p]=m(p)),d[p]}}var nC=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Ky=eC(function(m){return nC.test(m)||m.charCodeAt(0)===111&&m.charCodeAt(1)===110&&m.charCodeAt(2)<91}),Ep=qu,rC={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},oC={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},iC={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Gy={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Cp={};Cp[Ep.ForwardRef]=iC,Cp[Ep.Memo]=Gy;function Yy(m){return Ep.isMemo(m)?Gy:Cp[m.$$typeof]||rC}var aC=Object.defineProperty,sC=Object.getOwnPropertyNames,Zy=Object.getOwnPropertySymbols,lC=Object.getOwnPropertyDescriptor,cC=Object.getPrototypeOf,Xy=Object.prototype;function Qy(m,d,p){if(typeof d!="string"){if(Xy){var t=cC(d);t&&t!==Xy&&Qy(m,t,p)}var f=sC(d);Zy&&(f=f.concat(Zy(d)));for(var r=Yy(m),n=Yy(d),e=0;e<f.length;++e){var s=f[e];if(!oC[s]&&!(p&&p[s])&&!(n&&n[s])&&!(r&&r[s])){var i=lC(d,s);try{aC(m,s,i)}catch{}}}}return m}var uC=Qy;const dC=Qb(uC);function ui(){return(ui=Object.assign||function(m){for(var d=1;d<arguments.length;d++){var p=arguments[d];for(var t in p)Object.prototype.hasOwnProperty.call(p,t)&&(m[t]=p[t])}return m}).apply(this,arguments)}var tv=function(m,d){for(var p=[m[0]],t=0,f=d.length;t<f;t+=1)p.push(d[t],m[t+1]);return p},kp=function(m){return m!==null&&typeof m=="object"&&(m.toString?m.toString():Object.prototype.toString.call(m))==="[object Object]"&&!qu.typeOf(m)},Wu=Object.freeze([]),Ji=Object.freeze({});function Ql(m){return typeof m=="function"}function Op(m){return process.env.NODE_ENV!=="production"&&typeof m=="string"&&m||m.displayName||m.name||"Component"}function Tp(m){return m&&typeof m.styledComponentId=="string"}var Us=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",Ap=typeof window<"u"&&"HTMLElement"in window,fC=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==""?process.env.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&process.env.REACT_APP_SC_DISABLE_SPEEDY:process.env.SC_DISABLE_SPEEDY!==void 0&&process.env.SC_DISABLE_SPEEDY!==""?process.env.SC_DISABLE_SPEEDY!=="false"&&process.env.SC_DISABLE_SPEEDY:process.env.NODE_ENV!=="production")),pC=process.env.NODE_ENV!=="production"?{1:`Cannot create styled-component for component: %s.
1444
1444
 
1445
1445
  `,2:`Can't collect styles once you've consumed a \`ServerStyleSheet\`'s styles! \`ServerStyleSheet\` is a one off instance for each server-side render cycle.
1446
1446