@noxickon/onyx 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/Button-CLMaoxRW.js +11054 -0
- package/dist/chunks/Button-CZYAHivj.js +20 -0
- package/dist/chunks/Input-BQQT5eZ0.js +138 -0
- package/dist/chunks/Input-DJZcvJdP.js +1 -0
- package/dist/chunks/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/chunks/_commonjsHelpers-DwGv2jUC.js +1 -0
- package/dist/chunks/constants-B1_n9ezb.js +1 -0
- package/dist/chunks/constants-CDXq37n6.js +4 -0
- package/dist/chunks/index-1-zQ3RaM.js +601 -0
- package/dist/chunks/index-BgUMV1hv.js +2129 -0
- package/dist/chunks/index-CjVXr8mh.js +2 -0
- package/dist/chunks/index-XTQUUzZ1.js +22 -0
- package/dist/chunks/isObject-BDHKUJKN.js +1 -0
- package/dist/chunks/isObject-vmP43YLW.js +6 -0
- package/dist/chunks/jsx-runtime-C5mzlN2N.js +284 -0
- package/dist/chunks/jsx-runtime-DUiatUiq.js +22 -0
- package/dist/chunks/useAuth-C-TIgBfr.js +61 -0
- package/dist/chunks/useAuth-CfKOZqhG.js +10 -0
- package/dist/chunks/useForm-BIKRbGHj.js +3085 -0
- package/dist/chunks/useForm-BZEaiRaa.js +26 -0
- package/dist/chunks/useQuery-B_ce5e8f.js +2 -0
- package/dist/chunks/useQuery-CJdYhuQu.js +1481 -0
- package/dist/context/context.cjs.js +1 -0
- package/dist/context/context.es.js +6 -0
- package/dist/context.d.ts +44 -0
- package/dist/hooks/hooks.cjs.js +6 -0
- package/dist/hooks/hooks.es.js +1917 -0
- package/dist/hooks.d.ts +130 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +148 -110
- package/dist/layout/layout.cjs.js +1 -0
- package/dist/layout/layout.es.js +264 -0
- package/dist/layout.d.ts +89 -0
- package/dist/onyx.cjs.js +12 -0
- package/dist/onyx.es.js +2523 -9494
- package/dist/pages/pages.cjs.js +7 -0
- package/dist/pages/pages.es.js +93 -0
- package/dist/pages.d.ts +14 -0
- package/dist/shared.css +104 -0
- package/package.json +41 -16
- package/dist/onyx.umd.js +0 -42
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../chunks/useAuth-CfKOZqhG.js");exports.OxAuthContext=t.OxAuthContext;exports.OxAuthProvider=t.OxAuthProvider;exports.useOxAuth=t.useOxAuth;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ApolloError } from '@apollo/client';
|
|
2
|
+
import { ApolloQueryResult } from '@apollo/client';
|
|
3
|
+
import { Context } from 'react';
|
|
4
|
+
import { DocumentNode } from '@apollo/client';
|
|
5
|
+
import { JSX } from 'react/jsx-runtime';
|
|
6
|
+
import { OxAuthContextType as OxAuthContextType_2 } from './AuthContext.types';
|
|
7
|
+
import { QueryHookOptions } from '@apollo/client';
|
|
8
|
+
import { ReactNode } from 'react';
|
|
9
|
+
|
|
10
|
+
export declare const OxAuthContext: Context<OxAuthContextType>;
|
|
11
|
+
|
|
12
|
+
export declare type OxAuthContextType = {
|
|
13
|
+
error: ApolloError | null;
|
|
14
|
+
isAdmin: boolean;
|
|
15
|
+
isLoggedIn: boolean;
|
|
16
|
+
loading: boolean;
|
|
17
|
+
refreshUser: () => Promise<ApolloQueryResult<OxGetCurrentUserResponse>> | Promise<void>;
|
|
18
|
+
user: OxUser;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export declare function OxAuthProvider({ adminRole, children, getCurrentUserQuery, options, pollInterval, }: OxAuthProviderProps): JSX.Element;
|
|
22
|
+
|
|
23
|
+
declare interface OxAuthProviderProps {
|
|
24
|
+
adminRole?: string;
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
getCurrentUserQuery?: DocumentNode;
|
|
27
|
+
options?: Omit<QueryHookOptions, 'pollInterval'>;
|
|
28
|
+
pollInterval?: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export declare type OxGetCurrentUserResponse = {
|
|
32
|
+
me: OxUser;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
declare type OxUser = {
|
|
36
|
+
email?: string;
|
|
37
|
+
id: string;
|
|
38
|
+
role: 'user' | 'moderator' | 'admin';
|
|
39
|
+
username?: string;
|
|
40
|
+
} | null;
|
|
41
|
+
|
|
42
|
+
export declare function useOxAuth(): OxAuthContextType_2;
|
|
43
|
+
|
|
44
|
+
export { }
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("../chunks/useForm-BZEaiRaa.js"),v=require("react"),A=require("../chunks/index-CjVXr8mh.js"),I=require("../chunks/useQuery-B_ce5e8f.js");var at=["refetch","reobserve","fetchMore","updateQuery","startPolling","stopPolling","subscribeToMore"];function ct(e,t){var n,r=A.rehacktExports.useRef(void 0),s=A.rehacktExports.useRef(void 0),o=A.rehacktExports.useRef(void 0),i=A.mergeOptions(t,r.current||{}),c=(n=i==null?void 0:i.query)!==null&&n!==void 0?n:e;s.current=t,o.current=c;var f=A.__assign(A.__assign({},i),{skip:!r.current}),u=I.useQueryInternals(c,f),l=u.obsQueryFields,d=u.result,w=u.client,g=u.resultData,p=u.observable,m=u.onQueryExecuted,h=p.options.initialFetchPolicy||I.getDefaultFetchPolicy(f.defaultOptions,w.defaultOptions),R=A.rehacktExports.useReducer(function(C){return C+1},0)[1],E=A.rehacktExports.useMemo(function(){for(var C={},N=function(ge){var it=l[ge];C[ge]=function(){return r.current||(r.current=Object.create(null),R()),it.apply(this,arguments)}},M=0,X=at;M<X.length;M++){var ot=X[M];N(ot)}return C},[R,l]),b=!!r.current,T=A.rehacktExports.useMemo(function(){return A.__assign(A.__assign(A.__assign({},d),E),{called:b})},[d,E,b]),S=A.rehacktExports.useCallback(function(C){r.current=C?A.__assign(A.__assign({},C),{fetchPolicy:C.fetchPolicy||h}):{fetchPolicy:h};var N=A.mergeOptions(s.current,A.__assign({query:o.current},r.current)),M=ut(g,p,w,c,A.__assign(A.__assign({},N),{skip:!1}),m).then(function(X){return Object.assign(X,E)});return M.catch(function(){}),M},[w,c,E,h,p,g,m]),x=A.rehacktExports.useRef(S);q.useIsomorphicLayoutEffect(function(){x.current=S});var L=A.rehacktExports.useCallback(function(){for(var C=[],N=0;N<arguments.length;N++)C[N]=arguments[N];return x.current.apply(x,C)},[]);return[L,T]}function ut(e,t,n,r,s,o){var i=s.query||r,c=I.createMakeWatchQueryOptions(n,i,s,!1)(t),f=t.reobserveAsConcast(I.getObsQueryOptions(t,n,s,c));return o(c),new Promise(function(u){var l;f.subscribe({next:function(d){l=d},error:function(){u(I.toQueryResult(t.getCurrentResult(),e.previousData,t,n))},complete:function(){u(I.toQueryResult(t.maskResult(l),e.previousData,t,n))}})})}const lt=(e,t)=>{const n=r=>e(r);return Object.defineProperty(n,"message",{value:t}),n};function Le(e,t){return function(){return e.apply(t,arguments)}}const{toString:ft}=Object.prototype,{getPrototypeOf:be}=Object,{iterator:ne,toStringTag:De}=Symbol,re=(e=>t=>{const n=ft.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),k=e=>(e=e.toLowerCase(),t=>re(t)===e),se=e=>t=>typeof t===e,{isArray:H}=Array,J=se("undefined");function V(e){return e!==null&&!J(e)&&e.constructor!==null&&!J(e.constructor)&&F(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Be=k("ArrayBuffer");function dt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Be(e.buffer),t}const pt=se("string"),F=se("function"),qe=se("number"),W=e=>e!==null&&typeof e=="object",ht=e=>e===!0||e===!1,G=e=>{if(re(e)!=="object")return!1;const t=be(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(De in e)&&!(ne in e)},mt=e=>{if(!W(e)||V(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},yt=k("Date"),bt=k("File"),wt=k("Blob"),Et=k("FileList"),gt=e=>W(e)&&F(e.pipe),Rt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||F(e.append)&&((t=re(e))==="formdata"||t==="object"&&F(e.toString)&&e.toString()==="[object FormData]"))},St=k("URLSearchParams"),[Ot,Tt,At,xt]=["ReadableStream","Request","Response","Headers"].map(k),Ct=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function K(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),H(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(V(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(r=0;r<i;r++)c=o[r],t.call(null,e[c],c,e)}}function je(e,t){if(V(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const D=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Me=e=>!J(e)&&e!==D;function fe(){const{caseless:e}=Me(this)&&this||{},t={},n=(r,s)=>{const o=e&&je(t,s)||s;G(t[o])&&G(r)?t[o]=fe(t[o],r):G(r)?t[o]=fe({},r):H(r)?t[o]=r.slice():t[o]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&K(arguments[r],n);return t}const Pt=(e,t,n,{allOwnKeys:r}={})=>(K(t,(s,o)=>{n&&F(s)?e[o]=Le(s,n):e[o]=s},{allOwnKeys:r}),e),Ft=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),_t=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Nt=(e,t,n,r)=>{let s,o,i;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&be(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kt=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Ut=e=>{if(!e)return null;if(H(e))return e;let t=e.length;if(!qe(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Lt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&be(Uint8Array)),Dt=(e,t)=>{const r=(e&&e[ne]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},Bt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},qt=k("HTMLFormElement"),jt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Re=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Mt=k("RegExp"),ve=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};K(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},vt=e=>{ve(e,(t,n)=>{if(F(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(F(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},It=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return H(e)?r(e):r(String(e).split(t)),n},Ht=()=>{},zt=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function $t(e){return!!(e&&F(e.append)&&e[De]==="FormData"&&e[ne])}const Jt=e=>{const t=new Array(10),n=(r,s)=>{if(W(r)){if(t.indexOf(r)>=0)return;if(V(r))return r;if(!("toJSON"in r)){t[s]=r;const o=H(r)?[]:{};return K(r,(i,c)=>{const f=n(i,s+1);!J(f)&&(o[c]=f)}),t[s]=void 0,o}}return r};return n(e,0)},Vt=k("AsyncFunction"),Wt=e=>e&&(W(e)||F(e))&&F(e.then)&&F(e.catch),Ie=((e,t)=>e?setImmediate:t?((n,r)=>(D.addEventListener("message",({source:s,data:o})=>{s===D&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),D.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",F(D.postMessage)),Kt=typeof queueMicrotask<"u"?queueMicrotask.bind(D):typeof process<"u"&&process.nextTick||Ie,Qt=e=>e!=null&&F(e[ne]),a={isArray:H,isArrayBuffer:Be,isBuffer:V,isFormData:Rt,isArrayBufferView:dt,isString:pt,isNumber:qe,isBoolean:ht,isObject:W,isPlainObject:G,isEmptyObject:mt,isReadableStream:Ot,isRequest:Tt,isResponse:At,isHeaders:xt,isUndefined:J,isDate:yt,isFile:bt,isBlob:wt,isRegExp:Mt,isFunction:F,isStream:gt,isURLSearchParams:St,isTypedArray:Lt,isFileList:Et,forEach:K,merge:fe,extend:Pt,trim:Ct,stripBOM:Ft,inherits:_t,toFlatObject:Nt,kindOf:re,kindOfTest:k,endsWith:kt,toArray:Ut,forEachEntry:Dt,matchAll:Bt,isHTMLForm:qt,hasOwnProperty:Re,hasOwnProp:Re,reduceDescriptors:ve,freezeMethods:vt,toObjectSet:It,toCamelCase:jt,noop:Ht,toFiniteNumber:zt,findKey:je,global:D,isContextDefined:Me,isSpecCompliantForm:$t,toJSONObject:Jt,isAsyncFn:Vt,isThenable:Wt,setImmediate:Ie,asap:Kt,isIterable:Qt};function y(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}a.inherits(y,Error,{toJSON:function(){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:a.toJSONObject(this.config),code:this.code,status:this.status}}});const He=y.prototype,ze={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{ze[e]={value:e}});Object.defineProperties(y,ze);Object.defineProperty(He,"isAxiosError",{value:!0});y.from=(e,t,n,r,s,o)=>{const i=Object.create(He);return a.toFlatObject(e,i,function(f){return f!==Error.prototype},c=>c!=="isAxiosError"),y.call(i,e.message,t,n,r,s),i.cause=e,i.name=e.name,o&&Object.assign(i,o),i};const Xt=null;function de(e){return a.isPlainObject(e)||a.isArray(e)}function $e(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Se(e,t,n){return e?e.concat(t).map(function(s,o){return s=$e(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function Gt(e){return a.isArray(e)&&!e.some(de)}const Zt=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function oe(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,h){return!a.isUndefined(h[m])});const r=n.metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,f=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(a.isDate(p))return p.toISOString();if(a.isBoolean(p))return p.toString();if(!f&&a.isBlob(p))throw new y("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(p)||a.isTypedArray(p)?f&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function l(p,m,h){let R=p;if(p&&!h&&typeof p=="object"){if(a.endsWith(m,"{}"))m=r?m:m.slice(0,-2),p=JSON.stringify(p);else if(a.isArray(p)&&Gt(p)||(a.isFileList(p)||a.endsWith(m,"[]"))&&(R=a.toArray(p)))return m=$e(m),R.forEach(function(b,T){!(a.isUndefined(b)||b===null)&&t.append(i===!0?Se([m],T,o):i===null?m:m+"[]",u(b))}),!1}return de(p)?!0:(t.append(Se(h,m,o),u(p)),!1)}const d=[],w=Object.assign(Zt,{defaultVisitor:l,convertValue:u,isVisitable:de});function g(p,m){if(!a.isUndefined(p)){if(d.indexOf(p)!==-1)throw Error("Circular reference detected in "+m.join("."));d.push(p),a.forEach(p,function(R,E){(!(a.isUndefined(R)||R===null)&&s.call(t,R,a.isString(E)?E.trim():E,m,w))===!0&&g(R,m?m.concat(E):[E])}),d.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return g(e),t}function Oe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function we(e,t){this._pairs=[],e&&oe(e,this,t)}const Je=we.prototype;Je.append=function(t,n){this._pairs.push([t,n])};Je.toString=function(t){const n=t?function(r){return t.call(this,r,Oe)}:Oe;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Yt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ve(e,t,n){if(!t)return e;const r=n&&n.encode||Yt;a.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(s?o=s(t,n):o=a.isURLSearchParams(t)?t.toString():new we(t,n).toString(r),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Te{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const We={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},en=typeof URLSearchParams<"u"?URLSearchParams:we,tn=typeof FormData<"u"?FormData:null,nn=typeof Blob<"u"?Blob:null,rn={isBrowser:!0,classes:{URLSearchParams:en,FormData:tn,Blob:nn},protocols:["http","https","file","blob","url","data"]},Ee=typeof window<"u"&&typeof document<"u",pe=typeof navigator=="object"&&navigator||void 0,sn=Ee&&(!pe||["ReactNative","NativeScript","NS"].indexOf(pe.product)<0),on=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",an=Ee&&window.location.href||"http://localhost",cn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ee,hasStandardBrowserEnv:sn,hasStandardBrowserWebWorkerEnv:on,navigator:pe,origin:an},Symbol.toStringTag,{value:"Module"})),P={...cn,...rn};function un(e,t){return oe(e,new P.classes.URLSearchParams,{visitor:function(n,r,s,o){return P.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function ln(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function fn(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function Ke(e){function t(n,r,s,o){let i=n[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),f=o>=n.length;return i=!i&&a.isArray(s)?s.length:i,f?(a.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&a.isArray(s[i])&&(s[i]=fn(s[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(ln(r),s,n,0)}),n}return null}function dn(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Q={transitional:We,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=a.isObject(t);if(o&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?JSON.stringify(Ke(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return un(t,this.formSerializer).toString();if((c=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return oe(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),dn(t)):t}],transformResponse:[function(t){const n=this.transitional||Q.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?y.from(c,y.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:P.classes.FormData,Blob:P.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{Q.headers[e]={}});const pn=a.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"]),hn=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
2
|
+
`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&pn[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Ae=Symbol("internals");function $(e){return e&&String(e).trim().toLowerCase()}function Z(e){return e===!1||e==null?e:a.isArray(e)?e.map(Z):String(e)}function mn(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const yn=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ce(e,t,n,r,s){if(a.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!a.isString(t)){if(a.isString(r))return t.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(t)}}function bn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function wn(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}let _=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(c,f,u){const l=$(f);if(!l)throw new Error("header name must be a non-empty string");const d=a.findKey(s,l);(!d||s[d]===void 0||u===!0||u===void 0&&s[d]!==!1)&&(s[d||f]=Z(c))}const i=(c,f)=>a.forEach(c,(u,l)=>o(u,l,f));if(a.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(a.isString(t)&&(t=t.trim())&&!yn(t))i(hn(t),n);else if(a.isObject(t)&&a.isIterable(t)){let c={},f,u;for(const l of t){if(!a.isArray(l))throw TypeError("Object iterator must return a key-value pair");c[u=l[0]]=(f=c[u])?a.isArray(f)?[...f,l[1]]:[f,l[1]]:l[1]}i(c,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=$(t),t){const r=a.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return mn(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=$(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||ce(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=$(i),i){const c=a.findKey(r,i);c&&(!n||ce(r,r[c],c,n))&&(delete r[c],s=!0)}}return a.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||ce(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return a.forEach(this,(s,o)=>{const i=a.findKey(r,o);if(i){n[i]=Z(s),delete n[o];return}const c=t?bn(o):String(o).trim();c!==o&&delete n[o],n[c]=Z(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
3
|
+
`)}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,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Ae]=this[Ae]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=$(i);r[c]||(wn(s,i),r[c]=!0)}return a.isArray(t)?t.forEach(o):o(t),this}};_.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(_.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(_);function ue(e,t){const n=this||Q,r=t||n,s=_.from(r.headers);let o=r.data;return a.forEach(e,function(c){o=c.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Qe(e){return!!(e&&e.__CANCEL__)}function z(e,t,n){y.call(this,e??"canceled",y.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(z,y,{__CANCEL__:!0});function Xe(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new y("Request failed with status code "+n.status,[y.ERR_BAD_REQUEST,y.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function En(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function gn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(f){const u=Date.now(),l=r[o];i||(i=u),n[s]=f,r[s]=u;let d=o,w=0;for(;d!==s;)w+=n[d++],d=d%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i<t)return;const g=l&&u-l;return g?Math.round(w*1e3/g):void 0}}function Rn(e,t){let n=0,r=1e3/t,s,o;const i=(u,l=Date.now())=>{n=l,s=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const l=Date.now(),d=l-n;d>=r?i(u,l):(s=u,o||(o=setTimeout(()=>{o=null,i(s)},r-d)))},()=>s&&i(s)]}const ee=(e,t,n=3)=>{let r=0;const s=gn(50,250);return Rn(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,f=i-r,u=s(f),l=i<=c;r=i;const d={loaded:i,total:c,progress:c?i/c:void 0,bytes:f,rate:u||void 0,estimated:u&&c&&l?(c-i)/u:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(d)},n)},xe=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ce=e=>(...t)=>a.asap(()=>e(...t)),Sn=P.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,P.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(P.origin),P.navigator&&/(msie|trident)/i.test(P.navigator.userAgent)):()=>!0,On=P.hasStandardBrowserEnv?{write(e,t,n,r,s,o){const i=[e+"="+encodeURIComponent(t)];a.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),a.isString(r)&&i.push("path="+r),a.isString(s)&&i.push("domain="+s),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Tn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function An(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Ge(e,t,n){let r=!Tn(t);return e&&(r||n==!1)?An(e,t):t}const Pe=e=>e instanceof _?{...e}:e;function j(e,t){t=t||{};const n={};function r(u,l,d,w){return a.isPlainObject(u)&&a.isPlainObject(l)?a.merge.call({caseless:w},u,l):a.isPlainObject(l)?a.merge({},l):a.isArray(l)?l.slice():l}function s(u,l,d,w){if(a.isUndefined(l)){if(!a.isUndefined(u))return r(void 0,u,d,w)}else return r(u,l,d,w)}function o(u,l){if(!a.isUndefined(l))return r(void 0,l)}function i(u,l){if(a.isUndefined(l)){if(!a.isUndefined(u))return r(void 0,u)}else return r(void 0,l)}function c(u,l,d){if(d in t)return r(u,l);if(d in e)return r(void 0,u)}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:c,headers:(u,l,d)=>s(Pe(u),Pe(l),d,!0)};return a.forEach(Object.keys({...e,...t}),function(l){const d=f[l]||s,w=d(e[l],t[l],l);a.isUndefined(w)&&d!==c||(n[l]=w)}),n}const Ze=e=>{const t=j({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=t;t.headers=i=_.from(i),t.url=Ve(Ge(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let f;if(a.isFormData(n)){if(P.hasStandardBrowserEnv||P.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((f=i.getContentType())!==!1){const[u,...l]=f?f.split(";").map(d=>d.trim()).filter(Boolean):[];i.setContentType([u||"multipart/form-data",...l].join("; "))}}if(P.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&Sn(t.url))){const u=s&&o&&On.read(o);u&&i.set(s,u)}return t},xn=typeof XMLHttpRequest<"u",Cn=xn&&function(e){return new Promise(function(n,r){const s=Ze(e);let o=s.data;const i=_.from(s.headers).normalize();let{responseType:c,onUploadProgress:f,onDownloadProgress:u}=s,l,d,w,g,p;function m(){g&&g(),p&&p(),s.cancelToken&&s.cancelToken.unsubscribe(l),s.signal&&s.signal.removeEventListener("abort",l)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function R(){if(!h)return;const b=_.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),S={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:b,config:e,request:h};Xe(function(L){n(L),m()},function(L){r(L),m()},S),h=null}"onloadend"in h?h.onloadend=R:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(R)},h.onabort=function(){h&&(r(new y("Request aborted",y.ECONNABORTED,e,h)),h=null)},h.onerror=function(){r(new y("Network Error",y.ERR_NETWORK,e,h)),h=null},h.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const S=s.transitional||We;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),r(new y(T,S.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,e,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&a.forEach(i.toJSON(),function(T,S){h.setRequestHeader(S,T)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),u&&([w,p]=ee(u,!0),h.addEventListener("progress",w)),f&&h.upload&&([d,g]=ee(f),h.upload.addEventListener("progress",d),h.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(l=b=>{h&&(r(!b||b.type?new z(null,e,h):b),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(l),s.signal&&(s.signal.aborted?l():s.signal.addEventListener("abort",l)));const E=En(s.url);if(E&&P.protocols.indexOf(E)===-1){r(new y("Unsupported protocol "+E+":",y.ERR_BAD_REQUEST,e));return}h.send(o||null)})},Pn=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const o=function(u){if(!s){s=!0,c();const l=u instanceof Error?u:this.reason;r.abort(l instanceof y?l:new z(l instanceof Error?l.message:l))}};let i=t&&setTimeout(()=>{i=null,o(new y(`timeout ${t} of ms exceeded`,y.ETIMEDOUT))},t);const c=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:f}=r;return f.unsubscribe=()=>a.asap(c),f}},Fn=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},_n=async function*(e,t){for await(const n of Nn(e))yield*Fn(n,t)},Nn=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},Fe=(e,t,n,r)=>{const s=_n(e,t);let o=0,i,c=f=>{i||(i=!0,r&&r(f))};return new ReadableStream({async pull(f){try{const{done:u,value:l}=await s.next();if(u){c(),f.close();return}let d=l.byteLength;if(n){let w=o+=d;n(w)}f.enqueue(new Uint8Array(l))}catch(u){throw c(u),u}},cancel(f){return c(f),s.return()}},{highWaterMark:2})},ie=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Ye=ie&&typeof ReadableStream=="function",kn=ie&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),et=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Un=Ye&&et(()=>{let e=!1;const t=new Request(P.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),_e=64*1024,he=Ye&&et(()=>a.isReadableStream(new Response("").body)),te={stream:he&&(e=>e.body)};ie&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!te[t]&&(te[t]=a.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new y(`Response type '${t}' is not supported`,y.ERR_NOT_SUPPORT,r)})})})(new Response);const Ln=async e=>{if(e==null)return 0;if(a.isBlob(e))return e.size;if(a.isSpecCompliantForm(e))return(await new Request(P.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(a.isArrayBufferView(e)||a.isArrayBuffer(e))return e.byteLength;if(a.isURLSearchParams(e)&&(e=e+""),a.isString(e))return(await kn(e)).byteLength},Dn=async(e,t)=>{const n=a.toFiniteNumber(e.getContentLength());return n??Ln(t)},Bn=ie&&(async e=>{let{url:t,method:n,data:r,signal:s,cancelToken:o,timeout:i,onDownloadProgress:c,onUploadProgress:f,responseType:u,headers:l,withCredentials:d="same-origin",fetchOptions:w}=Ze(e);u=u?(u+"").toLowerCase():"text";let g=Pn([s,o&&o.toAbortSignal()],i),p;const m=g&&g.unsubscribe&&(()=>{g.unsubscribe()});let h;try{if(f&&Un&&n!=="get"&&n!=="head"&&(h=await Dn(l,r))!==0){let S=new Request(t,{method:"POST",body:r,duplex:"half"}),x;if(a.isFormData(r)&&(x=S.headers.get("content-type"))&&l.setContentType(x),S.body){const[L,C]=xe(h,ee(Ce(f)));r=Fe(S.body,_e,L,C)}}a.isString(d)||(d=d?"include":"omit");const R="credentials"in Request.prototype;p=new Request(t,{...w,signal:g,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:R?d:void 0});let E=await fetch(p,w);const b=he&&(u==="stream"||u==="response");if(he&&(c||b&&m)){const S={};["status","statusText","headers"].forEach(N=>{S[N]=E[N]});const x=a.toFiniteNumber(E.headers.get("content-length")),[L,C]=c&&xe(x,ee(Ce(c),!0))||[];E=new Response(Fe(E.body,_e,L,()=>{C&&C(),m&&m()}),S)}u=u||"text";let T=await te[a.findKey(te,u)||"text"](E,e);return!b&&m&&m(),await new Promise((S,x)=>{Xe(S,x,{data:T,headers:_.from(E.headers),status:E.status,statusText:E.statusText,config:e,request:p})})}catch(R){throw m&&m(),R&&R.name==="TypeError"&&/Load failed|fetch/i.test(R.message)?Object.assign(new y("Network Error",y.ERR_NETWORK,e,p),{cause:R.cause||R}):y.from(R,R&&R.code,e,p)}}),me={http:Xt,xhr:Cn,fetch:Bn};a.forEach(me,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ne=e=>`- ${e}`,qn=e=>a.isFunction(e)||e===null||e===!1,tt={getAdapter:e=>{e=a.isArray(e)?e:[e];const{length:t}=e;let n,r;const s={};for(let o=0;o<t;o++){n=e[o];let i;if(r=n,!qn(n)&&(r=me[(i=String(n)).toLowerCase()],r===void 0))throw new y(`Unknown adapter '${i}'`);if(r)break;s[i||"#"+o]=r}if(!r){const o=Object.entries(s).map(([c,f])=>`adapter ${c} `+(f===!1?"is not supported by the environment":"is not available in the build"));let i=t?o.length>1?`since :
|
|
4
|
+
`+o.map(Ne).join(`
|
|
5
|
+
`):" "+Ne(o[0]):"as no adapter specified";throw new y("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:me};function le(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new z(null,e)}function ke(e){return le(e),e.headers=_.from(e.headers),e.data=ue.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),tt.getAdapter(e.adapter||Q.adapter)(e).then(function(r){return le(e),r.data=ue.call(e,e.transformResponse,r),r.headers=_.from(r.headers),r},function(r){return Qe(r)||(le(e),r&&r.response&&(r.response.data=ue.call(e,e.transformResponse,r.response),r.response.headers=_.from(r.response.headers))),Promise.reject(r)})}const nt="1.11.0",ae={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ae[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Ue={};ae.transitional=function(t,n,r){function s(o,i){return"[Axios v"+nt+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,c)=>{if(t===!1)throw new y(s(i," has been removed"+(n?" in "+n:"")),y.ERR_DEPRECATED);return n&&!Ue[i]&&(Ue[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,c):!0}};ae.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function jn(e,t,n){if(typeof e!="object")throw new y("options must be an object",y.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const c=e[o],f=c===void 0||i(c,o,e);if(f!==!0)throw new y("option "+o+" must be "+f,y.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new y("Unknown option "+o,y.ERR_BAD_OPTION)}}const Y={assertOptions:jn,validators:ae},U=Y.validators;let B=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Te,response:new Te}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
6
|
+
`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=j(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&Y.assertOptions(r,{silentJSONParsing:U.transitional(U.boolean),forcedJSONParsing:U.transitional(U.boolean),clarifyTimeoutError:U.transitional(U.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:Y.assertOptions(s,{encode:U.function,serialize:U.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Y.assertOptions(n,{baseUrl:U.spelling("baseURL"),withXsrfToken:U.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[n.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],p=>{delete o[p]}),n.headers=_.concat(i,o);const c=[];let f=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(f=f&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let l,d=0,w;if(!f){const p=[ke.bind(this),void 0];for(p.unshift(...c),p.push(...u),w=p.length,l=Promise.resolve(n);d<w;)l=l.then(p[d++],p[d++]);return l}w=c.length;let g=n;for(d=0;d<w;){const p=c[d++],m=c[d++];try{g=p(g)}catch(h){m.call(this,h);break}}try{l=ke.call(this,g)}catch(p){return Promise.reject(p)}for(d=0,w=u.length;d<w;)l=l.then(u[d++],u[d++]);return l}getUri(t){t=j(this.defaults,t);const n=Ge(t.baseURL,t.url,t.allowAbsoluteUrls);return Ve(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){B.prototype[t]=function(n,r){return this.request(j(r||{},{method:t,url:n,data:(r||{}).data}))}});a.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,c){return this.request(j(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}B.prototype[t]=n(),B.prototype[t+"Form"]=n(!0)});let Mn=class rt{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new z(o,i,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new rt(function(s){t=s}),cancel:t}}};function vn(e){return function(n){return e.apply(null,n)}}function In(e){return a.isObject(e)&&e.isAxiosError===!0}const ye={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ye).forEach(([e,t])=>{ye[t]=e});function st(e){const t=new B(e),n=Le(B.prototype.request,t);return a.extend(n,B.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return st(j(e,s))},n}const O=st(Q);O.Axios=B;O.CanceledError=z;O.CancelToken=Mn;O.isCancel=Qe;O.VERSION=nt;O.toFormData=oe;O.AxiosError=y;O.Cancel=O.CanceledError;O.all=function(t){return Promise.all(t)};O.spread=vn;O.isAxiosError=In;O.mergeConfig=j;O.AxiosHeaders=_;O.formToJSON=e=>Ke(a.isHTMLForm(e)?new FormData(e):e);O.getAdapter=tt.getAdapter;O.HttpStatusCode=ye;O.default=O;const{Axios:Vn,AxiosError:Wn,CanceledError:Kn,isCancel:Qn,CancelToken:Xn,VERSION:Gn,all:Zn,Cancel:Yn,isAxiosError:er,spread:tr,toFormData:nr,AxiosHeaders:rr,HttpStatusCode:sr,formToJSON:or,getAdapter:ir,mergeConfig:ar}=O,Hn=({endpoint:e,headers:t={},initialData:n,validationRules:r})=>{const s=q.useFormState({initialData:n,validationRules:r}),[o,i]=v.useState(!1),c=v.useRef(null),f=v.useCallback((l={})=>{const{onBefore:d=()=>{},onCancel:w=()=>{},onError:g=()=>{},onFinish:p=()=>{},onSuccess:m=()=>{},onUpload:h=()=>{},skipValidation:R=!1}=l;if(!R&&!s.validate())return;const E=new FormData;Object.entries(s.data).forEach(([b,T])=>{Array.isArray(T)?T.forEach(S=>{S instanceof File?E.append(b,S):E.append(b,String(S))}):T instanceof File?E.append(b,T):E.append(b,String(T))}),d==null||d(),i(!0),c.current=new AbortController,O.post(e,E,{headers:{"Content-Type":"multipart/form-data",...t},signal:c.current.signal,onUploadProgress:b=>{h==null||h(b)}}).then(b=>{m==null||m(b)}).catch(b=>{O.isCancel(b)?w==null||w(b):g==null||g(b)}).finally(()=>{p==null||p(),i(!1),c.current=null})},[e,t,s]),u=v.useCallback(()=>{c.current&&c.current.abort("Upload cancelled by user")},[]);return{...s,upload:f,isUploading:o,cancel:u}},zn=({headers:e={},initialData:t,options:n={},query:r,validationRules:s})=>{const{data:o,setData:i,validate:c,...f}=q.useFormState({initialData:t,validationRules:s}),[u,{data:l,error:d,loading:w,refetch:g}]=ct(r,{fetchPolicy:"network-only",errorPolicy:"all",notifyOnNetworkStatusChange:!0,...n}),p=v.useCallback((h={})=>{const{onBefore:R=()=>{},onError:E=()=>{},onFinish:b=()=>{},onSuccess:T=()=>{},skipValidation:S=!1}=h;!S&&!c()||(R==null||R(),u({variables:{filters:o},...!q.isEmpty(e)&&{context:{headers:e}}}).then(x=>{T==null||T(x)}).catch(x=>{E==null||E(x)}).finally(()=>{b==null||b()}))},[o,u,e,c]),m=v.useCallback(()=>{g&&g({filters:o})},[g,o]);return{...f,validate:c,filter:o,setFilter:i,isLoading:w,query:p,refetch:m,data:l,error:d}};exports.handleRules=q.handleRules;exports.useForm=q.useForm;exports.useFormState=q.useFormState;exports.useFileUpload=Hn;exports.useFilter=zn;exports.validator=lt;
|