@tryghost/koenig-lexical 0.0.33 → 0.0.34

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.
@@ -28,7 +28,7 @@
28
28
  `}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>{let n=e.parentElement;return n!=null&&n.firstChild===e&&n.lastChild===e?null:{conversion:Kd,priority:0}}}}static importJSON(){return xn()}exportJSON(){return{type:"linebreak",version:1}}}function Kd(){return{node:xn()}}function xn(){return new Dt}function _n(t){return t instanceof Dt}function wi(t,e){return e&16?"code":e&32?"sub":e&64?"sup":null}function yi(t,e){return e&1?"strong":e&2?"em":"span"}function ki(t,e,n,r,i){t=r.classList,r=nn(i,"base"),r!==void 0&&t.add(...r),r=nn(i,"underlineStrikethrough");let o=!1,l=e&8&&e&4;var s=n&8&&n&4;r!==void 0&&(s?(o=!0,l||t.add(...r)):l&&t.remove(...r));for(let a in ht)s=ht[a],r=nn(i,a),r!==void 0&&(n&s?!o||a!=="underline"&&a!=="strikethrough"?((e&s)===0||l&&a==="underline"||a==="strikethrough")&&t.add(...r):e&s&&t.remove(...r):e&s&&t.remove(...r))}function Ci(t,e,n){let r=e.firstChild;if(n=n.isComposing(),t+=n?Gn:"",r==null)e.textContent=t;else if(e=r.nodeValue,e!==t)if(n||gt){n=e.length;let i=t.length,o=0,l=0;for(;o<n&&o<i&&e[o]===t[o];)o++;for(;l+o<n&&l+o<i&&e[n-l-1]===t[i-l-1];)l++;t=[o,n-o-l,t.slice(o,i-l)];let[s,a,c]=t;a!==0&&r.deleteData(s,a),r.insertData(s,c)}else r.nodeValue=t}class It extends dr{static getType(){return"text"}static clone(e){return new It(e.__text,e.__key)}constructor(e,n){super(n),this.__text=e,this.__format=0,this.__style="",this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let e=this.getLatest();return _d[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===rt()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return(this.getLatest().__detail&1)!==0}isUnmergeable(){return(this.getLatest().__detail&2)!==0}hasFormat(e){return e=ht[e],(this.getFormat()&e)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,n){let r=this.getLatest().__format;return tl(r,e,n)}createDOM(e){var n=this.__format,r=wi(this,n);let i=yi(this,n),o=document.createElement(r===null?i:r),l=o;return r!==null&&(l=document.createElement(i),o.appendChild(l)),r=l,Ci(this.__text,r,this),e=e.theme.text,e!==void 0&&ki(i,0,n,r,e),n=this.__style,n!==""&&(o.style.cssText=n),o}updateDOM(e,n,r){let i=this.__text;var o=e.__format,l=this.__format,s=wi(this,o);let a=wi(this,l);var c=yi(this,o);let d=yi(this,l);return(s===null?c:s)!==(a===null?d:a)?!0:s===a&&c!==d?(o=n.firstChild,o==null&&M(48),e=s=document.createElement(d),Ci(i,e,this),r=r.theme.text,r!==void 0&&ki(d,0,l,e,r),n.replaceChild(s,o),!1):(c=n,a!==null&&s!==null&&(c=n.firstChild,c==null&&M(49)),Ci(i,c,this),r=r.theme.text,r!==void 0&&o!==l&&ki(d,o,l,c,r),l=this.__style,e.__style!==l&&(n.style.cssText=l),!1)}static importDOM(){return{"#text":()=>({conversion:Vd,priority:0}),b:()=>({conversion:Ud,priority:0}),code:()=>({conversion:vn,priority:0}),em:()=>({conversion:vn,priority:0}),i:()=>({conversion:vn,priority:0}),span:()=>({conversion:Wd,priority:0}),strong:()=>({conversion:vn,priority:0}),u:()=>({conversion:vn,priority:0})}}static importJSON(e){let n=me(e.text);return n.setFormat(e.format),n.setDetail(e.detail),n.setMode(e.mode),n.setStyle(e.style),n}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(e){let n=this.getWritable();return n.__format=typeof e=="string"?ht[e]:e,n}setDetail(e){let n=this.getWritable();return n.__detail=typeof e=="string"?pd[e]:e,n}setStyle(e){let n=this.getWritable();return n.__style=e,n}toggleFormat(e){return e=ht[e],this.setFormat(this.getFormat()^e)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){e=xd[e];let n=this.getWritable();return n.__mode=e,n}setTextContent(e){let n=this.getWritable();return n.__text=e,n}select(e,n){Oe();let r=G();var i=this.getTextContent();let o=this.__key;if(typeof i=="string"?(i=i.length,e===void 0&&(e=i),n===void 0&&(n=i)):n=e=0,B(r))i=rt(),i!==r.anchor.key&&i!==r.focus.key||pe(o),r.setTextNodeRange(this,e,this,n);else return Kl(o,e,o,n,"text","text");return r}spliceText(e,n,r,i){let o=this.getWritable(),l=o.__text,s=r.length,a=e;0>a&&(a=s+a,0>a&&(a=0));let c=G();return i&&B(c)&&(e+=s,c.setTextNodeRange(o,e,o,e)),n=l.slice(0,a)+r+l.slice(a+n),o.__text=n,o}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Oe();var n=this.getLatest(),r=n.getTextContent(),i=n.__key,o=rt(),l=new Set(e);e=[];for(var s=r.length,a="",c=0;c<s;c++)a!==""&&l.has(c)&&(e.push(a),a=""),a+=r[c];if(a!==""&&e.push(a),l=e.length,l===0)return[];if(e[0]===r)return[n];var d=e[0];r=n.getParentOrThrow(),c=r.__key;let u=n.getFormat(),g=n.getStyle(),m=n.__detail;s=!1,n.isSegmented()?(a=me(d),a.__parent=c,a.__format=u,a.__style=g,a.__detail=m,s=!0):(a=n.getWritable(),a.__text=d),n=G(),a=[a],d=d.length;for(let C=1;C<l;C++){var f=e[C],v=f.length;f=me(f).getWritable(),f.__format=u,f.__style=g,f.__detail=m;let N=f.__key;if(v=d+v,B(n)){let p=n.anchor,x=n.focus;p.key===i&&p.type==="text"&&p.offset>d&&p.offset<=v&&(p.key=N,p.offset-=d,n.dirty=!0),x.key===i&&x.type==="text"&&x.offset>d&&x.offset<=v&&(x.key=N,x.offset-=d,n.dirty=!0)}o===i&&pe(N),d=v,f.__parent=c,a.push(f)}return bt(this),o=r.getWritable().__children,i=o.indexOf(i),e=a.map(C=>C.__key),s?(o.splice(i,0,...e),this.remove()):o.splice(i,1,...e),B(n)&&ar(n,r,i,l-1),a}mergeWithSibling(e){var n=e===this.getPreviousSibling();n||e===this.getNextSibling()||M(50);var r=this.__key;let i=e.__key,o=this.__text,l=o.length;rt()===i&&pe(r);let s=G();if(B(s)){let a=s.anchor,c=s.focus;a!==null&&a.key===i&&(Yl(a,n,r,e,l),s.dirty=!0),c!==null&&c.key===i&&(Yl(c,n,r,e,l),s.dirty=!0)}return r=e.__text,this.setTextContent(n?r+o:o+r),n=this.getWritable(),e.remove(),n}isTextEntity(){return!1}}function Wd(t){let e=t.style.fontWeight==="700",n=t.style.textDecoration==="line-through",r=t.style.fontStyle==="italic",i=t.style.textDecoration==="underline",o=t.style.verticalAlign;return{forChild:l=>(L(l)&&(e&&l.toggleFormat("bold"),n&&l.toggleFormat("strikethrough"),r&&l.toggleFormat("italic"),i&&l.toggleFormat("underline"),o==="sub"&&l.toggleFormat("subscript"),o==="super"&&l.toggleFormat("superscript")),l),node:null}}function Ud(t){let e=t.style.fontWeight==="normal";return{forChild:n=>(L(n)&&!e&&n.toggleFormat("bold"),n),node:null}}function Vd(t,e,n){return t=t.textContent||"",!n&&/\n/.test(t)&&(t=t.replace(/\r?\n/gm," "),t.trim().length===0)?{node:null}:{node:me(t)}}let Yd={code:"code",em:"italic",i:"italic",strong:"bold",u:"underline"};function vn(t){let e=Yd[t.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:n=>(L(n)&&n.toggleFormat(e),n),node:null}}function me(t=""){return new It(t)}function L(t){return t instanceof It}class Pt extends mt{static getType(){return"paragraph"}static clone(e){return new Pt(e.__key)}createDOM(e){let n=document.createElement("p");return e=nn(e.theme,"paragraph"),e!==void 0&&n.classList.add(...e),n}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:jd,priority:0})}}exportDOM(e){if({element:e}=super.exportDOM(e),e&&this.isEmpty()&&e.append(document.createElement("br")),e){var n=this.getFormatType();e.style.textAlign=n,(n=this.getDirection())&&(e.dir=n),n=this.getIndent(),0<n&&(e.style.textIndent=`${20*n}px`)}return{element:e}}static importJSON(e){let n=Ft();return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(){let e=Ft(),n=this.getDirection();return e.setDirection(n),this.insertAfter(e),e}collapseAtStart(){let e=this.getChildren();if(e.length===0||L(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function jd(){return{node:Ft()}}function Ft(){return new Pt}function es(t,e,n,r){let i=t._keyToDOMMap;i.clear(),t._editorState=vi(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],r=t._observer,r!==null&&(r.disconnect(),t._observer=null),e!==null&&(e.textContent=""),n!==null&&(n.textContent="",i.set("root",n))}function Gd(t){let e=new Map,n=new Set;return t.forEach(r=>{if(r=r.klass.importDOM!=null?r.klass.importDOM.bind(r.klass):null,r!=null&&!n.has(r)){n.add(r);var i=r();i!==null&&Object.keys(i).forEach(o=>{let l=e.get(o);l===void 0&&(l=[],e.set(o,l)),l.push(i[o])})}}),e}class Zd{constructor(e,n,r,i,o,l){this._parentEditor=n,this._rootElement=null,this._editorState=e,this._compositionKey=this._pendingEditorState=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=i,this._nodes=r,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=sl(),this._onError=o,this._htmlConversions=l,this._editable=!0,this._headless=!1,this._window=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){let n=this._listeners.update;return n.add(e),()=>{n.delete(e)}}registerEditableListener(e){let n=this._listeners.editable;return n.add(e),()=>{n.delete(e)}}registerDecoratorListener(e){let n=this._listeners.decorator;return n.add(e),()=>{n.delete(e)}}registerTextContentListener(e){let n=this._listeners.textcontent;return n.add(e),()=>{n.delete(e)}}registerRootListener(e){let n=this._listeners.root;return e(this._rootElement,null),n.add(e),()=>{e(null,this._rootElement),n.delete(e)}}registerCommand(e,n,r){r===void 0&&M(35);let i=this._commands;i.has(e)||i.set(e,[new Set,new Set,new Set,new Set,new Set]);let o=i.get(e);o===void 0&&M(36);let l=o[r];return l.add(n),()=>{l.delete(n),o.every(s=>s.size===0)&&i.delete(e)}}registerMutationListener(e,n){this._nodes.get(e.getType())===void 0&&M(37);let r=this._listeners.mutation;return r.set(n,e),()=>{r.delete(n)}}registerNodeTransform(e,n){e=e.getType();let r=this._nodes.get(e);r===void 0&&M(37);let i=r.transforms;return i.add(n),Cd(this,e),()=>{i.delete(n)}}hasNodes(e){for(let n=0;n<e.length;n++){let r=e[n].getType();if(!this._nodes.has(r))return!1}return!0}dispatchCommand(e,n){return A(this,e,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let n=this._rootElement;if(e!==n){let o=nn(this._config.theme,"root");var r=this._pendingEditorState||this._editorState;if(this._rootElement=e,es(this,n,e,r),n!==null){if(!this._config.disableEvents){if(dn!==0&&(dn--,dn===0&&n.ownerDocument.removeEventListener("selectionchange",Al)),r=n.__lexicalEditor,r!=null){if(r._parentEditor!==null){var i=qr(r);i=i[i.length-1]._key,At.get(i)===r&&At.delete(i)}else At.delete(r._key);n.__lexicalEditor=null}for(r=$l(n),i=0;i<r.length;i++)r[i]();n.__lexicalEventHandles=[]}o!=null&&n.classList.remove(...o)}e!==null?(r=(r=e.ownerDocument)&&r.defaultView||null,i=e.style,i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=r,this._dirtyType=2,qo(this),this._updateTags.add("history-merge"),pt(this),this._config.disableEvents||Id(e,this),o!=null&&e.classList.add(...o)):this._window=null,mn("root",this,!1,e,n)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&M(38),Qo(this);let r=this._pendingEditorState,i=this._updateTags;n=n!==void 0?n.tag:null,r===null||r.isEmpty()||(n!=null&&i.add(n),pt(this)),this._pendingEditorState=e,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,n!=null&&i.add(n),pt(this)}parseEditorState(e,n){e=typeof e=="string"?JSON.parse(e):e;let r=vi(),i=ye,o=le,l=fe,s=this._dirtyElements,a=this._dirtyLeaves,c=this._cloneNotNeeded,d=this._dirtyType;this._dirtyElements=new Map,this._dirtyLeaves=new Set,this._cloneNotNeeded=new Set,this._dirtyType=0,ye=r,le=!1,fe=this;try{xi(e.root,this._nodes),n&&n(),r._readOnly=!0}finally{this._dirtyElements=s,this._dirtyLeaves=a,this._cloneNotNeeded=c,this._dirtyType=d,ye=i,le=o,fe=l}return r}update(e,n){Re(this,e,n)}focus(e,n={}){let r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),Re(this,()=>{let i=G(),o=it();i!==null?i.dirty=!0:o.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?o.selectStart():o.selectEnd())},{onUpdate:()=>{r.removeAttribute("autocapitalize"),e&&e()}}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){var e=this._rootElement;e!==null&&e.blur(),e=Ee?window.getSelection():null,e!==null&&e.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,mn("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}class ts extends mt{constructor(e,n){super(n),this.__colSpan=e}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan}}}function ns(t){return t instanceof ts}class rs extends mt{}function is(t){return t instanceof rs}class os extends mt{}function ls(t){return t instanceof os}b.$addUpdateTag=function(t){Oe(),se()._updateTags.add(t)},b.$createLineBreakNode=xn,b.$createNodeSelection=Wl,b.$createParagraphNode=Ft,b.$createRangeSelection=function(){let t=new We("root",0,"element"),e=new We("root",0,"element");return new Mt(t,e,0)},b.$createTextNode=me,b.$getDecoratorNode=ul,b.$getNearestNodeFromDOMNode=tn,b.$getNearestRootOrShadowRoot=hl,b.$getNodeByKey=J,b.$getPreviousSelection=fn,b.$getRoot=it,b.$getSelection=G,b.$getTextContent=function(){let t=G();return t===null?"":t.getTextContent()},b.$hasAncestor=qn,b.$insertNodes=function(t,e){let n=G();return n===null&&(n=it().selectEnd()),n.insertNodes(t,e)},b.$isDecoratorNode=ne,b.$isElementNode=R,b.$isInlineElementOrDecoratorNode=function(t){return R(t)&&t.isInline()||ne(t)&&t.isInline()},b.$isLeafNode=nl,b.$isLineBreakNode=_n,b.$isNodeSelection=hn,b.$isParagraphNode=function(t){return t instanceof Pt},b.$isRangeSelection=B,b.$isRootNode=Pe,b.$isRootOrShadowRoot=ot,b.$isTextNode=L,b.$nodesOfType=function(t){var e=Ue();let n=e._readOnly,r=t.getType();e=e._nodeMap;let i=[];for(let[,o]of e)o instanceof t&&o.__type===r&&(n||o.isAttached())&&i.push(o);return i},b.$normalizeSelection__EXPERIMENTAL=_l,b.$parseSerializedNode=function(t){return xi(t,se()._nodes)},b.$setCompositionKey=pe,b.$setSelection=Ot,b.BLUR_COMMAND=Go,b.CAN_REDO_COMMAND={},b.CAN_UNDO_COMMAND={},b.CLEAR_EDITOR_COMMAND={},b.CLEAR_HISTORY_COMMAND={},b.CLICK_COMMAND=$o,b.COMMAND_PRIORITY_CRITICAL=4,b.COMMAND_PRIORITY_EDITOR=0,b.COMMAND_PRIORITY_HIGH=3,b.COMMAND_PRIORITY_LOW=1,b.COMMAND_PRIORITY_NORMAL=2,b.CONTROLLED_TEXT_INSERTION_COMMAND=Tt,b.COPY_COMMAND=jr,b.CUT_COMMAND=Gr,b.DELETE_CHARACTER_COMMAND=Xt,b.DELETE_LINE_COMMAND=en,b.DELETE_WORD_COMMAND=qt,b.DEPRECATED_$createGridSelection=function(){let t=new We("root",0,"element"),e=new We("root",0,"element");return new lr("root",t,e)},b.DEPRECATED_$isGridCellNode=ns,b.DEPRECATED_$isGridNode=is,b.DEPRECATED_$isGridRowNode=ls,b.DEPRECATED_$isGridSelection=pi,b.DEPRECATED_GridCellNode=ts,b.DEPRECATED_GridNode=rs,b.DEPRECATED_GridRowNode=os,b.DRAGEND_COMMAND=Yo,b.DRAGOVER_COMMAND=Vo,b.DRAGSTART_COMMAND=Uo,b.DROP_COMMAND=Wo,b.DecoratorNode=Ql,b.ElementNode=mt,b.FOCUS_COMMAND=jo,b.FORMAT_ELEMENT_COMMAND={},b.FORMAT_TEXT_COMMAND=nt,b.INDENT_CONTENT_COMMAND={},b.INSERT_LINE_BREAK_COMMAND=Qt,b.INSERT_PARAGRAPH_COMMAND=Kr,b.KEY_ARROW_DOWN_COMMAND=Po,b.KEY_ARROW_LEFT_COMMAND=Lo,b.KEY_ARROW_RIGHT_COMMAND=Ao,b.KEY_ARROW_UP_COMMAND=Io,b.KEY_BACKSPACE_COMMAND=zo,b.KEY_DELETE_COMMAND=Ho,b.KEY_ENTER_COMMAND=Vn,b.KEY_ESCAPE_COMMAND=Bo,b.KEY_MODIFIER_COMMAND=Zo,b.KEY_SPACE_COMMAND=Fo,b.KEY_TAB_COMMAND=Ko,b.LineBreakNode=Dt,b.MOVE_TO_END=Mo,b.MOVE_TO_START=Do,b.OUTDENT_CONTENT_COMMAND={},b.PASTE_COMMAND=Wr,b.ParagraphNode=Pt,b.REDO_COMMAND=Yr,b.REMOVE_TEXT_COMMAND=Ur,b.RootNode=Lt,b.SELECTION_CHANGE_COMMAND=Ro,b.TextNode=It,b.UNDO_COMMAND=Vr,b.VERSION="0.4.1",b.createCommand=function(){return{}},b.createEditor=function(t){var e=t||{},n=fe,r=e.theme||{};let i=t===void 0?n:e.parentEditor||null,o=e.disableEvents||!1,l=vi(),s=e.namespace||(i!==null?i._config.namespace:sl()),a=e.editorState,c=[Lt,It,Dt,Pt,...e.nodes||[]],d=e.onError;if(e=e.editable!==void 0?e.editable:!0,t===void 0&&n!==null)t=n._nodes;else for(t=new Map,n=0;n<c.length;n++){let u=c[n],g=u.getType();t.set(g,{klass:u,transforms:new Set})}return r=new Zd(l,i,t,{disableEvents:o,namespace:s,theme:r},d||console.error,Gd(t),e),a!==void 0&&(r._pendingEditorState=a,r._dirtyType=2),r};var k=b,ss=ge,wn=k,gr=S.default,Jd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?gr.useLayoutEffect:gr.useEffect;let hr={tag:"history-merge"};function Xd(t,e){if(e!==null){if(e===void 0)t.update(()=>{var n=wn.$getRoot();if(n.isEmpty()){let r=wn.$createParagraphNode();n.append(r),n=document.activeElement,(wn.$getSelection()!==null||n!==null&&n===t.getRootElement())&&r.select()}},hr);else if(e!==null)switch(typeof e){case"string":let n=t.parseEditorState(e);t.setEditorState(n,hr);break;case"object":t.setEditorState(e,hr);break;case"function":t.update(()=>{wn.$getRoot().isEmpty()&&e(t)},hr)}}}So.LexicalComposer=function({initialConfig:t,children:e}){let n=gr.useMemo(()=>{const{theme:r,namespace:i,editor__DEPRECATED:o,nodes:l,onError:s,editorState:a}=t,c=ss.createLexicalComposerContext(null,r);let d=o||null;if(d===null){const u=wn.createEditor({editable:!1,namespace:i,nodes:l,onError:g=>s(g,u),theme:r});Xd(u,a),d=u}return[d,c]},[]);return Jd(()=>{let r=t.editable,[i]=n;i.setEditable(r!==void 0?r:!0)},[]),gr.createElement(ss.LexicalComposerContext.Provider,{value:n},e)};var Qd=So,xe={},$e={},ke=k;function as(t){throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?code=${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function cs(t,e){for(;t!==ke.$getRoot()&&t!=null;){if(e(t))return t;t=t.getParent()}return null}function ds(t,e,n,r,i){var o=n._nodes.get(t.__type);o===void 0&&as(5);for(var l in t){var s=t[l];if(s!=null&&typeof s=="object"&&(s=s.editorState,s!=null)){var a=ke.createEditor({namespace:s.namespace});a._nodes=n._nodes,a._parentEditor=n._parentEditor,a._pendingEditorState=us(a,s),t[l]=a}}if(o=o.klass,l=t.__key,t.__key=void 0,o=o.clone(t),t.__key=l,l=o.__key,i._nodeMap.set(l,o),o.__parent=r,ke.$isElementNode(o)){for(r=t.__children,s=0;s<r.length;s++)a=e.get(r[s]),a!==void 0&&(a=ds(a,e,n,l,i).__key,o.__children.push(a));o.__indent=t.__indent,o.__format=t.__format,o.__dir=t.__dir}else ke.$isTextNode(o)&&(o.__format=t.__format,o.__style=t.__style,o.__mode=t.__mode,o.__detail=t.__detail);return o}function qd(t,e){let n=e._editorState.constructor,r=new Map,i=new n(r),o=new Map(t._nodeMap),l=o.get("root");t=e._updating;try{e._updating=!1,e.update(()=>{let s=e._dirtyElements,a=e._dirtyLeaves,c=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._dirtyType=0;try{ds(l,o,e,null,i)}finally{e._dirtyElements=s,e._dirtyLeaves=a,e._dirtyType=c}})}finally{e._updating=t}return i._readOnly=!0,i}function us(t,e){return e=typeof e=="string"?JSON.parse(e):e,qd(e,t)}$e.$dfs=function(t,e){let n=[];t=(t||ke.$getRoot()).getLatest(),e=e||(ke.$isElementNode(t)?t.getLastDescendant():t);for(var r=t,i=0;(r=r.getParent())!==null;)i++;for(r=i;t!==null&&!t.is(e);)if(n.push({depth:r,node:t}),ke.$isElementNode(t)&&0<t.getChildrenSize())t=t.getFirstChild(),r++;else for(i=null;i===null&&t!==null;)i=t.getNextSibling(),i===null?(t=t.getParent(),r--):t=i;return t!==null&&t.is(e)&&n.push({depth:r,node:t}),n},$e.$findMatchingParent=cs,$e.$getNearestBlockElementAncestorOrThrow=function(t){return t=cs(t,e=>ke.$isElementNode(e)&&!e.isInline()),ke.$isElementNode(t)||as(4),t},$e.$getNearestNodeOfType=function(t,e){for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null},$e.$insertNodeToNearestRoot=function(t){var e=ke.$getSelection();return ke.$isRangeSelection(e)?e.focus.getNode().getTopLevelElementOrThrow().insertAfter(t):ke.$isNodeSelection(e)||ke.DEPRECATED_$isGridSelection(e)?(e=e.getNodes(),e[e.length-1].getTopLevelElementOrThrow().insertAfter(t)):ke.$getRoot().append(t),e=ke.$createParagraphNode(),t.insertAfter(e),e.select(),t.getLatest()},$e.$restoreEditorState=function(t,e){let n=new Map(e._nodeMap),r=t._pendingEditorState;r&&(r._nodeMap=n),t._dirtyType=2,t=e._selection,ke.$setSelection(t===null?null:t.clone())},$e.$wrapNodeInElement=function(t,e){return e=e(),t.replace(e),e.append(t),e},$e.addClassNamesToElement=function(t,...e){e.forEach(n=>{typeof n=="string"&&(n=n.split(" ").filter(r=>r!==""),t.classList.add(...n))})},$e.mergeRegister=function(...t){return()=>{t.forEach(e=>e())}},$e.registerNestedElementResolver=function(t,e,n,r){return t.registerNodeTransform(e,i=>{e:{for(var o=i.getChildren(),l=0;l<o.length;l++)if(o[l]instanceof e){o=null;break e}for(o=i;o!==null;)if(l=o,o=o.getParent(),o instanceof e){o={child:l,parent:o};break e}o=null}if(o!==null){const{child:s,parent:a}=o;if(s.is(i)){if(r(a,i),i=s.getNextSiblings(),o=i.length,a.insertAfter(s),o!==0){l=n(a),s.insertAfter(l);for(let c=0;c<o;c++)l.append(i[c])}a.canBeEmpty()||a.getChildrenSize()!==0||a.remove()}}})},$e.removeClassNamesFromElement=function(t,...e){e.forEach(n=>{typeof n=="string"&&t.classList.remove(...n.split(" "))})},$e.unstable_convertLegacyJSONEditorState=us;var _e=$e,V=k,yn=_e;function kn(t){throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?code=${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function gs(t){let e=1;for(t=t.getParent();t!=null;){if(Z(t)){if(t=t.getParent(),K(t)){e++,t=t.getParent();continue}kn(40)}break}return e}function Ei(t){t=t.getParent(),K(t)||kn(40);let e=t;for(;e!==null;)e=e.getParent(),K(e)&&(t=e);return t}function hs(t){let e=[];t=t.getChildren().filter(Z);for(let n=0;n<t.length;n++){let r=t[n],i=r.getFirstChild();K(i)?e=e.concat(hs(i)):e.push(r)}return e}function zt(t){return Z(t)&&K(t.getFirstChild())}function eu(t){for(;t.getNextSibling()==null&&t.getPreviousSibling()==null;){let e=t.getParent();if(e==null||!Z(t)&&!K(t))break;t=e}t.remove()}function fs(t){return Ie().append(t)}function ps(t,e){return Z(t)&&(e.length===0||e.length===1&&t.is(e[0])&&t.getChildrenSize()===0)}function xt(t,e){t.splice(t.getChildrenSize(),0,e)}function ms(t,e){if(K(t))return t;let n=t.getPreviousSibling(),r=t.getNextSibling(),i=Ie();return i.setFormat(t.getFormatType()),i.setIndent(t.getIndent()),xt(i,t.getChildren()),K(n)&&e===n.getListType()?(n.append(i),t.remove(),K(r)&&e===r.getListType()&&(xt(n,r.getChildren()),r.remove()),n):K(r)&&e===r.getListType()?(r.getFirstChildOrThrow().insertBefore(i),t.remove(),r):(e=Me(e),e.append(i),t.replace(e),Ae(e),e)}function Ae(t,e){if(t=e||t.getChildren(),t!==void 0)for(e=0;e<t.length;e++){let o=t[e];if(Z(o)){let l=o.getValue();var n=o,r=n.getParent(),i=1;for(r!=null&&(K(r)?i=r.getStart():kn(44)),n=n.getPreviousSiblings(),r=0;r<n.length;r++){let s=n[r];Z(s)&&!K(s.getFirstChild())&&i++}l!==i&&o.setValue(i)}}}function xs(t){let e=new Set;t.forEach(n=>{if(!zt(n)&&!e.has(n.getKey())){var r=n.getParent(),i=n.getNextSibling(),o=n.getPreviousSibling();if(zt(i)&&zt(o))o=o.getFirstChild(),K(o)&&(o.append(n),n=i.getFirstChild(),K(n)&&(n=n.getChildren(),xt(o,n),i.remove(),e.add(i.getKey())),Ae(o));else if(zt(i))i=i.getFirstChild(),K(i)&&(o=i.getFirstChild(),o!==null&&o.insertBefore(n),Ae(i));else if(zt(o))i=o.getFirstChild(),K(i)&&(i.append(n),Ae(i));else if(K(r)){let l=Ie(),s=Me(r.getListType());l.append(s),s.append(n),o?o.insertAfter(l):i?i.insertBefore(l):r.append(l)}K(r)&&Ae(r)}})}function _s(t){t.forEach(e=>{if(!zt(e)){var n=e.getParent(),r=n?n.getParent():void 0,i=r?r.getParent():void 0;if(K(i)&&Z(r)&&K(n)){var o=n?n.getFirstChild():void 0,l=n?n.getLastChild():void 0;if(e.is(o))r.insertBefore(e),n.isEmpty()&&r.remove();else if(e.is(l))r.insertAfter(e),n.isEmpty()&&r.remove();else{var s=n.getListType();o=Ie();let a=Me(s);o.append(a),e.getPreviousSiblings().forEach(c=>a.append(c)),l=Ie(),s=Me(s),l.append(s),xt(s,e.getNextSiblings()),r.insertBefore(o),r.insertAfter(l),r.replace(e)}Ae(n),Ae(i)}}})}function vs(t){var e=V.$getSelection();if(V.$isRangeSelection(e)){var n=e.getNodes(),r=[];if(n.length===0&&n.push(e.anchor.getNode()),n.length===1){e:{for(n=n[0];n!==null;){if(Z(n))break e;n=n.getParent()}n=null}n!==null&&(r=[n])}else{for(r=new Set,e=0;e<n.length;e++){let i=n[e];Z(i)&&r.add(i)}r=Array.from(r)}0<r.length&&(t==="indent"?xs(r):_s(r))}}class _t extends V.ElementNode{static getType(){return"listitem"}static clone(e){return new _t(e.__value,e.__checked,e.__key)}constructor(e,n,r){super(r),this.__value=e===void 0?1:e,this.__checked=n}createDOM(e){let n=document.createElement("li"),r=this.getParent();return K(r)&&(Ae(r),ys(n,this,null,r)),n.value=this.__value,ws(n,e.theme,this),n}updateDOM(e,n,r){let i=this.getParent();return K(i)&&(Ae(i),ys(n,this,e,i)),n.value=this.__value,ws(n,r.theme,this),!1}static importDOM(){return{li:()=>({conversion:tu,priority:0})}}static importJSON(e){let n=new _t(e.value,e.checked);return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...e){for(let n=0;n<e.length;n++){let r=e[n];if(V.$isElementNode(r)&&this.canMergeWith(r)){let i=r.getChildren();this.append(...i),r.remove()}else super.append(r)}return this}replace(e){if(Z(e))return super.replace(e);let n=this.getParentOrThrow();if(K(n)){var r=n.__children;let o=r.length;var i=r.indexOf(this.__key);if(i===0)n.insertBefore(e);else if(i===o-1)n.insertAfter(e);else{r=Me(n.getListType());let l=n.getChildren();for(i+=1;i<o;i++)r.append(l[i]);n.insertAfter(e),e.insertAfter(r)}this.remove(),o===1&&n.remove()}return e}insertAfter(e){var n=this.getParentOrThrow();K(n)||kn(39);var r=this.getNextSiblings();if(Z(e))return n=super.insertAfter(e),e=e.getParentOrThrow(),K(e)&&Ae(e),n;if(K(e)&&e.getListType()===n.getListType()){for(n=e,e=e.getChildren(),r=e.length-1;0<=r;r--)n=e[r],this.insertAfter(n);return n}if(n.insertAfter(e),r.length!==0){let i=Me(n.getListType());r.forEach(o=>i.append(o)),e.insertAfter(i)}return e}remove(e){let n=this.getNextSibling();super.remove(e),n!==null&&(e=n.getParent(),K(e)&&Ae(e))}insertNewAfter(){let e=Ie(this.__checked==null?void 0:!1);return this.insertAfter(e),e}collapseAtStart(e){let n=V.$createParagraphNode();this.getChildren().forEach(l=>n.append(l));var r=this.getParentOrThrow(),i=r.getParentOrThrow();let o=Z(i);return r.getChildrenSize()===1?o?(r.remove(),i.select()):(r.replace(n),r=e.anchor,e=e.focus,i=n.getKey(),r.type==="element"&&r.getNode().is(this)&&r.set(i,r.offset,"element"),e.type==="element"&&e.getNode().is(this)&&e.set(i,e.offset,"element")):(r.insertBefore(n),this.remove()),!0}getValue(){return this.getLatest().__value}setValue(e){this.getWritable().__value=e}getChecked(){return this.getLatest().__checked}setChecked(e){this.getWritable().__checked=e}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){var e=this.getParent();if(e===null)return this.getLatest().__indent;e=e.getParentOrThrow();let n=0;for(;Z(e);)e=e.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){let n=this.getIndent();for(;n!==e;)n<e?(xs([this]),n++):(_s([this]),n--);return this}canIndent(){return!1}insertBefore(e){if(Z(e)){let n=this.getParentOrThrow();if(K(n)){let r=this.getNextSiblings();Ae(n,r)}}return super.insertBefore(e)}canInsertAfter(e){return Z(e)}canReplaceWith(e){return Z(e)}canMergeWith(e){return V.$isParagraphNode(e)||Z(e)}extractWithChild(e,n){if(!V.$isRangeSelection(n))return!1;e=n.anchor.getNode();let r=n.focus.getNode();return this.isParentOf(e)&&this.isParentOf(r)&&this.getTextContent().length===n.getTextContent().length}}function ws(t,e,n){let r=[],i=[];var o=(e=e.list)?e.listitem:void 0;if(e&&e.nested)var l=e.nested.listitem;if(o!==void 0&&(o=o.split(" "),r.push(...o)),e){o=n.getParent(),o=K(o)&&o.getListType()==="check";let s=n.getChecked();o&&!s||i.push(e.listitemUnchecked),o&&s||i.push(e.listitemChecked),o&&r.push(s?e.listitemChecked:e.listitemUnchecked)}l!==void 0&&(l=l.split(" "),n.getChildren().some(s=>K(s))?r.push(...l):i.push(...l)),0<i.length&&yn.removeClassNamesFromElement(t,...i),0<r.length&&yn.addClassNamesToElement(t,...r)}function ys(t,e,n,r){r.getListType()==="check"?K(e.getFirstChild())?(t.removeAttribute("role"),t.removeAttribute("tabIndex"),t.removeAttribute("aria-checked")):(t.setAttribute("role","checkbox"),t.setAttribute("tabIndex","-1"),n&&e.__checked===n.__checked||t.setAttribute("aria-checked",e.getChecked()?"true":"false")):e.getChecked()!=null&&e.setChecked(void 0)}function tu(){return{node:Ie()}}function Ie(t){return new _t(void 0,t)}function Z(t){return t instanceof _t}class Cn extends V.ElementNode{static getType(){return"list"}static clone(e){return new Cn(e.__listType||Es[e.__tag],e.__start,e.__key)}constructor(e,n,r){super(r),this.__listType=e=Es[e]||e,this.__tag=e==="number"?"ol":"ul",this.__start=n}getTag(){return this.__tag}getListType(){return this.__listType}getStart(){return this.__start}createDOM(e){let n=document.createElement(this.__tag);return this.__start!==1&&n.setAttribute("start",String(this.__start)),n.__lexicalListType=this.__listType,ks(n,e.theme,this),n}updateDOM(e,n,r){return e.__tag!==this.__tag?!0:(ks(n,r.theme,this),!1)}static importDOM(){return{ol:()=>({conversion:Cs,priority:0}),ul:()=>({conversion:Cs,priority:0})}}static importJSON(e){let n=Me(e.listType,e.start);return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...e){for(let r=0;r<e.length;r++){var n=e[r];if(Z(n))super.append(n);else{let i=Ie();K(n)||V.$isElementNode(n)&&(n=V.$createTextNode(n.getTextContent())),i.append(n),super.append(i)}}return this}extractWithChild(e){return Z(e)}}function ks(t,e,n){let r=[],i=[];var o=e.list;if(o!==void 0){let s=o[`${n.__tag}Depth`]||[];e=gs(n)-1;let a=e%s.length;var l=s[a];let c=o[n.__tag],d;if(o=o.nested,o!==void 0&&o.list&&(d=o.list),c!==void 0&&r.push(c),l!==void 0)for(l=l.split(" "),r.push(...l),l=0;l<s.length;l++)l!==a&&i.push(n.__tag+l);d!==void 0&&(n=d.split(" "),1<e?r.push(...n):i.push(...n))}0<i.length&&yn.removeClassNamesFromElement(t,...i),0<r.length&&yn.addClassNamesToElement(t,...r)}function nu(t){let e=[];for(let n=0;n<t.length;n++){let r=t[n];Z(r)?(e.push(r),r.getChildren().forEach(i=>{K(i)&&e.push(fs(i))})):e.push(fs(r))}return e}function Cs(t){t=t.nodeName.toLowerCase();let e=null;return t==="ol"?e=Me("number"):t==="ul"&&(e=Me("bullet")),{after:nu,node:e}}let Es={ol:"number",ul:"bullet"};function Me(t,e=1){return new Cn(t,e)}function K(t){return t instanceof Cn}let ru=V.createCommand("INSERT_UNORDERED_LIST_COMMAND"),iu=V.createCommand("INSERT_ORDERED_LIST_COMMAND"),ou=V.createCommand("INSERT_CHECK_LIST_COMMAND"),lu=V.createCommand("REMOVE_LIST_COMMAND");xe.$createListItemNode=Ie,xe.$createListNode=Me,xe.$getListDepth=gs,xe.$handleListInsertParagraph=function(){var t=V.$getSelection();if(!V.$isRangeSelection(t)||!t.isCollapsed()||(t=t.anchor.getNode(),!Z(t)||t.getTextContent()!==""))return!1;var e=Ei(t),n=t.getParent();K(n)||kn(40);let r=n.getParent(),i;if(V.$isRootOrShadowRoot(r))i=V.$createParagraphNode(),e.insertAfter(i);else if(Z(r))i=Ie(),r.insertAfter(i);else return!1;if(i.select(),e=t.getNextSiblings(),0<e.length){let o=Me(n.getListType());V.$isParagraphNode(i)?i.insertAfter(o):(n=Ie(),n.append(o),i.insertAfter(n)),e.forEach(l=>{l.remove(),o.append(l)})}return eu(t),!0},xe.$isListItemNode=Z,xe.$isListNode=K,xe.INSERT_CHECK_LIST_COMMAND=ou,xe.INSERT_ORDERED_LIST_COMMAND=iu,xe.INSERT_UNORDERED_LIST_COMMAND=ru,xe.ListItemNode=_t,xe.ListNode=Cn,xe.REMOVE_LIST_COMMAND=lu,xe.indentList=function(){vs("indent")},xe.insertList=function(t,e){t.update(()=>{var n=V.$getSelection();if(V.$isRangeSelection(n)||V.DEPRECATED_$isGridSelection(n)){var r=n.getNodes();n=n.anchor.getNode();var i=n.getParent();if(ps(n,r))r=Me(e),V.$isRootOrShadowRoot(i)?(n.replace(r),i=Ie(),V.$isElementNode(n)&&(i.setFormat(n.getFormatType()),i.setIndent(n.getIndent())),r.append(i)):Z(n)&&(n=n.getParentOrThrow(),xt(r,n.getChildren()),n.replace(r));else for(n=new Set,i=0;i<r.length;i++){var o=r[i];if(V.$isElementNode(o)&&o.isEmpty()&&!n.has(o.getKey()))ms(o,e);else if(V.$isLeafNode(o))for(o=o.getParent();o!=null;){let s=o.getKey();if(K(o)){if(!n.has(s)){var l=Me(e);xt(l,o.getChildren()),o.replace(l),Ae(l),n.add(s)}break}else{if(l=o.getParent(),V.$isRootOrShadowRoot(l)&&!n.has(s)){n.add(s),ms(o,e);break}o=l}}}}})},xe.outdentList=function(){vs("outdent")},xe.removeList=function(t){t.update(()=>{let e=V.$getSelection();if(V.$isRangeSelection(e)){var n=new Set,r=e.getNodes(),i=e.anchor.getNode();if(ps(i,r))n.add(Ei(i));else for(i=0;i<r.length;i++){var o=r[i];V.$isLeafNode(o)&&(o=yn.$getNearestNodeOfType(o,_t),o!=null&&n.add(Ei(o)))}for(let l of n){n=l,r=hs(l);for(let s of r)r=V.$createParagraphNode(),xt(r,s.getChildren()),n.insertAfter(r),n=r,s.__key===e.anchor.key&&e.anchor.set(r.getKey(),0,"element"),s.__key===e.focus.key&&e.focus.set(r.getKey(),0,"element"),s.remove();l.remove()}}})};var vt=xe,Ve={},Je={},Ni={},ae={},F=k;let fr=new Map;function su(t){return{nodeMap:t.getNodes().map(e=>{const n=e.getKey();return e=mr(e),[n,e]}),range:[t.gridKey]}}function Ns(t){for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function Ts(t){let e=t.parentNode;if(e==null)throw Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(t)]}function Ss(t){let e={};t=t.split(";");for(let n of t)if(n!==""){let[r,i]=n.split(/:([^]+)/);e[r.trim()]=i.trim()}return e}function Ti(t){let e=fr.get(t);return e===void 0&&(e=Ss(t),fr.set(t,e)),e}function au(t){let e="";for(let n in t)n&&(e+=`${n}: ${t[n]};`);return e}function cu(t){for(;t!==null&&!F.$isRootOrShadowRoot(t);){let e=t.getLatest(),n=t.getParent();e.__children.length===0&&t.remove(!0),t=n}}function pr(t,e,n,r,i=null){if(e.length!==0){var o=e[0],l=new Map,s=[];o=F.$isElementNode(o)?o:o.getParentOrThrow(),o.isInline()&&(o=o.getParentOrThrow());for(var a=!1;o!==null;){var c=o.getPreviousSibling();if(c!==null){o=c,a=!0;break}if(o=o.getParentOrThrow(),F.$isRootOrShadowRoot(o))break}c=new Set;for(var d=0;d<n;d++){var u=e[d];F.$isElementNode(u)&&u.getChildrenSize()===0&&c.add(u.getKey())}var g=new Set;for(d=0;d<n;d++){u=e[d];var m=u.getParent();if(m!==null&&m.isInline()&&(m=m.getParent()),m!==null&&F.$isLeafNode(u)&&!g.has(u.getKey())){if(u=m.getKey(),l.get(u)===void 0){let f=r();f.setFormat(m.getFormatType()),f.setIndent(m.getIndent()),s.push(f),l.set(u,f),m.getChildren().forEach(v=>{f.append(v),g.add(v.getKey())}),cu(m)}}else c.has(u.getKey())&&(m=r(),m.setFormat(u.getFormatType()),m.setIndent(u.getIndent()),s.push(m),u.remove(!0))}if(i!==null)for(e=0;e<s.length;e++)i.append(s[e]);if(F.$isRootOrShadowRoot(o))if(a)if(i!==null)o.insertAfter(i);else for(i=s.length-1;0<=i;i--)o.insertAfter(s[i]);else if(e=o.getFirstChild(),F.$isElementNode(e)&&(o=e),e===null)if(i)o.append(i);else for(i=0;i<s.length;i++)o.append(s[i]);else if(i!==null)e.insertBefore(i);else for(o=0;o<s.length;o++)e.insertBefore(s[o]);else if(i)o.insertAfter(i);else for(i=s.length-1;0<=i;i--)o.insertAfter(s[i]);s=F.$getPreviousSelection(),F.$isRangeSelection(s)&&s.anchor.getNode().isAttached()&&s.focus.getNode().isAttached()?F.$setSelection(s.clone()):t.dirty=!0}}function bs(t,e,n,r){t.modify(e?"extend":"move",n,r)}function Os(t){return t=t.anchor.getNode(),(F.$isRootNode(t)?t:t.getParentOrThrow()).getDirection()==="rtl"}function Rs(t,e,n,r,i,o){for(var l=e;t!==null;){for(e=t.getParent();e!==null&&e.excludeFromCopy("clone");)e=e.getParent();if(e===null)break;if(!F.$isElementNode(t)||!t.excludeFromCopy("clone")){let s=t.getKey(),a=o.get(s),c=a===void 0;if(c&&(a=mr(t),o.set(s,a)),!F.$isTextNode(a)||a.isSegmented()||a.isToken()?F.$isElementNode(a)&&(a.__children=a.__children.slice(r?l:0,r?void 0:(l||0)+1)):a.__text=a.__text.slice(r?l:0,r?n:l),F.$isRootNode(e)){c&&i.push(s);break}}l=o.get(e.getKey()),l=F.$isElementNode(l)?l.__children.indexOf(t.getKey()):t.getIndexWithinParent(),t=e}}function mr(t){t=t.getLatest();let e=t.constructor.clone(t);return e.__parent=t.__parent,F.$isElementNode(t)&&F.$isElementNode(e)?(e.__children=Array.from(t.__children),e.__format=t.__format,e.__indent=t.__indent,e.__dir=t.__dir,e):(F.$isTextNode(t)&&F.$isTextNode(e)&&(e.__format=t.__format,e.__style=t.__style,e.__mode=t.__mode,e.__detail=t.__detail),e)}function En(t,e){var n=Ti(t.getStyle());e=Object.entries(e).reduce((r,[i,o])=>(o===null?delete r[i]:r[i]=o,r),{...n}),n=au(e),t.setStyle(n),fr.set(n,e)}ae.$addNodeStyle=function(t){t=t.getStyle();let e=Ss(t);fr.set(t,e)},ae.$cloneContents=function(t){var e={nodeMap:[],range:[]};if(F.$isRangeSelection(t)){var n=t.anchor,r=t.focus;let[c,d]=t.getCharacterOffsets();if(e=t.getNodes(),e.length===0||e.length===1&&F.$isElementNode(e[0])&&e[0].excludeFromCopy("clone"))e={nodeMap:[],range:[]};else{t=e.length;var i=e[0],o=i.getParent();if(o!==null&&(!o.canBeEmpty()||F.$isRootNode(o))){var l=o.__children;if(l.length===t){for(var s=!0,a=0;a<l.length;a++)if(l[a]!==e[a].__key){s=!1;break}s&&(t++,e.push(o))}}for(o=e[t-1],n=n.isBefore(r),r=new Map,l=[],s=F.$isTextNode(i)&&t===1,Rs(i,n?c:d,s?n?d:c:void 0,!0,l,r),i=0;i<t;i++){a=e[i];let u=a.getKey();if(!(r.has(u)||F.$isElementNode(a)&&a.excludeFromCopy("clone"))){let g=mr(a);F.$isRootNode(a.getParent())&&l.push(a.getKey()),u!=="root"&&r.set(u,g)}}Rs(o,s?void 0:n?d:c,void 0,!1,l,r),e={nodeMap:Array.from(r.entries()),range:l}}}else if(F.DEPRECATED_$isGridSelection(t))e=su(t);else if(F.$isNodeSelection(t))throw Error("Minified Lexical error #1; visit https://lexical.dev/docs/error?code=1 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");return e},ae.$cloneWithProperties=mr,ae.$getSelectionStyleValueForProperty=function(t,e,n=""){let r=null,i=t.getNodes();var o=t.anchor,l=t.focus,s=t.isBackward();for(t=s?l.offset:o.offset,o=s?l.getNode():o.getNode(),l=0;l<i.length;l++){var a=i[l];if((l===0||t!==0||!a.is(o))&&F.$isTextNode(a)){s=e;var c=n;if(a=a.getStyle(),a=Ti(a),s=a!==null&&a[s]||c,r===null)r=s;else if(r!==s){r="";break}}}return r===null?n:r},ae.$isAtNodeEnd=function(t){return t.type==="text"?t.offset===t.getNode().getTextContentSize():t.offset===t.getNode().getChildrenSize()},ae.$isParentElementRTL=Os,ae.$moveCaretSelection=bs,ae.$moveCharacter=function(t,e,n){let r=Os(t);bs(t,e,n?!r:r,"character")},ae.$patchStyleText=function(t,e){var n=t.getNodes();let r=n.length-1,i=n[0],o=n[r];if(!t.isCollapsed()){var l=t.anchor,s=t.focus,a=i.getTextContent().length,c=s.offset,d=l.offset,u=l.isBefore(s),g=u?d:c;t=u?c:d;var m=u?l.type:s.type,f=u?s.type:l.type;if(l=u?s.key:l.key,F.$isTextNode(i)&&g===a&&(s=i.getNextSibling(),F.$isTextNode(s)&&(g=d=0,i=s)),i.is(o))F.$isTextNode(i)&&(g=m==="element"?0:d>c?c:d,t=f==="element"?a:d>c?d:c,g!==t&&(g===0&&t===a?(En(i,e),i.select(g,t)):(n=i.splitText(g,t),n=g===0?n[0]:n[1],En(n,e),n.select(0,t-g))));else for(F.$isTextNode(i)&&g<i.getTextContentSize()&&(g!==0&&(i=i.splitText(g)[1]),En(i,e)),F.$isTextNode(o)&&(g=o.getTextContent().length,o.__key!==l&&t!==0&&(t=g),t!==g&&([o]=o.splitText(t)),t!==0&&En(o,e)),t=1;t<r;t++)g=n[t],a=g.getKey(),F.$isTextNode(g)&&a!==i.getKey()&&a!==o.getKey()&&!g.isToken()&&En(g,e)}},ae.$selectAll=function(t){let e=t.anchor;t=t.focus;var n=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();let r=n.getFirstDescendant();n=n.getLastDescendant();let i="element",o="element",l=0;F.$isTextNode(r)?i="text":F.$isElementNode(r)||r===null||(r=r.getParentOrThrow()),F.$isTextNode(n)?(o="text",l=n.getTextContentSize()):F.$isElementNode(n)||n===null||(n=n.getParentOrThrow()),r&&n&&(e.set(r.getKey(),0,i),t.set(n.getKey(),l,o))},ae.$shouldOverrideDefaultCharacterSelection=function(t,e){return t=F.$getDecoratorNode(t.focus,e),F.$isDecoratorNode(t)&&!t.isIsolated()},ae.$sliceSelectedTextNodeContent=function(t,e){if(e.isSelected()&&!e.isSegmented()&&!e.isToken()&&(F.$isRangeSelection(t)||F.DEPRECATED_$isGridSelection(t))){var n=t.anchor.getNode(),r=t.focus.getNode(),i=e.is(n),o=e.is(r);if(i||o){i=t.isBackward();let[l,s]=t.getCharacterOffsets();t=n.is(r),o=e.is(i?r:n),r=e.is(i?n:r),n=0;let a;t?(n=l>s?s:l,a=l>s?l:s):o?(n=i?s:l,a=void 0):r&&(i=i?l:s,n=0,a=i),e.__text=e.__text.slice(n,a)}}return e},ae.$wrapNodes=function(t,e,n=null){var r=t.getNodes();let i=r.length;var o=t.anchor;if(i===0||i===1&&o.type==="element"&&o.getNode().getChildrenSize()===0){t=o.type==="text"?o.getNode().getParentOrThrow():o.getNode(),r=t.getChildren();let s=e();s.setFormat(t.getFormatType()),s.setIndent(t.getIndent()),r.forEach(a=>s.append(a)),n&&(s=n.append(s)),t.replace(s)}else{o=null;var l=[];for(let s=0;s<i;s++){let a=r[s];F.$isRootOrShadowRoot(a)?(pr(t,l,l.length,e,n),l=[],o=a):o===null||o!==null&&F.$hasAncestor(a,o)?l.push(a):(pr(t,l,l.length,e,n),l=[a])}pr(t,l,l.length,e,n)}},ae.$wrapNodesImpl=pr,ae.createDOMRange=function(t,e,n,r,i){let o=e.getKey(),l=r.getKey(),s=document.createRange(),a=t.getElementByKey(o);if(t=t.getElementByKey(l),F.$isTextNode(e)&&(a=Ns(a)),F.$isTextNode(r)&&(t=Ns(t)),e===void 0||r===void 0||a===null||t===null)return null;a.nodeName==="BR"&&([a,n]=Ts(a)),t.nodeName==="BR"&&([t,i]=Ts(t)),e=a.firstChild,a===t&&e!=null&&e.nodeName==="BR"&&n===0&&i===0&&(i=1);try{s.setStart(a,n),s.setEnd(t,i)}catch{return null}return!s.collapsed||n===i&&o===l||(s.setStart(t,i),s.setEnd(a,n)),s},ae.createRectsFromDOMRange=function(t,e){var n=t.getRootElement();if(n===null)return[];t=n.getBoundingClientRect(),n=getComputedStyle(n),n=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight),e=Array.from(e.getClientRects());let r=e.length,i;for(let o=0;o<r;o++){let l=e[o],s=l.width+n===t.width;i&&i.top===l.top&&i.left===l.left&&i.width===l.width&&i.height===l.height||s?(e.splice(o--,1),r--):i=l}return e},ae.getStyleObjectFromCSS=Ti,ae.trimTextContentFromAnchor=function(t,e,n){let r=e.getNode();if(F.$isElementNode(r)){var i=r.getDescendantByIndex(e.offset);i!==null&&(r=i)}for(;0<n&&r!==null;){var o=r.getPreviousSibling(),l=0;if(o===null){i=r.getParentOrThrow();for(var s=i.getPreviousSibling();s===null;){if(i=i.getParent(),i===null){o=null;break}s=i.getPreviousSibling()}i!==null&&(l=i.isInline()?0:2,o=F.$isElementNode(s)?s.getLastDescendant():s)}let a=r.getTextContent();a===""&&F.$isElementNode(r)&&!r.isInline()&&(a=`
