import{bU as O,bV as S,bW as P,bX as j,bY as L,bP as b}from"./index.f859bf4e.js";import{v as N}from"./el-input.f35758e8.js";var o=O,g=Object.prototype.hasOwnProperty,x=Array.isArray,s={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:o.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},E=function(i){return i.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},v=function(i,e){return i&&typeof i=="string"&&e.comma&&i.indexOf(",")>-1?i.split(","):i},A="utf8=%26%2310003%3B",D="utf8=%E2%9C%93",H=function(e,r){var n={},c=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,u=r.parameterLimit===1/0?void 0:r.parameterLimit,t=c.split(r.delimiter,u),l=-1,a,f=r.charset;if(r.charsetSentinel)for(a=0;a<t.length;++a)t[a].indexOf("utf8=")===0&&(t[a]===D?f="utf-8":t[a]===A&&(f="iso-8859-1"),l=a,a=t.length);for(a=0;a<t.length;++a)if(a!==l){var d=t[a],p=d.indexOf("]="),h=p===-1?d.indexOf("="):p+1,y,m;h===-1?(y=r.decoder(d,s.decoder,f,"key"),m=r.strictNullHandling?null:""):(y=r.decoder(d.slice(0,h),s.decoder,f,"key"),m=o.maybeMap(v(d.slice(h+1),r),function(w){return r.decoder(w,s.decoder,f,"value")})),m&&r.interpretNumericEntities&&f==="iso-8859-1"&&(m=E(m)),d.indexOf("[]=")>-1&&(m=x(m)?[m]:m),g.call(n,y)?n[y]=o.combine(n[y],m):n[y]=m}return n},C=function(i,e,r,n){for(var c=n?e:v(e,r),u=i.length-1;u>=0;--u){var t,l=i[u];if(l==="[]"&&r.parseArrays)t=[].concat(c);else{t=r.plainObjects?Object.create(null):{};var a=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,f=parseInt(a,10);!r.parseArrays&&a===""?t={0:c}:!isNaN(f)&&l!==a&&String(f)===a&&f>=0&&r.parseArrays&&f<=r.arrayLimit?(t=[],t[f]=c):a!=="__proto__"&&(t[a]=c)}c=t}return c},Q=function(e,r,n,c){if(!!e){var u=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,t=/(\[[^[\]]*])/,l=/(\[[^[\]]*])/g,a=n.depth>0&&t.exec(u),f=a?u.slice(0,a.index):u,d=[];if(f){if(!n.plainObjects&&g.call(Object.prototype,f)&&!n.allowPrototypes)return;d.push(f)}for(var p=0;n.depth>0&&(a=l.exec(u))!==null&&p<n.depth;){if(p+=1,!n.plainObjects&&g.call(Object.prototype,a[1].slice(1,-1))&&!n.allowPrototypes)return;d.push(a[1])}return a&&d.push("["+u.slice(a.index)+"]"),C(d,r,n,c)}},T=function(e){if(!e)return s;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=typeof e.charset>"u"?s.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?s.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:s.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:s.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:s.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:s.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:s.comma,decoder:typeof e.decoder=="function"?e.decoder:s.decoder,delimiter:typeof e.delimiter=="string"||o.isRegExp(e.delimiter)?e.delimiter:s.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:s.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:s.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:s.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:s.strictNullHandling}},_=function(i,e){var r=T(e);if(i===""||i===null||typeof i>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof i=="string"?H(i,r):i,c=r.plainObjects?Object.create(null):{},u=Object.keys(n),t=0;t<u.length;++t){var l=u[t],a=Q(l,n[l],r,typeof i=="string");c=o.merge(c,a,r)}return r.allowSparse===!0?c:o.compact(c)},$=S,I=_,U=P,V={formats:U,parse:I,stringify:$};async function M({url:i,method:e="POST",params:r,useQS:n=!1,callback:c}){if(!i)return!1;const u=N.service({lock:!0,text:"\u8BF7\u7A0D\u5019",background:"rgba(0, 0, 0, 0.7)"});let t={baseURL:j.backendHost,url:i,method:e,withCredentials:!0};return e.toUpperCase()=="POST"?(t.headers={"content-type":"application/x-www-form-urlencoded"},t.data=n?V.stringify(r):r):e.toUpperCase()=="GET"&&(t.params=r),L(t).then(l=>{let a=l.data;if(!a.success)return b.error((a==null?void 0:a.msg)||"\u670D\u52A1\u5668\u9519\u8BEF"),null;let f=a.data;return typeof c=="function"&&c(f),f}).catch(l=>(console.error(l),b.error(l.message),!1)).finally(()=>{u.close()})}export{M as s};
