import{addOauthHeader as e}from"@clevercloud/client/esm/oauth.js";import{prefixUrl as t}from"@clevercloud/client/esm/prefix-url.js";import{execWarpscript as o}from"@clevercloud/client/esm/request-warp10.fetch.js";import{request as r}from"@clevercloud/client/esm/request.fetch.js";import{withCache as n}from"@clevercloud/client/esm/with-cache.js";import{withOptions as c}from"@clevercloud/client/esm/with-options.js";import{CcApiErrorEvent as i}from"./send-to-api.events.js";function s({apiConfig:o,signal:s,cacheDelay:l,timeout:m}){return u=>{const h={...o,...u};return n(h,l,(()=>{const{API_HOST:n="https://api.clever-cloud.com",...l}=o??{};return Promise.resolve(u).then(t(n)).then(e(l)).then(c({signal:s,timeout:m})).then(r).catch((e=>{throw window.dispatchEvent(new i(e)),e}))}))}}function l({apiConfig:e,signal:r,cacheDelay:i,timeout:s}){return l=>{const m={...e,...l};return n(m,i,(()=>{const{WARP_10_HOST:n}=e;return Promise.resolve(l).then(t(n)).then(c({signal:r,timeout:s})).then(o)}))}}export{s as sendToApi,l as sendToWarp};
//# sourceMappingURL=send-to-api.js.map
