copilot-for-dressing / assets /axios.1fa0e28b.js
ryesun's picture
upload
b65c314
raw
history blame
20.4 kB
import{s as Be}from"./utils.62547028.js";var V={exports:{}},fe=function(e,r){return function(){for(var n=new Array(arguments.length),u=0;u<n.length;u++)n[u]=arguments[u];return e.apply(r,n)}},xe=fe,F=Object.prototype.toString;function W(t){return F.call(t)==="[object Array]"}function I(t){return typeof t=="undefined"}function Re(t){return t!==null&&!I(t)&&t.constructor!==null&&!I(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function De(t){return F.call(t)==="[object ArrayBuffer]"}function Te(t){return typeof FormData!="undefined"&&t instanceof FormData}function ge(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Oe(t){return typeof t=="string"}function Ue(t){return typeof t=="number"}function de(t){return t!==null&&typeof t=="object"}function O(t){if(F.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function $e(t){return F.call(t)==="[object Date]"}function Pe(t){return F.call(t)==="[object File]"}function Ne(t){return F.call(t)==="[object Blob]"}function he(t){return F.call(t)==="[object Function]"}function Le(t){return de(t)&&he(t.pipe)}function je(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function qe(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function ke(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function G(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),W(t))for(var r=0,a=t.length;r<a;r++)e.call(null,t[r],r,t);else for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.call(null,t[n],n,t)}function J(){var t={};function e(n,u){O(t[u])&&O(n)?t[u]=J(t[u],n):O(n)?t[u]=J({},n):W(n)?t[u]=n.slice():t[u]=n}for(var r=0,a=arguments.length;r<a;r++)G(arguments[r],e);return t}function _e(t,e,r){return G(e,function(n,u){r&&typeof n=="function"?t[u]=xe(n,r):t[u]=n}),t}function He(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}var p={isArray:W,isArrayBuffer:De,isBuffer:Re,isFormData:Te,isArrayBufferView:ge,isString:Oe,isNumber:Ue,isObject:de,isPlainObject:O,isUndefined:I,isDate:$e,isFile:Pe,isBlob:Ne,isFunction:he,isStream:Le,isURLSearchParams:je,isStandardBrowserEnv:ke,forEach:G,merge:J,extend:_e,trim:qe,stripBOM:He},b=p;function ee(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var pe=function(e,r,a){if(!r)return e;var n;if(a)n=a(r);else if(b.isURLSearchParams(r))n=r.toString();else{var u=[];b.forEach(r,function(l,v){l===null||typeof l=="undefined"||(b.isArray(l)?v=v+"[]":l=[l],b.forEach(l,function(c){b.isDate(c)?c=c.toISOString():b.isObject(c)&&(c=JSON.stringify(c)),u.push(ee(v)+"="+ee(c))}))}),n=u.join("&")}if(n){var s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+n}return e},Me=p;function $(){this.handlers=[]}$.prototype.use=function(e,r,a){return this.handlers.push({fulfilled:e,rejected:r,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1};$.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};$.prototype.forEach=function(e){Me.forEach(this.handlers,function(a){a!==null&&e(a)})};var Ie=$,Je=p,ze=function(e,r){Je.forEach(e,function(n,u){u!==r&&u.toUpperCase()===r.toUpperCase()&&(e[r]=n,delete e[u])})},me=function(e,r,a,n,u){return e.config=r,a&&(e.code=a),e.request=n,e.response=u,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e},Ve=me,ve=function(e,r,a,n,u){var s=new Error(e);return Ve(s,r,a,n,u)},We=ve,Ge=function(e,r,a){var n=a.config.validateStatus;!a.status||!n||n(a.status)?e(a):r(We("Request failed with status code "+a.status,a.config,null,a.request,a))},T=p,Xe=T.isStandardBrowserEnv()?function(){return{write:function(r,a,n,u,s,o){var l=[];l.push(r+"="+encodeURIComponent(a)),T.isNumber(n)&&l.push("expires="+new Date(n).toGMTString()),T.isString(u)&&l.push("path="+u),T.isString(s)&&l.push("domain="+s),o===!0&&l.push("secure"),document.cookie=l.join("; ")},read:function(r){var a=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return a?decodeURIComponent(a[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),Ye=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)},Ke=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e},Qe=Ye,Ze=Ke,et=function(e,r){return e&&!Qe(r)?Ze(e,r):r},k=p,tt=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],rt=function(e){var r={},a,n,u;return e&&k.forEach(e.split(`
`),function(o){if(u=o.indexOf(":"),a=k.trim(o.substr(0,u)).toLowerCase(),n=k.trim(o.substr(u+1)),a){if(r[a]&&tt.indexOf(a)>=0)return;a==="set-cookie"?r[a]=(r[a]?r[a]:[]).concat([n]):r[a]=r[a]?r[a]+", "+n:n}}),r},te=p,nt=te.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),a;function n(u){var s=u;return e&&(r.setAttribute("href",s),s=r.href),r.setAttribute("href",s),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return a=n(window.location.href),function(s){var o=te.isString(s)?n(s):s;return o.protocol===a.protocol&&o.host===a.host}}():function(){return function(){return!0}}();function X(t){this.message=t}X.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};X.prototype.__CANCEL__=!0;var P=X,g=p,at=Ge,ut=Xe,st=pe,it=et,ot=rt,lt=nt,_=ve,ct=L,ft=P,re=function(e){return new Promise(function(a,n){var u=e.data,s=e.headers,o=e.responseType,l;function v(){e.cancelToken&&e.cancelToken.unsubscribe(l),e.signal&&e.signal.removeEventListener("abort",l)}g.isFormData(u)&&delete s["Content-Type"];var i=new XMLHttpRequest;if(e.auth){var c=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.Authorization="Basic "+btoa(c+":"+d)}var S=it(e.baseURL,e.url);i.open(e.method.toUpperCase(),st(S,e.params,e.paramsSerializer),!0),i.timeout=e.timeout;function Q(){if(!!i){var m="getAllResponseHeaders"in i?ot(i.getAllResponseHeaders()):null,w=!o||o==="text"||o==="json"?i.responseText:i.response,y={data:w,status:i.status,statusText:i.statusText,headers:m,config:e,request:i};at(function(q){a(q),v()},function(q){n(q),v()},y),i=null}}if("onloadend"in i?i.onloadend=Q:i.onreadystatechange=function(){!i||i.readyState!==4||i.status===0&&!(i.responseURL&&i.responseURL.indexOf("file:")===0)||setTimeout(Q)},i.onabort=function(){!i||(n(_("Request aborted",e,"ECONNABORTED",i)),i=null)},i.onerror=function(){n(_("Network Error",e,null,i)),i=null},i.ontimeout=function(){var w=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",y=e.transitional||ct.transitional;e.timeoutErrorMessage&&(w=e.timeoutErrorMessage),n(_(w,e,y.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",i)),i=null},g.isStandardBrowserEnv()){var Z=(e.withCredentials||lt(S))&&e.xsrfCookieName?ut.read(e.xsrfCookieName):void 0;Z&&(s[e.xsrfHeaderName]=Z)}"setRequestHeader"in i&&g.forEach(s,function(w,y){typeof u=="undefined"&&y.toLowerCase()==="content-type"?delete s[y]:i.setRequestHeader(y,w)}),g.isUndefined(e.withCredentials)||(i.withCredentials=!!e.withCredentials),o&&o!=="json"&&(i.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&i.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&i.upload&&i.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(l=function(m){!i||(n(!m||m&&m.type?new ft("canceled"):m),i.abort(),i=null)},e.cancelToken&&e.cancelToken.subscribe(l),e.signal&&(e.signal.aborted?l():e.signal.addEventListener("abort",l))),u||(u=null),i.send(u)})},f=p,ne=ze,dt=me,ht={"Content-Type":"application/x-www-form-urlencoded"};function ae(t,e){!f.isUndefined(t)&&f.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function pt(){var t;return(typeof XMLHttpRequest!="undefined"||typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]")&&(t=re),t}function mt(t,e,r){if(f.isString(t))try{return(e||JSON.parse)(t),f.trim(t)}catch(a){if(a.name!=="SyntaxError")throw a}return(r||JSON.stringify)(t)}var N={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:pt(),transformRequest:[function(e,r){return ne(r,"Accept"),ne(r,"Content-Type"),f.isFormData(e)||f.isArrayBuffer(e)||f.isBuffer(e)||f.isStream(e)||f.isFile(e)||f.isBlob(e)?e:f.isArrayBufferView(e)?e.buffer:f.isURLSearchParams(e)?(ae(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):f.isObject(e)||r&&r["Content-Type"]==="application/json"?(ae(r,"application/json"),mt(e)):e}],transformResponse:[function(e){var r=this.transitional||N.transitional,a=r&&r.silentJSONParsing,n=r&&r.forcedJSONParsing,u=!a&&this.responseType==="json";if(u||n&&f.isString(e)&&e.length)try{return JSON.parse(e)}catch(s){if(u)throw s.name==="SyntaxError"?dt(s,this,"E_JSON_PARSE"):s}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};f.forEach(["delete","get","head"],function(e){N.headers[e]={}});f.forEach(["post","put","patch"],function(e){N.headers[e]=f.merge(ht)});var L=N,vt=p,Et=L,yt=function(e,r,a){var n=this||Et;return vt.forEach(a,function(s){e=s.call(n,e,r)}),e},Ee=function(e){return!!(e&&e.__CANCEL__)},ue=p,H=yt,Ft=Ee,wt=L,bt=P;function M(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new bt("canceled")}var Ct=function(e){M(e),e.headers=e.headers||{},e.data=H.call(e,e.data,e.headers,e.transformRequest),e.headers=ue.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),ue.forEach(["delete","get","head","post","put","patch","common"],function(n){delete e.headers[n]});var r=e.adapter||wt.adapter;return r(e).then(function(n){return M(e),n.data=H.call(e,n.data,n.headers,e.transformResponse),n},function(n){return Ft(n)||(M(e),n&&n.response&&(n.response.data=H.call(e,n.response.data,n.response.headers,e.transformResponse))),Promise.reject(n)})},h=p,ye=function(e,r){r=r||{};var a={};function n(i,c){return h.isPlainObject(i)&&h.isPlainObject(c)?h.merge(i,c):h.isPlainObject(c)?h.merge({},c):h.isArray(c)?c.slice():c}function u(i){if(h.isUndefined(r[i])){if(!h.isUndefined(e[i]))return n(void 0,e[i])}else return n(e[i],r[i])}function s(i){if(!h.isUndefined(r[i]))return n(void 0,r[i])}function o(i){if(h.isUndefined(r[i])){if(!h.isUndefined(e[i]))return n(void 0,e[i])}else return n(void 0,r[i])}function l(i){if(i in r)return n(e[i],r[i]);if(i in e)return n(void 0,e[i])}var v={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l};return h.forEach(Object.keys(e).concat(Object.keys(r)),function(c){var d=v[c]||u,S=d(c);h.isUndefined(S)&&d!==l||(a[c]=S)}),a},Fe={version:"0.23.0"},At=Fe.version,Y={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){Y[t]=function(a){return typeof a===t||"a"+(e<1?"n ":" ")+t}});var se={};Y.transitional=function(e,r,a){function n(u,s){return"[Axios v"+At+"] Transitional option '"+u+"'"+s+(a?". "+a:"")}return function(u,s,o){if(e===!1)throw new Error(n(s," has been removed"+(r?" in "+r:"")));return r&&!se[s]&&(se[s]=!0,console.warn(n(s," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(u,s,o):!0}};function St(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var a=Object.keys(t),n=a.length;n-- >0;){var u=a[n],s=e[u];if(s){var o=t[u],l=o===void 0||s(o,u,t);if(l!==!0)throw new TypeError("option "+u+" must be "+l);continue}if(r!==!0)throw Error("Unknown option "+u)}}var Bt={assertOptions:St,validators:Y},we=p,xt=pe,ie=Ie,oe=Ct,j=ye,be=Bt,C=be.validators;function D(t){this.defaults=t,this.interceptors={request:new ie,response:new ie}}D.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=j(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&be.assertOptions(r,{silentJSONParsing:C.transitional(C.boolean),forcedJSONParsing:C.transitional(C.boolean),clarifyTimeoutError:C.transitional(C.boolean)},!1);var a=[],n=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(n=n&&d.synchronous,a.unshift(d.fulfilled,d.rejected))});var u=[];this.interceptors.response.forEach(function(d){u.push(d.fulfilled,d.rejected)});var s;if(!n){var o=[oe,void 0];for(Array.prototype.unshift.apply(o,a),o=o.concat(u),s=Promise.resolve(e);o.length;)s=s.then(o.shift(),o.shift());return s}for(var l=e;a.length;){var v=a.shift(),i=a.shift();try{l=v(l)}catch(c){i(c);break}}try{s=oe(l)}catch(c){return Promise.reject(c)}for(;u.length;)s=s.then(u.shift(),u.shift());return s};D.prototype.getUri=function(e){return e=j(this.defaults,e),xt(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};we.forEach(["delete","get","head","options"],function(e){D.prototype[e]=function(r,a){return this.request(j(a||{},{method:e,url:r,data:(a||{}).data}))}});we.forEach(["post","put","patch"],function(e){D.prototype[e]=function(r,a,n){return this.request(j(n||{},{method:e,url:r,data:a}))}});var Rt=D,Dt=P;function A(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(n){e=n});var r=this;this.promise.then(function(a){if(!!r._listeners){var n,u=r._listeners.length;for(n=0;n<u;n++)r._listeners[n](a);r._listeners=null}}),this.promise.then=function(a){var n,u=new Promise(function(s){r.subscribe(s),n=s}).then(a);return u.cancel=function(){r.unsubscribe(n)},u},t(function(n){r.reason||(r.reason=new Dt(n),e(r.reason))})}A.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};A.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};A.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}};A.source=function(){var e,r=new A(function(n){e=n});return{token:r,cancel:e}};var Tt=A,gt=function(e){return function(a){return e.apply(null,a)}},Ot=function(e){return typeof e=="object"&&e.isAxiosError===!0},le=p,Ut=fe,U=Rt,$t=ye,Pt=L;function Ce(t){var e=new U(t),r=Ut(U.prototype.request,e);return le.extend(r,U.prototype,e),le.extend(r,e),r.create=function(n){return Ce($t(t,n))},r}var E=Ce(Pt);E.Axios=U;E.Cancel=P;E.CancelToken=Tt;E.isCancel=Ee;E.VERSION=Fe.version;E.all=function(e){return Promise.all(e)};E.spread=gt;E.isAxiosError=Ot;V.exports=E;V.exports.default=E;var K=V.exports,Nt={exportDetails:"/exportDetails",commonUpload:"/upload",PageCustomService:"/second/hwydystoreadmin/storeUser/name/one",PageCustomService2:"/hwydystoreadmin/storeUser/name/one",resetPassword:"/resetPassword",searchURL:"https://serpapi.com/search.json",itemFilterURL:"http://106.52.238.44:8080/api"};let x="";switch("production"){case"development":x="/dev";break;case"test":x="/test";break;case"production":x="/production";break;default:x="/dev";break}var Lt=x;const jt={200:"\u670D\u52A1\u5668\u6210\u529F\u8FD4\u56DE\u8BF7\u6C42\u7684\u6570\u636E\u3002",201:"\u65B0\u5EFA\u6216\u4FEE\u6539\u6570\u636E\u6210\u529F\u3002",202:"\u4E00\u4E2A\u8BF7\u6C42\u5DF2\u7ECF\u8FDB\u5165\u540E\u53F0\u6392\u961F\uFF08\u5F02\u6B65\u4EFB\u52A1\uFF09\u3002",204:"\u5220\u9664\u6570\u636E\u6210\u529F\u3002",400:"\u53D1\u51FA\u7684\u8BF7\u6C42\u6709\u9519\u8BEF\uFF0C\u670D\u52A1\u5668\u6CA1\u6709\u8FDB\u884C\u65B0\u5EFA\u6216\u4FEE\u6539\u6570\u636E\u7684\u64CD\u4F5C\u3002",401:"\u7528\u6237\u6CA1\u6709\u6743\u9650\uFF08\u4EE4\u724C\u3001\u7528\u6237\u540D\u3001\u5BC6\u7801\u9519\u8BEF\uFF09\u3002",403:"\u7528\u6237\u5F97\u5230\u6388\u6743\uFF0C\u4F46\u662F\u8BBF\u95EE\u662F\u88AB\u7981\u6B62\u7684\u3002",404:"\u53D1\u51FA\u7684\u8BF7\u6C42\u9488\u5BF9\u7684\u662F\u4E0D\u5B58\u5728\u7684\u8BB0\u5F55\uFF0C\u670D\u52A1\u5668\u6CA1\u6709\u8FDB\u884C\u64CD\u4F5C\u3002",406:"\u8BF7\u6C42\u7684\u683C\u5F0F\u4E0D\u53EF\u5F97\u3002",410:"\u8BF7\u6C42\u7684\u8D44\u6E90\u88AB\u6C38\u4E45\u5220\u9664\uFF0C\u4E14\u4E0D\u4F1A\u518D\u5F97\u5230\u7684\u3002",422:"\u5F53\u521B\u5EFA\u4E00\u4E2A\u5BF9\u8C61\u65F6\uFF0C\u53D1\u751F\u4E00\u4E2A\u9A8C\u8BC1\u9519\u8BEF\u3002",500:"\u670D\u52A1\u5668\u53D1\u751F\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u670D\u52A1\u5668\u3002",502:"\u7F51\u5173\u9519\u8BEF\u3002",503:"\u670D\u52A1\u4E0D\u53EF\u7528\uFF0C\u670D\u52A1\u5668\u6682\u65F6\u8FC7\u8F7D\u6216\u7EF4\u62A4\u3002",504:"\u7F51\u5173\u8D85\u65F6\u3002"},ce={toast:101,loginFail:10086};let R=K.create({baseURL:Lt,timeout:2e4,responseType:"json"});const qt=t=>{if(t&&(t==null?void 0:t.status)){const e=jt[t.status]||t.statusText,{status:r,url:a}=t;(t==null?void 0:t.status)===401?setTimeout(()=>{window.sessionStorage.clear(),window.location.href=`${window.location.origin}/login`},1e3):console.log(`\u8BF7\u6C42\u9519\u8BEF ${r}: ${a},${e}`)}return t},z=[];R.interceptors.request.use(t=>{const e=t;return e.cancelToken=new K.CancelToken(r=>{z.push(r)}),e},()=>{});window.$cancelRequest=()=>{z.forEach((t,e)=>{t("cancel"),delete z[e]})};const Ae=[{url:Nt.exportDetails,type:"export",export:1}];R.interceptors.request.use(t=>{var a;const e=Ae.find(n=>t.url.includes(n.url)),r=((a=t[t.method.toUpperCase()==="GET"?"params":"data"])==null?void 0:a.export)||0;return e&&r===1&&(t.responseType="blob"),t},t=>{console.log(t)});R.interceptors.response.use(async t=>{var n,u;const e=t.config,r=Ae.find(s=>e.url.includes(s.url)),a=((n=e[e.method.toUpperCase()==="GET"?"params":"data"])==null?void 0:n.export)||0;if(r&&a===1&&t.status===200){const s=new Blob([t.data],{type:"application/vnd.ms-excel"});let o=((u=e[e.method.toUpperCase()==="GET"?"params":"data"])==null?void 0:u.fileName)||new Date().Format("YYYY-MM-DD hh:mm:ss");const l=document.createElement("a");return l.download=o,l.style.display="none",l.href=URL.createObjectURL(s),document.body.appendChild(l),l.click(),URL.revokeObjectURL(l.href),document.body.removeChild(l),s}if(t.status===200)try{t.data.code&&t.data.code!==200&&(t.data.code===ce.loginFail&&setTimeout(()=>{window.sessionStorage.clear(),window.location.href=`${window.location.origin}/login`},1e3),t.data.code===ce.toast?alert(t.data.errorMsg):console.log(t.data.errorMsg))}catch{console.log("\u63A5\u53E3\u8BF7\u6C42\u5931\u8D25")}else qt(t);return t.data});K.defaults.withCredentials=!0;const B=(t,e)=>{let r=Be.get("token"),a=null;return t!=="FILE"?(t==="POST"||t==="PUT"?a={data:JSON.stringify(e.data)}:(t==="GET"||t==="DELETE")&&(a={params:e.data}),new Promise((n,u)=>{R(e.url,{method:t,...a,headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:r||"Basic aHc6aHc=","with-credentials":!0,...e.header}}).then(s=>{n(s)}).catch(s=>{console.log(s,"\u5F02\u5E38")})})):new Promise((n,u)=>{R(e.url,{method:"post",data:e.data,requestType:"form",headers:{Authorization:r||"Basic aHc6aHc="}}).then(s=>{n(s)}).catch(s=>{console.log(s,"\u5F02\u5E38")})})};var _t={post:t=>B("POST",t),get:t=>B("GET",t),delete:t=>B("DELETE",t),put:t=>B("PUT",t),file:t=>B("FILE",t)};export{K as a,Nt as b,_t as r};