import{_ as W}from"./preload-helper-ec9aa979.js";import{S as p,i as E,s as V,e as z,c as M,a as H,d as w,b as R,f as A,N as y,_ as C,A as P,$ as I,a0 as O,a1 as T,a2 as K,a3 as L,a4 as b,X as U}from"./vendor-cb8fe21e.js";function q(o){let t;return{c(){t=z("div"),this.h()},l(n){t=M(n,"DIV",{class:!0}),H(t).forEach(w),this.h()},h(){R(t,"class","w-full h-full")},m(n,m){A(n,t,m),o[7](t)},p:y,i:y,o:y,d(n){n&&w(t),o[7](null)}}}function x(o,t,n){const m=C();let{language:l="json"}=t,{value:c=""}=t,{isReadonly:f=!1}=t,{schema:s=null}=t,{lineHighlight:g=!f}=t,{fontSize:_}=t,i,h=null,u,k;const v=()=>{i.layout()};function S(e){if(!i)return;const d=i.getPosition();i.setValue(e),i.setPosition(d)}P(async()=>{self.MonacoEnvironment={getWorker(a,r){return r==="json"?new I:r==="css"||r==="scss"||r==="less"?new O:r==="html"||r==="handlebars"||r==="razor"?new T:r==="typescript"||r==="javascript"?new K:r==="yaml"?L():new b}},u=await W(()=>import("./editor.main-cbfa99b0.js").then(function(a){return a.b}),["chunks/editor.main-cbfa99b0.js","assets/editor.main-200e01be.css"]);const e=await W(()=>import("./Monokai-89d42e8f.js"),[]);u.editor.defineTheme("monokai",e),u.editor.setTheme("monokai");const d=u.Uri.parse(`ds://${Date.now()}.${l}`);s!==null&&l==="json"&&(console.log(84,{language:l,schema:s,modelUri:d}),u.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemaValidation:"error",schemas:Array.isArray(s)?[{uri:`https://datastore${s[0].$id}`,fileMatch:[d.toString()],schema:s[0]},...s.map(a=>({uri:`https://datastore${a.$id}`,schema:a}))]:[{uri:"https://datastore/schema.json",fileMatch:[d.toString()],schema:s}]}));const D=u.editor.createModel(c,l,d);return i=u.editor.create(h,{model:D,language:l,readOnly:f,tabSize:2,minimap:{enabled:!1},renderLineHighlight:g===!1?"none":void 0,fontSize:_}),i.onDidContentSizeChange(v),v(),i.onKeyDown(function(a){if(a.ctrlKey&&a.keyCode===49){a.preventDefault(),n(1,c=i.getValue()),m("save",{value:c});return}if(a.ctrlKey&&a.keyCode===56){a.preventDefault(),i.restoreViewState(k);return}}),k=i.saveViewState(),()=>{i.dispose()}});function j(e){U[e?"unshift":"push"](()=>{h=e,n(0,h)})}return o.$$set=e=>{"language"in e&&n(2,l=e.language),"value"in e&&n(1,c=e.value),"isReadonly"in e&&n(3,f=e.isReadonly),"schema"in e&&n(4,s=e.schema),"lineHighlight"in e&&n(5,g=e.lineHighlight),"fontSize"in e&&n(6,_=e.fontSize)},o.$$.update=()=>{o.$$.dirty&2&&S(c)},[h,c,l,f,s,g,_,j]}class B extends p{constructor(t){super();E(this,t,x,q,V,{language:2,value:1,isReadonly:3,schema:4,lineHighlight:5,fontSize:6})}}export{B as E};
