sykpcomposer 0.0.80 → 0.0.81
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/assets/icons/3-columns.svg +3 -3
- package/dist/assets/icons/LICENSE.md +5 -5
- package/dist/assets/icons/add-sign.svg +3 -3
- package/dist/assets/icons/file-earmark-text.svg +3 -3
- package/dist/assets/icons/minus-sign.svg +3 -3
- package/dist/assets/icons/scissors.svg +2 -2
- package/dist/index.es.js +3 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/src/vite-env.d.ts +1 -1
- package/dist/style.css +1 -1
- package/package.json +52 -52
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?rr.tooltipAnimations.hideAtOnce:rr.tooltipAnimations.hideWithDelay};
|
|
1427
1427
|
left: ${n?"0px":"100%"};
|
|
1428
1428
|
z-index: 10;
|
|
1429
|
-
`,A.append(H),_=H}!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(c){let p=!1,t=c.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,d]=l;if(s.has(d))continue;let u=rr.isMousePositionWithinElementCords(c,o);c.type===Sr.mouseover&&u&&(a.style.animation=this.isEditingInProgress?rr.tooltipAnimations.hideAtOnce:rr.tooltipAnimations.showAtOnce,s.add(d)),c.type===Sr.mouseout&&(a.style.animation=rr.tooltipAnimations.hideWithDelay,s.add(d)),c.type===Sr.mousemove&&u&&(a.style.animation=this.isEditingInProgress?rr.tooltipAnimations.hideAtOnce:rr.tooltipAnimations.showAtOnce,s.add(d))}}_keyboardEventsListener(c){c.type===Sr.keypress&&(this.isEditingInProgress||(this.isEditingInProgress=!0)),c.type===Sr.keyup&&this.isEditingInProgress&&(this.isEditingInProgress=!1)}_resizeEventListener(c){Se.mainEditorExists()&&this.paintRemoteSelections(this.remoteSelections)}mount(){window.addEventListener(Sr.keypress,this.keyboardBindedListener),window.addEventListener(Sr.keyup,this.keyboardBindedListener),window.addEventListener(Sr.resize,this.resizeBindedListener),window.addEventListener(Sr.scroll,this.resizeBindedListener);for(const c of H0)window.addEventListener(c,this.mouseBindedListener)}unmount(){window.removeEventListener(Sr.keypress,this.keyboardBindedListener),window.removeEventListener(Sr.keyup,this.keyboardBindedListener),window.removeEventListener(Sr.resize,this.resizeBindedListener),window.removeEventListener(Sr.scroll,this.resizeBindedListener);for(const c of H0)window.removeEventListener(c,this.mouseBindedListener);this.gcPrevPaintedRemoteSelections()}shouldUpdateRemoteSelections(){return!0}gcPrevPaintedRemoteSelections(){let c=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=c||[],this.remoteSelectionDOMsMap={},this.activeEditorsKeys={}}paintRemoteSelections(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];this.gcPrevPaintedRemoteSelections(c);let p=Se.getMainEditorState();p.read&&p.read(()=>{for(let t of this.remoteSelections)if(fp.validateJSONSelection(t,lp.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){ce.warn("[PAINT REMOTE SELECTION] failed for nested editor - ",{error:e,nestedSelectionJSON:f,fullSelection:t,lexicalSelection:n})}else ce.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){ce.error("DEBUGGER: [paintRemoteSelections] selection from json to lexical is null: ",{selection:t,lexicalSelection:f});continue}try{this.paintSingleRemoteSelection({editor:Se.getMainEditor(),selectionJSON:t,lexicalSelection:f,selectedNodes:f.getNodes(),isBackward:f.isBackward()})}catch(r){ce.warn("[PAINT REMOTE SELECTION] failed - ",{error:r,fullSelection:t,lexicalSelection:f})}}})}updateRemoteSelections(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";this.shouldUpdateRemoteSelections(c)&&(ce.log("[updateRemoteSelections] "+p,{newRemoteSelections:c}),Promise.resolve().then(()=>{this.paintRemoteSelections(c),this.hideInUI&&this.hideRemoteSelectionsFromUI()}))}clear(){this.gcPrevPaintedRemoteSelections()}getCurrentRemoteSelections(){return this.remoteSelections}hideRemoteSelectionsFromUI(){this.hideInUI||(this.hideInUI=!0);const c=document.querySelectorAll(".codox_remote_selection");for(let p of c)p.classList.add("hidden_codox_remote_selection")}showHiddenRemoteSelectionsInUI(){this.hideInUI=!1;const c=document.querySelectorAll(".hidden_codox_remote_selection");for(let p of c)p.classList.remove("hidden_codox_remote_selection")}}const So=new vS;function bS(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).findIndex(m=>m===ka.editorState)}function Ru(m){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,p=Se.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)Ru(r,f);return c&&c.getChildrenSize&&c.splice(c.getChildrenSize(),0,[f]),f}function Mu(m){if(m.getChildren)for(let c of m.getChildren())Mu(c);m.remove()}function sy(m){m.__parent=null,m.__next=null,m.__prev=null}function ly(m,c){return!!Se.isLexicalEditorInstance(m)&&!(typeof c!="object"||!c.editorState||(m.update(()=>{try{let p=(0,be.$getSelection)();const t=m.parseEditorState(c.editorState);if(t.isEmpty())return(0,be.$getRoot)().clear(),!0;(0,be.$setSelection)(p),m.setEditorState(t)}catch(p){ce.error("[stateUpdates][updateNestedEditorState] update nested state and selection error: ",p)}}),0))}function _S(m,c){let p=c;for(const t of m)p=p[t];return p}function Ta(m){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,p=arguments.length>2&&arguments[2]!==void 0&&arguments[2],t=null,f=_S(m,p?c:Se.getMainEditorState().toJSON());return f&&(t=Aa(f)?(0,be.$getRoot)():Nn.get(f.codoxId)),t||ce.debug("[WARNING][getLexicalNodeByPathOutOfJSONState] lexical node not found: ",{jsonNode:f,lexicalNode:t,pathArray:m,currentStateJSON:Se.getMainEditorState().toJSON(),newStateJSON:c,codoxNodes:Nn.nodesToArray(),searchInNewState:p}),t||(p?t:Ta(m,c,!0))}function cy(m){ce.log("[applyFullLexicalStateReplace] clear current state and apply new");const c=(0,be.$getRoot)();c.clear();let p=Se.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)c.append(t(f))}function xS(m){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(c.length){ce.log("[applyDeltasToLexicalState] Original Deltas: ",{newStateJSON:m,deltas:JSON.parse(JSON.stringify(c))});for(const p of c){let{p:t}=p;const f=t[t.length-1],r=f==="children",n=typeof f=="number",e=!n&&!r,s=bS(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 d=t.slice(0,s),u=m;for(const h of d)u=u[h];let g=Vl(t[o]);ly(a.getWritable()[g],u)}}else{if(r){let o=p.oi;if(!o){ce.warn("[applyDeltasToLexicalState][====WARNING====] SKIPPED. Delta oi attr expected for path",{delta:p});continue}if(o.some(d=>!(!d.hasOwnProperty("text")||typeof d.text=="string"))){ce.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(d=>!!d.codoxDId)){try{a=a.getWritable()}catch(h){ce.debug("[applyDeltasToLexicalState][shouldUpdateLeaves] getWritable error: ",{err:h,delta:p,fullStateJSON:m});continue}let d={};for(let h of a.getChildren())h.codoxDId?d[h.codoxDId]=h:Mu(h);let u=[],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?u[h-1]:null;if(y.codoxDId){let w=d[y.codoxDId];if(w){w=w.getWritable();let S=Ru(y);if(ce.debug("[DELTA_DECORATOR_UPDATE]: ",{exisingDecorator:w,tmpDecorator:S}),!S){ce.debug("[DELTA_DECORATOR_UPDATE] UPADATE SKIPPED: ",{exisingDecorator:w,tmpDecorator:S});continue}for(let C in S)if(S.hasOwnProperty(C)&&!g.includes(C))if(Se.isLexicalEditorInstance(S[C])){let k={editorState:S[C].getEditorState().toJSON()};ly(w[C],k)}else{let k=sp(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(),sy(w),b=w,delete d[y.codoxDId]}}b||(b=Ru(y),b.codoxDId&&b.__type==="excalidraw"&&b.__data==="[]"&&(b.__data="{}")),b=b.getWritable(),u.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=u.length}for(let h in d){let y=d[h];y=y.getWritable(),sy(y),Mu(y),delete d[h]}}else{let d=o.map(u=>Ru(u));a.splice(0,a.getChildrenSize(),d)}}if(n){if(p.ld){const o=p.ld,a=Nn.get(o.codoxId);a.getChildrenSize&&a.getChildrenSize()?Mu(a):a.remove()}if(p.li){let o=Se.getMainEditorNodesClassesMap();const a=p.li,d=o.get(a.type).klass.importJSON(a);if(t.length===1&&t[0]==="root")(0,be.$getRoot)().splice(0,0,[d]);else{const u=t[t.length-1];t.length=t.length-2;let g=Ta(t,m);g&&g.splice(u,0,[d])}if(a.children&&a.children.length){let u=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)u(v,y)};for(const g of a.children)u(g,d)}}if(p.oi||p.od){let{p:o,oi:a,od:d}=p,u=Ta(o,m);if(u)try{let g=u.getWritable();if(a){let h=Object.keys(a);for(let y of h)g[Vl(y)]=a[y]}if(d){let h=Object.keys(d);for(let y of h)delete g[Vl(y)]}}catch(g){ce.debug("[applyDeltasToLexicalState][delta oi/od] getWritable error: ",{err:g,delta:p})}}if(l){let{p:o,lm:a}=p,d=o[o.length-1],u=a,g=u<d,h=Ta(o,m);if(h){let y=h.getParent().getChildren(),v=y[d],_=y[u];g?_.insertBefore(v):_.insertAfter(v)}}}if(e){const o=t[t.length-1];let a=Vl(o);t.length=t.length-1;let d,u=Ta(t,m);if(!u){ce.error("Missing node when update node attr from delta: ",{path:t,delta:p,fullStateJSON:m,currentEditorState:Se.getMainEditorState().toJSON()});continue}try{d=u.getWritable()}catch(h){ce.debug("[applyDeltasToLexicalState][shouldUpdateBlockAttr] getWritable error: ",{err:h,delta:p})}if(!d)continue;let g=p.oi;if(o==="format"&&(g=_w(g)),o==="direction"&&(u.hasOwnProperty(a)||(a="__dir")),!d.hasOwnProperty(a)){let h=Object.keys(d);for(let y of h){let v=sp(y);if(o.startsWith(v)){a=y;break}}}d[a]=g}}else if(p.oi&&p.oi.root)return cy(p.oi)}}else ce.log("[applyDeltasToLexicalState] stop, no deltas: ",c)}function wS(m){let c=m.clipboardData.getData(ww.paste),p=!1;try{c=JSON.parse(c),typeof c=="object"&&c.nodes&&Array.isArray(c.nodes)&&(p=!0)}catch{return!1}if(!p)return!1;if(p){Nn.clearPastedIds();const t=f=>{if(f.codoxId&&Nn.addPastedId(f.codoxId),f.children&&f.children.length)for(const r of f.children)t(r)};for(const f of c.nodes)t(f)}return!1}var SS=m=>{var c={};return on.d(c,m),c};const uy=SS({useCollaborationContext:()=>Mx});var ES=m=>{var c={};return on.d(c,m),c};const Wi=ES({LexicalComposerContext:()=>Jf,useLexicalComposerContext:()=>wr});class dy{constructor(){this.blacklist=Object.keys(q0).reduce((c,p)=>{let t=q0[p];return c[p]=t.reduce((f,r)=>(f[r]=r,f),{}),c},{}),this._isBlacklistedFound=!1,this._clientCallback=null}_shouldSkipNode(c){return c instanceof be.TextNode||c instanceof be.ParagraphNode||c instanceof be.RootNode}setClientCallback(c){this._clientCallback=c}removeClientCallback(){this._clientCallback=null}invokeClientCallback(){this._clientCallback&&this._clientCallback()}trackBlacklisted(c){let p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>2?arguments[2]:void 0;if(pp||p!==Kr.created||this._isBlacklistedFound||!c||!c.__type||this._shouldSkipNode(c))return;let f=t||Se.getMainEditorState(),r=c.__type,n=this.blacklist[r];n&&f.read(()=>{let e=c.getParent();for(;e!==null;){let s=e?e.__type:null;if(!s)return;if(n[s])return ce.warn("[ContentNestingsWatcher][trackBlacklisted] FOUND: ",{targetNode:c,targetType:r,parent:e,parentType:s,mutationType:p}),void(this._isBlacklistedFound=!0);e=e.getParent()}})}trackBlacklistedInNestedEditor(c){let p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>3?arguments[3]:void 0;if(p!==Kr.created||this._isBlacklistedFound||this._shouldSkipNode(c))return;let f=t.__type,r=c.__type;if(!f||!r)return;let n=this.blacklist[r];n&&n[f]&&(this._isBlacklistedFound=!0,ce.warn("[ContentNestingsWatcher][trackBlacklistedInNestedEditor] FOUND: ",{targetNode:c,targetType:r,rootNode:t,rootType:f,mutationType:p}))}isBlacklistedFound(){let c=this._isBlacklistedFound;return c&&(this._isBlacklistedFound=!1),c}}const CS=new dy,Ji=CS,kS=["editorState","prevEditorState","dirtyElements","dirtyLeaves"];function OS(m,c){if(m==null)return{};var p,t,f=TS(m,c);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);for(t=0;t<r.length;t++)p=r[t],c.indexOf(p)>=0||{}.propertyIsEnumerable.call(m,p)&&(f[p]=m[p])}return f}function TS(m,c){if(m==null)return{};var p={};for(var t in m)if({}.hasOwnProperty.call(m,t)){if(c.indexOf(t)>=0)continue;p[t]=m[t]}return p}class AS{constructor(){this.nestedEditorsListenersMap={}}_createNestedEditorUpdatesListener(c,p){let t=!1;return function(f){let{editorState:r,prevEditorState:n,dirtyElements:e,dirtyLeaves:s}=f,i=(OS(f,kS),Se.getMainEditor()),l=Se.getMainEditorState(),o=r.toJSON(),a=n.toJSON(),d=dp(o,a),u=r._selection,g=n._selection,h=!1,y=null,v=Se.isOnlySelectionChanged(e,s),_=c[p];if(ce.debug("[NESTED EDITOR LISTENER] invoked: ",{lexicalNode:c,key:c.__key,onlySelectionChanged:v,newEditorStateJSON:o,prevEditorStateJSON:a,isSameState:d,lexicalSelection:u,prevLexicalSelection:g,mainDirtyLeaves:i._dirtyLeaves.size,mainDirtyElements:i._dirtyElements.size,nestedDirtyLeaves:_._dirtyLeaves.size,nestedDirtyElements:_._dirtyElements.size,nestedEditorKey:_._key}),Ji.isBlacklistedFound())return t=!0,ce.debug("[NESTED EDITOR LISTENER] BLACKLISTED FOUND - revert to prev state"),Se.scanLexicalNodeForNestedEditorAttribute(c)?(_.update(()=>{try{const b=_.parseEditorState(a);if(b.isEmpty())return(0,be.$getRoot)().clear(),!0;_.setEditorState(b)}catch(b){ce.error("[NESTED EDITOR LISTENER] BLACKLISTED FOUND - ROLLBACK ERROR: ",b)}}),void Ji.invokeClientCallback()):void 0;if(t)t=!1;else{if(c.codoxId||c.codoxDId){let b=null;l.read(()=>{b=$e.getNodeAncestorsCodoxIds(c),!c.codoxId&&c.codoxDId&&b.push(c.codoxDId)}),r.read(()=>{let x=sp(p),w=$e.lexicalToJSONNested(u,x,b);y=Se.getCurrentNestedSelectionJSON(),h=$e.equalSelectionsJSON(y,w),h||Se.setNestedSelectionJSON(w)})}d&&h||i.update(()=>{try{ce.debug("[NESTED EDITOR LISTENER] MARKING DIRTY TO TRIGGER UPDATE",{mainTags:i._updateTags,nestedTags:_&&_._updateTags,isSameState:d,isSameSelection:h,onlyNestedSelectionChanged:v,mainDirtyLeaves:i._dirtyLeaves.size,mainDirtyElements:i._dirtyElements.size,nestedDirtyLeaves:_._dirtyLeaves.size,nestedDirtyElements:_._dirtyElements.size,lexicalNode:c,lexicalSelection:u,prevLexicalSelection:g,mainEditorTags:i._updateTags,mainEditorTagsSize:i._updateTags.size}),Se.addUpdateTag({fromNestedEditor:!0}),c.markDirty()}catch(b){ce.error("[NESTED EDITOR LISTENER] MARKING DIRTY TO TRIGGER UPDATE - ERROR: ",b)}})}}}_isNestedEditorManaged(c){return!!this.nestedEditorsListenersMap[c]}gc(){for(let c in this.nestedEditorsListenersMap)if(!Se.getLexicalNodeByKey(c)){let p=this.nestedEditorsListenersMap[c];p&&p(),delete this.nestedEditorsListenersMap[c]}}manageNestedEditorInLexicalNode(c){if(this._isNestedEditorManaged(c.getKey()))return;let p=Se.scanLexicalNodeForNestedEditorAttribute(c);if(p){let t=c[p],f=this._createNestedEditorUpdatesListener(c,p),r=[];t._nodes.forEach((s,i,l)=>{let{klass:o}=s,a=t.registerMutationListener(o,d=>{for(let[u,g]of d)if(g===Kr.created){let h=t.getEditorState()._nodeMap.get(u);h&&Ji.trackBlacklistedInNestedEditor(h,g,t.getEditorState(),c)}});r.push(a)});let n=(0,ks.mergeRegister)(t.registerUpdateListener(f),...r),e=c.getKey();this.nestedEditorsListenersMap[e]=n}}gcNestedEditorListenerInLexicalNode(c){let p=c.getKey(),t=this.nestedEditorsListenersMap[p];t&&(t(),delete this.nestedEditorsListenersMap[p])}manageNestedEditorInClonedLexicalNode(c,p){let t=c.getKey();t!==p.getKey()&&this._isNestedEditorManaged(t)&&(this.gcNestedEditorListenerInLexicalNode(c),this.manageNestedEditorInLexicalNode(p))}setNestedEditorSelection(c){let{nestedSelectionJSON:p,nestedEditor:t}=$e.getNestedSelectionJSONFromMainSelectionJSON(c);if(!t)return!1;let f=!0;return t.update(()=>{try{let r=$e.JSONToLexical(p);(0,be.$setSelection)(r),ce.debug("[setNestedEditorSelection]: lexical nested selection: ",r)}catch(r){ce.error("[setNestedEditorSelection] set nested selection error: ",r),f=!1}}),f}clearListeners(){for(let c in this.nestedEditorsListenersMap){let p=this.nestedEditorsListenersMap[c];p&&p(),delete this.nestedEditorsListenersMap[c]}}}const PS=new AS,ui=PS,jS=function(m){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];try{let p=(0,be.createEditor)({namespace:"validation",nodes:[...c],onError:e=>{throw e},parentEditor:null});const t=new dy,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,Kr.created,r),t.isBlacklistedFound()))throw new Error(Sw)}}catch(p){throw p}};class NS{constructor(){this.removeCandidateTableKeys=new Set,this.validateTableCandidateKeys=new Set,this.tableFixActions=[]}_scanForCellHeaderState(c,p,t,f){if(p.length<f)return null;let r,n=p.some(s=>s.__headerState===Hi.BOTH||s.__headerState===Hi.ROW),e=c.some((s,i)=>{if(s.__size<f)return!1;let l=s.getChildAtIndex(t);return!(!l||l.__headerState!==Hi.BOTH&&l.__headerState!==Hi.COLUMN)});return n&&e?r=Hi.BOTH:n&&!e?r=Hi.ROW:e&&!n&&(r=Hi.COLUMN),r}_isValidCellChildren(c){for(let p of c)if(Ns(p)||!js(p)&&Tn(p))return!1;return!0}_createEmptyCell(){let c=(0,An.$createTableCellNode)();return c.append((0,be.$createParagraphNode)()),c}_wrapInvalidCellChildrenIntoParagraph(c){let p=(0,be.$createParagraphNode)().getWritable(),t=c.getChildren();(c=c.getWritable()).__first=p.__key,c.__last=p.__key,c.__size=1,p.__parent=c.__key,t.forEach((f,r)=>{(f=f.getWritable()).__parent=null,p.append(f)})}_createFixAction_APPEND_CELLS_TO_ROW(c,p){return()=>{ce.debug("[TablesValidator][FIX TABLE ACTION - APPEND_CELLS_TO_ROW] invoked: ",{rowKey:c,numOfCellsToAppend:p});let t=(0,be.$getNodeByKey)(c);for(;p;){let f=(0,An.$createTableCellNode)().append((0,be.$createParagraphNode)());f.setRowSpan(1).setColSpan(1),t.append(f),p--}}}_createFixAction_ADD_PARAGRAPH_TO_EMPTY_CELL(c){return()=>{ce.debug("[TablesValidator][FIX TABLE ACTION - ADD_PARAGRAPH_TO_EMPTY_CELL] invoked: ",{cellKey:c}),(0,be.$getNodeByKey)(c).append((0,be.$createParagraphNode)())}}_createFixAction_WRAP_CELL_CHILDREN_IN_PARAGRAPH(c){return()=>{ce.debug("[TablesValidator][FIX TABLE ACTION - WRAP_CELL_CHILDREN_IN_PARAGRAPH] invoked: ",{cellKey:c});let p=(0,be.$getNodeByKey)(c);this._wrapInvalidCellChildrenIntoParagraph(p)}}_createFixAction_ADD_ROW_CELL_TO_TABLE_NODE(c){return()=>{ce.debug("[TablesValidator][FIX TABLE ACTION - ADD_ROW_CELL_TO_EMPTY_TABLE_NODE] invoked: ",{tableKey:c});let p=(0,be.$getNodeByKey)(c),t=(0,An.$createTableRowNode)();t.append(this._createEmptyCell()),p.append(t)}}_createFixAction_ADD_CELL_TO_EMPTY_ROW_NODE(c,p){return()=>{for(p||(p=1);p;)(0,be.$getNodeByKey)(c).append(this._createEmptyCell()),p--}}_createFixAction_WRAP_INVALID_ROW_NODE(c,p){return()=>{ce.debug("[TablesValidator][FIX TABLE ACTION - WRAP_INVALID_ROW_NODE] invoked: ",{tableKey:c,rowKey:p});let t=(0,be.$getNodeByKey)(c);if(!t)return;let f=(0,be.$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,An.$createTableRowNode)();if((0,An.$isTableCellNode)(f))f.getChildren().length?this._isValidCellChildren()||this._wrapInvalidCellChildrenIntoParagraph(f):f.append((0,be.$createParagraphNode)()),e.append(f);else{let s=this._isValidCellChildren([f]),i=(0,An.$createTableCellNode)();if(e.append(i),s)i.append(f);else{let l=(0,be.$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(c,p){return()=>{ce.debug("[TablesValidator][FIX TABLE ACTION - WRAP_INVALID_CELL_NODE] invoked: ",{rowKey:c,cellKey:p});let t=(0,be.$getNodeByKey)(c);if(!t)return;let f=(0,be.$getNodeByKey)(p);if(f.remove(),f=(0,be.$createParagraphNode)(),!f)return;t=t.getWritable(),f=f.getWritable();let r=f.getPreviousSibling(),n=f.getNextSibling(),e=(0,An.$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,be.$createParagraphNode)();s.append(f),e.append(s)}}}_createFixAction_APPLY_HEADER_STATE_TO_CELL(c,p){return()=>{ce.debug("[TablesValidator][FIX TABLE ACTION - APPLY_HEADER_STATE_TO_CELL] invoked: ",{cellKey:c,headerStateToApply:p});let t=(0,be.$getNodeByKey)(c);t&&(t=t.getWritable(),t.__headerState=p)}}clear(){this.removeCandidateTableKeys=new Set,this.validateTableCandidateKeys=new Set,this.tableFixActions=[]}tableRemoveEventListener(c){let p=Se.getMainEditorState()._selection;if(ce.debug(`[${c}]`,{selection:p}),!(0,be.$isRangeSelection)(p))return;let t=[];try{let f=Se.getLexicalNodeByKey(p.anchor.key),r=Se.getLexicalNodeByKey(p.focus.key);f&&r&&(t=p.isBackward()?r.getNodesBetween(f):f.getNodesBetween(r))}catch(f){ce.warn("[TablesValidator][tableRemoveEventListener] get range selection nodes internal lexical error: ",f)}t.forEach(f=>{(0,An.$isTableNode)(f)&&this.removeCandidateTableKeys.add(f.__key)})}tableNodeRemoveListener(c){this.removeCandidateTableKeys.has(c)&&this.removeCandidateTableKeys.delete(c)}shouldGCRemovedTables(){return!!this.removeCandidateTableKeys.size}gcRemovedTables(){ce.debug("[TablesValidator][gcRemovedTable] candidate table keys ",{tableKeys:this.removeCandidateTableKeys}),Se.getMainEditor().update(()=>{Array.from(this.removeCandidateTableKeys).forEach(c=>{let p=(0,be.$getNodeByKey)(c);p&&p.remove()}),this.removeCandidateTableKeys.clear(),(0,be.$addUpdateTag)(io.historic)})}tableUpdateListener(c){this.validateTableCandidateKeys.add(c)}tableRowNodeChangesListener(c){let p=arguments.length>1&&arguments[1]!==void 0&&arguments[1],t=Se.getLexicalNodeByKey(c);if(!t)return void(p&&ce.debug("[TablesValidator][tableRowNodeChangesListener] no row node found in lexical: ",{tableRowNodeKey:c}));let f=t.__parent;f?this.validateTableCandidateKeys.add(f):ce.debug("[tableRowNodeChangesListener] no parent table for row node found in lexical: ",{rowNode:t})}tableCellNodeChangesListener(c){let p=Se.getLexicalNodeByKey(c);if(!p||!p.__parent)return;let t=Se.getLexicalNodeByKey(p.__parent);t&&t.__parent&&this.validateTableCandidateKeys.add(t.__parent)}shouldValidateUpdatedTables(){return!!this.validateTableCandidateKeys.size}validateUpdatedTables(){let c=Array.from(this.validateTableCandidateKeys);return Se.getMainEditorState().read(()=>{for(let p of c){let t=Se.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,An.$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 u=[];n.forEach(g=>{let[h,y]=g;a+=y,h--,h&&u.push([h,y])}),n=[...u]}let d=o.map((u,g)=>{if(!(0,An.$isTableCellNode)(u))return this.tableFixActions.push(this._createFixAction_WRAP_INVALID_CELL_NODE(i.__key,u.__key)),a++,"invalid_cell_node_should_wrap_in_cell";let h,y=u.getChildren(),v=!y.length;if(v?this.tableFixActions.push(this._createFixAction_ADD_PARAGRAPH_TO_EMPTY_CELL(u.__key)):(h=this._isValidCellChildren(y),h||this.tableFixActions.push(this._createFixAction_WRAP_CELL_CHILDREN_IN_PARAGRAPH(u.__key))),u.__rowSpan>1){let _=u.__rowSpan,b=u.__colSpan;n.push([_-1,b])}if(a+=u.__colSpan,u.__headerState===Hi.NO_STATUS){let _=this._scanForCellHeaderState(f,o,g,r);_&&this.tableFixActions.push(this._createFixAction_APPLY_HEADER_STATE_TO_CELL(u.__key,_))}return{cellKey:u.__key,rowKey:i.__key,tableKey:p,colSpan:u.__colSpan,rowSpan:u.__rowSpan,headerState:u.__headerState,childrenAreValid:h,isEmptyCell:v}});if(a<r){let u=r-a;this.tableFixActions.push(this._createFixAction_APPEND_CELLS_TO_ROW(i.__key,u))}return{realRowLength:a,rowKey:i.__key,tableKey:p,cells:d}}),s=!this.tableFixActions.length;ce[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 c=Se.getMainEditor();ce.log("[TablesValidator][fixTablesStructure]: fix actions to apply - count: ",this.tableFixActions.length),c.update(()=>{for(let p of this.tableFixActions)p();this.tableFixActions=[],(0,be.$addUpdateTag)(io.historic)})}ensureDocTablesAreValid(c){return this.shouldGCRemovedTables()?(ce.warn("[TablesValidator][GARBAGE COLLECT TABLE NODES AFTER TABLE REMOVAL ATTEMPT]"),this.gcRemovedTables(),!1):!(this.shouldValidateUpdatedTables()&&(ce.debug("[TablesValidator][shouldValidateUpdatedTables] invoked"),!this.validateUpdatedTables()))||(ce.warn("[TablesValidator][shouldValidateUpdatedTables] INVALID LEXICAL TABLE(S) STRUCTURE FOUND - FIXING",{state:JSON.parse(JSON.stringify(c.toJSON()))}),this.fixTablesStructure(),!1)}}const Ro=new NS,IS=["contentChanged"],RS=["state","remoteSelection"];function fy(m,c){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(m);c&&(t=t.filter(function(f){return Object.getOwnPropertyDescriptor(m,f).enumerable})),p.push.apply(p,t)}return p}function As(m){for(var c=1;c<arguments.length;c++){var p=arguments[c]!=null?arguments[c]:{};c%2?fy(Object(p),!0).forEach(function(t){MS(m,t,p[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):fy(Object(p)).forEach(function(t){Object.defineProperty(m,t,Object.getOwnPropertyDescriptor(p,t))})}return m}function MS(m,c,p){return(c=DS(c))in m?Object.defineProperty(m,c,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[c]=p,m}function DS(m){var c=LS(m,"string");return typeof c=="symbol"?c:c+""}function LS(m,c){if(typeof m!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var t=p.call(m,c||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(m)}function py(m,c){if(m==null)return{};var p,t,f=BS(m,c);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);for(t=0;t<r.length;t++)p=r[t],c.indexOf(p)>=0||{}.propertyIsEnumerable.call(m,p)&&(f[p]=m[p])}return f}function BS(m,c){if(m==null)return{};var p={};for(var t in m)if({}.hasOwnProperty.call(m,t)){if(c.indexOf(t)>=0)continue;p[t]=m[t]}return p}const pp={DEBUG:!1,VERSION:"1.0.2",NAME:"@codoxhq/lexical-provider",SDKUI_SOURCE_PATH:"../../../sdkui/dist-production2/codox.bundle.js"}.LOCAL==="true";ce.info("MODE: ","production");const FS=m=>async()=>{const{state:c,timestamp:p}=await m();if(!Se.isValidJSONState(c))throw new Error("Invalid state received from fetchDocOnNetworkReconnect hook");const{commentThreads:t,root:f}=c,r={content:{comments:t,root:f},timestamp:p};return ce.info("[decorateFetchOnReconnctHook] hook invoked: ",{returnObj:r}),r};let Du=0,di=null,hp=!1,Eo={},gp={};const zS=(0,Gt.forwardRef)((m,c)=>{let{onBlacklistedInsert:p}=m;const t=(0,Gt.useContext)(Wi.LexicalComposerContext);if(!t)throw new Error("[CodoxCollabPlugin] CodoxCollabPlugin must be inited inside <LexicalComposer> component - LexicalComposerContext is missing");const[f]=(0,Wi.useLexicalComposerContext)(),r=(0,uy.useCollaborationContext)();(0,Gt.useEffect)(()=>{if(ce.debug("[INIT] lexical context check: ",{lexicalContext:t,editor:f}),!f)return;ce.log("[useEffect][editor] Editor instance changed: ",{editor:f,key:f._key}),Se.setMainEditor(f),Nn.gcAbandonedNodes(),ui.gc(),Ro.clear(),ce.log("[useEffect][editor] subscribe to editor changes");const v=(0,ks.mergeRegister)(f.registerUpdateListener(g),f.registerCommand(be.PASTE_COMMAND,wS,be.COMMAND_PRIORITY_CRITICAL),f.registerCommand(be.UNDO_COMMAND,()=>{Se.setUndoInvoked(!0)},be.COMMAND_PRIORITY_CRITICAL),f.registerCommand(be.REDO_COMMAND,()=>{Se.setRedoInvoked(!0)},be.COMMAND_PRIORITY_CRITICAL),f.registerCommand(be.KEY_DELETE_COMMAND,(b,x)=>{Ro.tableRemoveEventListener("KEY_DELETE_COMMAND")},be.COMMAND_PRIORITY_CRITICAL),f.registerCommand(be.KEY_BACKSPACE_COMMAND,(b,x)=>{Ro.tableRemoveEventListener("KEY_BACKSPACE_COMMAND")},be.COMMAND_PRIORITY_CRITICAL),f.registerCommand(be.CUT_COMMAND,(b,x)=>{Ro.tableRemoveEventListener("CUT_COMMAND")},be.COMMAND_PRIORITY_CRITICAL),...h());So.mount(),Se.alignStateSelectionJSONsFromLatestEditor(),ce.debug("New editor mounted: ",{isCodoxStarted:Se.isCodoxStarted,codoxLexicalEditorManager:Se,nestedEditorsProcessor:ui});let _=f._onError;return f._onError=b=>{ce.error("[ERROR HANDLER WRAPPER] error from editor: ",b),_&&_(b),u()},p&&Ji.setClientCallback(p),()=>{Se.getMainEditorKey()&&(ce.debug("Unmount prev editor"),v(),Se.removeMainEditor(),So.unmount(),Se.clearJSONs(),On.clear(),Ro.clear(),Se.isCodoxStarted&&(ce.debug("EDITOR USE_EFFECT stopping codox"),n(),Se.setIsCodoxStarted(!1)),Ji.removeClientCallback())}},[f]);const n=()=>{Se.isCodoxStarted&&(ce.log("[stopCodoxInstance] stopping codox"),Se.setIsCodoxStarted(!1),pp||ri().stop(),Se.clearJSONs(),Nn.clearAll(),So.clear(),On.resetComments(),ui.clearListeners())},e=async v=>{ce.debug("[startCodoxInstance] invoked"),ri().createNewInstance(),ce.debug("[startCodoxInstance] instance created");for(let O in gp)ri().instance.on(O,gp[O]);if(ce.debug("[startCodoxInstance] events subscribed"),Eo=v,di=Eo.docId,!di)return ce.error("[startCodoxInstance] - start codox skipped - docId is missing",{docId:di});let _=On.initialCommentsExist();ce.debug("[startCodoxInstance] initCommentsExist: ",_),_&&(On.activateInitialComments(f,Nn),ce.log("[activateInitialComments] "));let b=Se.getMainEditorState().toJSON();if(!Se.isValidJSONState(b))throw ce.error("[startCodoxInstance] - start codox skipped - invalid init state",{docId:di,initJSONState:b}),new Error("start codox skipped - invalid init state");ce.log("[startCodoxInstance] starting codox with: ",{docId:di,initJSONState:b,config:Eo,codoxComments:On}),Se.currentContentStateJSON||Se.setCurrentContentStateJSON(b),Se.isCodoxStarted&&n();let{username:x,apiKey:w,getServerState:S,domain:C="",demo:k=!1,hooks:D}=Eo;D&&D.fetchDocOnNetworkReconnect&&(D.fetchDocOnNetworkReconnect=FS(D.fetchDocOnNetworkReconnect));const N=py(D,IS);await ri().start(ri().createConfig(As(As({},Eo),{},{docId:di,username:x,apiKey:w,domain:C,hooks:As({syncState:l,getState:i,getServerState:async()=>await S(di)},N),editorInstanceHooks:{getSelection:()=>Se.getCurrentActiveSelectionJSON(),setSelection:O=>o(O),getState:i,setState:O=>{const{root:R,comments:A}=O;ce.info("DEBUG: EDITOR INSTANCE setState:",{fullState:O}),a({state:{root:R},selection:Se.getCurrentActiveSelectionJSON()},So.getCurrentRemoteSelections()),On.setAllComments(A)},enableEditor:()=>{Se.disableEditorReadOnlyMode()},disableEditor:()=>{Se.enableEditorReadOnlyMode(),So.updateRemoteSelections([])},getContent:()=>{let O=Se.composeFullStateWithRootAndComments();return ce.info("[getContent]: ",O),{state:O}}},appServer:Eo.appServer,demo:k}))),ce.log("[startCodoxInstance] codox started - first sync invoking"),Se.setIsCodoxStarted(!0),r.clientID=Eo.username,r.name=Eo.username,d()},s=()=>{let v=Se.composeFullStateWithRootAndComments({directlyFromEditor:!0});e(v)},i=()=>({state:As(As({},Se.getMainEditorState().toJSON()),{},{comments:On.getAllComments()}),docId:di}),l=v=>{if(!Se.isCodoxStarted)return;ce.log("[SYNC_STATE]: Before sync payload = ",v);const _=ri().sync({meta:v}),{state:b,remoteSelection:x=[]}=_,w=py(_,RS);if(ce.log("[SYNC_STATE]: After sync",{state:b,remoteSelection:x,rest:w}),!b)return ce.error("[SYNC_STATE] abort apply - synced state is not valid - restarting codox"),s();const S=b.state;ce.log("[SYNC_STATE] synced state: ",{synced:JSON.parse(JSON.stringify(S))});let{stateFromSync:C,commentsFromSync:k}=Se.extractStateAndCommentsFromSynced(S);if(!Se.isValidJSONState(C.state))return ce.error("[SYNC_STATE] - invalid state from sync - local update skipped - restarting codox",{contentState:C.state}),s();a(C,x),On.setAllComments(k)},o=v=>{if(!Se.isCodoxStarted||(ce.log("[setLocalSelectionFromSync] synced selection: ",{syncedSelectionJSON:v}),!fp.validateJSONSelection(v,lp.local)))return;let _=Se.getCurrentActiveSelectionJSON();if($e.equalSelectionsJSON(_,v))return void ce.log("[setLocalSelectionFromSync] STOP - local and synced selections are equal");let b=$e.isNestedSelectionJSON(v);f.update(()=>{ce.log("[setLocalSelectionFromSync] json selection to apply: ",{syncedSelectionJSON:v});const x=$e.JSONToLexical(v);if(ce.log("[setLocalSelectionFromSync] lexical selection to apply: ",x),b){let w=ui.setNestedEditorSelection(v);Se.setNestedSelectionJSON(w?v:null)}else(0,be.$setSelection)(x),Se.setMainSelectionJSON(v);ce.log("[setLocalSelectionFromSync] selection updated. latest selection: ",{latestSelectionJSON:Se.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=Se.getCurrentContentStateJSON();ce.log("[updateEditor] invoked: ",{currentContentStateJSON:JSON.parse(JSON.stringify(S)),newStateJSON:JSON.parse(JSON.stringify(v)),newSelectionJSON:_,remoteSelection:x,stateReplace:b,editor:f}),_===void 0&&ce.error("SELECTION FROm SYNC IS UNDEFINED - will default prev selection",_);const C=dp(S,v),k=$e.equalSelectionsJSON(Se.getCurrentActiveSelectionJSON(),_);f.update(()=>{if(Se.addUpdateTag({isSameState:C,isSameSelection:k,updateTag:w}),b)ce.log("[updateEditor] invoke full stateReplace after sync"),cy(v),S=Se.setCurrentContentStateJSON(v),(0,be.$addUpdateTag)("codox_sync_state_changes"),ce.log("[updateEditor] state updated: ",S);else{ce.log("[updateEditor] invoke deltas diff");let N=ri().diff(S,v,{keyNames:{default:"codoxId"}});ce.log("JSON_DIFF_ANALYSIS: ",{currentContentStateJSON:JSON.parse(JSON.stringify(S)),newStateJSON:v,deltas:N&&JSON.parse(JSON.stringify(N))}),N&&N.length&&(ce.log("[updateEditor] apply deltas to lexical state"),xS(v,N),S=Se.setCurrentContentStateJSON(v),(0,be.$addUpdateTag)("codox_sync_state_changes"),ce.log("[updateEditor] state updated: ",S))}let D=$e.isNestedSelectionJSON(_);if(fp.validateJSONSelection(_,lp.local)||(_=Se.getCurrentActiveSelectionJSON()),D){let N=ui.setNestedEditorSelection(_);Se.setNestedSelectionJSON(N?_:null),ce.log("[updateEditor] nested selection updated",N?_:null)}else if(_!==void 0){const N=$e.JSONToLexical(_);ce.log("[updateEditor] updated selection to apply: ",{isSameSelection:k,newSelectionJSON:_,lexicalSelection:N}),(0,be.$setSelection)(N),Se.setMainSelectionJSON(_),ce.log("[updateEditor] selection updated",_)}},{onUpdate:()=>{C||So.updateRemoteSelections(x,"from onUpdate hook")}}),C&&So.updateRemoteSelections(x,"from direct updateEditor")},d=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(!Se.isCodoxStarted)return;ce.log("[invokeSync] SYNC INVOKED ",{upd_call_counter:v});let _=Se.composeFullStateWithRootAndComments();const b={docId:di,state:{state:_,selection:Se.getCurrentActiveSelectionJSON()}};ce.log("[codoxSync]: Before sync",{local:b,upd_call_counter:v}),ce.log("[codoxSync]: Before sync state",JSON.parse(JSON.stringify(b.state)));let{state:x,remoteSelection:w=[],changes:S}=ri().sync({state:b,meta:{}});if(ce.log("[codoxSync]: After sync",{afterSyncState:JSON.parse(JSON.stringify(x)),remoteSelection:w,changes:S}),!x)return ce.error("[codoxSync] abort apply - synced state is not valid - restarting codox "),s();const C=x.state;ce.log("[codoxSync]: synced state: ",JSON.parse(JSON.stringify(C)),v);let{stateFromSync:k,commentsFromSync:D}=Se.extractStateAndCommentsFromSynced(C);if(!Se.isValidJSONState(k.state))return ce.error("[invokeSync] - invalid state from sync - local update skipped - restarting codox",{contentState:k.state}),s();a(k,w),On.setAllComments(D)},u=()=>{ce.warn("[rollbackStateDuringUpdateError] rollback invoked"),ce.log("[rollbackStateDuringUpdateError] values: ",{prevState:Se.getPrevContentStateJSON(),currentState:Se.getCurrentContentStateJSON(),prevSelection:Se.getPrevMainSelectionJSON(),currentSelection:Se.getCurrentActiveSelectionJSON(),codoxComments:On});let v=Se.getPrevContentStateJSON(),_=Se.getPrevMainSelectionJSON();a({state:v,selection:_},So.getCurrentRemoteSelections(),io.historic);let b=Se.undoInvoked(),x=Se.redoInvoked();On.gcAbandonedNodeKeys(Se.getMainEditorState()._nodeMap),b&&f.dispatchCommand(be.CAN_REDO_COMMAND,!1),x&&f.dispatchCommand(be.CAN_UNDO_COMMAND,!1)},g=v=>{let{editorState:_,prevEditorState:b,tags:x,dirtyElements:w,dirtyLeaves:S}=v;if(hp)return hp=!1,void ce.debug("[editorUpdatesListener] invoked blacklisted queued selection change - stop");if(Ji.isBlacklistedFound())return hp=!0,ce.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,j=null;V.read(()=>{let L=(0,be.$getSelection)();j=$e.lexicalToJSON(L),T=V.toJSON()}),Se.setCurrentContentStateJSON(T),Se.setMainSelectionJSON(j),a({state:F,selection:z},So.getCurrentRemoteSelections(),io.historic),f.dispatchCommand(be.CAN_REDO_COMMAND,!1),f.dispatchCommand(be.CAN_UNDO_COMMAND,!1)})(_,b),void Ji.invokeClientCallback();if(!Ro.ensureDocTablesAreValid(_))return;Du++,ce.log("[editorUpdatesListener] invoked by lexical. call counter: ",{upd_call_counter:Du,isCodoxStarted:Se.isCodoxStarted});let C=Se.isOnlySelectionChanged(w,S),k=null,D=null,N=null,O=null,R=Se.getCurrentContentStateJSON(),A=x.has("codox_sync_state_changes"),U=x.has(Kl),H=Se.undoInvoked(),q=Se.redoInvoked(),M=Se.canUndo(),W=Se.canRedo();k=_.toJSON(),D=b.toJSON(),b.read(()=>{O=$e.lexicalToJSON(b._selection)}),_.read(()=>{let V=(0,be.$getSelection)();N=$e.lexicalToJSON(V);let K=$e.JSONToLexical(N),z=V===null&&K===null||V.is(K);ce.log("[editorUpdatesListener] new values: ",{newContentStateJSON:k,currentContentStateJSON:JSON.parse(JSON.stringify(R)),prevContentStateJSON:JSON.parse(JSON.stringify(D)),currentCommentsJSON:JSON.parse(JSON.stringify(On.getAllComments())),newSelectionJSON:JSON.parse(JSON.stringify(N)),currentMainSelectionJSON:JSON.parse(JSON.stringify(Se.getCurrentMainSelectionJSON())),currentNestedSelectionJSON:JSON.parse(JSON.stringify(Se.getCurrentNestedSelectionJSON())),currentActiveSelectionJSON:JSON.parse(JSON.stringify(Se.getCurrentActiveSelectionJSON())),lexicalSelection:V,convertedBackMainSelection:K,isMainSelectionConvertionCorrect:z,nodes:f._editorState._nodeMap,fullEditor:f,codoxNodesMap:Nn.toArray(),codoxComments:On,isUpdateFromSync:A,isUpdateFromComments:U,tags:x,onlySelectionChanged:C,undoInvoked:H,redoInvoked:q,canUndo:M,canRedo:W})});let G=dp(R,k),I=$e.equalSelectionsJSON(Se.getCurrentActiveSelectionJSON(),N);ce.log("[editorUpdatesListener] compares: ",{isStateSame:G,isSelectionSame:I});let $=G&&I&&!U;if(!G||U||A){let V=As({},G?R:k),K=On.getAllComments();K.length&&(V.commentThreads=K);let z={source:A?W0.remote:W0.local,content:V};Eo.hooks&&Eo.hooks.contentChanged&&Eo.hooks.contentChanged(z),ri().instance.emit("content_changed",z)}if($)ce.log("[editorUpdatesListener] STOP - state and selection and comments are same ",Du);else if(Se.undoInvoked()&&Se.setUndoInvoked(!1),Se.redoInvoked()&&Se.setRedoInvoked(!1),Se.setCurrentContentStateJSON(k),Se.setPrevContentStateJSON(D),Se.setMainSelectionJSON(N),Se.setPrevMainSelectionJSON(O),pp){let V=Se.getCurrentActiveSelectionJSON();a({state:Se.getCurrentContentStateJSON(),selection:V},[])}else d(Du)},h=()=>{let v=[];return Se.getMainEditorNodesClassesMap().forEach((_,b,x)=>{let{klass:w}=_,S=f.registerMutationListener(w,C=>{for(let[k,D]of C){if(!Kr[D])continue;const N=Se.getLexicalNodeByKey(k);if(D===Kr.created&&N&&Ji.trackBlacklisted(N,D),w.name===An.TableNode.name&&(D===Kr.destroyed?Ro.tableNodeRemoveListener(k):Ro.tableUpdateListener(k)),w.name===An.TableRowNode.name&&D!==Kr.destroyed&&Ro.tableRowNodeChangesListener(k,D===Kr.updated),w.name===An.TableCellNode.name&&D===Kr.updated&&Ro.tableCellNodeChangesListener(k),w.name===oo.MarkNode.name&&(ce.debug("[MUTATION LISTENER] MARK node: ",{nodeKey:k,node:N,mutationType:D,codoxComments:On}),D===Kr.destroyed?On.removeRelatedNodeKey(k):N&&On.addRelatedNodeKey(N.__key,N.__ids,D===Kr.created)),N&&N.codoxId){if(D===Kr.destroyed)return void(N.codoxId&&Nn.remove(N.codoxId));xy(N)||ce.warn("[MutationListener Error] duplicating codoxId detected - such codoxId already exists in codoxNodesMap - updating node ref to latest: ",{mutationType:D,node:N}),Nn.add(N.codoxId,N)}}v.push(S)})}),v},y={start:e,stop:n,on:(v,_)=>{ce.info(`Subscribing client to codox ${v} event`),gp[v]=_},cursor:{hide:()=>{So.hideRemoteSelectionsFromUI()},show:()=>{So.showHiddenRemoteSelectionsInUI()}},initComments:v=>{On.setInitialComments(v)}};return(0,Gt.useImperativeHandle)(c,()=>y),null}),US=zS,$S=["comments"];function hy(m,c){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(m);c&&(t=t.filter(function(f){return Object.getOwnPropertyDescriptor(m,f).enumerable})),p.push.apply(p,t)}return p}function mp(m){for(var c=1;c<arguments.length;c++){var p=arguments[c]!=null?arguments[c]:{};c%2?hy(Object(p),!0).forEach(function(t){HS(m,t,p[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):hy(Object(p)).forEach(function(t){Object.defineProperty(m,t,Object.getOwnPropertyDescriptor(p,t))})}return m}function HS(m,c,p){return(c=qS(c))in m?Object.defineProperty(m,c,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[c]=p,m}function qS(m){var c=WS(m,"string");return typeof c=="symbol"?c:c+""}function WS(m,c){if(typeof m!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var t=p.call(m,c||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(m)}function JS(m,c){if(m==null)return{};var p,t,f=VS(m,c);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);for(t=0;t<r.length;t++)p=r[t],c.indexOf(p)>=0||{}.propertyIsEnumerable.call(m,p)&&(f[p]=m[p])}return f}function VS(m,c){if(m==null)return{};var p={};for(var t in m)if({}.hasOwnProperty.call(m,t)){if(c.indexOf(t)>=0)continue;p[t]=m[t]}return p}class KS extends $0{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(c){this._canUndo=c}setCanRedo(c){this._canRedo=c}canUndo(){return this._canUndo}canRedo(){return this._canRedo}setUndoInvoked(c){this._undoInvoked=c}setRedoInvoked(c){this._redoInvoked=c}undoInvoked(){return this._undoInvoked}redoInvoked(){return this._redoInvoked}setIsCodoxStarted(){let c=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this._isCodoxStarted=c}get isCodoxStarted(){return this._isCodoxStarted}getMainEditorKey(){return this.mainEditorKey}setMainEditor(c){this.mainEditor=c,this.mainEditorKey=c._key}clearJSONs(){ce.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,be.$getSelection)()))})}mainEditorExists(){return!!this.mainEditor}getMainEditorState(){return this.mainEditor?this.mainEditor.getEditorState():{}}getMainEditorNodesClassesMap(){return this.mainEditor?this.mainEditor._nodes:new Map}getLexicalNodeByKey(c){return this.mainEditor?this.getMainEditorState()._nodeMap.get(c):null}isLexicalEditorInstance(c){return c&&typeof c=="object"&&!!c.setEditorState}setCurrentContentStateJSON(c){return this.currentContentStateJSON=c,this.currentContentStateJSON}getCurrentContentStateJSON(){return this.currentContentStateJSON}setPrevContentStateJSON(c){this.prevContentStateJSON=c}getPrevContentStateJSON(){return this.prevContentStateJSON}setMainSelectionJSON(c){this.currentMainSelectionJSON=c,this.currentMainSelectionJSON&&this.currentNestedSelectionJSON&&(this.currentNestedSelectionJSON=null)}setNestedSelectionJSON(c){this.currentNestedSelectionJSON=c,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(c){this.prevMainSelectionJSON=c}getPrevMainSelectionJSON(){return this.prevMainSelectionJSON}extractStateAndCommentsFromSynced(c){let{state:{comments:p},selection:t,stateReplace:f}=c;return{stateFromSync:{state:mp({},JS(c.state,$S)),selection:t,stateReplace:f},commentsFromSync:p}}composeFullStateWithRootAndComments(){let{directlyFromEditor:c=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return mp(mp({},c?this.getMainEditorState().toJSON():this.currentContentStateJSON),{},{comments:On.getAllComments()})}isValidJSONState(c){let p=!1;try{if(!c)throw new Error("State is undefined");if(!c.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 be.ElementNode,o=i.prototype instanceof be.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(c.root),p=!0}catch(t){ce.error("[isValidJSONState] invalid state found: ",t.message),p=!1}return p}scanLexicalNodeForNestedEditorAttribute(c){for(let p in c){let t=c[p];if(this.isLexicalEditorInstance(t))return p}return""}isOnlySelectionChanged(c,p){return c.size===0&&p.size===0}addUpdateTag(){let{isSameState:c,isSameSelection:p,fromNestedEditor:t=!1,updateTag:f=""}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return f?(ce.log(`[addUpdateTag] explicit add of tag "${f}" `),void(0,be.$addUpdateTag)(f)):t?(ce.log(`[addUpdateTag] add "${io.historic}" tag - change invoked by nested editor`),void(0,be.$addUpdateTag)(io.historic)):void(c?(ce.log(`[addUpdateTag] add "${io.historic}" tag - state is same`),(0,be.$addUpdateTag)(io.historic)):(ce.log(`[addUpdateTag] add "${io.historyMerge}" tag - state is different`),(0,be.$addUpdateTag)(io.historyMerge)))}enableEditorReadOnlyMode(){this.mainEditor&&this.mainEditor.isEditable()&&this.mainEditor.setEditable(!1)}disableEditorReadOnlyMode(){this.mainEditor&&(this.mainEditor.isEditable()||this.mainEditor.setEditable(!0))}}const GS=new KS,Se=GS;class YS{constructor(){this._nodesMap=new Map,this._pastedNodesCodoxIds=new Set}get size(){return this._nodesMap.size}add(c,p){this._nodesMap.set(c,p)}get(c){return this._nodesMap.get(c)||null}remove(c){this._nodesMap.delete(c)}has(c){return this._nodesMap.has(c)}nodesToArray(){return Array.from(this._nodesMap.values())}keysToArray(){return Array.from(this._nodesMap.keys())}toArray(){return Array.from(this._nodesMap.entries())}addPastedId(c){this._pastedNodesCodoxIds.add(c)}removePastedId(c){this._pastedNodesCodoxIds.delete(c)}hasPastedId(c){return this._pastedNodesCodoxIds.has(c)}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 c=Se.getMainEditorState();if(!c._nodeMap)return;let p=this.nodesToArray();for(let t of p)c._nodeMap.has(t.__key)||this.remove(t.codoxId)}}const ZS=new YS,Nn=ZS;function gy(m,c){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(m);c&&(t=t.filter(function(f){return Object.getOwnPropertyDescriptor(m,f).enumerable})),p.push.apply(p,t)}return p}function my(m){for(var c=1;c<arguments.length;c++){var p=arguments[c]!=null?arguments[c]:{};c%2?gy(Object(p),!0).forEach(function(t){XS(m,t,p[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):gy(Object(p)).forEach(function(t){Object.defineProperty(m,t,Object.getOwnPropertyDescriptor(p,t))})}return m}function XS(m,c,p){return(c=QS(c))in m?Object.defineProperty(m,c,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[c]=p,m}function QS(m){var c=t2(m,"string");return typeof c=="symbol"?c:c+""}function t2(m,c){if(typeof m!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var t=p.call(m,c||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(m)}const yp=()=>lw(),yy=m=>typeof m=="number";function Ps(m){let c=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:c,writable:!0}),p}const Aa=m=>m.__type==="root"||m.type==="root",vy=m=>Aa(m.getParent()),Wn=m=>m.__type===Pu.text||m.type===Pu.text||m.hasOwnProperty("__text")||m.hasOwnProperty("text"),js=m=>(0,be.$isElementNode)(m),Ns=m=>(0,An.$isTableNode)(m)||(0,An.$isTableRowNode)(m)||(0,An.$isTableCellNode)(m),e2=m=>!m.getChildren,by=m=>!!m.getChildren,Tn=m=>(0,be.$isDecoratorNode)(m),Yl=m=>(0,tw.$isLinkNode)(m),Zl=m=>m.__type==="mark"||m.type==="mark",vp=m=>(0,be.$isLineBreakNode)(m),Vi=m=>Wn(m)||vp(m),bp=m=>m.__type===Pu.horizontalrule||m.type===Pu.horizontalrule,_y=m=>{if(Vi(m)||Yl(m)||Zl(m))return!1;if(!m.__parent||m.__parent==="root"||(0,be.$isParagraphNode)(m))return!0;let c=m.getParent().getChildren();return c.length===1&&c[0].__key===m.__key?!((Tn(m)||Yl(m)||Zl(m))&&!bp(m)):!c.some(p=>{let t=bp(p);return p.__key!==m.__key&&(Vi(p)||Tn(p)&&!t||Yl(p)||Zl(p))})},xy=m=>{const c=Nn.get(m.codoxId);return!c||m.__key===c.__key},Is=function(m){const c=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:null)||yp();m.codoxId=c,Nn.add(c,m)},wy=m=>{Nn.remove(m.codoxId),delete m.codoxId},n2=m=>{if(!by(m)||!m.getChildrenSize())return;const c=m.getChildren();if(c.some(f=>!!(0,be.$isParagraphNode)(f)))return;let p=!1,t=[];for(let f of c)(Vi(f)||Tn(f)||Yl(f)||Zl(f))&&!p&&(bp(f)||(p=!0)),(by(f)||Tn(f))&&t.push(f);for(let f of t)p||f.codoxId?p&&f.codoxId&&(f=f.getWritable(),wy(f)):(f=f.getWritable(),Is(f))},r2=m=>{const c=my({},m);for(const p in m)m[p]===void 0&&m.hasOwnProperty(p)&&delete c[p];return c},o2=m=>{const c=`__nativeCreateDOM_${m.name}`;m.prototype[c]=Ps(m.prototype.createDOM,c),m.prototype.createDOM=function(p,t){if(_y(this))if(this.codoxId){if(!xy(this)){let r=Nn.get(this.codoxId);r.__type===this.__type&&this.isAttached()&&!r.isAttached()?(ce.warn("[createDOM][Non-unique codoxId] overwrite abandoned existing node with latest: ",{latestNode:this,existingNode:r}),Nn.add(this.codoxId,this)):Is(this)}}else Is(this);else this.codoxId&&wy(this);Tn(this)&&!this.codoxDId&&(this.codoxDId=yp()),ui.manageNestedEditorInLexicalNode(this);let f=this[c](p,t);return f.__codox_track=!0,f}},i2=m=>{const c=`__nativeUpdateDOM_${m.name}`;return m.prototype[c]=Ps(m.prototype.updateDOM,c),m.prototype.updateDOM=function(){const p=this[c](...arguments);return n2(this),p},m},a2=m=>{const c=`__nativeRemove_${m.name}`;return m.prototype[c]=Ps(m.prototype.remove,c),m.prototype.remove=function(){const p=this.codoxId;return p&&Nn.remove(p),ui.gcNestedEditorListenerInLexicalNode(this),this[c](...arguments)},m},s2=m=>{const c=`__nativeExportJSON_${m.name}`;m.prototype[c]=Ps(m.prototype.exportJSON,c),m.prototype.exportJSON=function(){const p=this[c]();return this.codoxId&&(p.codoxId=this.codoxId),this.codoxDId&&(p.codoxDId=this.codoxDId),Wn(this)&&yy(p.format)&&this.hasFormat&&(p.format=bw(this)),r2(p)}},l2=m=>{const c="__nativeImportJSON";m[c]=Ps(m.importJSON,c),m.importJSON=function(p){const t=my({},p);Wn(t)&&!yy(t.format)&&(t.format=vw(t.format));const f=m[c](t);ui.manageNestedEditorInLexicalNode(f);const r=_y(f);return r&&t.codoxId&&(Nn.hasPastedId(t.codoxId)&&Nn.has(t.codoxId)?(Nn.removePastedId(t.codoxId),Is(f)):Is(f,t.codoxId)),r&&!f.codoxId&&Is(f),t.codoxDId&&(f.codoxDId=t.codoxDId),f}},c2=m=>{const c="__nativeClone";m[c]=Ps(m.clone,c),m.clone=function(p){const t=m[c](p);return p.codoxId&&(t.codoxId=p.codoxId),p.codoxDId&&(t.codoxDId=p.codoxDId),ui.manageNestedEditorInClonedLexicalNode(p,t),t}},u2=m=>{let c=!1,p=!1,t=!1,f=!1;m.forEach(n=>{n.name===be.TextNode.name?c=!0:n.name===be.ParagraphNode.name?p=!0:n.name===be.LineBreakNode.name?t=!0:n.name===oo.MarkNode.name&&(f=!0)});let r=[];return c||r.push(be.TextNode),p||r.push(be.ParagraphNode),t||r.push(be.LineBreakNode),f||r.push(oo.MarkNode),r.length?[...r,...m]:m},d2=function(){return u2(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).map(m=>(m.hasOwnProperty("__isCodoxExtended")||(o2(m),i2(m),s2(m),a2(m),l2(m),c2(m),Object.defineProperty(m,"__isCodoxExtended",{value:!0,writable:!1})),m))};var Lu=on(777),Rs={};Rs.styleTagTransform=ci(),Rs.setAttributes=si(),Rs.insert=ai().bind(null,"head"),Rs.domAPI=ii(),Rs.insertStyleElement=li(),oi()(Lu.A,Rs),Lu.A&&Lu.A.locals&&Lu.A.locals;var f2=m=>{var c={};return on.d(c,m),c};const p2=f2({AutoFocusPlugin:()=>Pm});var h2=m=>{var c={};return on.d(c,m),c};const g2=h2({ClearEditorPlugin:()=>Lx});var m2=m=>{var c={};return on.d(c,m),c};const y2=m2({LexicalComposer:()=>Am});var v2=m=>{var c={};return on.d(c,m),c};const Sy=v2({default:()=>Fx});var b2=m=>{var c={};return on.d(c,m),c};const _2=b2({HistoryPlugin:()=>Gm});var x2=m=>{var c={};return on.d(c,m),c};const w2=x2({OnChangePlugin:()=>Ux});var S2=m=>{var c={};return on.d(c,m),c};const E2=S2({PlainTextPlugin:()=>Gx});var C2=m=>{var c={};return on.d(c,m),c};const Ey=C2({$isRootTextContentEmpty:()=>Zm,$rootTextContent:()=>Ym});var k2=m=>{var c={};return on.d(c,m),c};const Ms=k2({createPortal:()=>a1.createPortal}),O2=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,T2=O2?Gt.useLayoutEffect:Gt.useEffect,Cy=T2;var Bu=on(253),Ds={};Ds.styleTagTransform=ci(),Ds.setAttributes=si(),Ds.insert=ai().bind(null,"head"),Ds.domAPI=ii(),Ds.insertStyleElement=li(),oi()(Bu.A,Ds),Bu.A&&Bu.A.locals&&Bu.A.locals;function A2(m){let{onClose:c,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"&&c()},s=l=>{const o=l.target;r.current!==null&&!r.current.contains(o)&&f&&c()},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,c]),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:c},"X"),Gt.createElement("div",{className:"Modal__content"},p)))}function P2(m){let{onClose:c,children:p,title:t,closeOnClickOutside:f=!1}=m;return(0,Ms.createPortal)(Gt.createElement(A2,{onClose:c,title:t,closeOnClickOutside:f},p),document.body)}function ky(){const[m,c]=(0,Gt.useState)(null),p=(0,Gt.useCallback)(()=>{c(null)},[]),t=(0,Gt.useMemo)(()=>{if(m===null)return null;const{title:r,content:n,closeOnClickOutside:e}=m;return Gt.createElement(P2,{onClose:p,title:r,closeOnClickOutside:e},n)},[m,p]),f=(0,Gt.useCallback)(function(r,n){c({closeOnClickOutside:arguments.length>2&&arguments[2]!==void 0&&arguments[2],content:n(p),title:r})},[p]);return[t,f]}var Fu=on(191),Ls={};Ls.styleTagTransform=ci(),Ls.setAttributes=si(),Ls.insert=ai().bind(null,"head"),Ls.domAPI=ii(),Ls.insertStyleElement=li(),oi()(Fu.A,Ls),Fu.A&&Fu.A.locals&&Fu.A.locals;const j2={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"}},N2=j2;var zu=on(72),Bs={};Bs.styleTagTransform=ci(),Bs.setAttributes=si(),Bs.insert=ai().bind(null,"head"),Bs.domAPI=ii(),Bs.insertStyleElement=li(),oi()(zu.A,Bs),zu.A&&zu.A.locals&&zu.A.locals;function I2(){for(var m=arguments.length,c=new Array(m),p=0;p<m;p++)c[p]=arguments[p];return c.filter(Boolean).join(" ")}function _p(){return _p=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var t in p)({}).hasOwnProperty.call(p,t)&&(m[t]=p[t])}return m},_p.apply(null,arguments)}function Ki(m){let{"data-test-id":c,children:p,className:t,onClick:f,disabled:r,small:n,title:e}=m;return Gt.createElement("button",_p({disabled:r,className:I2("Button__root",r&&"Button__disabled",n&&"Button__small",t),onClick:f,title:e,"aria-label":e},c&&{"data-test-id":c}),p)}var Uu=on(129),Fs={};Fs.styleTagTransform=ci(),Fs.setAttributes=si(),Fs.insert=ai().bind(null,"head"),Fs.domAPI=ii(),Fs.insertStyleElement=li(),oi()(Uu.A,Fs),Uu.A&&Uu.A.locals&&Uu.A.locals;var R2=m=>{var c={};return on.d(c,m),c};const M2=R2({ContentEditable:()=>jm});function D2(m){let{className:c}=m;return Gt.createElement(M2.ContentEditable,{className:c||"ContentEditable__root"})}var $u=on(457),zs={};zs.styleTagTransform=ci(),zs.setAttributes=si(),zs.insert=ai().bind(null,"head"),zs.domAPI=ii(),zs.insertStyleElement=li(),oi()($u.A,zs),$u.A&&$u.A.locals&&$u.A.locals;function L2(m){let{children:c,className:p}=m;return Gt.createElement("div",{className:p||"Placeholder__root"},c)}const B2=Sy.default.LexicalErrorBoundary||Sy.default,F2=()=>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"})),Oy=()=>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"})),z2=()=>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"})),U2=()=>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 Ty(m,c,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 On.createNewCommentObj({content:m,author:c,codoxId:p,timeStamp:t,deleted:f})}function $2(m,c,p){return On.createNewThreadObj({quote:m,comments:c,codoxId:p})}function H2(m){let{anchorKey:c,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(c);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"}},[c,p]);return(0,Gt.useEffect)(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[p,r]),Cy(()=>{r()},[c,p,r]),Gt.createElement("div",{className:"CodoxCommentPlugin_AddCommentBox",ref:f},Gt.createElement("button",{className:"CodoxCommentPlugin_AddCommentBox_button",onClick:t},Gt.createElement(F2,null)))}function q2(m){let{onEscape:c}=m;const[p]=(0,Wi.useLexicalComposerContext)();return(0,Gt.useEffect)(()=>p.registerCommand(be.KEY_ESCAPE_COMMAND,t=>c(t),2),[p,c]),null}function W2(m){let{editorRef:c}=m;const[p]=(0,Wi.useLexicalComposerContext)();return typeof c=="function"?c(p):typeof c=="object"&&(c.current=p),null}function Ay(m){let{className:c,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:N2};return Gt.createElement(y2.LexicalComposer,{initialConfig:s},Gt.createElement("div",{className:"CodoxCommentPlugin_CommentInputBox_EditorContainer",onClick:e},Gt.createElement(E2.PlainTextPlugin,{contentEditable:Gt.createElement(D2,{className:c}),placeholder:Gt.createElement(L2,null,n),ErrorBoundary:B2}),Gt.createElement(w2.OnChangePlugin,{onChange:f}),Gt.createElement(_2.HistoryPlugin,null),p!==!1&&Gt.createElement(p2.AutoFocusPlugin,null),Gt.createElement(q2,{onEscape:t}),Gt.createElement(g2.ClearEditorPlugin,null),r!==void 0&&Gt.createElement(W2,{editorRef:r})))}function Py(m,c){return(0,Gt.useCallback)((p,t)=>{p.read(()=>{m((0,Ey.$rootTextContent)()),c(!(0,Ey.$isRootTextContentEmpty)(t.isComposing(),!0))})},[c,m])}function J2(m){let{editor:c,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=Iy(),a=(0,Gt.useCallback)(()=>{c.getEditorState().read(()=>{const u=(0,be.$getSelection)();if((0,be.$isRangeSelection)(u)){l.current=u.clone();const g=u.anchor,h=u.focus,y=(0,Oa.createDOMRange)(c,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)(c,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 U="255, 212, 0",H=`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(${U}, 0.3);pointer-events:none;z-index:5;`;A.style.cssText=H}for(let O=N-1;O>=C;O--){const R=D[O];k.removeChild(R),D.pop()}}}})},[c,i]);Cy(()=>{a();const u=i.container,g=document.body;if(g!==null)return g.appendChild(u),()=>{g.removeChild(u)}},[i.container,a]),(0,Gt.useEffect)(()=>(window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}),[a]);const d=Py(r,e);return Gt.createElement("div",{className:"CodoxCommentPlugin_CommentInputBox",ref:s},Gt.createElement(Ay,{className:"CodoxCommentPlugin_CommentInputBox_Editor",onEscape:u=>(u.preventDefault(),p(),!0),onChange:d}),Gt.createElement("div",{className:"CodoxCommentPlugin_CommentInputBox_Buttons"},Gt.createElement(Ki,{onClick:p,className:"CodoxCommentPlugin_CommentInputBox_Button"},"Cancel"),Gt.createElement(Ki,{onClick:()=>{if(n){let u=c.getEditorState().read(()=>{const g=l.current;return g?g.getTextContent():""});u.length>100&&(u=u.slice(0,99)+"…"),t($2(u,[Ty(f,o)]),!0,void 0,l.current),l.current=null}},disabled:!n,className:"CodoxCommentPlugin_CommentInputBox_Button primary"},"Comment")))}function V2(m){let{submitAddComment:c,thread:p,placeholder:t}=m;const[f,r]=(0,Gt.useState)(""),[n,e]=(0,Gt.useState)(!1),s=(0,Gt.useRef)(null),i=Iy(),l=Py(r,e);return Gt.createElement(Gt.Fragment,null,Gt.createElement(Ay,{className:"CodoxCommentPlugin_CommentsPanel_Editor",autoFocus:!1,onEscape:()=>!0,onChange:l,editorRef:s,placeholder:t}),Gt.createElement(Ki,{className:"CodoxCommentPlugin_CommentsPanel_SendButton",onClick:()=>{if(n){c(Ty(f,i),!1,p);const o=s.current;o!==null&&o.dispatchCommand(be.CLEAR_EDITOR_COMMAND,void 0)}},disabled:!n},Gt.createElement(z2,null)))}function jy(m){let{commentOrThread:c,deleteCommentOrThread:p,onClose:t,thread:f}=m;return Gt.createElement(Gt.Fragment,null,"Are you sure you want to delete this ",c.type,"?",Gt.createElement("div",{className:"Modal__content"},Gt.createElement(Ki,{onClick:()=>{p(c,f),t()}},"Delete")," ",Gt.createElement(Ki,{onClick:()=>{t()}},"Cancel")))}function Ny(m){let{comment:c,deleteComment:p,thread:t,rtf:f}=m;const r=Math.round((c.timeStamp-performance.now())/1e3),n=Math.round(r/60),[e,s]=ky();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"},c.author),Gt.createElement("span",{className:"CodoxCommentPlugin_CommentsPanel_List_Comment_Time"},"· ",r>-10?"Just now":f.format(n,"minute"))),Gt.createElement("p",{className:c.deleted?"CodoxCommentPlugin_CommentsPanel_DeletedComment":""},c.content),!c.deleted&&Gt.createElement(Gt.Fragment,null,Gt.createElement(Ki,{onClick:()=>{s("Delete Comment",i=>Gt.createElement(jy,{commentOrThread:c,deleteCommentOrThread:p,thread:t,onClose:i}))},className:"CodoxCommentPlugin_CommentsPanel_List_DeleteButton"},Gt.createElement(Oy,null)),e))}function K2(m){let{activeIDs:c,comments:p,deleteCommentOrThread:t,listRef:f,submitAddComment:r,markNodeMap:n}=m;const[e]=(0,Wi.useLexicalComposerContext)(),[s,i]=(0,Gt.useState)(0),[l,o]=ky(),a=(0,Gt.useMemo)(()=>new Intl.RelativeTimeFormat("en",{localeMatcher:"best fit",numeric:"auto",style:"short"}),[]);return(0,Gt.useEffect)(()=>{const d=setTimeout(()=>{i(s+1)},1e4);return()=>{clearTimeout(d)}},[s]),Gt.createElement("ul",{className:"CodoxCommentPlugin_CommentsPanel_List",ref:f},p.map(d=>{const u=d.codoxId;if(!u)return null;if(d.type==="thread"){const g=()=>{if(n.get(u)!==void 0&&(c===null||c.indexOf(u)===-1)){const h=document.activeElement;e.update(()=>{(0,be.$setSelection)(null)},{onUpdate(){h!==null&&h.focus()}})}};return Gt.createElement("li",{key:u,onClick:g,className:`CodoxCommentPlugin_CommentsPanel_List_Thread ${n.has(u)?"interactive":""} ${c.indexOf(u)===-1?"":"active"}`},Gt.createElement("div",{className:"CodoxCommentPlugin_CommentsPanel_List_Thread_QuoteBox"},Gt.createElement("blockquote",{className:"CodoxCommentPlugin_CommentsPanel_List_Thread_Quote"},"> ",Gt.createElement("span",null,d.quote)),Gt.createElement(Ki,{onClick:()=>{o("Delete Thread",h=>Gt.createElement(jy,{commentOrThread:d,deleteCommentOrThread:t,onClose:h}))},className:"CodoxCommentPlugin_CommentsPanel_List_DeleteButton"},Gt.createElement(Oy,null)),l),Gt.createElement("ul",{className:"CodoxCommentPlugin_CommentsPanel_List_Thread_Comments"},d.comments.map(h=>Gt.createElement(Ny,{key:h.codoxId,comment:h,deleteComment:t,thread:d,rtf:a}))),Gt.createElement("div",{className:"CodoxCommentPlugin_CommentsPanel_List_Thread_Editor"},Gt.createElement(V2,{submitAddComment:r,thread:d,placeholder:"Reply to comment..."})))}return Gt.createElement(Ny,{key:u,comment:d,deleteComment:t,rtf:a})}))}function G2(m){let{activeIDs:c,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(K2,{activeIDs:c,comments:t,deleteCommentOrThread:p,listRef:n,submitAddComment:f,markNodeMap:r}))}function Iy(){const m=(0,uy.useCollaborationContext)(),{yjsDocMap:c,name:p}=m;return p||"Playground User"}function Y2(m){const[c]=(0,Wi.useLexicalComposerContext)(),p=Nw(),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)(()=>{c.update(()=>{const g=(0,be.$getSelection)();g!==null&&(g.dirty=!0)}),i(!1)},[c]),d=(0,Gt.useCallback)((g,h)=>{if(g.type==="comment"){if(ce.log("[deleteCommentOrThread]: type comment new values",{comment:g,thread:h,markNodeMap:t}),On.removeComment(h.codoxId,g.codoxId),!h)return;const y=h.codoxId,v=t.get(y);c.update(()=>{v?v.forEach((_,b)=>{const x=(0,be.$getNodeByKey)(b);ce.log("[deleteCommentOrThread]: type comment new values",{lexicalNode:x}),x&&x.markDirty()}):(0,be.$getRoot)().markDirty(),(0,be.$addUpdateTag)(io.historic),(0,be.$addUpdateTag)(Kl)})}else{ce.log("[deleteCommentOrThread]: type thread new values",{comment:g,markNodeMap:t});const y=h!==void 0?h.codoxId:g.codoxId,v=t.get(y);setTimeout(()=>{c.update(()=>{if(v)for(const _ of v){const b=(0,be.$getNodeByKey)(_);ce.log("[deleteCommentOrThread]: type thread new values",{node:b}),(0,oo.$isMarkNode)(b)&&(b.deleteID(y),b.getIDs().length===0&&(0,oo.$unwrapMarkNode)(b))}else(0,be.$getRoot)().markDirty(),ce.debug("[deleteCommentOrThread][refreshComments]");On.refreshComments(!0),(0,be.$addUpdateTag)(Kl)})})}},[c,t]),u=(0,Gt.useCallback)((g,h,y,v)=>{if(ce.log("[submitAddComment]: new values",{commentOrThread:g,isInlineComment:h,thread:y,markNodeMap:t}),y?On.addComment(y.codoxId,g):On.addCommentThread(g),h)c.update(()=>{if((0,be.$isRangeSelection)(v)){const _=v.isBackward(),b=g.codoxId;(0,oo.$wrapSelectionInMarkNode)(v,_,b),(0,be.$addUpdateTag)(Kl)}}),i(!1);else if(!h&&y){const _=y.codoxId,b=t.get(_);if(!b)return void On.removeComment(y.codoxId,g.codoxId);c.update(()=>{b.forEach((x,w)=>{let S=(0,be.$getNodeByKey)(w);S&&S.markDirty()}),(0,be.$addUpdateTag)(io.historic),(0,be.$addUpdateTag)(Kl)})}},[c]);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=c.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,c,t]),(0,Gt.useEffect)(()=>{const g=new Map;return(0,ks.mergeRegister)((0,ks.registerNestedElementResolver)(c,oo.MarkNode,h=>(0,oo.$createMarkNode)(h.getIDs()),(h,y)=>{h.getIDs().forEach(v=>{y.addID(v)})}),c.registerMutationListener(oo.MarkNode,h=>{c.getEditorState().read(()=>{for(const[y,v]of h){const _=(0,be.$getNodeByKey)(y);let b=[];v==="destroyed"?b=g.get(y)||[]:(0,oo.$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))}}})}),c.registerUpdateListener(h=>{let{editorState:y,tags:v}=h;y.read(()=>{const _=(0,be.$getSelection)();let b=!1,x=!1;if((0,be.$isRangeSelection)(_)){const w=_.anchor.getNode();if((0,be.$isTextNode)(w)){const S=(0,oo.$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,be.$isRangeSelection)(_)&&i(!1)})}),c.registerCommand(up,()=>{const h=window.getSelection();return h!==null&&h.removeAllRanges(),i(!0),!0},be.COMMAND_PRIORITY_EDITOR))},[c,t]),Gt.createElement(Gt.Fragment,null,s&&(0,Ms.createPortal)(Gt.createElement(J2,{editor:c,cancelAddComment:a,submitAddComment:u}),document.body),f!=null&&!s&&(0,Ms.createPortal)(Gt.createElement(H2,{anchorKey:f,editor:c,onAddComment:()=>{c.dispatchCommand(up,void 0)}}),document.body),(0,Ms.createPortal)(Gt.createElement(Ki,{className:"CodoxCommentPlugin_ShowCommentsButton "+(l?"active":""),onClick:()=>o(!l),title:l?"Hide Comments":"Show Comments"},Gt.createElement(U2,null)),document.body),l&&(0,Ms.createPortal)(Gt.createElement(G2,{comments:p,submitAddComment:u,deleteCommentOrThread:d,activeIDs:n,markNodeMap:t}),document.body))}var Hu=on(766),Us={};Us.styleTagTransform=ci(),Us.setAttributes=si(),Us.insert=ai().bind(null,"head"),Us.domAPI=ii(),Us.insertStyleElement=li(),oi()(Hu.A,Us),Hu.A&&Hu.A.locals&&Hu.A.locals;var qu=on(225),$s={};$s.styleTagTransform=ci(),$s.setAttributes=si(),$s.insert=ai().bind(null,"head"),$s.domAPI=ii(),$s.insertStyleElement=li(),oi()(qu.A,$s),qu.A&&qu.A.locals&&qu.A.locals;function Z2(m){let{label:c,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"},c),Gt.createElement("input",{type:n,className:"CodoxInput__input",placeholder:f,value:p,onChange:e=>{t(e.target.value)},"data-test-id":r}))}function Ry(m,c){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(m);c&&(t=t.filter(function(f){return Object.getOwnPropertyDescriptor(m,f).enumerable})),p.push.apply(p,t)}return p}function Wu(m){for(var c=1;c<arguments.length;c++){var p=arguments[c]!=null?arguments[c]:{};c%2?Ry(Object(p),!0).forEach(function(t){X2(m,t,p[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):Ry(Object(p)).forEach(function(t){Object.defineProperty(m,t,Object.getOwnPropertyDescriptor(p,t))})}return m}function X2(m,c,p){return(c=Q2(c))in m?Object.defineProperty(m,c,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[c]=p,m}function Q2(m){var c=tE(m,"string");return typeof c=="symbol"?c:c+""}function tE(m,c){if(typeof m!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var t=p.call(m,c||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(m)}let Xl=!1;const eE=["#d0021b","#f5a623","#f8e71c","#8b572a","#7ed321","#417505","#bd10e0","#9013fe","#4a90e2","#50e3c2","#b8e986","#000000","#4a4a4a","#9b9b9b","#ffffff"],Ql=214,My=150;function nE(m){let{color:c,onChange:p}=m;const[t,f]=(0,Gt.useState)(Hs("hex",c)),[r,n]=(0,Gt.useState)(c),e=(0,Gt.useRef)(null),s=(0,Gt.useMemo)(()=>({x:t.hsv.s/100*Ql,y:(100-t.hsv.v)/100*My}),[t.hsv.s,t.hsv.v]),i=(0,Gt.useMemo)(()=>({x:t.hsv.h/360*Ql}),[t.hsv]);return(0,Gt.useEffect)(()=>{e.current!==null&&p&&n(t.hex)},[t,p]),(0,Gt.useEffect)(()=>{if(c===void 0)return;const l=Hs("hex",c);f(l),n(l.hex)},[c]),Gt.createElement("div",{className:"codox-color-picker-wrapper",style:{width:Ql},ref:e},Gt.createElement(Z2,{label:"Hex",onChange:l=>{if(n(l),/^#[0-9A-Fa-f]{6}$/i.test(l)){const o=Hs("hex",l);f(o)}},value:r}),Gt.createElement("div",{className:"codox-color-picker-basic-color"},eE.map(l=>Gt.createElement("button",{className:l===t.hex?" active":"",key:l,style:{backgroundColor:l},onClick:()=>(o=>{n(o);let a=Hs("hex",o);f(a),p(a.hex,Xl)})(l)}))),Gt.createElement(Dy,{className:"codox-color-picker-saturation",style:{backgroundColor:`hsl(${t.hsv.h}, 100%, 50%)`},onChange:l=>{let{x:o,y:a}=l;const d=Hs("hsv",Wu(Wu({},t.hsv),{},{s:o/Ql*100,v:100-a/My*100}));f(d),n(d.hex),p(d.hex,Xl)}},Gt.createElement("div",{className:"codox-color-picker-saturation_cursor",style:{backgroundColor:t.hex,left:s.x,top:s.y}})),Gt.createElement(Dy,{className:"codox-color-picker-hue",onChange:l=>{let{x:o}=l;const a=Hs("hsv",Wu(Wu({},t.hsv),{},{h:o/Ql*360}));f(a),n(a.hex),p(a.hex,Xl)}},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 Dy(m){let{className:c,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:d}=i.getBoundingClientRect(),u=Ly(s.clientX-a,l,0),g=Ly(s.clientY-d,o,0);t({x:u,y:g})}};return Gt.createElement("div",{ref:r,className:c,style:p,onMouseDown:s=>{if(s.button!==0)return;e(s);const i=o=>{n.current=!0,Xl=!0,e(o)},l=o=>{n.current&&(Xl=!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 Ly(m,c,p){return m>c?c:m<p?p:m}function By(m){if(!m.startsWith("#")){const c=document.createElement("canvas").getContext("2d");if(!c)throw new Error("2d context not supported or canvas already initialized");return c.fillStyle=m,c.fillStyle}return m.length===4||m.length===5?m=m.split("").map((c,p)=>p?c+c:"#").join(""):m.length===7||m.length===9?m:"#000000"}function Fy(m){const c=(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:c[2],g:c[1],r:c[0]}}function xp(m){let{r:c,g:p,b:t}=m;c/=255,p/=255,t/=255;const f=Math.max(c,p,t),r=f-Math.min(c,p,t);return{h:r?60*(f===c?(p-t)/r+(p<t?6:0):f===p?2+(t-c)/r:4+(c-p)/r):0,s:f?r/f*100:0,v:100*f}}function rE(m){let{h:c,s:p,v:t}=m;p/=100,t/=100;const f=~~(c/60),r=c/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 zy(m){let{b:c,g:p,r:t}=m;return"#"+[t,p,c].map(f=>f.toString(16).padStart(2,"0")).join("")}function Hs(m,c){let p=By("#121212"),t=Fy(p),f=xp(t);return m==="hex"?(p=By(c),t=Fy(p),f=xp(t)):m==="rgb"?(t=c,p=zy(t),f=xp(t)):m==="hsv"&&(f=c,t=rE(f),p=zy(t)),{hex:p,hsv:f,rgb:t}}const oE=Gt.createContext(null),Uy=4;function iE(m){let{children:c,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(oE.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(d=>{if(!d)return r[0];const u=r.indexOf(d)-1;return r[u===-1?r.length-1:u]}):a==="ArrowDown"&&s(d=>d?r[r.indexOf(d)+1]:r[0])}},c))}function aE(m){let{disabled:c=!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),[d,u]=(0,Gt.useState)(!1);return(0,Gt.useEffect)(()=>{const g=a.current,h=o.current;if(d&&g!==null&&h!==null){const{top:y,left:v}=g.getBoundingClientRect();h.style.top=`${y+g.offsetHeight+Uy}px`,h.style.left=`${Math.min(v,window.innerWidth-h.offsetWidth-20)}px`}},[o,a,d]),(0,Gt.useEffect)(()=>{const g=a.current;if(g!==null&&d){const h=y=>{const v=y.target;e&&o.current&&o.current.contains(v)||g.contains(v)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[o,a,d,e]),(0,Gt.useEffect)(()=>{const g=()=>{if(d){const h=a.current,y=o.current;if(h!==null&&y!==null){const{top:v}=h.getBoundingClientRect(),_=v+h.offsetHeight+Uy;_!==y.getBoundingClientRect().top&&(y.style.top=`${_}px`)}}};return document.addEventListener("scroll",g),()=>{document.removeEventListener("scroll",g)}},[a,o,d]),Gt.createElement(Gt.Fragment,null,Gt.createElement("button",{type:"button",disabled:c,"aria-label":t||p,className:f,onClick:()=>u(!d),ref:a},r&&Gt.createElement("span",{className:r}),p&&Gt.createElement("span",{className:i},p),Gt.createElement("i",{className:l})),d&&(0,Ms.createPortal)(Gt.createElement(iE,{dropDownRef:o,onClose:()=>{u(!1),a&&a.current&&a.current.focus()},dropdownClassName:s},n),document.body))}const sE=["disabled","stopCloseOnClickSelf","color","onChange"];function wp(){return wp=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var t in p)({}).hasOwnProperty.call(p,t)&&(m[t]=p[t])}return m},wp.apply(null,arguments)}function lE(m,c){if(m==null)return{};var p,t,f=cE(m,c);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);for(t=0;t<r.length;t++)p=r[t],c.indexOf(p)>=0||{}.propertyIsEnumerable.call(m,p)&&(f[p]=m[p])}return f}function cE(m,c){if(m==null)return{};var p={};for(var t in m)if({}.hasOwnProperty.call(m,t)){if(c.indexOf(t)>=0)continue;p[t]=m[t]}return p}function $y(m){let{disabled:c=!1,stopCloseOnClickSelf:p=!0,color:t,onChange:f}=m,r=lE(m,sE);return Gt.createElement(aE,wp({},r,{disabled:c,stopCloseOnClickSelf:p}),Gt.createElement(nE,{color:t,onChange:f}))}const uE=m=>{let{onColorChange:c,buttonClassName:p,buttonIconClassName:t,buttonAriaLabel:f,buttonLabel:r,dropdownClassName:n,buttonLabelClassName:e,dropdownChevronClassName:s}=m;const[i]=(0,Wi.useLexicalComposerContext)(),[l,o]=(0,Gt.useState)(()=>i.isEditable()),[a,d]=(0,Gt.useState)("");(0,Gt.useEffect)(()=>(0,ks.mergeRegister)(i.registerEditableListener(g=>{o(g)}),i.registerUpdateListener(g=>{let{editorState:h}=g;h.read(()=>{const y=(0,be.$getSelection)();if((0,be.$isRangeSelection)(y)){let v=(0,Oa.$getSelectionStyleValueForProperty)(y,"color");v!==a&&(d(v||""),c(v))}})})),[i]);const u=(0,Gt.useCallback)((g,h)=>{i.update(()=>{const y=(0,be.$getSelection)();y!==null&&(0,Oa.$patchStyleText)(y,{color:g})})},[i]);return Gt.createElement($y,{disabled:!l,color:a,onChange:u,buttonClassName:p||"",buttonIconClassName:t||"",buttonAriaLabel:f||"",buttonLabel:r||"",dropdownClassName:n||"",buttonLabelClassName:e||"",dropdownChevronClassName:s||""})},dE=uE,fE=m=>{let{onColorChange:c,buttonClassName:p,buttonIconClassName:t,buttonAriaLabel:f,buttonLabel:r,dropdownClassName:n,buttonLabelClassName:e,dropdownChevronClassName:s}=m;const[i]=(0,Wi.useLexicalComposerContext)(),[l,o]=(0,Gt.useState)(()=>i.isEditable()),[a,d]=(0,Gt.useState)("#fff");(0,Gt.useEffect)(()=>(0,ks.mergeRegister)(i.registerEditableListener(g=>{o(g)}),i.registerUpdateListener(g=>{let{editorState:h}=g;h.read(()=>{const y=(0,be.$getSelection)();if((0,be.$isRangeSelection)(y)){let v=(0,Oa.$getSelectionStyleValueForProperty)(y,"background-color");v!==a&&(d(v||""),c(v))}})})),[i]);const u=(0,Gt.useCallback)((g,h)=>{i.update(()=>{const y=(0,be.$getSelection)();y!==null&&(0,Oa.$patchStyleText)(y,{"background-color":g})})},[i]);return Gt.createElement($y,{disabled:!l,color:a,onChange:u,buttonClassName:p||"",buttonIconClassName:t||"",buttonAriaLabel:f||"",buttonLabel:r||"",dropdownClassName:n||"",buttonLabelClassName:e||"",dropdownChevronClassName:s||""})},pE=fE;var hE=Ui.yy;Ui._U,Ui.a8,Ui.Vs,Ui.Cn;var gE=Ui.gK,mE=Ui.vv;function yE(m){return m&&m.__esModule&&Object.prototype.hasOwnProperty.call(m,"default")?m.default:m}var Ju=yE(function(m){const c=new URLSearchParams;c.append("code",m);for(let p=1;p<arguments.length;p++)c.append("v",arguments[p]);throw Error(`Minified Lexical error #${m}; visit https://lexical.dev/docs/error?${c} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function vE({hasCellMerge:m=!0,hasCellBackgroundColor:c=!0,hasTabHandler:p=!0}){const[t]=wr();return we.useEffect(()=>(t.hasNodes([wo,Fi,$l])||Ju(10),_o(t.registerCommand(vx,({columns:f,rows:r,includeHeaders:n})=>{const e=b0(Number(r),Number(f),n);Wm(e);const s=e.getFirstDescendant();return je(s)&&s.select(),!0},an),t.registerNodeTransform(wo,f=>{const[r]=S0(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=ni(0);o.append(jn()),i!==null?i.insertAfter(o):Jm(i,o)}}}))),[t]),we.useEffect(()=>{const f=new Map,r=e=>{const s=e.getKey(),i=t.getElementByKey(s);if(i&&!f.has(s)){const l=jx(e,i,t,p);f.set(s,l)}};t.getEditorState().read(()=>{const e=jg(wo);for(const s of e)Rn(s)&&r(s)});const n=t.registerMutationListener(wo,e=>{for(const[s,i]of e)if(i==="created")t.getEditorState().read(()=>{const l=Gn(s);Rn(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]),we.useEffect(()=>{if(!m)return t.registerNodeTransform(Fi,f=>{if(f.getColSpan()>1||f.getRowSpan()>1){const[,,r]=Vr(f),[n]=Io(r,f,f),e=n.length,s=n[0].length;let i=r.getFirstChild();cr(i)||Ju(175);const l=[];for(let o=0;o<e;o++){o!==0&&(i=i.getNextSibling(),cr(i)||Ju(175));let a=null;for(let d=0;d<s;d++){const u=n[o][d],g=u.cell;if(u.startRow===o&&u.startColumn===d)a=g,l.push(g);else if(g.getColSpan()>1||g.getRowSpan()>1){rn(g)||Ju(176);const h=ni(g.__headerState);a!==null?a.insertAfter(h):Jm(i,h)}}}for(const o of l)o.setColSpan(1),o.setRowSpan(1)}})},[t,m]),we.useEffect(()=>{if(!c)return t.registerNodeTransform(Fi,f=>{f.getBackgroundColor()!==null&&f.setBackgroundColor(null)})},[t,c,m]),null}const $k="",bE={autocomplete:"PlaygroundEditorTheme__autocomplete",blockCursor:"PlaygroundEditorTheme__blockCursor",characterLimit:"PlaygroundEditorTheme__characterLimit",code:"PlaygroundEditorTheme__code",codeHighlight:{atrule:"PlaygroundEditorTheme__tokenAttr",attr:"PlaygroundEditorTheme__tokenAttr",boolean:"PlaygroundEditorTheme__tokenProperty",builtin:"PlaygroundEditorTheme__tokenSelector",cdata:"PlaygroundEditorTheme__tokenComment",char:"PlaygroundEditorTheme__tokenSelector",class:"PlaygroundEditorTheme__tokenFunction","class-name":"PlaygroundEditorTheme__tokenFunction",comment:"PlaygroundEditorTheme__tokenComment",constant:"PlaygroundEditorTheme__tokenProperty",deleted:"PlaygroundEditorTheme__tokenProperty",doctype:"PlaygroundEditorTheme__tokenComment",entity:"PlaygroundEditorTheme__tokenOperator",function:"PlaygroundEditorTheme__tokenFunction",important:"PlaygroundEditorTheme__tokenVariable",inserted:"PlaygroundEditorTheme__tokenSelector",keyword:"PlaygroundEditorTheme__tokenAttr",namespace:"PlaygroundEditorTheme__tokenVariable",number:"PlaygroundEditorTheme__tokenProperty",operator:"PlaygroundEditorTheme__tokenOperator",prolog:"PlaygroundEditorTheme__tokenComment",property:"PlaygroundEditorTheme__tokenProperty",punctuation:"PlaygroundEditorTheme__tokenPunctuation",regex:"PlaygroundEditorTheme__tokenVariable",selector:"PlaygroundEditorTheme__tokenSelector",string:"PlaygroundEditorTheme__tokenSelector",symbol:"PlaygroundEditorTheme__tokenProperty",tag:"PlaygroundEditorTheme__tokenProperty",url:"PlaygroundEditorTheme__tokenOperator",variable:"PlaygroundEditorTheme__tokenVariable"},embedBlock:{base:"PlaygroundEditorTheme__embedBlock",focus:"PlaygroundEditorTheme__embedBlockFocus"},hashtag:"PlaygroundEditorTheme__hashtag",heading:{h1:"PlaygroundEditorTheme__h1",h2:"PlaygroundEditorTheme__h2",h3:"PlaygroundEditorTheme__h3",h4:"PlaygroundEditorTheme__h4",h5:"PlaygroundEditorTheme__h5",h6:"PlaygroundEditorTheme__h6"},hr:"PlaygroundEditorTheme__hr",image:"editor-image",indent:"PlaygroundEditorTheme__indent",inlineImage:"inline-editor-image",layoutContainer:"PlaygroundEditorTheme__layoutContainer",layoutItem:"PlaygroundEditorTheme__layoutItem",link:"PlaygroundEditorTheme__link",list:{checklist:"PlaygroundEditorTheme__checklist",listitem:"PlaygroundEditorTheme__listItem",listitemChecked:"PlaygroundEditorTheme__listItemChecked",listitemUnchecked:"PlaygroundEditorTheme__listItemUnchecked",nested:{listitem:"PlaygroundEditorTheme__nestedListItem"},olDepth:["PlaygroundEditorTheme__ol1","PlaygroundEditorTheme__ol2","PlaygroundEditorTheme__ol3","PlaygroundEditorTheme__ol4","PlaygroundEditorTheme__ol5"],ul:"PlaygroundEditorTheme__ul"},ltr:"PlaygroundEditorTheme__ltr",mark:"PlaygroundEditorTheme__mark",markOverlap:"PlaygroundEditorTheme__markOverlap",paragraph:"PlaygroundEditorTheme__paragraph",quote:"PlaygroundEditorTheme__quote",rtl:"PlaygroundEditorTheme__rtl",table:"PlaygroundEditorTheme__table",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",tableRowStriping:"PlaygroundEditorTheme__tableRowStriping",tableSelected:"PlaygroundEditorTheme__tableSelected",tableSelection:"PlaygroundEditorTheme__tableSelection",text:{bold:"PlaygroundEditorTheme__textBold",code:"PlaygroundEditorTheme__textCode",italic:"PlaygroundEditorTheme__textItalic",strikethrough:"PlaygroundEditorTheme__textStrikethrough",subscript:"PlaygroundEditorTheme__textSubscript",superscript:"PlaygroundEditorTheme__textSuperscript",underline:"PlaygroundEditorTheme__textUnderline",underlineStrikethrough:"PlaygroundEditorTheme__textUnderlineStrikethrough"}},_E="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDE1IDE1IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTYuMDAwMDEgOC4zMzMzM0wxLjkwMDAxIDEzLjhMMS4xMDAwMSAxMy4yTDUuMzc1MDEgNy41TDEuMTAwMDEgMS44TDEuOTAwMDEgMS4yTDYuMDAwMDEgNi42NjY2N0wxMC4xIDEuMkwxMC45IDEuOEw2LjYyNTAxIDcuNUwxMC45IDEzLjJMMTAuMSAxMy44TDYuMDAwMDEgOC4zMzMzM1pNMTIgMTIuNUMxMiAxMS42NzE2IDEyLjY3MTYgMTEgMTMuNSAxMUgxMy43OTI5QzE0LjQ1OTYgMTEgMTUgMTEuNTQwNCAxNSAxMi4yMDcxQzE1IDEyLjUyNzMgMTQuODcyOCAxMi44MzQzIDE0LjY0NjUgMTMuMDYwN0wxMy43MDcxIDE0SDE1VjE1SDEyLjVDMTIuMjk3OCAxNSAxMi4xMTU1IDE0Ljg3ODIgMTIuMDM4MSAxNC42OTEzQzExLjk2MDcgMTQuNTA0NSAxMi4wMDM1IDE0LjI4OTQgMTIuMTQ2NSAxNC4xNDY0TDEzLjkzOTMgMTIuMzUzNkMxMy45NzgyIDEyLjMxNDcgMTQgMTIuMjYyIDE0IDEyLjIwNzFDMTQgMTIuMDkyNyAxMy45MDczIDEyIDEzLjc5MjkgMTJIMTMuNUMxMy4yMjM5IDEyIDEzIDEyLjIyMzkgMTMgMTIuNUgxMloiIGZpbGw9IiMwMDAwMDAiLz4KPC9zdmc+",xE="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIiB0ZXh0LXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIiBpbWFnZS1yZW5kZXJpbmc9Im9wdGltaXplUXVhbGl0eSIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIHZpZXdCb3g9IjAgMCA1MDQgNTEyLjM2Ij48cGF0aCBmaWxsLXJ1bGU9Im5vbnplcm8iIGQ9Ik00OTkuNDMgMjMxLjM2SDM2OC40Yy0yLjUzIDAtNC41OC0yLjA1LTQuNTgtNC41N3YtOC4xMWMwLTEuMjYuNTItMi40IDEuMzQtMy4yMmw3MS41Ny04Mi41M2M2LjczLTcuNzUgMTIuNTctMTQuOTcgMTcuNDgtMjEuNjggNC44OC02LjY0IDguODMtMTIuNzQgMTEuODUtMTguMjggMi45Ny01LjQzIDUuMTgtMTAuNjEgNi42NC0xNS41NSAxLjQyLTQuODUgMi4xMy05LjUzIDIuMTMtMTQgMC0xNC42OC0zLjk4LTI2LjA1LTExLjkyLTM0LjA5LTMuOTItMy45Ni04Ljc1LTYuOTMtMTQuNDktOC45Mi01Ljk1LTIuMDMtMTIuOTEtMy4wNS0yMC44Ny0zLjA1LTguNDUgMC0xNS44OCAxLjIxLTIyLjI5IDMuNjItNi4yNyAyLjM2LTExLjYzIDUuOTItMTYuMDcgMTAuNjNhNDcuODg0IDQ3Ljg4NCAwIDAgMC0xMC4xNCAxNi42Yy0yLjI3IDYuMjktMy40MSAxMy4zOS0zLjQxIDIxLjI2IDAgMi41Mi0yLjA1IDQuNTctNC41NyA0LjU3aC02Ljg5Yy0yLjA1IDAtMy44LTEuMzYtNC4zNy0zLjI0bC0uMjctLjgyYy0uMTgtLjU2LS4yNS0xLjEzLS4yMi0xLjY3LS4yMy05LjMyIDEuMTQtMTcuOTkgNC4xMi0yNS45NyAzLjAyLTguMTMgNy42OC0xNS41NCAxMy45NC0yMi4xOSA2LjI2LTYuNyAxMy42My0xMS43NiAyMi4xLTE1LjEzQzQwNy44NCAxLjY4IDQxNy4yIDAgNDI3LjU1IDBjOS41OSAwIDE4LjI2IDEuMzggMjYuMDMgNC4xMyA3Ljg2IDIuNzkgMTQuNzcgNyAyMC43MiAxMi42MSA2LjAyIDUuNjMgMTAuNTUgMTIuNCAxMy41NSAyMC4yOCAyLjk2IDcuNzUgNC40NSAxNi41NiA0LjQ1IDI2LjQgMCA2LjUtMS4wNyAxMy4wOC0zLjE3IDE5LjY5bC0uMTQuMzhjLTIuMDkgNi40Ni01LjE3IDEyLjk3LTkuMiAxOS40OWwtLjE0LjIxYy00LjA4IDYuNTEtOC45IDEzLjQzLTE0LjQzIDIwLjc0LTUuNTYgNy4zMy0xMS45NiAxNS4yMy0xOS4yMiAyMy42N2wtNTYuOTEgNjYuNTFoMTEwLjM0YzIuNTIgMCA0LjU3IDIuMDUgNC41NyA0LjU3djguMTFjMCAyLjUyLTIuMDUgNC41Ny00LjU3IDQuNTd6bS0zMjcuMjUgNjguNzUgMTM3Ljk2LTE2Ny43NmMuODktMS4wNyAyLjMtMS42NSAzLjc0LTEuNjVsMjAuMTMtLjAyYzIuNTIgMCA0LjU3IDEuNzQgNC41NyAzLjg4IDAgLjkxLS4zNyAxLjc1LS45OCAyLjQxTDE4OC4zMiAzMTcuNjYgMzQ0LjEgNTA2LjI0YzEuNDUgMS43NS45NSA0LjE3LTEuMSA1LjQtLjguNDgtMS43Mi43MS0yLjYzLjcxbC0yMC4xMy4wMWMtMS43IDAtMy4xOC0uNzktMy45Ny0xLjk2bC0xNDQuMS0xNzUuMkwyOC4yMyA1MTAuNjljLS44OCAxLjA3LTIuMyAxLjY0LTMuNzMgMS42NWwtMTkuOTMuMDJjLTIuNTIgMC00LjU3LTEuNzQtNC41Ny0zLjg5IDAtLjkuMzctMS43NC45OC0yLjRsMTU1LjY1LTE4OC40TDYuOSAxMzYuOGMtMS40NS0xLjc1LS45NS00LjE4IDEuMTEtNS40MS43OS0uNDcgMS43MS0uNyAyLjYyLS43bDIwLjQ0LS4wMWMxLjYzIDAgMy4wNi43MiAzLjg3IDEuODFsMTM3LjI0IDE2Ny42MnoiLz48L3N2Zz4=",Hy=Un.createContext(null),qy=4;function Vu({children:m,className:c,onClick:p,title:t}){const f=we.useRef(null),r=Un.useContext(Hy);if(r===null)throw new Error("DropDownItem must be used within a DropDown");const{registerItem:n}=r;return we.useEffect(()=>{f&&f.current&&n(f)},[f,n]),le.jsx("button",{className:c,onClick:p,ref:f,title:t,type:"button",children:m})}function wE({children:m,dropDownRef:c,onClose:p}){const[t,f]=we.useState(),[r,n]=we.useState(),e=we.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 d=t.indexOf(a)-1;return t[d===-1?t.length-1:d]}):o==="ArrowDown"&&n(a=>a?t[t.indexOf(a)+1]:t[0])},i=we.useMemo(()=>({registerItem:e}),[e]);return we.useEffect(()=>{t&&!r&&n(t[0]),r&&r.current&&r.current.focus()},[t,r]),le.jsx(Hy.Provider,{value:i,children:le.jsx("div",{className:"dropdown",ref:c,onKeyDown:s,children:m})})}function SE({disabled:m=!1,buttonLabel:c,buttonAriaLabel:p,buttonClassName:t,buttonIconClassName:f,children:r,stopCloseOnClickSelf:n}){const e=we.useRef(null),s=we.useRef(null),[i,l]=we.useState(!1),o=()=>{l(!1),s&&s.current&&s.current.focus()};return we.useEffect(()=>{const a=s.current,d=e.current;if(i&&a!==null&&d!==null){const{top:u,left:g}=a.getBoundingClientRect();d.style.top=`${u+a.offsetHeight+qy}px`,d.style.left=`${Math.min(g,window.innerWidth-d.offsetWidth-20)}px`}},[e,s,i]),we.useEffect(()=>{const a=s.current;if(a!==null&&i){const d=u=>{const g=u.target;n&&e.current&&e.current.contains(g)||a.contains(g)||l(!1)};return document.addEventListener("click",d),()=>{document.removeEventListener("click",d)}}},[e,s,i,n]),we.useEffect(()=>{const a=()=>{if(i){const d=s.current,u=e.current;if(d!==null&&u!==null){const{top:g}=d.getBoundingClientRect(),h=g+d.offsetHeight+qy;h!==u.getBoundingClientRect().top&&(u.style.top=`${h}px`)}}};return document.addEventListener("scroll",a),()=>{document.removeEventListener("scroll",a)}},[s,e,i]),le.jsxs(le.Fragment,{children:[le.jsxs("button",{type:"button",disabled:m,"aria-label":p||c,className:t,onClick:()=>l(!i),ref:s,children:[f&&le.jsx("span",{className:f}),c&&le.jsx("span",{className:"text dropdown-button-text",children:c}),le.jsx("i",{className:"chevron-down"})]}),i&&Wr.createPortal(le.jsx(wE,{dropDownRef:e,onClose:o,children:r}),document.body)]})}function Wy(){return le.jsx("div",{className:"divider"})}const Sp=8,Ep=72,qs={h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",paragraph:"Normal"},EE=({selectionFontSize:m,disabled:c,editor:p,blockType:t,styleConfig:f,isenterPressed:r,currentElementClick:n,currentElementSelect:e})=>{const[s,i]=Un.useState(m),[l,o]=Un.useState(t),[a,d]=Un.useState(""),u=x=>{p.update(()=>{if(p.isEditable()){const w=Ce();w!==null&&Bm(w,x)}})},g=x=>{i(x.target.value)},h=()=>{const x=Number(s);if(!isNaN(x)){const w=Math.min(Math.max(x,Sp),Ep);i(String(w)),u({"font-size":`${w}px`})}},y=x=>{const w=f[l].fontSize,S=x?Math.min(w+2,Ep):Math.max(w-2,Sp);i(String(S)),u({"font-size":`${l}px`})},v=x=>{p.update(()=>{const w=Ce();ye(w)&&O_(w,()=>jn())})},_=x=>{d(x),p.update(()=>{const k=Ce();ye(k)&&A_(k,()=>ws(x))});let w;switch(x){case"h1":w=0;break;case"h2":w=1;break;case"h3":w=2;break;case"paragraph":w=3;break;default:w=0}const S=f.heading[w];i(String(S.fontSize)),d(x),o(x);const C={title:`${S.title}`,"font-size":`${S.fontSize}px`,color:S.fontColor,"font-family":S.fontFamily,"line-height":`${1+S.leadingSpace}em`,"margin-bottom":`${S.trailingSpace}em`};u(C)},b=()=>{o("paragraph"),u({}),i("11"),v()};return Un.useEffect(()=>{r&&r==="Enter"&&b()},[r]),Un.useEffect(()=>{const x=()=>{p.update(()=>{const w=Ce();if(w!==null){const C=w.getNodes()[0];if(!je(C)){const k=C.getType();k in qs&&o(k)}}})};return p.registerUpdateListener(x),()=>{p.registerUpdateListener(x)}},[p]),Un.useEffect(()=>{switch(n.tagName){case"P":o("paragraph"),i("11");break;case"H1":console.log("H1"),o("h1"),i(f.heading.find(x=>x.title==="Heading1").fontSize);break;case"H2":o("h2"),i(f.heading.find(x=>x.title==="Heading2").fontSize);break;case"H3":o("h3"),i(f.heading.find(x=>x.title==="Heading3").fontSize);break;case"default":o("paragraph"),i("11"),console.log("default");break}},[n]),Un.useEffect(()=>{switch(e.trim(" ")){case"Heading1":o("h1"),i(f.heading.find(x=>x.title==="Heading1").fontSize);break;case"Heading2":o("h2"),i(f.heading.find(x=>x.title==="Heading2").fontSize);break;case"Heading3":o("h3"),i(f.heading.find(x=>x.title==="Heading3").fontSize);break;case"paragraph":o("paragraph"),i("11"),console.log("Setting to default paragraph");break;default:console.warn("Unknown element type:",e);break}},[e]),le.jsxs(le.Fragment,{children:[le.jsx("button",{type:"button",disabled:c,onClick:()=>y(!1),className:"toolbar-item font-decrement"}),le.jsx("input",{type:"number",value:s,disabled:c,readOnly:!0,className:"toolbar-item font-size-input",min:Sp,max:Ep,onChange:g,onBlur:h}),le.jsx("button",{type:"button",disabled:c,onClick:()=>y(!0),className:"toolbar-item font-increment"}),le.jsx(Wy,{}),le.jsxs("div",{className:"symbol-dropdown cust-head-dropDown",children:[le.jsxs(SE,{disabled:c,buttonClassName:"toolbar-item block-controls",buttonAriaLabel:"Formatting options for text style",buttonIconClassName:"icon block-type "+l,buttonLabel:qs[l],children:[le.jsxs(Vu,{className:`item ${l==="paragraph"?"active":""}`,onClick:()=>v(),children:[le.jsx("i",{className:"icon paragraph"}),le.jsx("span",{className:"text",children:qs.paragraph})]}),le.jsxs(Vu,{className:`item ${l==="h1"?"active":""}`,onClick:()=>_("h1"),children:[le.jsx("i",{className:"icon h1"}),le.jsx("span",{className:"text",children:qs.h1})]}),le.jsxs(Vu,{className:`item ${l==="h2"?"active":""}`,onClick:()=>_("h2"),children:[le.jsx("i",{className:"icon h2"}),le.jsx("span",{className:"text",children:qs.h2})]}),le.jsxs(Vu,{className:`item ${l==="h3"?"active":""}`,onClick:()=>_("h3"),children:[le.jsx("i",{className:"icon h3"}),le.jsx("span",{className:"text",children:qs.h3})]})]}),le.jsx(Wy,{})]})]})},CE="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48IS0tISBGb250IEF3ZXNvbWUgUHJvIDYuMS4xIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlIChDb21tZXJjaWFsIExpY2Vuc2UpIENvcHlyaWdodCAyMDIyIEZvbnRpY29ucywgSW5jLi0tPjxwYXRoIGQ9Ik0wIDI1NkMwIDExNC42IDExNC42IDAgMjU2IDBzMjU2IDExNC42IDI1NiAyNTYtMTE0LjYgMjU2LTI1NiAyNTZTMCAzOTcuNCAwIDI1NnptMTc1LTQ3LjkgNDcuMSA0N0wxNzUgMzAzYy05LjMgOS40LTkuMyAyNC42IDAgMzMuMSA5LjQgMTAuMiAyNC42IDEwLjIgMzMuMSAwbDQ3LTQ2LjIgNDcuOSA0Ni4yYzkuNCAxMC4yIDI0LjYgMTAuMiAzMy4xIDAgMTAuMi04LjUgMTAuMi0yMy43IDAtMzMuMWwtNDYuMi00Ny45IDQ2LjItNDdjMTAuMi04LjUgMTAuMi0yMy43IDAtMzMuMS04LjUtOS4zLTIzLjctOS4zLTMzLjEgMGwtNDcuOSA0Ny4xLTQ3LTQ3LjFjLTguNS05LjMtMjMuNy05LjMtMzMuMSAwLTkuMyA5LjQtOS4zIDI0LjYgMCAzMy4xeiIvPjwvc3ZnPg==",kE="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iY3VycmVudENvbG9yIiBjbGFzcz0iYmkgYmktdGFibGUiPjxwYXRoIGQ9Ik0wIDJhMiAyIDAgMCAxIDItMmgxMmEyIDIgMCAwIDEgMiAydjEyYTIgMiAwIDAgMS0yIDJIMmEyIDIgMCAwIDEtMi0yVjJ6bTE1IDJoLTR2M2g0VjR6bTAgNGgtNHYzaDRWOHptMCA0aC00djNoM2ExIDEgMCAwIDAgMS0xdi0yem0tNSAzdi0zSDZ2M2g0em0tNSAwdi0zSDF2MmExIDEgMCAwIDAgMSAxaDN6bS00LTRoNFY4SDF2M3ptMC00aDRWNEgxdjN6bTUtM3YzaDRWNEg2em00IDRINnYzaDRWOHoiLz48L3N2Zz4=";function OE(){const[m,c]=we.useState("4"),[p,t]=we.useState("4"),[f,r]=we.useState(!1),[n,e]=we.useState(),[s]=wr(),i=()=>{!m||!p||(s.update(()=>{const l=b0(m,p,!0),o=Wm(l);e(o)}),r(!1))};return le.jsxs(le.Fragment,{children:[le.jsx("button",{title:"Table",className:"toolbar-item ",onClick:()=>r(!0),children:le.jsx("img",{className:"add-toolbar-table-icon",src:kE,alt:"Add Table"})}),f&&le.jsx("div",{className:"modal-overlay",children:le.jsxs("div",{className:"modal-content",children:[le.jsx("h3",{children:"Select Table Dimensions"}),le.jsx("button",{className:"modal-buttons-close",onClick:()=>r(!1),children:le.jsx("img",{src:CE,height:16,width:16,style:{margin:"0 0 29px 10px"}})}),le.jsxs("div",{className:"select-table-container",children:[le.jsx("label",{children:"Rows"}),le.jsx("input",{type:"number",value:m,onChange:l=>c(Number(l.target.value))})]}),le.jsxs("div",{className:"select-table-container",children:[le.jsx("label",{children:"Column"}),le.jsx("input",{type:"number",value:p,onChange:l=>t(Number(l.target.value))})]}),le.jsx("div",{children:le.jsx("div",{className:"modal-buttons",children:le.jsx("button",{className:"toolbar-item",onClick:i,children:"Confirm"})})})]})})]})}const TE=[{letter:"",uppercase:"A",lowercase:"α"},{letter:"Beta",uppercase:"Β",lowercase:"β"},{letter:"Gamma",uppercase:"Γ",lowercase:"γ"},{letter:"Delta",uppercase:"Δ",lowercase:"δ"},{letter:"Epsilon",uppercase:"Ε",lowercase:"ε"},{letter:"Zeta",uppercase:"Ζ",lowercase:"ζ"},{letter:" Eta ",uppercase:"Η",lowercase:"η"},{letter:"Theta",uppercase:"Θ",lowercase:"θ"},{letter:"Iota",uppercase:"Ι",lowercase:"ι"},{letter:"Kappa",uppercase:"Κ",lowercase:"κ"}];function AE(){const[m]=wr(),[c,p]=we.useState(!1),t=f=>{m.update(()=>{var n;const r=Ce();if(ye(r)){const e=r.anchor.getNode();let s="inherit";if(e instanceof Ii){const l=e.getStyle();s=((n=l==null?void 0:l.match(/font-size:\s*(\S+);/))==null?void 0:n[1])||s}const i=nr(f);r.insertNodes([i])}}),p(!1)};return le.jsxs("div",{children:[le.jsx("button",{className:"toolbar-item symbols-toolbar",title:"Symbols",onPointerEnter:()=>p(!c),children:"Symbols"}),c&&le.jsx("div",{className:"modal-overlay-symb",onClick:()=>p(!1),children:le.jsx("div",{className:"modal-content-symb",children:le.jsx("div",{className:"symbol-Flex-container",children:TE.map(({letter:f,uppercase:r,lowercase:n})=>le.jsxs("div",{className:"symbol-items",children:[le.jsx("button",{onClick:()=>t(n),children:n}),le.jsx("button",{onClick:()=>t(r),children:r})]},f))})})})]})}const Jy="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik00IDEySDIwTTEyIDRWMjAiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4NCjwvc3ZnPg==",Vy="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik02IDEyTDE4IDEyIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+DQo8L3N2Zz4=";var PE=typeof global=="object"&&global&&global.Object===Object&&global;const jE=PE;var NE=typeof self=="object"&&self&&self.Object===Object&&self,IE=jE||NE||Function("return this")();const Ky=IE;var RE=Ky.Symbol;const Ku=RE;var Gy=Object.prototype,ME=Gy.hasOwnProperty,DE=Gy.toString,tc=Ku?Ku.toStringTag:void 0;function LE(m){var c=ME.call(m,tc),p=m[tc];try{m[tc]=void 0;var t=!0}catch{}var f=DE.call(m);return t&&(c?m[tc]=p:delete m[tc]),f}var BE=Object.prototype,FE=BE.toString;function zE(m){return FE.call(m)}var UE="[object Null]",$E="[object Undefined]",Yy=Ku?Ku.toStringTag:void 0;function HE(m){return m==null?m===void 0?$E:UE:Yy&&Yy in Object(m)?LE(m):zE(m)}function qE(m){return m!=null&&typeof m=="object"}var WE="[object Symbol]";function JE(m){return typeof m=="symbol"||qE(m)&&HE(m)==WE}var VE=/\s/;function KE(m){for(var c=m.length;c--&&VE.test(m.charAt(c)););return c}var GE=/^\s+/;function YE(m){return m&&m.slice(0,KE(m)+1).replace(GE,"")}function Cp(m){var c=typeof m;return m!=null&&(c=="object"||c=="function")}var Zy=0/0,ZE=/^[-+]0x[0-9a-f]+$/i,XE=/^0b[01]+$/i,QE=/^0o[0-7]+$/i,tC=parseInt;function Xy(m){if(typeof m=="number")return m;if(JE(m))return Zy;if(Cp(m)){var c=typeof m.valueOf=="function"?m.valueOf():m;m=Cp(c)?c+"":c}if(typeof m!="string")return m===0?m:+m;m=YE(m);var p=XE.test(m);return p||QE.test(m)?tC(m.slice(2),p?2:8):ZE.test(m)?Zy:+m}var eC=function(){return Ky.Date.now()};const kp=eC;var nC="Expected a function",rC=Math.max,oC=Math.min;function iC(m,c,p){var t,f,r,n,e,s,i=0,l=!1,o=!1,a=!0;if(typeof m!="function")throw new TypeError(nC);c=Xy(c)||0,Cp(p)&&(l=!!p.leading,o="maxWait"in p,r=o?rC(Xy(p.maxWait)||0,c):r,a="trailing"in p?!!p.trailing:a);function d(w){var S=t,C=f;return t=f=void 0,i=w,n=m.apply(C,S),n}function u(w){return i=w,e=setTimeout(y,c),l?d(w):n}function g(w){var S=w-s,C=w-i,k=c-S;return o?oC(k,r-C):k}function h(w){var S=w-s,C=w-i;return s===void 0||S>=c||S<0||o&&C>=r}function y(){var w=kp();if(h(w))return v(w);e=setTimeout(y,g(w))}function v(w){return e=void 0,a&&t?d(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(kp())}function x(){var w=kp(),S=h(w);if(t=arguments,f=this,s=w,S){if(e===void 0)return u(s);if(o)return clearTimeout(e),e=setTimeout(y,c),d(s)}return e===void 0&&(e=setTimeout(y,c)),n}return x.cancel=_,x.flush=b,x}function aC(m,c,p){const t=we.useRef(null);return t.current=m,we.useMemo(()=>iC((...f)=>{t.current&&t.current(...f)},c,{maxWait:p}),[c,p])}const Qy=20;function sC({anchorElem:m}){const[c]=wr(),p=_u(),[t,f]=we.useState(!1),[r,n]=we.useState(!1),[e,s]=we.useState(!1),[i,l]=we.useState({}),o=we.useRef(new Set),a=we.useRef(null),d=aC(y=>{const{isOutside:v,tableDOMNode:_}=lC(y);if(v){f(!1),n(!1);return}if(!_)return;a.current=_;let b=null,x=null,w=null;if(c.update(()=>{var C;const S=sr(_);if(rn(S)){const k=bn(S,D=>Rn(D));if(!Rn(k))return;if(w=c.getElementByKey(k==null?void 0:k.getKey()),w){const D=k.getChildrenSize(),N=(C=k.getChildAtIndex(0))==null?void 0:C.getChildrenSize(),O=Sx(S),R=x0(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:Qy,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:Qy}))}},50,250),u=we.useMemo(()=>new ResizeObserver(()=>{f(!1),n(!1)}),[]);we.useEffect(()=>{if(e)return document.addEventListener("mousemove",d),()=>{f(!1),n(!1),d.cancel(),document.removeEventListener("mousemove",d)}},[e,d]),we.useEffect(()=>_o(c.registerMutationListener(wo,y=>{c.getEditorState().read(()=>{for(const[v,_]of y){const b=c.getElementByKey(v);switch(_){case"created":o.current.add(v),s(o.current.size>0),b&&u.observe(b);break;case"destroyed":o.current.delete(v),s(o.current.size>0),u.disconnect(),o.current.forEach(x=>{const w=c.getElementByKey(x);w&&u.observe(w)});break}}})})),[c,u]);const g=y=>{c.update(()=>{if(a.current){const v=sr(a.current);v==null||v.selectEnd(),y?(Ex(),f(!1)):(Cx(),n(!1))}})},h=y=>{c.update(()=>{if(a.current){const v=sr(a.current);v==null||v.selectEnd(),y?(kx(),f(!1)):(Ox(),n(!1))}})};return p?le.jsxs(le.Fragment,{children:[t&&le.jsxs("div",{children:[le.jsx("button",{className:"PlaygroundEditorTheme__tableAddRows",style:{...i,flex:"50%",padding:"20px"},onClick:()=>g(!0),children:le.jsx("img",{src:Jy,height:14,width:14,style:{color:"grey",marginLeft:"-3px"}})}),le.jsx("button",{className:"PlaygroundEditorTheme__tableAddRows",style:{...i,flex:"50%"},onClick:()=>h(!0),children:le.jsx("img",{src:Vy,height:14,width:14,style:{color:"grey",marginLeft:"-3px"}})})]}),r&&le.jsxs("div",{className:"table-add-row-flex-container",children:[le.jsx("button",{className:"PlaygroundEditorTheme__tableAddColumns table-add-row-flex-children",style:{...i,flex:"50%",padding:"20px"},onClick:()=>g(!1),children:le.jsx("img",{src:Jy,height:14,width:14,style:{color:"grey",marginLeft:"-3px"}})}),le.jsx("button",{className:"PlaygroundEditorTheme__tableAddColumns table-add-row-flex-children",style:{...i,flex:"50%"},onClick:()=>h(!1),children:le.jsx("img",{src:Vy,height:14,width:14,style:{color:"grey",marginLeft:"-3px"}})})]})]}):null}function lC(m){const c=m.target;if(c&&c instanceof HTMLElement){const p=c.closest("td.PlaygroundEditorTheme__tableCell, th.PlaygroundEditorTheme__tableCell");return{isOutside:!(p||c.closest("button.PlaygroundEditorTheme__tableAddRows")||c.closest("button.PlaygroundEditorTheme__tableAddColumns")||c.closest("div.TableCellResizer__resizer")),tableDOMNode:p}}else return{isOutside:!0,tableDOMNode:null}}function cC({anchorElem:m=document.body}){return _u()?Wr.createPortal(le.jsx(sC,{anchorElem:m}),m):null}const ec=1;function Op(){return le.jsx("div",{className:"divider"})}function uC({renderOnlineUsers:m,styleConfig:c}){const[p]=wr(),t=we.useRef(null),[f,r]=we.useState(!1),[n,e]=we.useState(!1),[s,i]=we.useState(!1),[l,o]=we.useState(!1),[a,d]=we.useState(!1),[u,g]=we.useState(!1),[h,y]=we.useState(!1),[v,_]=we.useState(!1),[b,x]=we.useState("11px"),[w,S]=we.useState(()=>p.isEditable()),[C,k]=we.useState(""),[D,N]=we.useState(""),[O,R]=we.useState(""),A=we.useCallback(()=>{const U=Ce();ye(U)&&(i(U.hasFormat("bold")),o(U.hasFormat("italic")),d(U.hasFormat("underline")),g(U.hasFormat("strikethrough")),y(U.hasFormat("subscript")),_(U.hasFormat("superscript")),x(zm(U,"font-size","11px")))},[]);return we.useEffect(()=>_o(p.registerUpdateListener(({editorState:U})=>{U.read(()=>{A()})}),p.registerCommand(Go,U=>{k("");const H=Ce();let q=["Heading1","Heading2","Heading3","paragraph"],M="";return H&&H.style&&(H.style.split(";")[0]&&q.includes(H.style.split(";")[0].split(":")[1].trim(""))&&(M=H.style.split(";")[0].split(":")[1].trim("")),H.style.split(";")[1]&&q.includes(H.style.split(";")[1].split(":")[1].trim(""))&&(M=H.style.split(";")[1].split(":")[1].trim("")),H.style.split(";")[2]&&q.includes(H.style.split(";")[2].split(":")[1].trim(""))&&(M=H.style.split(";")[2].split(":")[1].trim("")),H.style.split(";")[3]&&q.includes(H.style.split(";")[3].split(":")[1].trim(""))&&(M=H.style.split(";")[3].split(":")[1].trim(""))),console.log("SELECTION_CHANGE_COMMAND",H&&H.style&&M),R(H&&H.style?M:"paragraph"),A(),!1},ec),p.registerCommand(is,U=>(r(U),!1),ec),p.registerCommand(os,U=>(e(U),!1),ec),p.registerCommand(qd,U=>(N(U.target),!1),ec),p.registerCommand(ns,U=>(k(U.code),!1),ec)),[p,A]),le.jsxs("div",{className:"toolbar",ref:t,children:[le.jsx("button",{disabled:!f,onClick:()=>{p.dispatchCommand(_l,void 0)},className:"toolbar-item spaced","aria-label":"Undo",children:le.jsx("i",{className:"format undo"})}),le.jsx("button",{disabled:!n,onClick:()=>{p.dispatchCommand(xl,void 0)},className:"toolbar-item","aria-label":"Redo",children:le.jsx("i",{className:"format redo"})}),le.jsx(Op,{}),le.jsx(EE,{currentElementClick:D,selectionFontSize:b.slice(0,-2),editor:p,disabled:!w,blockType:"paragraph",styleConfig:c,isenterPressed:C,currentElementSelect:O}),le.jsx(Op,{}),le.jsx("button",{onClick:()=>{p.dispatchCommand(Tr,"bold")},className:"toolbar-item spaced "+(s?"active":""),"aria-label":"Format Bold",children:le.jsx("i",{className:"format bold"})}),le.jsx("button",{onClick:()=>{p.dispatchCommand(Tr,"italic")},className:"toolbar-item spaced "+(l?"active":""),"aria-label":"Format Italics",children:le.jsx("i",{className:"format italic"})}),le.jsx("button",{onClick:()=>{p.dispatchCommand(Tr,"underline")},className:"toolbar-item spaced "+(a?"active":""),"aria-label":"Format Underline",children:le.jsx("i",{className:"format underline"})}),le.jsx("button",{onClick:()=>{p.dispatchCommand(Tr,"strikethrough")},className:"toolbar-item spaced "+(u?"active":""),"aria-label":"Format Strikethrough",children:le.jsx("i",{className:"format strikethrough"})}),le.jsx("button",{onClick:()=>{p.dispatchCommand(Tr,"superscript")},className:"toolbar-item spaced "+(v?"active":""),"aria-label":"Format SuperScript",children:le.jsx("img",{src:xE,height:16,width:16,style:{marginTop:"1px"}})}),le.jsx("button",{onClick:()=>{p.dispatchCommand(Tr,"subscript")},className:"toolbar-item spaced "+(h?"active":""),"aria-label":"Format SubScript",children:le.jsx("img",{src:_E,height:16,width:16,style:{marginTop:"1px"}})}),le.jsx(Op,{}),le.jsx("button",{onClick:()=>{p.dispatchCommand(rs,"left")},className:"toolbar-item spaced","aria-label":"Left Align",children:le.jsx("i",{className:"format left-align"})}),le.jsx("button",{onClick:()=>{p.dispatchCommand(rs,"center")},className:"toolbar-item spaced","aria-label":"Center Align",children:le.jsx("i",{className:"format center-align"})}),le.jsx("button",{onClick:()=>{p.dispatchCommand(rs,"right")},className:"toolbar-item spaced","aria-label":"Right Align",children:le.jsx("i",{className:"format right-align"})}),le.jsx("button",{onClick:()=>{p.dispatchCommand(rs,"justify")},className:"toolbar-item","aria-label":"Justify Align",children:le.jsx("i",{className:"format justify-align"})}),le.jsx(OE,{}),le.jsx(AE,{}),le.jsx(cC,{}),le.jsx("div",{className:"avtar-outer-div",children:m()})]})}var Tp={exports:{}},Sn={};/** @license React v16.13.1
|
|
1429
|
+
`,A.append(H),_=H}!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(c){let p=!1,t=c.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,d]=l;if(s.has(d))continue;let u=rr.isMousePositionWithinElementCords(c,o);c.type===Sr.mouseover&&u&&(a.style.animation=this.isEditingInProgress?rr.tooltipAnimations.hideAtOnce:rr.tooltipAnimations.showAtOnce,s.add(d)),c.type===Sr.mouseout&&(a.style.animation=rr.tooltipAnimations.hideWithDelay,s.add(d)),c.type===Sr.mousemove&&u&&(a.style.animation=this.isEditingInProgress?rr.tooltipAnimations.hideAtOnce:rr.tooltipAnimations.showAtOnce,s.add(d))}}_keyboardEventsListener(c){c.type===Sr.keypress&&(this.isEditingInProgress||(this.isEditingInProgress=!0)),c.type===Sr.keyup&&this.isEditingInProgress&&(this.isEditingInProgress=!1)}_resizeEventListener(c){Se.mainEditorExists()&&this.paintRemoteSelections(this.remoteSelections)}mount(){window.addEventListener(Sr.keypress,this.keyboardBindedListener),window.addEventListener(Sr.keyup,this.keyboardBindedListener),window.addEventListener(Sr.resize,this.resizeBindedListener),window.addEventListener(Sr.scroll,this.resizeBindedListener);for(const c of H0)window.addEventListener(c,this.mouseBindedListener)}unmount(){window.removeEventListener(Sr.keypress,this.keyboardBindedListener),window.removeEventListener(Sr.keyup,this.keyboardBindedListener),window.removeEventListener(Sr.resize,this.resizeBindedListener),window.removeEventListener(Sr.scroll,this.resizeBindedListener);for(const c of H0)window.removeEventListener(c,this.mouseBindedListener);this.gcPrevPaintedRemoteSelections()}shouldUpdateRemoteSelections(){return!0}gcPrevPaintedRemoteSelections(){let c=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=c||[],this.remoteSelectionDOMsMap={},this.activeEditorsKeys={}}paintRemoteSelections(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];this.gcPrevPaintedRemoteSelections(c);let p=Se.getMainEditorState();p.read&&p.read(()=>{for(let t of this.remoteSelections)if(fp.validateJSONSelection(t,lp.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){ce.warn("[PAINT REMOTE SELECTION] failed for nested editor - ",{error:e,nestedSelectionJSON:f,fullSelection:t,lexicalSelection:n})}else ce.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){ce.error("DEBUGGER: [paintRemoteSelections] selection from json to lexical is null: ",{selection:t,lexicalSelection:f});continue}try{this.paintSingleRemoteSelection({editor:Se.getMainEditor(),selectionJSON:t,lexicalSelection:f,selectedNodes:f.getNodes(),isBackward:f.isBackward()})}catch(r){ce.warn("[PAINT REMOTE SELECTION] failed - ",{error:r,fullSelection:t,lexicalSelection:f})}}})}updateRemoteSelections(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";this.shouldUpdateRemoteSelections(c)&&(ce.log("[updateRemoteSelections] "+p,{newRemoteSelections:c}),Promise.resolve().then(()=>{this.paintRemoteSelections(c),this.hideInUI&&this.hideRemoteSelectionsFromUI()}))}clear(){this.gcPrevPaintedRemoteSelections()}getCurrentRemoteSelections(){return this.remoteSelections}hideRemoteSelectionsFromUI(){this.hideInUI||(this.hideInUI=!0);const c=document.querySelectorAll(".codox_remote_selection");for(let p of c)p.classList.add("hidden_codox_remote_selection")}showHiddenRemoteSelectionsInUI(){this.hideInUI=!1;const c=document.querySelectorAll(".hidden_codox_remote_selection");for(let p of c)p.classList.remove("hidden_codox_remote_selection")}}const So=new vS;function bS(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).findIndex(m=>m===ka.editorState)}function Ru(m){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,p=Se.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)Ru(r,f);return c&&c.getChildrenSize&&c.splice(c.getChildrenSize(),0,[f]),f}function Mu(m){if(m.getChildren)for(let c of m.getChildren())Mu(c);m.remove()}function sy(m){m.__parent=null,m.__next=null,m.__prev=null}function ly(m,c){return!!Se.isLexicalEditorInstance(m)&&!(typeof c!="object"||!c.editorState||(m.update(()=>{try{let p=(0,be.$getSelection)();const t=m.parseEditorState(c.editorState);if(t.isEmpty())return(0,be.$getRoot)().clear(),!0;(0,be.$setSelection)(p),m.setEditorState(t)}catch(p){ce.error("[stateUpdates][updateNestedEditorState] update nested state and selection error: ",p)}}),0))}function _S(m,c){let p=c;for(const t of m)p=p[t];return p}function Ta(m){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,p=arguments.length>2&&arguments[2]!==void 0&&arguments[2],t=null,f=_S(m,p?c:Se.getMainEditorState().toJSON());return f&&(t=Aa(f)?(0,be.$getRoot)():Nn.get(f.codoxId)),t||ce.debug("[WARNING][getLexicalNodeByPathOutOfJSONState] lexical node not found: ",{jsonNode:f,lexicalNode:t,pathArray:m,currentStateJSON:Se.getMainEditorState().toJSON(),newStateJSON:c,codoxNodes:Nn.nodesToArray(),searchInNewState:p}),t||(p?t:Ta(m,c,!0))}function cy(m){ce.log("[applyFullLexicalStateReplace] clear current state and apply new");const c=(0,be.$getRoot)();c.clear();let p=Se.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)c.append(t(f))}function xS(m){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(c.length){ce.log("[applyDeltasToLexicalState] Original Deltas: ",{newStateJSON:m,deltas:JSON.parse(JSON.stringify(c))});for(const p of c){let{p:t}=p;const f=t[t.length-1],r=f==="children",n=typeof f=="number",e=!n&&!r,s=bS(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 d=t.slice(0,s),u=m;for(const h of d)u=u[h];let g=Vl(t[o]);ly(a.getWritable()[g],u)}}else{if(r){let o=p.oi;if(!o){ce.warn("[applyDeltasToLexicalState][====WARNING====] SKIPPED. Delta oi attr expected for path",{delta:p});continue}if(o.some(d=>!(!d.hasOwnProperty("text")||typeof d.text=="string"))){ce.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(d=>!!d.codoxDId)){try{a=a.getWritable()}catch(h){ce.debug("[applyDeltasToLexicalState][shouldUpdateLeaves] getWritable error: ",{err:h,delta:p,fullStateJSON:m});continue}let d={};for(let h of a.getChildren())h.codoxDId?d[h.codoxDId]=h:Mu(h);let u=[],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?u[h-1]:null;if(y.codoxDId){let w=d[y.codoxDId];if(w){w=w.getWritable();let S=Ru(y);if(ce.debug("[DELTA_DECORATOR_UPDATE]: ",{exisingDecorator:w,tmpDecorator:S}),!S){ce.debug("[DELTA_DECORATOR_UPDATE] UPADATE SKIPPED: ",{exisingDecorator:w,tmpDecorator:S});continue}for(let C in S)if(S.hasOwnProperty(C)&&!g.includes(C))if(Se.isLexicalEditorInstance(S[C])){let k={editorState:S[C].getEditorState().toJSON()};ly(w[C],k)}else{let k=sp(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(),sy(w),b=w,delete d[y.codoxDId]}}b||(b=Ru(y),b.codoxDId&&b.__type==="excalidraw"&&b.__data==="[]"&&(b.__data="{}")),b=b.getWritable(),u.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=u.length}for(let h in d){let y=d[h];y=y.getWritable(),sy(y),Mu(y),delete d[h]}}else{let d=o.map(u=>Ru(u));a.splice(0,a.getChildrenSize(),d)}}if(n){if(p.ld){const o=p.ld,a=Nn.get(o.codoxId);a.getChildrenSize&&a.getChildrenSize()?Mu(a):a.remove()}if(p.li){let o=Se.getMainEditorNodesClassesMap();const a=p.li,d=o.get(a.type).klass.importJSON(a);if(t.length===1&&t[0]==="root")(0,be.$getRoot)().splice(0,0,[d]);else{const u=t[t.length-1];t.length=t.length-2;let g=Ta(t,m);g&&g.splice(u,0,[d])}if(a.children&&a.children.length){let u=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)u(v,y)};for(const g of a.children)u(g,d)}}if(p.oi||p.od){let{p:o,oi:a,od:d}=p,u=Ta(o,m);if(u)try{let g=u.getWritable();if(a){let h=Object.keys(a);for(let y of h)g[Vl(y)]=a[y]}if(d){let h=Object.keys(d);for(let y of h)delete g[Vl(y)]}}catch(g){ce.debug("[applyDeltasToLexicalState][delta oi/od] getWritable error: ",{err:g,delta:p})}}if(l){let{p:o,lm:a}=p,d=o[o.length-1],u=a,g=u<d,h=Ta(o,m);if(h){let y=h.getParent().getChildren(),v=y[d],_=y[u];g?_.insertBefore(v):_.insertAfter(v)}}}if(e){const o=t[t.length-1];let a=Vl(o);t.length=t.length-1;let d,u=Ta(t,m);if(!u){ce.error("Missing node when update node attr from delta: ",{path:t,delta:p,fullStateJSON:m,currentEditorState:Se.getMainEditorState().toJSON()});continue}try{d=u.getWritable()}catch(h){ce.debug("[applyDeltasToLexicalState][shouldUpdateBlockAttr] getWritable error: ",{err:h,delta:p})}if(!d)continue;let g=p.oi;if(o==="format"&&(g=_w(g)),o==="direction"&&(u.hasOwnProperty(a)||(a="__dir")),!d.hasOwnProperty(a)){let h=Object.keys(d);for(let y of h){let v=sp(y);if(o.startsWith(v)){a=y;break}}}d[a]=g}}else if(p.oi&&p.oi.root)return cy(p.oi)}}else ce.log("[applyDeltasToLexicalState] stop, no deltas: ",c)}function wS(m){let c=m.clipboardData.getData(ww.paste),p=!1;try{c=JSON.parse(c),typeof c=="object"&&c.nodes&&Array.isArray(c.nodes)&&(p=!0)}catch{return!1}if(!p)return!1;if(p){Nn.clearPastedIds();const t=f=>{if(f.codoxId&&Nn.addPastedId(f.codoxId),f.children&&f.children.length)for(const r of f.children)t(r)};for(const f of c.nodes)t(f)}return!1}var SS=m=>{var c={};return on.d(c,m),c};const uy=SS({useCollaborationContext:()=>Mx});var ES=m=>{var c={};return on.d(c,m),c};const Wi=ES({LexicalComposerContext:()=>Jf,useLexicalComposerContext:()=>wr});class dy{constructor(){this.blacklist=Object.keys(q0).reduce((c,p)=>{let t=q0[p];return c[p]=t.reduce((f,r)=>(f[r]=r,f),{}),c},{}),this._isBlacklistedFound=!1,this._clientCallback=null}_shouldSkipNode(c){return c instanceof be.TextNode||c instanceof be.ParagraphNode||c instanceof be.RootNode}setClientCallback(c){this._clientCallback=c}removeClientCallback(){this._clientCallback=null}invokeClientCallback(){this._clientCallback&&this._clientCallback()}trackBlacklisted(c){let p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>2?arguments[2]:void 0;if(pp||p!==Kr.created||this._isBlacklistedFound||!c||!c.__type||this._shouldSkipNode(c))return;let f=t||Se.getMainEditorState(),r=c.__type,n=this.blacklist[r];n&&f.read(()=>{let e=c.getParent();for(;e!==null;){let s=e?e.__type:null;if(!s)return;if(n[s])return ce.warn("[ContentNestingsWatcher][trackBlacklisted] FOUND: ",{targetNode:c,targetType:r,parent:e,parentType:s,mutationType:p}),void(this._isBlacklistedFound=!0);e=e.getParent()}})}trackBlacklistedInNestedEditor(c){let p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>3?arguments[3]:void 0;if(p!==Kr.created||this._isBlacklistedFound||this._shouldSkipNode(c))return;let f=t.__type,r=c.__type;if(!f||!r)return;let n=this.blacklist[r];n&&n[f]&&(this._isBlacklistedFound=!0,ce.warn("[ContentNestingsWatcher][trackBlacklistedInNestedEditor] FOUND: ",{targetNode:c,targetType:r,rootNode:t,rootType:f,mutationType:p}))}isBlacklistedFound(){let c=this._isBlacklistedFound;return c&&(this._isBlacklistedFound=!1),c}}const CS=new dy,Ji=CS,kS=["editorState","prevEditorState","dirtyElements","dirtyLeaves"];function OS(m,c){if(m==null)return{};var p,t,f=TS(m,c);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);for(t=0;t<r.length;t++)p=r[t],c.indexOf(p)>=0||{}.propertyIsEnumerable.call(m,p)&&(f[p]=m[p])}return f}function TS(m,c){if(m==null)return{};var p={};for(var t in m)if({}.hasOwnProperty.call(m,t)){if(c.indexOf(t)>=0)continue;p[t]=m[t]}return p}class AS{constructor(){this.nestedEditorsListenersMap={}}_createNestedEditorUpdatesListener(c,p){let t=!1;return function(f){let{editorState:r,prevEditorState:n,dirtyElements:e,dirtyLeaves:s}=f,i=(OS(f,kS),Se.getMainEditor()),l=Se.getMainEditorState(),o=r.toJSON(),a=n.toJSON(),d=dp(o,a),u=r._selection,g=n._selection,h=!1,y=null,v=Se.isOnlySelectionChanged(e,s),_=c[p];if(ce.debug("[NESTED EDITOR LISTENER] invoked: ",{lexicalNode:c,key:c.__key,onlySelectionChanged:v,newEditorStateJSON:o,prevEditorStateJSON:a,isSameState:d,lexicalSelection:u,prevLexicalSelection:g,mainDirtyLeaves:i._dirtyLeaves.size,mainDirtyElements:i._dirtyElements.size,nestedDirtyLeaves:_._dirtyLeaves.size,nestedDirtyElements:_._dirtyElements.size,nestedEditorKey:_._key}),Ji.isBlacklistedFound())return t=!0,ce.debug("[NESTED EDITOR LISTENER] BLACKLISTED FOUND - revert to prev state"),Se.scanLexicalNodeForNestedEditorAttribute(c)?(_.update(()=>{try{const b=_.parseEditorState(a);if(b.isEmpty())return(0,be.$getRoot)().clear(),!0;_.setEditorState(b)}catch(b){ce.error("[NESTED EDITOR LISTENER] BLACKLISTED FOUND - ROLLBACK ERROR: ",b)}}),void Ji.invokeClientCallback()):void 0;if(t)t=!1;else{if(c.codoxId||c.codoxDId){let b=null;l.read(()=>{b=$e.getNodeAncestorsCodoxIds(c),!c.codoxId&&c.codoxDId&&b.push(c.codoxDId)}),r.read(()=>{let x=sp(p),w=$e.lexicalToJSONNested(u,x,b);y=Se.getCurrentNestedSelectionJSON(),h=$e.equalSelectionsJSON(y,w),h||Se.setNestedSelectionJSON(w)})}d&&h||i.update(()=>{try{ce.debug("[NESTED EDITOR LISTENER] MARKING DIRTY TO TRIGGER UPDATE",{mainTags:i._updateTags,nestedTags:_&&_._updateTags,isSameState:d,isSameSelection:h,onlyNestedSelectionChanged:v,mainDirtyLeaves:i._dirtyLeaves.size,mainDirtyElements:i._dirtyElements.size,nestedDirtyLeaves:_._dirtyLeaves.size,nestedDirtyElements:_._dirtyElements.size,lexicalNode:c,lexicalSelection:u,prevLexicalSelection:g,mainEditorTags:i._updateTags,mainEditorTagsSize:i._updateTags.size}),Se.addUpdateTag({fromNestedEditor:!0}),c.markDirty()}catch(b){ce.error("[NESTED EDITOR LISTENER] MARKING DIRTY TO TRIGGER UPDATE - ERROR: ",b)}})}}}_isNestedEditorManaged(c){return!!this.nestedEditorsListenersMap[c]}gc(){for(let c in this.nestedEditorsListenersMap)if(!Se.getLexicalNodeByKey(c)){let p=this.nestedEditorsListenersMap[c];p&&p(),delete this.nestedEditorsListenersMap[c]}}manageNestedEditorInLexicalNode(c){if(this._isNestedEditorManaged(c.getKey()))return;let p=Se.scanLexicalNodeForNestedEditorAttribute(c);if(p){let t=c[p],f=this._createNestedEditorUpdatesListener(c,p),r=[];t._nodes.forEach((s,i,l)=>{let{klass:o}=s,a=t.registerMutationListener(o,d=>{for(let[u,g]of d)if(g===Kr.created){let h=t.getEditorState()._nodeMap.get(u);h&&Ji.trackBlacklistedInNestedEditor(h,g,t.getEditorState(),c)}});r.push(a)});let n=(0,ks.mergeRegister)(t.registerUpdateListener(f),...r),e=c.getKey();this.nestedEditorsListenersMap[e]=n}}gcNestedEditorListenerInLexicalNode(c){let p=c.getKey(),t=this.nestedEditorsListenersMap[p];t&&(t(),delete this.nestedEditorsListenersMap[p])}manageNestedEditorInClonedLexicalNode(c,p){let t=c.getKey();t!==p.getKey()&&this._isNestedEditorManaged(t)&&(this.gcNestedEditorListenerInLexicalNode(c),this.manageNestedEditorInLexicalNode(p))}setNestedEditorSelection(c){let{nestedSelectionJSON:p,nestedEditor:t}=$e.getNestedSelectionJSONFromMainSelectionJSON(c);if(!t)return!1;let f=!0;return t.update(()=>{try{let r=$e.JSONToLexical(p);(0,be.$setSelection)(r),ce.debug("[setNestedEditorSelection]: lexical nested selection: ",r)}catch(r){ce.error("[setNestedEditorSelection] set nested selection error: ",r),f=!1}}),f}clearListeners(){for(let c in this.nestedEditorsListenersMap){let p=this.nestedEditorsListenersMap[c];p&&p(),delete this.nestedEditorsListenersMap[c]}}}const PS=new AS,ui=PS,jS=function(m){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];try{let p=(0,be.createEditor)({namespace:"validation",nodes:[...c],onError:e=>{throw e},parentEditor:null});const t=new dy,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,Kr.created,r),t.isBlacklistedFound()))throw new Error(Sw)}}catch(p){throw p}};class NS{constructor(){this.removeCandidateTableKeys=new Set,this.validateTableCandidateKeys=new Set,this.tableFixActions=[]}_scanForCellHeaderState(c,p,t,f){if(p.length<f)return null;let r,n=p.some(s=>s.__headerState===Hi.BOTH||s.__headerState===Hi.ROW),e=c.some((s,i)=>{if(s.__size<f)return!1;let l=s.getChildAtIndex(t);return!(!l||l.__headerState!==Hi.BOTH&&l.__headerState!==Hi.COLUMN)});return n&&e?r=Hi.BOTH:n&&!e?r=Hi.ROW:e&&!n&&(r=Hi.COLUMN),r}_isValidCellChildren(c){for(let p of c)if(Ns(p)||!js(p)&&Tn(p))return!1;return!0}_createEmptyCell(){let c=(0,An.$createTableCellNode)();return c.append((0,be.$createParagraphNode)()),c}_wrapInvalidCellChildrenIntoParagraph(c){let p=(0,be.$createParagraphNode)().getWritable(),t=c.getChildren();(c=c.getWritable()).__first=p.__key,c.__last=p.__key,c.__size=1,p.__parent=c.__key,t.forEach((f,r)=>{(f=f.getWritable()).__parent=null,p.append(f)})}_createFixAction_APPEND_CELLS_TO_ROW(c,p){return()=>{ce.debug("[TablesValidator][FIX TABLE ACTION - APPEND_CELLS_TO_ROW] invoked: ",{rowKey:c,numOfCellsToAppend:p});let t=(0,be.$getNodeByKey)(c);for(;p;){let f=(0,An.$createTableCellNode)().append((0,be.$createParagraphNode)());f.setRowSpan(1).setColSpan(1),t.append(f),p--}}}_createFixAction_ADD_PARAGRAPH_TO_EMPTY_CELL(c){return()=>{ce.debug("[TablesValidator][FIX TABLE ACTION - ADD_PARAGRAPH_TO_EMPTY_CELL] invoked: ",{cellKey:c}),(0,be.$getNodeByKey)(c).append((0,be.$createParagraphNode)())}}_createFixAction_WRAP_CELL_CHILDREN_IN_PARAGRAPH(c){return()=>{ce.debug("[TablesValidator][FIX TABLE ACTION - WRAP_CELL_CHILDREN_IN_PARAGRAPH] invoked: ",{cellKey:c});let p=(0,be.$getNodeByKey)(c);this._wrapInvalidCellChildrenIntoParagraph(p)}}_createFixAction_ADD_ROW_CELL_TO_TABLE_NODE(c){return()=>{ce.debug("[TablesValidator][FIX TABLE ACTION - ADD_ROW_CELL_TO_EMPTY_TABLE_NODE] invoked: ",{tableKey:c});let p=(0,be.$getNodeByKey)(c),t=(0,An.$createTableRowNode)();t.append(this._createEmptyCell()),p.append(t)}}_createFixAction_ADD_CELL_TO_EMPTY_ROW_NODE(c,p){return()=>{for(p||(p=1);p;)(0,be.$getNodeByKey)(c).append(this._createEmptyCell()),p--}}_createFixAction_WRAP_INVALID_ROW_NODE(c,p){return()=>{ce.debug("[TablesValidator][FIX TABLE ACTION - WRAP_INVALID_ROW_NODE] invoked: ",{tableKey:c,rowKey:p});let t=(0,be.$getNodeByKey)(c);if(!t)return;let f=(0,be.$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,An.$createTableRowNode)();if((0,An.$isTableCellNode)(f))f.getChildren().length?this._isValidCellChildren()||this._wrapInvalidCellChildrenIntoParagraph(f):f.append((0,be.$createParagraphNode)()),e.append(f);else{let s=this._isValidCellChildren([f]),i=(0,An.$createTableCellNode)();if(e.append(i),s)i.append(f);else{let l=(0,be.$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(c,p){return()=>{ce.debug("[TablesValidator][FIX TABLE ACTION - WRAP_INVALID_CELL_NODE] invoked: ",{rowKey:c,cellKey:p});let t=(0,be.$getNodeByKey)(c);if(!t)return;let f=(0,be.$getNodeByKey)(p);if(f.remove(),f=(0,be.$createParagraphNode)(),!f)return;t=t.getWritable(),f=f.getWritable();let r=f.getPreviousSibling(),n=f.getNextSibling(),e=(0,An.$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,be.$createParagraphNode)();s.append(f),e.append(s)}}}_createFixAction_APPLY_HEADER_STATE_TO_CELL(c,p){return()=>{ce.debug("[TablesValidator][FIX TABLE ACTION - APPLY_HEADER_STATE_TO_CELL] invoked: ",{cellKey:c,headerStateToApply:p});let t=(0,be.$getNodeByKey)(c);t&&(t=t.getWritable(),t.__headerState=p)}}clear(){this.removeCandidateTableKeys=new Set,this.validateTableCandidateKeys=new Set,this.tableFixActions=[]}tableRemoveEventListener(c){let p=Se.getMainEditorState()._selection;if(ce.debug(`[${c}]`,{selection:p}),!(0,be.$isRangeSelection)(p))return;let t=[];try{let f=Se.getLexicalNodeByKey(p.anchor.key),r=Se.getLexicalNodeByKey(p.focus.key);f&&r&&(t=p.isBackward()?r.getNodesBetween(f):f.getNodesBetween(r))}catch(f){ce.warn("[TablesValidator][tableRemoveEventListener] get range selection nodes internal lexical error: ",f)}t.forEach(f=>{(0,An.$isTableNode)(f)&&this.removeCandidateTableKeys.add(f.__key)})}tableNodeRemoveListener(c){this.removeCandidateTableKeys.has(c)&&this.removeCandidateTableKeys.delete(c)}shouldGCRemovedTables(){return!!this.removeCandidateTableKeys.size}gcRemovedTables(){ce.debug("[TablesValidator][gcRemovedTable] candidate table keys ",{tableKeys:this.removeCandidateTableKeys}),Se.getMainEditor().update(()=>{Array.from(this.removeCandidateTableKeys).forEach(c=>{let p=(0,be.$getNodeByKey)(c);p&&p.remove()}),this.removeCandidateTableKeys.clear(),(0,be.$addUpdateTag)(io.historic)})}tableUpdateListener(c){this.validateTableCandidateKeys.add(c)}tableRowNodeChangesListener(c){let p=arguments.length>1&&arguments[1]!==void 0&&arguments[1],t=Se.getLexicalNodeByKey(c);if(!t)return void(p&&ce.debug("[TablesValidator][tableRowNodeChangesListener] no row node found in lexical: ",{tableRowNodeKey:c}));let f=t.__parent;f?this.validateTableCandidateKeys.add(f):ce.debug("[tableRowNodeChangesListener] no parent table for row node found in lexical: ",{rowNode:t})}tableCellNodeChangesListener(c){let p=Se.getLexicalNodeByKey(c);if(!p||!p.__parent)return;let t=Se.getLexicalNodeByKey(p.__parent);t&&t.__parent&&this.validateTableCandidateKeys.add(t.__parent)}shouldValidateUpdatedTables(){return!!this.validateTableCandidateKeys.size}validateUpdatedTables(){let c=Array.from(this.validateTableCandidateKeys);return Se.getMainEditorState().read(()=>{for(let p of c){let t=Se.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,An.$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 u=[];n.forEach(g=>{let[h,y]=g;a+=y,h--,h&&u.push([h,y])}),n=[...u]}let d=o.map((u,g)=>{if(!(0,An.$isTableCellNode)(u))return this.tableFixActions.push(this._createFixAction_WRAP_INVALID_CELL_NODE(i.__key,u.__key)),a++,"invalid_cell_node_should_wrap_in_cell";let h,y=u.getChildren(),v=!y.length;if(v?this.tableFixActions.push(this._createFixAction_ADD_PARAGRAPH_TO_EMPTY_CELL(u.__key)):(h=this._isValidCellChildren(y),h||this.tableFixActions.push(this._createFixAction_WRAP_CELL_CHILDREN_IN_PARAGRAPH(u.__key))),u.__rowSpan>1){let _=u.__rowSpan,b=u.__colSpan;n.push([_-1,b])}if(a+=u.__colSpan,u.__headerState===Hi.NO_STATUS){let _=this._scanForCellHeaderState(f,o,g,r);_&&this.tableFixActions.push(this._createFixAction_APPLY_HEADER_STATE_TO_CELL(u.__key,_))}return{cellKey:u.__key,rowKey:i.__key,tableKey:p,colSpan:u.__colSpan,rowSpan:u.__rowSpan,headerState:u.__headerState,childrenAreValid:h,isEmptyCell:v}});if(a<r){let u=r-a;this.tableFixActions.push(this._createFixAction_APPEND_CELLS_TO_ROW(i.__key,u))}return{realRowLength:a,rowKey:i.__key,tableKey:p,cells:d}}),s=!this.tableFixActions.length;ce[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 c=Se.getMainEditor();ce.log("[TablesValidator][fixTablesStructure]: fix actions to apply - count: ",this.tableFixActions.length),c.update(()=>{for(let p of this.tableFixActions)p();this.tableFixActions=[],(0,be.$addUpdateTag)(io.historic)})}ensureDocTablesAreValid(c){return this.shouldGCRemovedTables()?(ce.warn("[TablesValidator][GARBAGE COLLECT TABLE NODES AFTER TABLE REMOVAL ATTEMPT]"),this.gcRemovedTables(),!1):!(this.shouldValidateUpdatedTables()&&(ce.debug("[TablesValidator][shouldValidateUpdatedTables] invoked"),!this.validateUpdatedTables()))||(ce.warn("[TablesValidator][shouldValidateUpdatedTables] INVALID LEXICAL TABLE(S) STRUCTURE FOUND - FIXING",{state:JSON.parse(JSON.stringify(c.toJSON()))}),this.fixTablesStructure(),!1)}}const Ro=new NS,IS=["contentChanged"],RS=["state","remoteSelection"];function fy(m,c){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(m);c&&(t=t.filter(function(f){return Object.getOwnPropertyDescriptor(m,f).enumerable})),p.push.apply(p,t)}return p}function As(m){for(var c=1;c<arguments.length;c++){var p=arguments[c]!=null?arguments[c]:{};c%2?fy(Object(p),!0).forEach(function(t){MS(m,t,p[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):fy(Object(p)).forEach(function(t){Object.defineProperty(m,t,Object.getOwnPropertyDescriptor(p,t))})}return m}function MS(m,c,p){return(c=DS(c))in m?Object.defineProperty(m,c,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[c]=p,m}function DS(m){var c=LS(m,"string");return typeof c=="symbol"?c:c+""}function LS(m,c){if(typeof m!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var t=p.call(m,c||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(m)}function py(m,c){if(m==null)return{};var p,t,f=BS(m,c);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);for(t=0;t<r.length;t++)p=r[t],c.indexOf(p)>=0||{}.propertyIsEnumerable.call(m,p)&&(f[p]=m[p])}return f}function BS(m,c){if(m==null)return{};var p={};for(var t in m)if({}.hasOwnProperty.call(m,t)){if(c.indexOf(t)>=0)continue;p[t]=m[t]}return p}const pp={DEBUG:!1,VERSION:"1.0.2",NAME:"@codoxhq/lexical-provider",SDKUI_SOURCE_PATH:"../../../sdkui/dist-production2/codox.bundle.js"}.LOCAL==="true";ce.info("MODE: ","production");const FS=m=>async()=>{const{state:c,timestamp:p}=await m();if(!Se.isValidJSONState(c))throw new Error("Invalid state received from fetchDocOnNetworkReconnect hook");const{commentThreads:t,root:f}=c,r={content:{comments:t,root:f},timestamp:p};return ce.info("[decorateFetchOnReconnctHook] hook invoked: ",{returnObj:r}),r};let Du=0,di=null,hp=!1,Eo={},gp={};const zS=(0,Gt.forwardRef)((m,c)=>{let{onBlacklistedInsert:p}=m;const t=(0,Gt.useContext)(Wi.LexicalComposerContext);if(!t)throw new Error("[CodoxCollabPlugin] CodoxCollabPlugin must be inited inside <LexicalComposer> component - LexicalComposerContext is missing");const[f]=(0,Wi.useLexicalComposerContext)(),r=(0,uy.useCollaborationContext)();(0,Gt.useEffect)(()=>{if(ce.debug("[INIT] lexical context check: ",{lexicalContext:t,editor:f}),!f)return;ce.log("[useEffect][editor] Editor instance changed: ",{editor:f,key:f._key}),Se.setMainEditor(f),Nn.gcAbandonedNodes(),ui.gc(),Ro.clear(),ce.log("[useEffect][editor] subscribe to editor changes");const v=(0,ks.mergeRegister)(f.registerUpdateListener(g),f.registerCommand(be.PASTE_COMMAND,wS,be.COMMAND_PRIORITY_CRITICAL),f.registerCommand(be.UNDO_COMMAND,()=>{Se.setUndoInvoked(!0)},be.COMMAND_PRIORITY_CRITICAL),f.registerCommand(be.REDO_COMMAND,()=>{Se.setRedoInvoked(!0)},be.COMMAND_PRIORITY_CRITICAL),f.registerCommand(be.KEY_DELETE_COMMAND,(b,x)=>{Ro.tableRemoveEventListener("KEY_DELETE_COMMAND")},be.COMMAND_PRIORITY_CRITICAL),f.registerCommand(be.KEY_BACKSPACE_COMMAND,(b,x)=>{Ro.tableRemoveEventListener("KEY_BACKSPACE_COMMAND")},be.COMMAND_PRIORITY_CRITICAL),f.registerCommand(be.CUT_COMMAND,(b,x)=>{Ro.tableRemoveEventListener("CUT_COMMAND")},be.COMMAND_PRIORITY_CRITICAL),...h());So.mount(),Se.alignStateSelectionJSONsFromLatestEditor(),ce.debug("New editor mounted: ",{isCodoxStarted:Se.isCodoxStarted,codoxLexicalEditorManager:Se,nestedEditorsProcessor:ui});let _=f._onError;return f._onError=b=>{ce.error("[ERROR HANDLER WRAPPER] error from editor: ",b),_&&_(b),u()},p&&Ji.setClientCallback(p),()=>{Se.getMainEditorKey()&&(ce.debug("Unmount prev editor"),v(),Se.removeMainEditor(),So.unmount(),Se.clearJSONs(),On.clear(),Ro.clear(),Se.isCodoxStarted&&(ce.debug("EDITOR USE_EFFECT stopping codox"),n(),Se.setIsCodoxStarted(!1)),Ji.removeClientCallback())}},[f]);const n=()=>{Se.isCodoxStarted&&(ce.log("[stopCodoxInstance] stopping codox"),Se.setIsCodoxStarted(!1),pp||ri().stop(),Se.clearJSONs(),Nn.clearAll(),So.clear(),On.resetComments(),ui.clearListeners())},e=async v=>{ce.debug("[startCodoxInstance] invoked"),ri().createNewInstance(),ce.debug("[startCodoxInstance] instance created");for(let O in gp)ri().instance.on(O,gp[O]);if(ce.debug("[startCodoxInstance] events subscribed"),Eo=v,di=Eo.docId,!di)return ce.error("[startCodoxInstance] - start codox skipped - docId is missing",{docId:di});let _=On.initialCommentsExist();ce.debug("[startCodoxInstance] initCommentsExist: ",_),_&&(On.activateInitialComments(f,Nn),ce.log("[activateInitialComments] "));let b=Se.getMainEditorState().toJSON();if(!Se.isValidJSONState(b))throw ce.error("[startCodoxInstance] - start codox skipped - invalid init state",{docId:di,initJSONState:b}),new Error("start codox skipped - invalid init state");ce.log("[startCodoxInstance] starting codox with: ",{docId:di,initJSONState:b,config:Eo,codoxComments:On}),Se.currentContentStateJSON||Se.setCurrentContentStateJSON(b),Se.isCodoxStarted&&n();let{username:x,apiKey:w,getServerState:S,domain:C="",demo:k=!1,hooks:D}=Eo;D&&D.fetchDocOnNetworkReconnect&&(D.fetchDocOnNetworkReconnect=FS(D.fetchDocOnNetworkReconnect));const N=py(D,IS);await ri().start(ri().createConfig(As(As({},Eo),{},{docId:di,username:x,apiKey:w,domain:C,hooks:As({syncState:l,getState:i,getServerState:async()=>await S(di)},N),editorInstanceHooks:{getSelection:()=>Se.getCurrentActiveSelectionJSON(),setSelection:O=>o(O),getState:i,setState:O=>{const{root:R,comments:A}=O;ce.info("DEBUG: EDITOR INSTANCE setState:",{fullState:O}),a({state:{root:R},selection:Se.getCurrentActiveSelectionJSON()},So.getCurrentRemoteSelections()),On.setAllComments(A)},enableEditor:()=>{Se.disableEditorReadOnlyMode()},disableEditor:()=>{Se.enableEditorReadOnlyMode(),So.updateRemoteSelections([])},getContent:()=>{let O=Se.composeFullStateWithRootAndComments();return ce.info("[getContent]: ",O),{state:O}}},appServer:Eo.appServer,demo:k}))),ce.log("[startCodoxInstance] codox started - first sync invoking"),Se.setIsCodoxStarted(!0),r.clientID=Eo.username,r.name=Eo.username,d()},s=()=>{let v=Se.composeFullStateWithRootAndComments({directlyFromEditor:!0});e(v)},i=()=>({state:As(As({},Se.getMainEditorState().toJSON()),{},{comments:On.getAllComments()}),docId:di}),l=v=>{if(!Se.isCodoxStarted)return;ce.log("[SYNC_STATE]: Before sync payload = ",v);const _=ri().sync({meta:v}),{state:b,remoteSelection:x=[]}=_,w=py(_,RS);if(ce.log("[SYNC_STATE]: After sync",{state:b,remoteSelection:x,rest:w}),!b)return ce.error("[SYNC_STATE] abort apply - synced state is not valid - restarting codox"),s();const S=b.state;ce.log("[SYNC_STATE] synced state: ",{synced:JSON.parse(JSON.stringify(S))});let{stateFromSync:C,commentsFromSync:k}=Se.extractStateAndCommentsFromSynced(S);if(!Se.isValidJSONState(C.state))return ce.error("[SYNC_STATE] - invalid state from sync - local update skipped - restarting codox",{contentState:C.state}),s();a(C,x),On.setAllComments(k)},o=v=>{if(!Se.isCodoxStarted||(ce.log("[setLocalSelectionFromSync] synced selection: ",{syncedSelectionJSON:v}),!fp.validateJSONSelection(v,lp.local)))return;let _=Se.getCurrentActiveSelectionJSON();if($e.equalSelectionsJSON(_,v))return void ce.log("[setLocalSelectionFromSync] STOP - local and synced selections are equal");let b=$e.isNestedSelectionJSON(v);f.update(()=>{ce.log("[setLocalSelectionFromSync] json selection to apply: ",{syncedSelectionJSON:v});const x=$e.JSONToLexical(v);if(ce.log("[setLocalSelectionFromSync] lexical selection to apply: ",x),b){let w=ui.setNestedEditorSelection(v);Se.setNestedSelectionJSON(w?v:null)}else(0,be.$setSelection)(x),Se.setMainSelectionJSON(v);ce.log("[setLocalSelectionFromSync] selection updated. latest selection: ",{latestSelectionJSON:Se.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=Se.getCurrentContentStateJSON();ce.log("[updateEditor] invoked: ",{currentContentStateJSON:JSON.parse(JSON.stringify(S)),newStateJSON:JSON.parse(JSON.stringify(v)),newSelectionJSON:_,remoteSelection:x,stateReplace:b,editor:f}),_===void 0&&ce.error("SELECTION FROm SYNC IS UNDEFINED - will default prev selection",_);const C=dp(S,v),k=$e.equalSelectionsJSON(Se.getCurrentActiveSelectionJSON(),_);f.update(()=>{if(Se.addUpdateTag({isSameState:C,isSameSelection:k,updateTag:w}),b)ce.log("[updateEditor] invoke full stateReplace after sync"),cy(v),S=Se.setCurrentContentStateJSON(v),(0,be.$addUpdateTag)("codox_sync_state_changes"),ce.log("[updateEditor] state updated: ",S);else{ce.log("[updateEditor] invoke deltas diff");let N=ri().diff(S,v,{keyNames:{default:"codoxId"}});ce.log("JSON_DIFF_ANALYSIS: ",{currentContentStateJSON:JSON.parse(JSON.stringify(S)),newStateJSON:v,deltas:N&&JSON.parse(JSON.stringify(N))}),N&&N.length&&(ce.log("[updateEditor] apply deltas to lexical state"),xS(v,N),S=Se.setCurrentContentStateJSON(v),(0,be.$addUpdateTag)("codox_sync_state_changes"),ce.log("[updateEditor] state updated: ",S))}let D=$e.isNestedSelectionJSON(_);if(fp.validateJSONSelection(_,lp.local)||(_=Se.getCurrentActiveSelectionJSON()),D){let N=ui.setNestedEditorSelection(_);Se.setNestedSelectionJSON(N?_:null),ce.log("[updateEditor] nested selection updated",N?_:null)}else if(_!==void 0){const N=$e.JSONToLexical(_);ce.log("[updateEditor] updated selection to apply: ",{isSameSelection:k,newSelectionJSON:_,lexicalSelection:N}),(0,be.$setSelection)(N),Se.setMainSelectionJSON(_),ce.log("[updateEditor] selection updated",_)}},{onUpdate:()=>{C||So.updateRemoteSelections(x,"from onUpdate hook")}}),C&&So.updateRemoteSelections(x,"from direct updateEditor")},d=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(!Se.isCodoxStarted)return;ce.log("[invokeSync] SYNC INVOKED ",{upd_call_counter:v});let _=Se.composeFullStateWithRootAndComments();const b={docId:di,state:{state:_,selection:Se.getCurrentActiveSelectionJSON()}};ce.log("[codoxSync]: Before sync",{local:b,upd_call_counter:v}),ce.log("[codoxSync]: Before sync state",JSON.parse(JSON.stringify(b.state)));let{state:x,remoteSelection:w=[],changes:S}=ri().sync({state:b,meta:{}});if(ce.log("[codoxSync]: After sync",{afterSyncState:JSON.parse(JSON.stringify(x)),remoteSelection:w,changes:S}),!x)return ce.error("[codoxSync] abort apply - synced state is not valid - restarting codox "),s();const C=x.state;ce.log("[codoxSync]: synced state: ",JSON.parse(JSON.stringify(C)),v);let{stateFromSync:k,commentsFromSync:D}=Se.extractStateAndCommentsFromSynced(C);if(!Se.isValidJSONState(k.state))return ce.error("[invokeSync] - invalid state from sync - local update skipped - restarting codox",{contentState:k.state}),s();a(k,w),On.setAllComments(D)},u=()=>{ce.warn("[rollbackStateDuringUpdateError] rollback invoked"),ce.log("[rollbackStateDuringUpdateError] values: ",{prevState:Se.getPrevContentStateJSON(),currentState:Se.getCurrentContentStateJSON(),prevSelection:Se.getPrevMainSelectionJSON(),currentSelection:Se.getCurrentActiveSelectionJSON(),codoxComments:On});let v=Se.getPrevContentStateJSON(),_=Se.getPrevMainSelectionJSON();a({state:v,selection:_},So.getCurrentRemoteSelections(),io.historic);let b=Se.undoInvoked(),x=Se.redoInvoked();On.gcAbandonedNodeKeys(Se.getMainEditorState()._nodeMap),b&&f.dispatchCommand(be.CAN_REDO_COMMAND,!1),x&&f.dispatchCommand(be.CAN_UNDO_COMMAND,!1)},g=v=>{let{editorState:_,prevEditorState:b,tags:x,dirtyElements:w,dirtyLeaves:S}=v;if(hp)return hp=!1,void ce.debug("[editorUpdatesListener] invoked blacklisted queued selection change - stop");if(Ji.isBlacklistedFound())return hp=!0,ce.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,j=null;V.read(()=>{let L=(0,be.$getSelection)();j=$e.lexicalToJSON(L),T=V.toJSON()}),Se.setCurrentContentStateJSON(T),Se.setMainSelectionJSON(j),a({state:F,selection:z},So.getCurrentRemoteSelections(),io.historic),f.dispatchCommand(be.CAN_REDO_COMMAND,!1),f.dispatchCommand(be.CAN_UNDO_COMMAND,!1)})(_,b),void Ji.invokeClientCallback();if(!Ro.ensureDocTablesAreValid(_))return;Du++,ce.log("[editorUpdatesListener] invoked by lexical. call counter: ",{upd_call_counter:Du,isCodoxStarted:Se.isCodoxStarted});let C=Se.isOnlySelectionChanged(w,S),k=null,D=null,N=null,O=null,R=Se.getCurrentContentStateJSON(),A=x.has("codox_sync_state_changes"),U=x.has(Kl),H=Se.undoInvoked(),q=Se.redoInvoked(),M=Se.canUndo(),W=Se.canRedo();k=_.toJSON(),D=b.toJSON(),b.read(()=>{O=$e.lexicalToJSON(b._selection)}),_.read(()=>{let V=(0,be.$getSelection)();N=$e.lexicalToJSON(V);let K=$e.JSONToLexical(N),z=V===null&&K===null||V.is(K);ce.log("[editorUpdatesListener] new values: ",{newContentStateJSON:k,currentContentStateJSON:JSON.parse(JSON.stringify(R)),prevContentStateJSON:JSON.parse(JSON.stringify(D)),currentCommentsJSON:JSON.parse(JSON.stringify(On.getAllComments())),newSelectionJSON:JSON.parse(JSON.stringify(N)),currentMainSelectionJSON:JSON.parse(JSON.stringify(Se.getCurrentMainSelectionJSON())),currentNestedSelectionJSON:JSON.parse(JSON.stringify(Se.getCurrentNestedSelectionJSON())),currentActiveSelectionJSON:JSON.parse(JSON.stringify(Se.getCurrentActiveSelectionJSON())),lexicalSelection:V,convertedBackMainSelection:K,isMainSelectionConvertionCorrect:z,nodes:f._editorState._nodeMap,fullEditor:f,codoxNodesMap:Nn.toArray(),codoxComments:On,isUpdateFromSync:A,isUpdateFromComments:U,tags:x,onlySelectionChanged:C,undoInvoked:H,redoInvoked:q,canUndo:M,canRedo:W})});let G=dp(R,k),I=$e.equalSelectionsJSON(Se.getCurrentActiveSelectionJSON(),N);ce.log("[editorUpdatesListener] compares: ",{isStateSame:G,isSelectionSame:I});let $=G&&I&&!U;if(!G||U||A){let V=As({},G?R:k),K=On.getAllComments();K.length&&(V.commentThreads=K);let z={source:A?W0.remote:W0.local,content:V};Eo.hooks&&Eo.hooks.contentChanged&&Eo.hooks.contentChanged(z),ri().instance.emit("content_changed",z)}if($)ce.log("[editorUpdatesListener] STOP - state and selection and comments are same ",Du);else if(Se.undoInvoked()&&Se.setUndoInvoked(!1),Se.redoInvoked()&&Se.setRedoInvoked(!1),Se.setCurrentContentStateJSON(k),Se.setPrevContentStateJSON(D),Se.setMainSelectionJSON(N),Se.setPrevMainSelectionJSON(O),pp){let V=Se.getCurrentActiveSelectionJSON();a({state:Se.getCurrentContentStateJSON(),selection:V},[])}else d(Du)},h=()=>{let v=[];return Se.getMainEditorNodesClassesMap().forEach((_,b,x)=>{let{klass:w}=_,S=f.registerMutationListener(w,C=>{for(let[k,D]of C){if(!Kr[D])continue;const N=Se.getLexicalNodeByKey(k);if(D===Kr.created&&N&&Ji.trackBlacklisted(N,D),w.name===An.TableNode.name&&(D===Kr.destroyed?Ro.tableNodeRemoveListener(k):Ro.tableUpdateListener(k)),w.name===An.TableRowNode.name&&D!==Kr.destroyed&&Ro.tableRowNodeChangesListener(k,D===Kr.updated),w.name===An.TableCellNode.name&&D===Kr.updated&&Ro.tableCellNodeChangesListener(k),w.name===oo.MarkNode.name&&(ce.debug("[MUTATION LISTENER] MARK node: ",{nodeKey:k,node:N,mutationType:D,codoxComments:On}),D===Kr.destroyed?On.removeRelatedNodeKey(k):N&&On.addRelatedNodeKey(N.__key,N.__ids,D===Kr.created)),N&&N.codoxId){if(D===Kr.destroyed)return void(N.codoxId&&Nn.remove(N.codoxId));xy(N)||ce.warn("[MutationListener Error] duplicating codoxId detected - such codoxId already exists in codoxNodesMap - updating node ref to latest: ",{mutationType:D,node:N}),Nn.add(N.codoxId,N)}}v.push(S)})}),v},y={start:e,stop:n,on:(v,_)=>{ce.info(`Subscribing client to codox ${v} event`),gp[v]=_},cursor:{hide:()=>{So.hideRemoteSelectionsFromUI()},show:()=>{So.showHiddenRemoteSelectionsInUI()}},initComments:v=>{On.setInitialComments(v)}};return(0,Gt.useImperativeHandle)(c,()=>y),null}),US=zS,$S=["comments"];function hy(m,c){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(m);c&&(t=t.filter(function(f){return Object.getOwnPropertyDescriptor(m,f).enumerable})),p.push.apply(p,t)}return p}function mp(m){for(var c=1;c<arguments.length;c++){var p=arguments[c]!=null?arguments[c]:{};c%2?hy(Object(p),!0).forEach(function(t){HS(m,t,p[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):hy(Object(p)).forEach(function(t){Object.defineProperty(m,t,Object.getOwnPropertyDescriptor(p,t))})}return m}function HS(m,c,p){return(c=qS(c))in m?Object.defineProperty(m,c,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[c]=p,m}function qS(m){var c=WS(m,"string");return typeof c=="symbol"?c:c+""}function WS(m,c){if(typeof m!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var t=p.call(m,c||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(m)}function JS(m,c){if(m==null)return{};var p,t,f=VS(m,c);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);for(t=0;t<r.length;t++)p=r[t],c.indexOf(p)>=0||{}.propertyIsEnumerable.call(m,p)&&(f[p]=m[p])}return f}function VS(m,c){if(m==null)return{};var p={};for(var t in m)if({}.hasOwnProperty.call(m,t)){if(c.indexOf(t)>=0)continue;p[t]=m[t]}return p}class KS extends $0{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(c){this._canUndo=c}setCanRedo(c){this._canRedo=c}canUndo(){return this._canUndo}canRedo(){return this._canRedo}setUndoInvoked(c){this._undoInvoked=c}setRedoInvoked(c){this._redoInvoked=c}undoInvoked(){return this._undoInvoked}redoInvoked(){return this._redoInvoked}setIsCodoxStarted(){let c=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this._isCodoxStarted=c}get isCodoxStarted(){return this._isCodoxStarted}getMainEditorKey(){return this.mainEditorKey}setMainEditor(c){this.mainEditor=c,this.mainEditorKey=c._key}clearJSONs(){ce.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,be.$getSelection)()))})}mainEditorExists(){return!!this.mainEditor}getMainEditorState(){return this.mainEditor?this.mainEditor.getEditorState():{}}getMainEditorNodesClassesMap(){return this.mainEditor?this.mainEditor._nodes:new Map}getLexicalNodeByKey(c){return this.mainEditor?this.getMainEditorState()._nodeMap.get(c):null}isLexicalEditorInstance(c){return c&&typeof c=="object"&&!!c.setEditorState}setCurrentContentStateJSON(c){return this.currentContentStateJSON=c,this.currentContentStateJSON}getCurrentContentStateJSON(){return this.currentContentStateJSON}setPrevContentStateJSON(c){this.prevContentStateJSON=c}getPrevContentStateJSON(){return this.prevContentStateJSON}setMainSelectionJSON(c){this.currentMainSelectionJSON=c,this.currentMainSelectionJSON&&this.currentNestedSelectionJSON&&(this.currentNestedSelectionJSON=null)}setNestedSelectionJSON(c){this.currentNestedSelectionJSON=c,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(c){this.prevMainSelectionJSON=c}getPrevMainSelectionJSON(){return this.prevMainSelectionJSON}extractStateAndCommentsFromSynced(c){let{state:{comments:p},selection:t,stateReplace:f}=c;return{stateFromSync:{state:mp({},JS(c.state,$S)),selection:t,stateReplace:f},commentsFromSync:p}}composeFullStateWithRootAndComments(){let{directlyFromEditor:c=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return mp(mp({},c?this.getMainEditorState().toJSON():this.currentContentStateJSON),{},{comments:On.getAllComments()})}isValidJSONState(c){let p=!1;try{if(!c)throw new Error("State is undefined");if(!c.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 be.ElementNode,o=i.prototype instanceof be.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(c.root),p=!0}catch(t){ce.error("[isValidJSONState] invalid state found: ",t.message),p=!1}return p}scanLexicalNodeForNestedEditorAttribute(c){for(let p in c){let t=c[p];if(this.isLexicalEditorInstance(t))return p}return""}isOnlySelectionChanged(c,p){return c.size===0&&p.size===0}addUpdateTag(){let{isSameState:c,isSameSelection:p,fromNestedEditor:t=!1,updateTag:f=""}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return f?(ce.log(`[addUpdateTag] explicit add of tag "${f}" `),void(0,be.$addUpdateTag)(f)):t?(ce.log(`[addUpdateTag] add "${io.historic}" tag - change invoked by nested editor`),void(0,be.$addUpdateTag)(io.historic)):void(c?(ce.log(`[addUpdateTag] add "${io.historic}" tag - state is same`),(0,be.$addUpdateTag)(io.historic)):(ce.log(`[addUpdateTag] add "${io.historyMerge}" tag - state is different`),(0,be.$addUpdateTag)(io.historyMerge)))}enableEditorReadOnlyMode(){this.mainEditor&&this.mainEditor.isEditable()&&this.mainEditor.setEditable(!1)}disableEditorReadOnlyMode(){this.mainEditor&&(this.mainEditor.isEditable()||this.mainEditor.setEditable(!0))}}const GS=new KS,Se=GS;class YS{constructor(){this._nodesMap=new Map,this._pastedNodesCodoxIds=new Set}get size(){return this._nodesMap.size}add(c,p){this._nodesMap.set(c,p)}get(c){return this._nodesMap.get(c)||null}remove(c){this._nodesMap.delete(c)}has(c){return this._nodesMap.has(c)}nodesToArray(){return Array.from(this._nodesMap.values())}keysToArray(){return Array.from(this._nodesMap.keys())}toArray(){return Array.from(this._nodesMap.entries())}addPastedId(c){this._pastedNodesCodoxIds.add(c)}removePastedId(c){this._pastedNodesCodoxIds.delete(c)}hasPastedId(c){return this._pastedNodesCodoxIds.has(c)}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 c=Se.getMainEditorState();if(!c._nodeMap)return;let p=this.nodesToArray();for(let t of p)c._nodeMap.has(t.__key)||this.remove(t.codoxId)}}const ZS=new YS,Nn=ZS;function gy(m,c){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(m);c&&(t=t.filter(function(f){return Object.getOwnPropertyDescriptor(m,f).enumerable})),p.push.apply(p,t)}return p}function my(m){for(var c=1;c<arguments.length;c++){var p=arguments[c]!=null?arguments[c]:{};c%2?gy(Object(p),!0).forEach(function(t){XS(m,t,p[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):gy(Object(p)).forEach(function(t){Object.defineProperty(m,t,Object.getOwnPropertyDescriptor(p,t))})}return m}function XS(m,c,p){return(c=QS(c))in m?Object.defineProperty(m,c,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[c]=p,m}function QS(m){var c=t2(m,"string");return typeof c=="symbol"?c:c+""}function t2(m,c){if(typeof m!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var t=p.call(m,c||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(m)}const yp=()=>lw(),yy=m=>typeof m=="number";function Ps(m){let c=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:c,writable:!0}),p}const Aa=m=>m.__type==="root"||m.type==="root",vy=m=>Aa(m.getParent()),Wn=m=>m.__type===Pu.text||m.type===Pu.text||m.hasOwnProperty("__text")||m.hasOwnProperty("text"),js=m=>(0,be.$isElementNode)(m),Ns=m=>(0,An.$isTableNode)(m)||(0,An.$isTableRowNode)(m)||(0,An.$isTableCellNode)(m),e2=m=>!m.getChildren,by=m=>!!m.getChildren,Tn=m=>(0,be.$isDecoratorNode)(m),Yl=m=>(0,tw.$isLinkNode)(m),Zl=m=>m.__type==="mark"||m.type==="mark",vp=m=>(0,be.$isLineBreakNode)(m),Vi=m=>Wn(m)||vp(m),bp=m=>m.__type===Pu.horizontalrule||m.type===Pu.horizontalrule,_y=m=>{if(Vi(m)||Yl(m)||Zl(m))return!1;if(!m.__parent||m.__parent==="root"||(0,be.$isParagraphNode)(m))return!0;let c=m.getParent().getChildren();return c.length===1&&c[0].__key===m.__key?!((Tn(m)||Yl(m)||Zl(m))&&!bp(m)):!c.some(p=>{let t=bp(p);return p.__key!==m.__key&&(Vi(p)||Tn(p)&&!t||Yl(p)||Zl(p))})},xy=m=>{const c=Nn.get(m.codoxId);return!c||m.__key===c.__key},Is=function(m){const c=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:null)||yp();m.codoxId=c,Nn.add(c,m)},wy=m=>{Nn.remove(m.codoxId),delete m.codoxId},n2=m=>{if(!by(m)||!m.getChildrenSize())return;const c=m.getChildren();if(c.some(f=>!!(0,be.$isParagraphNode)(f)))return;let p=!1,t=[];for(let f of c)(Vi(f)||Tn(f)||Yl(f)||Zl(f))&&!p&&(bp(f)||(p=!0)),(by(f)||Tn(f))&&t.push(f);for(let f of t)p||f.codoxId?p&&f.codoxId&&(f=f.getWritable(),wy(f)):(f=f.getWritable(),Is(f))},r2=m=>{const c=my({},m);for(const p in m)m[p]===void 0&&m.hasOwnProperty(p)&&delete c[p];return c},o2=m=>{const c=`__nativeCreateDOM_${m.name}`;m.prototype[c]=Ps(m.prototype.createDOM,c),m.prototype.createDOM=function(p,t){if(_y(this))if(this.codoxId){if(!xy(this)){let r=Nn.get(this.codoxId);r.__type===this.__type&&this.isAttached()&&!r.isAttached()?(ce.warn("[createDOM][Non-unique codoxId] overwrite abandoned existing node with latest: ",{latestNode:this,existingNode:r}),Nn.add(this.codoxId,this)):Is(this)}}else Is(this);else this.codoxId&&wy(this);Tn(this)&&!this.codoxDId&&(this.codoxDId=yp()),ui.manageNestedEditorInLexicalNode(this);let f=this[c](p,t);return f.__codox_track=!0,f}},i2=m=>{const c=`__nativeUpdateDOM_${m.name}`;return m.prototype[c]=Ps(m.prototype.updateDOM,c),m.prototype.updateDOM=function(){const p=this[c](...arguments);return n2(this),p},m},a2=m=>{const c=`__nativeRemove_${m.name}`;return m.prototype[c]=Ps(m.prototype.remove,c),m.prototype.remove=function(){const p=this.codoxId;return p&&Nn.remove(p),ui.gcNestedEditorListenerInLexicalNode(this),this[c](...arguments)},m},s2=m=>{const c=`__nativeExportJSON_${m.name}`;m.prototype[c]=Ps(m.prototype.exportJSON,c),m.prototype.exportJSON=function(){const p=this[c]();return this.codoxId&&(p.codoxId=this.codoxId),this.codoxDId&&(p.codoxDId=this.codoxDId),Wn(this)&&yy(p.format)&&this.hasFormat&&(p.format=bw(this)),r2(p)}},l2=m=>{const c="__nativeImportJSON";m[c]=Ps(m.importJSON,c),m.importJSON=function(p){const t=my({},p);Wn(t)&&!yy(t.format)&&(t.format=vw(t.format));const f=m[c](t);ui.manageNestedEditorInLexicalNode(f);const r=_y(f);return r&&t.codoxId&&(Nn.hasPastedId(t.codoxId)&&Nn.has(t.codoxId)?(Nn.removePastedId(t.codoxId),Is(f)):Is(f,t.codoxId)),r&&!f.codoxId&&Is(f),t.codoxDId&&(f.codoxDId=t.codoxDId),f}},c2=m=>{const c="__nativeClone";m[c]=Ps(m.clone,c),m.clone=function(p){const t=m[c](p);return p.codoxId&&(t.codoxId=p.codoxId),p.codoxDId&&(t.codoxDId=p.codoxDId),ui.manageNestedEditorInClonedLexicalNode(p,t),t}},u2=m=>{let c=!1,p=!1,t=!1,f=!1;m.forEach(n=>{n.name===be.TextNode.name?c=!0:n.name===be.ParagraphNode.name?p=!0:n.name===be.LineBreakNode.name?t=!0:n.name===oo.MarkNode.name&&(f=!0)});let r=[];return c||r.push(be.TextNode),p||r.push(be.ParagraphNode),t||r.push(be.LineBreakNode),f||r.push(oo.MarkNode),r.length?[...r,...m]:m},d2=function(){return u2(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).map(m=>(m.hasOwnProperty("__isCodoxExtended")||(o2(m),i2(m),s2(m),a2(m),l2(m),c2(m),Object.defineProperty(m,"__isCodoxExtended",{value:!0,writable:!1})),m))};var Lu=on(777),Rs={};Rs.styleTagTransform=ci(),Rs.setAttributes=si(),Rs.insert=ai().bind(null,"head"),Rs.domAPI=ii(),Rs.insertStyleElement=li(),oi()(Lu.A,Rs),Lu.A&&Lu.A.locals&&Lu.A.locals;var f2=m=>{var c={};return on.d(c,m),c};const p2=f2({AutoFocusPlugin:()=>Pm});var h2=m=>{var c={};return on.d(c,m),c};const g2=h2({ClearEditorPlugin:()=>Lx});var m2=m=>{var c={};return on.d(c,m),c};const y2=m2({LexicalComposer:()=>Am});var v2=m=>{var c={};return on.d(c,m),c};const Sy=v2({default:()=>Fx});var b2=m=>{var c={};return on.d(c,m),c};const _2=b2({HistoryPlugin:()=>Gm});var x2=m=>{var c={};return on.d(c,m),c};const w2=x2({OnChangePlugin:()=>Ux});var S2=m=>{var c={};return on.d(c,m),c};const E2=S2({PlainTextPlugin:()=>Gx});var C2=m=>{var c={};return on.d(c,m),c};const Ey=C2({$isRootTextContentEmpty:()=>Zm,$rootTextContent:()=>Ym});var k2=m=>{var c={};return on.d(c,m),c};const Ms=k2({createPortal:()=>a1.createPortal}),O2=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,T2=O2?Gt.useLayoutEffect:Gt.useEffect,Cy=T2;var Bu=on(253),Ds={};Ds.styleTagTransform=ci(),Ds.setAttributes=si(),Ds.insert=ai().bind(null,"head"),Ds.domAPI=ii(),Ds.insertStyleElement=li(),oi()(Bu.A,Ds),Bu.A&&Bu.A.locals&&Bu.A.locals;function A2(m){let{onClose:c,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"&&c()},s=l=>{const o=l.target;r.current!==null&&!r.current.contains(o)&&f&&c()},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,c]),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:c},"X"),Gt.createElement("div",{className:"Modal__content"},p)))}function P2(m){let{onClose:c,children:p,title:t,closeOnClickOutside:f=!1}=m;return(0,Ms.createPortal)(Gt.createElement(A2,{onClose:c,title:t,closeOnClickOutside:f},p),document.body)}function ky(){const[m,c]=(0,Gt.useState)(null),p=(0,Gt.useCallback)(()=>{c(null)},[]),t=(0,Gt.useMemo)(()=>{if(m===null)return null;const{title:r,content:n,closeOnClickOutside:e}=m;return Gt.createElement(P2,{onClose:p,title:r,closeOnClickOutside:e},n)},[m,p]),f=(0,Gt.useCallback)(function(r,n){c({closeOnClickOutside:arguments.length>2&&arguments[2]!==void 0&&arguments[2],content:n(p),title:r})},[p]);return[t,f]}var Fu=on(191),Ls={};Ls.styleTagTransform=ci(),Ls.setAttributes=si(),Ls.insert=ai().bind(null,"head"),Ls.domAPI=ii(),Ls.insertStyleElement=li(),oi()(Fu.A,Ls),Fu.A&&Fu.A.locals&&Fu.A.locals;const j2={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"}},N2=j2;var zu=on(72),Bs={};Bs.styleTagTransform=ci(),Bs.setAttributes=si(),Bs.insert=ai().bind(null,"head"),Bs.domAPI=ii(),Bs.insertStyleElement=li(),oi()(zu.A,Bs),zu.A&&zu.A.locals&&zu.A.locals;function I2(){for(var m=arguments.length,c=new Array(m),p=0;p<m;p++)c[p]=arguments[p];return c.filter(Boolean).join(" ")}function _p(){return _p=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var t in p)({}).hasOwnProperty.call(p,t)&&(m[t]=p[t])}return m},_p.apply(null,arguments)}function Ki(m){let{"data-test-id":c,children:p,className:t,onClick:f,disabled:r,small:n,title:e}=m;return Gt.createElement("button",_p({disabled:r,className:I2("Button__root",r&&"Button__disabled",n&&"Button__small",t),onClick:f,title:e,"aria-label":e},c&&{"data-test-id":c}),p)}var Uu=on(129),Fs={};Fs.styleTagTransform=ci(),Fs.setAttributes=si(),Fs.insert=ai().bind(null,"head"),Fs.domAPI=ii(),Fs.insertStyleElement=li(),oi()(Uu.A,Fs),Uu.A&&Uu.A.locals&&Uu.A.locals;var R2=m=>{var c={};return on.d(c,m),c};const M2=R2({ContentEditable:()=>jm});function D2(m){let{className:c}=m;return Gt.createElement(M2.ContentEditable,{className:c||"ContentEditable__root"})}var $u=on(457),zs={};zs.styleTagTransform=ci(),zs.setAttributes=si(),zs.insert=ai().bind(null,"head"),zs.domAPI=ii(),zs.insertStyleElement=li(),oi()($u.A,zs),$u.A&&$u.A.locals&&$u.A.locals;function L2(m){let{children:c,className:p}=m;return Gt.createElement("div",{className:p||"Placeholder__root"},c)}const B2=Sy.default.LexicalErrorBoundary||Sy.default,F2=()=>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"})),Oy=()=>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"})),z2=()=>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"})),U2=()=>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 Ty(m,c,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 On.createNewCommentObj({content:m,author:c,codoxId:p,timeStamp:t,deleted:f})}function $2(m,c,p){return On.createNewThreadObj({quote:m,comments:c,codoxId:p})}function H2(m){let{anchorKey:c,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(c);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"}},[c,p]);return(0,Gt.useEffect)(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[p,r]),Cy(()=>{r()},[c,p,r]),Gt.createElement("div",{className:"CodoxCommentPlugin_AddCommentBox",ref:f},Gt.createElement("button",{className:"CodoxCommentPlugin_AddCommentBox_button",onClick:t},Gt.createElement(F2,null)))}function q2(m){let{onEscape:c}=m;const[p]=(0,Wi.useLexicalComposerContext)();return(0,Gt.useEffect)(()=>p.registerCommand(be.KEY_ESCAPE_COMMAND,t=>c(t),2),[p,c]),null}function W2(m){let{editorRef:c}=m;const[p]=(0,Wi.useLexicalComposerContext)();return typeof c=="function"?c(p):typeof c=="object"&&(c.current=p),null}function Ay(m){let{className:c,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:N2};return Gt.createElement(y2.LexicalComposer,{initialConfig:s},Gt.createElement("div",{className:"CodoxCommentPlugin_CommentInputBox_EditorContainer",onClick:e},Gt.createElement(E2.PlainTextPlugin,{contentEditable:Gt.createElement(D2,{className:c}),placeholder:Gt.createElement(L2,null,n),ErrorBoundary:B2}),Gt.createElement(w2.OnChangePlugin,{onChange:f}),Gt.createElement(_2.HistoryPlugin,null),p!==!1&&Gt.createElement(p2.AutoFocusPlugin,null),Gt.createElement(q2,{onEscape:t}),Gt.createElement(g2.ClearEditorPlugin,null),r!==void 0&&Gt.createElement(W2,{editorRef:r})))}function Py(m,c){return(0,Gt.useCallback)((p,t)=>{p.read(()=>{m((0,Ey.$rootTextContent)()),c(!(0,Ey.$isRootTextContentEmpty)(t.isComposing(),!0))})},[c,m])}function J2(m){let{editor:c,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=Iy(),a=(0,Gt.useCallback)(()=>{c.getEditorState().read(()=>{const u=(0,be.$getSelection)();if((0,be.$isRangeSelection)(u)){l.current=u.clone();const g=u.anchor,h=u.focus,y=(0,Oa.createDOMRange)(c,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)(c,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 U="255, 212, 0",H=`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(${U}, 0.3);pointer-events:none;z-index:5;`;A.style.cssText=H}for(let O=N-1;O>=C;O--){const R=D[O];k.removeChild(R),D.pop()}}}})},[c,i]);Cy(()=>{a();const u=i.container,g=document.body;if(g!==null)return g.appendChild(u),()=>{g.removeChild(u)}},[i.container,a]),(0,Gt.useEffect)(()=>(window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}),[a]);const d=Py(r,e);return Gt.createElement("div",{className:"CodoxCommentPlugin_CommentInputBox",ref:s},Gt.createElement(Ay,{className:"CodoxCommentPlugin_CommentInputBox_Editor",onEscape:u=>(u.preventDefault(),p(),!0),onChange:d}),Gt.createElement("div",{className:"CodoxCommentPlugin_CommentInputBox_Buttons"},Gt.createElement(Ki,{onClick:p,className:"CodoxCommentPlugin_CommentInputBox_Button"},"Cancel"),Gt.createElement(Ki,{onClick:()=>{if(n){let u=c.getEditorState().read(()=>{const g=l.current;return g?g.getTextContent():""});u.length>100&&(u=u.slice(0,99)+"…"),t($2(u,[Ty(f,o)]),!0,void 0,l.current),l.current=null}},disabled:!n,className:"CodoxCommentPlugin_CommentInputBox_Button primary"},"Comment")))}function V2(m){let{submitAddComment:c,thread:p,placeholder:t}=m;const[f,r]=(0,Gt.useState)(""),[n,e]=(0,Gt.useState)(!1),s=(0,Gt.useRef)(null),i=Iy(),l=Py(r,e);return Gt.createElement(Gt.Fragment,null,Gt.createElement(Ay,{className:"CodoxCommentPlugin_CommentsPanel_Editor",autoFocus:!1,onEscape:()=>!0,onChange:l,editorRef:s,placeholder:t}),Gt.createElement(Ki,{className:"CodoxCommentPlugin_CommentsPanel_SendButton",onClick:()=>{if(n){c(Ty(f,i),!1,p);const o=s.current;o!==null&&o.dispatchCommand(be.CLEAR_EDITOR_COMMAND,void 0)}},disabled:!n},Gt.createElement(z2,null)))}function jy(m){let{commentOrThread:c,deleteCommentOrThread:p,onClose:t,thread:f}=m;return Gt.createElement(Gt.Fragment,null,"Are you sure you want to delete this ",c.type,"?",Gt.createElement("div",{className:"Modal__content"},Gt.createElement(Ki,{onClick:()=>{p(c,f),t()}},"Delete")," ",Gt.createElement(Ki,{onClick:()=>{t()}},"Cancel")))}function Ny(m){let{comment:c,deleteComment:p,thread:t,rtf:f}=m;const r=Math.round((c.timeStamp-performance.now())/1e3),n=Math.round(r/60),[e,s]=ky();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"},c.author),Gt.createElement("span",{className:"CodoxCommentPlugin_CommentsPanel_List_Comment_Time"},"· ",r>-10?"Just now":f.format(n,"minute"))),Gt.createElement("p",{className:c.deleted?"CodoxCommentPlugin_CommentsPanel_DeletedComment":""},c.content),!c.deleted&&Gt.createElement(Gt.Fragment,null,Gt.createElement(Ki,{onClick:()=>{s("Delete Comment",i=>Gt.createElement(jy,{commentOrThread:c,deleteCommentOrThread:p,thread:t,onClose:i}))},className:"CodoxCommentPlugin_CommentsPanel_List_DeleteButton"},Gt.createElement(Oy,null)),e))}function K2(m){let{activeIDs:c,comments:p,deleteCommentOrThread:t,listRef:f,submitAddComment:r,markNodeMap:n}=m;const[e]=(0,Wi.useLexicalComposerContext)(),[s,i]=(0,Gt.useState)(0),[l,o]=ky(),a=(0,Gt.useMemo)(()=>new Intl.RelativeTimeFormat("en",{localeMatcher:"best fit",numeric:"auto",style:"short"}),[]);return(0,Gt.useEffect)(()=>{const d=setTimeout(()=>{i(s+1)},1e4);return()=>{clearTimeout(d)}},[s]),Gt.createElement("ul",{className:"CodoxCommentPlugin_CommentsPanel_List",ref:f},p.map(d=>{const u=d.codoxId;if(!u)return null;if(d.type==="thread"){const g=()=>{if(n.get(u)!==void 0&&(c===null||c.indexOf(u)===-1)){const h=document.activeElement;e.update(()=>{(0,be.$setSelection)(null)},{onUpdate(){h!==null&&h.focus()}})}};return Gt.createElement("li",{key:u,onClick:g,className:`CodoxCommentPlugin_CommentsPanel_List_Thread ${n.has(u)?"interactive":""} ${c.indexOf(u)===-1?"":"active"}`},Gt.createElement("div",{className:"CodoxCommentPlugin_CommentsPanel_List_Thread_QuoteBox"},Gt.createElement("blockquote",{className:"CodoxCommentPlugin_CommentsPanel_List_Thread_Quote"},"> ",Gt.createElement("span",null,d.quote)),Gt.createElement(Ki,{onClick:()=>{o("Delete Thread",h=>Gt.createElement(jy,{commentOrThread:d,deleteCommentOrThread:t,onClose:h}))},className:"CodoxCommentPlugin_CommentsPanel_List_DeleteButton"},Gt.createElement(Oy,null)),l),Gt.createElement("ul",{className:"CodoxCommentPlugin_CommentsPanel_List_Thread_Comments"},d.comments.map(h=>Gt.createElement(Ny,{key:h.codoxId,comment:h,deleteComment:t,thread:d,rtf:a}))),Gt.createElement("div",{className:"CodoxCommentPlugin_CommentsPanel_List_Thread_Editor"},Gt.createElement(V2,{submitAddComment:r,thread:d,placeholder:"Reply to comment..."})))}return Gt.createElement(Ny,{key:u,comment:d,deleteComment:t,rtf:a})}))}function G2(m){let{activeIDs:c,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(K2,{activeIDs:c,comments:t,deleteCommentOrThread:p,listRef:n,submitAddComment:f,markNodeMap:r}))}function Iy(){const m=(0,uy.useCollaborationContext)(),{yjsDocMap:c,name:p}=m;return p||"Playground User"}function Y2(m){const[c]=(0,Wi.useLexicalComposerContext)(),p=Nw(),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)(()=>{c.update(()=>{const g=(0,be.$getSelection)();g!==null&&(g.dirty=!0)}),i(!1)},[c]),d=(0,Gt.useCallback)((g,h)=>{if(g.type==="comment"){if(ce.log("[deleteCommentOrThread]: type comment new values",{comment:g,thread:h,markNodeMap:t}),On.removeComment(h.codoxId,g.codoxId),!h)return;const y=h.codoxId,v=t.get(y);c.update(()=>{v?v.forEach((_,b)=>{const x=(0,be.$getNodeByKey)(b);ce.log("[deleteCommentOrThread]: type comment new values",{lexicalNode:x}),x&&x.markDirty()}):(0,be.$getRoot)().markDirty(),(0,be.$addUpdateTag)(io.historic),(0,be.$addUpdateTag)(Kl)})}else{ce.log("[deleteCommentOrThread]: type thread new values",{comment:g,markNodeMap:t});const y=h!==void 0?h.codoxId:g.codoxId,v=t.get(y);setTimeout(()=>{c.update(()=>{if(v)for(const _ of v){const b=(0,be.$getNodeByKey)(_);ce.log("[deleteCommentOrThread]: type thread new values",{node:b}),(0,oo.$isMarkNode)(b)&&(b.deleteID(y),b.getIDs().length===0&&(0,oo.$unwrapMarkNode)(b))}else(0,be.$getRoot)().markDirty(),ce.debug("[deleteCommentOrThread][refreshComments]");On.refreshComments(!0),(0,be.$addUpdateTag)(Kl)})})}},[c,t]),u=(0,Gt.useCallback)((g,h,y,v)=>{if(ce.log("[submitAddComment]: new values",{commentOrThread:g,isInlineComment:h,thread:y,markNodeMap:t}),y?On.addComment(y.codoxId,g):On.addCommentThread(g),h)c.update(()=>{if((0,be.$isRangeSelection)(v)){const _=v.isBackward(),b=g.codoxId;(0,oo.$wrapSelectionInMarkNode)(v,_,b),(0,be.$addUpdateTag)(Kl)}}),i(!1);else if(!h&&y){const _=y.codoxId,b=t.get(_);if(!b)return void On.removeComment(y.codoxId,g.codoxId);c.update(()=>{b.forEach((x,w)=>{let S=(0,be.$getNodeByKey)(w);S&&S.markDirty()}),(0,be.$addUpdateTag)(io.historic),(0,be.$addUpdateTag)(Kl)})}},[c]);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=c.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,c,t]),(0,Gt.useEffect)(()=>{const g=new Map;return(0,ks.mergeRegister)((0,ks.registerNestedElementResolver)(c,oo.MarkNode,h=>(0,oo.$createMarkNode)(h.getIDs()),(h,y)=>{h.getIDs().forEach(v=>{y.addID(v)})}),c.registerMutationListener(oo.MarkNode,h=>{c.getEditorState().read(()=>{for(const[y,v]of h){const _=(0,be.$getNodeByKey)(y);let b=[];v==="destroyed"?b=g.get(y)||[]:(0,oo.$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))}}})}),c.registerUpdateListener(h=>{let{editorState:y,tags:v}=h;y.read(()=>{const _=(0,be.$getSelection)();let b=!1,x=!1;if((0,be.$isRangeSelection)(_)){const w=_.anchor.getNode();if((0,be.$isTextNode)(w)){const S=(0,oo.$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,be.$isRangeSelection)(_)&&i(!1)})}),c.registerCommand(up,()=>{const h=window.getSelection();return h!==null&&h.removeAllRanges(),i(!0),!0},be.COMMAND_PRIORITY_EDITOR))},[c,t]),Gt.createElement(Gt.Fragment,null,s&&(0,Ms.createPortal)(Gt.createElement(J2,{editor:c,cancelAddComment:a,submitAddComment:u}),document.body),f!=null&&!s&&(0,Ms.createPortal)(Gt.createElement(H2,{anchorKey:f,editor:c,onAddComment:()=>{c.dispatchCommand(up,void 0)}}),document.body),(0,Ms.createPortal)(Gt.createElement(Ki,{className:"CodoxCommentPlugin_ShowCommentsButton "+(l?"active":""),onClick:()=>o(!l),title:l?"Hide Comments":"Show Comments"},Gt.createElement(U2,null)),document.body),l&&(0,Ms.createPortal)(Gt.createElement(G2,{comments:p,submitAddComment:u,deleteCommentOrThread:d,activeIDs:n,markNodeMap:t}),document.body))}var Hu=on(766),Us={};Us.styleTagTransform=ci(),Us.setAttributes=si(),Us.insert=ai().bind(null,"head"),Us.domAPI=ii(),Us.insertStyleElement=li(),oi()(Hu.A,Us),Hu.A&&Hu.A.locals&&Hu.A.locals;var qu=on(225),$s={};$s.styleTagTransform=ci(),$s.setAttributes=si(),$s.insert=ai().bind(null,"head"),$s.domAPI=ii(),$s.insertStyleElement=li(),oi()(qu.A,$s),qu.A&&qu.A.locals&&qu.A.locals;function Z2(m){let{label:c,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"},c),Gt.createElement("input",{type:n,className:"CodoxInput__input",placeholder:f,value:p,onChange:e=>{t(e.target.value)},"data-test-id":r}))}function Ry(m,c){var p=Object.keys(m);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(m);c&&(t=t.filter(function(f){return Object.getOwnPropertyDescriptor(m,f).enumerable})),p.push.apply(p,t)}return p}function Wu(m){for(var c=1;c<arguments.length;c++){var p=arguments[c]!=null?arguments[c]:{};c%2?Ry(Object(p),!0).forEach(function(t){X2(m,t,p[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(p)):Ry(Object(p)).forEach(function(t){Object.defineProperty(m,t,Object.getOwnPropertyDescriptor(p,t))})}return m}function X2(m,c,p){return(c=Q2(c))in m?Object.defineProperty(m,c,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[c]=p,m}function Q2(m){var c=tE(m,"string");return typeof c=="symbol"?c:c+""}function tE(m,c){if(typeof m!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var t=p.call(m,c||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(m)}let Xl=!1;const eE=["#d0021b","#f5a623","#f8e71c","#8b572a","#7ed321","#417505","#bd10e0","#9013fe","#4a90e2","#50e3c2","#b8e986","#000000","#4a4a4a","#9b9b9b","#ffffff"],Ql=214,My=150;function nE(m){let{color:c,onChange:p}=m;const[t,f]=(0,Gt.useState)(Hs("hex",c)),[r,n]=(0,Gt.useState)(c),e=(0,Gt.useRef)(null),s=(0,Gt.useMemo)(()=>({x:t.hsv.s/100*Ql,y:(100-t.hsv.v)/100*My}),[t.hsv.s,t.hsv.v]),i=(0,Gt.useMemo)(()=>({x:t.hsv.h/360*Ql}),[t.hsv]);return(0,Gt.useEffect)(()=>{e.current!==null&&p&&n(t.hex)},[t,p]),(0,Gt.useEffect)(()=>{if(c===void 0)return;const l=Hs("hex",c);f(l),n(l.hex)},[c]),Gt.createElement("div",{className:"codox-color-picker-wrapper",style:{width:Ql},ref:e},Gt.createElement(Z2,{label:"Hex",onChange:l=>{if(n(l),/^#[0-9A-Fa-f]{6}$/i.test(l)){const o=Hs("hex",l);f(o)}},value:r}),Gt.createElement("div",{className:"codox-color-picker-basic-color"},eE.map(l=>Gt.createElement("button",{className:l===t.hex?" active":"",key:l,style:{backgroundColor:l},onClick:()=>(o=>{n(o);let a=Hs("hex",o);f(a),p(a.hex,Xl)})(l)}))),Gt.createElement(Dy,{className:"codox-color-picker-saturation",style:{backgroundColor:`hsl(${t.hsv.h}, 100%, 50%)`},onChange:l=>{let{x:o,y:a}=l;const d=Hs("hsv",Wu(Wu({},t.hsv),{},{s:o/Ql*100,v:100-a/My*100}));f(d),n(d.hex),p(d.hex,Xl)}},Gt.createElement("div",{className:"codox-color-picker-saturation_cursor",style:{backgroundColor:t.hex,left:s.x,top:s.y}})),Gt.createElement(Dy,{className:"codox-color-picker-hue",onChange:l=>{let{x:o}=l;const a=Hs("hsv",Wu(Wu({},t.hsv),{},{h:o/Ql*360}));f(a),n(a.hex),p(a.hex,Xl)}},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 Dy(m){let{className:c,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:d}=i.getBoundingClientRect(),u=Ly(s.clientX-a,l,0),g=Ly(s.clientY-d,o,0);t({x:u,y:g})}};return Gt.createElement("div",{ref:r,className:c,style:p,onMouseDown:s=>{if(s.button!==0)return;e(s);const i=o=>{n.current=!0,Xl=!0,e(o)},l=o=>{n.current&&(Xl=!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 Ly(m,c,p){return m>c?c:m<p?p:m}function By(m){if(!m.startsWith("#")){const c=document.createElement("canvas").getContext("2d");if(!c)throw new Error("2d context not supported or canvas already initialized");return c.fillStyle=m,c.fillStyle}return m.length===4||m.length===5?m=m.split("").map((c,p)=>p?c+c:"#").join(""):m.length===7||m.length===9?m:"#000000"}function Fy(m){const c=(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:c[2],g:c[1],r:c[0]}}function xp(m){let{r:c,g:p,b:t}=m;c/=255,p/=255,t/=255;const f=Math.max(c,p,t),r=f-Math.min(c,p,t);return{h:r?60*(f===c?(p-t)/r+(p<t?6:0):f===p?2+(t-c)/r:4+(c-p)/r):0,s:f?r/f*100:0,v:100*f}}function rE(m){let{h:c,s:p,v:t}=m;p/=100,t/=100;const f=~~(c/60),r=c/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 zy(m){let{b:c,g:p,r:t}=m;return"#"+[t,p,c].map(f=>f.toString(16).padStart(2,"0")).join("")}function Hs(m,c){let p=By("#121212"),t=Fy(p),f=xp(t);return m==="hex"?(p=By(c),t=Fy(p),f=xp(t)):m==="rgb"?(t=c,p=zy(t),f=xp(t)):m==="hsv"&&(f=c,t=rE(f),p=zy(t)),{hex:p,hsv:f,rgb:t}}const oE=Gt.createContext(null),Uy=4;function iE(m){let{children:c,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(oE.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(d=>{if(!d)return r[0];const u=r.indexOf(d)-1;return r[u===-1?r.length-1:u]}):a==="ArrowDown"&&s(d=>d?r[r.indexOf(d)+1]:r[0])}},c))}function aE(m){let{disabled:c=!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),[d,u]=(0,Gt.useState)(!1);return(0,Gt.useEffect)(()=>{const g=a.current,h=o.current;if(d&&g!==null&&h!==null){const{top:y,left:v}=g.getBoundingClientRect();h.style.top=`${y+g.offsetHeight+Uy}px`,h.style.left=`${Math.min(v,window.innerWidth-h.offsetWidth-20)}px`}},[o,a,d]),(0,Gt.useEffect)(()=>{const g=a.current;if(g!==null&&d){const h=y=>{const v=y.target;e&&o.current&&o.current.contains(v)||g.contains(v)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[o,a,d,e]),(0,Gt.useEffect)(()=>{const g=()=>{if(d){const h=a.current,y=o.current;if(h!==null&&y!==null){const{top:v}=h.getBoundingClientRect(),_=v+h.offsetHeight+Uy;_!==y.getBoundingClientRect().top&&(y.style.top=`${_}px`)}}};return document.addEventListener("scroll",g),()=>{document.removeEventListener("scroll",g)}},[a,o,d]),Gt.createElement(Gt.Fragment,null,Gt.createElement("button",{type:"button",disabled:c,"aria-label":t||p,className:f,onClick:()=>u(!d),ref:a},r&&Gt.createElement("span",{className:r}),p&&Gt.createElement("span",{className:i},p),Gt.createElement("i",{className:l})),d&&(0,Ms.createPortal)(Gt.createElement(iE,{dropDownRef:o,onClose:()=>{u(!1),a&&a.current&&a.current.focus()},dropdownClassName:s},n),document.body))}const sE=["disabled","stopCloseOnClickSelf","color","onChange"];function wp(){return wp=Object.assign?Object.assign.bind():function(m){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var t in p)({}).hasOwnProperty.call(p,t)&&(m[t]=p[t])}return m},wp.apply(null,arguments)}function lE(m,c){if(m==null)return{};var p,t,f=cE(m,c);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(m);for(t=0;t<r.length;t++)p=r[t],c.indexOf(p)>=0||{}.propertyIsEnumerable.call(m,p)&&(f[p]=m[p])}return f}function cE(m,c){if(m==null)return{};var p={};for(var t in m)if({}.hasOwnProperty.call(m,t)){if(c.indexOf(t)>=0)continue;p[t]=m[t]}return p}function $y(m){let{disabled:c=!1,stopCloseOnClickSelf:p=!0,color:t,onChange:f}=m,r=lE(m,sE);return Gt.createElement(aE,wp({},r,{disabled:c,stopCloseOnClickSelf:p}),Gt.createElement(nE,{color:t,onChange:f}))}const uE=m=>{let{onColorChange:c,buttonClassName:p,buttonIconClassName:t,buttonAriaLabel:f,buttonLabel:r,dropdownClassName:n,buttonLabelClassName:e,dropdownChevronClassName:s}=m;const[i]=(0,Wi.useLexicalComposerContext)(),[l,o]=(0,Gt.useState)(()=>i.isEditable()),[a,d]=(0,Gt.useState)("");(0,Gt.useEffect)(()=>(0,ks.mergeRegister)(i.registerEditableListener(g=>{o(g)}),i.registerUpdateListener(g=>{let{editorState:h}=g;h.read(()=>{const y=(0,be.$getSelection)();if((0,be.$isRangeSelection)(y)){let v=(0,Oa.$getSelectionStyleValueForProperty)(y,"color");v!==a&&(d(v||""),c(v))}})})),[i]);const u=(0,Gt.useCallback)((g,h)=>{i.update(()=>{const y=(0,be.$getSelection)();y!==null&&(0,Oa.$patchStyleText)(y,{color:g})})},[i]);return Gt.createElement($y,{disabled:!l,color:a,onChange:u,buttonClassName:p||"",buttonIconClassName:t||"",buttonAriaLabel:f||"",buttonLabel:r||"",dropdownClassName:n||"",buttonLabelClassName:e||"",dropdownChevronClassName:s||""})},dE=uE,fE=m=>{let{onColorChange:c,buttonClassName:p,buttonIconClassName:t,buttonAriaLabel:f,buttonLabel:r,dropdownClassName:n,buttonLabelClassName:e,dropdownChevronClassName:s}=m;const[i]=(0,Wi.useLexicalComposerContext)(),[l,o]=(0,Gt.useState)(()=>i.isEditable()),[a,d]=(0,Gt.useState)("#fff");(0,Gt.useEffect)(()=>(0,ks.mergeRegister)(i.registerEditableListener(g=>{o(g)}),i.registerUpdateListener(g=>{let{editorState:h}=g;h.read(()=>{const y=(0,be.$getSelection)();if((0,be.$isRangeSelection)(y)){let v=(0,Oa.$getSelectionStyleValueForProperty)(y,"background-color");v!==a&&(d(v||""),c(v))}})})),[i]);const u=(0,Gt.useCallback)((g,h)=>{i.update(()=>{const y=(0,be.$getSelection)();y!==null&&(0,Oa.$patchStyleText)(y,{"background-color":g})})},[i]);return Gt.createElement($y,{disabled:!l,color:a,onChange:u,buttonClassName:p||"",buttonIconClassName:t||"",buttonAriaLabel:f||"",buttonLabel:r||"",dropdownClassName:n||"",buttonLabelClassName:e||"",dropdownChevronClassName:s||""})},pE=fE;var hE=Ui.yy;Ui._U,Ui.a8,Ui.Vs,Ui.Cn;var gE=Ui.gK,mE=Ui.vv;function yE(m){return m&&m.__esModule&&Object.prototype.hasOwnProperty.call(m,"default")?m.default:m}var Ju=yE(function(m){const c=new URLSearchParams;c.append("code",m);for(let p=1;p<arguments.length;p++)c.append("v",arguments[p]);throw Error(`Minified Lexical error #${m}; visit https://lexical.dev/docs/error?${c} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function vE({hasCellMerge:m=!0,hasCellBackgroundColor:c=!0,hasTabHandler:p=!0}){const[t]=wr();return we.useEffect(()=>(t.hasNodes([wo,Fi,$l])||Ju(10),_o(t.registerCommand(vx,({columns:f,rows:r,includeHeaders:n})=>{const e=b0(Number(r),Number(f),n);Wm(e);const s=e.getFirstDescendant();return je(s)&&s.select(),!0},an),t.registerNodeTransform(wo,f=>{const[r]=S0(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=ni(0);o.append(jn()),i!==null?i.insertAfter(o):Jm(i,o)}}}))),[t]),we.useEffect(()=>{const f=new Map,r=e=>{const s=e.getKey(),i=t.getElementByKey(s);if(i&&!f.has(s)){const l=jx(e,i,t,p);f.set(s,l)}};t.getEditorState().read(()=>{const e=jg(wo);for(const s of e)Rn(s)&&r(s)});const n=t.registerMutationListener(wo,e=>{for(const[s,i]of e)if(i==="created")t.getEditorState().read(()=>{const l=Gn(s);Rn(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]),we.useEffect(()=>{if(!m)return t.registerNodeTransform(Fi,f=>{if(f.getColSpan()>1||f.getRowSpan()>1){const[,,r]=Vr(f),[n]=Io(r,f,f),e=n.length,s=n[0].length;let i=r.getFirstChild();cr(i)||Ju(175);const l=[];for(let o=0;o<e;o++){o!==0&&(i=i.getNextSibling(),cr(i)||Ju(175));let a=null;for(let d=0;d<s;d++){const u=n[o][d],g=u.cell;if(u.startRow===o&&u.startColumn===d)a=g,l.push(g);else if(g.getColSpan()>1||g.getRowSpan()>1){rn(g)||Ju(176);const h=ni(g.__headerState);a!==null?a.insertAfter(h):Jm(i,h)}}}for(const o of l)o.setColSpan(1),o.setRowSpan(1)}})},[t,m]),we.useEffect(()=>{if(!c)return t.registerNodeTransform(Fi,f=>{f.getBackgroundColor()!==null&&f.setBackgroundColor(null)})},[t,c,m]),null}const $k="",bE={autocomplete:"PlaygroundEditorTheme__autocomplete",blockCursor:"PlaygroundEditorTheme__blockCursor",characterLimit:"PlaygroundEditorTheme__characterLimit",code:"PlaygroundEditorTheme__code",codeHighlight:{atrule:"PlaygroundEditorTheme__tokenAttr",attr:"PlaygroundEditorTheme__tokenAttr",boolean:"PlaygroundEditorTheme__tokenProperty",builtin:"PlaygroundEditorTheme__tokenSelector",cdata:"PlaygroundEditorTheme__tokenComment",char:"PlaygroundEditorTheme__tokenSelector",class:"PlaygroundEditorTheme__tokenFunction","class-name":"PlaygroundEditorTheme__tokenFunction",comment:"PlaygroundEditorTheme__tokenComment",constant:"PlaygroundEditorTheme__tokenProperty",deleted:"PlaygroundEditorTheme__tokenProperty",doctype:"PlaygroundEditorTheme__tokenComment",entity:"PlaygroundEditorTheme__tokenOperator",function:"PlaygroundEditorTheme__tokenFunction",important:"PlaygroundEditorTheme__tokenVariable",inserted:"PlaygroundEditorTheme__tokenSelector",keyword:"PlaygroundEditorTheme__tokenAttr",namespace:"PlaygroundEditorTheme__tokenVariable",number:"PlaygroundEditorTheme__tokenProperty",operator:"PlaygroundEditorTheme__tokenOperator",prolog:"PlaygroundEditorTheme__tokenComment",property:"PlaygroundEditorTheme__tokenProperty",punctuation:"PlaygroundEditorTheme__tokenPunctuation",regex:"PlaygroundEditorTheme__tokenVariable",selector:"PlaygroundEditorTheme__tokenSelector",string:"PlaygroundEditorTheme__tokenSelector",symbol:"PlaygroundEditorTheme__tokenProperty",tag:"PlaygroundEditorTheme__tokenProperty",url:"PlaygroundEditorTheme__tokenOperator",variable:"PlaygroundEditorTheme__tokenVariable"},embedBlock:{base:"PlaygroundEditorTheme__embedBlock",focus:"PlaygroundEditorTheme__embedBlockFocus"},hashtag:"PlaygroundEditorTheme__hashtag",heading:{h1:"PlaygroundEditorTheme__h1",h2:"PlaygroundEditorTheme__h2",h3:"PlaygroundEditorTheme__h3",h4:"PlaygroundEditorTheme__h4",h5:"PlaygroundEditorTheme__h5",h6:"PlaygroundEditorTheme__h6"},hr:"PlaygroundEditorTheme__hr",image:"editor-image",indent:"PlaygroundEditorTheme__indent",inlineImage:"inline-editor-image",layoutContainer:"PlaygroundEditorTheme__layoutContainer",layoutItem:"PlaygroundEditorTheme__layoutItem",link:"PlaygroundEditorTheme__link",list:{checklist:"PlaygroundEditorTheme__checklist",listitem:"PlaygroundEditorTheme__listItem",listitemChecked:"PlaygroundEditorTheme__listItemChecked",listitemUnchecked:"PlaygroundEditorTheme__listItemUnchecked",nested:{listitem:"PlaygroundEditorTheme__nestedListItem"},olDepth:["PlaygroundEditorTheme__ol1","PlaygroundEditorTheme__ol2","PlaygroundEditorTheme__ol3","PlaygroundEditorTheme__ol4","PlaygroundEditorTheme__ol5"],ul:"PlaygroundEditorTheme__ul"},ltr:"PlaygroundEditorTheme__ltr",mark:"PlaygroundEditorTheme__mark",markOverlap:"PlaygroundEditorTheme__markOverlap",paragraph:"PlaygroundEditorTheme__paragraph",quote:"PlaygroundEditorTheme__quote",rtl:"PlaygroundEditorTheme__rtl",table:"PlaygroundEditorTheme__table",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",tableRowStriping:"PlaygroundEditorTheme__tableRowStriping",tableSelected:"PlaygroundEditorTheme__tableSelected",tableSelection:"PlaygroundEditorTheme__tableSelection",text:{bold:"PlaygroundEditorTheme__textBold",code:"PlaygroundEditorTheme__textCode",italic:"PlaygroundEditorTheme__textItalic",strikethrough:"PlaygroundEditorTheme__textStrikethrough",subscript:"PlaygroundEditorTheme__textSubscript",superscript:"PlaygroundEditorTheme__textSuperscript",underline:"PlaygroundEditorTheme__textUnderline",underlineStrikethrough:"PlaygroundEditorTheme__textUnderlineStrikethrough"}},_E="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDE1IDE1IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTYuMDAwMDEgOC4zMzMzM0wxLjkwMDAxIDEzLjhMMS4xMDAwMSAxMy4yTDUuMzc1MDEgNy41TDEuMTAwMDEgMS44TDEuOTAwMDEgMS4yTDYuMDAwMDEgNi42NjY2N0wxMC4xIDEuMkwxMC45IDEuOEw2LjYyNTAxIDcuNUwxMC45IDEzLjJMMTAuMSAxMy44TDYuMDAwMDEgOC4zMzMzM1pNMTIgMTIuNUMxMiAxMS42NzE2IDEyLjY3MTYgMTEgMTMuNSAxMUgxMy43OTI5QzE0LjQ1OTYgMTEgMTUgMTEuNTQwNCAxNSAxMi4yMDcxQzE1IDEyLjUyNzMgMTQuODcyOCAxMi44MzQzIDE0LjY0NjUgMTMuMDYwN0wxMy43MDcxIDE0SDE1VjE1SDEyLjVDMTIuMjk3OCAxNSAxMi4xMTU1IDE0Ljg3ODIgMTIuMDM4MSAxNC42OTEzQzExLjk2MDcgMTQuNTA0NSAxMi4wMDM1IDE0LjI4OTQgMTIuMTQ2NSAxNC4xNDY0TDEzLjkzOTMgMTIuMzUzNkMxMy45NzgyIDEyLjMxNDcgMTQgMTIuMjYyIDE0IDEyLjIwNzFDMTQgMTIuMDkyNyAxMy45MDczIDEyIDEzLjc5MjkgMTJIMTMuNUMxMy4yMjM5IDEyIDEzIDEyLjIyMzkgMTMgMTIuNUgxMloiIGZpbGw9IiMwMDAwMDAiLz4KPC9zdmc+",xE="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIiB0ZXh0LXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIiBpbWFnZS1yZW5kZXJpbmc9Im9wdGltaXplUXVhbGl0eSIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIHZpZXdCb3g9IjAgMCA1MDQgNTEyLjM2Ij48cGF0aCBmaWxsLXJ1bGU9Im5vbnplcm8iIGQ9Ik00OTkuNDMgMjMxLjM2SDM2OC40Yy0yLjUzIDAtNC41OC0yLjA1LTQuNTgtNC41N3YtOC4xMWMwLTEuMjYuNTItMi40IDEuMzQtMy4yMmw3MS41Ny04Mi41M2M2LjczLTcuNzUgMTIuNTctMTQuOTcgMTcuNDgtMjEuNjggNC44OC02LjY0IDguODMtMTIuNzQgMTEuODUtMTguMjggMi45Ny01LjQzIDUuMTgtMTAuNjEgNi42NC0xNS41NSAxLjQyLTQuODUgMi4xMy05LjUzIDIuMTMtMTQgMC0xNC42OC0zLjk4LTI2LjA1LTExLjkyLTM0LjA5LTMuOTItMy45Ni04Ljc1LTYuOTMtMTQuNDktOC45Mi01Ljk1LTIuMDMtMTIuOTEtMy4wNS0yMC44Ny0zLjA1LTguNDUgMC0xNS44OCAxLjIxLTIyLjI5IDMuNjItNi4yNyAyLjM2LTExLjYzIDUuOTItMTYuMDcgMTAuNjNhNDcuODg0IDQ3Ljg4NCAwIDAgMC0xMC4xNCAxNi42Yy0yLjI3IDYuMjktMy40MSAxMy4zOS0zLjQxIDIxLjI2IDAgMi41Mi0yLjA1IDQuNTctNC41NyA0LjU3aC02Ljg5Yy0yLjA1IDAtMy44LTEuMzYtNC4zNy0zLjI0bC0uMjctLjgyYy0uMTgtLjU2LS4yNS0xLjEzLS4yMi0xLjY3LS4yMy05LjMyIDEuMTQtMTcuOTkgNC4xMi0yNS45NyAzLjAyLTguMTMgNy42OC0xNS41NCAxMy45NC0yMi4xOSA2LjI2LTYuNyAxMy42My0xMS43NiAyMi4xLTE1LjEzQzQwNy44NCAxLjY4IDQxNy4yIDAgNDI3LjU1IDBjOS41OSAwIDE4LjI2IDEuMzggMjYuMDMgNC4xMyA3Ljg2IDIuNzkgMTQuNzcgNyAyMC43MiAxMi42MSA2LjAyIDUuNjMgMTAuNTUgMTIuNCAxMy41NSAyMC4yOCAyLjk2IDcuNzUgNC40NSAxNi41NiA0LjQ1IDI2LjQgMCA2LjUtMS4wNyAxMy4wOC0zLjE3IDE5LjY5bC0uMTQuMzhjLTIuMDkgNi40Ni01LjE3IDEyLjk3LTkuMiAxOS40OWwtLjE0LjIxYy00LjA4IDYuNTEtOC45IDEzLjQzLTE0LjQzIDIwLjc0LTUuNTYgNy4zMy0xMS45NiAxNS4yMy0xOS4yMiAyMy42N2wtNTYuOTEgNjYuNTFoMTEwLjM0YzIuNTIgMCA0LjU3IDIuMDUgNC41NyA0LjU3djguMTFjMCAyLjUyLTIuMDUgNC41Ny00LjU3IDQuNTd6bS0zMjcuMjUgNjguNzUgMTM3Ljk2LTE2Ny43NmMuODktMS4wNyAyLjMtMS42NSAzLjc0LTEuNjVsMjAuMTMtLjAyYzIuNTIgMCA0LjU3IDEuNzQgNC41NyAzLjg4IDAgLjkxLS4zNyAxLjc1LS45OCAyLjQxTDE4OC4zMiAzMTcuNjYgMzQ0LjEgNTA2LjI0YzEuNDUgMS43NS45NSA0LjE3LTEuMSA1LjQtLjguNDgtMS43Mi43MS0yLjYzLjcxbC0yMC4xMy4wMWMtMS43IDAtMy4xOC0uNzktMy45Ny0xLjk2bC0xNDQuMS0xNzUuMkwyOC4yMyA1MTAuNjljLS44OCAxLjA3LTIuMyAxLjY0LTMuNzMgMS42NWwtMTkuOTMuMDJjLTIuNTIgMC00LjU3LTEuNzQtNC41Ny0zLjg5IDAtLjkuMzctMS43NC45OC0yLjRsMTU1LjY1LTE4OC40TDYuOSAxMzYuOGMtMS40NS0xLjc1LS45NS00LjE4IDEuMTEtNS40MS43OS0uNDcgMS43MS0uNyAyLjYyLS43bDIwLjQ0LS4wMWMxLjYzIDAgMy4wNi43MiAzLjg3IDEuODFsMTM3LjI0IDE2Ny42MnoiLz48L3N2Zz4=",Hy=Un.createContext(null),qy=4;function Vu({children:m,className:c,onClick:p,title:t}){const f=we.useRef(null),r=Un.useContext(Hy);if(r===null)throw new Error("DropDownItem must be used within a DropDown");const{registerItem:n}=r;return we.useEffect(()=>{f&&f.current&&n(f)},[f,n]),le.jsx("button",{className:c,onClick:p,ref:f,title:t,type:"button",children:m})}function wE({children:m,dropDownRef:c,onClose:p}){const[t,f]=we.useState(),[r,n]=we.useState(),e=we.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 d=t.indexOf(a)-1;return t[d===-1?t.length-1:d]}):o==="ArrowDown"&&n(a=>a?t[t.indexOf(a)+1]:t[0])},i=we.useMemo(()=>({registerItem:e}),[e]);return we.useEffect(()=>{t&&!r&&n(t[0]),r&&r.current&&r.current.focus()},[t,r]),le.jsx(Hy.Provider,{value:i,children:le.jsx("div",{className:"dropdown",ref:c,onKeyDown:s,children:m})})}function SE({disabled:m=!1,buttonLabel:c,buttonAriaLabel:p,buttonClassName:t,buttonIconClassName:f,children:r,stopCloseOnClickSelf:n}){const e=we.useRef(null),s=we.useRef(null),[i,l]=we.useState(!1),o=()=>{l(!1),s&&s.current&&s.current.focus()};return we.useEffect(()=>{const a=s.current,d=e.current;if(i&&a!==null&&d!==null){const{top:u,left:g}=a.getBoundingClientRect();d.style.top=`${u+a.offsetHeight+qy}px`,d.style.left=`${Math.min(g,window.innerWidth-d.offsetWidth-20)}px`}},[e,s,i]),we.useEffect(()=>{const a=s.current;if(a!==null&&i){const d=u=>{const g=u.target;n&&e.current&&e.current.contains(g)||a.contains(g)||l(!1)};return document.addEventListener("click",d),()=>{document.removeEventListener("click",d)}}},[e,s,i,n]),we.useEffect(()=>{const a=()=>{if(i){const d=s.current,u=e.current;if(d!==null&&u!==null){const{top:g}=d.getBoundingClientRect(),h=g+d.offsetHeight+qy;h!==u.getBoundingClientRect().top&&(u.style.top=`${h}px`)}}};return document.addEventListener("scroll",a),()=>{document.removeEventListener("scroll",a)}},[s,e,i]),le.jsxs(le.Fragment,{children:[le.jsxs("button",{type:"button",disabled:m,"aria-label":p||c,className:t,onClick:()=>l(!i),ref:s,children:[f&&le.jsx("span",{className:f}),c&&le.jsx("span",{className:"text dropdown-button-text",children:c}),le.jsx("i",{className:"chevron-down"})]}),i&&Wr.createPortal(le.jsx(wE,{dropDownRef:e,onClose:o,children:r}),document.body)]})}function Wy(){return le.jsx("div",{className:"divider"})}const Sp=8,Ep=72,qs={h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",paragraph:"Normal"},EE=({selectionFontSize:m,disabled:c,editor:p,blockType:t,styleConfig:f,isenterPressed:r,currentElementClick:n,currentElementSelect:e})=>{const[s,i]=Un.useState(m),[l,o]=Un.useState(t),[a,d]=Un.useState(""),u=x=>{p.update(()=>{if(p.isEditable()){const w=Ce();w!==null&&Bm(w,x)}})},g=x=>{i(x.target.value)},h=()=>{const x=Number(s);if(!isNaN(x)){const w=Math.min(Math.max(x,Sp),Ep);i(String(w)),u({"font-size":`${w}px`})}},y=x=>{const w=f[l].fontSize,S=x?Math.min(w+2,Ep):Math.max(w-2,Sp);i(String(S)),u({"font-size":`${l}px`})},v=x=>{p.update(()=>{const w=Ce();ye(w)&&O_(w,()=>jn())})},_=x=>{d(x),p.update(()=>{const k=Ce();ye(k)&&A_(k,()=>ws(x))});let w;switch(x){case"h1":w=0;break;case"h2":w=1;break;case"h3":w=2;break;case"paragraph":w=3;break;default:w=0}const S=f.heading[w];i(String(S.fontSize)),d(x),o(x);const C={title:`${S.title}`,"font-size":`${S.fontSize}px`,color:S.fontColor,"font-family":S.fontFamily,"line-height":`${1+S.leadingSpace}em`,"margin-bottom":`${S.trailingSpace}em`};u(C)},b=()=>{o("paragraph"),u({}),i("11"),v()};return Un.useEffect(()=>{r&&r==="Enter"&&b()},[r]),Un.useEffect(()=>{const x=()=>{p.update(()=>{const w=Ce();if(w!==null){const C=w.getNodes()[0];if(!je(C)){const k=C.getType();k in qs&&o(k)}}})};return p.registerUpdateListener(x),()=>{p.registerUpdateListener(x)}},[p]),Un.useEffect(()=>{switch(n.tagName){case"P":o("paragraph"),i("11");break;case"H1":console.log("H1"),o("h1"),i(f.heading.find(x=>x.title==="Heading1").fontSize);break;case"H2":o("h2"),i(f.heading.find(x=>x.title==="Heading2").fontSize);break;case"H3":o("h3"),i(f.heading.find(x=>x.title==="Heading3").fontSize);break;case"default":o("paragraph"),i("11"),console.log("default");break}},[n]),Un.useEffect(()=>{switch(e.trim(" ")){case"Heading1":o("h1"),i(f.heading.find(x=>x.title==="Heading1").fontSize);break;case"Heading2":o("h2"),i(f.heading.find(x=>x.title==="Heading2").fontSize);break;case"Heading3":o("h3"),i(f.heading.find(x=>x.title==="Heading3").fontSize);break;case"paragraph":o("paragraph"),i("11"),console.log("Setting to default paragraph");break;default:console.warn("Unknown element type:",e);break}},[e]),le.jsxs(le.Fragment,{children:[le.jsx("button",{type:"button",disabled:c,onClick:()=>y(!1),className:"toolbar-item font-decrement"}),le.jsx("input",{type:"number",value:s,disabled:c,readOnly:!0,className:"toolbar-item font-size-input",min:Sp,max:Ep,onChange:g,onBlur:h}),le.jsx("button",{type:"button",disabled:c,onClick:()=>y(!0),className:"toolbar-item font-increment"}),le.jsx(Wy,{}),le.jsxs("div",{className:"symbol-dropdown cust-head-dropDown",children:[le.jsxs(SE,{disabled:c,buttonClassName:"toolbar-item block-controls",buttonAriaLabel:"Formatting options for text style",buttonIconClassName:"icon block-type "+l,buttonLabel:qs[l],children:[le.jsxs(Vu,{className:`item ${l==="paragraph"?"active":""}`,onClick:()=>v(),children:[le.jsx("i",{className:"icon paragraph"}),le.jsx("span",{className:"text",children:qs.paragraph})]}),le.jsxs(Vu,{className:`item ${l==="h1"?"active":""}`,onClick:()=>_("h1"),children:[le.jsx("i",{className:"icon h1"}),le.jsx("span",{className:"text",children:qs.h1})]}),le.jsxs(Vu,{className:`item ${l==="h2"?"active":""}`,onClick:()=>_("h2"),children:[le.jsx("i",{className:"icon h2"}),le.jsx("span",{className:"text",children:qs.h2})]}),le.jsxs(Vu,{className:`item ${l==="h3"?"active":""}`,onClick:()=>_("h3"),children:[le.jsx("i",{className:"icon h3"}),le.jsx("span",{className:"text",children:qs.h3})]})]}),le.jsx(Wy,{})]})]})},CE="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48IS0tISBGb250IEF3ZXNvbWUgUHJvIDYuMS4xIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlIChDb21tZXJjaWFsIExpY2Vuc2UpIENvcHlyaWdodCAyMDIyIEZvbnRpY29ucywgSW5jLi0tPjxwYXRoIGQ9Ik0wIDI1NkMwIDExNC42IDExNC42IDAgMjU2IDBzMjU2IDExNC42IDI1NiAyNTYtMTE0LjYgMjU2LTI1NiAyNTZTMCAzOTcuNCAwIDI1NnptMTc1LTQ3LjkgNDcuMSA0N0wxNzUgMzAzYy05LjMgOS40LTkuMyAyNC42IDAgMzMuMSA5LjQgMTAuMiAyNC42IDEwLjIgMzMuMSAwbDQ3LTQ2LjIgNDcuOSA0Ni4yYzkuNCAxMC4yIDI0LjYgMTAuMiAzMy4xIDAgMTAuMi04LjUgMTAuMi0yMy43IDAtMzMuMWwtNDYuMi00Ny45IDQ2LjItNDdjMTAuMi04LjUgMTAuMi0yMy43IDAtMzMuMS04LjUtOS4zLTIzLjctOS4zLTMzLjEgMGwtNDcuOSA0Ny4xLTQ3LTQ3LjFjLTguNS05LjMtMjMuNy05LjMtMzMuMSAwLTkuMyA5LjQtOS4zIDI0LjYgMCAzMy4xeiIvPjwvc3ZnPg==",kE="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iY3VycmVudENvbG9yIiBjbGFzcz0iYmkgYmktdGFibGUiPjxwYXRoIGQ9Ik0wIDJhMiAyIDAgMCAxIDItMmgxMmEyIDIgMCAwIDEgMiAydjEyYTIgMiAwIDAgMS0yIDJIMmEyIDIgMCAwIDEtMi0yVjJ6bTE1IDJoLTR2M2g0VjR6bTAgNGgtNHYzaDRWOHptMCA0aC00djNoM2ExIDEgMCAwIDAgMS0xdi0yem0tNSAzdi0zSDZ2M2g0em0tNSAwdi0zSDF2MmExIDEgMCAwIDAgMSAxaDN6bS00LTRoNFY4SDF2M3ptMC00aDRWNEgxdjN6bTUtM3YzaDRWNEg2em00IDRINnYzaDRWOHoiLz48L3N2Zz4=";function OE(){const[m,c]=we.useState("4"),[p,t]=we.useState("4"),[f,r]=we.useState(!1),[n,e]=we.useState(),[s]=wr(),i=()=>{!m||!p||(s.update(()=>{const l=b0(m,p,!0),o=Wm(l);e(o)}),r(!1))};return le.jsxs(le.Fragment,{children:[le.jsx("button",{title:"Table",className:"toolbar-item ",onClick:()=>r(!0),children:le.jsx("img",{className:"add-toolbar-table-icon",src:kE,alt:"Add Table"})}),f&&le.jsx("div",{className:"modal-overlay",children:le.jsxs("div",{className:"modal-content",children:[le.jsx("h3",{children:"Select Table Dimensions"}),le.jsx("button",{className:"modal-buttons-close",onClick:()=>r(!1),children:le.jsx("img",{src:CE,height:16,width:16,style:{margin:"0 0 29px 10px"}})}),le.jsxs("div",{className:"select-table-container",children:[le.jsx("label",{children:"Rows"}),le.jsx("input",{type:"number",value:m,onChange:l=>c(Number(l.target.value))})]}),le.jsxs("div",{className:"select-table-container",children:[le.jsx("label",{children:"Column"}),le.jsx("input",{type:"number",value:p,onChange:l=>t(Number(l.target.value))})]}),le.jsx("div",{children:le.jsx("div",{className:"modal-buttons",children:le.jsx("button",{className:"toolbar-item",onClick:i,children:"Confirm"})})})]})})]})}const TE=[{letter:"",uppercase:"A",lowercase:"α"},{letter:"Beta",uppercase:"Β",lowercase:"β"},{letter:"Gamma",uppercase:"Γ",lowercase:"γ"},{letter:"Delta",uppercase:"Δ",lowercase:"δ"},{letter:"Epsilon",uppercase:"Ε",lowercase:"ε"},{letter:"Zeta",uppercase:"Ζ",lowercase:"ζ"},{letter:" Eta ",uppercase:"Η",lowercase:"η"},{letter:"Theta",uppercase:"Θ",lowercase:"θ"},{letter:"Iota",uppercase:"Ι",lowercase:"ι"},{letter:"Kappa",uppercase:"Κ",lowercase:"κ"}];function AE(){const[m]=wr(),[c,p]=we.useState(!1),t=f=>{m.update(()=>{var n;const r=Ce();if(ye(r)){const e=r.anchor.getNode();let s="inherit";if(e instanceof Ii){const l=e.getStyle();s=((n=l==null?void 0:l.match(/font-size:\s*(\S+);/))==null?void 0:n[1])||s}const i=nr(f);r.insertNodes([i])}}),p(!1)};return le.jsxs("div",{children:[le.jsx("button",{className:"toolbar-item symbols-toolbar",title:"Symbols",onPointerEnter:()=>p(!c),children:"Symbols"}),c&&le.jsx("div",{className:"modal-overlay-symb",onClick:()=>p(!1),children:le.jsx("div",{className:"modal-content-symb",children:le.jsx("div",{className:"symbol-Flex-container",children:TE.map(({letter:f,uppercase:r,lowercase:n})=>le.jsxs("div",{className:"symbol-items",children:[le.jsx("button",{onClick:()=>t(n),children:n}),le.jsx("button",{onClick:()=>t(r),children:r})]},f))})})})]})}const Jy="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNNCAxMkgyME0xMiA0VjIwIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPg==",Vy="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNNiAxMkwxOCAxMiIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4=";var PE=typeof global=="object"&&global&&global.Object===Object&&global;const jE=PE;var NE=typeof self=="object"&&self&&self.Object===Object&&self,IE=jE||NE||Function("return this")();const Ky=IE;var RE=Ky.Symbol;const Ku=RE;var Gy=Object.prototype,ME=Gy.hasOwnProperty,DE=Gy.toString,tc=Ku?Ku.toStringTag:void 0;function LE(m){var c=ME.call(m,tc),p=m[tc];try{m[tc]=void 0;var t=!0}catch{}var f=DE.call(m);return t&&(c?m[tc]=p:delete m[tc]),f}var BE=Object.prototype,FE=BE.toString;function zE(m){return FE.call(m)}var UE="[object Null]",$E="[object Undefined]",Yy=Ku?Ku.toStringTag:void 0;function HE(m){return m==null?m===void 0?$E:UE:Yy&&Yy in Object(m)?LE(m):zE(m)}function qE(m){return m!=null&&typeof m=="object"}var WE="[object Symbol]";function JE(m){return typeof m=="symbol"||qE(m)&&HE(m)==WE}var VE=/\s/;function KE(m){for(var c=m.length;c--&&VE.test(m.charAt(c)););return c}var GE=/^\s+/;function YE(m){return m&&m.slice(0,KE(m)+1).replace(GE,"")}function Cp(m){var c=typeof m;return m!=null&&(c=="object"||c=="function")}var Zy=0/0,ZE=/^[-+]0x[0-9a-f]+$/i,XE=/^0b[01]+$/i,QE=/^0o[0-7]+$/i,tC=parseInt;function Xy(m){if(typeof m=="number")return m;if(JE(m))return Zy;if(Cp(m)){var c=typeof m.valueOf=="function"?m.valueOf():m;m=Cp(c)?c+"":c}if(typeof m!="string")return m===0?m:+m;m=YE(m);var p=XE.test(m);return p||QE.test(m)?tC(m.slice(2),p?2:8):ZE.test(m)?Zy:+m}var eC=function(){return Ky.Date.now()};const kp=eC;var nC="Expected a function",rC=Math.max,oC=Math.min;function iC(m,c,p){var t,f,r,n,e,s,i=0,l=!1,o=!1,a=!0;if(typeof m!="function")throw new TypeError(nC);c=Xy(c)||0,Cp(p)&&(l=!!p.leading,o="maxWait"in p,r=o?rC(Xy(p.maxWait)||0,c):r,a="trailing"in p?!!p.trailing:a);function d(w){var S=t,C=f;return t=f=void 0,i=w,n=m.apply(C,S),n}function u(w){return i=w,e=setTimeout(y,c),l?d(w):n}function g(w){var S=w-s,C=w-i,k=c-S;return o?oC(k,r-C):k}function h(w){var S=w-s,C=w-i;return s===void 0||S>=c||S<0||o&&C>=r}function y(){var w=kp();if(h(w))return v(w);e=setTimeout(y,g(w))}function v(w){return e=void 0,a&&t?d(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(kp())}function x(){var w=kp(),S=h(w);if(t=arguments,f=this,s=w,S){if(e===void 0)return u(s);if(o)return clearTimeout(e),e=setTimeout(y,c),d(s)}return e===void 0&&(e=setTimeout(y,c)),n}return x.cancel=_,x.flush=b,x}function aC(m,c,p){const t=we.useRef(null);return t.current=m,we.useMemo(()=>iC((...f)=>{t.current&&t.current(...f)},c,{maxWait:p}),[c,p])}const Qy=20;function sC({anchorElem:m}){const[c]=wr(),p=_u(),[t,f]=we.useState(!1),[r,n]=we.useState(!1),[e,s]=we.useState(!1),[i,l]=we.useState({}),o=we.useRef(new Set),a=we.useRef(null),d=aC(y=>{const{isOutside:v,tableDOMNode:_}=lC(y);if(v){f(!1),n(!1);return}if(!_)return;a.current=_;let b=null,x=null,w=null;if(c.update(()=>{var C;const S=sr(_);if(rn(S)){const k=bn(S,D=>Rn(D));if(!Rn(k))return;if(w=c.getElementByKey(k==null?void 0:k.getKey()),w){const D=k.getChildrenSize(),N=(C=k.getChildAtIndex(0))==null?void 0:C.getChildrenSize(),O=Sx(S),R=x0(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:Qy,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:Qy}))}},50,250),u=we.useMemo(()=>new ResizeObserver(()=>{f(!1),n(!1)}),[]);we.useEffect(()=>{if(e)return document.addEventListener("mousemove",d),()=>{f(!1),n(!1),d.cancel(),document.removeEventListener("mousemove",d)}},[e,d]),we.useEffect(()=>_o(c.registerMutationListener(wo,y=>{c.getEditorState().read(()=>{for(const[v,_]of y){const b=c.getElementByKey(v);switch(_){case"created":o.current.add(v),s(o.current.size>0),b&&u.observe(b);break;case"destroyed":o.current.delete(v),s(o.current.size>0),u.disconnect(),o.current.forEach(x=>{const w=c.getElementByKey(x);w&&u.observe(w)});break}}})})),[c,u]);const g=y=>{c.update(()=>{if(a.current){const v=sr(a.current);v==null||v.selectEnd(),y?(Ex(),f(!1)):(Cx(),n(!1))}})},h=y=>{c.update(()=>{if(a.current){const v=sr(a.current);v==null||v.selectEnd(),y?(kx(),f(!1)):(Ox(),n(!1))}})};return p?le.jsxs(le.Fragment,{children:[t&&le.jsxs("div",{children:[le.jsx("button",{className:"PlaygroundEditorTheme__tableAddRows",style:{...i,flex:"50%",padding:"20px"},onClick:()=>g(!0),children:le.jsx("img",{src:Jy,height:14,width:14,style:{color:"grey",marginLeft:"-3px"}})}),le.jsx("button",{className:"PlaygroundEditorTheme__tableAddRows",style:{...i,flex:"50%"},onClick:()=>h(!0),children:le.jsx("img",{src:Vy,height:14,width:14,style:{color:"grey",marginLeft:"-3px"}})})]}),r&&le.jsxs("div",{className:"table-add-row-flex-container",children:[le.jsx("button",{className:"PlaygroundEditorTheme__tableAddColumns table-add-row-flex-children",style:{...i,flex:"50%",padding:"20px"},onClick:()=>g(!1),children:le.jsx("img",{src:Jy,height:14,width:14,style:{color:"grey",marginLeft:"-3px"}})}),le.jsx("button",{className:"PlaygroundEditorTheme__tableAddColumns table-add-row-flex-children",style:{...i,flex:"50%"},onClick:()=>h(!1),children:le.jsx("img",{src:Vy,height:14,width:14,style:{color:"grey",marginLeft:"-3px"}})})]})]}):null}function lC(m){const c=m.target;if(c&&c instanceof HTMLElement){const p=c.closest("td.PlaygroundEditorTheme__tableCell, th.PlaygroundEditorTheme__tableCell");return{isOutside:!(p||c.closest("button.PlaygroundEditorTheme__tableAddRows")||c.closest("button.PlaygroundEditorTheme__tableAddColumns")||c.closest("div.TableCellResizer__resizer")),tableDOMNode:p}}else return{isOutside:!0,tableDOMNode:null}}function cC({anchorElem:m=document.body}){return _u()?Wr.createPortal(le.jsx(sC,{anchorElem:m}),m):null}const ec=1;function Op(){return le.jsx("div",{className:"divider"})}function uC({renderOnlineUsers:m,styleConfig:c}){const[p]=wr(),t=we.useRef(null),[f,r]=we.useState(!1),[n,e]=we.useState(!1),[s,i]=we.useState(!1),[l,o]=we.useState(!1),[a,d]=we.useState(!1),[u,g]=we.useState(!1),[h,y]=we.useState(!1),[v,_]=we.useState(!1),[b,x]=we.useState("11px"),[w,S]=we.useState(()=>p.isEditable()),[C,k]=we.useState(""),[D,N]=we.useState(""),[O,R]=we.useState(""),A=we.useCallback(()=>{const U=Ce();ye(U)&&(i(U.hasFormat("bold")),o(U.hasFormat("italic")),d(U.hasFormat("underline")),g(U.hasFormat("strikethrough")),y(U.hasFormat("subscript")),_(U.hasFormat("superscript")),x(zm(U,"font-size","11px")))},[]);return we.useEffect(()=>_o(p.registerUpdateListener(({editorState:U})=>{U.read(()=>{A()})}),p.registerCommand(Go,U=>{k("");const H=Ce();let q=["Heading1","Heading2","Heading3","paragraph"],M="";return H&&H.style&&(H.style.split(";")[0]&&q.includes(H.style.split(";")[0].split(":")[1].trim(""))&&(M=H.style.split(";")[0].split(":")[1].trim("")),H.style.split(";")[1]&&q.includes(H.style.split(";")[1].split(":")[1].trim(""))&&(M=H.style.split(";")[1].split(":")[1].trim("")),H.style.split(";")[2]&&q.includes(H.style.split(";")[2].split(":")[1].trim(""))&&(M=H.style.split(";")[2].split(":")[1].trim("")),H.style.split(";")[3]&&q.includes(H.style.split(";")[3].split(":")[1].trim(""))&&(M=H.style.split(";")[3].split(":")[1].trim(""))),console.log("SELECTION_CHANGE_COMMAND",H&&H.style&&M),R(H&&H.style?M:"paragraph"),A(),!1},ec),p.registerCommand(is,U=>(r(U),!1),ec),p.registerCommand(os,U=>(e(U),!1),ec),p.registerCommand(qd,U=>(N(U.target),!1),ec),p.registerCommand(ns,U=>(k(U.code),!1),ec)),[p,A]),le.jsxs("div",{className:"toolbar",ref:t,children:[le.jsx("button",{disabled:!f,onClick:()=>{p.dispatchCommand(_l,void 0)},className:"toolbar-item spaced","aria-label":"Undo",children:le.jsx("i",{className:"format undo"})}),le.jsx("button",{disabled:!n,onClick:()=>{p.dispatchCommand(xl,void 0)},className:"toolbar-item","aria-label":"Redo",children:le.jsx("i",{className:"format redo"})}),le.jsx(Op,{}),le.jsx(EE,{currentElementClick:D,selectionFontSize:b.slice(0,-2),editor:p,disabled:!w,blockType:"paragraph",styleConfig:c,isenterPressed:C,currentElementSelect:O}),le.jsx(Op,{}),le.jsx("button",{onClick:()=>{p.dispatchCommand(Tr,"bold")},className:"toolbar-item spaced "+(s?"active":""),"aria-label":"Format Bold",children:le.jsx("i",{className:"format bold"})}),le.jsx("button",{onClick:()=>{p.dispatchCommand(Tr,"italic")},className:"toolbar-item spaced "+(l?"active":""),"aria-label":"Format Italics",children:le.jsx("i",{className:"format italic"})}),le.jsx("button",{onClick:()=>{p.dispatchCommand(Tr,"underline")},className:"toolbar-item spaced "+(a?"active":""),"aria-label":"Format Underline",children:le.jsx("i",{className:"format underline"})}),le.jsx("button",{onClick:()=>{p.dispatchCommand(Tr,"strikethrough")},className:"toolbar-item spaced "+(u?"active":""),"aria-label":"Format Strikethrough",children:le.jsx("i",{className:"format strikethrough"})}),le.jsx("button",{onClick:()=>{p.dispatchCommand(Tr,"superscript")},className:"toolbar-item spaced "+(v?"active":""),"aria-label":"Format SuperScript",children:le.jsx("img",{src:xE,height:16,width:16,style:{marginTop:"1px"}})}),le.jsx("button",{onClick:()=>{p.dispatchCommand(Tr,"subscript")},className:"toolbar-item spaced "+(h?"active":""),"aria-label":"Format SubScript",children:le.jsx("img",{src:_E,height:16,width:16,style:{marginTop:"1px"}})}),le.jsx(Op,{}),le.jsx("button",{onClick:()=>{p.dispatchCommand(rs,"left")},className:"toolbar-item spaced","aria-label":"Left Align",children:le.jsx("i",{className:"format left-align"})}),le.jsx("button",{onClick:()=>{p.dispatchCommand(rs,"center")},className:"toolbar-item spaced","aria-label":"Center Align",children:le.jsx("i",{className:"format center-align"})}),le.jsx("button",{onClick:()=>{p.dispatchCommand(rs,"right")},className:"toolbar-item spaced","aria-label":"Right Align",children:le.jsx("i",{className:"format right-align"})}),le.jsx("button",{onClick:()=>{p.dispatchCommand(rs,"justify")},className:"toolbar-item","aria-label":"Justify Align",children:le.jsx("i",{className:"format justify-align"})}),le.jsx(OE,{}),le.jsx(AE,{}),le.jsx(cC,{}),le.jsx("div",{className:"avtar-outer-div",children:m()})]})}var Tp={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 ev;function fC(){return ev||(ev=1,process.env.NODE_ENV!=="production"&&function(){var m=typeof Symbol=="function"&&Symbol.for,c=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,d=m?Symbol.for("react.memo"):60115,u=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===u||Z.$$typeof===d||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 c: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 u:case d:case n:return Q;default:return rt}}case p:return rt}}}var x=s,w=i,S=e,C=n,k=c,D=l,N=t,O=u,R=d,A=p,U=r,H=f,q=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 $(Z){return b(Z)===n}function V(Z){return typeof Z=="object"&&Z!==null&&Z.$$typeof===c}function K(Z){return b(Z)===l}function z(Z){return b(Z)===t}function F(Z){return b(Z)===u}function T(Z){return b(Z)===d}function j(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=U,En.StrictMode=H,En.Suspense=q,En.isAsyncMode=W,En.isConcurrentMode=G,En.isContextConsumer=I,En.isContextProvider=$,En.isElement=V,En.isForwardRef=K,En.isFragment=z,En.isLazy=F,En.isMemo=T,En.isPortal=j,En.isProfiler=L,En.isStrictMode=B,En.isSuspense=Y,En.isValidElementType=_,En.typeOf=b}()),En}process.env.NODE_ENV==="production"?Tp.exports=dC():Tp.exports=fC();var Gu=Tp.exports;function pC(m){function c($,V,K,z,F){for(var T=0,j=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="",jt;et<wt;){if(Z=K.charCodeAt(et),et===St&&j+B+L+T!==0&&(j!==0&&(Z=j===47?10:47),B=L=T=0,wt++,St++),j+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=H}if(Q=c(V,at,Q,Z,F+1),ht=Q.length,0<M&&(at=p(H,Ct,lt),jt=e(3,Q,at,V,R,O,ht,Z,F,z),Ct=at.join(""),jt!==void 0&&(ht=(Q=jt.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=U===1||U===2&&r("@"+Q,3)?"@-webkit-"+Q+"@"+Q:"@"+Q;break;default:Q=Ct+Q,z===112&&(Q=(At+=Q,""))}else Q="";break;default:Q=c(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&&(jt=e(1,Ct,V,$,R,O,At.length,z,F,z))!==void 0&&(ht=(Ct=jt.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:j===47?j=0:1+Y===0&&z!==107&&0<Ct.length&&(at=1,Ct+="\0"),0<M*G&&e(0,Ct,V,$,R,O,At.length,z,F,z),O=1,R++;break;case 59:case 125:if(j+B+L+T===0){O++;break}default:switch(O++,Rt=K.charAt(et),Z){case 9:case 32:if(B+T+j===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+j+T===0&&(at=lt=1,Rt="\f"+Rt);break;case 108:if(B+j+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+j+T===0&&(nt=et);break;case 44:j+L+B+T===0&&(at=1,Rt+="\r");break;case 34:case 39:j===0&&(B=B===Z?0:B===0?Z:B);break;case 91:B+j+L===0&&T++;break;case 93:B+j+L===0&&T--;break;case 41:B+j+T===0&&L--;break;case 40:if(B+j+T===0){if(Y===0)switch(2*rt+3*X){case 533:break;default:Y=1}L++}break;case 64:j+L+B+T+nt+Q===0&&(Q=1);break;case 42:case 47:if(!(0<B+T+L))switch(j){case 0:switch(2*Z+3*K.charCodeAt(et+1)){case 235:j=47;break;case 220:ht=et,j=42}break;case 42:Z===47&&rt===42&&ht+2!==et&&(K.charCodeAt(ht+2)===33&&(At+=K.substring(ht,et+1)),Rt="",j=0)}}j===0&&(Ct+=Rt)}X=rt,rt=Z,et++}if(ht=At.length,0<ht){if(at=V,0<M&&(jt=e(2,At,at,$,R,O,ht,z,F,z),jt!==void 0&&(At=jt).length===0))return Nt+At+mt;if(At=at.join(",")+"{"+At+"}",U*A!==0){switch(U!==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($,V,K){var z=V.trim().split(h);V=z;var F=z.length,T=$.length;switch(T){case 0:case 1:var j=0;for($=T===0?"":$[0]+" ";j<F;++j)V[j]=t($,V[j],K).trim();break;default:var L=j=0;for(V=[];j<F;++j)for(var B=0;B<T;++B)V[L++]=t($[B]+" ",z[j],K).trim()}return V}function t($,V,K){var z=V.charCodeAt(0);switch(33>z&&(z=(V=V.trim()).charCodeAt(0)),z){case 38:return V.replace(y,"$1"+$.trim());case 58:return $.trim()+V.replace(y,"$1"+$.trim());default:if(0<1*K&&0<V.indexOf("\f"))return V.replace(y,($.charCodeAt(0)===58?"":"$1")+$.trim())}return $+V}function f($,V,K,z){var F=$+";",T=2*V+3*K+4*z;if(T===944){$=F.indexOf(":",9)+1;var j=F.substring($,F.length-1).trim();return j=F.substring(0,$).trim()+j+";",U===1||U===2&&r(j,1)?"-webkit-"+j+j:j}if(U===0||U===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 j=F.substring(F.indexOf(":",15)).replace("flex-","").replace("space-between","justify"),"-webkit-box-pack"+j+"-webkit-"+F+"-ms-flex-pack"+j+F;case 1005:return u.test(F)?F.replace(d,":-webkit-")+F.replace(d,":-moz-")+F:F;case 1e3:switch(j=F.substring(13).trim(),V=j.indexOf("-")+1,j.charCodeAt(0)+j.charCodeAt(V)){case 226:j=F.replace(x,"tb");break;case 232:j=F.replace(x,"tb-rl");break;case 220:j=F.replace(x,"lr");break;default:return F}return"-webkit-"+F+"-ms-"+j+F;case 1017:if(F.indexOf("sticky",9)===-1)break;case 975:switch(V=(F=$).length-10,j=(F.charCodeAt(V)===33?F.substring(0,V):F).substring($.indexOf(":",7)+1).trim(),T=j.charCodeAt(0)+(j.charCodeAt(7)|0)){case 203:if(111>j.charCodeAt(8))break;case 115:F=F.replace(j,"-webkit-"+j)+";"+F;break;case 207:case 102:F=F.replace(j,"-webkit-"+(102<T?"inline-":"")+"box")+";"+F.replace(j,"-webkit-"+j)+";"+F.replace(j,"-ms-"+j+"box")+";"+F}return F+";";case 938:if(F.charCodeAt(5)===45)switch(F.charCodeAt(6)){case 105:return j=F.replace("-items",""),"-webkit-"+F+"-webkit-box-"+j+"-ms-flex-"+j+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($)===!0)return(j=$.substring($.indexOf(":")+1)).charCodeAt(0)===115?f($.replace("stretch","fill-available"),V,K,z).replace(":fill-available",":stretch"):F.replace(j,"-webkit-"+j)+F.replace(j,"-moz-"+j.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($,V){var K=$.indexOf(V===1?":":"{"),z=$.substring(0,V!==3?K:10);return K=$.substring(K+1,$.length-1),W(V!==2?z:z.replace(k,"$1"),K,V)}function n($,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($,V,K,z,F,T,j,L,B,Y){for(var Z=0,rt=V,X;Z<M;++Z)switch(X=q[Z].call(l,$,rt,K,z,F,T,j,L,B,Y)){case void 0:case!1:case!0:case null:break;default:rt=X}if(rt!==V)return rt}function s($){switch($){case void 0:case null:M=q.length=0;break;default:if(typeof $=="function")q[M++]=$;else if(typeof $=="object")for(var V=0,K=$.length;V<K;++V)s($[V]);else G=!!$|0}return s}function i($){return $=$.prefix,$!==void 0&&(W=null,$?typeof $!="function"?U=1:(U=2,W=$):U=0),i}function l($,V){var K=$;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=c(H,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,d=/: */g,u=/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,U=1,H=[],q=[],M=0,W=null,G=0,I="";return l.use=s,l.set=i,m!==void 0&&i(m),l}var hC={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 gC(m){var c=Object.create(null);return function(p){return c[p]===void 0&&(c[p]=m(p)),c[p]}}var mC=/^((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)-.*))$/,nv=gC(function(m){return mC.test(m)||m.charCodeAt(0)===111&&m.charCodeAt(1)===110&&m.charCodeAt(2)<91}),Ap=Gu,yC={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},vC={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},bC={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},rv={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Pp={};Pp[Ap.ForwardRef]=bC,Pp[Ap.Memo]=rv;function ov(m){return Ap.isMemo(m)?rv:Pp[m.$$typeof]||yC}var _C=Object.defineProperty,xC=Object.getOwnPropertyNames,iv=Object.getOwnPropertySymbols,wC=Object.getOwnPropertyDescriptor,SC=Object.getPrototypeOf,av=Object.prototype;function sv(m,c,p){if(typeof c!="string"){if(av){var t=SC(c);t&&t!==av&&sv(m,t,p)}var f=xC(c);iv&&(f=f.concat(iv(c)));for(var r=ov(m),n=ov(c),e=0;e<f.length;++e){var s=f[e];if(!vC[s]&&!(p&&p[s])&&!(n&&n[s])&&!(r&&r[s])){var i=wC(c,s);try{_C(m,s,i)}catch{}}}}return m}var EC=sv;const CC=s1(EC);function fi(){return(fi=Object.assign||function(m){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var t in p)Object.prototype.hasOwnProperty.call(p,t)&&(m[t]=p[t])}return m}).apply(this,arguments)}var lv=function(m,c){for(var p=[m[0]],t=0,f=c.length;t<f;t+=1)p.push(c[t],m[t+1]);return p},jp=function(m){return m!==null&&typeof m=="object"&&(m.toString?m.toString():Object.prototype.toString.call(m))==="[object Object]"&&!Gu.typeOf(m)},Yu=Object.freeze([]),Gi=Object.freeze({});function nc(m){return typeof m=="function"}function Np(m){return process.env.NODE_ENV!=="production"&&typeof m=="string"&&m||m.displayName||m.name||"Component"}function Ip(m){return m&&typeof m.styledComponentId=="string"}var Ws=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",Rp=typeof window<"u"&&"HTMLElement"in window,kC=!!(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")),OC=process.env.NODE_ENV!=="production"?{1:`Cannot create styled-component for component: %s.
|
|
1443
|
+
*/var ev;function fC(){return ev||(ev=1,process.env.NODE_ENV!=="production"&&function(){var m=typeof Symbol=="function"&&Symbol.for,c=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,d=m?Symbol.for("react.memo"):60115,u=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===u||Z.$$typeof===d||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 c: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 u:case d:case n:return Q;default:return rt}}case p:return rt}}}var x=s,w=i,S=e,C=n,k=c,D=l,N=t,O=u,R=d,A=p,U=r,H=f,q=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 $(Z){return b(Z)===n}function V(Z){return typeof Z=="object"&&Z!==null&&Z.$$typeof===c}function K(Z){return b(Z)===l}function z(Z){return b(Z)===t}function F(Z){return b(Z)===u}function T(Z){return b(Z)===d}function j(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=U,En.StrictMode=H,En.Suspense=q,En.isAsyncMode=W,En.isConcurrentMode=G,En.isContextConsumer=I,En.isContextProvider=$,En.isElement=V,En.isForwardRef=K,En.isFragment=z,En.isLazy=F,En.isMemo=T,En.isPortal=j,En.isProfiler=L,En.isStrictMode=B,En.isSuspense=Y,En.isValidElementType=_,En.typeOf=b}()),En}process.env.NODE_ENV==="production"?Tp.exports=dC():Tp.exports=fC();var Gu=Tp.exports;function pC(m){function c($,V,K,z,F){for(var T=0,j=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="",jt;et<wt;){if(Z=K.charCodeAt(et),et===St&&j+B+L+T!==0&&(j!==0&&(Z=j===47?10:47),B=L=T=0,wt++,St++),j+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=H}if(Q=c(V,at,Q,Z,F+1),ht=Q.length,0<M&&(at=p(H,Ct,lt),jt=e(3,Q,at,V,R,O,ht,Z,F,z),Ct=at.join(""),jt!==void 0&&(ht=(Q=jt.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=U===1||U===2&&r("@"+Q,3)?"@-webkit-"+Q+"@"+Q:"@"+Q;break;default:Q=Ct+Q,z===112&&(Q=(At+=Q,""))}else Q="";break;default:Q=c(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&&(jt=e(1,Ct,V,$,R,O,At.length,z,F,z))!==void 0&&(ht=(Ct=jt.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:j===47?j=0:1+Y===0&&z!==107&&0<Ct.length&&(at=1,Ct+="\0"),0<M*G&&e(0,Ct,V,$,R,O,At.length,z,F,z),O=1,R++;break;case 59:case 125:if(j+B+L+T===0){O++;break}default:switch(O++,Rt=K.charAt(et),Z){case 9:case 32:if(B+T+j===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+j+T===0&&(at=lt=1,Rt="\f"+Rt);break;case 108:if(B+j+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+j+T===0&&(nt=et);break;case 44:j+L+B+T===0&&(at=1,Rt+="\r");break;case 34:case 39:j===0&&(B=B===Z?0:B===0?Z:B);break;case 91:B+j+L===0&&T++;break;case 93:B+j+L===0&&T--;break;case 41:B+j+T===0&&L--;break;case 40:if(B+j+T===0){if(Y===0)switch(2*rt+3*X){case 533:break;default:Y=1}L++}break;case 64:j+L+B+T+nt+Q===0&&(Q=1);break;case 42:case 47:if(!(0<B+T+L))switch(j){case 0:switch(2*Z+3*K.charCodeAt(et+1)){case 235:j=47;break;case 220:ht=et,j=42}break;case 42:Z===47&&rt===42&&ht+2!==et&&(K.charCodeAt(ht+2)===33&&(At+=K.substring(ht,et+1)),Rt="",j=0)}}j===0&&(Ct+=Rt)}X=rt,rt=Z,et++}if(ht=At.length,0<ht){if(at=V,0<M&&(jt=e(2,At,at,$,R,O,ht,z,F,z),jt!==void 0&&(At=jt).length===0))return Nt+At+mt;if(At=at.join(",")+"{"+At+"}",U*A!==0){switch(U!==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($,V,K){var z=V.trim().split(h);V=z;var F=z.length,T=$.length;switch(T){case 0:case 1:var j=0;for($=T===0?"":$[0]+" ";j<F;++j)V[j]=t($,V[j],K).trim();break;default:var L=j=0;for(V=[];j<F;++j)for(var B=0;B<T;++B)V[L++]=t($[B]+" ",z[j],K).trim()}return V}function t($,V,K){var z=V.charCodeAt(0);switch(33>z&&(z=(V=V.trim()).charCodeAt(0)),z){case 38:return V.replace(y,"$1"+$.trim());case 58:return $.trim()+V.replace(y,"$1"+$.trim());default:if(0<1*K&&0<V.indexOf("\f"))return V.replace(y,($.charCodeAt(0)===58?"":"$1")+$.trim())}return $+V}function f($,V,K,z){var F=$+";",T=2*V+3*K+4*z;if(T===944){$=F.indexOf(":",9)+1;var j=F.substring($,F.length-1).trim();return j=F.substring(0,$).trim()+j+";",U===1||U===2&&r(j,1)?"-webkit-"+j+j:j}if(U===0||U===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 j=F.substring(F.indexOf(":",15)).replace("flex-","").replace("space-between","justify"),"-webkit-box-pack"+j+"-webkit-"+F+"-ms-flex-pack"+j+F;case 1005:return u.test(F)?F.replace(d,":-webkit-")+F.replace(d,":-moz-")+F:F;case 1e3:switch(j=F.substring(13).trim(),V=j.indexOf("-")+1,j.charCodeAt(0)+j.charCodeAt(V)){case 226:j=F.replace(x,"tb");break;case 232:j=F.replace(x,"tb-rl");break;case 220:j=F.replace(x,"lr");break;default:return F}return"-webkit-"+F+"-ms-"+j+F;case 1017:if(F.indexOf("sticky",9)===-1)break;case 975:switch(V=(F=$).length-10,j=(F.charCodeAt(V)===33?F.substring(0,V):F).substring($.indexOf(":",7)+1).trim(),T=j.charCodeAt(0)+(j.charCodeAt(7)|0)){case 203:if(111>j.charCodeAt(8))break;case 115:F=F.replace(j,"-webkit-"+j)+";"+F;break;case 207:case 102:F=F.replace(j,"-webkit-"+(102<T?"inline-":"")+"box")+";"+F.replace(j,"-webkit-"+j)+";"+F.replace(j,"-ms-"+j+"box")+";"+F}return F+";";case 938:if(F.charCodeAt(5)===45)switch(F.charCodeAt(6)){case 105:return j=F.replace("-items",""),"-webkit-"+F+"-webkit-box-"+j+"-ms-flex-"+j+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($)===!0)return(j=$.substring($.indexOf(":")+1)).charCodeAt(0)===115?f($.replace("stretch","fill-available"),V,K,z).replace(":fill-available",":stretch"):F.replace(j,"-webkit-"+j)+F.replace(j,"-moz-"+j.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($,V){var K=$.indexOf(V===1?":":"{"),z=$.substring(0,V!==3?K:10);return K=$.substring(K+1,$.length-1),W(V!==2?z:z.replace(k,"$1"),K,V)}function n($,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($,V,K,z,F,T,j,L,B,Y){for(var Z=0,rt=V,X;Z<M;++Z)switch(X=q[Z].call(l,$,rt,K,z,F,T,j,L,B,Y)){case void 0:case!1:case!0:case null:break;default:rt=X}if(rt!==V)return rt}function s($){switch($){case void 0:case null:M=q.length=0;break;default:if(typeof $=="function")q[M++]=$;else if(typeof $=="object")for(var V=0,K=$.length;V<K;++V)s($[V]);else G=!!$|0}return s}function i($){return $=$.prefix,$!==void 0&&(W=null,$?typeof $!="function"?U=1:(U=2,W=$):U=0),i}function l($,V){var K=$;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=c(H,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,d=/: */g,u=/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,U=1,H=[],q=[],M=0,W=null,G=0,I="";return l.use=s,l.set=i,m!==void 0&&i(m),l}var hC={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 gC(m){var c=Object.create(null);return function(p){return c[p]===void 0&&(c[p]=m(p)),c[p]}}var mC=/^((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)-.*))$/,nv=gC(function(m){return mC.test(m)||m.charCodeAt(0)===111&&m.charCodeAt(1)===110&&m.charCodeAt(2)<91}),Ap=Gu,yC={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},vC={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},bC={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},rv={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Pp={};Pp[Ap.ForwardRef]=bC,Pp[Ap.Memo]=rv;function ov(m){return Ap.isMemo(m)?rv:Pp[m.$$typeof]||yC}var _C=Object.defineProperty,xC=Object.getOwnPropertyNames,iv=Object.getOwnPropertySymbols,wC=Object.getOwnPropertyDescriptor,SC=Object.getPrototypeOf,av=Object.prototype;function sv(m,c,p){if(typeof c!="string"){if(av){var t=SC(c);t&&t!==av&&sv(m,t,p)}var f=xC(c);iv&&(f=f.concat(iv(c)));for(var r=ov(m),n=ov(c),e=0;e<f.length;++e){var s=f[e];if(!vC[s]&&!(p&&p[s])&&!(n&&n[s])&&!(r&&r[s])){var i=wC(c,s);try{_C(m,s,i)}catch{}}}}return m}var EC=sv;const CC=s1(EC);function fi(){return(fi=Object.assign||function(m){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var t in p)Object.prototype.hasOwnProperty.call(p,t)&&(m[t]=p[t])}return m}).apply(this,arguments)}var lv=function(m,c){for(var p=[m[0]],t=0,f=c.length;t<f;t+=1)p.push(c[t],m[t+1]);return p},jp=function(m){return m!==null&&typeof m=="object"&&(m.toString?m.toString():Object.prototype.toString.call(m))==="[object Object]"&&!Gu.typeOf(m)},Yu=Object.freeze([]),Gi=Object.freeze({});function nc(m){return typeof m=="function"}function Np(m){return process.env.NODE_ENV!=="production"&&typeof m=="string"&&m||m.displayName||m.name||"Component"}function Ip(m){return m&&typeof m.styledComponentId=="string"}var Ws=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",Rp=typeof window<"u"&&"HTMLElement"in window,kC=!!(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")),OC=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
|
|
|
@@ -1501,5 +1501,5 @@ Read more about this at https://www.styled-components.com/docs/basics#react-nati
|
|
|
1501
1501
|
|
|
1502
1502
|
See https://s-c.sh/2BAXzed for more info.`),window["__styled-components-init__"]+=1);const uk=zp,Up=gE([...[wo,$l,Fi,wu]]);function dk(){return le.jsx("div",{className:"editor-placeholder"})}const fk={namespace:"React.js Demo",nodes:Up,onError(m){throw m},theme:bE},pk=()=>le.jsx(le.Fragment,{children:"hello"});function hk({collabApiKey:m,styleConfig:c,userObj:p}){const[t,f]=we.useState(!1),[r,n]=we.useState([]),[e,s]=we.useState("demo_docId_1"),[i,l]=we.useState({root:null}),{userId:o,userName:a,userEmail:d}=p,{pageMargin:u}=c||{},g=we.useRef(),y={docId:e,apiKey:m,user:{name:a,id:o,email:d},hooks:{contentChanged:({source:S,content:C})=>{},usersUpdate:S=>{n(S)}}},v=()=>{g.current&&g.current.start(y).then(()=>{console.log("[Lexical Demo][codox.start] success"),f(!0)}).catch(S=>console.log("[Lexical Demo][codox.start] error",S))};we.useEffect(()=>()=>{_()},[]);const _=()=>{g.current&&g.current.stop(),f(!1)};let b={root:{children:[{children:[],direction:"ltr",format:"",indent:0,type:"paragraph",version:1,textFormat:0,showUI:!0}],direction:"ltr",format:"",indent:0,type:"root",version:1}};we.useEffect(()=>{(async()=>{if(!e)return;t&&_();let S=b;if(S)try{mE(S,Up),l(S)}catch(C){console.error("[APP] error: ",C)}})()},[e]),we.useEffect(()=>{i&&e&&!t&&v()},[i,e,t]),we.useMemo(()=>({editorState:i?JSON.stringify({root:i.root}):null,namespace:"Playground",nodes:Up,onError:S=>{throw S},theme:{}}),[i]);const x=()=>{let S=[],C=[];return r&&r.length>0&&r.map((k,D)=>{C.includes(k.name)||(C.push(k.name),S.push(le.jsxs("div",{title:k.email,className:`avatarStyle avatar-color-${D+1}`,children:[" ",k.name&&k.name[0],k.name&&k.name[4]]},D)))}),le.jsx("div",{className:"flexContainer",children:S})},w=uk.div`
|
|
1503
1503
|
padding: ${u||"56px"}
|
|
1504
|
-
`;return le.jsx("div",{children:le.jsx(Am,{initialConfig:fk,children:le.jsxs("div",{className:"editor-container",children:[le.jsx(uC,{renderOnlineUsers:x,styleConfig:c}),le.jsxs("div",{className:"editor-inner",children:[le.jsx(ux,{contentEditable:le.jsx(w,{children:le.jsx(jm,{className:"editor-input"})}),placeholder:le.jsx(dk,{}),ErrorBoundary:pk}),le.jsx(hE,{ref:g}),le.jsx(Gm,{}),le.jsx(vE,{}),le.jsx(Pm,{})]})]})})})}Br.Editor=hk,Object.defineProperty(Br,Symbol.toStringTag,{value:"Module"})});
|
|
1504
|
+
`;return le.jsx("div",{children:le.jsx(Am,{initialConfig:fk,children:le.jsxs("div",{className:"editor-container",children:[le.jsx(uC,{renderOnlineUsers:x,styleConfig:c}),le.jsxs("div",{className:"editor-inner",children:[le.jsx(ux,{contentEditable:le.jsx(w,{children:le.jsx(jm,{className:"editor-input",autoFocus:!0})}),placeholder:le.jsx(dk,{}),ErrorBoundary:pk}),le.jsx(hE,{ref:g}),le.jsx(Gm,{}),le.jsx(vE,{}),le.jsx(Pm,{})]})]})})})}Br.Editor=hk,Object.defineProperty(Br,Symbol.toStringTag,{value:"Module"})});
|
|
1505
1505
|
//# sourceMappingURL=index.umd.js.map
|