@rainte/js 0.0.35 → 0.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +9 -5
- package/dist/index.umd.cjs +1 -1
- package/dist/types/src/storage/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5667,10 +5667,12 @@ class Xi {
|
|
|
5667
5667
|
this.storage = i;
|
|
5668
5668
|
}
|
|
5669
5669
|
getRaw(i, u = null) {
|
|
5670
|
-
|
|
5670
|
+
var a;
|
|
5671
|
+
return ((a = this.storage) == null ? void 0 : a.getItem(i)) ?? u;
|
|
5671
5672
|
}
|
|
5672
5673
|
setRaw(i, u) {
|
|
5673
|
-
|
|
5674
|
+
var a;
|
|
5675
|
+
(a = this.storage) == null || a.setItem(i, u);
|
|
5674
5676
|
}
|
|
5675
5677
|
get(i, u = null) {
|
|
5676
5678
|
const a = this.getRaw(i);
|
|
@@ -5680,13 +5682,15 @@ class Xi {
|
|
|
5680
5682
|
this.setRaw(i, Jn.stringify(u));
|
|
5681
5683
|
}
|
|
5682
5684
|
del(i) {
|
|
5683
|
-
|
|
5685
|
+
var u;
|
|
5686
|
+
(u = this.storage) == null || u.removeItem(i);
|
|
5684
5687
|
}
|
|
5685
5688
|
clear() {
|
|
5686
|
-
|
|
5689
|
+
var i;
|
|
5690
|
+
(i = this.storage) == null || i.clear();
|
|
5687
5691
|
}
|
|
5688
5692
|
}
|
|
5689
|
-
const no = new Xi(localStorage), Qi = new Xi(sessionStorage), Nu = {
|
|
5693
|
+
const no = new Xi(typeof localStorage > "u" ? void 0 : localStorage), Qi = new Xi(typeof sessionStorage > "u" ? void 0 : sessionStorage), Nu = {
|
|
5690
5694
|
local: no,
|
|
5691
5695
|
session: Qi
|
|
5692
5696
|
}, Sc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
package/dist/index.umd.cjs
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(o){return o instanceof this?o:new this(o)}static concat(o,...u){const a=new this(o);return u.forEach(l=>a.set(l)),a}static accessor(o){const a=(this[eo]=this[eo]={accessors:{}}).accessors,l=this.prototype;function d(h){const x=Ut(h);a[x]||(Fa(l,h),a[x]=!0)}return A.isArray(o)?o.forEach(d):d(o),this}};Ye.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),A.reduceDescriptors(Ye.prototype,({value:r},o)=>{let u=o[0].toUpperCase()+o.slice(1);return{get:()=>r,set(a){this[u]=a}}}),A.freezeMethods(Ye);function vr(r,o){const u=this||Lt,a=o||u,l=Ye.from(a.headers);let d=a.data;return A.forEach(r,function(x){d=x.call(u,d,l.normalize(),o?o.status:void 0)}),l.normalize(),d}function to(r){return!!(r&&r.__CANCEL__)}function At(r,o,u){pe.call(this,r??"canceled",pe.ERR_CANCELED,o,u),this.name="CanceledError"}A.inherits(At,pe,{__CANCEL__:!0});function no(r,o,u){const a=u.config.validateStatus;!u.status||!a||a(u.status)?r(u):o(new pe("Request failed with status code "+u.status,[pe.ERR_BAD_REQUEST,pe.ERR_BAD_RESPONSE][Math.floor(u.status/100)-4],u.config,u.request,u))}function qa(r){const o=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return o&&o[1]||""}function Ba(r,o){r=r||10;const u=new Array(r),a=new Array(r);let l=0,d=0,h;return o=o!==void 0?o:1e3,function($){const C=Date.now(),D=a[d];h||(h=C),u[l]=$,a[l]=C;let M=d,ae=0;for(;M!==l;)ae+=u[M++],M=M%r;if(l=(l+1)%r,l===d&&(d=(d+1)%r),C-h<o)return;const ue=D&&C-D;return ue?Math.round(ae*1e3/ue):void 0}}function Ka(r,o){let u=0,a=1e3/o,l,d;const h=(C,D=Date.now())=>{u=D,l=null,d&&(clearTimeout(d),d=null),r.apply(null,C)};return[(...C)=>{const D=Date.now(),M=D-u;M>=a?h(C,D):(l=C,d||(d=setTimeout(()=>{d=null,h(l)},a-M)))},()=>l&&h(l)]}const kn=(r,o,u=3)=>{let a=0;const l=Ba(50,250);return Ka(d=>{const h=d.loaded,x=d.lengthComputable?d.total:void 0,$=h-a,C=l($),D=h<=x;a=h;const M={loaded:h,total:x,progress:x?h/x:void 0,bytes:$,rate:C||void 0,estimated:C&&x&&D?(x-h)/C:void 0,event:d,lengthComputable:x!=null,[o?"download":"upload"]:!0};r(M)},u)},ro=(r,o)=>{const u=r!=null;return[a=>o[0]({lengthComputable:u,total:r,loaded:a}),o[1]]},io=r=>(...o)=>A.asap(()=>r(...o)),Ia=qe.hasStandardBrowserEnv?((r,o)=>u=>(u=new URL(u,qe.origin),r.protocol===u.protocol&&r.host===u.host&&(o||r.port===u.port)))(new URL(qe.origin),qe.navigator&&/(msie|trident)/i.test(qe.navigator.userAgent)):()=>!0,La=qe.hasStandardBrowserEnv?{write(r,o,u,a,l,d){const h=[r+"="+encodeURIComponent(o)];A.isNumber(u)&&h.push("expires="+new Date(u).toGMTString()),A.isString(a)&&h.push("path="+a),A.isString(l)&&h.push("domain="+l),d===!0&&h.push("secure"),document.cookie=h.join("; ")},read(r){const o=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return o?decodeURIComponent(o[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Ua(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function Ya(r,o){return o?r.replace(/\/?\/$/,"")+"/"+o.replace(/^\/+/,""):r}function oo(r,o,u){let a=!Ua(o);return r&&(a||u==!1)?Ya(r,o):o}const so=r=>r instanceof Ye?{...r}:r;function yt(r,o){o=o||{};const u={};function a(C,D,M,ae){return A.isPlainObject(C)&&A.isPlainObject(D)?A.merge.call({caseless:ae},C,D):A.isPlainObject(D)?A.merge({},D):A.isArray(D)?D.slice():D}function l(C,D,M,ae){if(A.isUndefined(D)){if(!A.isUndefined(C))return a(void 0,C,M,ae)}else return a(C,D,M,ae)}function d(C,D){if(!A.isUndefined(D))return a(void 0,D)}function h(C,D){if(A.isUndefined(D)){if(!A.isUndefined(C))return a(void 0,C)}else return a(void 0,D)}function x(C,D,M){if(M in o)return a(C,D);if(M in r)return a(void 0,C)}const $={url:d,method:d,data:d,baseURL:h,transformRequest:h,transformResponse:h,paramsSerializer:h,timeout:h,timeoutMessage:h,withCredentials:h,withXSRFToken:h,adapter:h,responseType:h,xsrfCookieName:h,xsrfHeaderName:h,onUploadProgress:h,onDownloadProgress:h,decompress:h,maxContentLength:h,maxBodyLength:h,beforeRedirect:h,transport:h,httpAgent:h,httpsAgent:h,cancelToken:h,socketPath:h,responseEncoding:h,validateStatus:x,headers:(C,D,M)=>l(so(C),so(D),M,!0)};return A.forEach(Object.keys(Object.assign({},r,o)),function(D){const M=$[D]||l,ae=M(r[D],o[D],D);A.isUndefined(ae)&&M!==x||(u[D]=ae)}),u}const ao=r=>{const o=yt({},r);let{data:u,withXSRFToken:a,xsrfHeaderName:l,xsrfCookieName:d,headers:h,auth:x}=o;o.headers=h=Ye.from(h),o.url=Gi(oo(o.baseURL,o.url,o.allowAbsoluteUrls),r.params,r.paramsSerializer),x&&h.set("Authorization","Basic "+btoa((x.username||"")+":"+(x.password?unescape(encodeURIComponent(x.password)):"")));let $;if(A.isFormData(u)){if(qe.hasStandardBrowserEnv||qe.hasStandardBrowserWebWorkerEnv)h.setContentType(void 0);else if(($=h.getContentType())!==!1){const[C,...D]=$?$.split(";").map(M=>M.trim()).filter(Boolean):[];h.setContentType([C||"multipart/form-data",...D].join("; "))}}if(qe.hasStandardBrowserEnv&&(a&&A.isFunction(a)&&(a=a(o)),a||a!==!1&&Ia(o.url))){const C=l&&d&&La.read(d);C&&h.set(l,C)}return o},Ha=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(u,a){const l=ao(r);let d=l.data;const h=Ye.from(l.headers).normalize();let{responseType:x,onUploadProgress:$,onDownloadProgress:C}=l,D,M,ae,ue,N;function j(){ue&&ue(),N&&N(),l.cancelToken&&l.cancelToken.unsubscribe(D),l.signal&&l.signal.removeEventListener("abort",D)}let E=new XMLHttpRequest;E.open(l.method.toUpperCase(),l.url,!0),E.timeout=l.timeout;function J(){if(!E)return;const G=Ye.from("getAllResponseHeaders"in E&&E.getAllResponseHeaders()),fe={data:!x||x==="text"||x==="json"?E.responseText:E.response,status:E.status,statusText:E.statusText,headers:G,config:r,request:E};no(function(U){u(U),j()},function(U){a(U),j()},fe),E=null}"onloadend"in E?E.onloadend=J:E.onreadystatechange=function(){!E||E.readyState!==4||E.status===0&&!(E.responseURL&&E.responseURL.indexOf("file:")===0)||setTimeout(J)},E.onabort=function(){E&&(a(new pe("Request aborted",pe.ECONNABORTED,r,E)),E=null)},E.onerror=function(){a(new pe("Network Error",pe.ERR_NETWORK,r,E)),E=null},E.ontimeout=function(){let _e=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded";const fe=l.transitional||Qi;l.timeoutErrorMessage&&(_e=l.timeoutErrorMessage),a(new pe(_e,fe.clarifyTimeoutError?pe.ETIMEDOUT:pe.ECONNABORTED,r,E)),E=null},d===void 0&&h.setContentType(null),"setRequestHeader"in E&&A.forEach(h.toJSON(),function(_e,fe){E.setRequestHeader(fe,_e)}),A.isUndefined(l.withCredentials)||(E.withCredentials=!!l.withCredentials),x&&x!=="json"&&(E.responseType=l.responseType),C&&([ae,N]=kn(C,!0),E.addEventListener("progress",ae)),$&&E.upload&&([M,ue]=kn($),E.upload.addEventListener("progress",M),E.upload.addEventListener("loadend",ue)),(l.cancelToken||l.signal)&&(D=G=>{E&&(a(!G||G.type?new At(null,r,E):G),E.abort(),E=null)},l.cancelToken&&l.cancelToken.subscribe(D),l.signal&&(l.signal.aborted?D():l.signal.addEventListener("abort",D)));const re=qa(l.url);if(re&&qe.protocols.indexOf(re)===-1){a(new pe("Unsupported protocol "+re+":",pe.ERR_BAD_REQUEST,r));return}E.send(d||null)})},za=(r,o)=>{const{length:u}=r=r?r.filter(Boolean):[];if(o||u){let a=new AbortController,l;const d=function(C){if(!l){l=!0,x();const D=C instanceof Error?C:this.reason;a.abort(D instanceof pe?D:new At(D instanceof Error?D.message:D))}};let h=o&&setTimeout(()=>{h=null,d(new pe(`timeout ${o} of ms exceeded`,pe.ETIMEDOUT))},o);const x=()=>{r&&(h&&clearTimeout(h),h=null,r.forEach(C=>{C.unsubscribe?C.unsubscribe(d):C.removeEventListener("abort",d)}),r=null)};r.forEach(C=>C.addEventListener("abort",d));const{signal:$}=a;return $.unsubscribe=()=>A.asap(x),$}},Va=function*(r,o){let u=r.byteLength;if(u<o){yield r;return}let a=0,l;for(;a<u;)l=a+o,yield r.slice(a,l),a=l},Wa=async function*(r,o){for await(const u of Ja(r))yield*Va(u,o)},Ja=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const o=r.getReader();try{for(;;){const{done:u,value:a}=await o.read();if(u)break;yield a}}finally{await o.cancel()}},uo=(r,o,u,a)=>{const l=Wa(r,o);let d=0,h,x=$=>{h||(h=!0,a&&a($))};return new ReadableStream({async pull($){try{const{done:C,value:D}=await l.next();if(C){x(),$.close();return}let M=D.byteLength;if(u){let ae=d+=M;u(ae)}$.enqueue(new Uint8Array(D))}catch(C){throw x(C),C}},cancel($){return x($),l.return()}},{highWaterMark:2})},Tn=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",co=Tn&&typeof ReadableStream=="function",Ga=Tn&&(typeof TextEncoder=="function"?(r=>o=>r.encode(o))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),lo=(r,...o)=>{try{return!!r(...o)}catch{return!1}},Xa=co&&lo(()=>{let r=!1;const o=new Request(qe.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!o}),fo=64*1024,gr=co&&lo(()=>A.isReadableStream(new Response("").body)),Rn={stream:gr&&(r=>r.body)};Tn&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(o=>{!Rn[o]&&(Rn[o]=A.isFunction(r[o])?u=>u[o]():(u,a)=>{throw new pe(`Response type '${o}' is not supported`,pe.ERR_NOT_SUPPORT,a)})})})(new Response);const Qa=async r=>{if(r==null)return 0;if(A.isBlob(r))return r.size;if(A.isSpecCompliantForm(r))return(await new Request(qe.origin,{method:"POST",body:r}).arrayBuffer()).byteLength;if(A.isArrayBufferView(r)||A.isArrayBuffer(r))return r.byteLength;if(A.isURLSearchParams(r)&&(r=r+""),A.isString(r))return(await Ga(r)).byteLength},Za=async(r,o)=>{const u=A.toFiniteNumber(r.getContentLength());return u??Qa(o)},br={http:wa,xhr:Ha,fetch:Tn&&(async r=>{let{url:o,method:u,data:a,signal:l,cancelToken:d,timeout:h,onDownloadProgress:x,onUploadProgress:$,responseType:C,headers:D,withCredentials:M="same-origin",fetchOptions:ae}=ao(r);C=C?(C+"").toLowerCase():"text";let ue=za([l,d&&d.toAbortSignal()],h),N;const j=ue&&ue.unsubscribe&&(()=>{ue.unsubscribe()});let E;try{if($&&Xa&&u!=="get"&&u!=="head"&&(E=await Za(D,a))!==0){let fe=new Request(o,{method:"POST",body:a,duplex:"half"}),te;if(A.isFormData(a)&&(te=fe.headers.get("content-type"))&&D.setContentType(te),fe.body){const[U,K]=ro(E,kn(io($)));a=uo(fe.body,fo,U,K)}}A.isString(M)||(M=M?"include":"omit");const J="credentials"in Request.prototype;N=new Request(o,{...ae,signal:ue,method:u.toUpperCase(),headers:D.normalize().toJSON(),body:a,duplex:"half",credentials:J?M:void 0});let re=await fetch(N);const G=gr&&(C==="stream"||C==="response");if(gr&&(x||G&&j)){const fe={};["status","statusText","headers"].forEach(ce=>{fe[ce]=re[ce]});const te=A.toFiniteNumber(re.headers.get("content-length")),[U,K]=x&&ro(te,kn(io(x),!0))||[];re=new Response(uo(re.body,fo,U,()=>{K&&K(),j&&j()}),fe)}C=C||"text";let _e=await Rn[A.findKey(Rn,C)||"text"](re,r);return!G&&j&&j(),await new Promise((fe,te)=>{no(fe,te,{data:_e,headers:Ye.from(re.headers),status:re.status,statusText:re.statusText,config:r,request:N})})}catch(J){throw j&&j(),J&&J.name==="TypeError"&&/fetch/i.test(J.message)?Object.assign(new pe("Network Error",pe.ERR_NETWORK,r,N),{cause:J.cause||J}):pe.from(J,J&&J.code,r,N)}})};A.forEach(br,(r,o)=>{if(r){try{Object.defineProperty(r,"name",{value:o})}catch{}Object.defineProperty(r,"adapterName",{value:o})}});const ho=r=>`- ${r}`,eu=r=>A.isFunction(r)||r===null||r===!1,po={getAdapter:r=>{r=A.isArray(r)?r:[r];const{length:o}=r;let u,a;const l={};for(let d=0;d<o;d++){u=r[d];let h;if(a=u,!eu(u)&&(a=br[(h=String(u)).toLowerCase()],a===void 0))throw new pe(`Unknown adapter '${h}'`);if(a)break;l[h||"#"+d]=a}if(!a){const d=Object.entries(l).map(([x,$])=>`adapter ${x} `+($===!1?"is not supported by the environment":"is not available in the build"));let h=o?d.length>1?`since :
|
|
6
6
|
`+d.map(ho).join(`
|
|
7
7
|
`):" "+ho(d[0]):"as no adapter specified";throw new pe("There is no suitable adapter to dispatch the request "+h,"ERR_NOT_SUPPORT")}return a},adapters:br};function wr(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new At(null,r)}function mo(r){return wr(r),r.headers=Ye.from(r.headers),r.data=vr.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),po.getAdapter(r.adapter||Lt.adapter)(r).then(function(a){return wr(r),a.data=vr.call(r,r.transformResponse,a),a.headers=Ye.from(a.headers),a},function(a){return to(a)||(wr(r),a&&a.response&&(a.response.data=vr.call(r,r.transformResponse,a.response),a.response.headers=Ye.from(a.response.headers))),Promise.reject(a)})}const yo="1.8.4",An={};["object","boolean","number","function","string","symbol"].forEach((r,o)=>{An[r]=function(a){return typeof a===r||"a"+(o<1?"n ":" ")+r}});const vo={};An.transitional=function(o,u,a){function l(d,h){return"[Axios v"+yo+"] Transitional option '"+d+"'"+h+(a?". "+a:"")}return(d,h,x)=>{if(o===!1)throw new pe(l(h," has been removed"+(u?" in "+u:"")),pe.ERR_DEPRECATED);return u&&!vo[h]&&(vo[h]=!0,console.warn(l(h," has been deprecated since v"+u+" and will be removed in the near future"))),o?o(d,h,x):!0}},An.spelling=function(o){return(u,a)=>(console.warn(`${a} is likely a misspelling of ${o}`),!0)};function tu(r,o,u){if(typeof r!="object")throw new pe("options must be an object",pe.ERR_BAD_OPTION_VALUE);const a=Object.keys(r);let l=a.length;for(;l-- >0;){const d=a[l],h=o[d];if(h){const x=r[d],$=x===void 0||h(x,d,r);if($!==!0)throw new pe("option "+d+" must be "+$,pe.ERR_BAD_OPTION_VALUE);continue}if(u!==!0)throw new pe("Unknown option "+d,pe.ERR_BAD_OPTION)}}const $n={assertOptions:tu,validators:An},tt=$n.validators;let vt=class{constructor(o){this.defaults=o,this.interceptors={request:new Xi,response:new Xi}}async request(o,u){try{return await this._request(o,u)}catch(a){if(a instanceof Error){let l={};Error.captureStackTrace?Error.captureStackTrace(l):l=new Error;const d=l.stack?l.stack.replace(/^.+\n/,""):"";try{a.stack?d&&!String(a.stack).endsWith(d.replace(/^.+\n.+\n/,""))&&(a.stack+=`
|
|
8
|
-
`+d):a.stack=d}catch{}}throw a}}_request(o,u){typeof o=="string"?(u=u||{},u.url=o):u=o||{},u=yt(this.defaults,u);const{transitional:a,paramsSerializer:l,headers:d}=u;a!==void 0&&$n.assertOptions(a,{silentJSONParsing:tt.transitional(tt.boolean),forcedJSONParsing:tt.transitional(tt.boolean),clarifyTimeoutError:tt.transitional(tt.boolean)},!1),l!=null&&(A.isFunction(l)?u.paramsSerializer={serialize:l}:$n.assertOptions(l,{encode:tt.function,serialize:tt.function},!0)),u.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?u.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:u.allowAbsoluteUrls=!0),$n.assertOptions(u,{baseUrl:tt.spelling("baseURL"),withXsrfToken:tt.spelling("withXSRFToken")},!0),u.method=(u.method||this.defaults.method||"get").toLowerCase();let h=d&&A.merge(d.common,d[u.method]);d&&A.forEach(["delete","get","head","post","put","patch","common"],N=>{delete d[N]}),u.headers=Ye.concat(h,d);const x=[];let $=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(u)===!1||($=$&&j.synchronous,x.unshift(j.fulfilled,j.rejected))});const C=[];this.interceptors.response.forEach(function(j){C.push(j.fulfilled,j.rejected)});let D,M=0,ae;if(!$){const N=[mo.bind(this),void 0];for(N.unshift.apply(N,x),N.push.apply(N,C),ae=N.length,D=Promise.resolve(u);M<ae;)D=D.then(N[M++],N[M++]);return D}ae=x.length;let ue=u;for(M=0;M<ae;){const N=x[M++],j=x[M++];try{ue=N(ue)}catch(E){j.call(this,E);break}}try{D=mo.call(this,ue)}catch(N){return Promise.reject(N)}for(M=0,ae=C.length;M<ae;)D=D.then(C[M++],C[M++]);return D}getUri(o){o=yt(this.defaults,o);const u=oo(o.baseURL,o.url,o.allowAbsoluteUrls);return Gi(u,o.params,o.paramsSerializer)}};A.forEach(["delete","get","head","options"],function(o){vt.prototype[o]=function(u,a){return this.request(yt(a||{},{method:o,url:u,data:(a||{}).data}))}}),A.forEach(["post","put","patch"],function(o){function u(a){return function(d,h,x){return this.request(yt(x||{},{method:o,headers:a?{"Content-Type":"multipart/form-data"}:{},url:d,data:h}))}}vt.prototype[o]=u(),vt.prototype[o+"Form"]=u(!0)});let nu=class as{constructor(o){if(typeof o!="function")throw new TypeError("executor must be a function.");let u;this.promise=new Promise(function(d){u=d});const a=this;this.promise.then(l=>{if(!a._listeners)return;let d=a._listeners.length;for(;d-- >0;)a._listeners[d](l);a._listeners=null}),this.promise.then=l=>{let d;const h=new Promise(x=>{a.subscribe(x),d=x}).then(l);return h.cancel=function(){a.unsubscribe(d)},h},o(function(d,h,x){a.reason||(a.reason=new At(d,h,x),u(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(o){if(this.reason){o(this.reason);return}this._listeners?this._listeners.push(o):this._listeners=[o]}unsubscribe(o){if(!this._listeners)return;const u=this._listeners.indexOf(o);u!==-1&&this._listeners.splice(u,1)}toAbortSignal(){const o=new AbortController,u=a=>{o.abort(a)};return this.subscribe(u),o.signal.unsubscribe=()=>this.unsubscribe(u),o.signal}static source(){let o;return{token:new as(function(l){o=l}),cancel:o}}};function ru(r){return function(u){return r.apply(null,u)}}function iu(r){return A.isObject(r)&&r.isAxiosError===!0}const _r={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(_r).forEach(([r,o])=>{_r[o]=r});function go(r){const o=new vt(r),u=Ni(vt.prototype.request,o);return A.extend(u,vt.prototype,o,{allOwnKeys:!0}),A.extend(u,o,null,{allOwnKeys:!0}),u.create=function(l){return go(yt(r,l))},u}const Re=go(Lt);Re.Axios=vt,Re.CanceledError=At,Re.CancelToken=nu,Re.isCancel=to,Re.VERSION=yo,Re.toFormData=On,Re.AxiosError=pe,Re.Cancel=Re.CanceledError,Re.all=function(o){return Promise.all(o)},Re.spread=ru,Re.isAxiosError=iu,Re.mergeConfig=yt,Re.AxiosHeaders=Ye,Re.formToJSON=r=>Zi(A.isHTMLForm(r)?new FormData(r):r),Re.getAdapter=po.getAdapter,Re.HttpStatusCode=_r,Re.default=Re;const{Axios:oc,AxiosError:sc,CanceledError:ac,isCancel:uc,CancelToken:cc,VERSION:lc,all:fc,Cancel:dc,isAxiosError:hc,spread:pc,toFormData:mc,AxiosHeaders:yc,HttpStatusCode:vc,formToJSON:gc,getAdapter:bc,mergeConfig:wc}=Re;class bo{constructor(o){oi(this,"storage");this.storage=o}getRaw(o,u=null){return
|
|
8
|
+
`+d):a.stack=d}catch{}}throw a}}_request(o,u){typeof o=="string"?(u=u||{},u.url=o):u=o||{},u=yt(this.defaults,u);const{transitional:a,paramsSerializer:l,headers:d}=u;a!==void 0&&$n.assertOptions(a,{silentJSONParsing:tt.transitional(tt.boolean),forcedJSONParsing:tt.transitional(tt.boolean),clarifyTimeoutError:tt.transitional(tt.boolean)},!1),l!=null&&(A.isFunction(l)?u.paramsSerializer={serialize:l}:$n.assertOptions(l,{encode:tt.function,serialize:tt.function},!0)),u.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?u.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:u.allowAbsoluteUrls=!0),$n.assertOptions(u,{baseUrl:tt.spelling("baseURL"),withXsrfToken:tt.spelling("withXSRFToken")},!0),u.method=(u.method||this.defaults.method||"get").toLowerCase();let h=d&&A.merge(d.common,d[u.method]);d&&A.forEach(["delete","get","head","post","put","patch","common"],N=>{delete d[N]}),u.headers=Ye.concat(h,d);const x=[];let $=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(u)===!1||($=$&&j.synchronous,x.unshift(j.fulfilled,j.rejected))});const C=[];this.interceptors.response.forEach(function(j){C.push(j.fulfilled,j.rejected)});let D,M=0,ae;if(!$){const N=[mo.bind(this),void 0];for(N.unshift.apply(N,x),N.push.apply(N,C),ae=N.length,D=Promise.resolve(u);M<ae;)D=D.then(N[M++],N[M++]);return D}ae=x.length;let ue=u;for(M=0;M<ae;){const N=x[M++],j=x[M++];try{ue=N(ue)}catch(E){j.call(this,E);break}}try{D=mo.call(this,ue)}catch(N){return Promise.reject(N)}for(M=0,ae=C.length;M<ae;)D=D.then(C[M++],C[M++]);return D}getUri(o){o=yt(this.defaults,o);const u=oo(o.baseURL,o.url,o.allowAbsoluteUrls);return Gi(u,o.params,o.paramsSerializer)}};A.forEach(["delete","get","head","options"],function(o){vt.prototype[o]=function(u,a){return this.request(yt(a||{},{method:o,url:u,data:(a||{}).data}))}}),A.forEach(["post","put","patch"],function(o){function u(a){return function(d,h,x){return this.request(yt(x||{},{method:o,headers:a?{"Content-Type":"multipart/form-data"}:{},url:d,data:h}))}}vt.prototype[o]=u(),vt.prototype[o+"Form"]=u(!0)});let nu=class as{constructor(o){if(typeof o!="function")throw new TypeError("executor must be a function.");let u;this.promise=new Promise(function(d){u=d});const a=this;this.promise.then(l=>{if(!a._listeners)return;let d=a._listeners.length;for(;d-- >0;)a._listeners[d](l);a._listeners=null}),this.promise.then=l=>{let d;const h=new Promise(x=>{a.subscribe(x),d=x}).then(l);return h.cancel=function(){a.unsubscribe(d)},h},o(function(d,h,x){a.reason||(a.reason=new At(d,h,x),u(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(o){if(this.reason){o(this.reason);return}this._listeners?this._listeners.push(o):this._listeners=[o]}unsubscribe(o){if(!this._listeners)return;const u=this._listeners.indexOf(o);u!==-1&&this._listeners.splice(u,1)}toAbortSignal(){const o=new AbortController,u=a=>{o.abort(a)};return this.subscribe(u),o.signal.unsubscribe=()=>this.unsubscribe(u),o.signal}static source(){let o;return{token:new as(function(l){o=l}),cancel:o}}};function ru(r){return function(u){return r.apply(null,u)}}function iu(r){return A.isObject(r)&&r.isAxiosError===!0}const _r={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(_r).forEach(([r,o])=>{_r[o]=r});function go(r){const o=new vt(r),u=Ni(vt.prototype.request,o);return A.extend(u,vt.prototype,o,{allOwnKeys:!0}),A.extend(u,o,null,{allOwnKeys:!0}),u.create=function(l){return go(yt(r,l))},u}const Re=go(Lt);Re.Axios=vt,Re.CanceledError=At,Re.CancelToken=nu,Re.isCancel=to,Re.VERSION=yo,Re.toFormData=On,Re.AxiosError=pe,Re.Cancel=Re.CanceledError,Re.all=function(o){return Promise.all(o)},Re.spread=ru,Re.isAxiosError=iu,Re.mergeConfig=yt,Re.AxiosHeaders=Ye,Re.formToJSON=r=>Zi(A.isHTMLForm(r)?new FormData(r):r),Re.getAdapter=po.getAdapter,Re.HttpStatusCode=_r,Re.default=Re;const{Axios:oc,AxiosError:sc,CanceledError:ac,isCancel:uc,CancelToken:cc,VERSION:lc,all:fc,Cancel:dc,isAxiosError:hc,spread:pc,toFormData:mc,AxiosHeaders:yc,HttpStatusCode:vc,formToJSON:gc,getAdapter:bc,mergeConfig:wc}=Re;class bo{constructor(o){oi(this,"storage");this.storage=o}getRaw(o,u=null){var a;return((a=this.storage)==null?void 0:a.getItem(o))??u}setRaw(o,u){var a;(a=this.storage)==null||a.setItem(o,u)}get(o,u=null){const a=this.getRaw(o);return a?bn.parse(a):u}set(o,u){this.setRaw(o,bn.stringify(u))}del(o){var u;(u=this.storage)==null||u.removeItem(o)}clear(){var o;(o=this.storage)==null||o.clear()}}const xr=new bo(typeof localStorage>"u"?void 0:localStorage),wo=new bo(typeof sessionStorage>"u"?void 0:sessionStorage),ou=Object.freeze(Object.defineProperty({__proto__:null,default:{local:xr,session:wo},local:xr,session:wo},Symbol.toStringTag,{value:"Module"})),_o="access_token",xo=(r,o="请求异常.")=>r.message??r.msg??o,Yt=Re.create({baseURL:"",timeout:3e3}),su=()=>Yt.interceptors.request.use(r=>{const o=xr.get(_o);return o&&(r.headers.Authorization=`Bearer ${o}`),r}),au=r=>Yt.interceptors.response.use(o=>{const u=o.data;if(o.status===200)return u.data;const a=new Error(xo(u));return r?r(a):Promise.reject(a)},o=>r?r(o):Promise.reject(o));let Pn=!1,Dn=[];const uu=(r,o,u)=>{const{response:a}=r;return a.config.url==o?(Pn=!1,Dn=[],Promise.reject(r)):(Pn||(Pn=!0,u().then(()=>Dn.forEach(l=>l())).finally(()=>{Pn=!1,Dn=[]})),new Promise(l=>{Dn.push(()=>l(Yt(a.config)))}))},So=(r,o)=>Ht({url:r,method:"GET",params:o}),Oo=(r,o)=>Ht({url:r,method:"POST",data:o}),Eo=r=>(r.responseType??(r.responseType="blob"),Ht(r)),Ht=r=>(r.headers={...r.headers,"Content-Type":"application/json"},Yt.request(r)),cu=Object.freeze(Object.defineProperty({__proto__:null,ACCESS_TOKEN:_o,axios:Yt,default:{get:So,post:Oo,download:Eo,request:Ht},download:Eo,get:So,message:xo,post:Oo,request:Ht,responseInterceptor:au,retry:uu,tokenRequestInterceptor:su},Symbol.toStringTag,{value:"Module"})),Sr=()=>{const r=decodeURIComponent(location.search);return new URLSearchParams(r)},ko=()=>{let r={};for(let[o,u]of Sr().entries())r[o]=u;return r},To=(r,o,u)=>{o??(o="_blank"),window.open(r,o,u)},lu=Object.freeze(Object.defineProperty({__proto__:null,all:ko,default:{search:Sr,all:ko,open:To},open:To,search:Sr},Symbol.toStringTag,{value:"Module"}));De.date=Ss,De.db=Ts,De.fast=Rs,De.file=As,De.hash=Ms,De.http=cu,De.json=js,De.storage=ou,De.url=lu,Object.defineProperty(De,Symbol.toStringTag,{value:"Module"})});
|