var d=Object.defineProperty;var p=(r,e,t)=>e in r?d(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var n=(r,e,t)=>(p(r,typeof e!="symbol"?e+"":e,t),t);import{D as l,a as h,b as y,m as f}from"./runnerData.9bb742cb.js";import{A as m}from"./record.87959be0.js";import{a as u}from"./asyncComputed.31721c4c.js";import"./outputWidgets.3b5544a6.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]="4718721c-46d1-46db-8b46-08a8566835d8",r._sentryDebugIdIdentifier="sentry-dbid-4718721c-46d1-46db-8b46-08a8566835d8")}catch{}})();class w{async get(){return await(await fetch("/_editor/api/workspace",{method:"GET",headers:{"Content-Type":"application/json"}})).json()}async update(e,t){const c=await(await fetch("/_editor/api/workspace",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json();return s.refetch(),c}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})}),s.refetch()}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 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 w,s=u(async()=>{const r=await a.get();return o.from(r)});class o{constructor(e){n(this,"record");this.record=m.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 mainColor(){var e;return(e=this.record.get("main_color"))!=null?e:l}set mainColor(e){this.record.set("main_color",e)}get fontFamily(){var e;return(e=this.record.get("font_family"))!=null?e:h}set fontFamily(e){this.record.set("font_family",e)}get theme(){var e;return(e=this.record.get("theme"))!=null?e:y}set theme(e){this.record.set("theme",e)}async save(){return this.record.save()}hasChanges(){return this.record.hasChanges()}async openFile(e){await a.openFile(e)}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 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(){return{sidebar:this.sidebar,brandName:this.brandName,fontFamily:this.fontFamily,logoUrl:f("logo",this.logoUrl,"player"),mainColor:this.mainColor,theme:this.theme}}static get computed(){return s}}export{o as W};
//# sourceMappingURL=workspaces.926d11e0.js.map
