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

7 lines
50 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 Sr,s as De}from"./index-BnH4zeyR.js";import{i as ee,t as te,g as ut}from"./serverRotation-CKkcADIS.js";const Le=(e,t)=>t.some(r=>e instanceof r);let lt,ft;function Or(){return lt||(lt=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Ar(){return ft||(ft=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Ie=new WeakMap,Ne=new WeakMap,Ee=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 Ee.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 Ft(e){je=e(je)}function _r(e){return Ar().includes(e)?function(...t){return e.apply($e(this),t),z(this.request)}:function(...t){return z(e.apply($e(this),t))}}function Cr(e){return typeof e=="function"?_r(e):(e instanceof IDBTransaction&&Tr(e),Le(e,Or())?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=Cr(e);return t!==e&&(Ne.set(e,t),Ee.set(t,e)),t}const $e=e=>Ee.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 dt(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}Ft(e=>({...e,get:(t,r,n)=>dt(t,r)||e.get(t,r,n),has:(t,r)=>!!dt(t,r)||e.has(t,r)}));const Pr=["continue","continuePrimaryKey","advance"],pt={},Me=new WeakMap,Lt=new WeakMap,vr={get(e,t){if(!Pr.includes(t))return e[t];let r=pt[t];return r||(r=pt[t]=function(...n){Me.set(this,Lt.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(Lt.set(r,t),Ee.set(r,$e(t));t;)yield r,t=await(Me.get(r)||t.continue()),Me.delete(r)}function ht(e,t){return t===Symbol.asyncIterator&&Le(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&Le(e,[IDBIndex,IDBObjectStore])}Ft(e=>({...e,get(t,r,n){return ht(t,r)?Br:e.get(t,r,n)},has(t,r){return ht(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?k(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),k(!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),h={keys:u,total_rows:l,current_page:{limit:o,skip:a,count:u.length},load_more:null};return k(h)}catch(t){return x("获取本地键名列表失败:"+t.message)}}};function It(e,t){return function(){return e.apply(t,arguments)}}const{toString:Lr}=Object.prototype,{getPrototypeOf:Xe}=Object,{iterator:Se,toStringTag:jt}=Symbol,Oe=(e=>t=>{const r=Lr.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 $t=L("ArrayBuffer");function Ir(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&$t(e.buffer),t}const jr=Ae("string"),C=Ae("function"),Mt=Ae("number"),ie=e=>e!==null&&typeof e=="object",$r=e=>e===!0||e===!1,ye=e=>{if(Oe(e)!=="object")return!1;const t=Xe(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(jt 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=L("Date"),qr=L("File"),Kr=L("Blob"),zr=L("FileList"),Vr=e=>ie(e)&&C(e.pipe),Wr=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||C(e.append)&&((t=Oe(e))==="formdata"||t==="object"&&C(e.toString)&&e.toString()==="[object FormData]"))},Jr=L("URLSearchParams"),[Xr,Zr,Gr,Qr]=["ReadableStream","Request","Response","Headers"].map(L),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 Ht(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,qt=e=>!Z(e)&&e!==K;function He(){const{caseless:e,skipUndefined:t}=qt(this)&&this||{},r={},n=(s,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const o=e&&Ht(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:It(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(!Mt(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=L("HTMLFormElement"),fn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),mt=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),dn=L("RegExp"),Kt=(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=>{Kt(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[jt]==="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=L("AsyncFunction"),Rn=e=>e&&(ie(e)||C(e))&&C(e.then)&&C(e.catch),zt=((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)),En=typeof queueMicrotask<"u"?queueMicrotask.bind(K):typeof process<"u"&&process.nextTick||zt,Sn=e=>e!=null&&C(e[Se]),c={isArray:G,isArrayBuffer:$t,isBuffer:oe,isFormData:Wr,isArrayBufferView:Ir,isString:jr,isNumber:Mt,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:Oe,kindOfTest:L,endsWith:sn,toArray:on,forEachEntry:cn,matchAll:un,isHTMLForm:ln,hasOwnProperty:mt,hasOwnProp:mt,reduceDescriptors:Kt,freezeMethods:pn,toObjectSet:hn,toCamelCase:fn,noop:mn,toFiniteNumber:yn,findKey:Ht,global:K,isContextDefined:qt,isSpecCompliantForm:bn,toJSONObject:wn,isAsyncFn:gn,isThenable:Rn,setImmediate:zt,asap:En,isIterable:Sn};let y=class Vt extends Error{static from(t,r,n,s,i,o){const a=new Vt(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 On=null;function qe(e){return c.isPlainObject(e)||c.isArray(e)}function Wt(e){return c.endsWith(e,"[]")?e.slice(0,-2):e}function yt(e,t,r){return e?e.concat(t).map(function(s,i){return s=Wt(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function An(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,p){return!c.isUndefined(p[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,p){let R=d;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)&&An(d)||(c.isFileList(d)||c.endsWith(m,"[]"))&&(R=c.toArray(d)))return m=Wt(m),R.forEach(function(E,T){!(c.isUndefined(E)||E===null)&&t.append(o===!0?yt([m],T,i):o===null?m:m+"[]",l(E))}),!1}return qe(d)?!0:(t.append(yt(p,m,i),l(d)),!1)}const h=[],b=Object.assign(xn,{defaultVisitor:u,convertValue:l,isVisitable:qe});function w(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,U){(!(c.isUndefined(R)||R===null)&&s.call(t,R,c.isString(U)?U.trim():U,m,b))===!0&&w(R,m?m.concat(U):[U])}),h.pop()}}if(!c.isObject(e))throw new TypeError("data must be an object");return w(e),t}function bt(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 Jt=Ze.prototype;Jt.append=function(t,r){this._pairs.push([t,r])};Jt.toString=function(t){const r=t?function(n){return t.call(this,n,bt)}:bt;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 Xt(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 wt{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 Ge={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},_n=typeof URLSearchParams<"u"?URLSearchParams:Ze,Cn=typeof FormData<"u"?FormData:null,Dn=typeof Blob<"u"?Blob:null,Nn={isBrowser:!0,classes:{URLSearchParams:_n,FormData:Cn,Blob:Dn},protocols:["http","https","file","blob","url","data"]},Qe=typeof window<"u"&&typeof document<"u",Ke=typeof navigator=="object"&&navigator||void 0,Un=Qe&&(!Ke||["ReactNative","NativeScript","NS"].indexOf(Ke.product)<0),Pn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",vn=Qe&&window.location.href||"http://localhost",Bn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Qe,hasStandardBrowserEnv:Un,hasStandardBrowserWebWorkerEnv:Pn,navigator:Ke,origin:vn},Symbol.toStringTag,{value:"Module"})),A={...Bn,...Nn};function kn(e,t){return xe(e,new A.classes.URLSearchParams,{visitor:function(r,n,s,i){return A.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:Ge,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: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 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},gt=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 D=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 h=c.findKey(s,u);(!h||s[h]===void 0||l===!0||l===void 0&&s[h]!==!1)&&(s[h||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[gt]=this[gt]={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}};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 Be(e,t){const r=this||ce,n=t||r,s=D.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 h=i,b=0;for(;h!==s;)b+=r[h++],h=h%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(),h=u-r;h>=n?o(l,u):(s=l,i||(i=setTimeout(()=>{i=null,o(s)},n-h)))},()=>s&&o(s)]}const Re=(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 h={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(h)},r)},Rt=(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=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,Xn=A.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 typeof e!="string"?!1:/^([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 St=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 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,h){if(h in t)return n(l,u);if(h 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,h)=>s(St(l),St(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 er=e=>{const t=W({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=t;if(t.headers=o=D.from(o),t.url=Xt(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(A.hasStandardBrowserEnv||A.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,h])=>{l.includes(u.toLowerCase())&&o.set(u,h)})}}if(A.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=D.from(s.headers).normalize();let{responseType:a,onUploadProgress:f,onDownloadProgress:l}=s,u,h,b,w,d;function m(){w&&w(),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};Qt(function(P){r(P),m()},function(P){n(P),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||Ge;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),n(new y(T,B.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,e,p)),p=null},i===void 0&&o.setContentType(null),"setRequestHeader"in p&&c.forEach(o.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,w]=Re(f),p.upload.addEventListener("progress",h),p.upload.addEventListener("loadend",w)),(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 U=zn(s.url);if(U&&A.protocols.indexOf(U)===-1){n(new y("Unsupported protocol "+U+":",y.ERR_BAD_REQUEST,e));return}p.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()}},Ot=(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 h=u.byteLength;if(r){let b=i+=h;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:xt,TextEncoder:Tt}=c.global,_t=(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(xt),f=s&&(typeof Tt=="function"?(d=>m=>d.encode(m))(new Tt):async d=>new Uint8Array(await new r(d).arrayBuffer())),l=i&&a&&_t(()=>{let d=!1;const m=new r(A.origin,{body:new xt,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!m}),u=o&&a&&_t(()=>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},w=async(d,m)=>{const p=c.toFiniteNumber(d.getContentLength());return p??b(m)};return async d=>{let{url:m,method:p,data:R,signal:U,cancelToken:E,timeout:T,onDownloadProgress:B,onUploadProgress:H,responseType:P,headers:_e,withCredentials:le="same-origin",fetchOptions:nt}=er(d),st=t||fetch;P=P?(P+"").toLowerCase():"text";let fe=es([U,E&&E.toAbortSignal()],T),Y=null;const q=fe&&fe.unsubscribe&&(()=>{fe.unsubscribe()});let ot;try{if(H&&l&&p!=="get"&&p!=="head"&&(ot=await w(_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]=Rt(ot,Re(Et(H)));R=Ot(M.body,At,Ce,de)}}c.isString(le)||(le=le?"include":"omit");const _=i&&"credentials"in r.prototype,it={...nt,signal:fe,method:p.toUpperCase(),headers:_e.normalize().toJSON(),body:R,duplex:"half",credentials:_?le:void 0};Y=i&&new r(m,it);let $=await(i?st(Y,nt):st(m,it));const at=u&&(P==="stream"||P==="response");if(u&&(B||at&&q)){const M={};["status","statusText","headers"].forEach(ct=>{M[ct]=$[ct]});const J=c.toFiniteNumber($.headers.get("content-length")),[Ce,de]=B&&Rt(J,Re(Et(B),!0))||[];$=new n(Ot($.body,At,Ce,()=>{de&&de(),q&&q()}),M)}P=P||"text";let Er=await h[c.findKey(h,P)||"text"]($,d);return!at&&q&&q(),await new Promise((M,J)=>{Qt(M,J,{data:Er,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)}}},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 Ye={http:On,xhr:Yn,fetch:{get:tr}};c.forEach(Ye,(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=Ye[(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:Ye};function ke(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ue(null,e)}function Dt(e){return ke(e),e.headers=D.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=D.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=D.from(n.response.headers))),Promise.reject(n)})}const nr="1.13.5",Te={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Te[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Nt={};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&&!Nt[o]&&(Nt[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},v=we.validators;let V=class{constructor(t){this.defaults=t||{},this.interceptors={request:new wt,response:new wt}}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: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}:we.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),we.assertOptions(r,{baseUrl:v.spelling("baseURL"),withXsrfToken:v.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=D.concat(o,i);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||Ge;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=[Dt.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 w=r;for(;h<b;){const d=a[h++],m=a[h++];try{w=d(w)}catch(p){m.call(this,p);break}}try{u=Dt.call(this,w)}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=Yt(t.baseURL,t.url,t.allowAbsoluteUrls);return Xt(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=It(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=D;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=F(I(e,`${n}limit`)),i=F(I(e,`${n}used`))||F(I(e,`${n}observed`)),o=F(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=Rs(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=F((t=hs.exec(e))==null?void 0:t[1]),i=F((r=ms.exec(e))==null?void 0:r[1]),o=F((n=ys.exec(e))==null?void 0:n[1]),a=et(o);return{limit:s,used:s-i,remaining:i,reset:a}}function et(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 ir(e){return new Date(e)}function Ve(e){const t=F(e);return new Date(t*1e3)}function ar(e){const t=F(e);return et(t)}function ws(e){const t=F(e);return et(t/1e3)}var gs=/[a-z]/i;function Rs(e){if(gs.test(e))return ir(e);const t=F(e);return t&&t>1e9?Ve(t):ar(t)}const cr="3.7.8",Es=cr,Q=typeof Buffer=="function",Ut=typeof TextDecoder=="function"?new TextDecoder:void 0,Pt=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),Os=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,O=String.fromCharCode.bind(String),vt=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},tt=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(O.apply(null,e.subarray(n,n+4096)));return tt(r.join(""))},ge=(e,t=!1)=>t?ur(We(e)):We(e),As=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)}},xs=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,dr=e=>e.replace(xs,As),Bt=Q?e=>Buffer.from(e,"utf8").toString("base64"):Pt?e=>We(Pt.encode(e)):e=>tt(dr(e)),X=(e,t=!1)=>t?ur(Bt(e)):Bt(e),kt=e=>X(e,!0),Ts=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,_s=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))}},pr=e=>e.replace(Ts,_s),hr=e=>{if(e=e.replace(/\s+/g,""),!Os.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(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("")},rt=typeof atob=="function"?e=>atob(lr(e)):Q?e=>Buffer.from(e,"base64").toString("binary"):hr,mr=Q?e=>vt(Buffer.from(e,"base64")):e=>vt(rt(e).split("").map(t=>t.charCodeAt(0))),yr=e=>mr(br(e)),Cs=Q?e=>Buffer.from(e,"base64").toString("utf8"):Ut?e=>Ut.decode(mr(e)):e=>pr(rt(e)),br=e=>lr(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),Je=e=>Cs(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)})},Rr=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(),Rr()},Us={version:cr,VERSION:Es,atob:rt,atobPolyfill:hr,btoa:tt,btoaPolyfill:fr,fromBase64:Je,toBase64:X,encode:X,encodeURI:kt,encodeURL:kt,utob:dr,btou:pr,decode:Je,isValid:Ds,fromUint8Array:ge,toUint8Array:yr,extendString:gr,extendUint8Array:Rr,extendBuiltins:Ns},N=g.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"]=Us.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=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: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 i=await N.get(`${s}/kv/_info`,{headers:j()});return k(i.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 i=>await N.put(`${i}/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 o=>{const a=await N.get(`${o}/kv/${e}`,{headers:j()});return k(a.data)});const s=S("server.domain"),i=await N.get(`${s}/kv/${e}`,{headers:j()});return k(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 N.post(`${i}/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,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 N.get(`${w}/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(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"))}}},k=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=ut():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=ut()}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 h=S("server.kvToken");return{success:!0,url:`${o}/kv/${e}?token=${h}`,migrated:u,configured:l}}catch(i){return console.error("获取键云端地址时出错:",i),x(i.message||"获取键云端地址失败","CLOUD_URL_ERROR")}}};export{g as a,N as b,pe as c,eo as d,Ys as e,Us as g,ne as k,Dr as o};