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