import{r as i,j as u}from"./index-DTC0Ed21.js";import{C as f,N as c,D as d,H as E,K as S,L as C}from"./TaskPanel-DL-lNNa-.js";import{g as N}from"./layers.B6AgvWr7-Bq9IA4iY.js";import"./tasks-ClycqzjK.js";import"./IconUser-Bh9n--nN.js";import"./tasks-R9G1-k7v.js";import"./IconChevronLeft-DwnMQlxZ.js";import"./use-resize-observer-B2T5TxF-.js";import"./useTaskTypesData-DEDxUwkB.js";import"./PillsInput-BQBRVlfT.js";import"./SegmentedControl-CI2D3wRP.js";import"./get-base-value-JqT_q0U7.js";import"./ColorSwatch-DyLoUEeW.js";import"./TypographyStylesProvider-B4wTcLh8.js";import"./clamp-Bw9v46PI.js";import"./IconGripVertical-A4WphpSm.js";import"./Accordion-BmslGzqa.js";const D=f("INSERT_EXCALIDRAW_COMMAND");function v(){const[t]=c(),[n,e]=i.useState(!1),[r,l]=i.useState(null),o=i.useRef(null);return i.useEffect(()=>{if(!t.hasNodes([d]))throw new Error("ExcalidrawPlugin: ExcalidrawNode not registered on editor");return t.registerCommand(D,()=>{e(!0);const s=E();return l(s),!0},S)},[t]),u.jsx(N,{initialElements:[],initialAppState:{},initialFiles:{},isShown:n,onDelete:()=>{e(!1)},onClose:()=>{e(!1),o.current=!1},onSave:(s,p,m)=>{t.update(()=>{const a=C();a.setData(JSON.stringify({appState:p,elements:s,files:m})),r&&r.getParent()&&(r==null||r.replace(a))}),e(!1)},closeOnClickOutside:!1,isEdited:o})}export{D as INSERT_EXCALIDRAW_COMMAND,v as default};
