import{d as _,r as p,E as M,X as E,Y as h,G as l,Z as k,o as y,e as C,p as w,f as x,_ as f}from"./BvNnk7SS.js";const L=_({__name:"MonacoEditor.client",props:{lang:{default:()=>"plaintext"},options:{default:()=>({})},modelValue:{default:()=>""}},emits:["update:modelValue","load"],setup(V,{expose:g,emit:v}){const o=V,n=v,d=p(!0),u=M(()=>o.lang||o.options.language),i=E(),a=p(),s=h(),r={automaticLayout:!0};let e,t;return l(()=>o.modelValue,()=>{e?.getValue()!==o.modelValue&&e?.setValue(o.modelValue)}),l(()=>o.lang,()=>{t&&t.dispose(),t=s.editor.createModel(o.modelValue,u.value),e?.setModel(t)}),l(()=>o.options,()=>{e?.updateOptions(f(o.options,r))}),l(a,(c,m)=>{!a.value||m||(e=s.editor.create(a.value,f(o.options,r)),t=s.editor.createModel(o.modelValue,u.value),i.value=e,e.layout(),e.setModel(t),e.onDidChangeModelContent(()=>{n("update:modelValue",e.getValue())}),d.value=!1,n("load",e))}),g({$editor:i}),k(()=>{e?.dispose(),t?.dispose()}),(c,m)=>(y(),C("div",{ref_key:"editorElement",ref:a},[d.value?w(c.$slots,"default",{key:0}):x("",!0)],512))}});export{L as _};
