@vtj/utils 0.9.0-alpha.3 → 0.9.0-alpha.31
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.cjs +3 -3
- package/dist/index.iife.js +26 -26
- package/dist/index.mjs +3 -3
- package/dist/index.umd.js +26 -26
- package/package.json +3 -3
- package/types/version.d.ts +2 -2
package/dist/index.cjs
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
3
3
|
* @name @vtj/utils
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
5
|
-
* @version 0.9.0-alpha.
|
5
|
+
* @version 0.9.0-alpha.31
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
7
|
-
*/const Yt="0.9.0-alpha.
|
7
|
+
*/const Yt="0.9.0-alpha.31";/**
|
8
8
|
* @vue/shared v3.5.13
|
9
9
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
10
10
|
* @license MIT
|
@@ -13,4 +13,4 @@
|
|
13
13
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Xe]=this[Xe]={accessors:{}}).accessors,s=this.prototype;function o(i){const a=K(i);r[a]||(xr(s,i),r[a]=!0)}return c.isArray(t)?t.forEach(o):o(t),this}}j.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);c.reduceDescriptors(j.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});c.freezeMethods(j);function be(e,t){const n=this||Q,r=t||n,s=j.from(r.headers);let o=r.data;return c.forEach(e,function(a){o=a.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function vt(e){return!!(e&&e.__CANCEL__)}function Z(e,t,n){g.call(this,e??"canceled",g.ERR_CANCELED,t,n),this.name="CanceledError"}c.inherits(Z,g,{__CANCEL__:!0});function Pr(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new g("Request failed with status code "+n.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const jr=C.hasStandardBrowserEnv?{write(e,t,n,r,s,o){const i=[e+"="+encodeURIComponent(t)];c.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),c.isString(r)&&i.push("path="+r),c.isString(s)&&i.push("domain="+s),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Cr(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Nr(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Ft(e,t){return e&&!Cr(t)?Nr(e,t):t}const Lr=C.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function s(o){let i=o;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=s(window.location.href),function(i){const a=c.isString(i)?s(i):i;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}();function vr(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Fr(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(d){const f=Date.now(),l=r[o];i||(i=f),n[s]=d,r[s]=f;let u=o,m=0;for(;u!==s;)m+=n[u++],u=u%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),f-i<t)return;const R=l&&f-l;return R?Math.round(m*1e3/R):void 0}}function Qe(e,t){let n=0;const r=Fr(50,250);return s=>{const o=s.loaded,i=s.lengthComputable?s.total:void 0,a=o-n,d=r(a),f=o<=i;n=o;const l={loaded:o,total:i,progress:i?o/i:void 0,bytes:a,rate:d||void 0,estimated:d&&i&&f?(i-o)/d:void 0,event:s};l[t?"download":"upload"]=!0,e(l)}}const Dr=typeof XMLHttpRequest<"u",Ur=Dr&&function(e){return new Promise(function(n,r){let s=e.data;const o=j.from(e.headers).normalize();let{responseType:i,withXSRFToken:a}=e,d;function f(){e.cancelToken&&e.cancelToken.unsubscribe(d),e.signal&&e.signal.removeEventListener("abort",d)}let l;if(c.isFormData(s)){if(C.hasStandardBrowserEnv||C.hasStandardBrowserWebWorkerEnv)o.setContentType(!1);else if((l=o.getContentType())!==!1){const[p,...E]=l?l.split(";").map(y=>y.trim()).filter(Boolean):[];o.setContentType([p||"multipart/form-data",...E].join("; "))}}let u=new XMLHttpRequest;if(e.auth){const p=e.auth.username||"",E=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(p+":"+E))}const m=Ft(e.baseURL,e.url);u.open(e.method.toUpperCase(),jt(m,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function R(){if(!u)return;const p=j.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),y={data:!i||i==="text"||i==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:p,config:e,request:u};Pr(function(S){n(S),f()},function(S){r(S),f()},y),u=null}if("onloadend"in u?u.onloadend=R:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(R)},u.onabort=function(){u&&(r(new g("Request aborted",g.ECONNABORTED,e,u)),u=null)},u.onerror=function(){r(new g("Network Error",g.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let E=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const y=e.transitional||Ct;e.timeoutErrorMessage&&(E=e.timeoutErrorMessage),r(new g(E,y.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,e,u)),u=null},C.hasStandardBrowserEnv&&(a&&c.isFunction(a)&&(a=a(e)),a||a!==!1&&Lr(m))){const p=e.xsrfHeaderName&&e.xsrfCookieName&&jr.read(e.xsrfCookieName);p&&o.set(e.xsrfHeaderName,p)}s===void 0&&o.setContentType(null),"setRequestHeader"in u&&c.forEach(o.toJSON(),function(E,y){u.setRequestHeader(y,E)}),c.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),i&&i!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",Qe(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",Qe(e.onUploadProgress)),(e.cancelToken||e.signal)&&(d=p=>{u&&(r(!p||p.type?new Z(null,e,u):p),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(d),e.signal&&(e.signal.aborted?d():e.signal.addEventListener("abort",d)));const h=vr(m);if(h&&C.protocols.indexOf(h)===-1){r(new g("Unsupported protocol "+h+":",g.ERR_BAD_REQUEST,e));return}u.send(s||null)})},Pe={http:ar,xhr:Ur};c.forEach(Pe,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ze=e=>`- ${e}`,Br=e=>c.isFunction(e)||e===null||e===!1,Dt={getAdapter:e=>{e=c.isArray(e)?e:[e];const{length:t}=e;let n,r;const s={};for(let o=0;o<t;o++){n=e[o];let i;if(r=n,!Br(n)&&(r=Pe[(i=String(n)).toLowerCase()],r===void 0))throw new g(`Unknown adapter '${i}'`);if(r)break;s[i||"#"+o]=r}if(!r){const o=Object.entries(s).map(([a,d])=>`adapter ${a} `+(d===!1?"is not supported by the environment":"is not available in the build"));let i=t?o.length>1?`since :
|
14
14
|
`+o.map(Ze).join(`
|
15
15
|
`):" "+Ze(o[0]):"as no adapter specified";throw new g("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:Pe};function Ee(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Z(null,e)}function et(e){return Ee(e),e.headers=j.from(e.headers),e.data=be.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Dt.getAdapter(e.adapter||Q.adapter)(e).then(function(r){return Ee(e),r.data=be.call(e,e.transformResponse,r),r.headers=j.from(r.headers),r},function(r){return vt(r)||(Ee(e),r&&r.response&&(r.response.data=be.call(e,e.transformResponse,r.response),r.response.headers=j.from(r.response.headers))),Promise.reject(r)})}const tt=e=>e instanceof j?{...e}:e;function q(e,t){t=t||{};const n={};function r(f,l,u){return c.isPlainObject(f)&&c.isPlainObject(l)?c.merge.call({caseless:u},f,l):c.isPlainObject(l)?c.merge({},l):c.isArray(l)?l.slice():l}function s(f,l,u){if(c.isUndefined(l)){if(!c.isUndefined(f))return r(void 0,f,u)}else return r(f,l,u)}function o(f,l){if(!c.isUndefined(l))return r(void 0,l)}function i(f,l){if(c.isUndefined(l)){if(!c.isUndefined(f))return r(void 0,f)}else return r(void 0,l)}function a(f,l,u){if(u in t)return r(f,l);if(u in e)return r(void 0,f)}const d={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(f,l)=>s(tt(f),tt(l),!0)};return c.forEach(Object.keys(Object.assign({},e,t)),function(l){const u=d[l]||s,m=u(e[l],t[l],l);c.isUndefined(m)&&u!==a||(n[l]=m)}),n}const Ut="1.6.8",He={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{He[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const nt={};He.transitional=function(t,n,r){function s(o,i){return"[Axios v"+Ut+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,a)=>{if(t===!1)throw new g(s(i," has been removed"+(n?" in "+n:"")),g.ERR_DEPRECATED);return n&&!nt[i]&&(nt[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,a):!0}};function Ir(e,t,n){if(typeof e!="object")throw new g("options must be an object",g.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const a=e[o],d=a===void 0||i(a,o,e);if(d!==!0)throw new g("option "+o+" must be "+d,g.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new g("Unknown option "+o,g.ERR_BAD_OPTION)}}const je={assertOptions:Ir,validators:He},v=je.validators;class B{constructor(t){this.defaults=t,this.interceptors={request:new Ye,response:new Ye}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s;Error.captureStackTrace?Error.captureStackTrace(s={}):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
16
|
-
`+o):r.stack=o}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=q(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&je.assertOptions(r,{silentJSONParsing:v.transitional(v.boolean),forcedJSONParsing:v.transitional(v.boolean),clarifyTimeoutError:v.transitional(v.boolean)},!1),s!=null&&(c.isFunction(s)?n.paramsSerializer={serialize:s}:je.assertOptions(s,{encode:v.function,serialize:v.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&c.merge(o.common,o[n.method]);o&&c.forEach(["delete","get","head","post","put","patch","common"],h=>{delete o[h]}),n.headers=j.concat(i,o);const a=[];let d=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(n)===!1||(d=d&&p.synchronous,a.unshift(p.fulfilled,p.rejected))});const f=[];this.interceptors.response.forEach(function(p){f.push(p.fulfilled,p.rejected)});let l,u=0,m;if(!d){const h=[et.bind(this),void 0];for(h.unshift.apply(h,a),h.push.apply(h,f),m=h.length,l=Promise.resolve(n);u<m;)l=l.then(h[u++],h[u++]);return l}m=a.length;let R=n;for(u=0;u<m;){const h=a[u++],p=a[u++];try{R=h(R)}catch(E){p.call(this,E);break}}try{l=et.call(this,R)}catch(h){return Promise.reject(h)}for(u=0,m=f.length;u<m;)l=l.then(f[u++],f[u++]);return l}getUri(t){t=q(this.defaults,t);const n=Ft(t.baseURL,t.url);return jt(n,t.params,t.paramsSerializer)}}c.forEach(["delete","get","head","options"],function(t){B.prototype[t]=function(n,r){return this.request(q(r||{},{method:t,url:n,data:(r||{}).data}))}});c.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,a){return this.request(q(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}B.prototype[t]=n(),B.prototype[t+"Form"]=n(!0)});class qe{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(a=>{r.subscribe(a),o=a}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,a){r.reason||(r.reason=new Z(o,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new qe(function(s){t=s}),cancel:t}}}function Mr(e){return function(n){return e.apply(null,n)}}function kr(e){return c.isObject(e)&&e.isAxiosError===!0}const Ce={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(Ce).forEach(([e,t])=>{Ce[t]=e});function Bt(e){const t=new B(e),n=wt(B.prototype.request,t);return c.extend(n,B.prototype,t,{allOwnKeys:!0}),c.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Bt(q(e,s))},n}const b=Bt(Q);b.Axios=B;b.CanceledError=Z;b.CancelToken=qe;b.isCancel=vt;b.VERSION=Ut;b.toFormData=fe;b.AxiosError=g;b.Cancel=b.CanceledError;b.all=function(t){return Promise.all(t)};b.spread=Mr;b.isAxiosError=kr;b.mergeConfig=q;b.AxiosHeaders=j;b.formToJSON=e=>Lt(c.isHTMLForm(e)?new FormData(e):e);b.getAdapter=Dt.getAdapter;b.HttpStatusCode=Ce;b.default=b;const Hr={form:"application/x-www-form-urlencoded",json:"application/json",data:"multipart/form-data"},qr=["put","post","patch"],Ne="Local-Request-Id",Jr=100,zr=300;class It{constructor(t={}){x(this,"axios");x(this,"settings");x(this,"records",{});x(this,"isLoading",!1);x(this,"stopSkipWarn");x(this,"showLoading");x(this,"showError");this.settings=Object.assign({type:"form"},t.settings||{});const n=_.omit(t,["settings","query"]);this.axios=b.create(_.merge({headers:{"Content-Type":"application/x-www-form-urlencoded"},timeout:2*60*1e3},n)),this.setupSkipWarn(this.settings),this.showLoading=_.debounce(this.openLoading.bind(this),Jr),this.showError=_.throttle(this._showError.bind(this),zr,{leading:!0,trailing:!1})}setConfig(t={}){this.settings=_.merge(this.settings,t.settings||{});const n=_.omit(t,["settings","query"]);this.axios.defaults=_.merge(this.axios.defaults,n),this.setupSkipWarn(this.settings)}cancel(t,n="请求已取消"){if(t){const r=this.records[t];if(!r)return;r.source.cancel(n)}else for(const r of Object.values(this.records))r.source.cancel(n)}createHeaders(t,n,r){const s=n.injectHeaders?typeof n.headers=="function"?n.headers(t,r,n):n.headers||{}:{},o={"Content-Type":Hr[n.type||"form"],...r.headers,...s};return n.skipWarn&&(o[Ne]=t),o}isJsonType(t){return Object.entries(t).some(([n,r])=>n.toLowerCase()==="content-type"&&String(r).includes("application/json"))}toFormData(t,n="data"){if(t instanceof FormData||t instanceof URLSearchParams)return t;const r=n==="data"?new FormData:new URLSearchParams;return Object.entries(t).forEach(([s,o])=>{r.append(s,o)}),r}createSendData(t,n,r,s,o={}){const{type:i,skipWarn:a}=t,{name:d="skipWarn"}=a||{};let{data:f,params:l={},method:u="get"}=n;const m=s?{[d]:!0}:{};return qr.includes(u.toLowerCase())?(f=Object.assign(f||{},m),f=i!=="json"||!this.isJsonType(r)?this.toFormData(f,i):f,l={...o}):i==="form"?l={...f||{},...o,...m}:(f&&(i!=="json"||!this.isJsonType(r))&&(f=this.toFormData(f,i)),l={...o,...m}),{data:f,params:l}}createUrl(t){let{url:n,params:r}=t;if(n)try{return _.pathToRegexpCompile(n,{encode:encodeURIComponent})(r||{})}catch{console.warn("createUrl","pathToRegexpCompile error",n)}return n}openLoading(t){const{loading:n,showLoading:r}=t;n&&r&&Object.keys(this.records).length>0&&(this.isLoading=!0,r())}closeLoading(t){const{loading:n,hideLoading:r}=t;if(!n)return;this.isLoading=!1;const s=Object.keys(this.records);r&&s.length===0&&(this.isLoading=!1,r())}_showError(t,n){const{failMessage:r,showError:s}=t;if(r&&s){const o=n.response?.data,i=o?.message||o?.msg||n?.message||n?.msg||"未知错误";s(i,n)}}validResponse(t,n){const{validSuccess:r,validate:s}=t;return r&&s?!!s(n):!0}isSkipWarnResponse(t){return!!t.promise}send(t={},n=!1){const r=_.merge({},this.settings,t.settings||{}),s=t.query||{},o=_.omit(t,["settings","query"]),i=_.uuid(!1),a=b.CancelToken.source();this.records[i]={settings:r,config:o,source:a};const d=this.createUrl(o),f=this.createHeaders(i,r,o),{data:l,params:u}=this.createSendData(r,o,f,n,s);return this.showLoading(r),new Promise((m,R)=>{this.axios({cancelToken:a.token,...o,url:d,headers:f,data:l,params:u}).then(h=>this.isSkipWarnResponse(h)?m(h.promise):this.validResponse(r,h)?m(r.originResponse?h:h.data?.data):(this.showError(r,h.data),R(h.data))).catch(h=>(this.showError(r,h),R(h))).finally(()=>{delete this.records[i],this.closeLoading(r)})})}useResponse(t,n){const{response:r}=this.axios.interceptors,s=r.use(t,n);return()=>r.eject(s)}useRequest(t,n){const{request:r}=this.axios.interceptors,s=r.use(t,n);return()=>r.eject(s)}setupSkipWarn(t){if(this.stopSkipWarn&&(this.stopSkipWarn(),this.stopSkipWarn=void 0),!t.skipWarn)return;const{code:n,executor:r,callback:s,complete:o}=t.skipWarn;this.stopSkipWarn=this.useResponse(i=>{const d=(i.config.headers||{})[Ne],f=this.records[d];if(!f)return i;const{data:l}=i;if(!l||typeof l!="object")return i;if(l?.code===n){s&&s(i);const u=new Promise(r).then(()=>this.send({...f.config,settings:f.settings},!0));u.catch(m=>m).finally(()=>{o&&o()}),i.promise=u}return i})}}function Mt(e={}){const t=new It(e),n=t.send.bind(t),r=t.cancel.bind(t),s=t.setConfig.bind(t),o=t.useRequest.bind(t),i=t.useResponse.bind(t);return Object.assign(n,{...t,instance:t,send:n,cancel:r,setConfig:s,useRequest:o,useResponse:i})}const kt=Mt({settings:{injectHeaders:!0,loading:!0,originResponse:!0}});function Ht(e){const t=typeof e=="string"?{url:e}:e;return(n,r)=>kt.send(_.merge(t,r||{},{data:n}))}function Wr(e){const t={};for(const[n,r]of Object.entries(e))t[n]=Ht(r);return t}function Kr(e,t){const n=ge(null),r=ge(),s=ge(!0);return e.then(o=>{n.value=t?t(o):o}).catch(o=>{r.value=o}).finally(()=>{s.value=!1}),{data:n,error:r,loading:s}}const J=typeof window<"u",$r=e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>{t(r.result)},r.onerror=s=>{n(s)}});function Vr(e){const t={};return e?(e.forEach((n,r)=>{t[r]=typeof n=="string"?decodeURIComponent(n):n}),t):{}}function Gr(e){const t=e.split(","),n=t[0].match(/:(.*?);/)?.[1],r=atob(t[1]);let s=r.length;const o=new Uint8Array(s);for(;s--;)o[s]=r.charCodeAt(s);return new Blob([o],{type:n})}function Yr(e,t){const n=e;return n.lastModified=Date.now(),n.lastModifiedDate=new Date,n.name=t,n}const Xr=e=>J?window.requestAnimationFrame(e):setTimeout(e,16),Qr=e=>J?window.cancelAnimationFrame(e):clearTimeout(e);class qt{constructor(t={}){x(this,"options",{type:"cache",expired:0,prefix:"__VTJ_"});x(this,"caches",{});x(this,"types");this.types={local:J?window.localStorage:this.caches,session:J?window.sessionStorage:this.caches,cache:this.caches},this.config(t)}config(t={}){this.options=Object.assign(this.options,t)}save(t,n,r={}){const{type:s,expired:o,prefix:i}={...this.options,...r},a=Date.now(),d=i+t,f=this.types[s]||this.caches,l={value:n,timestamp:a,expired:o};f===this.caches?f[d]=l:f.setItem(d,JSON.stringify(l))}get(t,n={}){const{type:r,prefix:s}={...this.options,...n},o=s+t,i=this.types[r]||this.caches;let a;if(i===this.caches)a=i[o];else{const m=i.getItem(o);m&&(a=JSON.parse(m))}if(!a)return null;const{value:d,timestamp:f,expired:l}=a;return l>0&&f+l<Date.now()?(this.remove(t,n),null):d}remove(t,n={}){const{type:r,prefix:s}={...this.options,...n},o=this.types[r]||this.caches,i=s+t;o===this.caches?delete o[i]:o.removeItem(i)}clear(t={}){const{type:n}={...this.options,...t},r=this.types[n]||this.caches;r===this.caches?this.caches={}:r.clear()}}const Zr=new qt;var es=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Le={exports:{}};(function(e,t){(function(n,r){r(t,e)})(es,function(n,r){var s={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function o(){return"jsonp_"+Date.now()+"_"+Math.ceil(Math.random()*1e5)}function i(f){try{delete window[f]}catch{window[f]=void 0}}function a(f){var l=document.getElementById(f);l&&document.getElementsByTagName("head")[0].removeChild(l)}function d(f){var l=arguments.length<=1||arguments[1]===void 0?{}:arguments[1],u=f,m=l.timeout||s.timeout,R=l.jsonpCallback||s.jsonpCallback,h=void 0;return new Promise(function(p,E){var y=l.jsonpCallbackFunction||o(),A=R+"_"+y;window[y]=function(de){p({ok:!0,json:function(){return Promise.resolve(de)}}),h&&clearTimeout(h),a(A),i(y)},u+=u.indexOf("?")===-1?"?":"&";var S=document.createElement("script");S.setAttribute("src",""+u+R+"="+y),l.charset&&S.setAttribute("charset",l.charset),l.nonce&&S.setAttribute("nonce",l.nonce),l.referrerPolicy&&S.setAttribute("referrerPolicy",l.referrerPolicy),l.crossorigin&&S.setAttribute("crossorigin","true"),S.id=A,document.getElementsByTagName("head")[0].appendChild(S),h=setTimeout(function(){E(new Error("JSONP request to "+f+" timed out")),i(y),a(A),window[y]=function(){i(y)}},m),S.onerror=function(){E(new Error("JSONP request to "+f+" failed")),i(y),a(A),h&&clearTimeout(h)}})}r.exports=d})})(Le,Le.exports);var ts=Le.exports;const ns=Jt(ts);function rs(e){if(J){const{protocol:t,host:n,pathname:r}=location;return`${t}//${n}${e?r:""}`}else return null}function ss(e=""){const t=e.match(_.rURL);return t?t[0]:""}function zt(e){const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push([n,encodeURIComponent(e[n])].join("="));return t.join("&")}function ve(e,t,n){const r={};e=(e||location.search).replace(/^[^]*\?/,""),t=t||"&",n=n||"=";let s;const o=new RegExp("(?:^|\\"+t+")([^\\"+n+"\\"+t+"]+)(?:\\"+n+"([^\\"+t+"]*))?","g");for(;(s=o.exec(e))!==null;)s[1]!==e&&(r[decodeURIComponent(s[1])]=decodeURIComponent(s[2]||""));return r}function Wt(e,t){t=typeof t=="string"?ve(t):t;const n=e.split("?")[0],r=ve(e),s=Object.assign({},r,t),o=zt(s);return o?[n,o].join("?"):e}const os=Object.freeze(Object.defineProperty({__proto__:null,append:Wt,getCurrentHost:rs,getHost:ss,parse:ve,stringify:zt},Symbol.toStringTag,{value:"Module"}));async function is(e,t={}){const{query:n={}}=t;e.includes("${")&&(e=_.template(e)(n||{}));const r=Wt(e,n);return await(await ns(r,t)).json()}var as=function(t,n,r){var s=document.head||document.getElementsByTagName("head")[0],o=document.createElement("script");typeof n=="function"&&(r=n,n={}),n=n||{},r=r||function(){},o.type=n.type||"text/javascript",o.charset=n.charset||"utf8",o.async="async"in n?!!n.async:!0,o.src=t,n.attrs&&cs(o,n.attrs),n.text&&(o.text=""+n.text);var i="onload"in o?rt:us;i(o,r),o.onload||rt(o,r),s.appendChild(o)};function cs(e,t){for(var n in t)e.setAttribute(n,t[n])}function rt(e,t){e.onload=function(){this.onerror=this.onload=null,t(null,e)},e.onerror=function(){this.onerror=this.onload=null,t(new Error("Failed to load "+this.src),e)}}function us(e,t){e.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,t(null,e))}}const ls=Jt(as);function fs(e,t={}){return new Promise((n,r)=>{const{library:s}=t;ls(e,t,(o,i)=>{o?r(o):n(s?window[s]:void 0)})})}const st={debug:-1,log:0,info:0,warn:1,error:2},ds=function(e,t,n,r){return function(...s){if(t&&st[t]<=st[e]&&console[e].apply&&(r==="*"||n.startsWith(r)))return console[e].apply(console,hs(s,n))}};function hs(e,t){return t!=="*"&&(typeof e[0]=="string"?e[0]=`[${t}] ${e[0]}`:e=["["+t+"]"].concat(e)),e}function ps(e,t){if(!e)return{targetLevel:t.level,targetBizName:t.bizName};if(~e.indexOf(":")){const n=e.split(":");return{targetLevel:n[0],targetBizName:n[1]}}return{targetLevel:e,targetBizName:"*"}}const ms={level:"warn",bizName:"*"};class Kt{constructor(t){x(this,"config");x(this,"options");this.options={...ms,...t};const n=typeof location<"u"?location:{},r=(/__(?:logConf|logLevel)__=([^#/&]*)/.exec(n.href)||[])[1];this.config=ps(r,t)}_log(t){const{targetLevel:n,targetBizName:r}=this.config,{bizName:s}=this.options;return ds(t,n,s,r)}debug(...t){return this._log("debug")(...t)}log(...t){return this._log("log")(...t)}info(...t){return this._log("info")(...t)}warn(...t){return this._log("warn")(...t)}error(...t){return this._log("error")(...t)}}function $t(e){return new Kt(e)}const gs=$t({level:"log",bizName:"VTJ"});/*! js-cookie v3.0.5 | MIT */function ne(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var ws={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Fe(e,t){function n(s,o,i){if(!(typeof document>"u")){i=ne({},t,i),typeof i.expires=="number"&&(i.expires=new Date(Date.now()+i.expires*864e5)),i.expires&&(i.expires=i.expires.toUTCString()),s=encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var d in i)i[d]&&(a+="; "+d,i[d]!==!0&&(a+="="+i[d].split(";")[0]));return document.cookie=s+"="+e.write(o,s)+a}}function r(s){if(!(typeof document>"u"||arguments.length&&!s)){for(var o=document.cookie?document.cookie.split("; "):[],i={},a=0;a<o.length;a++){var d=o[a].split("="),f=d.slice(1).join("=");try{var l=decodeURIComponent(d[0]);if(i[l]=e.read(f,l),s===l)break}catch{}}return s?i[s]:i}}return Object.create({set:n,get:r,remove:function(s,o){n(s,"",ne({},o,{expires:-1}))},withAttributes:function(s){return Fe(this.converter,ne({},this.attributes,s))},withConverter:function(s){return Fe(ne({},this.converter,s),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var Je=Fe(ws,{path:"/"});function ys(e,t,n){Je.set(e,t,n)}function bs(e){return Je.get(e)}function Es(e,t){Je.remove(e,t)}const Rs=Object.freeze(Object.defineProperty({__proto__:null,get:bs,remove:Es,set:ys},Symbol.toStringTag,{value:"Module"}));function Ss(e,t=""){const n=document.createElement("a");n.download=t,n.href=e,n.target="_blank",n.click()}function ze(e,t="",n){const r=new Blob([e],{type:n}),s=document.createElement("a");s.download=t,s.style.display="none",s.href=URL.createObjectURL(r),s.click(),URL.revokeObjectURL(s.href)}async function _s(e,t="",n){return fetch(e,{credentials:"include"}).then(async r=>{const s=await r.blob();return ze(s,t,n),s})}function Os(e,t=""){const n=JSON.stringify(e);ze(n,t,"application/json")}exports.LOCAL_REQUEST_ID=Ne;exports.Logger=Kt;exports.Request=It;exports.Storage=qt;exports.VTJ_UTILS_VERSION=Yt;exports.axios=b;exports.blobToFile=Yr;exports.cAF=Qr;exports.cookie=Rs;exports.createApi=Ht;exports.createApis=Wr;exports.createRequest=Mt;exports.dataURLtoBlob=Gr;exports.downloadBlob=ze;exports.downloadJson=Os;exports.downloadRemoteFile=_s;exports.downloadUrl=Ss;exports.fileToBase64=$r;exports.formDataToJson=Vr;exports.getLogger=$t;exports.isClient=J;exports.jsonp=is;exports.loadScript=fs;exports.logger=gs;exports.rAF=Xr;exports.request=kt;exports.storage=Zr;exports.url=os;exports.useApi=Kr;Object.keys(_).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>_[e]})});
|
16
|
+
`+o):r.stack=o}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=q(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&je.assertOptions(r,{silentJSONParsing:v.transitional(v.boolean),forcedJSONParsing:v.transitional(v.boolean),clarifyTimeoutError:v.transitional(v.boolean)},!1),s!=null&&(c.isFunction(s)?n.paramsSerializer={serialize:s}:je.assertOptions(s,{encode:v.function,serialize:v.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&c.merge(o.common,o[n.method]);o&&c.forEach(["delete","get","head","post","put","patch","common"],h=>{delete o[h]}),n.headers=j.concat(i,o);const a=[];let d=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(n)===!1||(d=d&&p.synchronous,a.unshift(p.fulfilled,p.rejected))});const f=[];this.interceptors.response.forEach(function(p){f.push(p.fulfilled,p.rejected)});let l,u=0,m;if(!d){const h=[et.bind(this),void 0];for(h.unshift.apply(h,a),h.push.apply(h,f),m=h.length,l=Promise.resolve(n);u<m;)l=l.then(h[u++],h[u++]);return l}m=a.length;let R=n;for(u=0;u<m;){const h=a[u++],p=a[u++];try{R=h(R)}catch(E){p.call(this,E);break}}try{l=et.call(this,R)}catch(h){return Promise.reject(h)}for(u=0,m=f.length;u<m;)l=l.then(f[u++],f[u++]);return l}getUri(t){t=q(this.defaults,t);const n=Ft(t.baseURL,t.url);return jt(n,t.params,t.paramsSerializer)}}c.forEach(["delete","get","head","options"],function(t){B.prototype[t]=function(n,r){return this.request(q(r||{},{method:t,url:n,data:(r||{}).data}))}});c.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,a){return this.request(q(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}B.prototype[t]=n(),B.prototype[t+"Form"]=n(!0)});class qe{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(a=>{r.subscribe(a),o=a}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,a){r.reason||(r.reason=new Z(o,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new qe(function(s){t=s}),cancel:t}}}function Mr(e){return function(n){return e.apply(null,n)}}function kr(e){return c.isObject(e)&&e.isAxiosError===!0}const Ce={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(Ce).forEach(([e,t])=>{Ce[t]=e});function Bt(e){const t=new B(e),n=wt(B.prototype.request,t);return c.extend(n,B.prototype,t,{allOwnKeys:!0}),c.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Bt(q(e,s))},n}const b=Bt(Q);b.Axios=B;b.CanceledError=Z;b.CancelToken=qe;b.isCancel=vt;b.VERSION=Ut;b.toFormData=fe;b.AxiosError=g;b.Cancel=b.CanceledError;b.all=function(t){return Promise.all(t)};b.spread=Mr;b.isAxiosError=kr;b.mergeConfig=q;b.AxiosHeaders=j;b.formToJSON=e=>Lt(c.isHTMLForm(e)?new FormData(e):e);b.getAdapter=Dt.getAdapter;b.HttpStatusCode=Ce;b.default=b;const Hr={form:"application/x-www-form-urlencoded",json:"application/json",data:"multipart/form-data"},qr=["put","post","patch"],Ne="Local-Request-Id",Jr=100,zr=300;class It{constructor(t={}){x(this,"axios");x(this,"settings");x(this,"records",{});x(this,"isLoading",!1);x(this,"stopSkipWarn");x(this,"showLoading");x(this,"showError");this.settings=Object.assign({type:"form"},t.settings||{});const n=_.omit(t,["settings","query"]);this.axios=b.create(_.merge({headers:{"Content-Type":"application/x-www-form-urlencoded"},timeout:2*60*1e3},n)),this.setupSkipWarn(this.settings),this.showLoading=_.debounce(this.openLoading.bind(this),Jr),this.showError=_.throttle(this._showError.bind(this),zr,{leading:!0,trailing:!1})}setConfig(t={}){this.settings=_.merge(this.settings,t.settings||{});const n=_.omit(t,["settings","query"]);this.axios.defaults=_.merge(this.axios.defaults,n),this.setupSkipWarn(this.settings)}cancel(t,n="请求已取消"){if(t){const r=this.records[t];if(!r)return;r.source.cancel(n)}else for(const r of Object.values(this.records))r.source.cancel(n)}createHeaders(t,n,r){const s=n.injectHeaders?typeof n.headers=="function"?n.headers(t,r,n):n.headers||{}:{},o={"Content-Type":Hr[n.type||"form"],...r.headers,...s};return n.skipWarn&&(o[Ne]=t),o}isJsonType(t){return Object.entries(t).some(([n,r])=>n.toLowerCase()==="content-type"&&String(r).includes("application/json"))}toFormData(t,n="data"){if(t instanceof FormData||t instanceof URLSearchParams)return t;const r=n==="data"?new FormData:new URLSearchParams;return Object.entries(t).forEach(([s,o])=>{r.append(s,o)}),r}createSendData(t,n,r,s,o={}){const{type:i,skipWarn:a}=t,{name:d="skipWarn"}=a||{};let{data:f,params:l={},method:u="get"}=n;const m=s?{[d]:!0}:{};return qr.includes(u.toLowerCase())?(f=Object.assign(f||{},m),f=i!=="json"||!this.isJsonType(r)?this.toFormData(f,i):f,l={...o}):i==="form"?l={...f||{},...o,...m}:(f&&(i!=="json"||!this.isJsonType(r))&&(f=this.toFormData(f,i)),l={...o,...m}),{data:f,params:l}}createUrl(t){let{url:n,params:r}=t;if(n)try{return _.pathToRegexpCompile(n,{encode:encodeURIComponent})(r||{})}catch{console.warn("createUrl","pathToRegexpCompile error",n)}return n}openLoading(t){const{loading:n,showLoading:r}=t;n&&r&&Object.keys(this.records).length>0&&(this.isLoading=!0,r())}closeLoading(t){const{loading:n,hideLoading:r}=t;if(!n)return;this.isLoading=!1;const s=Object.keys(this.records);r&&s.length===0&&(this.isLoading=!1,r())}_showError(t,n){const{failMessage:r,showError:s}=t;if(r&&s){const o=n.response?.data,i=o?.message||o?.msg||n?.message||n?.msg||"未知错误";s(i,n)}}validResponse(t,n){const{validSuccess:r,validate:s}=t;return r&&s?!!s(n):!0}isSkipWarnResponse(t){return!!t.promise}send(t={},n=!1){const r=_.merge({},this.settings,t.settings||{}),s=t.query||{},o=_.omit(t,["settings","query"]),i=_.uuid(!1),a=b.CancelToken.source();this.records[i]={settings:r,config:o,source:a};const d=this.createUrl(o),f=this.createHeaders(i,r,o),{data:l,params:u}=this.createSendData(r,o,f,n,s);return this.showLoading(r),new Promise((m,R)=>{this.axios({cancelToken:a.token,...o,url:d,headers:f,data:l,params:u}).then(h=>this.isSkipWarnResponse(h)?m(h.promise):this.validResponse(r,h)?m(r.originResponse?h:h.data?.data):(this.showError(r,h.data),R(h.data))).catch(h=>(this.showError(r,h),R(h))).finally(()=>{delete this.records[i],this.closeLoading(r)})})}useResponse(t,n){const{response:r}=this.axios.interceptors,s=r.use(t,n);return()=>r.eject(s)}useRequest(t,n){const{request:r}=this.axios.interceptors,s=r.use(t,n);return()=>r.eject(s)}setupSkipWarn(t){if(this.stopSkipWarn&&(this.stopSkipWarn(),this.stopSkipWarn=void 0),!t.skipWarn)return;const{code:n,executor:r,callback:s,complete:o}=t.skipWarn;this.stopSkipWarn=this.useResponse(i=>{const d=(i.config.headers||{})[Ne],f=this.records[d];if(!f)return i;const{data:l}=i;if(!l||typeof l!="object")return i;if(l?.code===n){s&&s(i);const u=new Promise(r).then(()=>this.send({...f.config,settings:f.settings},!0));u.catch(m=>m).finally(()=>{o&&o()}),i.promise=u}return i})}}function Mt(e={}){const t=new It(e),n=t.send.bind(t),r=t.cancel.bind(t),s=t.setConfig.bind(t),o=t.useRequest.bind(t),i=t.useResponse.bind(t);return Object.assign(n,{...t,instance:t,send:n,cancel:r,setConfig:s,useRequest:o,useResponse:i})}const kt=Mt({settings:{injectHeaders:!0,loading:!0,originResponse:!0}});function Ht(e){const t=typeof e=="string"?{url:e}:e;return(n,r)=>kt.send(_.merge({},t,r||{},{data:n}))}function Wr(e){const t={};for(const[n,r]of Object.entries(e))t[n]=Ht(r);return t}function Kr(e,t){const n=ge(null),r=ge(),s=ge(!0);return e.then(o=>{n.value=t?t(o):o}).catch(o=>{r.value=o}).finally(()=>{s.value=!1}),{data:n,error:r,loading:s}}const J=typeof window<"u",$r=e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>{t(r.result)},r.onerror=s=>{n(s)}});function Vr(e){const t={};return e?(e.forEach((n,r)=>{t[r]=typeof n=="string"?decodeURIComponent(n):n}),t):{}}function Gr(e){const t=e.split(","),n=t[0].match(/:(.*?);/)?.[1],r=atob(t[1]);let s=r.length;const o=new Uint8Array(s);for(;s--;)o[s]=r.charCodeAt(s);return new Blob([o],{type:n})}function Yr(e,t){const n=e;return n.lastModified=Date.now(),n.lastModifiedDate=new Date,n.name=t,n}const Xr=e=>J?window.requestAnimationFrame(e):setTimeout(e,16),Qr=e=>J?window.cancelAnimationFrame(e):clearTimeout(e);class qt{constructor(t={}){x(this,"options",{type:"cache",expired:0,prefix:"__VTJ_"});x(this,"caches",{});x(this,"types");this.types={local:J?window.localStorage:this.caches,session:J?window.sessionStorage:this.caches,cache:this.caches},this.config(t)}config(t={}){this.options=Object.assign(this.options,t)}save(t,n,r={}){const{type:s,expired:o,prefix:i}={...this.options,...r},a=Date.now(),d=i+t,f=this.types[s]||this.caches,l={value:n,timestamp:a,expired:o};f===this.caches?f[d]=l:f.setItem(d,JSON.stringify(l))}get(t,n={}){const{type:r,prefix:s}={...this.options,...n},o=s+t,i=this.types[r]||this.caches;let a;if(i===this.caches)a=i[o];else{const m=i.getItem(o);m&&(a=JSON.parse(m))}if(!a)return null;const{value:d,timestamp:f,expired:l}=a;return l>0&&f+l<Date.now()?(this.remove(t,n),null):d}remove(t,n={}){const{type:r,prefix:s}={...this.options,...n},o=this.types[r]||this.caches,i=s+t;o===this.caches?delete o[i]:o.removeItem(i)}clear(t={}){const{type:n}={...this.options,...t},r=this.types[n]||this.caches;r===this.caches?this.caches={}:r.clear()}}const Zr=new qt;var es=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Le={exports:{}};(function(e,t){(function(n,r){r(t,e)})(es,function(n,r){var s={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function o(){return"jsonp_"+Date.now()+"_"+Math.ceil(Math.random()*1e5)}function i(f){try{delete window[f]}catch{window[f]=void 0}}function a(f){var l=document.getElementById(f);l&&document.getElementsByTagName("head")[0].removeChild(l)}function d(f){var l=arguments.length<=1||arguments[1]===void 0?{}:arguments[1],u=f,m=l.timeout||s.timeout,R=l.jsonpCallback||s.jsonpCallback,h=void 0;return new Promise(function(p,E){var y=l.jsonpCallbackFunction||o(),A=R+"_"+y;window[y]=function(de){p({ok:!0,json:function(){return Promise.resolve(de)}}),h&&clearTimeout(h),a(A),i(y)},u+=u.indexOf("?")===-1?"?":"&";var S=document.createElement("script");S.setAttribute("src",""+u+R+"="+y),l.charset&&S.setAttribute("charset",l.charset),l.nonce&&S.setAttribute("nonce",l.nonce),l.referrerPolicy&&S.setAttribute("referrerPolicy",l.referrerPolicy),l.crossorigin&&S.setAttribute("crossorigin","true"),S.id=A,document.getElementsByTagName("head")[0].appendChild(S),h=setTimeout(function(){E(new Error("JSONP request to "+f+" timed out")),i(y),a(A),window[y]=function(){i(y)}},m),S.onerror=function(){E(new Error("JSONP request to "+f+" failed")),i(y),a(A),h&&clearTimeout(h)}})}r.exports=d})})(Le,Le.exports);var ts=Le.exports;const ns=Jt(ts);function rs(e){if(J){const{protocol:t,host:n,pathname:r}=location;return`${t}//${n}${e?r:""}`}else return null}function ss(e=""){const t=e.match(_.rURL);return t?t[0]:""}function zt(e){const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push([n,encodeURIComponent(e[n])].join("="));return t.join("&")}function ve(e,t,n){const r={};e=(e||location.search).replace(/^[^]*\?/,""),t=t||"&",n=n||"=";let s;const o=new RegExp("(?:^|\\"+t+")([^\\"+n+"\\"+t+"]+)(?:\\"+n+"([^\\"+t+"]*))?","g");for(;(s=o.exec(e))!==null;)s[1]!==e&&(r[decodeURIComponent(s[1])]=decodeURIComponent(s[2]||""));return r}function Wt(e,t){t=typeof t=="string"?ve(t):t;const n=e.split("?")[0],r=ve(e),s=Object.assign({},r,t),o=zt(s);return o?[n,o].join("?"):e}const os=Object.freeze(Object.defineProperty({__proto__:null,append:Wt,getCurrentHost:rs,getHost:ss,parse:ve,stringify:zt},Symbol.toStringTag,{value:"Module"}));async function is(e,t={}){const{query:n={}}=t;e.includes("${")&&(e=_.template(e)(n||{}));const r=Wt(e,n);return await(await ns(r,t)).json()}var as=function(t,n,r){var s=document.head||document.getElementsByTagName("head")[0],o=document.createElement("script");typeof n=="function"&&(r=n,n={}),n=n||{},r=r||function(){},o.type=n.type||"text/javascript",o.charset=n.charset||"utf8",o.async="async"in n?!!n.async:!0,o.src=t,n.attrs&&cs(o,n.attrs),n.text&&(o.text=""+n.text);var i="onload"in o?rt:us;i(o,r),o.onload||rt(o,r),s.appendChild(o)};function cs(e,t){for(var n in t)e.setAttribute(n,t[n])}function rt(e,t){e.onload=function(){this.onerror=this.onload=null,t(null,e)},e.onerror=function(){this.onerror=this.onload=null,t(new Error("Failed to load "+this.src),e)}}function us(e,t){e.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,t(null,e))}}const ls=Jt(as);function fs(e,t={}){return new Promise((n,r)=>{const{library:s}=t;ls(e,t,(o,i)=>{o?r(o):n(s?window[s]:void 0)})})}const st={debug:-1,log:0,info:0,warn:1,error:2},ds=function(e,t,n,r){return function(...s){if(t&&st[t]<=st[e]&&console[e].apply&&(r==="*"||n.startsWith(r)))return console[e].apply(console,hs(s,n))}};function hs(e,t){return t!=="*"&&(typeof e[0]=="string"?e[0]=`[${t}] ${e[0]}`:e=["["+t+"]"].concat(e)),e}function ps(e,t){if(!e)return{targetLevel:t.level,targetBizName:t.bizName};if(~e.indexOf(":")){const n=e.split(":");return{targetLevel:n[0],targetBizName:n[1]}}return{targetLevel:e,targetBizName:"*"}}const ms={level:"warn",bizName:"*"};class Kt{constructor(t){x(this,"config");x(this,"options");this.options={...ms,...t};const n=typeof location<"u"?location:{},r=(/__(?:logConf|logLevel)__=([^#/&]*)/.exec(n.href)||[])[1];this.config=ps(r,t)}_log(t){const{targetLevel:n,targetBizName:r}=this.config,{bizName:s}=this.options;return ds(t,n,s,r)}debug(...t){return this._log("debug")(...t)}log(...t){return this._log("log")(...t)}info(...t){return this._log("info")(...t)}warn(...t){return this._log("warn")(...t)}error(...t){return this._log("error")(...t)}}function $t(e){return new Kt(e)}const gs=$t({level:"log",bizName:"VTJ"});/*! js-cookie v3.0.5 | MIT */function ne(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var ws={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Fe(e,t){function n(s,o,i){if(!(typeof document>"u")){i=ne({},t,i),typeof i.expires=="number"&&(i.expires=new Date(Date.now()+i.expires*864e5)),i.expires&&(i.expires=i.expires.toUTCString()),s=encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var d in i)i[d]&&(a+="; "+d,i[d]!==!0&&(a+="="+i[d].split(";")[0]));return document.cookie=s+"="+e.write(o,s)+a}}function r(s){if(!(typeof document>"u"||arguments.length&&!s)){for(var o=document.cookie?document.cookie.split("; "):[],i={},a=0;a<o.length;a++){var d=o[a].split("="),f=d.slice(1).join("=");try{var l=decodeURIComponent(d[0]);if(i[l]=e.read(f,l),s===l)break}catch{}}return s?i[s]:i}}return Object.create({set:n,get:r,remove:function(s,o){n(s,"",ne({},o,{expires:-1}))},withAttributes:function(s){return Fe(this.converter,ne({},this.attributes,s))},withConverter:function(s){return Fe(ne({},this.converter,s),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var Je=Fe(ws,{path:"/"});function ys(e,t,n){Je.set(e,t,n)}function bs(e){return Je.get(e)}function Es(e,t){Je.remove(e,t)}const Rs=Object.freeze(Object.defineProperty({__proto__:null,get:bs,remove:Es,set:ys},Symbol.toStringTag,{value:"Module"}));function Ss(e,t=""){const n=document.createElement("a");n.download=t,n.href=e,n.target="_blank",n.click()}function ze(e,t="",n){const r=new Blob([e],{type:n}),s=document.createElement("a");s.download=t,s.style.display="none",s.href=URL.createObjectURL(r),s.click(),URL.revokeObjectURL(s.href)}async function _s(e,t="",n){return fetch(e,{credentials:"include"}).then(async r=>{const s=await r.blob();return ze(s,t,n),s})}function Os(e,t=""){const n=JSON.stringify(e);ze(n,t,"application/json")}exports.LOCAL_REQUEST_ID=Ne;exports.Logger=Kt;exports.Request=It;exports.Storage=qt;exports.VTJ_UTILS_VERSION=Yt;exports.axios=b;exports.blobToFile=Yr;exports.cAF=Qr;exports.cookie=Rs;exports.createApi=Ht;exports.createApis=Wr;exports.createRequest=Mt;exports.dataURLtoBlob=Gr;exports.downloadBlob=ze;exports.downloadJson=Os;exports.downloadRemoteFile=_s;exports.downloadUrl=Ss;exports.fileToBase64=$r;exports.formDataToJson=Vr;exports.getLogger=$t;exports.isClient=J;exports.jsonp=is;exports.loadScript=fs;exports.logger=gs;exports.rAF=Xr;exports.request=kt;exports.storage=Zr;exports.url=os;exports.useApi=Kr;Object.keys(_).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>_[e]})});
|