29
29
 
30
30
  `),i=a.length,s=i-n;let c=a.slice(0,s);if(!F.$isTextNode(r)||n>=i)s=r.getParent(),r.remove(),s!=null&&s.getChildrenSize()===0&&s.remove(),n-=i+l,r=o;else{let d=r.getKey();o=t.getEditorState().read(()=>{const u=F.$getNodeByKey(d);return F.$isTextNode(u)&&u.isSimpleText()?u.getTextContent():null}),o!==null&&o!==a?(n=F.$getPreviousSelection(),i=r,r.isSimpleText()?r.setTextContent(o):(i=F.$createTextNode(o),r.replace(i)),F.$isRangeSelection(n)&&n.isCollapsed()&&(n=n.anchor.offset,i.select(n,n))):r.isSimpleText()?(o=e.key===d,l=e.offset,l<n&&(l=i),n=o?l-n:0,i=o?l:s,o&&n===0?([n]=r.splitText(n,i),n.remove()):([,n]=r.splitText(n,i),n.remove())):(n=F.$createTextNode(c),r.replace(n)),n=0}}};var Ye=ae,$s=Ye,Bt=k;function As(t,e,n,r=null){let i=r!=null?e.isSelected():!0,o=Bt.$isElementNode(e)&&e.excludeFromCopy("html");var l=e;r!==null&&(l=$s.$cloneWithProperties(e),l=Bt.$isTextNode(l)&&r!=null?$s.$sliceSelectedTextNodeContent(r,l):l);let s=Bt.$isElementNode(l)?l.getChildren():[],{element:a,after:c}=l.exportDOM(t);if(!a)return!1;let d=new DocumentFragment;for(let u=0;u<s.length;u++){let g=s[u],m=As(t,g,d,r);!i&&Bt.$isElementNode(e)&&m&&e.extractWithChild(g,r,"html")&&(i=!0)}return i&&!o?(a.append(d),n.append(a),c&&(t=c.call(l,a))&&a.replaceWith(t)):n.append(d),i}let Ms=new Set(["STYLE"]);function Ls(t,e,n=new Map,r,i=!1){let o=[];if(Ms.has(t.nodeName))return o;let l=null;var{nodeName:s}=t,a=e._htmlConversions.get(s.toLowerCase());if(s=null,a!==void 0)for(c of a)a=c(t),a!==null&&(s===null||s.priority<a.priority)&&(s=a);var c=(c=s!==null?s.conversion:null)?c(t,void 0,i):null;if(s=null,c!==null){if(s=c.after,l=c.node,l!==null){for(var[,d]of n)if(l=d(l,r),!l)break;l&&o.push(l)}c.forChild!=null&&n.set(t.nodeName,c.forChild)}for(t=t.childNodes,r=[],d=0;d<t.length;d++)r.push(...Ls(t[d],e,new Map(n),l,i||(c&&c.preformatted)===!0));return s!=null&&(r=s(r)),l==null?o=o.concat(r):Bt.$isElementNode(l)&&l.append(...r),o}Ni.$generateHtmlFromNodes=function(t,e){if(typeof document>"u"||typeof window>"u")throw Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),r=Bt.$getRoot().getChildren();for(let i=0;i<r.length;i++)As(t,r[i],n,e);return n.innerHTML},Ni.$generateNodesFromDOM=function(t,e){let n=[];e=e.body?Array.from(e.body.childNodes):[];let r=e.length;for(let o=0;o<r;o++){var i=e[o];Ms.has(i.nodeName)||(i=Ls(i,t),i!==null&&(n=n.concat(i)))}return n};var du=Ni,Ds=du,Is=vt,Si=Ye,Nn=_e,z=k;function Xe(t){throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?code=${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Ps(t){let e=z.$getSelection();if(e==null)throw Error("Expected valid LexicalSelection");return z.$isRangeSelection(e)&&e.isCollapsed()||e.getNodes().length===0?"":Ds.$generateHtmlFromNodes(t,e)}function Fs(t){let e=z.$getSelection();if(e==null)throw Error("Expected valid LexicalSelection");return z.$isRangeSelection(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(Bs(t,e))}function bi(t,e,n){(z.DEPRECATED_$isGridSelection(n)||Nn.$findMatchingParent(n.anchor.getNode(),r=>z.DEPRECATED_$isGridCellNode(r))!==null&&Nn.$findMatchingParent(n.focus.getNode(),r=>z.DEPRECATED_$isGridCellNode(r))!==null)&&e.length===1&&z.DEPRECATED_$isGridNode(e[0])?gu(e,n,!1,t):uu(e,n)}function uu(t,e){let n=[],r=null,i=null;for(let o=0;o<t.length;o++){let l=t[o];if(Is.$isListItemNode(l)){i==null&&(i=Is.$createListNode("bullet"),n.push(i)),i.append(l);continue}else i!=null&&(i=null);let s=z.$isLineBreakNode(l);if(s||z.$isDecoratorNode(l)&&l.isInline()||z.$isElementNode(l)&&l.isInline()||z.$isTextNode(l)){if(r===null&&(r=z.$createParagraphNode(),n.push(r),s))continue;r!==null&&r.append(l)}else n.push(l),r=null}z.$isRangeSelection(e)?e.insertNodes(n):z.DEPRECATED_$isGridSelection(e)&&(t=e.anchor.getNode(),z.DEPRECATED_$isGridCellNode(t)||Xe(41),t.append(...n))}function gu(t,e,n,r){t.length===1&&z.DEPRECATED_$isGridNode(t[0])||Xe(42);var i=t[0];t=i.getChildren(),n=i.getFirstChildOrThrow().getChildrenSize();var o=i.getChildrenSize(),l=Nn.$findMatchingParent(e.anchor.getNode(),m=>z.DEPRECATED_$isGridCellNode(m));e=(i=l&&Nn.$findMatchingParent(l,m=>z.DEPRECATED_$isGridRowNode(m)))&&Nn.$findMatchingParent(i,m=>z.DEPRECATED_$isGridNode(m)),z.DEPRECATED_$isGridCellNode(l)&&z.DEPRECATED_$isGridRowNode(i)&&z.DEPRECATED_$isGridNode(e)||Xe(43);var s=i.getIndexWithinParent(),a=Math.min(e.getChildrenSize()-1,s+o-1);o=l.getIndexWithinParent(),l=Math.min(i.getChildrenSize()-1,o+n-1),n=Math.min(o,l),i=Math.min(s,a),o=Math.max(o,l),s=Math.max(s,a),a=e.getChildren(),l=0;let c,d;for(let m=i;m<=s;m++){var u=a[m];z.DEPRECATED_$isGridRowNode(u)||Xe(24);var g=t[l];z.DEPRECATED_$isGridRowNode(g)||Xe(24),u=u.getChildren(),g=g.getChildren();let f=0;for(let v=n;v<=o;v++){let C=u[v];z.DEPRECATED_$isGridCellNode(C)||Xe(25);let N=g[f];z.DEPRECATED_$isGridCellNode(N)||Xe(25),m===i&&v===n?c=C.getKey():m===s&&v===o&&(d=C.getKey());let p=C.getChildren();N.getChildren().forEach(x=>{z.$isTextNode(x)&&z.$createParagraphNode().append(x),C.append(x)}),p.forEach(x=>x.remove()),f++}l++}c&&d&&(t=z.DEPRECATED_$createGridSelection(),t.set(e.getKey(),c,d),z.$setSelection(t),r.dispatchCommand(z.SELECTION_CHANGE_COMMAND,void 0))}function zs(t,e,n,r=[]){let i=e!=null?n.isSelected():!0,o=z.$isElementNode(n)&&n.excludeFromCopy("html");var l=n;if(e!==null){var s=Si.$cloneWithProperties(n);l=s=z.$isTextNode(s)&&e!=null?Si.$sliceSelectedTextNodeContent(e,s):s}let a=z.$isElementNode(l)?l.getChildren():[];var c=l;s=c.exportJSON(),s.type!==c.constructor.getType()&&Xe(58);var d=s.children;for(z.$isElementNode(c)&&(Array.isArray(d)||Xe(59)),z.$isTextNode(l)&&(s.text=l.__text),l=0;l<a.length;l++)c=a[l],d=zs(t,e,c,s.children),!i&&z.$isElementNode(n)&&d&&n.extractWithChild(c,e,"clone")&&(i=!0);if(i&&!o)r.push(s);else if(Array.isArray(s.children))for(t=0;t<s.children.length;t++)r.push(s.children[t]);return i}function Bs(t,e){let n=[],r=z.$getRoot().getChildren();for(let i=0;i<r.length;i++)zs(t,e,r[i],n);return{namespace:t._config.namespace,nodes:n}}function Hs(t){let e=[];for(let n=0;n<t.length;n++){let r=z.$parseSerializedNode(t[n]);z.$isTextNode(r)&&Si.$addNodeStyle(r),e.push(r)}return e}let Ht=null;function Ks(t,e){if(e.preventDefault(),e=e.clipboardData,e===null)return!1;let n=z.$getSelection(),r=Ps(t);t=Fs(t);let i="";return n!==null&&(i=n.getTextContent()),r!==null&&e.setData("text/html",r),t!==null&&e.setData("application/x-lexical-editor",t),e.setData("text/plain",i),!0}Je.$generateJSONFromSelectedNodes=Bs,Je.$generateNodesFromSerializedNodes=Hs,Je.$getHtmlContent=Ps,Je.$getLexicalContent=Fs,Je.$insertDataTransferForPlainText=function(t,e){t=t.getData("text/plain"),t!=null&&e.insertRawText(t)},Je.$insertDataTransferForRichText=function(t,e,n){var r=t.getData("application/x-lexical-editor");if(r)try{let o=JSON.parse(r);if(o.namespace===n._config.namespace&&Array.isArray(o.nodes)){let l=Hs(o.nodes);return bi(n,l,e)}}catch{}if(r=t.getData("text/html"))try{var i=new DOMParser().parseFromString(r,"text/html");let o=Ds.$generateNodesFromDOM(n,i);return bi(n,o,e)}catch{}if(t=t.getData("text/plain"),t!=null)if(z.$isRangeSelection(e))for(t=t.split(/\r?\n/),n=t.length,i=0;i<n;i++)e.insertText(t[i]),i<n-1&&e.insertParagraph();else e.insertRawText(t)},Je.$insertGeneratedNodes=bi,Je.copyToClipboard__EXPERIMENTAL=async function(t,e){if(Ht!==null)return!1;if(e!==null)return new Promise(o=>{t.update(()=>{o(Ks(t,e))})});var n=t.getRootElement();let r=document.getSelection();if(n===null||r===null)return!1;let i=document.createElement("span");return i.style.cssText="position: fixed; top: -1000px;",i.append(document.createTextNode("#")),n.append(i),n=new Range,n.setStart(i,0),n.setEnd(i,1),r.removeAllRanges(),r.addRange(n),new Promise(o=>{let l=t.registerCommand(z.COPY_COMMAND,s=>(s instanceof ClipboardEvent&&(l(),Ht!==null&&(window.clearTimeout(Ht),Ht=null),o(Ks(t,s))),!0),z.COMMAND_PRIORITY_CRITICAL);Ht=window.setTimeout(()=>{l(),Ht=null,o(!1)},50),document.execCommand("copy"),i.remove()})};var hu=Je,xr=hu,_r=Ye,Kt=_e,w=k;let Wt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",fu=Wt&&"documentMode"in document?document.documentMode:null;Wt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Wt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);let pu=Wt&&"InputEvent"in window&&!fu?"getTargetRanges"in new window.InputEvent("input"):!1,mu=Wt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),xu=Wt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Oi=w.createCommand("DRAG_DROP_PASTE_FILE");class Tn extends w.ElementNode{static getType(){return"quote"}static clone(e){return new Tn(e.__key)}constructor(e){super(e)}createDOM(e){let n=document.createElement("blockquote");return Kt.addClassNamesToElement(n,e.theme.quote),n}updateDOM(){return!1}static importDOM(){return{blockquote:()=>({conversion:_u,priority:0})}}static importJSON(e){let n=Ri();return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(){let e=w.$createParagraphNode(),n=this.getDirection();return e.setDirection(n),this.insertAfter(e),e}collapseAtStart(){let e=w.$createParagraphNode();return this.getChildren().forEach(n=>e.append(n)),this.replace(e),!0}}function Ri(){return new Tn}class Sn extends w.ElementNode{static getType(){return"heading"}static clone(e){return new Sn(e.__tag,e.__key)}constructor(e,n){super(n),this.__tag=e}getTag(){return this.__tag}createDOM(e){let n=this.__tag,r=document.createElement(n);return e=e.theme.heading,e!==void 0&&Kt.addClassNamesToElement(r,e[n]),r}updateDOM(){return!1}static importDOM(){return{h1:()=>({conversion:Ut,priority:0}),h2:()=>({conversion:Ut,priority:0}),h3:()=>({conversion:Ut,priority:0}),h4:()=>({conversion:Ut,priority:0}),h5:()=>({conversion:Ut,priority:0}),h6:()=>({conversion:Ut,priority:0}),p:e=>(e=e.firstChild,e!==null&&Ws(e)?{conversion:()=>({node:null}),priority:3}:null),span:e=>Ws(e)?{conversion:()=>({node:vr("h1")}),priority:3}:null}}static importJSON(e){let n=vr(e.tag);return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(){let e=w.$createParagraphNode(),n=this.getDirection();return e.setDirection(n),this.insertAfter(e),e}collapseAtStart(){let e=w.$createParagraphNode();return this.getChildren().forEach(n=>e.append(n)),this.replace(e),!0}extractWithChild(){return!0}}function Ws(t){return t.nodeName.toLowerCase()==="span"?t.style.fontSize==="26pt":!1}function Ut(t){t=t.nodeName.toLowerCase();let e=null;return(t==="h1"||t==="h2"||t==="h3"||t==="h4"||t==="h5"||t==="h6")&&(e=vr(t)),{node:e}}function _u(){return{node:Ri()}}function vr(t){return new Sn(t)}function vu(t,e){t.preventDefault(),e.update(()=>{let n=w.$getSelection(),r=t instanceof InputEvent||t instanceof KeyboardEvent?null:t.clipboardData;r!=null&&(w.$isRangeSelection(n)||w.DEPRECATED_$isGridSelection(n))&&xr.$insertDataTransferForRichText(r,n,e)},{tag:"paste"})}async function wu(t,e){e.getEditorState().read(()=>w.$getSelection())!=null&&(await xr.copyToClipboard__EXPERIMENTAL(e,t instanceof ClipboardEvent?t:null),e.update(()=>{let n=w.$getSelection();w.$isRangeSelection(n)?n.removeText():w.$isNodeSelection(n)&&n.getNodes().forEach(r=>r.remove())}))}function bn(t){let e=null;return t instanceof DragEvent?e=t.dataTransfer:t instanceof ClipboardEvent&&(e=t.clipboardData),e===null?[!1,[]]:[e.types.includes("Files"),Array.from(e.files)]}function Us(t,e){var n=w.$getSelection();if(w.$isRangeSelection(n)){var r=new Set;n=n.getNodes();for(let o=0;o<n.length;o++){let l=n[o];var i=l.getKey();r.has(i)||(r.add(i),i=Kt.$getNearestBlockElementAncestorOrThrow(l),i.canInsertTab()?t(l):i.canIndent()&&e(i))}}}function wr(t){return t=w.$getNearestNodeFromDOMNode(t),w.$isDecoratorNode(t)}Ve.$createHeadingNode=vr,Ve.$createQuoteNode=Ri,Ve.$isHeadingNode=function(t){return t instanceof Sn},Ve.$isQuoteNode=function(t){return t instanceof Tn},Ve.DRAG_DROP_PASTE=Oi,Ve.HeadingNode=Sn,Ve.QuoteNode=Tn,Ve.eventFiles=bn,Ve.registerRichText=function(t){return Kt.mergeRegister(t.registerCommand(w.CLICK_COMMAND,()=>{const e=w.$getSelection();return w.$isNodeSelection(e)?(e.clear(),!0):!1},0),t.registerCommand(w.DELETE_CHARACTER_COMMAND,e=>{const n=w.$getSelection();return w.$isRangeSelection(n)?(n.deleteCharacter(e),!0):!1},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.DELETE_WORD_COMMAND,e=>{const n=w.$getSelection();return w.$isRangeSelection(n)?(n.deleteWord(e),!0):!1},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.DELETE_LINE_COMMAND,e=>{const n=w.$getSelection();return w.$isRangeSelection(n)?(n.deleteLine(e),!0):!1},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.CONTROLLED_TEXT_INSERTION_COMMAND,e=>{const n=w.$getSelection();if(typeof e=="string")w.$isRangeSelection(n)?n.insertText(e):w.DEPRECATED_$isGridSelection(n);else{if(!w.$isRangeSelection(n)&&!w.DEPRECATED_$isGridSelection(n))return!1;const r=e.dataTransfer;r!=null?xr.$insertDataTransferForRichText(r,n,t):w.$isRangeSelection(n)&&(e=e.data)&&n.insertText(e)}return!0},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.REMOVE_TEXT_COMMAND,()=>{const e=w.$getSelection();return w.$isRangeSelection(e)?(e.removeText(),!0):!1},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.FORMAT_TEXT_COMMAND,e=>{const n=w.$getSelection();return w.$isRangeSelection(n)?(n.formatText(e),!0):!1},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.FORMAT_ELEMENT_COMMAND,e=>{var n=w.$getSelection();if(!w.$isRangeSelection(n)&&!w.$isNodeSelection(n))return!1;n=n.getNodes();for(const r of n)Kt.$getNearestBlockElementAncestorOrThrow(r).setFormat(e);return!0},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.INSERT_LINE_BREAK_COMMAND,e=>{const n=w.$getSelection();return w.$isRangeSelection(n)?(n.insertLineBreak(e),!0):!1},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.INSERT_PARAGRAPH_COMMAND,()=>{const e=w.$getSelection();return w.$isRangeSelection(e)?(e.insertParagraph(),!0):!1},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.INDENT_CONTENT_COMMAND,()=>(Us(()=>{t.dispatchCommand(w.CONTROLLED_TEXT_INSERTION_COMMAND," ")},e=>{const n=e.getIndent();n!==10&&e.setIndent(n+1)}),!0),w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.OUTDENT_CONTENT_COMMAND,()=>(Us(e=>{w.$isTextNode(e)&&(e=e.getTextContent(),e[e.length-1]===" "&&t.dispatchCommand(w.DELETE_CHARACTER_COMMAND,!0))},e=>{const n=e.getIndent();n!==0&&e.setIndent(n-1)}),!0),w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.KEY_ARROW_UP_COMMAND,e=>{const n=w.$getSelection();return w.$isNodeSelection(n)&&!wr(e.target)&&(e=n.getNodes(),0<e.length)?(e[0].selectPrevious(),!0):!1},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.KEY_ARROW_DOWN_COMMAND,()=>{var e=w.$getSelection();return w.$isNodeSelection(e)&&(e=e.getNodes(),0<e.length)?(e[0].selectNext(0,0),!0):!1},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.KEY_ARROW_LEFT_COMMAND,e=>{const n=w.$getSelection();if(w.$isNodeSelection(n)){var r=n.getNodes();if(0<r.length)return e.preventDefault(),r[0].selectPrevious(),!0}return w.$isRangeSelection(n)&&_r.$shouldOverrideDefaultCharacterSelection(n,!0)?(r=e.shiftKey,e.preventDefault(),_r.$moveCharacter(n,r,!0),!0):!1},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.KEY_ARROW_RIGHT_COMMAND,e=>{const n=w.$getSelection();if(w.$isNodeSelection(n)&&!wr(e.target)){var r=n.getNodes();if(0<r.length)return e.preventDefault(),r[0].selectNext(0,0),!0}return w.$isRangeSelection(n)?(r=e.shiftKey,_r.$shouldOverrideDefaultCharacterSelection(n,!1)?(e.preventDefault(),_r.$moveCharacter(n,r,!1),!0):!1):!1},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.KEY_BACKSPACE_COMMAND,e=>{if(wr(e.target))return!1;const n=w.$getSelection();if(!w.$isRangeSelection(n))return!1;e.preventDefault(),{anchor:e}=n;const r=e.getNode();return n.isCollapsed()&&e.offset===0&&!w.$isRootNode(r)&&0<Kt.$getNearestBlockElementAncestorOrThrow(r).getIndent()?t.dispatchCommand(w.OUTDENT_CONTENT_COMMAND,void 0):t.dispatchCommand(w.DELETE_CHARACTER_COMMAND,!0)},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.KEY_DELETE_COMMAND,e=>{if(wr(e.target))return!1;const n=w.$getSelection();return w.$isRangeSelection(n)?(e.preventDefault(),t.dispatchCommand(w.DELETE_CHARACTER_COMMAND,!1)):!1},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.KEY_ENTER_COMMAND,e=>{const n=w.$getSelection();if(!w.$isRangeSelection(n))return!1;if(e!==null){if((xu||mu)&&pu)return!1;if(e.preventDefault(),e.shiftKey)return t.dispatchCommand(w.INSERT_LINE_BREAK_COMMAND,!1)}return t.dispatchCommand(w.INSERT_PARAGRAPH_COMMAND,void 0)},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.KEY_TAB_COMMAND,e=>{const n=w.$getSelection();return w.$isRangeSelection(n)?(e.preventDefault(),t.dispatchCommand(e.shiftKey?w.OUTDENT_CONTENT_COMMAND:w.INDENT_CONTENT_COMMAND,void 0)):!1},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.KEY_ESCAPE_COMMAND,()=>{const e=w.$getSelection();return w.$isRangeSelection(e)?(t.blur(),!0):!1},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.DROP_COMMAND,e=>{const[,n]=bn(e);if(0<n.length){var r=e.clientX,i=e.clientY;if(r=typeof document.caretRangeFromPoint<"u"?document.caretRangeFromPoint(r,i):document.caretPositionFromPoint!=="undefined"?document.caretPositionFromPoint(r,i):null,r!==null){const{startOffset:o,endOffset:l,startContainer:s,endContainer:a}=r;if(r=w.$getNearestNodeFromDOMNode(s),i=w.$getNearestNodeFromDOMNode(a),r!==null&&i!==null){const c=w.$createRangeSelection();w.$isTextNode(r)?c.anchor.set(r.getKey(),o,"text"):c.anchor.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+1,"element"),w.$isTextNode(i)?c.focus.set(i.getKey(),l,"text"):c.focus.set(i.getParentOrThrow().getKey(),i.getIndexWithinParent()+1,"element"),r=w.$normalizeSelection__EXPERIMENTAL(c),w.$setSelection(r)}t.dispatchCommand(Oi,n)}return e.preventDefault(),!0}return e=w.$getSelection(),!!w.$isRangeSelection(e)},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.DRAGSTART_COMMAND,e=>{const[n]=bn(e),r=w.$getSelection();return n&&!w.$isRangeSelection(r)?!1:(e.preventDefault(),!0)},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.DRAGOVER_COMMAND,e=>{const[n]=bn(e),r=w.$getSelection();return n&&!w.$isRangeSelection(r)?!1:(e.preventDefault(),!0)},w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.COPY_COMMAND,e=>(xr.copyToClipboard__EXPERIMENTAL(t,e instanceof ClipboardEvent?e:null),!0),w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.CUT_COMMAND,e=>(wu(e,t),!0),w.COMMAND_PRIORITY_EDITOR),t.registerCommand(w.PASTE_COMMAND,e=>{var[,n]=bn(e);return n!==null&&0<n.length?(t.dispatchCommand(Oi,n),!0):(n=w.$getSelection(),w.$isRangeSelection(n)||w.DEPRECATED_$isGridSelection(n)?(vu(e,t),!0):!1)},w.COMMAND_PRIORITY_EDITOR))};var Qe=Ve,qe={},yu=_e,st=k;class Vt extends st.ElementNode{static getType(){return"link"}static clone(e){return new Vt(e.__url,{rel:e.__rel,target:e.__target},e.__key)}constructor(e,n={},r){super(r);let{target:i=null,rel:o=null}=n;this.__url=e,this.__target=i,this.__rel=o}createDOM(e){let n=document.createElement("a");return n.href=this.__url,this.__target!==null&&(n.target=this.__target),this.__rel!==null&&(n.rel=this.__rel),yu.addClassNamesToElement(n,e.theme.link),n}updateDOM(e,n){let r=this.__url,i=this.__target,o=this.__rel;return r!==e.__url&&(n.href=r),i!==e.__target&&(i?n.target=i:n.removeAttribute("target")),o!==e.__rel&&(o?n.rel=o:n.removeAttribute("rel")),!1}static importDOM(){return{a:()=>({conversion:ku,priority:1})}}static importJSON(e){let n=On(e.url,{rel:e.rel,target:e.target});return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){this.getWritable().__url=e}getTarget(){return this.getLatest().__target}setTarget(e){this.getWritable().__target=e}getRel(){return this.getLatest().__rel}setRel(e){this.getWritable().__rel=e}insertNewAfter(e){if(e=this.getParentOrThrow().insertNewAfter(e),st.$isElementNode(e)){let n=On(this.__url,{rel:this.__rel,target:this.__target});return e.append(n),n}return null}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,n){if(!st.$isRangeSelection(n))return!1;e=n.anchor.getNode();let r=n.focus.getNode();return this.isParentOf(e)&&this.isParentOf(r)&&0<n.getTextContent().length}}function ku(t){let e=null;if(t instanceof HTMLAnchorElement){let n=t.textContent;n!==null&&n!==""&&(e=On(t.getAttribute("href")||"",{rel:t.getAttribute("rel"),target:t.getAttribute("target")}))}return{node:e}}function On(t,e){return new Vt(t,e)}function wt(t){return t instanceof Vt}class Rn extends Vt{static getType(){return"autolink"}static clone(e){return new Rn(e.__url,{rel:e.__rel,target:e.__target},e.__key)}static importJSON(e){let n=$i(e.url,{rel:e.rel,target:e.target});return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),type:"autolink",version:1}}insertNewAfter(e){if(e=this.getParentOrThrow().insertNewAfter(e),st.$isElementNode(e)){let n=$i(this.__url,{rel:this._rel,target:this.__target});return e.append(n),n}return null}}function $i(t,e){return new Rn(t,e)}let Cu=st.createCommand("TOGGLE_LINK_COMMAND");function Eu(t){return Nu(t,e=>wt(e))}function Nu(t,e){for(;t!==null&&(t=t.getParent())!==null&&!e(t););return t}qe.$createAutoLinkNode=$i,qe.$createLinkNode=On,qe.$isAutoLinkNode=function(t){return t instanceof Rn},qe.$isLinkNode=wt,qe.AutoLinkNode=Rn,qe.LinkNode=Vt,qe.TOGGLE_LINK_COMMAND=Cu,qe.toggleLink=function(t,e={}){let{target:n,rel:r}=e;if(e=st.$getSelection(),st.$isRangeSelection(e))if(e=e.extract(),t===null)e.forEach(o=>{if(o=o.getParent(),wt(o)){let l=o.getChildren();for(let s=0;s<l.length;s++)o.insertBefore(l[s]);o.remove()}});else{if(e.length===1){var i=e[0];if(i=wt(i)?i:Eu(i),i!==null){i.setURL(t),n!==void 0&&i.setTarget(n),r!==void 0&&i.setRel(r);return}}let o=null,l=null;e.forEach(s=>{var a=s.getParent();if(a!==l&&a!==null&&(!st.$isElementNode(s)||s.isInline()))if(wt(a))l=a,a.setURL(t),n!==void 0&&a.setTarget(n),r!==void 0&&a.setRel(r);else if(a.is(o)||(o=a,l=On(t,{rel:r,target:n}),wt(a)?s.getPreviousSibling()===null?a.insertBefore(l):a.insertAfter(l):s.insertBefore(l)),wt(s)){if(!s.is(l)){if(l!==null){a=s.getChildren();for(let c=0;c<a.length;c++)l.append(a[c])}s.remove()}}else l!==null&&l.append(s)})}};var Ai=qe;class yr extends k.ElementNode{static getType(){return"aside"}static clone(e){return new yr(e.__key)}createDOM(e){const n=document.createElement("aside");return _e.addClassNamesToElement(n,e.theme.aside),n}updateDOM(e,n){return!1}static importDOM(){return{aside:e=>({conversion:Tu,priority:0})}}static importJSON(e){const n=Mi();return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),type:"aside"}}insertNewAfter(){const e=k.$createParagraphNode(),n=this.getDirection();return e.setDirection(n),this.insertNewAfter(e),e}collapseAtStart(){const e=k.$createParagraphNode();return this.getChildren().forEach(r=>e.append(r)),this.replace(e),!0}}function Tu(){return{node:Mi}}function Mi(){return new yr}var Vs={},Su=ge,yt=k,kr=S.default;function Ys(t,e){return t.getEditorState().read(()=>{let n=yt.$getNodeByKey(e);return n===null?!1:n.isSelected()})}Vs.useLexicalNodeSelection=function(t){let[e]=Su.useLexicalComposerContext(),[n,r]=kr.useState(()=>Ys(e,t));kr.useEffect(()=>e.registerUpdateListener(()=>{r(Ys(e,t))}),[e,t]);let i=kr.useCallback(l=>{e.update(()=>{let s=yt.$getSelection();yt.$isNodeSelection(s)||(s=yt.$createNodeSelection(),yt.$setSelection(s)),l?s.add(t):s.delete(t)})},[e,t]),o=kr.useCallback(()=>{e.update(()=>{const l=yt.$getSelection();yt.$isNodeSelection(l)&&l.clear()})},[e]);return[n,i,o]};var js=Vs;const Gs=S.default.createContext({});var Le={exports:{}},bu="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Ou=bu,Ru=Ou;function Zs(){}function Js(){}Js.resetWarningCache=Zs;var $u=function(){function t(r,i,o,l,s,a){if(a!==Ru){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Js,resetWarningCache:Zs};return n.PropTypes=n,n};Le.exports=$u();const Li=S.default.forwardRef(({isSelected:t,cardWidth:e,cardType:n,children:r,...i},o)=>h("div",{className:`relative border border-transparent caret-grey-800 ${t?"shadow-[0_0_0_2px] shadow-green":"hover:shadow-[0_0_0_1px] hover:shadow-green"} ${e==="wide"?"mx-[calc(50%-(50vw-var(--kg-breakout-adjustment))-.8rem)] w-[calc(65vw+2px-var(--kg-breakout-adjustment))] min-w-[calc(100%+3.6rem)] sm:min-w-[calc(100%+10rem)] lg:min-w-[calc(100%+18rem)] translate-x-[calc(50vw-50%+.8rem-var(--kg-breakout-adjustment))]":e==="full"?"lg:mx-[calc(50%-50vw+(var(--kg-breakout-adjustment)/2))] lg:w-[calc(100vw-var(--kg-breakout-adjustment))]":""}`,ref:o,"data-kg-card":n,"data-kg-card-selected":t,...i,children:r}));Li.propTypes={isSelected:Le.exports.bool,cardWidth:Le.exports.oneOf(["regular","wide","full"])},Li.defaultProps={cardWidth:"regular"};const Di=({nodeKey:t,children:e,width:n})=>{const[r]=ge.useLexicalComposerContext(),[i,o,l]=js.useLexicalNodeSelection(t),[s,a]=S.default.useState(null),[c,d]=S.default.useState(null),[u,g]=S.default.useState(n||"regular"),m=S.default.useRef(null);return S.default.useLayoutEffect(()=>{r.getEditorState().read(()=>{const f=k.$getNodeByKey(t);d(f.getType())})},[]),S.default.useEffect(()=>_e.mergeRegister(r.registerUpdateListener(({editorState:f})=>{a(f.read(()=>k.$getSelection()))}),r.registerCommand(k.CLICK_COMMAND,f=>(m.current.contains(f.target)?(l(),o(!0)):i&&o(!1),!1),k.COMMAND_PRIORITY_LOW),r.registerCommand(k.KEY_ENTER_COMMAND,f=>{const v=k.$getSelection();if(i&&k.$isNodeSelection(v)&&v.getNodes().length===1){f.preventDefault();const C=k.$getNodeByKey(t),N=k.$createParagraphNode();return C.getTopLevelElementOrThrow().insertAfter(N),N.select(),!0}return!1},k.COMMAND_PRIORITY_EDITOR),r.registerCommand(k.KEY_BACKSPACE_COMMAND,f=>{const v=k.$getSelection();if(i&&k.$isNodeSelection(v)&&v.getNodes().length===1){f.preventDefault();const C=k.$getNodeByKey(t);if(C.getType()==="image"&&f.target.matches("input"))return r.update(()=>{const x=C.getCaption();C.setCaption(x.slice(0,-1))}),!1;const N=C.getPreviousSibling(),p=C.getNextSibling();if(N)if(N.selectEnd)N.selectEnd();else if(k.$isDecoratorNode(N)){const x=k.$createNodeSelection();x.add(N.getKey()),k.$setSelection(x)}else C.selectPrevious();else if(p)if(p.selectStart)p.selectStart();else if(k.$isDecoratorNode(p)){const x=k.$createNodeSelection();x.add(p.getKey()),k.$setSelection(x)}else C.selectNext();return C.remove(),!0}return!1},k.COMMAND_PRIORITY_EDITOR),r.registerCommand(k.KEY_DELETE_COMMAND,f=>{const v=k.$getSelection();if(i&&k.$isNodeSelection(v)&&v.getNodes().length===1){f.preventDefault();const C=k.$getNodeByKey(t),N=C.getNextSibling();if(N)if(N.selectStart)N.selectStart();else if(k.$isDecoratorNode(N)){const p=k.$createNodeSelection();p.add(N.getKey()),k.$setSelection(p)}else C.selectNext();else{const p=k.$createParagraphNode();C.getTopLevelElementOrThrow().insertAfter(p),p.select()}return C.remove(),!0}return!1},k.COMMAND_PRIORITY_EDITOR)),[r,i,o,l,t]),h(Gs.Provider,{value:{isSelected:i,cardWidth:u,setCardWidth:g,selection:s,cardContainerRef:m},children:h(Li,{isSelected:i,cardType:c,ref:m,cardWidth:u,children:e})})};function Au(){return h("hr",{className:"block h-[1px] border-0 border-t border-grey-300"})}const Xs=k.createCommand(),oo=class extends k.DecoratorNode{static getType(){return"horizontalrule"}static clone(e){return new oo(e.__key)}static importJSON(e){return Ii()}exportJSON(){return{type:"horizontalrule",version:1}}createDOM(){return document.createElement("div")}getTextContent(){return`
