import{r as R,j as t}from"./iframe-B8FSoBNY.js";import{c as J}from"./compiler-runtime-BXE7OOXE.js";import{C as O,L as H,n as L,D as V,f as z}from"./rich-text-theme-Bkhh9rAZ.js";import{J as G,l as Q,s as U,n as X,I as Y,E as Z,K as ee}from"./CodeBlockPlugin-C3OWpvP8.js";import{a as te}from"./LexicalHistoryPlugin.prod-BQAibkDj.js";import{n as oe,T as re,a as se}from"./TreeViewPlugin-CyVKCrKJ.js";import{e as ne,a as ie,F as le,b as N}from"./FloatingTextFormatToolbarPlugin-B6jc8xvg.js";import{s as ae}from"./markdown-BLUemkxK.js";import{B as de}from"./index-B0y2_lLF.js";import{F as me}from"./flex-DAJL4AFZ.js";function ce(S){const e=J.c(38),{debug:k,defaultState:P,isEditable:D,placeholder:m,onChange:c}=S,_=k===void 0?!1:k,w=P===void 0?"":P,o=D===void 0?!1:D;let f;e[0]!==w?(f=ae(w),e[0]=w,e[1]=f):f=e[1];const{frontmatter:F,body:q}=f,B=o&&!!c,I=R.useRef(null),[u,A]=R.useState(null);let p,g;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{A(I.current)},g=[],e[2]=p,e[3]=g):(p=e[2],g=e[3]),R.useEffect(p,g);let r;e[4]!==q?(r=()=>G(q,N,void 0,!1),e[4]=q,e[5]=r):r=e[5];let h;e[6]!==o||e[7]!==r?(h={namespace:"MARKDOWN_EDITOR",nodes:ie,editorState:r,onError:fe,editable:o,theme:ne},e[6]=o,e[7]=r,e[8]=h):h=e[8];const M=h;let x,b,E,j,y,T;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(te,{}),T=t.jsx(Q,{}),x=t.jsx(U,{}),b=t.jsx(X,{}),E=t.jsx(Y,{}),j=t.jsx(Z,{}),e[9]=x,e[10]=b,e[11]=E,e[12]=j,e[13]=y,e[14]=T):(x=e[9],b=e[10],E=e[11],j=e[12],y=e[13],T=e[14]);let C;e[15]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(O,{fullWidth:!1}),e[15]=C):C=e[15];let s;e[16]!==m?(s=m?t.jsx(de,{position:"absolute",top:"0",color:"fg.muted",pointerEvents:"none",userSelect:"none",textStyle:"paragraph/M/regular",children:m}):null,e[16]=m,e[17]=s):s=e[17];let n;e[18]!==s?(n=t.jsx(H,{contentEditable:C,placeholder:s,ErrorBoundary:L}),e[18]=s,e[19]=n):n=e[19];let i;e[20]!==u||e[21]!==o?(i=o&&u?t.jsx(le,{anchorElem:u}):null,e[20]=u,e[21]=o,e[22]=i):i=e[22];let l;e[23]!==F||e[24]!==c||e[25]!==B?(l=B?t.jsx(oe,{ignoreSelectionChange:!0,ignoreHistoryMergeTagChange:!1,onChange:K=>{K.read(()=>{const W=V(),$=ee(N,W);c?.(F+$)})}}):null,e[23]=F,e[24]=c,e[25]=B,e[26]=l):l=e[26];let a;e[27]!==o?(a=t.jsx(re,{isEditable:o}),e[27]=o,e[28]=a):a=e[28];let d;e[29]!==_?(d=_&&t.jsx(se,{}),e[29]=_,e[30]=d):d=e[30];let v;return e[31]!==M||e[32]!==n||e[33]!==i||e[34]!==l||e[35]!==a||e[36]!==d?(v=t.jsx(me,{ref:I,className:"rich-text",justifyContent:"space-between",width:"100%",maxWidth:"100%",height:"100%",position:"relative",direction:"column",overflow:"hidden",children:t.jsxs(z,{initialConfig:M,children:[y,T,x,b,E,j,n,i,l,a,d]})}),e[31]=M,e[32]=n,e[33]=i,e[34]=l,e[35]=a,e[36]=d,e[37]=v):v=e[37],v}function fe(S){return console.error(S)}ce.__docgenInfo={description:"",methods:[],displayName:"MarkdownEditor",props:{debug:{required:!1,tsType:{name:"boolean"},description:""},defaultState:{required:!0,tsType:{name:"string"},description:""},isEditable:{required:!1,tsType:{name:"boolean"},description:""},placeholder:{required:!1,tsType:{name:"string"},description:""},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:"(value: string) => void",signature:{arguments:[{type:{name:"string"},name:"value"}],return:{name:"void"}}},description:""}}};export{ce as M};
