var l=Object.defineProperty;var h=(r,e,t)=>e in r?l(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var s=(r,e,t)=>(h(r,typeof e!="symbol"?e+"":e,t),t);import{D as p,e as f,f as y,h as i,m as c}from"./workspaceStore.ba59e8f0.js";import{A as g}from"./record.9f354c97.js";import{i as u}from"./colorHelpers.68e96910.js";import"./vue-router.e3ef87f0.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="a80b1af0-b28d-473f-98c9-c4c90b4d847e",r._sentryDebugIdIdentifier="sentry-dbid-a80b1af0-b28d-473f-98c9-c4c90b4d847e")}catch{}})();class m{async get(){return await(await fetch("/_editor/api/workspace",{method:"GET",headers:{"Content-Type":"application/json"}})).json()}async update(e,t){return await(await fetch("/_editor/api/workspace",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async create(e){throw new Error("Not implemented")}async openFile(e){await fetch("/_editor/api/workspace/open-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})})}async initFile(e,t){await fetch("/_editor/api/workspace/init-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,type:t})})}async checkFile(e){const t=await fetch(`/_editor/api/workspace/check-file?path=${e}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok)throw new Error("Failed to check file");return await t.json()}async readFile(e){const t=await fetch(`/_editor/api/workspace/read-file?file=${e}`,{method:"GET",headers:{"Content-Type":"application/json"}});return t.status===404?null:await t.text()}async readTestData(){return await(await fetch("/_editor/api/workspace/read-test-data",{method:"GET",headers:{"Content-Type":"application/json"}})).text()}async writeTestData(e){if(!(await fetch("/_editor/api/workspace/write-test-data",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({test_data:e})})).ok)throw new Error("Failed to write test data");return{success:!0}}async deploy(){if(!(await fetch("/_editor/api/workspace/deploy",{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to deploy")}}const a=new m,o=class{constructor(e){s(this,"record");this.record=g.create(a,e)}static async get(){const e=await a.get();return new o(e)}static from(e){return new o(e)}get brandName(){var e;return(e=this.record.get("brand_name"))!=null?e:""}set brandName(e){this.record.set("brand_name",e)}get fontColor(){var e;return(e=this.record.get("font_color"))!=null?e:"#000000"}set fontColor(e){this.record.set("font_color",e)}get logoUrl(){var e;return(e=this.record.get("logo_url"))!=null?e:""}set logoUrl(e){this.record.set("logo_url",e)}get faviconUrl(){var e;return(e=this.record.get("favicon_url"))!=null?e:""}set faviconUrl(e){this.record.set("favicon_url",e)}get mainColor(){var e;return(e=this.record.get("main_color"))!=null?e:p}set mainColor(e){this.record.set("main_color",e)}get fontFamily(){var e;return(e=this.record.get("font_family"))!=null?e:f}set fontFamily(e){this.record.set("font_family",e)}get language(){var e;return(e=this.record.get("language"))!=null?e:y.value}set language(e){this.record.set("language",e)}get theme(){var e;return(e=this.record.get("theme"))!=null?e:i}set theme(e){this.record.set("theme",e)}async save(){return this.record.save()}hasChanges(){return this.record.hasChanges()}static async openFile(e){await a.openFile(e)}static async initFile(e,t){await a.initFile(e,t)}static async checkFile(e){return a.checkFile(e)}async readFile(e){return a.readFile(e)}static async readTestData(){return a.readTestData()}static async writeTestData(e){return a.writeTestData(e)}static async deploy(){return a.deploy()}get sidebar(){var e;return(e=this.record.get("sidebar"))!=null?e:[]}set sidebar(e){this.record.set("sidebar",e)}makeRunnerData(){var e;return{sidebar:this.sidebar,name:this.brandName,fontColor:this.fontColor,brandName:this.brandName,fontFamily:this.fontFamily,logoUrl:this.logoUrl?c("logo",this.logoUrl,"editor"):null,mainColor:this.mainColor,theme:u(this.theme)?this.theme:(e=c("background",this.theme,"editor"))!=null?e:i,language:this.language}}};let n=o;s(n,"instance");export{n as W};
//# sourceMappingURL=workspaces.3503b70f.js.map