31
- `}isInline(){return!1}updateDOM(){return!1}decorate(){return h(Di,{nodeKey:this.getKey(),className:"inline-block",children:h(Au,{})})}};let kt=oo;Se(kt,"kgMenu",{label:"Divider",desc:"Insert a dividing line",Icon:Eo,insertCommand:Xs,matches:["divider","horizontal-rule","hr"]});function Ii(){return new kt}function Mu(t){return t instanceof kt}const Lu=({el:t,value:e})=>{te.useEffect(()=>{const n=t.current;if(n){n.style.height="0px";const r=n.scrollHeight;n.style.height=`${r}px`}},[t,e])};function Qs({code:t,language:e,updateCode:n,updateLanguage:r}){const i=S.default.useRef(null);return Lu({el:i,value:t}),h("code",{children:h("textarea",{ref:i,autoCorrect:"off",autoCapitalize:"off",spellCheck:"false",tabIndex:"0",autoFocus:!0,className:"min-h-170 w-full bg-grey-50 p-3 text-grey-900",value:t,onChange:n})})}Qs.propTypes={code:Le.exports.string},k.createCommand();function Du({code:t,language:e,nodeKey:n,editor:r}){return h(Qs,{code:t,updateCode:l=>{r.update(()=>{k.$getNodeByKey(n).setCode(l.target.value)})},language:e,updateLanguage:l=>{r.update(()=>{k.$getNodeByKey(n).setLanguage(l.target.value)})}})}class Yt extends k.DecoratorNode{constructor(n,r,i){super(i);Se(this,"__code","");Se(this,"__language","");this.__language=n,this.__code=r}static getType(){return"codeblock"}static clone(n){return new Yt(n.__key,n.__code)}static importJSON(n){return qs()}exportJSON(){return{type:"codeblock",version:1,code:this.__code,language:this.__language}}createDOM(n){return document.createElement("div")}updateDOM(){return!1}getCode(){return this.getLatest().__code}setCode(n){const r=this.getWritable();r.__code=n}getLanguage(){return this.getLatest().__language}setLanguage(n){const r=this.getWritable();r.__language=n}getTextContent(){return this.getLatest().__code}decorate(n,r){return h(Di,{nodeKey:this.getKey(),children:h(Du,{code:this.__code,language:this.__language,nodeKey:this.getKey(),editor:n})})}isInline(){return!1}}function qs(t,e){return new Yt(t,e)}function Iu(t){return t instanceof Yt}const Cr=S.default.createContext({});function Pu({value:t,placeholder:e,onChange:n}){return h("input",{onChange:i=>{n(i.target.value)},className:"not-kg-prose w-full px-9 text-center font-sans text-sm font-normal leading-8 tracking-wide text-grey-900",placeholder:e,value:t})}function Fu({value:t,placeholder:e,onChange:n}){return h("input",{onChange:i=>{n(i.target.value)},className:"not-kg-prose w-full px-9 text-center font-sans text-sm font-normal leading-8 tracking-wide text-grey-900",placeholder:e,value:t})}function zu({isEditingAlt:t,onClick:e}){return h("button",{name:"alt-toggle-button",className:`absolute bottom-0 right-0 m-2 cursor-pointer rounded border px-1 font-sans text-[1.3rem] font-normal leading-7 tracking-wide transition-all duration-100 ${t?"border-green bg-green text-white":"border-grey text-grey"} `,onClick:e,children:"Alt"})}function Bu({altText:t,altTextPlaceholder:e,setAltText:n,caption:r,captionPlaceholder:i,setCaption:o,isSelected:l}){const[s,a]=S.default.useState(!1),c=d=>{d.stopPropagation(),a(!s)};if(S.default.useEffect(()=>{l||a(!1)},[l,a]),l||r)return Y("figcaption",{className:"flex w-full p-2",children:[s?h(Fu,{value:t,placeholder:e,onChange:n}):h(Pu,{value:r,placeholder:i,onChange:o}),n&&h(zu,{isEditingAlt:s,onClick:c})]})}const Hu=({text:t})=>h("span",{"data-kg-card-drag-text":!0,className:"text-sm font-sans font-bold text-grey-800 transition-all group-hover:text-grey-800",children:t});function Ku({desc:t,Icon:e,filePicker:n,size:r,handleDrag:i,handleDrop:o,isDraggedOver:l,...s}){return h("div",{onDragEnter:i,onDragLeave:i,onDragOver:i,onDrop:o,className:"border border-transparent",...s,children:h("div",{className:`h-100 relative flex items-center justify-center border border-grey/20 bg-grey-50 ${r==="xsmall"?"before:pb-[12.5%]":"before:pb-[62.5%]"}`,children:l?h(Hu,{text:"Drop it like it's hot \u{1F525}"}):Y("button",{onClick:n,name:"placeholder-button",className:`group flex cursor-pointer items-center justify-center ${r==="xsmall"?"p-4":"p-20 flex-col"}`,children:[h(e,{className:`opacity-80 transition-all ease-linear group-hover:scale-105 group-hover:opacity-100 ${r==="large"?"h-20 w-20 text-grey":r==="small"?"h-14 w-14 text-grey":r==="xsmall"?"w-6 h-6 mr-3 text-grey-700":"h-16 w-16 text-grey"}`}),h("p",{className:`font-sans text-sm font-normal text-grey-700 transition-all group-hover:text-grey-800 ${r==="xsmall"?"":"mt-4"}`,children:t})]})})})}function Er({fileInputRef:t}){t.current.click()}function ea({onFileChange:t,fileInputRef:e}){return h("form",{onChange:t,children:h("input",{name:"image-input",type:"file",accept:"image/*",ref:e,hidden:!0})})}function Wu({src:t,alt:e}){return h("img",{src:t,alt:e})}function Uu({previewSrc:t,progress:e}){const n={width:`${e.toFixed(0)}%`};return Y("div",{children:[h("img",{classname:"opacity-40",src:t,alt:`upload in progress, ${e} `}),h("div",{className:"absolute inset-0 flex items-center min-w-full bg-white/50 justify-center overflow-hidden",children:h("div",{className:"not-kg-prose bg-grey-200 rounded-full shadow w-[60%]",children:h("div",{className:"bg-green rounded-full text-xs leading-none py-1 text-center text-white",style:n})})})]})}function Vu({onFileChange:t,setFileInputRef:e,handleDrag:n,handleDrop:r,isDraggedOver:i}){const o=S.default.useRef(null);return Y(Wn,{children:[h(Ku,{handleDrag:n,handleDrop:r,filePicker:()=>Er({fileInputRef:o}),desc:"Click to select an image",Icon:Hr,isDraggedOver:i}),h(ea,{filePicker:()=>Er({fileInputRef:o}),onFileChange:t,fileInputRef:s=>{o.current=s,e(o)}})]})}const Yu=({src:t,altText:e,previewSrc:n,uploadProgress:r,onFileChange:i,setFileInputRef:o,handleDrag:l,handleDrop:s,isDraggedOver:a})=>n&&!t&&r>0?h(Uu,{previewSrc:n,progress:r}):t&&!n?h(Wu,{src:t,alt:e}):h(Vu,{handleDrag:l,onFileChange:i,setFileInputRef:o,handleDrop:s,isDraggedOver:a});function ta({isSelected:t,src:e,onFileChange:n,caption:r,setCaption:i,altText:o,setAltText:l,setFigureRef:s,fileInputRef:a,handleDrag:c,handleDrop:d,isDraggedOver:u,cardWidth:g,previewSrc:m,uploadProgress:f}){const v=S.default.useRef(null);return S.default.useEffect(()=>{s&&s(v)},[v,s]),h(Wn,{children:Y("figure",{"data-kg-card-width":g,ref:v,children:[h(Yu,{src:e,altText:o,previewSrc:m,uploadProgress:f,onFileChange:n,setFileInputRef:N=>{a&&(a.current=N.current)},handleDrag:c,handleDrop:d,isDraggedOver:u}),h(Bu,{altText:o||"",setAltText:l,altTextPlaceholder:"Type alt text for image (optional)",caption:r||"",setCaption:i,captionPlaceholder:"Type caption for image (optional)",isSelected:t})]})})}ta.propTypes={isSelected:Le.exports.bool,setAltText:Le.exports.func,caption:Le.exports.string,altText:Le.exports.string,setCaption:Le.exports.func,src:Le.exports.string,isDraggedOver:Le.exports.bool,previewSrc:Le.exports.string,uploadProgress:Le.exports.number};const ju={bold:go,italic:ho,headingOne:fo,headingTwo:po,quote:mo,quoteOne:t=>_.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...t},_.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 8.00011H6C6.26522 8.00011 6.51957 8.10546 6.70711 8.293C6.89464 8.48054 7 8.73489 7 9.00011V13.0001C7 13.2653 6.89464 13.5197 6.70711 13.7072C6.51957 13.8947 6.26522 14.0001 6 14.0001H3C2.73478 14.0001 2.48043 13.8947 2.29289 13.7072C2.10536 13.5197 2 13.2653 2 13.0001V5.08211C2 3.90611 2.906 2.96211 4.538 2.11311C4.65448 2.05244 4.78177 2.0153 4.91261 2.00383C5.04344 1.99235 5.17525 2.00675 5.30052 2.04622C5.42579 2.08568 5.54205 2.14944 5.64268 2.23383C5.74331 2.31823 5.82633 2.42162 5.887 2.53811C5.94767 2.65459 5.9848 2.78188 5.99628 2.91271C6.00776 3.04355 5.99335 3.17536 5.95389 3.30063C5.91442 3.42589 5.85067 3.54216 5.76627 3.64279C5.68187 3.74342 5.57848 3.82644 5.462 3.88711C4.884 4.18711 4.469 4.47611 4.222 4.73411C4.054 4.90811 4 5.02011 4 5.08211V8.00011ZM13 8.00011C13.2652 8.00011 13.5196 8.10546 13.7071 8.293C13.8946 8.48054 14 8.73489 14 9.00011V9.5366C13.6143 9.60243 13.2536 9.7523 12.937 9.9445L12.9298 9.9489L12.4315 10.2608C11.9856 10.5357 11.5 11.0479 11.5 11.8252C11.5 12.5688 11.9611 13.2015 12.6323 13.4311V14.0001H10C9.73478 14.0001 9.48043 13.8947 9.29289 13.7072C9.10536 13.5197 9 13.2653 9 13.0001V5.08211C9 3.90611 9.906 2.96211 11.538 2.11311C11.6545 2.05244 11.7818 2.0153 11.9126 2.00383C12.0434 1.99235 12.1753 2.00675 12.3005 2.04622C12.4258 2.08568 12.5421 2.14944 12.6427 2.23383C12.7433 2.31823 12.8263 2.42162 12.887 2.53811C12.9477 2.65459 12.9848 2.78188 12.9963 2.91271C13.0078 3.04355 12.9934 3.17536 12.9539 3.30063C12.9144 3.42589 12.8507 3.54216 12.7663 3.64279C12.6819 3.74342 12.5785 3.82644 12.462 3.88711C11.884 4.18711 11.469 4.47611 11.222 4.73411C11.054 4.90811 11 5.02011 11 5.08211V8.00011H13ZM14.5428 15.4344C14.1182 15.4344 13.8823 15.1783 13.8823 14.7267V11.96H13.8722L13.6397 12.1082C13.4274 12.2329 13.3229 12.2734 13.1948 12.2734C12.9354 12.2734 12.75 12.0846 12.75 11.8252C12.75 11.6297 12.8646 11.4612 13.0904 11.323L13.5858 11.013C13.8688 10.8411 14.1587 10.7501 14.4249 10.7501C14.8933 10.7501 15.2 11.0635 15.2 11.5488V14.7267C15.2 15.1817 14.9641 15.4344 14.5428 15.4344Z"})),quoteTwo:t=>_.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},_.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 8.00015H6C6.26522 8.00015 6.51957 8.1055 6.70711 8.29304C6.89464 8.48058 7 8.73493 7 9.00015V13.0001C7 13.2654 6.89464 13.5197 6.70711 13.7073C6.51957 13.8948 6.26522 14.0001 6 14.0001H3C2.73478 14.0001 2.48043 13.8948 2.29289 13.7073C2.10536 13.5197 2 13.2654 2 13.0001V5.08215C2 3.90615 2.906 2.96215 4.538 2.11315C4.65448 2.05248 4.78177 2.01534 4.91261 2.00387C5.04344 1.99239 5.17525 2.00679 5.30052 2.04626C5.42579 2.08572 5.54205 2.14948 5.64268 2.23387C5.74331 2.31827 5.82633 2.42166 5.887 2.53815C5.94767 2.65463 5.9848 2.78192 5.99628 2.91275C6.00776 3.04359 5.99335 3.1754 5.95389 3.30067C5.91442 3.42593 5.85067 3.5422 5.76627 3.64283C5.68187 3.74346 5.57848 3.82648 5.462 3.88715C4.884 4.18715 4.469 4.47615 4.222 4.73415C4.054 4.90815 4 5.02015 4 5.08215V8.00015ZM13 8.00015C13.2652 8.00015 13.5196 8.1055 13.7071 8.29304C13.8946 8.48058 14 8.73493 14 9.00015V9.51812C13.4378 9.57694 12.9087 9.77735 12.4803 10.0918C11.9785 10.4601 11.5 11.0848 11.5 11.9043C11.5 12.3632 11.6772 12.8135 12.0264 13.1451C12.0604 13.1774 12.0955 13.208 12.1312 13.2369C11.9419 13.4409 11.7509 13.6922 11.6323 14.0001H10C9.73478 14.0001 9.48043 13.8948 9.29289 13.7073C9.10536 13.5197 9 13.2654 9 13.0001V5.08215C9 3.90615 9.906 2.96215 11.538 2.11315C11.6545 2.05248 11.7818 2.01534 11.9126 2.00387C12.0434 1.99239 12.1753 2.00679 12.3005 2.04626C12.4258 2.08572 12.5421 2.14948 12.6427 2.23387C12.7433 2.31827 12.8263 2.42166 12.887 2.53815C12.9477 2.65463 12.9848 2.78192 12.9963 2.91275C13.0078 3.04359 12.9934 3.1754 12.9539 3.30067C12.9144 3.42593 12.8507 3.5422 12.7663 3.64283C12.6819 3.74346 12.5785 3.82648 12.462 3.88715C11.884 4.18715 11.469 4.47615 11.222 4.73415C11.054 4.90815 11 5.02015 11 5.08215V8.00015H13ZM13.2256 15.1428C12.8903 15.1428 12.6626 14.9404 12.6626 14.6432C12.6626 14.4218 12.7891 14.2257 13.1591 13.8779L14.1616 12.907C14.4937 12.5876 14.6391 12.3789 14.6391 12.1607C14.6391 11.9045 14.4526 11.7337 14.1806 11.7337C13.9687 11.7337 13.8169 11.8255 13.6556 12.0532C13.4785 12.2872 13.3457 12.3694 13.1402 12.3694C12.8524 12.3694 12.65 12.1765 12.65 11.9045C12.65 11.2973 13.371 10.7502 14.247 10.7502C15.1546 10.7502 15.825 11.2973 15.825 12.0373C15.825 12.4959 15.5879 12.926 15.0787 13.3908L14.2881 14.1245V14.172H15.4203C15.765 14.172 15.98 14.3585 15.98 14.6621C15.98 14.9626 15.7713 15.1428 15.4203 15.1428H13.2256Z"})),link:Br,imageRegular:xo,imageWide:_o,imageFull:vo,imageReplace:wo,add:yo,edit:t=>_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...t},_.createElement("path",{d:"M16.19 3.51a.51.51 0 0 0-.71 0L4.07 14.92a.5.5 0 0 0 0 .71l4.28 4.28a.48.48 0 0 0 .7 0L20.47 8.5a.51.51 0 0 0 0-.71ZM3 16.71a.51.51 0 0 0-.47-.13.48.48 0 0 0-.36.33L0 23.33a.49.49 0 0 0 .12.51.5.5 0 0 0 .54.16l6.42-2.14a.52.52 0 0 0 .33-.36.49.49 0 0 0-.14-.5ZM23 1a3.6 3.6 0 0 0-5 0l-.71.71a.5.5 0 0 0 0 .71l4.28 4.28a.51.51 0 0 0 .7 0L23 6a3.53 3.53 0 0 0 0-5Z"})),snippet:Bn};function na({children:t,...e}){return h("ul",{className:"m-0 relative flex items-center justify-evenly rounded bg-black px-1 py-0 font-sans text-md font-normal text-white after:absolute after:top-[36px] after:left-[calc(50%-8px)] after:w-0 after:border-t-8 after:border-t-black after:border-x-8 after:border-x-transparent",...e,children:t})}function Fe({label:t,isActive:e,onClick:n,icon:r,...i}){const o=ju[r];return h("li",{className:"m-0 flex p-0 first:m-0",...i,children:h("button",{type:"button",className:"flex h-9 w-9 items-center justify-center",onClick:n,"aria-label":t,"data-kg-active":e,children:h(o,{className:e?"fill-green":"fill-white"})})})}function Pi(){return h("li",{className:"m-0 mx-1 h-5 w-px bg-grey-900"})}function Gu({isVisible:t,children:e,...n}){if(t)return h("div",{className:"not-kg-prose absolute top-[-44px] left-1/2 -translate-x-1/2 z-[1000]",...n,children:e})}async function Zu(t){const e=new Image;return e.src=t,new Promise((n,r)=>{e.onload=()=>{n({width:e.naturalWidth,height:e.naturalHeight})},e.onerror=r})}const Fi=async(t,e,n,r)=>{if(!t)return;let i=URL.createObjectURL(t[0]);i&&await n.update(()=>{k.$getNodeByKey(e).setPreviewSrc(i)});const{width:o,height:l}=await Zu(i),s=await r.imageUploader(t);await n.update(()=>{const a=k.$getNodeByKey(e);a.setImgWidth(o),a.setImgHeight(l),a.setSrc(s.src)})};function Ju({nodeKey:t,src:e,altText:n,caption:r,triggerFileDialog:i,previewSrc:o}){const[l]=ge.useLexicalComposerContext(),[s,a]=S.default.useState(!1),{imageUploader:c}=S.default.useContext(Cr),{isSelected:d,cardWidth:u,setCardWidth:g}=S.default.useContext(Gs),m=S.default.useRef(),f=S.default.useRef(),v=async y=>{const O=y.target.files;return await Fi(O,t,l,c)},C=y=>{l.update(()=>{k.$getNodeByKey(t).setCaption(y)})},N=y=>{l.update(()=>{k.$getNodeByKey(t).setAltText(y)})};S.default.useEffect(()=>{if(!i)return;const y=setTimeout(()=>{Er({fileInputRef:m}),l.update(()=>{k.$getNodeByKey(t).setTriggerFileDialog(!1)})});return()=>{clearTimeout(y)}});const p=y=>{l.update(()=>{k.$getNodeByKey(t).setCardWidth(y),g(y)})},x=y=>{y.preventDefault(),y.stopPropagation(),y.type==="dragenter"||y.type==="dragover"?a(!0):y.type==="dragleave"&&a(!1)},T=async y=>{if(y.preventDefault(),y.stopPropagation(),y.dataTransfer.files&&y.dataTransfer.files[0]){const O=y.dataTransfer.files;O&&(a(!1),await Fi(O,t,l,c))}},E=(c==null?void 0:c.uploadProgress)||100;return Y(Wn,{children:[h(ta,{isSelected:d,fileInputRef:m,onFileChange:v,src:e,altText:n,setAltText:N,caption:r,setCaption:C,handleDrag:x,handleDrop:T,isDraggedOver:s,cardWidth:u,previewSrc:o,uploadProgress:E}),Y(Gu,{isVisible:e&&d,"data-kg-card-toolbar":"image",children:[h(ea,{onFileChange:v,fileInputRef:f}),Y(na,{children:[h(Fe,{label:"Regular",icon:"imageRegular",isActive:u==="regular",onClick:()=>p("regular")}),h(Fe,{label:"Wide",icon:"imageWide",isActive:u==="wide",onClick:()=>p("wide")}),h(Fe,{label:"Full",icon:"imageFull",isActive:u==="full",onClick:()=>p("full")}),h(Pi,{}),h(Fe,{label:"Link",icon:"link",isActive:!1}),h(Fe,{label:"Replace",icon:"imageReplace",isActive:!1,onClick:()=>Er({fileInputRef:f})}),h(Pi,{}),h(Fe,{label:"Snippet",icon:"snippet",isActive:!1})]})]})]})}const zi=k.createCommand();k.createCommand();function Xu(t){if(t instanceof HTMLImageElement){const{alt:e,src:n}=t;return{node:Nr({altText:e,src:n})}}return null}const lo=class extends k.DecoratorNode{constructor({src:n,caption:r,altText:i,cardWidth:o,uploadProgress:l,triggerFileDialog:s,width:a,height:c,previewSrc:d}={},u){super(u);Se(this,"__src");Se(this,"__caption");Se(this,"__altText");Se(this,"__cardWidth");Se(this,"__width");Se(this,"__height");Se(this,"__triggerFileDialog",!1);Se(this,"__previewSrc",null);this.__caption=r||"",this.__altText=i||"",this.__src=n||"",this.__previewSrc=d||"",this.__cardWidth=o||"regular",this.__triggerFileDialog=s||!1,this.__width=a||null,this.__height=c||null}static getType(){return"image"}static clone(n){return new lo({src:n.__src,caption:n.__caption,altText:n.__altText,cardWidth:n.__cardWidth,width:n.__width,height:n.__height},n.__key)}static importJSON(n){const{caption:r,altText:i,src:o,cardWidth:l,width:s,height:a}=n;return Nr({altText:i,caption:r,src:o,cardWidth:l,width:s,height:a})}exportDOM(){const n=document.createElement("figure"),r=document.createElement("img"),i=document.createElement("figcaption");return r.src=this.getSrc(),i.innerHTML=this.getCaption(),n.appendChild(r),n.appendChild(i),{element:n}}static importDom(){return{img:(n=Node)=>({conversion:Xu,priority:1})}}exportJSON(){const r=this.getSrc().startsWith("data:");return{altText:this.getAltText(),caption:this.getCaption(),src:r?"<base64String>":this.getSrc(),type:"image",cardWidth:this.getCardWidth(),width:this.getImgWidth(),height:this.getImgHeight()}}createDOM(){return document.createElement("div")}updateDOM(){return!1}isInline(){return!1}getSrc(){return this.__src}setSrc(n){const r=this.getWritable();return r.__src=n}getPreviewSrc(){return this.__previewSrc}setPreviewSrc(n){const r=this.getWritable();return r.__previewSrc=n}setCardWidth(n){const r=this.getWritable();return r.__cardWidth=n}getCardWidth(){return this.__cardWidth}getImgWidth(){return this.__width}setImgWidth(n){const r=this.getWritable();return r.__width=n}getImgHeight(){return this.__height}setImgHeight(n){const r=this.getWritable();return r.__height=n}getCaption(){return this.__caption}setCaption(n){const r=this.getWritable();return r.__caption=n}getAltText(){return this.__altText}setAltText(n){const r=this.getWritable();return r.__altText=n}setTriggerFileDialog(n){const r=this.getWritable();return r.__triggerFileDialog=n}decorate(){return h(Di,{nodeKey:this.getKey(),width:this.__cardWidth,children:h(Ju,{nodeKey:this.getKey(),src:this.__src,altText:this.__altText,caption:this.__caption,triggerFileDialog:this.__triggerFileDialog,previewSrc:this.getPreviewSrc()})})}};let je=lo;Se(je,"kgMenu",{label:"Image",desc:"Upload, or embed with /image [url]",Icon:Co,insertCommand:zi,insertParams:{triggerFileDialog:!0},matches:["image","img"],queryParams:["src"]}),Se(je,"extensionTypes",["gif","jpg","jpeg","png","svg","svgz","webp"]),Se(je,"mimeTypes",["image/gif","image/jpg","image/jpeg","image/png","image/svg+xml","image/webp"]);const Nr=t=>(t.src&&delete t.triggerFileDialog,new je(t));function Qu(t){return t instanceof je}const ra=[Qe.HeadingNode,vt.ListNode,vt.ListItemNode,Qe.QuoteNode,yr,Ai.LinkNode,Yt,kt,je],qu={paragraph:void 0,heading:{h1:void 0,h2:void 0,h3:void 0,h4:void 0,h5:void 0,h6:void 0},quote:void 0,aside:void 0,list:{nested:{listitem:"!list-none"},ol:void 0,ul:void 0,listitem:void 0},link:void 0,text:{bold:void 0,italic:"italic",overflowed:void 0,hashtag:void 0,underline:void 0,strikethrough:void 0,underlinestrikethrough:void 0,code:void 0},code:void 0};function eg(t){console.error(t)}const tg={namespace:"KoenigEditor",theme:qu},ng=({initialEditorState:t,nodes:e=[...ra],onError:n=eg,imageUploadFunction:r,children:i})=>{const o=S.default.useMemo(()=>Object.assign({},tg,{nodes:e,editorState:t,onError:n}),[t,e,n]),l=S.default.useRef(null),s=r||function(){console.error("requires imageUploadFunction to be passed to KoenigComposer component, eg <KoenigComposer imageUploadFunction={function} />")};return h(Qd.LexicalComposer,{initialConfig:o,children:h(Cr.Provider,{value:{imageUploader:s,editorContainerRef:l},children:i})})};var ia={},at={},De=k;function Bi(t,e=!0){return t?!1:(t=oa(),e&&(t=t.trim()),t==="")}function oa(){return De.$getRoot().getTextContent()}function la(t,e){if(!e||!Bi(t,!1)||(t=De.$getRoot().getChildren(),e=t.length,1<e))return!1;for(let r=0;r<e;r++){var n=t[r];if(De.$isElementNode(n)){if(n.__type!=="paragraph"||n.__indent!==0)return!1;n=n.getChildren();let i=n.length;for(let o=0;o<i;o++)if(!De.$isTextNode(n[r]))return!1}}return!0}at.$canShowPlaceholder=la,at.$canShowPlaceholderCurry=function(t,e){return()=>la(t,e)},at.$findTextIntersectionFromCharacters=function(t,e){var n=t.getFirstChild();t=0;e:for(;n!==null;){if(De.$isElementNode(n)){var r=n.getFirstChild();if(r!==null){n=r;continue}}else if(De.$isTextNode(n)){if(r=n.getTextContentSize(),t+r>e)return{node:n,offset:e-t};t+=r}if(r=n.getNextSibling(),r!==null)n=r;else{for(n=n.getParent();n!==null;){if(r=n.getNextSibling(),r!==null){n=r;continue e}n=n.getParent()}break}}return null},at.$isRootTextContentEmpty=Bi,at.$isRootTextContentEmptyCurry=function(t,e){return()=>Bi(t,e)},at.$rootTextContent=oa,at.registerLexicalTextEntity=function(t,e,n,r){let i=l=>{const s=De.$createTextNode(l.getTextContent());s.setFormat(l.getFormat()),l.replace(s)},o=t.registerNodeTransform(De.TextNode,l=>{if(l.isSimpleText()){var s=l.getPreviousSibling(),a=l.getTextContent(),c=l;if(De.$isTextNode(s)){var d=s.getTextContent(),u=e(d+a);if(s instanceof n){if(u===null||s.getLatest().__mode!==0){i(s);return}if(u=u.end-d.length,0<u){c=a.slice(0,u),c=d+c,s.select(),s.setTextContent(c),u===a.length?l.remove():(s=a.slice(u),l.setTextContent(s));return}}else if(u===null||u.start<d.length)return}for(;;){if(l=e(a),a=u=l===null?"":a.slice(l.end),u===""){if(d=c.getNextSibling(),De.$isTextNode(d)){if(u=c.getTextContent()+d.getTextContent(),u=e(u),u===null){d instanceof n?i(d):d.markDirty();break}else if(u.start!==0)break}}else if(d=e(u),d!==null&&d.start===0)break;if(l===null)break;if(l.start===0&&De.$isTextNode(s)&&s.isTextEntity())continue;let g;if(l.start===0?[g,c]=c.splitText(l.end):[,g,c]=c.splitText(l.start,l.end),l=r(g),g.replace(l),c==null)break}}});return t=t.registerNodeTransform(n,l=>{var s=l.getTextContent();const a=e(s);a===null||a.start!==0?i(l):s.length>a.end?l.splitText(a.end):(s=l.getPreviousSibling(),De.$isTextNode(s)&&s.isTextEntity()&&(i(s),i(l)),s=l.getNextSibling(),De.$isTextNode(s)&&s.isTextEntity()&&(i(s),l instanceof n&&i(l)))}),[o,t]};var rg=at,sa={},Tr=k;sa.registerDragonSupport=function(t){let e=n=>{var r=t.getRootElement();if(document.activeElement===r&&(r=n.data,typeof r=="string")){try{var i=JSON.parse(r)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"&&(i=i.payload)&&i.functionId==="makeChanges"&&(i=i.args)){const[o,l,s,a,c]=i;t.update(()=>{const d=Tr.$getSelection();if(Tr.$isRangeSelection(d)){var u=d.anchor;let g=u.getNode(),m=0,f=0;Tr.$isTextNode(g)&&0<=o&&0<=l&&(m=o,f=o+l,d.setTextNodeRange(g,m,g,f)),(m!==f||s!=="")&&(d.insertRawText(s),g=u.getNode()),Tr.$isTextNode(g)&&(m=a,f=a+c,u=g.getTextContentSize(),m=m>u?u:m,f=f>u?u:f,d.setTextNodeRange(g,m,g,f)),n.stopImmediatePropagation()}})}}};return window.addEventListener("message",e,!0),()=>{window.removeEventListener("message",e,!0)}};var ig=sa,og=ge,ze=S.default,lg=rg,aa=_e,ca=Sc.default,sg=ig,ag=Qe,Hi=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?ze.useLayoutEffect:ze.useEffect;function da(t){return t.getEditorState().read(lg.$canShowPlaceholderCurry(t.isComposing(),t.isEditable()))}function cg(t){let[e,n]=ze.useState(()=>da(t));return Hi(()=>{function r(){let i=da(t);n(i)}return r(),aa.mergeRegister(t.registerUpdateListener(()=>{r()}),t.registerEditableListener(()=>{r()}))},[t]),e}function dg(t,e){let[n,r]=ze.useState(()=>t.getDecorators());return Hi(()=>t.registerDecoratorListener(i=>{ca.flushSync(()=>{r(i)})}),[t]),ze.useEffect(()=>{r(t.getDecorators())},[t]),ze.useMemo(()=>{let i=[],o=Object.keys(n);for(let s=0;s<o.length;s++){var l=o[s];let a=ze.createElement(e,{onError:c=>t._onError(c)},ze.createElement(ze.Suspense,{fallback:null},n[l]));l=t.getElementByKey(l),l!==null&&i.push(ca.createPortal(a,l))}return i},[e,n,t])}function ug(t){Hi(()=>aa.mergeRegister(ag.registerRichText(t),sg.registerDragonSupport(t)),[t])}ia.RichTextPlugin=function({contentEditable:t,placeholder:e,ErrorBoundary:n}){let[r]=og.useLexicalComposerContext(),i=cg(r);return n=dg(r,n),ug(r),ze.createElement(ze.Fragment,null,t,i&&e,n)};var gg=ia,hg=td(ad).jsx,Sr=S.default;function Ki(t,e){return Ki=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ki(t,e)}function fg(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Ki(t,e)}function pg(t,e){return t===void 0&&(t=[]),e===void 0&&(e=[]),t.length!==e.length||t.some(function(n,r){return!Object.is(n,e[r])})}var ua={error:null},mg=function(t){function e(){for(var r,i=arguments.length,o=Array(i),l=0;l<i;l++)o[l]=arguments[l];return r=t.call.apply(t,[this].concat(o))||this,r.state=ua,r.resetErrorBoundary=function(){for(var s,a=arguments.length,c=Array(a),d=0;d<a;d++)c[d]=arguments[d];r.props.onReset==null||(s=r.props).onReset.apply(s,c),r.reset()},r}fg(e,t),e.getDerivedStateFromError=function(r){return{error:r}};var n=e.prototype;return n.reset=function(){this.setState(ua)},n.componentDidCatch=function(r,i){var o,l;(o=(l=this.props).onError)==null||o.call(l,r,i)},n.componentDidUpdate=function(r,i){var o=this.props.resetKeys;if(this.state.error!==null&&i.error!==null&&pg(r.resetKeys,o)){var l,s;(l=(s=this.props).onResetKeysChange)==null||l.call(s,r.resetKeys,o),this.reset()}},n.render=function(){var r=this.state.error,i=this.props,o=i.fallbackRender,l=i.FallbackComponent;if(i=i.fallback,r!==null){if(r={error:r,resetErrorBoundary:this.resetErrorBoundary},Sr.isValidElement(i))return i;if(typeof o=="function")return o(r);if(l)return Sr.createElement(l,r);throw Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},e}(Sr.Component),xg=function({children:t,onError:e}){return Sr.createElement(mg,{fallback:hg("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e},t)},_g=xg,ga={},vg=ge,$n=S.default,wg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?$n.useLayoutEffect:$n.useEffect;ga.ContentEditable=function({ariaActiveDescendantID:t,ariaAutoComplete:e,ariaControls:n,ariaDescribedBy:r,ariaExpanded:i,ariaLabel:o,ariaLabelledBy:l,ariaMultiline:s,ariaOwneeID:a,ariaRequired:c,autoCapitalize:d,autoComplete:u,autoCorrect:g,className:m,id:f,role:v="textbox",spellCheck:C=!0,style:N,tabIndex:p,testid:x}){let[T]=vg.useLexicalComposerContext(),[E,y]=$n.useState(!1),O=$n.useCallback(D=>{T.setRootElement(D)},[T]);return wg(()=>(y(T.isEditable()),T.registerEditableListener(D=>{y(D)})),[T]),$n.createElement("div",{"aria-activedescendant":E?t:null,"aria-autocomplete":E?e:null,"aria-controls":E?n:null,"aria-describedby":r,"aria-expanded":E&&v==="combobox"?!!i:null,"aria-label":o,"aria-labelledby":l,"aria-multiline":s,"aria-owns":E?a:null,"aria-required":c,autoCapitalize:d!==void 0?String(d):void 0,autoComplete:u,autoCorrect:g!==void 0?String(g):void 0,className:m,contentEditable:E,"data-testid":x,id:f,ref:O,role:E?v:void 0,spellCheck:C,style:N,tabIndex:p})};var yg=ga,Wi={},Ui={},kg=_e,X=k;function Cg(t,e,n,r,i){if(t===null||n.size===0&&r.size===0&&!i)return 0;var o=e._selection,l=t._selection;if(i)return 1;if(!(X.$isRangeSelection(o)&&X.$isRangeSelection(l)&&l.isCollapsed()&&o.isCollapsed()))return 0;i=e._nodeMap;let s=[];for(let a of n)n=i.get(a),n!==void 0&&s.push(n);for(let[a,c]of r)c&&(r=i.get(a),r===void 0||X.$isRootNode(r)||s.push(r));return s.length===0?0:1<s.length?(r=e._nodeMap,e=r.get(o.anchor.key),l=r.get(l.anchor.key),e&&l&&!t._nodeMap.has(e.__key)&&X.$isTextNode(e)&&e.__text.length===1&&o.anchor.offset===1?2:0):(e=s[0],t=t._nodeMap.get(e.__key),!X.$isTextNode(t)||!X.$isTextNode(e)||t.__mode!==e.__mode||(t=t.__text,e=e.__text,t===e)||(o=o.anchor,l=l.anchor,o.key!==l.key||o.type!=="text")?0:(o=o.offset,l=l.offset,t=e.length-t.length,t===1&&l===o-1?2:t===-1&&l===o+1?3:t===-1&&l===o?4:0))}function Eg(t,e){let n=Date.now(),r=0;return(i,o,l,s,a,c)=>{let d=Date.now();if(c.has("historic"))return r=0,n=d,2;let u=Cg(i,o,s,a,t.isComposing()),g=(()=>{var m=l===null||l.editor===t,f=c.has("history-push");if(!f&&m&&c.has("history-merge"))return 0;if(i===null)return 1;const v=o._selection,C=i._selection;return 0<s.size||0<a.size?f===!1&&u!==0&&u===r&&d<n+e&&m||s.size===1&&(f=Array.from(s)[0],m=i._nodeMap.get(f),f=o._nodeMap.get(f),m=X.$isTextNode(m)&&X.$isTextNode(f)?m.__type===f.__type&&m.__text===f.__text&&m.__mode===f.__mode&&m.__detail===f.__detail&&m.__style===f.__style&&m.__format===f.__format&&m.__parent===f.__parent:!1,m)?0:1:C===null&&v!==null?0:2})();return n=d,r=u,g}}Ui.createEmptyHistoryState=function(){return{current:null,redoStack:[],undoStack:[]}},Ui.registerHistory=function(t,e,n){let r=Eg(t,n);n=({editorState:l,prevEditorState:s,dirtyLeaves:a,dirtyElements:c,tags:d})=>{const u=e.current,g=e.redoStack,m=e.undoStack,f=u===null?null:u.editorState;if(u===null||l!==f){if(a=r(s,l,u,a,c,d),a===1)g.length!==0&&(e.redoStack=[]),u!==null&&(m.push({...u,undoSelection:s.read(X.$getSelection)}),t.dispatchCommand(X.CAN_UNDO_COMMAND,!0));else if(a===2)return;e.current={editor:t,editorState:l}}};let i=kg.mergeRegister(t.registerCommand(X.UNDO_COMMAND,()=>{let l=e.redoStack,s=e.undoStack;if(s.length!==0){let a=e.current,c=s.pop();a!==null&&(l.push(a),t.dispatchCommand(X.CAN_REDO_COMMAND,!0)),s.length===0&&t.dispatchCommand(X.CAN_UNDO_COMMAND,!1),e.current=c||null,c&&c.editor.setEditorState(c.editorState.clone(c.undoSelection),{tag:"historic"})}return!0},X.COMMAND_PRIORITY_EDITOR),t.registerCommand(X.REDO_COMMAND,()=>{let l=e.redoStack;var s=e.undoStack;if(l.length!==0){let a=e.current;a!==null&&(s.push(a),t.dispatchCommand(X.CAN_UNDO_COMMAND,!0)),s=l.pop(),l.length===0&&t.dispatchCommand(X.CAN_REDO_COMMAND,!1),e.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:"historic"})}return!0},X.COMMAND_PRIORITY_EDITOR),t.registerCommand(X.CLEAR_EDITOR_COMMAND,()=>(e.undoStack=[],e.redoStack=[],e.current=null,!1),X.COMMAND_PRIORITY_EDITOR),t.registerCommand(X.CLEAR_HISTORY_COMMAND,()=>(e.undoStack=[],e.redoStack=[],e.current=null,t.dispatchCommand(X.CAN_REDO_COMMAND,!1),t.dispatchCommand(X.CAN_UNDO_COMMAND,!1),!0),X.COMMAND_PRIORITY_EDITOR),t.registerUpdateListener(n)),o=t.registerUpdateListener(n);return()=>{i(),o()}};var Ng=Ui,Tg=ge,Vi=Ng,ha=S.default;function Sg(t,e,n=1e3){let r=ha.useMemo(()=>e||Vi.createEmptyHistoryState(),[e]);ha.useEffect(()=>Vi.registerHistory(t,r,n),[n,t,r])}Wi.createEmptyHistoryState=Vi.createEmptyHistoryState,Wi.HistoryPlugin=function({externalHistoryState:t}){let[e]=Tg.useLexicalComposerContext();return Sg(e,t),null};var bg=Wi,fa={},Og=ge,pa=S.default,Rg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?pa.useLayoutEffect:pa.useEffect;fa.OnChangePlugin=function({ignoreHistoryMergeTagChange:t=!0,ignoreSelectionChange:e=!1,onChange:n}){let[r]=Og.useLexicalComposerContext();return Rg(()=>{if(n)return r.registerUpdateListener(({editorState:i,dirtyElements:o,dirtyLeaves:l,prevEditorState:s,tags:a})=>{e&&o.size===0&&l.size===0||t&&a.has("history-merge")||s.isEmpty()||n(i,r)})},[r,t,e,n]),null};var $g=fa,ma={},Be=vt,Ag=ge,xa=S.default,Mg=_e,et=k;function Lg(t){xa.useEffect(()=>Mg.mergeRegister(t.registerCommand(et.INDENT_CONTENT_COMMAND,()=>(Be.indentList(),!1),et.COMMAND_PRIORITY_LOW),t.registerCommand(et.OUTDENT_CONTENT_COMMAND,()=>(Be.outdentList(),!1),et.COMMAND_PRIORITY_LOW),t.registerCommand(Be.INSERT_ORDERED_LIST_COMMAND,()=>(Be.insertList(t,"number"),!0),et.COMMAND_PRIORITY_LOW),t.registerCommand(Be.INSERT_UNORDERED_LIST_COMMAND,()=>(Be.insertList(t,"bullet"),!0),et.COMMAND_PRIORITY_LOW),t.registerCommand(Be.REMOVE_LIST_COMMAND,()=>(Be.removeList(t),!0),et.COMMAND_PRIORITY_LOW),t.registerCommand(et.INSERT_PARAGRAPH_COMMAND,()=>!!Be.$handleListInsertParagraph(),et.COMMAND_PRIORITY_LOW)),[t])}ma.ListPlugin=function(){let[t]=Ag.useLexicalComposerContext();return xa.useEffect(()=>{if(!t.hasNodes([Be.ListNode,Be.ListItemNode]))throw Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[t]),Lg(t),null};var Dg=ma;const _a=10;function jt(t){const e=k.$createNodeSelection();e.add(t.getKey()),k.$setSelection(e)}function va(t){t.nodeType===Node.TEXT_NODE&&(t=t.parentNode);const e="[data-lexical-editor] > *";return t.closest(e)}function Ig({editor:t,containerElem:e}){return S.default.useEffect(()=>{const n=r=>{e.current.contains(r.target)||t.update(()=>{const i=k.$getSelection();k.$isNodeSelection(i)&&k.$setSelection(null)})};return window.addEventListener("mousedown",n),()=>{window.removeEventListener("mousedown",n)}},[t,e]),S.default.useEffect(()=>_e.mergeRegister(t.registerCommand(k.KEY_ARROW_UP_COMMAND,()=>{const n=k.$getSelection();if(k.$isNodeSelection(n)){const i=n.getNodes()[0].getPreviousSibling();if(!i)return!0;if(k.$isDecoratorNode(i))return jt(i),!0}if(k.$isRangeSelection(n)&&n.isCollapsed){const r=n.anchor.getNode().getTopLevelElement(),i=window.getSelection(),o=(r==null?void 0:r.getTextContent().trim())===""&&n.anchor.offset===0,l=n.anchor.offset===0&&n.focus.offset===0;if(o||l){const s=r.getPreviousSibling();if(k.$isDecoratorNode(s))return jt(s),!0}else{const a=i.getRangeAt(0).cloneRange().getClientRects();if(a.length>0){const c=a[1]||a[0],u=va(i.anchorNode).getBoundingClientRect();if(Math.abs(c.top-u.top)<=_a){const m=r.getPreviousSibling();if(k.$isDecoratorNode(m))return jt(m),!0}}}}return!1},k.COMMAND_PRIORITY_HIGH),t.registerCommand(k.KEY_ARROW_DOWN_COMMAND,()=>{const n=k.$getSelection();if(k.$isNodeSelection(n)){const i=n.getNodes()[0].getNextSibling();if(k.$isDecoratorNode(i))return jt(i),!0}if(k.$isRangeSelection(n)&&n.isCollapsed){const r=n.anchor.getNode().getTopLevelElement(),i=window.getSelection(),o=va(i.anchorNode),l=(r==null?void 0:r.getTextContent().trim())===""&&n.anchor.offset===0,s=i.rangeCount!==0&&i.anchorNode===o&&i.anchorOffset===o.children.length-1&&i.focusOffset===o.children.length-1;if(l||s){const a=r.getNextSibling();if(k.$isDecoratorNode(a))return jt(a),!0}else{const c=i.getRangeAt(0).cloneRange().getClientRects();if(c.length>0){const d=c[0],u=o.getBoundingClientRect();if(Math.abs(d.bottom-u.bottom)<_a){const g=r.getNextSibling();if(k.$isDecoratorNode(g))return jt(g),!0}}}}return!1},k.COMMAND_PRIORITY_HIGH),t.registerCommand(k.PASTE_COMMAND,n=>{var s;const r=(s=n==null?void 0:n.clipboardData)==null?void 0:s.getData("text"),i=r==null?void 0:r.match(/^(https?:\/\/[^\s]+)$/),o=k.$getSelection(),l=o.getTextContent();if(i&&l.length>0){const a=i[1];if(k.$isRangeSelection(o)){const c=o.extract()[0],d=Ai.$createLinkNode(a),u=k.$createTextNode(l);u.setFormat(c.getFormat()),d.append(u),c.replace(d)}return!0}},k.COMMAND_PRIORITY_HIGH))),null}function wa({containerElem:t=document.querySelector(".koenig-editor")}){const[e]=ge.useLexicalComposerContext();return Ig({editor:e,containerElem:t})}var Q={},re={},ya={exports:{}};(function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
31
+ `}isInline(){return!1}updateDOM(){return!1}decorate(){return h(Di,{nodeKey:this.getKey(),className:"inline-block",children:h(Au,{})})}};let kt=oo;Se(kt,"kgMenu",{label:"Divider",desc:"Insert a dividing line",Icon:Eo,insertCommand:Xs,matches:["divider","horizontal-rule","hr"]});function Ii(){return new kt}function Mu(t){return t instanceof kt}const Lu=({el:t,value:e})=>{te.useEffect(()=>{const n=t.current;if(n){n.style.height="0px";const r=n.scrollHeight;n.style.height=`${r}px`}},[t,e])};function Qs({code:t,language:e,updateCode:n,updateLanguage:r}){const i=S.default.useRef(null);return Lu({el:i,value:t}),h("code",{children:h("textarea",{ref:i,autoCorrect:"off",autoCapitalize:"off",spellCheck:"false",tabIndex:"0",autoFocus:!0,className:"min-h-170 w-full bg-grey-50 p-3 text-grey-900",value:t,onChange:n})})}Qs.propTypes={code:Le.exports.string},k.createCommand();function Du({code:t,language:e,nodeKey:n,editor:r}){return h(Qs,{code:t,updateCode:l=>{r.update(()=>{k.$getNodeByKey(n).setCode(l.target.value)})},language:e,updateLanguage:l=>{r.update(()=>{k.$getNodeByKey(n).setLanguage(l.target.value)})}})}class Yt extends k.DecoratorNode{constructor(n,r,i){super(i);Se(this,"__code","");Se(this,"__language","");this.__language=n,this.__code=r}static getType(){return"codeblock"}static clone(n){return new Yt(n.__key,n.__code)}static importJSON(n){return qs()}exportJSON(){return{type:"codeblock",version:1,code:this.__code,language:this.__language}}createDOM(n){return document.createElement("div")}updateDOM(){return!1}getCode(){return this.getLatest().__code}setCode(n){const r=this.getWritable();r.__code=n}getLanguage(){return this.getLatest().__language}setLanguage(n){const r=this.getWritable();r.__language=n}getTextContent(){return this.getLatest().__code}decorate(n,r){return h(Di,{nodeKey:this.getKey(),children:h(Du,{code:this.__code,language:this.__language,nodeKey:this.getKey(),editor:n})})}isInline(){return!1}}function qs(t,e){return new Yt(t,e)}function Iu(t){return t instanceof Yt}const Cr=S.default.createContext({});function Pu({value:t,placeholder:e,onChange:n}){return h("input",{onChange:i=>{n(i.target.value)},className:"not-kg-prose w-full px-9 text-center font-sans text-sm font-normal leading-8 tracking-wide text-grey-900",placeholder:e,value:t})}function Fu({value:t,placeholder:e,onChange:n}){return h("input",{onChange:i=>{n(i.target.value)},className:"not-kg-prose w-full px-9 text-center font-sans text-sm font-normal leading-8 tracking-wide text-grey-900",placeholder:e,value:t})}function zu({isEditingAlt:t,onClick:e}){return h("button",{name:"alt-toggle-button",className:`absolute bottom-0 right-0 m-2 cursor-pointer rounded border px-1 font-sans text-[1.3rem] font-normal leading-7 tracking-wide transition-all duration-100 ${t?"border-green bg-green text-white":"border-grey text-grey"} `,onClick:e,children:"Alt"})}function Bu({altText:t,altTextPlaceholder:e,setAltText:n,caption:r,captionPlaceholder:i,setCaption:o,isSelected:l}){const[s,a]=S.default.useState(!1),c=d=>{d.stopPropagation(),a(!s)};if(S.default.useEffect(()=>{l||a(!1)},[l,a]),l||r)return Y("figcaption",{className:"flex w-full p-2",children:[s?h(Fu,{value:t,placeholder:e,onChange:n}):h(Pu,{value:r,placeholder:i,onChange:o}),n&&h(zu,{isEditingAlt:s,onClick:c})]})}const Hu=({text:t})=>h("span",{"data-kg-card-drag-text":!0,className:"text-sm font-sans font-bold text-grey-800 transition-all group-hover:text-grey-800",children:t});function Ku({desc:t,Icon:e,filePicker:n,size:r,handleDrag:i,handleDrop:o,isDraggedOver:l,...s}){return h("div",{onDragEnter:i,onDragLeave:i,onDragOver:i,onDrop:o,className:"border border-transparent",...s,children:h("div",{className:`h-100 relative flex items-center justify-center border border-grey/20 bg-grey-50 ${r==="xsmall"?"before:pb-[12.5%]":"before:pb-[62.5%]"}`,children:l?h(Hu,{text:"Drop it like it's hot \u{1F525}"}):Y("button",{onClick:n,name:"placeholder-button",className:`group flex cursor-pointer items-center justify-center ${r==="xsmall"?"p-4":"p-20 flex-col"}`,children:[h(e,{className:`opacity-80 transition-all ease-linear group-hover:scale-105 group-hover:opacity-100 ${r==="large"?"h-20 w-20 text-grey":r==="small"?"h-14 w-14 text-grey":r==="xsmall"?"w-6 h-6 mr-3 text-grey-700":"h-16 w-16 text-grey"}`}),h("p",{className:`font-sans text-sm font-normal text-grey-700 transition-all group-hover:text-grey-800 ${r==="xsmall"?"":"mt-4"}`,children:t})]})})})}function Er({fileInputRef:t}){t.current.click()}function ea({onFileChange:t,fileInputRef:e}){return h("form",{onChange:t,children:h("input",{name:"image-input",type:"file",accept:"image/*",ref:e,hidden:!0})})}function Wu({src:t,alt:e}){return h("img",{src:t,alt:e})}function Uu({previewSrc:t,progress:e}){const n={width:`${e.toFixed(0)}%`};return Y("div",{children:[h("img",{classname:"opacity-40",src:t,alt:`upload in progress, ${e} `}),h("div",{className:"absolute inset-0 flex items-center min-w-full bg-white/50 justify-center overflow-hidden",children:h("div",{className:"not-kg-prose bg-grey-200 rounded-full shadow w-[60%]",children:h("div",{className:"bg-green rounded-full text-xs leading-none py-1 text-center text-white",style:n})})})]})}function Vu({onFileChange:t,setFileInputRef:e,handleDrag:n,handleDrop:r,isDraggedOver:i}){const o=S.default.useRef(null);return Y(Wn,{children:[h(Ku,{handleDrag:n,handleDrop:r,filePicker:()=>Er({fileInputRef:o}),desc:"Click to select an image",Icon:Hr,isDraggedOver:i}),h(ea,{filePicker:()=>Er({fileInputRef:o}),onFileChange:t,fileInputRef:s=>{o.current=s,e(o)}})]})}const Yu=({src:t,altText:e,previewSrc:n,uploadProgress:r,onFileChange:i,setFileInputRef:o,handleDrag:l,handleDrop:s,isDraggedOver:a})=>n&&!t&&r>0?h(Uu,{previewSrc:n,progress:r}):t&&!n?h(Wu,{src:t,alt:e}):h(Vu,{handleDrag:l,onFileChange:i,setFileInputRef:o,handleDrop:s,isDraggedOver:a});function ta({isSelected:t,src:e,onFileChange:n,caption:r,setCaption:i,altText:o,setAltText:l,setFigureRef:s,fileInputRef:a,handleDrag:c,handleDrop:d,isDraggedOver:u,cardWidth:g,previewSrc:m,uploadProgress:f}){const v=S.default.useRef(null);return S.default.useEffect(()=>{s&&s(v)},[v,s]),h(Wn,{children:Y("figure",{"data-kg-card-width":g,ref:v,children:[h(Yu,{src:e,altText:o,previewSrc:m,uploadProgress:f,onFileChange:n,setFileInputRef:N=>{a&&(a.current=N.current)},handleDrag:c,handleDrop:d,isDraggedOver:u}),h(Bu,{altText:o||"",setAltText:l,altTextPlaceholder:"Type alt text for image (optional)",caption:r||"",setCaption:i,captionPlaceholder:"Type caption for image (optional)",isSelected:t})]})})}ta.propTypes={isSelected:Le.exports.bool,setAltText:Le.exports.func,caption:Le.exports.string,altText:Le.exports.string,setCaption:Le.exports.func,src:Le.exports.string,isDraggedOver:Le.exports.bool,previewSrc:Le.exports.string,uploadProgress:Le.exports.number};const ju={bold:go,italic:ho,headingOne:fo,headingTwo:po,quote:mo,quoteOne:t=>_.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...t},_.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 8.00011H6C6.26522 8.00011 6.51957 8.10546 6.70711 8.293C6.89464 8.48054 7 8.73489 7 9.00011V13.0001C7 13.2653 6.89464 13.5197 6.70711 13.7072C6.51957 13.8947 6.26522 14.0001 6 14.0001H3C2.73478 14.0001 2.48043 13.8947 2.29289 13.7072C2.10536 13.5197 2 13.2653 2 13.0001V5.08211C2 3.90611 2.906 2.96211 4.538 2.11311C4.65448 2.05244 4.78177 2.0153 4.91261 2.00383C5.04344 1.99235 5.17525 2.00675 5.30052 2.04622C5.42579 2.08568 5.54205 2.14944 5.64268 2.23383C5.74331 2.31823 5.82633 2.42162 5.887 2.53811C5.94767 2.65459 5.9848 2.78188 5.99628 2.91271C6.00776 3.04355 5.99335 3.17536 5.95389 3.30063C5.91442 3.42589 5.85067 3.54216 5.76627 3.64279C5.68187 3.74342 5.57848 3.82644 5.462 3.88711C4.884 4.18711 4.469 4.47611 4.222 4.73411C4.054 4.90811 4 5.02011 4 5.08211V8.00011ZM13 8.00011C13.2652 8.00011 13.5196 8.10546 13.7071 8.293C13.8946 8.48054 14 8.73489 14 9.00011V9.5366C13.6143 9.60243 13.2536 9.7523 12.937 9.9445L12.9298 9.9489L12.4315 10.2608C11.9856 10.5357 11.5 11.0479 11.5 11.8252C11.5 12.5688 11.9611 13.2015 12.6323 13.4311V14.0001H10C9.73478 14.0001 9.48043 13.8947 9.29289 13.7072C9.10536 13.5197 9 13.2653 9 13.0001V5.08211C9 3.90611 9.906 2.96211 11.538 2.11311C11.6545 2.05244 11.7818 2.0153 11.9126 2.00383C12.0434 1.99235 12.1753 2.00675 12.3005 2.04622C12.4258 2.08568 12.5421 2.14944 12.6427 2.23383C12.7433 2.31823 12.8263 2.42162 12.887 2.53811C12.9477 2.65459 12.9848 2.78188 12.9963 2.91271C13.0078 3.04355 12.9934 3.17536 12.9539 3.30063C12.9144 3.42589 12.8507 3.54216 12.7663 3.64279C12.6819 3.74342 12.5785 3.82644 12.462 3.88711C11.884 4.18711 11.469 4.47611 11.222 4.73411C11.054 4.90811 11 5.02011 11 5.08211V8.00011H13ZM14.5428 15.4344C14.1182 15.4344 13.8823 15.1783 13.8823 14.7267V11.96H13.8722L13.6397 12.1082C13.4274 12.2329 13.3229 12.2734 13.1948 12.2734C12.9354 12.2734 12.75 12.0846 12.75 11.8252C12.75 11.6297 12.8646 11.4612 13.0904 11.323L13.5858 11.013C13.8688 10.8411 14.1587 10.7501 14.4249 10.7501C14.8933 10.7501 15.2 11.0635 15.2 11.5488V14.7267C15.2 15.1817 14.9641 15.4344 14.5428 15.4344Z"})),quoteTwo:t=>_.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},_.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 8.00015H6C6.26522 8.00015 6.51957 8.1055 6.70711 8.29304C6.89464 8.48058 7 8.73493 7 9.00015V13.0001C7 13.2654 6.89464 13.5197 6.70711 13.7073C6.51957 13.8948 6.26522 14.0001 6 14.0001H3C2.73478 14.0001 2.48043 13.8948 2.29289 13.7073C2.10536 13.5197 2 13.2654 2 13.0001V5.08215C2 3.90615 2.906 2.96215 4.538 2.11315C4.65448 2.05248 4.78177 2.01534 4.91261 2.00387C5.04344 1.99239 5.17525 2.00679 5.30052 2.04626C5.42579 2.08572 5.54205 2.14948 5.64268 2.23387C5.74331 2.31827 5.82633 2.42166 5.887 2.53815C5.94767 2.65463 5.9848 2.78192 5.99628 2.91275C6.00776 3.04359 5.99335 3.1754 5.95389 3.30067C5.91442 3.42593 5.85067 3.5422 5.76627 3.64283C5.68187 3.74346 5.57848 3.82648 5.462 3.88715C4.884 4.18715 4.469 4.47615 4.222 4.73415C4.054 4.90815 4 5.02015 4 5.08215V8.00015ZM13 8.00015C13.2652 8.00015 13.5196 8.1055 13.7071 8.29304C13.8946 8.48058 14 8.73493 14 9.00015V9.51812C13.4378 9.57694 12.9087 9.77735 12.4803 10.0918C11.9785 10.4601 11.5 11.0848 11.5 11.9043C11.5 12.3632 11.6772 12.8135 12.0264 13.1451C12.0604 13.1774 12.0955 13.208 12.1312 13.2369C11.9419 13.4409 11.7509 13.6922 11.6323 14.0001H10C9.73478 14.0001 9.48043 13.8948 9.29289 13.7073C9.10536 13.5197 9 13.2654 9 13.0001V5.08215C9 3.90615 9.906 2.96215 11.538 2.11315C11.6545 2.05248 11.7818 2.01534 11.9126 2.00387C12.0434 1.99239 12.1753 2.00679 12.3005 2.04626C12.4258 2.08572 12.5421 2.14948 12.6427 2.23387C12.7433 2.31827 12.8263 2.42166 12.887 2.53815C12.9477 2.65463 12.9848 2.78192 12.9963 2.91275C13.0078 3.04359 12.9934 3.1754 12.9539 3.30067C12.9144 3.42593 12.8507 3.5422 12.7663 3.64283C12.6819 3.74346 12.5785 3.82648 12.462 3.88715C11.884 4.18715 11.469 4.47615 11.222 4.73415C11.054 4.90815 11 5.02015 11 5.08215V8.00015H13ZM13.2256 15.1428C12.8903 15.1428 12.6626 14.9404 12.6626 14.6432C12.6626 14.4218 12.7891 14.2257 13.1591 13.8779L14.1616 12.907C14.4937 12.5876 14.6391 12.3789 14.6391 12.1607C14.6391 11.9045 14.4526 11.7337 14.1806 11.7337C13.9687 11.7337 13.8169 11.8255 13.6556 12.0532C13.4785 12.2872 13.3457 12.3694 13.1402 12.3694C12.8524 12.3694 12.65 12.1765 12.65 11.9045C12.65 11.2973 13.371 10.7502 14.247 10.7502C15.1546 10.7502 15.825 11.2973 15.825 12.0373C15.825 12.4959 15.5879 12.926 15.0787 13.3908L14.2881 14.1245V14.172H15.4203C15.765 14.172 15.98 14.3585 15.98 14.6621C15.98 14.9626 15.7713 15.1428 15.4203 15.1428H13.2256Z"})),link:Br,imageRegular:xo,imageWide:_o,imageFull:vo,imageReplace:wo,add:yo,edit:t=>_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...t},_.createElement("path",{d:"M16.19 3.51a.51.51 0 0 0-.71 0L4.07 14.92a.5.5 0 0 0 0 .71l4.28 4.28a.48.48 0 0 0 .7 0L20.47 8.5a.51.51 0 0 0 0-.71ZM3 16.71a.51.51 0 0 0-.47-.13.48.48 0 0 0-.36.33L0 23.33a.49.49 0 0 0 .12.51.5.5 0 0 0 .54.16l6.42-2.14a.52.52 0 0 0 .33-.36.49.49 0 0 0-.14-.5ZM23 1a3.6 3.6 0 0 0-5 0l-.71.71a.5.5 0 0 0 0 .71l4.28 4.28a.51.51 0 0 0 .7 0L23 6a3.53 3.53 0 0 0 0-5Z"})),snippet:Bn};function na({children:t,...e}){return h("ul",{className:"m-0 relative flex items-center justify-evenly rounded bg-black px-1 py-0 font-sans text-md font-normal text-white after:absolute after:top-[36px] after:left-[calc(50%-8px)] after:w-0 after:border-t-8 after:border-t-black after:border-x-8 after:border-x-transparent",...e,children:t})}function Fe({label:t,isActive:e,onClick:n,icon:r,...i}){const o=ju[r];return h("li",{className:"m-0 flex p-0 first:m-0",...i,children:h("button",{type:"button",className:"flex h-9 w-9 items-center justify-center",onClick:n,"aria-label":t,"data-kg-active":e,children:h(o,{className:e?"fill-green":"fill-white"})})})}function Pi(){return h("li",{className:"m-0 mx-1 h-5 w-px bg-grey-900"})}function Gu({isVisible:t,children:e,...n}){if(t)return h("div",{className:"not-kg-prose absolute top-[-44px] left-1/2 -translate-x-1/2 z-[1000]",...n,children:e})}async function Zu(t){const e=new Image;return e.src=t,new Promise((n,r)=>{e.onload=()=>{n({width:e.naturalWidth,height:e.naturalHeight})},e.onerror=r})}const Fi=async(t,e,n,r)=>{if(!t)return;let i=URL.createObjectURL(t[0]);i&&await n.update(()=>{k.$getNodeByKey(e).setPreviewSrc(i)});const{width:o,height:l}=await Zu(i),s=await r.imageUploader(t);await n.update(()=>{const a=k.$getNodeByKey(e);a.setImgWidth(o),a.setImgHeight(l),a.setSrc(s.src)})};function Ju({nodeKey:t,src:e,altText:n,caption:r,triggerFileDialog:i,previewSrc:o}){const[l]=ge.useLexicalComposerContext(),[s,a]=S.default.useState(!1),{imageUploader:c}=S.default.useContext(Cr),{isSelected:d,cardWidth:u,setCardWidth:g}=S.default.useContext(Gs),m=S.default.useRef(),f=S.default.useRef(),v=async y=>{const O=y.target.files;return await Fi(O,t,l,c)},C=y=>{l.update(()=>{k.$getNodeByKey(t).setCaption(y)})},N=y=>{l.update(()=>{k.$getNodeByKey(t).setAltText(y)})};S.default.useEffect(()=>{if(!i)return;const y=setTimeout(()=>{Er({fileInputRef:m}),l.update(()=>{k.$getNodeByKey(t).setTriggerFileDialog(!1)})});return()=>{clearTimeout(y)}});const p=y=>{l.update(()=>{k.$getNodeByKey(t).setCardWidth(y),g(y)})},x=y=>{y.preventDefault(),y.stopPropagation(),y.type==="dragenter"||y.type==="dragover"?a(!0):y.type==="dragleave"&&a(!1)},T=async y=>{if(y.preventDefault(),y.stopPropagation(),y.dataTransfer.files&&y.dataTransfer.files[0]){const O=y.dataTransfer.files;O&&(a(!1),await Fi(O,t,l,c))}},E=(c==null?void 0:c.uploadProgress)||0;return Y(Wn,{children:[h(ta,{isSelected:d,fileInputRef:m,onFileChange:v,src:e,altText:n,setAltText:N,caption:r,setCaption:C,handleDrag:x,handleDrop:T,isDraggedOver:s,cardWidth:u,previewSrc:o,uploadProgress:E}),Y(Gu,{isVisible:e&&d,"data-kg-card-toolbar":"image",children:[h(ea,{onFileChange:v,fileInputRef:f}),Y(na,{children:[h(Fe,{label:"Regular",icon:"imageRegular",isActive:u==="regular",onClick:()=>p("regular")}),h(Fe,{label:"Wide",icon:"imageWide",isActive:u==="wide",onClick:()=>p("wide")}),h(Fe,{label:"Full",icon:"imageFull",isActive:u==="full",onClick:()=>p("full")}),h(Pi,{}),h(Fe,{label:"Link",icon:"link",isActive:!1}),h(Fe,{label:"Replace",icon:"imageReplace",isActive:!1,onClick:()=>Er({fileInputRef:f})}),h(Pi,{}),h(Fe,{label:"Snippet",icon:"snippet",isActive:!1})]})]})]})}const zi=k.createCommand();k.createCommand();function Xu(t){if(t instanceof HTMLImageElement){const{alt:e,src:n}=t;return{node:Nr({altText:e,src:n})}}return null}const lo=class extends k.DecoratorNode{constructor({src:n,caption:r,altText:i,cardWidth:o,triggerFileDialog:l,width:s,height:a,previewSrc:c}={},d){super(d);Se(this,"__src");Se(this,"__caption");Se(this,"__altText");Se(this,"__cardWidth");Se(this,"__width");Se(this,"__height");Se(this,"__triggerFileDialog",!1);Se(this,"__previewSrc",null);this.__caption=r||"",this.__altText=i||"",this.__src=n||"",this.__previewSrc=c||"",this.__cardWidth=o||"regular",this.__triggerFileDialog=l||!1,this.__width=s||null,this.__height=a||null}static getType(){return"image"}static clone(n){return new lo({src:n.__src,caption:n.__caption,altText:n.__altText,cardWidth:n.__cardWidth,width:n.__width,height:n.__height},n.__key)}static importJSON(n){const{caption:r,altText:i,src:o,cardWidth:l,width:s,height:a}=n;return Nr({altText:i,caption:r,src:o,cardWidth:l,width:s,height:a})}exportDOM(){const n=document.createElement("figure"),r=document.createElement("img"),i=document.createElement("figcaption");return r.src=this.getSrc(),i.innerHTML=this.getCaption(),n.appendChild(r),n.appendChild(i),{element:n}}static importDom(){return{img:(n=Node)=>({conversion:Xu,priority:1})}}exportJSON(){const r=this.getSrc().startsWith("data:");return{altText:this.getAltText(),caption:this.getCaption(),src:r?"<base64String>":this.getSrc(),type:"image",cardWidth:this.getCardWidth(),width:this.getImgWidth(),height:this.getImgHeight()}}createDOM(){return document.createElement("div")}updateDOM(){return!1}isInline(){return!1}getSrc(){return this.__src}setSrc(n){const r=this.getWritable();return r.__src=n}getPreviewSrc(){return this.__previewSrc}setPreviewSrc(n){const r=this.getWritable();return r.__previewSrc=n}setCardWidth(n){const r=this.getWritable();return r.__cardWidth=n}getCardWidth(){return this.__cardWidth}getImgWidth(){return this.__width}setImgWidth(n){const r=this.getWritable();return r.__width=n}getImgHeight(){return this.__height}setImgHeight(n){const r=this.getWritable();return r.__height=n}getCaption(){return this.__caption}setCaption(n){const r=this.getWritable();return r.__caption=n}getAltText(){return this.__altText}setAltText(n){const r=this.getWritable();return r.__altText=n}setTriggerFileDialog(n){const r=this.getWritable();return r.__triggerFileDialog=n}decorate(){return h(Di,{nodeKey:this.getKey(),width:this.__cardWidth,children:h(Ju,{nodeKey:this.getKey(),src:this.__src,altText:this.__altText,caption:this.__caption,triggerFileDialog:this.__triggerFileDialog,previewSrc:this.getPreviewSrc()})})}};let je=lo;Se(je,"kgMenu",{label:"Image",desc:"Upload, or embed with /image [url]",Icon:Co,insertCommand:zi,insertParams:{triggerFileDialog:!0},matches:["image","img"],queryParams:["src"]}),Se(je,"extensionTypes",["gif","jpg","jpeg","png","svg","svgz","webp"]),Se(je,"mimeTypes",["image/gif","image/jpg","image/jpeg","image/png","image/svg+xml","image/webp"]);const Nr=t=>(t.src&&delete t.triggerFileDialog,new je(t));function Qu(t){return t instanceof je}const ra=[Qe.HeadingNode,vt.ListNode,vt.ListItemNode,Qe.QuoteNode,yr,Ai.LinkNode,Yt,kt,je],qu={paragraph:void 0,heading:{h1:void 0,h2:void 0,h3:void 0,h4:void 0,h5:void 0,h6:void 0},quote:void 0,aside:void 0,list:{nested:{listitem:"!list-none"},ol:void 0,ul:void 0,listitem:void 0},link:void 0,text:{bold:void 0,italic:"italic",overflowed:void 0,hashtag:void 0,underline:void 0,strikethrough:void 0,underlinestrikethrough:void 0,code:void 0},code:void 0};function eg(t){console.error(t)}const tg={namespace:"KoenigEditor",theme:qu},ng=({initialEditorState:t,nodes:e=[...ra],onError:n=eg,imageUploadFunction:r,children:i})=>{const o=S.default.useMemo(()=>Object.assign({},tg,{nodes:e,editorState:t,onError:n}),[t,e,n]),l=S.default.useRef(null),s=r||function(){console.error("requires imageUploadFunction to be passed to KoenigComposer component, eg <KoenigComposer imageUploadFunction={function} />")};return h(Qd.LexicalComposer,{initialConfig:o,children:h(Cr.Provider,{value:{imageUploader:s,editorContainerRef:l},children:i})})};var ia={},at={},De=k;function Bi(t,e=!0){return t?!1:(t=oa(),e&&(t=t.trim()),t==="")}function oa(){return De.$getRoot().getTextContent()}function la(t,e){if(!e||!Bi(t,!1)||(t=De.$getRoot().getChildren(),e=t.length,1<e))return!1;for(let r=0;r<e;r++){var n=t[r];if(De.$isElementNode(n)){if(n.__type!=="paragraph"||n.__indent!==0)return!1;n=n.getChildren();let i=n.length;for(let o=0;o<i;o++)if(!De.$isTextNode(n[r]))return!1}}return!0}at.$canShowPlaceholder=la,at.$canShowPlaceholderCurry=function(t,e){return()=>la(t,e)},at.$findTextIntersectionFromCharacters=function(t,e){var n=t.getFirstChild();t=0;e:for(;n!==null;){if(De.$isElementNode(n)){var r=n.getFirstChild();if(r!==null){n=r;continue}}else if(De.$isTextNode(n)){if(r=n.getTextContentSize(),t+r>e)return{node:n,offset:e-t};t+=r}if(r=n.getNextSibling(),r!==null)n=r;else{for(n=n.getParent();n!==null;){if(r=n.getNextSibling(),r!==null){n=r;continue e}n=n.getParent()}break}}return null},at.$isRootTextContentEmpty=Bi,at.$isRootTextContentEmptyCurry=function(t,e){return()=>Bi(t,e)},at.$rootTextContent=oa,at.registerLexicalTextEntity=function(t,e,n,r){let i=l=>{const s=De.$createTextNode(l.getTextContent());s.setFormat(l.getFormat()),l.replace(s)},o=t.registerNodeTransform(De.TextNode,l=>{if(l.isSimpleText()){var s=l.getPreviousSibling(),a=l.getTextContent(),c=l;if(De.$isTextNode(s)){var d=s.getTextContent(),u=e(d+a);if(s instanceof n){if(u===null||s.getLatest().__mode!==0){i(s);return}if(u=u.end-d.length,0<u){c=a.slice(0,u),c=d+c,s.select(),s.setTextContent(c),u===a.length?l.remove():(s=a.slice(u),l.setTextContent(s));return}}else if(u===null||u.start<d.length)return}for(;;){if(l=e(a),a=u=l===null?"":a.slice(l.end),u===""){if(d=c.getNextSibling(),De.$isTextNode(d)){if(u=c.getTextContent()+d.getTextContent(),u=e(u),u===null){d instanceof n?i(d):d.markDirty();break}else if(u.start!==0)break}}else if(d=e(u),d!==null&&d.start===0)break;if(l===null)break;if(l.start===0&&De.$isTextNode(s)&&s.isTextEntity())continue;let g;if(l.start===0?[g,c]=c.splitText(l.end):[,g,c]=c.splitText(l.start,l.end),l=r(g),g.replace(l),c==null)break}}});return t=t.registerNodeTransform(n,l=>{var s=l.getTextContent();const a=e(s);a===null||a.start!==0?i(l):s.length>a.end?l.splitText(a.end):(s=l.getPreviousSibling(),De.$isTextNode(s)&&s.isTextEntity()&&(i(s),i(l)),s=l.getNextSibling(),De.$isTextNode(s)&&s.isTextEntity()&&(i(s),l instanceof n&&i(l)))}),[o,t]};var rg=at,sa={},Tr=k;sa.registerDragonSupport=function(t){let e=n=>{var r=t.getRootElement();if(document.activeElement===r&&(r=n.data,typeof r=="string")){try{var i=JSON.parse(r)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"&&(i=i.payload)&&i.functionId==="makeChanges"&&(i=i.args)){const[o,l,s,a,c]=i;t.update(()=>{const d=Tr.$getSelection();if(Tr.$isRangeSelection(d)){var u=d.anchor;let g=u.getNode(),m=0,f=0;Tr.$isTextNode(g)&&0<=o&&0<=l&&(m=o,f=o+l,d.setTextNodeRange(g,m,g,f)),(m!==f||s!=="")&&(d.insertRawText(s),g=u.getNode()),Tr.$isTextNode(g)&&(m=a,f=a+c,u=g.getTextContentSize(),m=m>u?u:m,f=f>u?u:f,d.setTextNodeRange(g,m,g,f)),n.stopImmediatePropagation()}})}}};return window.addEventListener("message",e,!0),()=>{window.removeEventListener("message",e,!0)}};var ig=sa,og=ge,ze=S.default,lg=rg,aa=_e,ca=Sc.default,sg=ig,ag=Qe,Hi=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?ze.useLayoutEffect:ze.useEffect;function da(t){return t.getEditorState().read(lg.$canShowPlaceholderCurry(t.isComposing(),t.isEditable()))}function cg(t){let[e,n]=ze.useState(()=>da(t));return Hi(()=>{function r(){let i=da(t);n(i)}return r(),aa.mergeRegister(t.registerUpdateListener(()=>{r()}),t.registerEditableListener(()=>{r()}))},[t]),e}function dg(t,e){let[n,r]=ze.useState(()=>t.getDecorators());return Hi(()=>t.registerDecoratorListener(i=>{ca.flushSync(()=>{r(i)})}),[t]),ze.useEffect(()=>{r(t.getDecorators())},[t]),ze.useMemo(()=>{let i=[],o=Object.keys(n);for(let s=0;s<o.length;s++){var l=o[s];let a=ze.createElement(e,{onError:c=>t._onError(c)},ze.createElement(ze.Suspense,{fallback:null},n[l]));l=t.getElementByKey(l),l!==null&&i.push(ca.createPortal(a,l))}return i},[e,n,t])}function ug(t){Hi(()=>aa.mergeRegister(ag.registerRichText(t),sg.registerDragonSupport(t)),[t])}ia.RichTextPlugin=function({contentEditable:t,placeholder:e,ErrorBoundary:n}){let[r]=og.useLexicalComposerContext(),i=cg(r);return n=dg(r,n),ug(r),ze.createElement(ze.Fragment,null,t,i&&e,n)};var gg=ia,hg=td(ad).jsx,Sr=S.default;function Ki(t,e){return Ki=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ki(t,e)}function fg(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Ki(t,e)}function pg(t,e){return t===void 0&&(t=[]),e===void 0&&(e=[]),t.length!==e.length||t.some(function(n,r){return!Object.is(n,e[r])})}var ua={error:null},mg=function(t){function e(){for(var r,i=arguments.length,o=Array(i),l=0;l<i;l++)o[l]=arguments[l];return r=t.call.apply(t,[this].concat(o))||this,r.state=ua,r.resetErrorBoundary=function(){for(var s,a=arguments.length,c=Array(a),d=0;d<a;d++)c[d]=arguments[d];r.props.onReset==null||(s=r.props).onReset.apply(s,c),r.reset()},r}fg(e,t),e.getDerivedStateFromError=function(r){return{error:r}};var n=e.prototype;return n.reset=function(){this.setState(ua)},n.componentDidCatch=function(r,i){var o,l;(o=(l=this.props).onError)==null||o.call(l,r,i)},n.componentDidUpdate=function(r,i){var o=this.props.resetKeys;if(this.state.error!==null&&i.error!==null&&pg(r.resetKeys,o)){var l,s;(l=(s=this.props).onResetKeysChange)==null||l.call(s,r.resetKeys,o),this.reset()}},n.render=function(){var r=this.state.error,i=this.props,o=i.fallbackRender,l=i.FallbackComponent;if(i=i.fallback,r!==null){if(r={error:r,resetErrorBoundary:this.resetErrorBoundary},Sr.isValidElement(i))return i;if(typeof o=="function")return o(r);if(l)return Sr.createElement(l,r);throw Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},e}(Sr.Component),xg=function({children:t,onError:e}){return Sr.createElement(mg,{fallback:hg("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e},t)},_g=xg,ga={},vg=ge,$n=S.default,wg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?$n.useLayoutEffect:$n.useEffect;ga.ContentEditable=function({ariaActiveDescendantID:t,ariaAutoComplete:e,ariaControls:n,ariaDescribedBy:r,ariaExpanded:i,ariaLabel:o,ariaLabelledBy:l,ariaMultiline:s,ariaOwneeID:a,ariaRequired:c,autoCapitalize:d,autoComplete:u,autoCorrect:g,className:m,id:f,role:v="textbox",spellCheck:C=!0,style:N,tabIndex:p,testid:x}){let[T]=vg.useLexicalComposerContext(),[E,y]=$n.useState(!1),O=$n.useCallback(D=>{T.setRootElement(D)},[T]);return wg(()=>(y(T.isEditable()),T.registerEditableListener(D=>{y(D)})),[T]),$n.createElement("div",{"aria-activedescendant":E?t:null,"aria-autocomplete":E?e:null,"aria-controls":E?n:null,"aria-describedby":r,"aria-expanded":E&&v==="combobox"?!!i:null,"aria-label":o,"aria-labelledby":l,"aria-multiline":s,"aria-owns":E?a:null,"aria-required":c,autoCapitalize:d!==void 0?String(d):void 0,autoComplete:u,autoCorrect:g!==void 0?String(g):void 0,className:m,contentEditable:E,"data-testid":x,id:f,ref:O,role:E?v:void 0,spellCheck:C,style:N,tabIndex:p})};var yg=ga,Wi={},Ui={},kg=_e,X=k;function Cg(t,e,n,r,i){if(t===null||n.size===0&&r.size===0&&!i)return 0;var o=e._selection,l=t._selection;if(i)return 1;if(!(X.$isRangeSelection(o)&&X.$isRangeSelection(l)&&l.isCollapsed()&&o.isCollapsed()))return 0;i=e._nodeMap;let s=[];for(let a of n)n=i.get(a),n!==void 0&&s.push(n);for(let[a,c]of r)c&&(r=i.get(a),r===void 0||X.$isRootNode(r)||s.push(r));return s.length===0?0:1<s.length?(r=e._nodeMap,e=r.get(o.anchor.key),l=r.get(l.anchor.key),e&&l&&!t._nodeMap.has(e.__key)&&X.$isTextNode(e)&&e.__text.length===1&&o.anchor.offset===1?2:0):(e=s[0],t=t._nodeMap.get(e.__key),!X.$isTextNode(t)||!X.$isTextNode(e)||t.__mode!==e.__mode||(t=t.__text,e=e.__text,t===e)||(o=o.anchor,l=l.anchor,o.key!==l.key||o.type!=="text")?0:(o=o.offset,l=l.offset,t=e.length-t.length,t===1&&l===o-1?2:t===-1&&l===o+1?3:t===-1&&l===o?4:0))}function Eg(t,e){let n=Date.now(),r=0;return(i,o,l,s,a,c)=>{let d=Date.now();if(c.has("historic"))return r=0,n=d,2;let u=Cg(i,o,s,a,t.isComposing()),g=(()=>{var m=l===null||l.editor===t,f=c.has("history-push");if(!f&&m&&c.has("history-merge"))return 0;if(i===null)return 1;const v=o._selection,C=i._selection;return 0<s.size||0<a.size?f===!1&&u!==0&&u===r&&d<n+e&&m||s.size===1&&(f=Array.from(s)[0],m=i._nodeMap.get(f),f=o._nodeMap.get(f),m=X.$isTextNode(m)&&X.$isTextNode(f)?m.__type===f.__type&&m.__text===f.__text&&m.__mode===f.__mode&&m.__detail===f.__detail&&m.__style===f.__style&&m.__format===f.__format&&m.__parent===f.__parent:!1,m)?0:1:C===null&&v!==null?0:2})();return n=d,r=u,g}}Ui.createEmptyHistoryState=function(){return{current:null,redoStack:[],undoStack:[]}},Ui.registerHistory=function(t,e,n){let r=Eg(t,n);n=({editorState:l,prevEditorState:s,dirtyLeaves:a,dirtyElements:c,tags:d})=>{const u=e.current,g=e.redoStack,m=e.undoStack,f=u===null?null:u.editorState;if(u===null||l!==f){if(a=r(s,l,u,a,c,d),a===1)g.length!==0&&(e.redoStack=[]),u!==null&&(m.push({...u,undoSelection:s.read(X.$getSelection)}),t.dispatchCommand(X.CAN_UNDO_COMMAND,!0));else if(a===2)return;e.current={editor:t,editorState:l}}};let i=kg.mergeRegister(t.registerCommand(X.UNDO_COMMAND,()=>{let l=e.redoStack,s=e.undoStack;if(s.length!==0){let a=e.current,c=s.pop();a!==null&&(l.push(a),t.dispatchCommand(X.CAN_REDO_COMMAND,!0)),s.length===0&&t.dispatchCommand(X.CAN_UNDO_COMMAND,!1),e.current=c||null,c&&c.editor.setEditorState(c.editorState.clone(c.undoSelection),{tag:"historic"})}return!0},X.COMMAND_PRIORITY_EDITOR),t.registerCommand(X.REDO_COMMAND,()=>{let l=e.redoStack;var s=e.undoStack;if(l.length!==0){let a=e.current;a!==null&&(s.push(a),t.dispatchCommand(X.CAN_UNDO_COMMAND,!0)),s=l.pop(),l.length===0&&t.dispatchCommand(X.CAN_REDO_COMMAND,!1),e.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:"historic"})}return!0},X.COMMAND_PRIORITY_EDITOR),t.registerCommand(X.CLEAR_EDITOR_COMMAND,()=>(e.undoStack=[],e.redoStack=[],e.current=null,!1),X.COMMAND_PRIORITY_EDITOR),t.registerCommand(X.CLEAR_HISTORY_COMMAND,()=>(e.undoStack=[],e.redoStack=[],e.current=null,t.dispatchCommand(X.CAN_REDO_COMMAND,!1),t.dispatchCommand(X.CAN_UNDO_COMMAND,!1),!0),X.COMMAND_PRIORITY_EDITOR),t.registerUpdateListener(n)),o=t.registerUpdateListener(n);return()=>{i(),o()}};var Ng=Ui,Tg=ge,Vi=Ng,ha=S.default;function Sg(t,e,n=1e3){let r=ha.useMemo(()=>e||Vi.createEmptyHistoryState(),[e]);ha.useEffect(()=>Vi.registerHistory(t,r,n),[n,t,r])}Wi.createEmptyHistoryState=Vi.createEmptyHistoryState,Wi.HistoryPlugin=function({externalHistoryState:t}){let[e]=Tg.useLexicalComposerContext();return Sg(e,t),null};var bg=Wi,fa={},Og=ge,pa=S.default,Rg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?pa.useLayoutEffect:pa.useEffect;fa.OnChangePlugin=function({ignoreHistoryMergeTagChange:t=!0,ignoreSelectionChange:e=!1,onChange:n}){let[r]=Og.useLexicalComposerContext();return Rg(()=>{if(n)return r.registerUpdateListener(({editorState:i,dirtyElements:o,dirtyLeaves:l,prevEditorState:s,tags:a})=>{e&&o.size===0&&l.size===0||t&&a.has("history-merge")||s.isEmpty()||n(i,r)})},[r,t,e,n]),null};var $g=fa,ma={},Be=vt,Ag=ge,xa=S.default,Mg=_e,et=k;function Lg(t){xa.useEffect(()=>Mg.mergeRegister(t.registerCommand(et.INDENT_CONTENT_COMMAND,()=>(Be.indentList(),!1),et.COMMAND_PRIORITY_LOW),t.registerCommand(et.OUTDENT_CONTENT_COMMAND,()=>(Be.outdentList(),!1),et.COMMAND_PRIORITY_LOW),t.registerCommand(Be.INSERT_ORDERED_LIST_COMMAND,()=>(Be.insertList(t,"number"),!0),et.COMMAND_PRIORITY_LOW),t.registerCommand(Be.INSERT_UNORDERED_LIST_COMMAND,()=>(Be.insertList(t,"bullet"),!0),et.COMMAND_PRIORITY_LOW),t.registerCommand(Be.REMOVE_LIST_COMMAND,()=>(Be.removeList(t),!0),et.COMMAND_PRIORITY_LOW),t.registerCommand(et.INSERT_PARAGRAPH_COMMAND,()=>!!Be.$handleListInsertParagraph(),et.COMMAND_PRIORITY_LOW)),[t])}ma.ListPlugin=function(){let[t]=Ag.useLexicalComposerContext();return xa.useEffect(()=>{if(!t.hasNodes([Be.ListNode,Be.ListItemNode]))throw Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[t]),Lg(t),null};var Dg=ma;const _a=10;function jt(t){const e=k.$createNodeSelection();e.add(t.getKey()),k.$setSelection(e)}function va(t){t.nodeType===Node.TEXT_NODE&&(t=t.parentNode);const e="[data-lexical-editor] > *";return t.closest(e)}function Ig({editor:t,containerElem:e}){return S.default.useEffect(()=>{const n=r=>{e.current.contains(r.target)||t.update(()=>{const i=k.$getSelection();k.$isNodeSelection(i)&&k.$setSelection(null)})};return window.addEventListener("mousedown",n),()=>{window.removeEventListener("mousedown",n)}},[t,e]),S.default.useEffect(()=>_e.mergeRegister(t.registerCommand(k.KEY_ARROW_UP_COMMAND,()=>{const n=k.$getSelection();if(k.$isNodeSelection(n)){const i=n.getNodes()[0].getPreviousSibling();if(!i)return!0;if(k.$isDecoratorNode(i))return jt(i),!0}if(k.$isRangeSelection(n)&&n.isCollapsed){const r=n.anchor.getNode().getTopLevelElement(),i=window.getSelection(),o=(r==null?void 0:r.getTextContent().trim())===""&&n.anchor.offset===0,l=n.anchor.offset===0&&n.focus.offset===0;if(o||l){const s=r.getPreviousSibling();if(k.$isDecoratorNode(s))return jt(s),!0}else{const a=i.getRangeAt(0).cloneRange().getClientRects();if(a.length>0){const c=a[1]||a[0],u=va(i.anchorNode).getBoundingClientRect();if(Math.abs(c.top-u.top)<=_a){const m=r.getPreviousSibling();if(k.$isDecoratorNode(m))return jt(m),!0}}}}return!1},k.COMMAND_PRIORITY_HIGH),t.registerCommand(k.KEY_ARROW_DOWN_COMMAND,()=>{const n=k.$getSelection();if(k.$isNodeSelection(n)){const i=n.getNodes()[0].getNextSibling();if(k.$isDecoratorNode(i))return jt(i),!0}if(k.$isRangeSelection(n)&&n.isCollapsed){const r=n.anchor.getNode().getTopLevelElement(),i=window.getSelection(),o=va(i.anchorNode),l=(r==null?void 0:r.getTextContent().trim())===""&&n.anchor.offset===0,s=i.rangeCount!==0&&i.anchorNode===o&&i.anchorOffset===o.children.length-1&&i.focusOffset===o.children.length-1;if(l||s){const a=r.getNextSibling();if(k.$isDecoratorNode(a))return jt(a),!0}else{const c=i.getRangeAt(0).cloneRange().getClientRects();if(c.length>0){const d=c[0],u=o.getBoundingClientRect();if(Math.abs(d.bottom-u.bottom)<_a){const g=r.getNextSibling();if(k.$isDecoratorNode(g))return jt(g),!0}}}}return!1},k.COMMAND_PRIORITY_HIGH),t.registerCommand(k.PASTE_COMMAND,n=>{var s;const r=(s=n==null?void 0:n.clipboardData)==null?void 0:s.getData("text"),i=r==null?void 0:r.match(/^(https?:\/\/[^\s]+)$/),o=k.$getSelection(),l=o.getTextContent();if(i&&l.length>0){const a=i[1];if(k.$isRangeSelection(o)){const c=o.extract()[0],d=Ai.$createLinkNode(a),u=k.$createTextNode(l);u.setFormat(c.getFormat()),d.append(u),c.replace(d)}return!0}},k.COMMAND_PRIORITY_HIGH))),null}function wa({containerElem:t=document.querySelector(".koenig-editor")}){const[e]=ge.useLexicalComposerContext();return Ig({editor:e,containerElem:t})}var Q={},re={},ya={exports:{}};(function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
32
32
  * Prism: Lightweight, robust, elegant syntax highlighting
33
33
  *
34
34
  * @license MIT <https://opensource.org/licenses/MIT>