import{t as e}from"./axios-DSyjHw-i.js";import{t}from"./sessionSettingStore-ZHUB-lwo.js";var n=null,r=class{static async get(t,n=null){return n===null?e.get(this.getFullUrl(t)).then(e=>e.data):e.get(this.getFullUrl(t),{params:n}).then(e=>e.data)}static async post(t,n){return e.post(this.getFullUrl(t),n).then(e=>e.data)}static async patch(t,n){return e.patch(this.getFullUrl(t),n).then(e=>e.data)}static async put(t,n){return e.put(this.getFullUrl(t),n).then(e=>e.data)}static async delete(t,n){return n===void 0?e.delete(this.getFullUrl(t)).then(e=>e.data):e.delete(this.getFullUrl(t),{data:n}).then(e=>e.data)}static getFullUrl(e){return n===null&&(n=t()),e.startsWith(`/`)&&(e=e.slice(1)),e.startsWith(`http`)?e:`${n.useHttps?`https`:`http`}://${n.host}:${n.port}${n.apiRoute}/${e}`}static getCacheUrl(e){if(!e)return;for(n||=t();e.startsWith(`/`);)e=e.slice(1);if(e.startsWith(`http`))return e;(e===`cache`||e.startsWith(`cache/`))&&(e=e.slice(6));let r=`${n.useHttps?`https`:`http`}://${n.host}:${n.port}/${n.cacheRoute}/${e}`;return encodeURI(r)}};export{r as t};