const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CKRx7_Gr.js","./KXnyWfWg.js","./entry.CPA3v5Fu.css","./D-SdQ5dM.js","./editor.d-_yvVgq.css","./monaco-setup.COQM9i0P.css"])))=>i.map(i=>d[i]);
import{$n as e,Ar as t,Gn as n,Mn as r,Nr as i,Rr as a,Sr as o,Tr as s,Vr as c,Wr as l,Yr as u,gr as d,jr as f,kr as p,oi as m,or as h,ri as g,t as _,vr as v,yr as y}from"./KXnyWfWg.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=s({__name:`MonacoYamlEditor.client`,props:{modelValue:{},readOnly:{type:Boolean,default:!1},language:{default:`yaml`}},emits:[`update:modelValue`],setup(s,{emit:w}){let T=s,E=w,{t:D}=r(),O=_(),k=n(),A=u(),j=u(!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 f(async()=>{M=(await e(()=>import(`./CKRx7_Gr.js`),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).ensureMonacoYaml();let t=T.language===`javascript`,n=M.Uri.parse(t?`inmemory://profile/script.js`:`inmemory://profile/config.yaml`);P=M.editor.getModel(n)??M.editor.createModel(T.modelValue,t?`javascript`:`yaml`,n),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}),a(()=>T.modelValue,e=>{P&&e!==P.getValue()&&P.setValue(e)}),a(()=>T.readOnly,e=>N?.updateOptions({readOnly:e})),a([()=>O.curTheme,k],async()=>{await p(),M?.editor.setTheme(F())}),a(j,e=>{!M||!P||T.language!==`yaml`||M.editor.setModelLanguage(P,e?`plaintext`:`yaml`)}),(e,t)=>(i(),y(`div`,b,[d(`div`,x,[s.language===`yaml`?(i(),y(`label`,S,[c(d(`input`,{"onUpdate:modelValue":t[0]||=e=>l(j)?j.value=e:null,type:`checkbox`,class:`toggle toggle-xs`},null,512),[[h,g(j)]]),o(` `+m(g(D)(`editorDisableValidation`)),1)])):v(``,!0),s.readOnly?(i(),y(`span`,C,m(g(D)(`editorReadOnly`)),1)):v(``,!0)]),d(`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};