import{r as n,j as f}from"./index-D775U4AF.js";import{ji as c}from"./initialize-Dcc4x6Mw.js";function o(e){const a=n.useRef(null),u=n.useRef(null);return n.useEffect(()=>{if(!a.current||u.current)return;const t=c.create(a.current,{value:e.value,language:e.language,theme:e.theme,...e.options});u.current=t},[]),n.useEffect(()=>{const t=u.current;if(!t)return;const r=t.getModel();r&&r.getValue()!==e.value&&r.setValue(e.value)},[e.value]),n.useEffect(()=>{e.theme&&c.setTheme(e.theme)},[e.theme]),n.useEffect(()=>{if(u.current&&e.language){const t=u.current.getModel();t&&c.setModelLanguage(t,e.language)}},[e.language]),n.useEffect(()=>{const t=a.current;return()=>{const r=u.current;r&&requestAnimationFrame(()=>{t!=null&&t.isConnected||(r.dispose(),u.current=null)})}},[]),f.jsx("div",{ref:a,className:"h-full w-full"})}export{o as ActivitySafeEditor};
