mirror of
https://github.com/ZeroCatDev/Classworks.git
synced 2026-02-03 23:23:09 +00:00
7 lines
50 KiB
JavaScript
7 lines
50 KiB
JavaScript
import{k as S,cs as Sr,s as De}from"./index-DS_mP1l0.js";import{i as ee,t as te,g as ct}from"./serverRotation-mM--a4oc.js";const Le=(e,t)=>t.some(r=>e instanceof r);let ut,lt;function Ar(){return ut||(ut=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Or(){return lt||(lt=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Ie=new WeakMap,Ne=new WeakMap,Re=new WeakMap;function xr(e){const t=new Promise((r,n)=>{const s=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{r(z(e.result)),s()},o=()=>{n(e.error),s()};e.addEventListener("success",i),e.addEventListener("error",o)});return Re.set(t,e),t}function Tr(e){if(Ie.has(e))return;const t=new Promise((r,n)=>{const s=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{r(),s()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),s()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});Ie.set(e,t)}let je={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return Ie.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return z(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function kt(e){je=e(je)}function Cr(e){return Or().includes(e)?function(...t){return e.apply($e(this),t),z(this.request)}:function(...t){return z(e.apply($e(this),t))}}function _r(e){return typeof e=="function"?Cr(e):(e instanceof IDBTransaction&&Tr(e),Le(e,Ar())?new Proxy(e,je):e)}function z(e){if(e instanceof IDBRequest)return xr(e);if(Ne.has(e))return Ne.get(e);const t=_r(e);return t!==e&&(Ne.set(e,t),Re.set(t,e)),t}const $e=e=>Re.get(e);function Dr(e,t,{blocked:r,upgrade:n,blocking:s,terminated:i}={}){const o=indexedDB.open(e,t),a=z(o);return n&&o.addEventListener("upgradeneeded",f=>{n(z(o.result),f.oldVersion,f.newVersion,z(o.transaction),f)}),r&&o.addEventListener("blocked",f=>r(f.oldVersion,f.newVersion,f)),a.then(f=>{i&&f.addEventListener("close",()=>i()),s&&f.addEventListener("versionchange",l=>s(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}const Nr=["get","getKey","getAll","getAllKeys","count"],Ur=["put","add","delete","clear"],Ue=new Map;function ft(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Ue.get(t))return Ue.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,s=Ur.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(s||Nr.includes(r)))return;const i=async function(o,...a){const f=this.transaction(o,s?"readwrite":"readonly");let l=f.store;return n&&(l=l.index(a.shift())),(await Promise.all([l[r](...a),s&&f.done]))[0]};return Ue.set(t,i),i}kt(e=>({...e,get:(t,r,n)=>ft(t,r)||e.get(t,r,n),has:(t,r)=>!!ft(t,r)||e.has(t,r)}));const Pr=["continue","continuePrimaryKey","advance"],dt={},Me=new WeakMap,Ft=new WeakMap,vr={get(e,t){if(!Pr.includes(t))return e[t];let r=dt[t];return r||(r=dt[t]=function(...n){Me.set(this,Ft.get(this)[t](...n))}),r}};async function*Br(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;t=t;const r=new Proxy(t,vr);for(Ft.set(r,t),Re.set(r,$e(t));t;)yield r,t=await(Me.get(r)||t.continue()),Me.delete(r)}function pt(e,t){return t===Symbol.asyncIterator&&Le(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&Le(e,[IDBIndex,IDBObjectStore])}kt(e=>({...e,get(t,r,n){return pt(t,r)?Br:e.get(t,r,n)},has(t,r){return pt(t,r)||e.has(t,r)}}));const kr="ClassworksDB",Fr=2,Pe=async()=>Dr(kr,Fr,{upgrade(e){e.objectStoreNames.contains("kv")||e.createObjectStore("kv"),e.objectStoreNames.contains("system")||e.createObjectStore("system")}}),pe={async loadData(e){try{const r=await(await Pe()).get("kv",e);return r?v(JSON.parse(r)):x("数据不存在","NOT_FOUND")}catch(t){return x("读取本地数据失败:"+t)}},async saveData(e,t){try{return await(await Pe()).put("kv",JSON.stringify(t),e),v(!0)}catch(r){return x("保存本地数据失败:"+r)}},async loadKeys(e={}){try{const s=await(await Pe()).transaction(["kv"],"readonly").objectStore("kv").getAllKeys(),{sortDir:i="asc",limit:o=100,skip:a=0}=e,f=s.sort((b,w)=>i==="desc"?w.localeCompare(b):b.localeCompare(w)),l=f.length,u=f.slice(a,a+o),p={keys:u,total_rows:l,current_page:{limit:o,skip:a,count:u.length},load_more:null};return v(p)}catch(t){return x("获取本地键名列表失败:"+t.message)}}};function Lt(e,t){return function(){return e.apply(t,arguments)}}const{toString:Lr}=Object.prototype,{getPrototypeOf:Xe}=Object,{iterator:Se,toStringTag:It}=Symbol,Ae=(e=>t=>{const r=Lr.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),k=e=>(e=e.toLowerCase(),t=>Ae(t)===e),Oe=e=>t=>typeof t===e,{isArray:G}=Array,Z=Oe("undefined");function oe(e){return e!==null&&!Z(e)&&e.constructor!==null&&!Z(e.constructor)&&C(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const jt=k("ArrayBuffer");function Ir(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&jt(e.buffer),t}const jr=Oe("string"),C=Oe("function"),$t=Oe("number"),ie=e=>e!==null&&typeof e=="object",$r=e=>e===!0||e===!1,ye=e=>{if(Ae(e)!=="object")return!1;const t=Xe(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(It in e)&&!(Se in e)},Mr=e=>{if(!ie(e)||oe(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Hr=k("Date"),qr=k("File"),Kr=k("Blob"),zr=k("FileList"),Vr=e=>ie(e)&&C(e.pipe),Wr=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||C(e.append)&&((t=Ae(e))==="formdata"||t==="object"&&C(e.toString)&&e.toString()==="[object FormData]"))},Jr=k("URLSearchParams"),[Xr,Zr,Gr,Qr]=["ReadableStream","Request","Response","Headers"].map(k),Yr=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ae(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),G(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(oe(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(n=0;n<o;n++)a=i[n],t.call(null,e[a],a,e)}}function Mt(e,t){if(oe(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,s;for(;n-- >0;)if(s=r[n],t===s.toLowerCase())return s;return null}const K=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ht=e=>!Z(e)&&e!==K;function He(){const{caseless:e,skipUndefined:t}=Ht(this)&&this||{},r={},n=(s,i)=>{const o=e&&Mt(r,i)||i;ye(r[o])&&ye(s)?r[o]=He(r[o],s):ye(s)?r[o]=He({},s):G(s)?r[o]=s.slice():(!t||!Z(s))&&(r[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&ae(arguments[s],n);return r}const en=(e,t,r,{allOwnKeys:n}={})=>(ae(t,(s,i)=>{r&&C(s)?Object.defineProperty(e,i,{value:Lt(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),tn=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),rn=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},nn=(e,t,r,n)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!n||n(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=r!==!1&&Xe(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},sn=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},on=e=>{if(!e)return null;if(G(e))return e;let t=e.length;if(!$t(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},an=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Xe(Uint8Array)),cn=(e,t)=>{const n=(e&&e[Se]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},un=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},ln=k("HTMLFormElement"),fn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),ht=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),dn=k("RegExp"),qt=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};ae(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},pn=e=>{qt(e,(t,r)=>{if(C(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(C(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},hn=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return G(e)?n(e):n(String(e).split(t)),r},mn=()=>{},yn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function bn(e){return!!(e&&C(e.append)&&e[It]==="FormData"&&e[Se])}const wn=e=>{const t=new Array(10),r=(n,s)=>{if(ie(n)){if(t.indexOf(n)>=0)return;if(oe(n))return n;if(!("toJSON"in n)){t[s]=n;const i=G(n)?[]:{};return ae(n,(o,a)=>{const f=r(o,s+1);!Z(f)&&(i[a]=f)}),t[s]=void 0,i}}return n};return r(e,0)},gn=k("AsyncFunction"),En=e=>e&&(ie(e)||C(e))&&C(e.then)&&C(e.catch),Kt=((e,t)=>e?setImmediate:t?((r,n)=>(K.addEventListener("message",({source:s,data:i})=>{s===K&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),K.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",C(K.postMessage)),Rn=typeof queueMicrotask<"u"?queueMicrotask.bind(K):typeof process<"u"&&process.nextTick||Kt,Sn=e=>e!=null&&C(e[Se]),c={isArray:G,isArrayBuffer:jt,isBuffer:oe,isFormData:Wr,isArrayBufferView:Ir,isString:jr,isNumber:$t,isBoolean:$r,isObject:ie,isPlainObject:ye,isEmptyObject:Mr,isReadableStream:Xr,isRequest:Zr,isResponse:Gr,isHeaders:Qr,isUndefined:Z,isDate:Hr,isFile:qr,isBlob:Kr,isRegExp:dn,isFunction:C,isStream:Vr,isURLSearchParams:Jr,isTypedArray:an,isFileList:zr,forEach:ae,merge:He,extend:en,trim:Yr,stripBOM:tn,inherits:rn,toFlatObject:nn,kindOf:Ae,kindOfTest:k,endsWith:sn,toArray:on,forEachEntry:cn,matchAll:un,isHTMLForm:ln,hasOwnProperty:ht,hasOwnProp:ht,reduceDescriptors:qt,freezeMethods:pn,toObjectSet:hn,toCamelCase:fn,noop:mn,toFiniteNumber:yn,findKey:Mt,global:K,isContextDefined:Ht,isSpecCompliantForm:bn,toJSONObject:wn,isAsyncFn:gn,isThenable:En,setImmediate:Kt,asap:Rn,isIterable:Sn};let y=class zt extends Error{static from(t,r,n,s,i,o){const a=new zt(t.message,r||t.code,n,s,i);return a.cause=t,a.name=t.name,o&&Object.assign(a,o),a}constructor(t,r,n,s,i){super(t),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:c.toJSONObject(this.config),code:this.code,status:this.status}}};y.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";y.ERR_BAD_OPTION="ERR_BAD_OPTION";y.ECONNABORTED="ECONNABORTED";y.ETIMEDOUT="ETIMEDOUT";y.ERR_NETWORK="ERR_NETWORK";y.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";y.ERR_DEPRECATED="ERR_DEPRECATED";y.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";y.ERR_BAD_REQUEST="ERR_BAD_REQUEST";y.ERR_CANCELED="ERR_CANCELED";y.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";y.ERR_INVALID_URL="ERR_INVALID_URL";const An=null;function qe(e){return c.isPlainObject(e)||c.isArray(e)}function Vt(e){return c.endsWith(e,"[]")?e.slice(0,-2):e}function mt(e,t,r){return e?e.concat(t).map(function(s,i){return s=Vt(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function On(e){return c.isArray(e)&&!e.some(qe)}const xn=c.toFlatObject(c,{},null,function(t){return/^is[A-Z]/.test(t)});function xe(e,t,r){if(!c.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=c.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,h){return!c.isUndefined(h[m])});const n=r.metaTokens,s=r.visitor||u,i=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(t);if(!c.isFunction(s))throw new TypeError("visitor must be a function");function l(d){if(d===null)return"";if(c.isDate(d))return d.toISOString();if(c.isBoolean(d))return d.toString();if(!f&&c.isBlob(d))throw new y("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(d)||c.isTypedArray(d)?f&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function u(d,m,h){let E=d;if(d&&!h&&typeof d=="object"){if(c.endsWith(m,"{}"))m=n?m:m.slice(0,-2),d=JSON.stringify(d);else if(c.isArray(d)&&On(d)||(c.isFileList(d)||c.endsWith(m,"[]"))&&(E=c.toArray(d)))return m=Vt(m),E.forEach(function(R,T){!(c.isUndefined(R)||R===null)&&t.append(o===!0?mt([m],T,i):o===null?m:m+"[]",l(R))}),!1}return qe(d)?!0:(t.append(mt(h,m,i),l(d)),!1)}const p=[],b=Object.assign(xn,{defaultVisitor:u,convertValue:l,isVisitable:qe});function w(d,m){if(!c.isUndefined(d)){if(p.indexOf(d)!==-1)throw Error("Circular reference detected in "+m.join("."));p.push(d),c.forEach(d,function(E,N){(!(c.isUndefined(E)||E===null)&&s.call(t,E,c.isString(N)?N.trim():N,m,b))===!0&&w(E,m?m.concat(N):[N])}),p.pop()}}if(!c.isObject(e))throw new TypeError("data must be an object");return w(e),t}function yt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Ze(e,t){this._pairs=[],e&&xe(e,this,t)}const Wt=Ze.prototype;Wt.append=function(t,r){this._pairs.push([t,r])};Wt.toString=function(t){const r=t?function(n){return t.call(this,n,yt)}:yt;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Tn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Jt(e,t,r){if(!t)return e;const n=r&&r.encode||Tn,s=c.isFunction(r)?{serialize:r}:r,i=s&&s.serialize;let o;if(i?o=i(t,s):o=c.isURLSearchParams(t)?t.toString():new Ze(t,s).toString(n),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class bt{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){c.forEach(this.handlers,function(n){n!==null&&t(n)})}}const Xt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Cn=typeof URLSearchParams<"u"?URLSearchParams:Ze,_n=typeof FormData<"u"?FormData:null,Dn=typeof Blob<"u"?Blob:null,Nn={isBrowser:!0,classes:{URLSearchParams:Cn,FormData:_n,Blob:Dn},protocols:["http","https","file","blob","url","data"]},Ge=typeof window<"u"&&typeof document<"u",Ke=typeof navigator=="object"&&navigator||void 0,Un=Ge&&(!Ke||["ReactNative","NativeScript","NS"].indexOf(Ke.product)<0),Pn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",vn=Ge&&window.location.href||"http://localhost",Bn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ge,hasStandardBrowserEnv:Un,hasStandardBrowserWebWorkerEnv:Pn,navigator:Ke,origin:vn},Symbol.toStringTag,{value:"Module"})),O={...Bn,...Nn};function kn(e,t){return xe(e,new O.classes.URLSearchParams,{visitor:function(r,n,s,i){return O.isNode&&c.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function Fn(e){return c.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Ln(e){const t={},r=Object.keys(e);let n;const s=r.length;let i;for(n=0;n<s;n++)i=r[n],t[i]=e[i];return t}function Zt(e){function t(r,n,s,i){let o=r[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),f=i>=r.length;return o=!o&&c.isArray(s)?s.length:o,f?(c.hasOwnProp(s,o)?s[o]=[s[o],n]:s[o]=n,!a):((!s[o]||!c.isObject(s[o]))&&(s[o]=[]),t(r,n,s[o],i)&&c.isArray(s[o])&&(s[o]=Ln(s[o])),!a)}if(c.isFormData(e)&&c.isFunction(e.entries)){const r={};return c.forEachEntry(e,(n,s)=>{t(Fn(n),s,r,0)}),r}return null}function In(e,t,r){if(c.isString(e))try{return(t||JSON.parse)(e),c.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const ce={transitional:Xt,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=c.isObject(t);if(i&&c.isHTMLForm(t)&&(t=new FormData(t)),c.isFormData(t))return s?JSON.stringify(Zt(t)):t;if(c.isArrayBuffer(t)||c.isBuffer(t)||c.isStream(t)||c.isFile(t)||c.isBlob(t)||c.isReadableStream(t))return t;if(c.isArrayBufferView(t))return t.buffer;if(c.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return kn(t,this.formSerializer).toString();if((a=c.isFileList(t))||n.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return xe(a?{"files[]":t}:t,f&&new f,this.formSerializer)}}return i||s?(r.setContentType("application/json",!1),In(t)):t}],transformResponse:[function(t){const r=this.transitional||ce.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(c.isResponse(t)||c.isReadableStream(t))return t;if(t&&c.isString(t)&&(n&&!this.responseType||s)){const o=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?y.from(a,y.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:O.classes.FormData,Blob:O.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};c.forEach(["delete","get","head","post","put","patch"],e=>{ce.headers[e]={}});const jn=c.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),$n=e=>{const t={};let r,n,s;return e&&e.split(`
|
||
`).forEach(function(o){s=o.indexOf(":"),r=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!r||t[r]&&jn[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t},wt=Symbol("internals");function re(e){return e&&String(e).trim().toLowerCase()}function be(e){return e===!1||e==null?e:c.isArray(e)?e.map(be):String(e)}function Mn(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const Hn=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ve(e,t,r,n,s){if(c.isFunction(n))return n.call(this,t,r);if(s&&(t=r),!!c.isString(t)){if(c.isString(n))return t.indexOf(n)!==-1;if(c.isRegExp(n))return n.test(t)}}function qn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Kn(e,t){const r=c.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(s,i,o){return this[n].call(this,t,s,i,o)},configurable:!0})})}let _=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(a,f,l){const u=re(f);if(!u)throw new Error("header name must be a non-empty string");const p=c.findKey(s,u);(!p||s[p]===void 0||l===!0||l===void 0&&s[p]!==!1)&&(s[p||f]=be(a))}const o=(a,f)=>c.forEach(a,(l,u)=>i(l,u,f));if(c.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(c.isString(t)&&(t=t.trim())&&!Hn(t))o($n(t),r);else if(c.isObject(t)&&c.isIterable(t)){let a={},f,l;for(const u of t){if(!c.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[l=u[0]]=(f=a[l])?c.isArray(f)?[...f,u[1]]:[f,u[1]]:u[1]}o(a,r)}else t!=null&&i(r,t,n);return this}get(t,r){if(t=re(t),t){const n=c.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return Mn(s);if(c.isFunction(r))return r.call(this,s,n);if(c.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=re(t),t){const n=c.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||ve(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=re(o),o){const a=c.findKey(n,o);a&&(!r||ve(n,n[a],a,r))&&(delete n[a],s=!0)}}return c.isArray(t)?t.forEach(i):i(t),s}clear(t){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const i=r[n];(!t||ve(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const r=this,n={};return c.forEach(this,(s,i)=>{const o=c.findKey(n,i);if(o){r[o]=be(s),delete r[i];return}const a=t?qn(i):String(i).trim();a!==i&&delete r[i],r[a]=be(s),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return c.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=t&&c.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
||
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(s=>n.set(s)),n}static accessor(t){const n=(this[wt]=this[wt]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=re(o);n[a]||(Kn(s,o),n[a]=!0)}return c.isArray(t)?t.forEach(i):i(t),this}};_.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);c.reduceDescriptors(_.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});c.freezeMethods(_);function Be(e,t){const r=this||ce,n=t||r,s=_.from(n.headers);let i=n.data;return c.forEach(e,function(a){i=a.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Gt(e){return!!(e&&e.__CANCEL__)}let ue=class extends y{constructor(t,r,n){super(t??"canceled",y.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function Qt(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new y("Request failed with status code "+r.status,[y.ERR_BAD_REQUEST,y.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function zn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Vn(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(f){const l=Date.now(),u=n[i];o||(o=l),r[s]=f,n[s]=l;let p=i,b=0;for(;p!==s;)b+=r[p++],p=p%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),l-o<t)return;const w=u&&l-u;return w?Math.round(b*1e3/w):void 0}}function Wn(e,t){let r=0,n=1e3/t,s,i;const o=(l,u=Date.now())=>{r=u,s=null,i&&(clearTimeout(i),i=null),e(...l)};return[(...l)=>{const u=Date.now(),p=u-r;p>=n?o(l,u):(s=l,i||(i=setTimeout(()=>{i=null,o(s)},n-p)))},()=>s&&o(s)]}const Ee=(e,t,r=3)=>{let n=0;const s=Vn(50,250);return Wn(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,f=o-n,l=s(f),u=o<=a;n=o;const p={loaded:o,total:a,progress:a?o/a:void 0,bytes:f,rate:l||void 0,estimated:l&&a&&u?(a-o)/l:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(p)},r)},gt=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Et=e=>(...t)=>c.asap(()=>e(...t)),Jn=O.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,O.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(O.origin),O.navigator&&/(msie|trident)/i.test(O.navigator.userAgent)):()=>!0,Xn=O.hasStandardBrowserEnv?{write(e,t,r,n,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];c.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),c.isString(n)&&a.push(`path=${n}`),c.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),c.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Zn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Gn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Yt(e,t,r){let n=!Zn(t);return e&&(n||r==!1)?Gn(e,t):t}const Rt=e=>e instanceof _?{...e}:e;function W(e,t){t=t||{};const r={};function n(l,u,p,b){return c.isPlainObject(l)&&c.isPlainObject(u)?c.merge.call({caseless:b},l,u):c.isPlainObject(u)?c.merge({},u):c.isArray(u)?u.slice():u}function s(l,u,p,b){if(c.isUndefined(u)){if(!c.isUndefined(l))return n(void 0,l,p,b)}else return n(l,u,p,b)}function i(l,u){if(!c.isUndefined(u))return n(void 0,u)}function o(l,u){if(c.isUndefined(u)){if(!c.isUndefined(l))return n(void 0,l)}else return n(void 0,u)}function a(l,u,p){if(p in t)return n(l,u);if(p in e)return n(void 0,l)}const f={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,u,p)=>s(Rt(l),Rt(u),p,!0)};return c.forEach(Object.keys({...e,...t}),function(u){const p=f[u]||s,b=p(e[u],t[u],u);c.isUndefined(b)&&p!==a||(r[u]=b)}),r}const er=e=>{const t=W({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=t;if(t.headers=o=_.from(o),t.url=Jt(Yt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),c.isFormData(r)){if(O.hasStandardBrowserEnv||O.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(c.isFunction(r.getHeaders)){const f=r.getHeaders(),l=["content-type","content-length"];Object.entries(f).forEach(([u,p])=>{l.includes(u.toLowerCase())&&o.set(u,p)})}}if(O.hasStandardBrowserEnv&&(n&&c.isFunction(n)&&(n=n(t)),n||n!==!1&&Jn(t.url))){const f=s&&i&&Xn.read(i);f&&o.set(s,f)}return t},Qn=typeof XMLHttpRequest<"u",Yn=Qn&&function(e){return new Promise(function(r,n){const s=er(e);let i=s.data;const o=_.from(s.headers).normalize();let{responseType:a,onUploadProgress:f,onDownloadProgress:l}=s,u,p,b,w,d;function m(){w&&w(),d&&d(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function E(){if(!h)return;const R=_.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),P={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:R,config:e,request:h};Qt(function(U){r(U),m()},function(U){n(U),m()},P),h=null}"onloadend"in h?h.onloadend=E:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(E)},h.onabort=function(){h&&(n(new y("Request aborted",y.ECONNABORTED,e,h)),h=null)},h.onerror=function(T){const P=T&&T.message?T.message:"Network Error",H=new y(P,y.ERR_NETWORK,e,h);H.event=T||null,n(H),h=null},h.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const P=s.transitional||Xt;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),n(new y(T,P.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,e,h)),h=null},i===void 0&&o.setContentType(null),"setRequestHeader"in h&&c.forEach(o.toJSON(),function(T,P){h.setRequestHeader(P,T)}),c.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),a&&a!=="json"&&(h.responseType=s.responseType),l&&([b,d]=Ee(l,!0),h.addEventListener("progress",b)),f&&h.upload&&([p,w]=Ee(f),h.upload.addEventListener("progress",p),h.upload.addEventListener("loadend",w)),(s.cancelToken||s.signal)&&(u=R=>{h&&(n(!R||R.type?new ue(null,e,h):R),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const N=zn(s.url);if(N&&O.protocols.indexOf(N)===-1){n(new y("Unsupported protocol "+N+":",y.ERR_BAD_REQUEST,e));return}h.send(i||null)})},es=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,s;const i=function(l){if(!s){s=!0,a();const u=l instanceof Error?l:this.reason;n.abort(u instanceof y?u:new ue(u instanceof Error?u.message:u))}};let o=t&&setTimeout(()=>{o=null,i(new y(`timeout of ${t}ms exceeded`,y.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(i):l.removeEventListener("abort",i)}),e=null)};e.forEach(l=>l.addEventListener("abort",i));const{signal:f}=n;return f.unsubscribe=()=>c.asap(a),f}},ts=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,s;for(;n<r;)s=n+t,yield e.slice(n,s),n=s},rs=async function*(e,t){for await(const r of ns(e))yield*ts(r,t)},ns=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},St=(e,t,r,n)=>{const s=rs(e,t);let i=0,o,a=f=>{o||(o=!0,n&&n(f))};return new ReadableStream({async pull(f){try{const{done:l,value:u}=await s.next();if(l){a(),f.close();return}let p=u.byteLength;if(r){let b=i+=p;r(b)}f.enqueue(new Uint8Array(u))}catch(l){throw a(l),l}},cancel(f){return a(f),s.return()}},{highWaterMark:2})},At=64*1024,{isFunction:he}=c,ss=(({Request:e,Response:t})=>({Request:e,Response:t}))(c.global),{ReadableStream:Ot,TextEncoder:xt}=c.global,Tt=(e,...t)=>{try{return!!e(...t)}catch{return!1}},os=e=>{e=c.merge.call({skipUndefined:!0},ss,e);const{fetch:t,Request:r,Response:n}=e,s=t?he(t):typeof fetch=="function",i=he(r),o=he(n);if(!s)return!1;const a=s&&he(Ot),f=s&&(typeof xt=="function"?(d=>m=>d.encode(m))(new xt):async d=>new Uint8Array(await new r(d).arrayBuffer())),l=i&&a&&Tt(()=>{let d=!1;const m=new r(O.origin,{body:new Ot,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!m}),u=o&&a&&Tt(()=>c.isReadableStream(new n("").body)),p={stream:u&&(d=>d.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!p[d]&&(p[d]=(m,h)=>{let E=m&&m[d];if(E)return E.call(m);throw new y(`Response type '${d}' is not supported`,y.ERR_NOT_SUPPORT,h)})});const b=async d=>{if(d==null)return 0;if(c.isBlob(d))return d.size;if(c.isSpecCompliantForm(d))return(await new r(O.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(c.isArrayBufferView(d)||c.isArrayBuffer(d))return d.byteLength;if(c.isURLSearchParams(d)&&(d=d+""),c.isString(d))return(await f(d)).byteLength},w=async(d,m)=>{const h=c.toFiniteNumber(d.getContentLength());return h??b(m)};return async d=>{let{url:m,method:h,data:E,signal:N,cancelToken:R,timeout:T,onDownloadProgress:P,onUploadProgress:H,responseType:U,headers:Ce,withCredentials:le="same-origin",fetchOptions:rt}=er(d),nt=t||fetch;U=U?(U+"").toLowerCase():"text";let fe=es([N,R&&R.toAbortSignal()],T),Y=null;const q=fe&&fe.unsubscribe&&(()=>{fe.unsubscribe()});let st;try{if(H&&l&&h!=="get"&&h!=="head"&&(st=await w(Ce,E))!==0){let M=new r(m,{method:"POST",body:E,duplex:"half"}),J;if(c.isFormData(E)&&(J=M.headers.get("content-type"))&&Ce.setContentType(J),M.body){const[_e,de]=gt(st,Ee(Et(H)));E=St(M.body,At,_e,de)}}c.isString(le)||(le=le?"include":"omit");const F=i&&"credentials"in r.prototype,ot={...rt,signal:fe,method:h.toUpperCase(),headers:Ce.normalize().toJSON(),body:E,duplex:"half",credentials:F?le:void 0};Y=i&&new r(m,ot);let $=await(i?nt(Y,rt):nt(m,ot));const it=u&&(U==="stream"||U==="response");if(u&&(P||it&&q)){const M={};["status","statusText","headers"].forEach(at=>{M[at]=$[at]});const J=c.toFiniteNumber($.headers.get("content-length")),[_e,de]=P&>(J,Ee(Et(P),!0))||[];$=new n(St($.body,At,_e,()=>{de&&de(),q&&q()}),M)}U=U||"text";let Rr=await p[c.findKey(p,U)||"text"]($,d);return!it&&q&&q(),await new Promise((M,J)=>{Qt(M,J,{data:Rr,headers:_.from($.headers),status:$.status,statusText:$.statusText,config:d,request:Y})})}catch(F){throw q&&q(),F&&F.name==="TypeError"&&/Load failed|fetch/i.test(F.message)?Object.assign(new y("Network Error",y.ERR_NETWORK,d,Y),{cause:F.cause||F}):y.from(F,F&&F.code,d,Y)}}},is=new Map,tr=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,i=[n,s,r];let o=i.length,a=o,f,l,u=is;for(;a--;)f=i[a],l=u.get(f),l===void 0&&u.set(f,l=a?new Map:os(t)),u=l;return l};tr();const Qe={http:An,xhr:Yn,fetch:{get:tr}};c.forEach(Qe,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ct=e=>`- ${e}`,as=e=>c.isFunction(e)||e===null||e===!1;function cs(e,t){e=c.isArray(e)?e:[e];const{length:r}=e;let n,s;const i={};for(let o=0;o<r;o++){n=e[o];let a;if(s=n,!as(n)&&(s=Qe[(a=String(n)).toLowerCase()],s===void 0))throw new y(`Unknown adapter '${a}'`);if(s&&(c.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([f,l])=>`adapter ${f} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
|
||
`+o.map(Ct).join(`
|
||
`):" "+Ct(o[0]):"as no adapter specified";throw new y("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const rr={getAdapter:cs,adapters:Qe};function ke(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ue(null,e)}function _t(e){return ke(e),e.headers=_.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),rr.getAdapter(e.adapter||ce.adapter,e)(e).then(function(n){return ke(e),n.data=Be.call(e,e.transformResponse,n),n.headers=_.from(n.headers),n},function(n){return Gt(n)||(ke(e),n&&n.response&&(n.response.data=Be.call(e,e.transformResponse,n.response),n.response.headers=_.from(n.response.headers))),Promise.reject(n)})}const nr="1.13.4",Te={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Te[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Dt={};Te.transitional=function(t,r,n){function s(i,o){return"[Axios v"+nr+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,a)=>{if(t===!1)throw new y(s(o," has been removed"+(r?" in "+r:"")),y.ERR_DEPRECATED);return r&&!Dt[o]&&(Dt[o]=!0,console.warn(s(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,o,a):!0}};Te.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function us(e,t,r){if(typeof e!="object")throw new y("options must be an object",y.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const i=n[s],o=t[i];if(o){const a=e[i],f=a===void 0||o(a,i,e);if(f!==!0)throw new y("option "+i+" must be "+f,y.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new y("Unknown option "+i,y.ERR_BAD_OPTION)}}const we={assertOptions:us,validators:Te},L=we.validators;let V=class{constructor(t){this.defaults=t||{},this.interceptors={request:new bt,response:new bt}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
||
`+i):n.stack=i}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=W(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&we.assertOptions(n,{silentJSONParsing:L.transitional(L.boolean),forcedJSONParsing:L.transitional(L.boolean),clarifyTimeoutError:L.transitional(L.boolean)},!1),s!=null&&(c.isFunction(s)?r.paramsSerializer={serialize:s}:we.assertOptions(s,{encode:L.function,serialize:L.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),we.assertOptions(r,{baseUrl:L.spelling("baseURL"),withXsrfToken:L.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&c.merge(i.common,i[r.method]);i&&c.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),r.headers=_.concat(o,i);const a=[];let f=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(r)===!1||(f=f&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const l=[];this.interceptors.response.forEach(function(m){l.push(m.fulfilled,m.rejected)});let u,p=0,b;if(!f){const d=[_t.bind(this),void 0];for(d.unshift(...a),d.push(...l),b=d.length,u=Promise.resolve(r);p<b;)u=u.then(d[p++],d[p++]);return u}b=a.length;let w=r;for(;p<b;){const d=a[p++],m=a[p++];try{w=d(w)}catch(h){m.call(this,h);break}}try{u=_t.call(this,w)}catch(d){return Promise.reject(d)}for(p=0,b=l.length;p<b;)u=u.then(l[p++],l[p++]);return u}getUri(t){t=W(this.defaults,t);const r=Yt(t.baseURL,t.url,t.allowAbsoluteUrls);return Jt(r,t.params,t.paramsSerializer)}};c.forEach(["delete","get","head","options"],function(t){V.prototype[t]=function(r,n){return this.request(W(n||{},{method:t,url:r,data:(n||{}).data}))}});c.forEach(["post","put","patch"],function(t){function r(n){return function(i,o,a){return this.request(W(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}V.prototype[t]=r(),V.prototype[t+"Form"]=r(!0)});let ls=class sr{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{n.subscribe(a),i=a}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},t(function(i,o,a){n.reason||(n.reason=new ue(i,o,a),r(n.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 r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new sr(function(s){t=s}),cancel:t}}};function fs(e){return function(r){return e.apply(null,r)}}function ds(e){return c.isObject(e)&&e.isAxiosError===!0}const ze={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ze).forEach(([e,t])=>{ze[t]=e});function or(e){const t=new V(e),r=Lt(V.prototype.request,t);return c.extend(r,V.prototype,t,{allOwnKeys:!0}),c.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return or(W(e,s))},r}const g=or(ce);g.Axios=V;g.CanceledError=ue;g.CancelToken=ls;g.isCancel=Gt;g.VERSION=nr;g.toFormData=xe;g.AxiosError=y;g.Cancel=g.CanceledError;g.all=function(t){return Promise.all(t)};g.spread=fs;g.isAxiosError=ds;g.mergeConfig=W;g.AxiosHeaders=_;g.formToJSON=e=>Zt(c.isHTMLForm(e)?new FormData(e):e);g.getAdapter=rr.getAdapter;g.HttpStatusCode=ze;g.default=g;const{Axios:Ls,AxiosError:Is,CanceledError:js,isCancel:$s,CancelToken:Ms,VERSION:Hs,all:qs,Cancel:Ks,isAxiosError:zs,spread:Vs,toFormData:Ws,AxiosHeaders:Js,HttpStatusCode:Xs,formToJSON:Zs,getAdapter:Gs,mergeConfig:Qs}=g;function ps(e,t){return"headers"in e&&typeof e.headers=="object"&&!Array.isArray(e.headers)?Fe(e.headers):"getHeaders"in e&&typeof e.getHeaders=="function"?Fe(e.getHeaders()):Fe(e)}function Fe(e,t){const r=I(e,"ratelimit");if(r)return bs(r);let n;if(I(e,"ratelimit-remaining"))n="ratelimit-";else if(I(e,"x-ratelimit-remaining"))n="x-ratelimit-";else if(I(e,"x-rate-limit-remaining"))n="x-rate-limit-";else return;const s=B(I(e,`${n}limit`)),i=B(I(e,`${n}used`))||B(I(e,`${n}observed`)),o=B(I(e,`${n}remaining`));let a;const f=I(e,`${n}reset`);switch(void 0){case"date":{a=ir(f??"");break}case"unix":{a=Ve(f??"");break}case"seconds":{a=ar(f??"");break}case"milliseconds":{a=ws(f??"");break}default:if(f)a=Es(f);else{const u=I(e,"retry-after");u&&(a=Ve(u))}}return{limit:Number.isNaN(s)?i+o:s,used:Number.isNaN(i)?s-o:i,remaining:o,reset:a}}var hs=/limit\s*=\s*(\d+)/i,ms=/remaining\s*=\s*(\d+)/i,ys=/reset\s*=\s*(\d+)/i;function bs(e){var t,r,n;const s=B((t=hs.exec(e))==null?void 0:t[1]),i=B((r=ms.exec(e))==null?void 0:r[1]),o=B((n=ys.exec(e))==null?void 0:n[1]),a=Ye(o);return{limit:s,used:s-i,remaining:i,reset:a}}function Ye(e){const t=new Date;return t.setSeconds(t.getSeconds()+e),t}function B(e){return typeof e=="number"?e:Number.parseInt(e??"",10)}function I(e,t){var r;if("get"in e&&typeof e.get=="function")return(r=e.get(t))!=null?r:void 0;if(t in e&&typeof e[t]=="string")return e[t]}function ir(e){return new Date(e)}function Ve(e){const t=B(e);return new Date(t*1e3)}function ar(e){const t=B(e);return Ye(t)}function ws(e){const t=B(e);return Ye(t/1e3)}var gs=/[a-z]/i;function Es(e){if(gs.test(e))return ir(e);const t=B(e);return t&&t>1e9?Ve(t):ar(t)}const cr="3.7.8",Rs=cr,Q=typeof Buffer=="function",Nt=typeof TextDecoder=="function"?new TextDecoder:void 0,Ut=typeof TextEncoder=="function"?new TextEncoder:void 0,Ss="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",se=Array.prototype.slice.call(Ss),me=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(se),As=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,A=String.fromCharCode.bind(String),Pt=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),ur=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),lr=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),fr=e=>{let t,r,n,s,i="";const o=e.length%3;for(let a=0;a<e.length;){if((r=e.charCodeAt(a++))>255||(n=e.charCodeAt(a++))>255||(s=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|s,i+=se[t>>18&63]+se[t>>12&63]+se[t>>6&63]+se[t&63]}return o?i.slice(0,o-3)+"===".substring(o):i},et=typeof btoa=="function"?e=>btoa(e):Q?e=>Buffer.from(e,"binary").toString("base64"):fr,We=Q?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,s=e.length;n<s;n+=4096)r.push(A.apply(null,e.subarray(n,n+4096)));return et(r.join(""))},ge=(e,t=!1)=>t?ur(We(e)):We(e),Os=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?A(192|t>>>6)+A(128|t&63):A(224|t>>>12&15)+A(128|t>>>6&63)+A(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return A(240|t>>>18&7)+A(128|t>>>12&63)+A(128|t>>>6&63)+A(128|t&63)}},xs=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,dr=e=>e.replace(xs,Os),vt=Q?e=>Buffer.from(e,"utf8").toString("base64"):Ut?e=>We(Ut.encode(e)):e=>et(dr(e)),X=(e,t=!1)=>t?ur(vt(e)):vt(e),Bt=e=>X(e,!0),Ts=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Cs=e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return A((r>>>10)+55296)+A((r&1023)+56320);case 3:return A((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return A((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},pr=e=>e.replace(Ts,Cs),hr=e=>{if(e=e.replace(/\s+/g,""),!As.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r,n,s=[];for(let i=0;i<e.length;)t=me[e.charAt(i++)]<<18|me[e.charAt(i++)]<<12|(r=me[e.charAt(i++)])<<6|(n=me[e.charAt(i++)]),r===64?s.push(A(t>>16&255)):n===64?s.push(A(t>>16&255,t>>8&255)):s.push(A(t>>16&255,t>>8&255,t&255));return s.join("")},tt=typeof atob=="function"?e=>atob(lr(e)):Q?e=>Buffer.from(e,"base64").toString("binary"):hr,mr=Q?e=>Pt(Buffer.from(e,"base64")):e=>Pt(tt(e).split("").map(t=>t.charCodeAt(0))),yr=e=>mr(br(e)),_s=Q?e=>Buffer.from(e,"base64").toString("utf8"):Nt?e=>Nt.decode(mr(e)):e=>pr(tt(e)),br=e=>lr(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),Je=e=>_s(br(e)),Ds=e=>{if(typeof e!="string")return!1;const t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},wr=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),gr=function(){const e=(t,r)=>Object.defineProperty(String.prototype,t,wr(r));e("fromBase64",function(){return Je(this)}),e("toBase64",function(t){return X(this,t)}),e("toBase64URI",function(){return X(this,!0)}),e("toBase64URL",function(){return X(this,!0)}),e("toUint8Array",function(){return yr(this)})},Er=function(){const e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,wr(r));e("toBase64",function(t){return ge(this,t)}),e("toBase64URI",function(){return ge(this,!0)}),e("toBase64URL",function(){return ge(this,!0)})},Ns=()=>{gr(),Er()},Us={version:cr,VERSION:Rs,atob:tt,atobPolyfill:hr,btoa:et,btoaPolyfill:fr,fromBase64:Je,toBase64:X,encode:X,encodeURI:Bt,encodeURL:Bt,utob:dr,btou:pr,decode:Je,isValid:Ds,fromUint8Array:ge,toUint8Array:yr,extendString:gr,extendUint8Array:Er,extendBuiltins:Ns},D=g.create({timeout:1e4});D.interceptors.request.use(e=>{const t=S("server.provider");if(t==="kv-server"||t==="classworkscloud"){const r=S("server.kvToken");if(r)e.headers["x-app-token"]=r;else{const n=S("server.siteKey");n&&(e.headers["x-site-key"]=Us.encode(n))}}return e},e=>(console.log(e),Promise.reject(e)));D.interceptors.response.use(e=>e,e=>{if(e.response&&e.response.status===429)try{const t=ps(e.response);t&&Sr.show(t.reset,e.config.url,e.config.method.toUpperCase())}catch(t){console.error("解析限速头信息失败:",t)}return Promise.reject(e)});const Ys=Object.freeze(Object.defineProperty({__proto__:null,default:D},Symbol.toStringTag,{value:"Module"})),j=()=>{const e={Accept:"application/json"},t=S("server.kvToken"),r=S("server.siteKey");return t?e["x-app-token"]=t:r&&(e["x-site-key"]=r),e},ne={async loadNamespaceInfo(){var e,t;try{if(ee())return await te(async s=>{const i=await D.get(`${s}/kv/_info`,{headers:j()});return v(i.data)});const r=S("server.domain"),n=await D.get(`${r}/kv/_info`,{headers:j()});return v(n.data)}catch(r){return console.error("获取命名空间信息失败:",r),x(((t=(e=r.response)==null?void 0:e.data)==null?void 0:t.message)||"获取命名空间信息失败","NAMESPACE_ERROR")}},async updateNamespaceInfo(e){var t,r;try{if(ee())return await te(async i=>await D.put(`${i}/kv/_info`,e,{headers:j()}));const n=S("server.domain");return await D.put(`${n}/kv/_info`,e,{headers:j()})}catch(n){return x(((r=(t=n.response)==null?void 0:t.data)==null?void 0:r.message)||"更新命名空间信息失败","NAMESPACE_ERROR")}},async loadData(e){var t,r,n;try{if(ee())return await te(async o=>{const a=await D.get(`${o}/kv/${e}`,{headers:j()});return v(a.data)});const s=S("server.domain"),i=await D.get(`${s}/kv/${e}`,{headers:j()});return v(i.data)}catch(s){return((t=s.response)==null?void 0:t.status)===404?x("数据不存在","NOT_FOUND"):(console.log(s),x(((n=(r=s.response)==null?void 0:r.data)==null?void 0:n.message)||"服务器连接失败","NETWORK_ERROR"))}},async saveData(e,t){var r,n;try{if(ee())return await te(async i=>(await D.post(`${i}/kv/${e}`,t,{headers:j()}),v(!0)));const s=S("server.domain");return await D.post(`${s}/kv/${e}`,t,{headers:j()}),v(!0)}catch(s){return console.log(s),x(((n=(r=s.response)==null?void 0:r.data)==null?void 0:n.message)||"保存失败","SAVE_ERROR")}},async loadKeys(e={}){var t,r,n,s,i;try{const{sortBy:o="key",sortDir:a="asc",limit:f=100,skip:l=0}=e,u=new URLSearchParams({sortBy:o,sortDir:a,limit:f.toString(),skip:l.toString()});if(ee())return await te(async w=>{const d=await D.get(`${w}/kv/_keys?${u}`,{headers:j()});return v(d.data)});const p=S("server.domain"),b=await D.get(`${p}/kv/_keys?${u}`,{headers:j()});return v(b.data)}catch(o){return((t=o.response)==null?void 0:t.status)===404?x("命名空间不存在","NOT_FOUND"):((r=o.response)==null?void 0:r.status)===403?x("无权限访问此命名空间","PERMISSION_DENIED"):((n=o.response)==null?void 0:n.status)===401?x("认证失败","UNAUTHORIZED"):(console.log(o),x(((i=(s=o.response)==null?void 0:s.data)==null?void 0:i.message)||"获取键名列表失败","NETWORK_ERROR"))}}},v=e=>e,x=(e,t="UNKNOWN_ERROR")=>({success:!1,error:{code:t,message:e}}),eo={loadData:async e=>{const t=S("server.provider");return t==="kv-server"||t==="classworkscloud"?ne.loadData(e):pe.loadData(e)},saveData:async(e,t)=>{const r=S("server.provider");return r==="kv-server"||r==="classworkscloud"?ne.saveData(e,t):pe.saveData(e,t)},loadKeys:async(e={})=>{const t=S("server.provider");return t==="kv-server"||t==="classworkscloud"?ne.loadKeys(e):pe.loadKeys(e)},async getKeyCloudUrl(e,t={}){var s;const{migrateFromLocal:r=!0,autoConfigureCloud:n=!0}=t;try{const i=S("server.provider");let o;i==="classworkscloud"?o=ct():o=S("server.domain");let a=S("server.siteKey");const f=S("device.uuid");let l=!1;if(!o||!f)if(n){const w={"server.domain":"https://kv-service.houlang.cloud","server.siteKey":""};o||(De("server.domain",w["server.domain"]),o=w["server.domain"],l=!0),a||(De("server.siteKey",w["server.siteKey"]),a=w["server.siteKey"]),De("server.provider","classworkscloud"),o=ct()}else return x("云端配置无效,请检查服务器域名和设备UUID","CONFIG_ERROR");let u=!1;if(r)try{const w=await pe.loadData(e);if(w&&w.success!==!1){const d=await ne.loadData(e);if(d&&d.success===!1&&((s=d.error)==null?void 0:s.code)==="NOT_FOUND"){const m=await ne.saveData(e,w);m&&m.success!==!1&&(u=!0,console.log(`已成功将键 ${e} 的数据从本地迁移到云端`))}}}catch(w){console.warn(`迁移键 ${e} 的数据时出错:`,w)}const p=S("server.kvToken");return{success:!0,url:`${o}/kv/${e}?token=${p}`,migrated:u,configured:l}}catch(i){return console.error("获取键云端地址时出错:",i),x(i.message||"获取键云端地址失败","CLOUD_URL_ERROR")}}};export{g as a,D as b,pe as c,eo as d,Ys as e,Us as g,ne as k,Dr as o};
|