/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/@just4/request@1.0.0/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
import{assignProps}from"@just4/util/object";import{joinURL,concatURLParams}from"./internal/util";export{RequestError,RequestErrorType}from"./request-error";export class Request{constructor(e,s){this._baseOptions=Object.create(null),this._adapter=e,this.mixBaseOptions(s)}mixBaseOptions(e){return assignProps(this._baseOptions,e),assignProps(Object.create(null),this._baseOptions)}send(e,s){var r;let t=assignProps(Object.create(null),s,this._baseOptions);const o=t.beforeSend;"function"==typeof o&&(t=null!==(r=o(t))&&void 0!==r?r:t);const a=concatURLParams(t.baseURL?joinURL(t.baseURL,e):e,t.params,t.preventCaching);return this._adapter.send(Object.freeze({fullURL:this._adapter.toFullURL(a),url:e,baseURL:t.baseURL,params:t.params,data:t.data,headers:t.headers||Object.create(null),method:(t.method||"GET").toUpperCase(),requestType:(t.requestType||"").toLowerCase(),responseType:(t.responseType||"json").toLowerCase(),withCredentials:t.withCredentials,timeout:t.timeout,preventCaching:t.preventCaching,username:t.username,password:t.password,beforeSend:t.beforeSend,beforeXhrSend:t.beforeXhrSend,receiveTaskId:t.receiveTaskId,onUploadProgress:t.onUploadProgress,onDownloadProgress:t.onDownloadProgress,extra:t.extra}))}get(e,s){const r=assignProps(Object.create(null),s);return r.method="GET",this.send(e,r)}post(e,s){const r=assignProps(Object.create(null),s);return r.method="POST",this.send(e,r)}abort(e){return this._adapter.abort(e)}}