"use strict";const i=require("../../../../../common/vendor.js"),_=require("../helpers/buildURL.js"),n=require("../core/buildFullPath.js"),h=require("../core/settle.js"),m=require("../utils.js"),o=(e,s)=>{const a={};return e.forEach(l=>{m.isUndefined(s[l])||(a[l]=s[l])}),a},c=e=>new Promise((s,a)=>{const l=_.buildURL(n.buildFullPath(e.baseURL,e.url),e.params),u={url:l,header:e.header,complete:t=>{e.fullPath=l,t.config=e;try{typeof t.data=="string"&&(t.data=JSON.parse(t.data))}catch{}h.settle(s,a,t)}};let d;if(e.method==="UPLOAD"){delete u.header["content-type"],delete u.header["Content-Type"];const t={filePath:e.filePath,name:e.name},r=["formData"];d=i.index.uploadFile({...u,...t,...o(r,e)})}else if(e.method==="DOWNLOAD")d=i.index.downloadFile(u);else{const t=["data","method","timeout","dataType","responseType"];d=i.index.request({...u,...o(t,e)})}e.getTask&&e.getTask(d,e)});exports.adapter=c;
