import{r as i,j as u}from"./index-26FXPGkN.js";import{H as f,L as c,J as d,Q as E,M as S,N as x}from"./TaskPanel-1n1xV0vy.js";import{q as C}from"./layers.YoByaZrc-DQ8FBM0v.js";import"./tasks-BMVBejH2.js";import"./index-DlWqcwmX.js";import"./IconUser-CkQmhwMi.js";import"./Textarea-C8aNW3Hx.js";import"./get-env-uyVen0u2.js";import"./IconChevronLeft-FAloe5QL.js";import"./use-resize-observer-6Qm_8hWl.js";import"./useTaskTypesData-CFzDcAWE.js";import"./ColorSwatch-CtoYH4Cn.js";import"./Typography-PKUzf06x.js";import"./clamp-CUTWWzXs.js";import"./Select-C1WMqk5R.js";import"./SegmentedControl-BeEuUkOb.js";import"./IconGripVertical-COCN8Vqa.js";import"./IconAt-Bca7mi74.js";import"./IconTableOff-DmQNoB2C.js";import"./Accordion-z2XcZ0M6.js";const N=f("INSERT_EXCALIDRAW_COMMAND");function v(){const[t]=c(),[n,e]=i.useState(!1),[r,l]=i.useState(null),s=i.useRef(null);return i.useEffect(()=>{if(!t.hasNodes([d]))throw new Error("ExcalidrawPlugin: ExcalidrawNode not registered on editor");return t.registerCommand(N,()=>{e(!0);const o=E();return l(o),!0},S)},[t]),u.jsx(C,{initialElements:[],initialAppState:{},initialFiles:{},isShown:n,onDelete:()=>{e(!1)},onClose:()=>{e(!1),s.current=!1},onSave:(o,p,m)=>{t.update(()=>{const a=x();a.setData(JSON.stringify({appState:p,elements:o,files:m})),r&&r.getParent()&&(r==null||r.replace(a))}),e(!1)},closeOnClickOutside:!1,isEdited:s})}export{N as INSERT_EXCALIDRAW_COMMAND,v as default};
