const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BcDb5xh0.js","./bEsZKPzd.js","./entry.Cthcl3x5.css","./BFcJb09c.js","./editor.d-_yvVgq.css","./DVepwuqA.js","./monaco-setup.COQM9i0P.css"])))=>i.map(i=>d[i]);
import{Ar as e,Dr as t,Er as n,Fr as r,Hn as i,Kr as a,Or as o,Rr as s,Sr as c,Vr as l,Xn as u,ei as d,gr as f,hr as p,kn as m,pr as h,ri as g,rr as _,t as v,yr as y}from"./bEsZKPzd.js";var b={class:`flex flex-col gap-2`},x={class:`flex items-center justify-end gap-3 text-xs`},S={key:0,class:`flex cursor-pointer items-center gap-1`},C={key:1,class:`badge badge-ghost badge-sm`},w=c({__name:`MonacoYamlEditor.client`,props:{modelValue:{},readOnly:{type:Boolean,default:!1},language:{default:`yaml`}},emits:[`update:modelValue`],setup(c,{emit:w}){let T=c,E=w,{t:D}=m(),O=v(),k=i(),A=a(),j=a(!1),M=null,N=null,P=null;function F(){if(typeof document<`u`){let e=getComputedStyle(document.documentElement).colorScheme;if(e.includes(`dark`))return`vs-dark`;if(e.includes(`light`))return`vs`}return k.value?`vs-dark`:`vs`}return o(async()=>{M=(await u(()=>import(`./BcDb5xh0.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).ensureMonacoYaml();let e=T.language===`javascript`,t=M.Uri.parse(e?`inmemory://profile/script.js`:`inmemory://profile/config.yaml`);P=M.editor.getModel(t)??M.editor.createModel(T.modelValue,e?`javascript`:`yaml`,t),P.setValue(T.modelValue),N=M.editor.create(A.value,{model:P,theme:F(),readOnly:T.readOnly,automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,tabSize:2}),N.onDidChangeModelContent(()=>{E(`update:modelValue`,N.getValue())})}),t(()=>{N?.dispose(),P?.dispose(),N=null,P=null}),r(()=>T.modelValue,e=>{P&&e!==P.getValue()&&P.setValue(e)}),r(()=>T.readOnly,e=>N?.updateOptions({readOnly:e})),r([()=>O.curTheme,k],async()=>{await n(),M?.editor.setTheme(F())}),r(j,e=>{!M||!P||T.language!==`yaml`||M.editor.setModelLanguage(P,e?`plaintext`:`yaml`)}),(t,n)=>(e(),f(`div`,b,[h(`div`,x,[c.language===`yaml`?(e(),f(`label`,S,[s(h(`input`,{"onUpdate:modelValue":n[0]||=e=>l(j)?j.value=e:null,type:`checkbox`,class:`toggle toggle-xs`},null,512),[[_,d(j)]]),y(` `+g(d(D)(`editorDisableValidation`)),1)])):p(``,!0),c.readOnly?(e(),f(`span`,C,g(d(D)(`editorReadOnly`)),1)):p(``,!0)]),h(`div`,{ref_key:`container`,ref:A,class:`h-[60vh] w-full overflow-hidden rounded-lg border border-base-content/10`},null,512)]))}}),T=Object.assign(w,{__name:`MonacoYamlEditor`});export{T as default};