var g=Object.defineProperty;var m=(r,t,e)=>t in r?g(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var i=(r,t,e)=>(m(r,typeof t!="symbol"?t+"":t,e),e);import{C as o}from"./router.87bf43b6.js";import{E as u}from"./record.820df198.js";import"./outputWidgets.be3472c2.js";import{l}from"./fetch.dd071db9.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[t]="4e1598e0-21cb-48db-aee4-6614e2b9572e",r._sentryDebugIdIdentifier="sentry-dbid-4e1598e0-21cb-48db-aee4-6614e2b9572e")}catch{}})();class h{constructor(t){i(this,"record");this.record=u.from(t)}get id(){return this.record.get("id")}get name(){return this.record.get("name")}get description(){return this.record.get("description")||""}set description(t){this.record.set("description",t)}get projectId(){return this.record.get("projectId")}static from(t){return new h(t)}commit(){this.record.commit()}hasChanges(){return this.record.hasChanges()}get changes(){return this.record.changes}update(t){this.record.update(t)}}class y{constructor(){i(this,"urlPath","roles")}async create(t,e){return o.post(`projects/${t}/${this.urlPath}`,e)}async delete(t,e){await o.delete(`projects/${t}/${this.urlPath}/${e}`)}async list(t,{limit:e,offset:s}){const a={};e&&(a.limit=e.toString()),s&&(a.offset=s.toString());const c=new URLSearchParams(a);return o.get(`projects/${t}/${this.urlPath}?${c.toString()}`)}async update(t,e,s){return o.patch(`projects/${t}/${this.urlPath}/${e}`,s)}}const n=new y;class S{constructor(t){this.projectId=t}async list(t,e){return(await n.list(this.projectId,{limit:t,offset:e})).map(h.from)}async create(t){await n.create(this.projectId,t)}async update(t,e){await n.update(this.projectId,t,e)}async delete(t){await n.delete(this.projectId,t)}}class C{constructor(t=l){this.fetch=t}async list(t,e){const s={};t&&(s.limit=t.toString()),e&&(s.offset=e.toString());const a=new URLSearchParams(s);return(await(await this.fetch(`/_editor/api/roles?${a.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})).json()).map(h.from)}}class p{constructor(t){i(this,"record");this.dto=t,this.record=u.from(t)}static from(t){return new p(t)}toDTO(){return this.record.toDTO()}get changes(){return this.record.changes}get id(){return this.record.get("id")}get email(){return this.record.get("email")}set email(t){this.record.set("email",t)}get projectId(){return this.record.get("projectId")}get roles(){return this.record.get("roles")}set roles(t){this.record.set("roles",t)}update(t){this.record.update(t)}resetChanges(){this.record.resetChanges()}}class f{constructor(){i(this,"urlPath","users")}async create(t,e){return o.post(`projects/${t}/${this.urlPath}`,e)}async delete(t,e){await o.delete(`projects/${t}/${this.urlPath}/${e}`)}async list(t,{limit:e,offset:s}){const a={};e&&(a.limit=e.toString()),s&&(a.offset=s.toString());const c=new URLSearchParams(a);return o.get(`projects/${t}/${this.urlPath}?${c.toString()}`)}async update(t,e,s){return o.patch(`projects/${t}/${this.urlPath}/${e}`,s)}}const d=new f;class E{constructor(t){this.projectId=t}async create(t){await d.create(this.projectId,t)}async update(t,e){await d.update(this.projectId,t,e)}async delete(t){await d.delete(this.projectId,t)}async list(t,e){return(await d.list(this.projectId,{limit:t,offset:e})).map(p.from)}}class R{constructor(t=l){this.fetch=t}async list(){return(await(await this.fetch("/_editor/api/users")).json()).map(p.from)}async create(t){await this.fetch("/_editor/api/users",{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}})}async update(t,e){await this.fetch(`/_editor/api/users/${t}`,{method:"PATCH",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}})}async delete(t){await this.fetch(`/_editor/api/users/${t}`,{method:"DELETE"})}}export{E as C,R as E,C as a,S as b};
//# sourceMappingURL=repository.0f18d917.js.map
