@rainte/js 0.0.39 → 0.0.40

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 CHANGED
@@ -5703,7 +5703,7 @@ const ku = (r, i, u) => {
5703
5703
  const i = {};
5704
5704
  for (const s in r) {
5705
5705
  const l = await r[s](), d = (u = s.split("/").pop()) == null ? void 0 : u.split(".").shift();
5706
- i[d] = { ...l.default, ...l };
5706
+ i[d] = l.default ?? l;
5707
5707
  }
5708
5708
  return i;
5709
5709
  }, bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -5,4 +5,4 @@
5
5
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(i){return i instanceof this?i:new this(i)}static concat(i,...u){const s=new this(i);return u.forEach(l=>s.set(l)),s}static accessor(i){const s=(this[Ko]=this[Ko]={accessors:{}}).accessors,l=this.prototype;function d(h){const S=Ut(h);s[S]||(ba(l,h),s[S]=!0)}return A.isArray(i)?i.forEach(d):d(i),this}};He.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),A.reduceDescriptors(He.prototype,({value:r},i)=>{let u=i[0].toUpperCase()+i.slice(1);return{get:()=>r,set(s){this[u]=s}}}),A.freezeMethods(He);function vr(r,i){const u=this||Lt,s=i||u,l=He.from(s.headers);let d=s.data;return A.forEach(r,function(S){d=S.call(u,d,l.normalize(),i?i.status:void 0)}),l.normalize(),d}function Io(r){return!!(r&&r.__CANCEL__)}function At(r,i,u){pe.call(this,r??"canceled",pe.ERR_CANCELED,i,u),this.name="CanceledError"}A.inherits(At,pe,{__CANCEL__:!0});function Lo(r,i,u){const s=u.config.validateStatus;!u.status||!s||s(u.status)?r(u):i(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 wa(r){const i=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return i&&i[1]||""}function _a(r,i){r=r||10;const u=new Array(r),s=new Array(r);let l=0,d=0,h;return i=i!==void 0?i:1e3,function(P){const C=Date.now(),$=s[d];h||(h=C),u[l]=P,s[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<i)return;const ue=$&&C-$;return ue?Math.round(ae*1e3/ue):void 0}}function Sa(r,i){let u=0,s=1e3/i,l,d;const h=(C,$=Date.now())=>{u=$,l=null,d&&(clearTimeout(d),d=null),r.apply(null,C)};return[(...C)=>{const $=Date.now(),M=$-u;M>=s?h(C,$):(l=C,d||(d=setTimeout(()=>{d=null,h(l)},s-M)))},()=>l&&h(l)]}const En=(r,i,u=3)=>{let s=0;const l=_a(50,250);return Sa(d=>{const h=d.loaded,S=d.lengthComputable?d.total:void 0,P=h-s,C=l(P),$=h<=S;s=h;const M={loaded:h,total:S,progress:S?h/S:void 0,bytes:P,rate:C||void 0,estimated:C&&S&&$?(S-h)/C:void 0,event:d,lengthComputable:S!=null,[i?"download":"upload"]:!0};r(M)},u)},Uo=(r,i)=>{const u=r!=null;return[s=>i[0]({lengthComputable:u,total:r,loaded:s}),i[1]]},Yo=r=>(...i)=>A.asap(()=>r(...i)),xa=qe.hasStandardBrowserEnv?((r,i)=>u=>(u=new URL(u,qe.origin),r.protocol===u.protocol&&r.host===u.host&&(i||r.port===u.port)))(new URL(qe.origin),qe.navigator&&/(msie|trident)/i.test(qe.navigator.userAgent)):()=>!0,Oa=qe.hasStandardBrowserEnv?{write(r,i,u,s,l,d){const h=[r+"="+encodeURIComponent(i)];A.isNumber(u)&&h.push("expires="+new Date(u).toGMTString()),A.isString(s)&&h.push("path="+s),A.isString(l)&&h.push("domain="+l),d===!0&&h.push("secure"),document.cookie=h.join("; ")},read(r){const i=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Ea(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function ka(r,i){return i?r.replace(/\/?\/$/,"")+"/"+i.replace(/^\/+/,""):r}function Ho(r,i,u){let s=!Ea(i);return r&&(s||u==!1)?ka(r,i):i}const zo=r=>r instanceof He?{...r}:r;function mt(r,i){i=i||{};const u={};function s(C,$,M,ae){return A.isPlainObject(C)&&A.isPlainObject($)?A.merge.call({caseless:ae},C,$):A.isPlainObject($)?A.merge({},$):A.isArray($)?$.slice():$}function l(C,$,M,ae){if(A.isUndefined($)){if(!A.isUndefined(C))return s(void 0,C,M,ae)}else return s(C,$,M,ae)}function d(C,$){if(!A.isUndefined($))return s(void 0,$)}function h(C,$){if(A.isUndefined($)){if(!A.isUndefined(C))return s(void 0,C)}else return s(void 0,$)}function S(C,$,M){if(M in i)return s(C,$);if(M in r)return s(void 0,C)}const P={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:S,headers:(C,$,M)=>l(zo(C),zo($),M,!0)};return A.forEach(Object.keys(Object.assign({},r,i)),function($){const M=P[$]||l,ae=M(r[$],i[$],$);A.isUndefined(ae)&&M!==S||(u[$]=ae)}),u}const Vo=r=>{const i=mt({},r);let{data:u,withXSRFToken:s,xsrfHeaderName:l,xsrfCookieName:d,headers:h,auth:S}=i;i.headers=h=He.from(h),i.url=No(Ho(i.baseURL,i.url,i.allowAbsoluteUrls),r.params,r.paramsSerializer),S&&h.set("Authorization","Basic "+btoa((S.username||"")+":"+(S.password?unescape(encodeURIComponent(S.password)):"")));let P;if(A.isFormData(u)){if(qe.hasStandardBrowserEnv||qe.hasStandardBrowserWebWorkerEnv)h.setContentType(void 0);else if((P=h.getContentType())!==!1){const[C,...$]=P?P.split(";").map(M=>M.trim()).filter(Boolean):[];h.setContentType([C||"multipart/form-data",...$].join("; "))}}if(qe.hasStandardBrowserEnv&&(s&&A.isFunction(s)&&(s=s(i)),s||s!==!1&&xa(i.url))){const C=l&&d&&Oa.read(d);C&&h.set(l,C)}return i},Ta=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(u,s){const l=Vo(r);let d=l.data;const h=He.from(l.headers).normalize();let{responseType:S,onUploadProgress:P,onDownloadProgress:C}=l,$,M,ae,ue,N;function j(){ue&&ue(),N&&N(),l.cancelToken&&l.cancelToken.unsubscribe($),l.signal&&l.signal.removeEventListener("abort",$)}let E=new XMLHttpRequest;E.open(l.method.toUpperCase(),l.url,!0),E.timeout=l.timeout;function J(){if(!E)return;const G=He.from("getAllResponseHeaders"in E&&E.getAllResponseHeaders()),fe={data:!S||S==="text"||S==="json"?E.responseText:E.response,status:E.status,statusText:E.statusText,headers:G,config:r,request:E};Lo(function(U){u(U),j()},function(U){s(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&&(s(new pe("Request aborted",pe.ECONNABORTED,r,E)),E=null)},E.onerror=function(){s(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||qo;l.timeoutErrorMessage&&(_e=l.timeoutErrorMessage),s(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),S&&S!=="json"&&(E.responseType=l.responseType),C&&([ae,N]=En(C,!0),E.addEventListener("progress",ae)),P&&E.upload&&([M,ue]=En(P),E.upload.addEventListener("progress",M),E.upload.addEventListener("loadend",ue)),(l.cancelToken||l.signal)&&($=G=>{E&&(s(!G||G.type?new At(null,r,E):G),E.abort(),E=null)},l.cancelToken&&l.cancelToken.subscribe($),l.signal&&(l.signal.aborted?$():l.signal.addEventListener("abort",$)));const re=wa(l.url);if(re&&qe.protocols.indexOf(re)===-1){s(new pe("Unsupported protocol "+re+":",pe.ERR_BAD_REQUEST,r));return}E.send(d||null)})},Ra=(r,i)=>{const{length:u}=r=r?r.filter(Boolean):[];if(i||u){let s=new AbortController,l;const d=function(C){if(!l){l=!0,S();const $=C instanceof Error?C:this.reason;s.abort($ instanceof pe?$:new At($ instanceof Error?$.message:$))}};let h=i&&setTimeout(()=>{h=null,d(new pe(`timeout ${i} of ms exceeded`,pe.ETIMEDOUT))},i);const S=()=>{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:P}=s;return P.unsubscribe=()=>A.asap(S),P}},Aa=function*(r,i){let u=r.byteLength;if(u<i){yield r;return}let s=0,l;for(;s<u;)l=s+i,yield r.slice(s,l),s=l},Pa=async function*(r,i){for await(const u of Da(r))yield*Aa(u,i)},Da=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const i=r.getReader();try{for(;;){const{done:u,value:s}=await i.read();if(u)break;yield s}}finally{await i.cancel()}},Wo=(r,i,u,s)=>{const l=Pa(r,i);let d=0,h,S=P=>{h||(h=!0,s&&s(P))};return new ReadableStream({async pull(P){try{const{done:C,value:$}=await l.next();if(C){S(),P.close();return}let M=$.byteLength;if(u){let ae=d+=M;u(ae)}P.enqueue(new Uint8Array($))}catch(C){throw S(C),C}},cancel(P){return S(P),l.return()}},{highWaterMark:2})},kn=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Jo=kn&&typeof ReadableStream=="function",$a=kn&&(typeof TextEncoder=="function"?(r=>i=>r.encode(i))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),Go=(r,...i)=>{try{return!!r(...i)}catch{return!1}},Ca=Jo&&Go(()=>{let r=!1;const i=new Request(qe.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!i}),Xo=64*1024,gr=Jo&&Go(()=>A.isReadableStream(new Response("").body)),Tn={stream:gr&&(r=>r.body)};kn&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(i=>{!Tn[i]&&(Tn[i]=A.isFunction(r[i])?u=>u[i]():(u,s)=>{throw new pe(`Response type '${i}' is not supported`,pe.ERR_NOT_SUPPORT,s)})})})(new Response);const ja=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 $a(r)).byteLength},Ma=async(r,i)=>{const u=A.toFiniteNumber(r.getContentLength());return u??ja(i)},br={http:na,xhr:Ta,fetch:kn&&(async r=>{let{url:i,method:u,data:s,signal:l,cancelToken:d,timeout:h,onDownloadProgress:S,onUploadProgress:P,responseType:C,headers:$,withCredentials:M="same-origin",fetchOptions:ae}=Vo(r);C=C?(C+"").toLowerCase():"text";let ue=Ra([l,d&&d.toAbortSignal()],h),N;const j=ue&&ue.unsubscribe&&(()=>{ue.unsubscribe()});let E;try{if(P&&Ca&&u!=="get"&&u!=="head"&&(E=await Ma($,s))!==0){let fe=new Request(i,{method:"POST",body:s,duplex:"half"}),te;if(A.isFormData(s)&&(te=fe.headers.get("content-type"))&&$.setContentType(te),fe.body){const[U,K]=Uo(E,En(Yo(P)));s=Wo(fe.body,Xo,U,K)}}A.isString(M)||(M=M?"include":"omit");const J="credentials"in Request.prototype;N=new Request(i,{...ae,signal:ue,method:u.toUpperCase(),headers:$.normalize().toJSON(),body:s,duplex:"half",credentials:J?M:void 0});let re=await fetch(N);const G=gr&&(C==="stream"||C==="response");if(gr&&(S||G&&j)){const fe={};["status","statusText","headers"].forEach(ce=>{fe[ce]=re[ce]});const te=A.toFiniteNumber(re.headers.get("content-length")),[U,K]=S&&Uo(te,En(Yo(S),!0))||[];re=new Response(Wo(re.body,Xo,U,()=>{K&&K(),j&&j()}),fe)}C=C||"text";let _e=await Tn[A.findKey(Tn,C)||"text"](re,r);return!G&&j&&j(),await new Promise((fe,te)=>{Lo(fe,te,{data:_e,headers:He.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,i)=>{if(r){try{Object.defineProperty(r,"name",{value:i})}catch{}Object.defineProperty(r,"adapterName",{value:i})}});const Qo=r=>`- ${r}`,Na=r=>A.isFunction(r)||r===null||r===!1,Zo={getAdapter:r=>{r=A.isArray(r)?r:[r];const{length:i}=r;let u,s;const l={};for(let d=0;d<i;d++){u=r[d];let h;if(s=u,!Na(u)&&(s=br[(h=String(u)).toLowerCase()],s===void 0))throw new pe(`Unknown adapter '${h}'`);if(s)break;l[h||"#"+d]=s}if(!s){const d=Object.entries(l).map(([S,P])=>`adapter ${S} `+(P===!1?"is not supported by the environment":"is not available in the build"));let h=i?d.length>1?`since :
6
6
  `+d.map(Qo).join(`
7
7
  `):" "+Qo(d[0]):"as no adapter specified";throw new pe("There is no suitable adapter to dispatch the request "+h,"ERR_NOT_SUPPORT")}return s},adapters:br};function wr(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new At(null,r)}function ei(r){return wr(r),r.headers=He.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),Zo.getAdapter(r.adapter||Lt.adapter)(r).then(function(s){return wr(r),s.data=vr.call(r,r.transformResponse,s),s.headers=He.from(s.headers),s},function(s){return Io(s)||(wr(r),s&&s.response&&(s.response.data=vr.call(r,r.transformResponse,s.response),s.response.headers=He.from(s.response.headers))),Promise.reject(s)})}const ti="1.8.4",Rn={};["object","boolean","number","function","string","symbol"].forEach((r,i)=>{Rn[r]=function(s){return typeof s===r||"a"+(i<1?"n ":" ")+r}});const ni={};Rn.transitional=function(i,u,s){function l(d,h){return"[Axios v"+ti+"] Transitional option '"+d+"'"+h+(s?". "+s:"")}return(d,h,S)=>{if(i===!1)throw new pe(l(h," has been removed"+(u?" in "+u:"")),pe.ERR_DEPRECATED);return u&&!ni[h]&&(ni[h]=!0,console.warn(l(h," has been deprecated since v"+u+" and will be removed in the near future"))),i?i(d,h,S):!0}},Rn.spelling=function(i){return(u,s)=>(console.warn(`${s} is likely a misspelling of ${i}`),!0)};function Fa(r,i,u){if(typeof r!="object")throw new pe("options must be an object",pe.ERR_BAD_OPTION_VALUE);const s=Object.keys(r);let l=s.length;for(;l-- >0;){const d=s[l],h=i[d];if(h){const S=r[d],P=S===void 0||h(S,d,r);if(P!==!0)throw new pe("option "+d+" must be "+P,pe.ERR_BAD_OPTION_VALUE);continue}if(u!==!0)throw new pe("Unknown option "+d,pe.ERR_BAD_OPTION)}}const An={assertOptions:Fa,validators:Rn},et=An.validators;let yt=class{constructor(i){this.defaults=i,this.interceptors={request:new Fo,response:new Fo}}async request(i,u){try{return await this._request(i,u)}catch(s){if(s instanceof Error){let l={};Error.captureStackTrace?Error.captureStackTrace(l):l=new Error;const d=l.stack?l.stack.replace(/^.+\n/,""):"";try{s.stack?d&&!String(s.stack).endsWith(d.replace(/^.+\n.+\n/,""))&&(s.stack+=`
8
- `+d):s.stack=d}catch{}}throw s}}_request(i,u){typeof i=="string"?(u=u||{},u.url=i):u=i||{},u=mt(this.defaults,u);const{transitional:s,paramsSerializer:l,headers:d}=u;s!==void 0&&An.assertOptions(s,{silentJSONParsing:et.transitional(et.boolean),forcedJSONParsing:et.transitional(et.boolean),clarifyTimeoutError:et.transitional(et.boolean)},!1),l!=null&&(A.isFunction(l)?u.paramsSerializer={serialize:l}:An.assertOptions(l,{encode:et.function,serialize:et.function},!0)),u.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?u.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:u.allowAbsoluteUrls=!0),An.assertOptions(u,{baseUrl:et.spelling("baseURL"),withXsrfToken:et.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=He.concat(h,d);const S=[];let P=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(u)===!1||(P=P&&j.synchronous,S.unshift(j.fulfilled,j.rejected))});const C=[];this.interceptors.response.forEach(function(j){C.push(j.fulfilled,j.rejected)});let $,M=0,ae;if(!P){const N=[ei.bind(this),void 0];for(N.unshift.apply(N,S),N.push.apply(N,C),ae=N.length,$=Promise.resolve(u);M<ae;)$=$.then(N[M++],N[M++]);return $}ae=S.length;let ue=u;for(M=0;M<ae;){const N=S[M++],j=S[M++];try{ue=N(ue)}catch(E){j.call(this,E);break}}try{$=ei.call(this,ue)}catch(N){return Promise.reject(N)}for(M=0,ae=C.length;M<ae;)$=$.then(C[M++],C[M++]);return $}getUri(i){i=mt(this.defaults,i);const u=Ho(i.baseURL,i.url,i.allowAbsoluteUrls);return No(u,i.params,i.paramsSerializer)}};A.forEach(["delete","get","head","options"],function(i){yt.prototype[i]=function(u,s){return this.request(mt(s||{},{method:i,url:u,data:(s||{}).data}))}}),A.forEach(["post","put","patch"],function(i){function u(s){return function(d,h,S){return this.request(mt(S||{},{method:i,headers:s?{"Content-Type":"multipart/form-data"}:{},url:d,data:h}))}}yt.prototype[i]=u(),yt.prototype[i+"Form"]=u(!0)});let qa=class Li{constructor(i){if(typeof i!="function")throw new TypeError("executor must be a function.");let u;this.promise=new Promise(function(d){u=d});const s=this;this.promise.then(l=>{if(!s._listeners)return;let d=s._listeners.length;for(;d-- >0;)s._listeners[d](l);s._listeners=null}),this.promise.then=l=>{let d;const h=new Promise(S=>{s.subscribe(S),d=S}).then(l);return h.cancel=function(){s.unsubscribe(d)},h},i(function(d,h,S){s.reason||(s.reason=new At(d,h,S),u(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(i){if(this.reason){i(this.reason);return}this._listeners?this._listeners.push(i):this._listeners=[i]}unsubscribe(i){if(!this._listeners)return;const u=this._listeners.indexOf(i);u!==-1&&this._listeners.splice(u,1)}toAbortSignal(){const i=new AbortController,u=s=>{i.abort(s)};return this.subscribe(u),i.signal.unsubscribe=()=>this.unsubscribe(u),i.signal}static source(){let i;return{token:new Li(function(l){i=l}),cancel:i}}};function Ba(r){return function(u){return r.apply(null,u)}}function Ka(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,i])=>{_r[i]=r});function ri(r){const i=new yt(r),u=So(yt.prototype.request,i);return A.extend(u,yt.prototype,i,{allOwnKeys:!0}),A.extend(u,i,null,{allOwnKeys:!0}),u.create=function(l){return ri(mt(r,l))},u}const Ae=ri(Lt);Ae.Axios=yt,Ae.CanceledError=At,Ae.CancelToken=qa,Ae.isCancel=Io,Ae.VERSION=ti,Ae.toFormData=xn,Ae.AxiosError=pe,Ae.Cancel=Ae.CanceledError,Ae.all=function(i){return Promise.all(i)},Ae.spread=Ba,Ae.isAxiosError=Ka,Ae.mergeConfig=mt,Ae.AxiosHeaders=He,Ae.formToJSON=r=>Bo(A.isHTMLForm(r)?new FormData(r):r),Ae.getAdapter=Zo.getAdapter,Ae.HttpStatusCode=_r,Ae.default=Ae;const{Axios:Xu,AxiosError:Qu,CanceledError:Zu,isCancel:ec,CancelToken:tc,VERSION:nc,all:rc,Cancel:oc,isAxiosError:ic,spread:sc,toFormData:ac,AxiosHeaders:uc,HttpStatusCode:cc,formToJSON:lc,getAdapter:fc,mergeConfig:dc}=Ae;class oi{constructor(i){ro(this,"storage");this.storage=i}getRaw(i,u=null){var s;return((s=this.storage)==null?void 0:s.getItem(i))??u}setRaw(i,u){var s;(s=this.storage)==null||s.setItem(i,u)}get(i,u=null){const s=this.getRaw(i);return s?_o(s):u}set(i,u){this.setRaw(i,cr(u))}del(i){var u;(u=this.storage)==null||u.removeItem(i)}clear(){var i;(i=this.storage)==null||i.clear()}}const Ia=typeof localStorage>"u"?void 0:localStorage,La=typeof sessionStorage>"u"?void 0:sessionStorage,ii=new oi(Ia),Ua=new oi(La),Ya=Object.freeze(Object.defineProperty({__proto__:null,local:ii,session:Ua},Symbol.toStringTag,{value:"Module"})),si="access_token",ai=(r,i="请求异常.")=>r.message??r.msg??i,Yt=Ae.create({baseURL:"",timeout:3e3}),Ha=()=>Yt.interceptors.request.use(r=>{const i=ii.get(si);return i&&(r.headers.Authorization=`Bearer ${i}`),r}),za=r=>Yt.interceptors.response.use(i=>{const u=i.data;if(i.status===200)return u.data;const s=new Error(ai(u));return r?r(s):Promise.reject(s)},i=>r?r(i):Promise.reject(i));let Pn=!1,Dn=[];const Va=(r,i,u)=>{const{response:s}=r;return s.config.url==i?(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(s.config)))}))},Wa=(r,i)=>$n({url:r,method:"GET",params:i}),Ja=(r,i)=>$n({url:r,method:"POST",data:i}),Ga=r=>(r.responseType??(r.responseType="blob"),$n(r)),$n=r=>(r.headers={...r.headers,"Content-Type":"application/json"},Yt.request(r)),Xa=Object.freeze(Object.defineProperty({__proto__:null,ACCESS_TOKEN:si,axios:Yt,download:Ga,get:Wa,message:ai,post:Ja,request:$n,responseInterceptor:za,retry:Va,tokenRequestInterceptor:Ha},Symbol.toStringTag,{value:"Module"})),Qa=Object.freeze(Object.defineProperty({__proto__:null,fail:r=>{throw new Error(r)},loadModules:async r=>{var u;const i={};for(const s in r){const l=await r[s](),d=(u=s.split("/").pop())==null?void 0:u.split(".").shift();i[d]={...l.default,...l}}return i},log:(r,i)=>{i?console.log(i,r):console.log(r)},sleep:r=>new Promise(i=>setTimeout(i,r))},Symbol.toStringTag,{value:"Module"})),ui=()=>{const r=decodeURIComponent(location.search);return new URLSearchParams(r)},Za=Object.freeze(Object.defineProperty({__proto__:null,open:(r,i,u)=>{i??(i="_blank"),window.open(r,i,u)},params:()=>{let r={};for(let[i,u]of ui().entries())r[i]=u;return r},search:ui},Symbol.toStringTag,{value:"Module"}));Re.array=Ui,Re.blob=Yi,Re.database=Ji,Re.date=fs,Re.hash=vs,Re.http=Xa,Re.json=ys,Re.storage=Ya,Re.system=Qa,Re.url=Za,Object.defineProperty(Re,Symbol.toStringTag,{value:"Module"})});
8
+ `+d):s.stack=d}catch{}}throw s}}_request(i,u){typeof i=="string"?(u=u||{},u.url=i):u=i||{},u=mt(this.defaults,u);const{transitional:s,paramsSerializer:l,headers:d}=u;s!==void 0&&An.assertOptions(s,{silentJSONParsing:et.transitional(et.boolean),forcedJSONParsing:et.transitional(et.boolean),clarifyTimeoutError:et.transitional(et.boolean)},!1),l!=null&&(A.isFunction(l)?u.paramsSerializer={serialize:l}:An.assertOptions(l,{encode:et.function,serialize:et.function},!0)),u.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?u.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:u.allowAbsoluteUrls=!0),An.assertOptions(u,{baseUrl:et.spelling("baseURL"),withXsrfToken:et.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=He.concat(h,d);const S=[];let P=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(u)===!1||(P=P&&j.synchronous,S.unshift(j.fulfilled,j.rejected))});const C=[];this.interceptors.response.forEach(function(j){C.push(j.fulfilled,j.rejected)});let $,M=0,ae;if(!P){const N=[ei.bind(this),void 0];for(N.unshift.apply(N,S),N.push.apply(N,C),ae=N.length,$=Promise.resolve(u);M<ae;)$=$.then(N[M++],N[M++]);return $}ae=S.length;let ue=u;for(M=0;M<ae;){const N=S[M++],j=S[M++];try{ue=N(ue)}catch(E){j.call(this,E);break}}try{$=ei.call(this,ue)}catch(N){return Promise.reject(N)}for(M=0,ae=C.length;M<ae;)$=$.then(C[M++],C[M++]);return $}getUri(i){i=mt(this.defaults,i);const u=Ho(i.baseURL,i.url,i.allowAbsoluteUrls);return No(u,i.params,i.paramsSerializer)}};A.forEach(["delete","get","head","options"],function(i){yt.prototype[i]=function(u,s){return this.request(mt(s||{},{method:i,url:u,data:(s||{}).data}))}}),A.forEach(["post","put","patch"],function(i){function u(s){return function(d,h,S){return this.request(mt(S||{},{method:i,headers:s?{"Content-Type":"multipart/form-data"}:{},url:d,data:h}))}}yt.prototype[i]=u(),yt.prototype[i+"Form"]=u(!0)});let qa=class Li{constructor(i){if(typeof i!="function")throw new TypeError("executor must be a function.");let u;this.promise=new Promise(function(d){u=d});const s=this;this.promise.then(l=>{if(!s._listeners)return;let d=s._listeners.length;for(;d-- >0;)s._listeners[d](l);s._listeners=null}),this.promise.then=l=>{let d;const h=new Promise(S=>{s.subscribe(S),d=S}).then(l);return h.cancel=function(){s.unsubscribe(d)},h},i(function(d,h,S){s.reason||(s.reason=new At(d,h,S),u(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(i){if(this.reason){i(this.reason);return}this._listeners?this._listeners.push(i):this._listeners=[i]}unsubscribe(i){if(!this._listeners)return;const u=this._listeners.indexOf(i);u!==-1&&this._listeners.splice(u,1)}toAbortSignal(){const i=new AbortController,u=s=>{i.abort(s)};return this.subscribe(u),i.signal.unsubscribe=()=>this.unsubscribe(u),i.signal}static source(){let i;return{token:new Li(function(l){i=l}),cancel:i}}};function Ba(r){return function(u){return r.apply(null,u)}}function Ka(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,i])=>{_r[i]=r});function ri(r){const i=new yt(r),u=So(yt.prototype.request,i);return A.extend(u,yt.prototype,i,{allOwnKeys:!0}),A.extend(u,i,null,{allOwnKeys:!0}),u.create=function(l){return ri(mt(r,l))},u}const Ae=ri(Lt);Ae.Axios=yt,Ae.CanceledError=At,Ae.CancelToken=qa,Ae.isCancel=Io,Ae.VERSION=ti,Ae.toFormData=xn,Ae.AxiosError=pe,Ae.Cancel=Ae.CanceledError,Ae.all=function(i){return Promise.all(i)},Ae.spread=Ba,Ae.isAxiosError=Ka,Ae.mergeConfig=mt,Ae.AxiosHeaders=He,Ae.formToJSON=r=>Bo(A.isHTMLForm(r)?new FormData(r):r),Ae.getAdapter=Zo.getAdapter,Ae.HttpStatusCode=_r,Ae.default=Ae;const{Axios:Xu,AxiosError:Qu,CanceledError:Zu,isCancel:ec,CancelToken:tc,VERSION:nc,all:rc,Cancel:oc,isAxiosError:ic,spread:sc,toFormData:ac,AxiosHeaders:uc,HttpStatusCode:cc,formToJSON:lc,getAdapter:fc,mergeConfig:dc}=Ae;class oi{constructor(i){ro(this,"storage");this.storage=i}getRaw(i,u=null){var s;return((s=this.storage)==null?void 0:s.getItem(i))??u}setRaw(i,u){var s;(s=this.storage)==null||s.setItem(i,u)}get(i,u=null){const s=this.getRaw(i);return s?_o(s):u}set(i,u){this.setRaw(i,cr(u))}del(i){var u;(u=this.storage)==null||u.removeItem(i)}clear(){var i;(i=this.storage)==null||i.clear()}}const Ia=typeof localStorage>"u"?void 0:localStorage,La=typeof sessionStorage>"u"?void 0:sessionStorage,ii=new oi(Ia),Ua=new oi(La),Ya=Object.freeze(Object.defineProperty({__proto__:null,local:ii,session:Ua},Symbol.toStringTag,{value:"Module"})),si="access_token",ai=(r,i="请求异常.")=>r.message??r.msg??i,Yt=Ae.create({baseURL:"",timeout:3e3}),Ha=()=>Yt.interceptors.request.use(r=>{const i=ii.get(si);return i&&(r.headers.Authorization=`Bearer ${i}`),r}),za=r=>Yt.interceptors.response.use(i=>{const u=i.data;if(i.status===200)return u.data;const s=new Error(ai(u));return r?r(s):Promise.reject(s)},i=>r?r(i):Promise.reject(i));let Pn=!1,Dn=[];const Va=(r,i,u)=>{const{response:s}=r;return s.config.url==i?(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(s.config)))}))},Wa=(r,i)=>$n({url:r,method:"GET",params:i}),Ja=(r,i)=>$n({url:r,method:"POST",data:i}),Ga=r=>(r.responseType??(r.responseType="blob"),$n(r)),$n=r=>(r.headers={...r.headers,"Content-Type":"application/json"},Yt.request(r)),Xa=Object.freeze(Object.defineProperty({__proto__:null,ACCESS_TOKEN:si,axios:Yt,download:Ga,get:Wa,message:ai,post:Ja,request:$n,responseInterceptor:za,retry:Va,tokenRequestInterceptor:Ha},Symbol.toStringTag,{value:"Module"})),Qa=Object.freeze(Object.defineProperty({__proto__:null,fail:r=>{throw new Error(r)},loadModules:async r=>{var u;const i={};for(const s in r){const l=await r[s](),d=(u=s.split("/").pop())==null?void 0:u.split(".").shift();i[d]=l.default??l}return i},log:(r,i)=>{i?console.log(i,r):console.log(r)},sleep:r=>new Promise(i=>setTimeout(i,r))},Symbol.toStringTag,{value:"Module"})),ui=()=>{const r=decodeURIComponent(location.search);return new URLSearchParams(r)},Za=Object.freeze(Object.defineProperty({__proto__:null,open:(r,i,u)=>{i??(i="_blank"),window.open(r,i,u)},params:()=>{let r={};for(let[i,u]of ui().entries())r[i]=u;return r},search:ui},Symbol.toStringTag,{value:"Module"}));Re.array=Ui,Re.blob=Yi,Re.database=Ji,Re.date=fs,Re.hash=vs,Re.http=Xa,Re.json=ys,Re.storage=Ya,Re.system=Qa,Re.url=Za,Object.defineProperty(Re,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rainte/js",
3
- "version": "0.0.39",
3
+ "version": "0.0.40",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",