1
0
mirror of https://github.com/ZeroCatDev/Classworks.git synced 2026-03-21 09:13:10 +00:00
Classworks/assets/dataProvider-B62Oym03.js

7 lines
51 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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