@neuctra/authix 2.0.1 → 3.0.0

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.
Files changed (32) hide show
  1. package/README.md +14 -28
  2. package/dist/index.d.ts +0 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/neuctra-authix.es.js +1112 -5347
  5. package/dist/neuctra-authix.umd.js +6 -281
  6. package/package.json +6 -28
  7. package/dist/react/Provider/AuthixProvider.d.ts +0 -9
  8. package/dist/react/Provider/AuthixProvider.d.ts.map +0 -1
  9. package/dist/react/SignedIn.d.ts +0 -8
  10. package/dist/react/SignedIn.d.ts.map +0 -1
  11. package/dist/react/SignedOut.d.ts +0 -8
  12. package/dist/react/SignedOut.d.ts.map +0 -1
  13. package/dist/react/UserButton.d.ts +0 -31
  14. package/dist/react/UserButton.d.ts.map +0 -1
  15. package/dist/react/UserLogin.d.ts +0 -15
  16. package/dist/react/UserLogin.d.ts.map +0 -1
  17. package/dist/react/UserProfile.d.ts +0 -90
  18. package/dist/react/UserProfile.d.ts.map +0 -1
  19. package/dist/react/UserSignUp.d.ts +0 -19
  20. package/dist/react/UserSignUp.d.ts.map +0 -1
  21. package/dist/react/UserVerify.d.ts +0 -43
  22. package/dist/react/UserVerify.d.ts.map +0 -1
  23. package/dist/react/components/AvatarModal.d.ts +0 -66
  24. package/dist/react/components/AvatarModal.d.ts.map +0 -1
  25. package/dist/react/components/ChangePasswordModal.d.ts +0 -60
  26. package/dist/react/components/ChangePasswordModal.d.ts.map +0 -1
  27. package/dist/react/components/DeleteAccountModal.d.ts +0 -75
  28. package/dist/react/components/DeleteAccountModal.d.ts.map +0 -1
  29. package/dist/react/components/EmailVerificationModal.d.ts +0 -76
  30. package/dist/react/components/EmailVerificationModal.d.ts.map +0 -1
  31. package/dist/react/index.d.ts +0 -9
  32. package/dist/react/index.d.ts.map +0 -1
@@ -1,281 +1,6 @@
1
- (function(pe,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],y):(pe=typeof globalThis<"u"?globalThis:pe||self,y(pe.NeuctraAuthix={},pe.React))})(this,(function(pe,y){"use strict";function Xt(t,e){return function(){return t.apply(e,arguments)}}const{toString:ss}=Object.prototype,{getPrototypeOf:$t}=Object,{iterator:nt,toStringTag:Gt}=Symbol,at=(t=>e=>{const r=ss.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),ge=t=>(t=t.toLowerCase(),e=>at(e)===t),ot=t=>e=>typeof e===t,{isArray:Me}=Array,Be=ot("undefined");function Ke(t){return t!==null&&!Be(t)&&t.constructor!==null&&!Be(t.constructor)&&me(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Zt=ge("ArrayBuffer");function ns(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Zt(t.buffer),e}const as=ot("string"),me=ot("function"),Qt=ot("number"),Xe=t=>t!==null&&typeof t=="object",os=t=>t===!0||t===!1,it=t=>{if(at(t)!=="object")return!1;const e=$t(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Gt in t)&&!(nt in t)},is=t=>{if(!Xe(t)||Ke(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},ls=ge("Date"),cs=ge("File"),ds=ge("Blob"),us=ge("FileList"),fs=t=>Xe(t)&&me(t.pipe),ps=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||me(t.append)&&((e=at(t))==="formdata"||e==="object"&&me(t.toString)&&t.toString()==="[object FormData]"))},ms=ge("URLSearchParams"),[hs,xs,ys,gs]=["ReadableStream","Request","Response","Headers"].map(ge),bs=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ge(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let s,a;if(typeof t!="object"&&(t=[t]),Me(t))for(s=0,a=t.length;s<a;s++)e.call(null,t[s],s,t);else{if(Ke(t))return;const o=r?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let l;for(s=0;s<i;s++)l=o[s],e.call(null,t[l],l,t)}}function er(t,e){if(Ke(t))return null;e=e.toLowerCase();const r=Object.keys(t);let s=r.length,a;for(;s-- >0;)if(a=r[s],e===a.toLowerCase())return a;return null}const Re=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,tr=t=>!Be(t)&&t!==Re;function St(){const{caseless:t,skipUndefined:e}=tr(this)&&this||{},r={},s=(a,o)=>{const i=t&&er(r,o)||o;it(r[i])&&it(a)?r[i]=St(r[i],a):it(a)?r[i]=St({},a):Me(a)?r[i]=a.slice():(!e||!Be(a))&&(r[i]=a)};for(let a=0,o=arguments.length;a<o;a++)arguments[a]&&Ge(arguments[a],s);return r}const ws=(t,e,r,{allOwnKeys:s}={})=>(Ge(e,(a,o)=>{r&&me(a)?t[o]=Xt(a,r):t[o]=a},{allOwnKeys:s}),t),js=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),vs=(t,e,r,s)=>{t.prototype=Object.create(e.prototype,s),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},Ns=(t,e,r,s)=>{let a,o,i;const l={};if(e=e||{},t==null)return e;do{for(a=Object.getOwnPropertyNames(t),o=a.length;o-- >0;)i=a[o],(!s||s(i,t,e))&&!l[i]&&(e[i]=t[i],l[i]=!0);t=r!==!1&&$t(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},Es=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const s=t.indexOf(e,r);return s!==-1&&s===r},$s=t=>{if(!t)return null;if(Me(t))return t;let e=t.length;if(!Qt(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},Ss=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&$t(Uint8Array)),ks=(t,e)=>{const s=(t&&t[nt]).call(t);let a;for(;(a=s.next())&&!a.done;){const o=a.value;e.call(t,o[0],o[1])}},Ps=(t,e)=>{let r;const s=[];for(;(r=t.exec(e))!==null;)s.push(r);return s},_s=ge("HTMLFormElement"),Cs=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,s,a){return s.toUpperCase()+a}),rr=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Ts=ge("RegExp"),sr=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),s={};Ge(r,(a,o)=>{let i;(i=e(a,o,t))!==!1&&(s[o]=i||a)}),Object.defineProperties(t,s)},As=t=>{sr(t,(e,r)=>{if(me(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const s=t[r];if(me(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Os=(t,e)=>{const r={},s=a=>{a.forEach(o=>{r[o]=!0})};return Me(t)?s(t):s(String(t).split(e)),r},Us=()=>{},Rs=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function zs(t){return!!(t&&me(t.append)&&t[Gt]==="FormData"&&t[nt])}const Is=t=>{const e=new Array(10),r=(s,a)=>{if(Xe(s)){if(e.indexOf(s)>=0)return;if(Ke(s))return s;if(!("toJSON"in s)){e[a]=s;const o=Me(s)?[]:{};return Ge(s,(i,l)=>{const f=r(i,a+1);!Be(f)&&(o[l]=f)}),e[a]=void 0,o}}return s};return r(t,0)},Ls=ge("AsyncFunction"),qs=t=>t&&(Xe(t)||me(t))&&me(t.then)&&me(t.catch),nr=((t,e)=>t?setImmediate:e?((r,s)=>(Re.addEventListener("message",({source:a,data:o})=>{a===Re&&o===r&&s.length&&s.shift()()},!1),a=>{s.push(a),Re.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",me(Re.postMessage)),Fs=typeof queueMicrotask<"u"?queueMicrotask.bind(Re):typeof process<"u"&&process.nextTick||nr,c={isArray:Me,isArrayBuffer:Zt,isBuffer:Ke,isFormData:ps,isArrayBufferView:ns,isString:as,isNumber:Qt,isBoolean:os,isObject:Xe,isPlainObject:it,isEmptyObject:is,isReadableStream:hs,isRequest:xs,isResponse:ys,isHeaders:gs,isUndefined:Be,isDate:ls,isFile:cs,isBlob:ds,isRegExp:Ts,isFunction:me,isStream:fs,isURLSearchParams:ms,isTypedArray:Ss,isFileList:us,forEach:Ge,merge:St,extend:ws,trim:bs,stripBOM:js,inherits:vs,toFlatObject:Ns,kindOf:at,kindOfTest:ge,endsWith:Es,toArray:$s,forEachEntry:ks,matchAll:Ps,isHTMLForm:_s,hasOwnProperty:rr,hasOwnProp:rr,reduceDescriptors:sr,freezeMethods:As,toObjectSet:Os,toCamelCase:Cs,noop:Us,toFiniteNumber:Rs,findKey:er,global:Re,isContextDefined:tr,isSpecCompliantForm:zs,toJSONObject:Is,isAsyncFn:Ls,isThenable:qs,setImmediate:nr,asap:Fs,isIterable:t=>t!=null&&me(t[nt])};function I(t,e,r,s,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),s&&(this.request=s),a&&(this.response=a,this.status=a.status?a.status:null)}c.inherits(I,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:c.toJSONObject(this.config),code:this.code,status:this.status}}});const ar=I.prototype,or={};["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(t=>{or[t]={value:t}}),Object.defineProperties(I,or),Object.defineProperty(ar,"isAxiosError",{value:!0}),I.from=(t,e,r,s,a,o)=>{const i=Object.create(ar);c.toFlatObject(t,i,function(p){return p!==Error.prototype},u=>u!=="isAxiosError");const l=t&&t.message?t.message:"Error",f=e==null&&t?t.code:e;return I.call(i,l,f,r,s,a),t&&i.cause==null&&Object.defineProperty(i,"cause",{value:t,configurable:!0}),i.name=t&&t.name||"Error",o&&Object.assign(i,o),i};const Ds=null;function kt(t){return c.isPlainObject(t)||c.isArray(t)}function ir(t){return c.endsWith(t,"[]")?t.slice(0,-2):t}function lr(t,e,r){return t?t.concat(e).map(function(a,o){return a=ir(a),!r&&o?"["+a+"]":a}).join(r?".":""):e}function Vs(t){return c.isArray(t)&&!t.some(kt)}const Ms=c.toFlatObject(c,{},null,function(e){return/^is[A-Z]/.test(e)});function lt(t,e,r){if(!c.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=c.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(x,g){return!c.isUndefined(g[x])});const s=r.metaTokens,a=r.visitor||p,o=r.dots,i=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(e);if(!c.isFunction(a))throw new TypeError("visitor must be a function");function u(m){if(m===null)return"";if(c.isDate(m))return m.toISOString();if(c.isBoolean(m))return m.toString();if(!f&&c.isBlob(m))throw new I("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(m)||c.isTypedArray(m)?f&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function p(m,x,g){let _=m;if(m&&!g&&typeof m=="object"){if(c.endsWith(x,"{}"))x=s?x:x.slice(0,-2),m=JSON.stringify(m);else if(c.isArray(m)&&Vs(m)||(c.isFileList(m)||c.endsWith(x,"[]"))&&(_=c.toArray(m)))return x=ir(x),_.forEach(function(k,F){!(c.isUndefined(k)||k===null)&&e.append(i===!0?lr([x],F,o):i===null?x:x+"[]",u(k))}),!1}return kt(m)?!0:(e.append(lr(g,x,o),u(m)),!1)}const b=[],j=Object.assign(Ms,{defaultVisitor:p,convertValue:u,isVisitable:kt});function P(m,x){if(!c.isUndefined(m)){if(b.indexOf(m)!==-1)throw Error("Circular reference detected in "+x.join("."));b.push(m),c.forEach(m,function(_,M){(!(c.isUndefined(_)||_===null)&&a.call(e,_,c.isString(M)?M.trim():M,x,j))===!0&&P(_,x?x.concat(M):[M])}),b.pop()}}if(!c.isObject(t))throw new TypeError("data must be an object");return P(t),e}function cr(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function Pt(t,e){this._pairs=[],t&&lt(t,this,e)}const dr=Pt.prototype;dr.append=function(e,r){this._pairs.push([e,r])},dr.toString=function(e){const r=e?function(s){return e.call(this,s,cr)}:cr;return this._pairs.map(function(a){return r(a[0])+"="+r(a[1])},"").join("&")};function Bs(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ur(t,e,r){if(!e)return t;const s=r&&r.encode||Bs;c.isFunction(r)&&(r={serialize:r});const a=r&&r.serialize;let o;if(a?o=a(e,r):o=c.isURLSearchParams(e)?e.toString():new Pt(e,r).toString(s),o){const i=t.indexOf("#");i!==-1&&(t=t.slice(0,i)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class fr{constructor(){this.handlers=[]}use(e,r,s){return this.handlers.push({fulfilled:e,rejected:r,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){c.forEach(this.handlers,function(s){s!==null&&e(s)})}}const pr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Hs={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Pt,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},_t=typeof window<"u"&&typeof document<"u",Ct=typeof navigator=="object"&&navigator||void 0,Ws=_t&&(!Ct||["ReactNative","NativeScript","NS"].indexOf(Ct.product)<0),Js=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ys=_t&&window.location.href||"http://localhost",ue={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:_t,hasStandardBrowserEnv:Ws,hasStandardBrowserWebWorkerEnv:Js,navigator:Ct,origin:Ys},Symbol.toStringTag,{value:"Module"})),...Hs};function Ks(t,e){return lt(t,new ue.classes.URLSearchParams,{visitor:function(r,s,a,o){return ue.isNode&&c.isBuffer(r)?(this.append(s,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function Xs(t){return c.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Gs(t){const e={},r=Object.keys(t);let s;const a=r.length;let o;for(s=0;s<a;s++)o=r[s],e[o]=t[o];return e}function mr(t){function e(r,s,a,o){let i=r[o++];if(i==="__proto__")return!0;const l=Number.isFinite(+i),f=o>=r.length;return i=!i&&c.isArray(a)?a.length:i,f?(c.hasOwnProp(a,i)?a[i]=[a[i],s]:a[i]=s,!l):((!a[i]||!c.isObject(a[i]))&&(a[i]=[]),e(r,s,a[i],o)&&c.isArray(a[i])&&(a[i]=Gs(a[i])),!l)}if(c.isFormData(t)&&c.isFunction(t.entries)){const r={};return c.forEachEntry(t,(s,a)=>{e(Xs(s),a,r,0)}),r}return null}function Zs(t,e,r){if(c.isString(t))try{return(e||JSON.parse)(t),c.trim(t)}catch(s){if(s.name!=="SyntaxError")throw s}return(r||JSON.stringify)(t)}const Ze={transitional:pr,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const s=r.getContentType()||"",a=s.indexOf("application/json")>-1,o=c.isObject(e);if(o&&c.isHTMLForm(e)&&(e=new FormData(e)),c.isFormData(e))return a?JSON.stringify(mr(e)):e;if(c.isArrayBuffer(e)||c.isBuffer(e)||c.isStream(e)||c.isFile(e)||c.isBlob(e)||c.isReadableStream(e))return e;if(c.isArrayBufferView(e))return e.buffer;if(c.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(o){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Ks(e,this.formSerializer).toString();if((l=c.isFileList(e))||s.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return lt(l?{"files[]":e}:e,f&&new f,this.formSerializer)}}return o||a?(r.setContentType("application/json",!1),Zs(e)):e}],transformResponse:[function(e){const r=this.transitional||Ze.transitional,s=r&&r.forcedJSONParsing,a=this.responseType==="json";if(c.isResponse(e)||c.isReadableStream(e))return e;if(e&&c.isString(e)&&(s&&!this.responseType||a)){const i=!(r&&r.silentJSONParsing)&&a;try{return JSON.parse(e,this.parseReviver)}catch(l){if(i)throw l.name==="SyntaxError"?I.from(l,I.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ue.classes.FormData,Blob:ue.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};c.forEach(["delete","get","head","post","put","patch"],t=>{Ze.headers[t]={}});const Qs=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"]),en=t=>{const e={};let r,s,a;return t&&t.split(`
2
- `).forEach(function(i){a=i.indexOf(":"),r=i.substring(0,a).trim().toLowerCase(),s=i.substring(a+1).trim(),!(!r||e[r]&&Qs[r])&&(r==="set-cookie"?e[r]?e[r].push(s):e[r]=[s]:e[r]=e[r]?e[r]+", "+s:s)}),e},hr=Symbol("internals");function Qe(t){return t&&String(t).trim().toLowerCase()}function ct(t){return t===!1||t==null?t:c.isArray(t)?t.map(ct):String(t)}function tn(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=r.exec(t);)e[s[1]]=s[2];return e}const rn=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Tt(t,e,r,s,a){if(c.isFunction(s))return s.call(this,e,r);if(a&&(e=r),!!c.isString(e)){if(c.isString(s))return e.indexOf(s)!==-1;if(c.isRegExp(s))return s.test(e)}}function sn(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,s)=>r.toUpperCase()+s)}function nn(t,e){const r=c.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(t,s+r,{value:function(a,o,i){return this[s].call(this,e,a,o,i)},configurable:!0})})}let he=class{constructor(e){e&&this.set(e)}set(e,r,s){const a=this;function o(l,f,u){const p=Qe(f);if(!p)throw new Error("header name must be a non-empty string");const b=c.findKey(a,p);(!b||a[b]===void 0||u===!0||u===void 0&&a[b]!==!1)&&(a[b||f]=ct(l))}const i=(l,f)=>c.forEach(l,(u,p)=>o(u,p,f));if(c.isPlainObject(e)||e instanceof this.constructor)i(e,r);else if(c.isString(e)&&(e=e.trim())&&!rn(e))i(en(e),r);else if(c.isObject(e)&&c.isIterable(e)){let l={},f,u;for(const p of e){if(!c.isArray(p))throw TypeError("Object iterator must return a key-value pair");l[u=p[0]]=(f=l[u])?c.isArray(f)?[...f,p[1]]:[f,p[1]]:p[1]}i(l,r)}else e!=null&&o(r,e,s);return this}get(e,r){if(e=Qe(e),e){const s=c.findKey(this,e);if(s){const a=this[s];if(!r)return a;if(r===!0)return tn(a);if(c.isFunction(r))return r.call(this,a,s);if(c.isRegExp(r))return r.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Qe(e),e){const s=c.findKey(this,e);return!!(s&&this[s]!==void 0&&(!r||Tt(this,this[s],s,r)))}return!1}delete(e,r){const s=this;let a=!1;function o(i){if(i=Qe(i),i){const l=c.findKey(s,i);l&&(!r||Tt(s,s[l],l,r))&&(delete s[l],a=!0)}}return c.isArray(e)?e.forEach(o):o(e),a}clear(e){const r=Object.keys(this);let s=r.length,a=!1;for(;s--;){const o=r[s];(!e||Tt(this,this[o],o,e,!0))&&(delete this[o],a=!0)}return a}normalize(e){const r=this,s={};return c.forEach(this,(a,o)=>{const i=c.findKey(s,o);if(i){r[i]=ct(a),delete r[o];return}const l=e?sn(o):String(o).trim();l!==o&&delete r[o],r[l]=ct(a),s[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return c.forEach(this,(s,a)=>{s!=null&&s!==!1&&(r[a]=e&&c.isArray(s)?s.join(", "):s)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
3
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const s=new this(e);return r.forEach(a=>s.set(a)),s}static accessor(e){const s=(this[hr]=this[hr]={accessors:{}}).accessors,a=this.prototype;function o(i){const l=Qe(i);s[l]||(nn(a,i),s[l]=!0)}return c.isArray(e)?e.forEach(o):o(e),this}};he.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),c.reduceDescriptors(he.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(s){this[r]=s}}}),c.freezeMethods(he);function At(t,e){const r=this||Ze,s=e||r,a=he.from(s.headers);let o=s.data;return c.forEach(t,function(l){o=l.call(r,o,a.normalize(),e?e.status:void 0)}),a.normalize(),o}function xr(t){return!!(t&&t.__CANCEL__)}function He(t,e,r){I.call(this,t??"canceled",I.ERR_CANCELED,e,r),this.name="CanceledError"}c.inherits(He,I,{__CANCEL__:!0});function yr(t,e,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?t(r):e(new I("Request failed with status code "+r.status,[I.ERR_BAD_REQUEST,I.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function an(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function on(t,e){t=t||10;const r=new Array(t),s=new Array(t);let a=0,o=0,i;return e=e!==void 0?e:1e3,function(f){const u=Date.now(),p=s[o];i||(i=u),r[a]=f,s[a]=u;let b=o,j=0;for(;b!==a;)j+=r[b++],b=b%t;if(a=(a+1)%t,a===o&&(o=(o+1)%t),u-i<e)return;const P=p&&u-p;return P?Math.round(j*1e3/P):void 0}}function ln(t,e){let r=0,s=1e3/e,a,o;const i=(u,p=Date.now())=>{r=p,a=null,o&&(clearTimeout(o),o=null),t(...u)};return[(...u)=>{const p=Date.now(),b=p-r;b>=s?i(u,p):(a=u,o||(o=setTimeout(()=>{o=null,i(a)},s-b)))},()=>a&&i(a)]}const dt=(t,e,r=3)=>{let s=0;const a=on(50,250);return ln(o=>{const i=o.loaded,l=o.lengthComputable?o.total:void 0,f=i-s,u=a(f),p=i<=l;s=i;const b={loaded:i,total:l,progress:l?i/l:void 0,bytes:f,rate:u||void 0,estimated:u&&l&&p?(l-i)/u:void 0,event:o,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(b)},r)},gr=(t,e)=>{const r=t!=null;return[s=>e[0]({lengthComputable:r,total:t,loaded:s}),e[1]]},br=t=>(...e)=>c.asap(()=>t(...e)),cn=ue.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,ue.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(ue.origin),ue.navigator&&/(msie|trident)/i.test(ue.navigator.userAgent)):()=>!0,dn=ue.hasStandardBrowserEnv?{write(t,e,r,s,a,o){const i=[t+"="+encodeURIComponent(e)];c.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),c.isString(s)&&i.push("path="+s),c.isString(a)&&i.push("domain="+a),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function un(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function fn(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function wr(t,e,r){let s=!un(e);return t&&(s||r==!1)?fn(t,e):e}const jr=t=>t instanceof he?{...t}:t;function ze(t,e){e=e||{};const r={};function s(u,p,b,j){return c.isPlainObject(u)&&c.isPlainObject(p)?c.merge.call({caseless:j},u,p):c.isPlainObject(p)?c.merge({},p):c.isArray(p)?p.slice():p}function a(u,p,b,j){if(c.isUndefined(p)){if(!c.isUndefined(u))return s(void 0,u,b,j)}else return s(u,p,b,j)}function o(u,p){if(!c.isUndefined(p))return s(void 0,p)}function i(u,p){if(c.isUndefined(p)){if(!c.isUndefined(u))return s(void 0,u)}else return s(void 0,p)}function l(u,p,b){if(b in e)return s(u,p);if(b in t)return s(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:l,headers:(u,p,b)=>a(jr(u),jr(p),b,!0)};return c.forEach(Object.keys({...t,...e}),function(p){const b=f[p]||a,j=b(t[p],e[p],p);c.isUndefined(j)&&b!==l||(r[p]=j)}),r}const vr=t=>{const e=ze({},t);let{data:r,withXSRFToken:s,xsrfHeaderName:a,xsrfCookieName:o,headers:i,auth:l}=e;if(e.headers=i=he.from(i),e.url=ur(wr(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&i.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),c.isFormData(r)){if(ue.hasStandardBrowserEnv||ue.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(c.isFunction(r.getHeaders)){const f=r.getHeaders(),u=["content-type","content-length"];Object.entries(f).forEach(([p,b])=>{u.includes(p.toLowerCase())&&i.set(p,b)})}}if(ue.hasStandardBrowserEnv&&(s&&c.isFunction(s)&&(s=s(e)),s||s!==!1&&cn(e.url))){const f=a&&o&&dn.read(o);f&&i.set(a,f)}return e},pn=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,s){const a=vr(t);let o=a.data;const i=he.from(a.headers).normalize();let{responseType:l,onUploadProgress:f,onDownloadProgress:u}=a,p,b,j,P,m;function x(){P&&P(),m&&m(),a.cancelToken&&a.cancelToken.unsubscribe(p),a.signal&&a.signal.removeEventListener("abort",p)}let g=new XMLHttpRequest;g.open(a.method.toUpperCase(),a.url,!0),g.timeout=a.timeout;function _(){if(!g)return;const k=he.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),q={data:!l||l==="text"||l==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:k,config:t,request:g};yr(function(R){r(R),x()},function(R){s(R),x()},q),g=null}"onloadend"in g?g.onloadend=_:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(_)},g.onabort=function(){g&&(s(new I("Request aborted",I.ECONNABORTED,t,g)),g=null)},g.onerror=function(F){const q=F&&F.message?F.message:"Network Error",X=new I(q,I.ERR_NETWORK,t,g);X.event=F||null,s(X),g=null},g.ontimeout=function(){let F=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const q=a.transitional||pr;a.timeoutErrorMessage&&(F=a.timeoutErrorMessage),s(new I(F,q.clarifyTimeoutError?I.ETIMEDOUT:I.ECONNABORTED,t,g)),g=null},o===void 0&&i.setContentType(null),"setRequestHeader"in g&&c.forEach(i.toJSON(),function(F,q){g.setRequestHeader(q,F)}),c.isUndefined(a.withCredentials)||(g.withCredentials=!!a.withCredentials),l&&l!=="json"&&(g.responseType=a.responseType),u&&([j,m]=dt(u,!0),g.addEventListener("progress",j)),f&&g.upload&&([b,P]=dt(f),g.upload.addEventListener("progress",b),g.upload.addEventListener("loadend",P)),(a.cancelToken||a.signal)&&(p=k=>{g&&(s(!k||k.type?new He(null,t,g):k),g.abort(),g=null)},a.cancelToken&&a.cancelToken.subscribe(p),a.signal&&(a.signal.aborted?p():a.signal.addEventListener("abort",p)));const M=an(a.url);if(M&&ue.protocols.indexOf(M)===-1){s(new I("Unsupported protocol "+M+":",I.ERR_BAD_REQUEST,t));return}g.send(o||null)})},mn=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let s=new AbortController,a;const o=function(u){if(!a){a=!0,l();const p=u instanceof Error?u:this.reason;s.abort(p instanceof I?p:new He(p instanceof Error?p.message:p))}};let i=e&&setTimeout(()=>{i=null,o(new I(`timeout ${e} of ms exceeded`,I.ETIMEDOUT))},e);const l=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),t=null)};t.forEach(u=>u.addEventListener("abort",o));const{signal:f}=s;return f.unsubscribe=()=>c.asap(l),f}},hn=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let s=0,a;for(;s<r;)a=s+e,yield t.slice(s,a),s=a},xn=async function*(t,e){for await(const r of yn(t))yield*hn(r,e)},yn=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:s}=await e.read();if(r)break;yield s}}finally{await e.cancel()}},Nr=(t,e,r,s)=>{const a=xn(t,e);let o=0,i,l=f=>{i||(i=!0,s&&s(f))};return new ReadableStream({async pull(f){try{const{done:u,value:p}=await a.next();if(u){l(),f.close();return}let b=p.byteLength;if(r){let j=o+=b;r(j)}f.enqueue(new Uint8Array(p))}catch(u){throw l(u),u}},cancel(f){return l(f),a.return()}},{highWaterMark:2})},Er=64*1024,{isFunction:ut}=c,gn=(({Request:t,Response:e})=>({Request:t,Response:e}))(c.global),{ReadableStream:$r,TextEncoder:Sr}=c.global,kr=(t,...e)=>{try{return!!t(...e)}catch{return!1}},bn=t=>{t=c.merge.call({skipUndefined:!0},gn,t);const{fetch:e,Request:r,Response:s}=t,a=e?ut(e):typeof fetch=="function",o=ut(r),i=ut(s);if(!a)return!1;const l=a&&ut($r),f=a&&(typeof Sr=="function"?(m=>x=>m.encode(x))(new Sr):async m=>new Uint8Array(await new r(m).arrayBuffer())),u=o&&l&&kr(()=>{let m=!1;const x=new r(ue.origin,{body:new $r,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return m&&!x}),p=i&&l&&kr(()=>c.isReadableStream(new s("").body)),b={stream:p&&(m=>m.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!b[m]&&(b[m]=(x,g)=>{let _=x&&x[m];if(_)return _.call(x);throw new I(`Response type '${m}' is not supported`,I.ERR_NOT_SUPPORT,g)})});const j=async m=>{if(m==null)return 0;if(c.isBlob(m))return m.size;if(c.isSpecCompliantForm(m))return(await new r(ue.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(c.isArrayBufferView(m)||c.isArrayBuffer(m))return m.byteLength;if(c.isURLSearchParams(m)&&(m=m+""),c.isString(m))return(await f(m)).byteLength},P=async(m,x)=>{const g=c.toFiniteNumber(m.getContentLength());return g??j(x)};return async m=>{let{url:x,method:g,data:_,signal:M,cancelToken:k,timeout:F,onDownloadProgress:q,onUploadProgress:X,responseType:R,headers:B,withCredentials:H="same-origin",fetchOptions:se}=vr(m),Q=e||fetch;R=R?(R+"").toLowerCase():"text";let J=mn([M,k&&k.toAbortSignal()],F),G=null;const W=J&&J.unsubscribe&&(()=>{J.unsubscribe()});let N;try{if(X&&u&&g!=="get"&&g!=="head"&&(N=await P(B,_))!==0){let d=new r(x,{method:"POST",body:_,duplex:"half"}),h;if(c.isFormData(_)&&(h=d.headers.get("content-type"))&&B.setContentType(h),d.body){const[w,E]=gr(N,dt(br(X)));_=Nr(d.body,Er,w,E)}}c.isString(H)||(H=H?"include":"omit");const $=o&&"credentials"in r.prototype,A={...se,signal:J,method:g.toUpperCase(),headers:B.normalize().toJSON(),body:_,duplex:"half",credentials:$?H:void 0};G=o&&new r(x,A);let O=await(o?Q(G,se):Q(x,A));const D=p&&(R==="stream"||R==="response");if(p&&(q||D&&W)){const d={};["status","statusText","headers"].forEach(V=>{d[V]=O[V]});const h=c.toFiniteNumber(O.headers.get("content-length")),[w,E]=q&&gr(h,dt(br(q),!0))||[];O=new s(Nr(O.body,Er,w,()=>{E&&E(),W&&W()}),d)}R=R||"text";let Y=await b[c.findKey(b,R)||"text"](O,m);return!D&&W&&W(),await new Promise((d,h)=>{yr(d,h,{data:Y,headers:he.from(O.headers),status:O.status,statusText:O.statusText,config:m,request:G})})}catch($){throw W&&W(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new I("Network Error",I.ERR_NETWORK,m,G),{cause:$.cause||$}):I.from($,$&&$.code,m,G)}}},wn=new Map,Pr=t=>{let e=t?t.env:{};const{fetch:r,Request:s,Response:a}=e,o=[s,a,r];let i=o.length,l=i,f,u,p=wn;for(;l--;)f=o[l],u=p.get(f),u===void 0&&p.set(f,u=l?new Map:bn(e)),p=u;return u};Pr();const Ot={http:Ds,xhr:pn,fetch:{get:Pr}};c.forEach(Ot,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const _r=t=>`- ${t}`,jn=t=>c.isFunction(t)||t===null||t===!1,Cr={getAdapter:(t,e)=>{t=c.isArray(t)?t:[t];const{length:r}=t;let s,a;const o={};for(let i=0;i<r;i++){s=t[i];let l;if(a=s,!jn(s)&&(a=Ot[(l=String(s)).toLowerCase()],a===void 0))throw new I(`Unknown adapter '${l}'`);if(a&&(c.isFunction(a)||(a=a.get(e))))break;o[l||"#"+i]=a}if(!a){const i=Object.entries(o).map(([f,u])=>`adapter ${f} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=r?i.length>1?`since :
4
- `+i.map(_r).join(`
5
- `):" "+_r(i[0]):"as no adapter specified";throw new I("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return a},adapters:Ot};function Ut(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new He(null,t)}function Tr(t){return Ut(t),t.headers=he.from(t.headers),t.data=At.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Cr.getAdapter(t.adapter||Ze.adapter,t)(t).then(function(s){return Ut(t),s.data=At.call(t,t.transformResponse,s),s.headers=he.from(s.headers),s},function(s){return xr(s)||(Ut(t),s&&s.response&&(s.response.data=At.call(t,t.transformResponse,s.response),s.response.headers=he.from(s.response.headers))),Promise.reject(s)})}const Ar="1.12.2",ft={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{ft[t]=function(s){return typeof s===t||"a"+(e<1?"n ":" ")+t}});const Or={};ft.transitional=function(e,r,s){function a(o,i){return"[Axios v"+Ar+"] Transitional option '"+o+"'"+i+(s?". "+s:"")}return(o,i,l)=>{if(e===!1)throw new I(a(i," has been removed"+(r?" in "+r:"")),I.ERR_DEPRECATED);return r&&!Or[i]&&(Or[i]=!0,console.warn(a(i," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,i,l):!0}},ft.spelling=function(e){return(r,s)=>(console.warn(`${s} is likely a misspelling of ${e}`),!0)};function vn(t,e,r){if(typeof t!="object")throw new I("options must be an object",I.ERR_BAD_OPTION_VALUE);const s=Object.keys(t);let a=s.length;for(;a-- >0;){const o=s[a],i=e[o];if(i){const l=t[o],f=l===void 0||i(l,o,t);if(f!==!0)throw new I("option "+o+" must be "+f,I.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new I("Unknown option "+o,I.ERR_BAD_OPTION)}}const pt={assertOptions:vn,validators:ft},ve=pt.validators;let Ie=class{constructor(e){this.defaults=e||{},this.interceptors={request:new fr,response:new fr}}async request(e,r){try{return await this._request(e,r)}catch(s){if(s instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const o=a.stack?a.stack.replace(/^.+\n/,""):"";try{s.stack?o&&!String(s.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(s.stack+=`
6
- `+o):s.stack=o}catch{}}throw s}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=ze(this.defaults,r);const{transitional:s,paramsSerializer:a,headers:o}=r;s!==void 0&&pt.assertOptions(s,{silentJSONParsing:ve.transitional(ve.boolean),forcedJSONParsing:ve.transitional(ve.boolean),clarifyTimeoutError:ve.transitional(ve.boolean)},!1),a!=null&&(c.isFunction(a)?r.paramsSerializer={serialize:a}:pt.assertOptions(a,{encode:ve.function,serialize:ve.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),pt.assertOptions(r,{baseUrl:ve.spelling("baseURL"),withXsrfToken:ve.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=o&&c.merge(o.common,o[r.method]);o&&c.forEach(["delete","get","head","post","put","patch","common"],m=>{delete o[m]}),r.headers=he.concat(i,o);const l=[];let f=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(r)===!1||(f=f&&x.synchronous,l.unshift(x.fulfilled,x.rejected))});const u=[];this.interceptors.response.forEach(function(x){u.push(x.fulfilled,x.rejected)});let p,b=0,j;if(!f){const m=[Tr.bind(this),void 0];for(m.unshift(...l),m.push(...u),j=m.length,p=Promise.resolve(r);b<j;)p=p.then(m[b++],m[b++]);return p}j=l.length;let P=r;for(;b<j;){const m=l[b++],x=l[b++];try{P=m(P)}catch(g){x.call(this,g);break}}try{p=Tr.call(this,P)}catch(m){return Promise.reject(m)}for(b=0,j=u.length;b<j;)p=p.then(u[b++],u[b++]);return p}getUri(e){e=ze(this.defaults,e);const r=wr(e.baseURL,e.url,e.allowAbsoluteUrls);return ur(r,e.params,e.paramsSerializer)}};c.forEach(["delete","get","head","options"],function(e){Ie.prototype[e]=function(r,s){return this.request(ze(s||{},{method:e,url:r,data:(s||{}).data}))}}),c.forEach(["post","put","patch"],function(e){function r(s){return function(o,i,l){return this.request(ze(l||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}Ie.prototype[e]=r(),Ie.prototype[e+"Form"]=r(!0)});let Nn=class rs{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const s=this;this.promise.then(a=>{if(!s._listeners)return;let o=s._listeners.length;for(;o-- >0;)s._listeners[o](a);s._listeners=null}),this.promise.then=a=>{let o;const i=new Promise(l=>{s.subscribe(l),o=l}).then(a);return i.cancel=function(){s.unsubscribe(o)},i},e(function(o,i,l){s.reason||(s.reason=new He(o,i,l),r(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=s=>{e.abort(s)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new rs(function(a){e=a}),cancel:e}}};function En(t){return function(r){return t.apply(null,r)}}function $n(t){return c.isObject(t)&&t.isAxiosError===!0}const Rt={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(Rt).forEach(([t,e])=>{Rt[e]=t});function Ur(t){const e=new Ie(t),r=Xt(Ie.prototype.request,e);return c.extend(r,Ie.prototype,e,{allOwnKeys:!0}),c.extend(r,e,null,{allOwnKeys:!0}),r.create=function(a){return Ur(ze(t,a))},r}const ae=Ur(Ze);ae.Axios=Ie,ae.CanceledError=He,ae.CancelToken=Nn,ae.isCancel=xr,ae.VERSION=Ar,ae.toFormData=lt,ae.AxiosError=I,ae.Cancel=ae.CanceledError,ae.all=function(e){return Promise.all(e)},ae.spread=En,ae.isAxiosError=$n,ae.mergeConfig=ze,ae.AxiosHeaders=he,ae.formToJSON=t=>mr(c.isHTMLForm(t)?new FormData(t):t),ae.getAdapter=Cr.getAdapter,ae.HttpStatusCode=Rt,ae.default=ae;const{Axios:Ea,AxiosError:$a,CanceledError:Sa,isCancel:ka,CancelToken:Pa,VERSION:_a,all:Ca,Cancel:Ta,isAxiosError:Aa,spread:Oa,toFormData:Ua,AxiosHeaders:Ra,HttpStatusCode:za,formToJSON:Ia,getAdapter:La,mergeConfig:qa}=ae;class Sn{appName;baseUrl;apiKey;appId;client;constructor(e){if(!e||!e.baseUrl)throw new Error("NeuctraAuthix: 'baseUrl' is required in config");const r=e.apiKey;if(!r)throw new Error("NeuctraAuthix: 'apiKey' is required in config");this.appName=e.appName,this.baseUrl=e.baseUrl.replace(/\/$/,""),this.apiKey=r,this.appId=e.appId||null,this.client=ae.create({baseURL:this.baseUrl,headers:{"Content-Type":"application/json","x-api-key":r},timeout:3e4,withCredentials:!0})}async request(e,r,s,a={},o=!1){try{const i={...this.appId?{appId:this.appId}:{},...s||{}};return(await this.client.request({url:r,method:e,data:i,headers:a,withCredentials:o})).data}catch(i){if(ae.isAxiosError(i)){const l=i.response?.status??0,f=i.response?.data;let u=f?.message||i.message||"Request failed";throw l===403&&f?.code==="INSUFFICIENT_SCOPE"&&(u=`${u} (called "${r}" with an API key). This endpoint needs an API key — call it from your server, not from client code.`),l===401&&f?.code==="NO_USER_SESSION"&&(u=`${u} Sign the user in with loginUser() first — this endpoint acts on the signed-in user's own data.`),l===409&&f?.code==="VERSION_CONFLICT"?{message:`${u} Re-read the record to get its current version, then retry the update.`,status:l,code:"VERSION_CONFLICT",isConflict:!0,currentVersion:f?.currentVersion,expectedVersion:f?.expectedVersion}:l===429?{message:u,status:l,code:f?.code||"RATE_LIMITED",isRateLimited:!0,resetDate:f?.resetDate}:{message:u,status:l,code:f?.code}}throw{message:i.message||"Unexpected error occurred"}}}async signupUser(e){const{name:r,email:s,password:a}=e;if(!r||!s||!a)throw new Error("signup: 'name', 'email', and 'password' are required");return await this.request("POST","/users/signup",e,{},!0)}async loginUser(e){const{email:r,password:s}=e;if(!r||!s)throw new Error("login: 'email' and 'password' are required");try{return await this.request("POST","/users/login",{email:r,password:s},{},!0)}catch(a){throw new Error(a.message||"Login failed due to an unknown error")}}async logoutUser(){try{return(await this.request("POST","/users/logout",{},{},!0))?.success?(typeof window<"u"&&(document.cookie="a_s_b=; path=/; Max-Age=0; SameSite=Lax",window.location.protocol==="https:"&&(document.cookie="a_s_b=; path=/; Max-Age=0; SameSite=Lax; Secure"),window.location.reload()),{success:!0}):{success:!1}}catch(e){throw new Error(e?.message||"Logout failed due to an unknown error")}}async changePassword(e){const{userId:r,currentPassword:s,newPassword:a}=e;if(!r)throw new Error("changePassword: 'userId' is required");if(!s||!a)throw new Error("changePassword: both 'currentPassword' and 'newPassword' are required");return await this.request("PUT",`/users/change-password/${r}`,{currentPassword:s,newPassword:a},{},!0)}async requestEmailVerificationOTP(e){const{userId:r,email:s}=e;if(!r)throw{message:"requestEmailVerificationOTP: 'userId' is required",status:400};if(!s)throw{message:"requestEmailVerificationOTP: 'email' is required",status:400};try{return await this.request("POST",`/users/send-verify-otp/${encodeURIComponent(r)}`,{email:s},{},!0)}catch(a){throw console.error("requestEmailVerificationOTP Error:",a),{message:a?.message||"Failed to send verification OTP",status:a?.status||500}}}async verifyEmail(e){const{email:r,otp:s}=e;if(!r)throw new Error("verifyEmail: 'email' is required");if(!s)throw new Error("verifyEmail: 'otp' is required");try{return await this.request("POST","/users/verify-email",{email:r,otp:s},{},!0)}catch(a){throw{message:a.message||"Failed to verify email",status:a.status||500}}}async checkUserSession(){if(typeof window>"u")return{authenticated:!1};const e=()=>{document.cookie="a_s_b=; path=/; Max-Age=0; SameSite=Lax",window.location.protocol==="https:"&&(document.cookie="a_s_b=; path=/; Max-Age=0; SameSite=Lax; Secure")};try{const r=await this.request("GET","/users/session",void 0,{},!0);return r?.authenticated||e(),r??{authenticated:!1}}catch{return e(),{authenticated:!1}}}async getUser(e){const r=this.appId;if(!r)throw new Error("getUser: 'appId' is required in SDK config");if(!e?.id&&!e?.username)throw new Error("getUser: either 'id' or 'username' is required");const s=new URLSearchParams;return e.id&&s.append("id",e.id),e.username&&s.append("username",e.username),await this.request("GET",`/users/${encodeURIComponent(r)}/user?${s.toString()}`,void 0,{},!0)}async updateUser(e){const{userId:r,...s}=e;if(!r)throw new Error("updateUser: 'userId' is required");if(!s.appId)throw new Error("updateUser: 'appId' is required");return await this.request("PUT",`/users/update/${r}`,s,{},!0)}async deleteUser(e){const{userId:r}=e;if(!r)throw new Error("deleteUser: 'userId' is required");return await this.request("DELETE",`/users/delete/${r}`,{},{},!0)}async getUserProfile(e){const{userId:r}=e;if(!r)throw new Error("getProfile: 'userId' and 'appId' are required");try{return await this.request("POST","/users/profile",{userId:r},{},!0)}catch(s){throw{message:s.message||"Failed to fetch profile",status:s.status||500}}}async requestResetUserPasswordOTP(e){const{email:r}=e;if(!r)throw new Error("forgotPassword: 'email' is required");return await this.request("POST","/users/forgot-password",{email:r})}async resetUserPassword(e){const{email:r,otp:s,newPassword:a}=e;if(!r||!s||!a)throw new Error("resetPassword: 'email', 'otp' and 'newPassword' are required");return await this.request("POST","/users/reset-password",{email:r,otp:s,newPassword:a})}async checkIfUserExists(e){if(!e)throw new Error("checkUser: 'userId' is required");return await this.request("GET",`/users/check-user/${e}?appId=${this.appId}`)}async addUserData(e){const{userId:r,dataCategory:s,data:a}=e;if(!r)throw new Error("addUserData: 'userId' is required");if(!s)throw new Error("addUserData: 'dataCategory' is required");if(!a)throw new Error("addUserData: 'data' is required");return await this.request("POST",`/users/${r}/data`,{dataCategory:s,...a},{},!1)}async getUserData(e){const{userId:r,limit:s=20,cursor:a,category:o,parentId:i}=e;if(!r)throw new Error("getUserData: 'userId' is required");const l=`/users/${encodeURIComponent(r)}/data`,f=new URLSearchParams;f.set("limit",String(s)),a&&f.set("cursor",a),o&&f.set("category",o),i&&f.set("parentId",i);const u=f.toString();return this.request("GET",u?`${l}?${u}`:l,void 0,{},!1)}async getSingleUserData(e){const{userId:r,dataId:s}=e;if(!r||!s)throw new Error("getSingleUserData: 'userId' and 'dataId' are required");return await this.request("GET",`/users/${r}/data/${s}`,void 0,{},!1)}async searchInUserData(e){const{userId:r,category:s,q:a,keys:o,limit:i,cursor:l}=e||{};if(!r)throw new Error("searchUserData: 'userId' is required");return await this.request("POST",`/users/${encodeURIComponent(r)}/data/search`,{category:s,q:a,keys:o&&Object.keys(o).length>0?o:{},...i!==void 0?{limit:i}:{},...l?{cursor:l}:{}},{},!1)}async*iterateUserData(e){let r;do{const s=await this.getUserData({...e,cursor:r});yield s,r=s?.nextCursor||void 0}while(r)}async updateUserData(e){const{userId:r,dataId:s,data:a,version:o}=e;if(!r||!s)throw new Error("updateUserData: 'userId' and 'dataId' are required");if(!a)throw new Error("updateUserData: 'data' is required");return await this.request("PUT",`/users/${r}/data/${s}`,{...a,...o!==void 0?{version:o}:{}},{},!1)}async deleteUserData(e){const{userId:r,dataId:s}=e;if(!r||!s)throw new Error("deleteUserData: 'userId' and 'dataId' are required");return await this.request("DELETE",`/users/${r}/data/${s}`,void 0,{},!1)}async deleteManyUserData(e){const{userId:r,dataIds:s}=e||{};if(!r)throw new Error("deleteManyUserData: 'userId' is required");if(!Array.isArray(s)||s.length===0)throw new Error("deleteManyUserData: 'dataIds' must be a non-empty array");return await this.request("POST",`/users/${encodeURIComponent(r)}/data-bulk-delete`,{dataIds:s},{},!1)}async batch(e){const{userId:r,operations:s}=e||{};if(!r)throw new Error("batch: 'userId' is required");if(!Array.isArray(s)||s.length===0)throw new Error("batch: 'operations' must be a non-empty array");const a=s.findIndex(o=>!o||!["create","update","delete"].includes(o.type));if(a!==-1)throw new Error(`batch: operations[${a}].type must be "create", "update", or "delete"`);return await this.request("POST",`/users/${encodeURIComponent(r)}/data-batch`,{operations:s},{},!1)}async addAppData(e){const r=this.appId;if(!r)throw new Error("addAppData: 'appId' is required");const{dataCategory:s,data:a}=e;if(!s)throw new Error("addAppData: 'dataCategory' is required");if(!a||typeof a!="object")throw new Error("addAppData: 'data' is required");return await this.request("POST",`/app/${encodeURIComponent(r)}/data/${encodeURIComponent(s)}`,a,{},!1)}async getAppData(e){const r=this.appId;if(!r)throw new Error("getAppData: 'appId' is required");const s=typeof e=="string"?{category:e}:e||{},{category:a,limit:o,cursor:i}=s,l=a?`/app/${encodeURIComponent(r)}/app-data/${encodeURIComponent(a)}`:`/app/${encodeURIComponent(r)}/app-data`,f=new URLSearchParams;o!==void 0&&f.set("limit",String(o)),i&&f.set("cursor",i);const u=f.toString();return await this.request("GET",u?`${l}?${u}`:l,void 0,{},!1)}async getSingleAppData(e){const r=this.appId;if(!r)throw new Error("getSingleAppData: 'appId' is required");if(!e?.dataId)throw new Error("getSingleAppData: 'dataId' is required");return await this.request("GET",`/app/${encodeURIComponent(r)}/data/${encodeURIComponent(e.dataId)}`,void 0,{},!1)}async searchInAppData(e){const r=this.appId;if(!r)throw new Error("searchInAppData: 'appId' is required");const{category:s,q:a,keys:o,limit:i,cursor:l}=e||{};return await this.request("POST",`/app/${encodeURIComponent(r)}/app-data/search`,{category:s,q:a,keys:o&&Object.keys(o).length>0?o:{},...i!==void 0?{limit:i}:{},...l?{cursor:l}:{}},{},!1)}async updateAppData(e){const r=this.appId;if(!r)throw new Error("updateAppData: 'appId' is required");if(!e?.dataId)throw new Error("updateAppData: 'dataId' is required");if(!e?.data||typeof e.data!="object")throw new Error("updateAppData: 'data' is required");return await this.request("PATCH",`/app/${encodeURIComponent(r)}/data/${encodeURIComponent(e.dataId)}`,e.data,{},!1)}async deleteAppData(e){const r=this.appId;if(!r)throw new Error("deleteAppData: 'appId' is required");if(!e?.dataId)throw new Error("deleteAppData: 'dataId' is required");return await this.request("DELETE",`/app/${encodeURIComponent(r)}/data/${encodeURIComponent(e.dataId)}`,void 0,{},!1)}async getAllUsersFromApp(e={}){const r=this.appId;if(!r)throw new Error("getAllUsersFromApp: 'appId' is required");const{cursor:s,limit:a}=e,o={};return s&&(o.cursor=s),a!==void 0&&(o.limit=a),await this.request("POST",`/app/global/${encodeURIComponent(r)}/all-app-users`,o,{},!1)}async searchInAllAppUsers(e={}){const r=this.appId;if(!r)throw new Error("searchInAllAppUsers: 'appId' is required");const{q:s,keys:a={},limit:o,cursor:i}=e,l={};return s&&(l.q=s),a&&Object.keys(a).length>0&&(l.keys=a),o!==void 0&&(l.limit=o),i&&(l.cursor=i),await this.request("POST",`/app/global/${encodeURIComponent(r)}/all-app-users/search`,l,{},!1)}async getAllUsersDataFromApp(e={}){const r=this.appId;if(!r)throw new Error("getAllUsersDataFromApp: 'appId' is required");const{category:s,cursor:a,limit:o}=e,i={};return s&&(i.category=s),a&&(i.cursor=a),o!==void 0&&(i.limit=o),await this.request("POST",`/app/global/${encodeURIComponent(r)}/all-app-users-data`,i,{},!1)}async searchInAllAppUsersData(e={}){const r=this.appId;if(!r)throw new Error("searchInAllAppUsersData: 'appId' is required");const{category:s,q:a,keys:o={},limit:i,cursor:l}=e,f={};return s&&(f.category=s),a&&(f.q=a),o&&Object.keys(o).length>0&&(f.keys=o),i!==void 0&&(f.limit=i),l&&(f.cursor=l),await this.request("POST",`/app/global/${encodeURIComponent(r)}/all-app-users-data/search`,f,{},!1)}}var mt={exports:{}},et={};/**
7
- * @license React
8
- * react-jsx-runtime.production.js
9
- *
10
- * Copyright (c) Meta Platforms, Inc. and affiliates.
11
- *
12
- * This source code is licensed under the MIT license found in the
13
- * LICENSE file in the root directory of this source tree.
14
- */var Rr;function kn(){if(Rr)return et;Rr=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(s,a,o){var i=null;if(o!==void 0&&(i=""+o),a.key!==void 0&&(i=""+a.key),"key"in a){o={};for(var l in a)l!=="key"&&(o[l]=a[l])}else o=a;return a=o.ref,{$$typeof:t,type:s,key:i,ref:a!==void 0?a:null,props:o}}return et.Fragment=e,et.jsx=r,et.jsxs=r,et}var tt={};/**
15
- * @license React
16
- * react-jsx-runtime.development.js
17
- *
18
- * Copyright (c) Meta Platforms, Inc. and affiliates.
19
- *
20
- * This source code is licensed under the MIT license found in the
21
- * LICENSE file in the root directory of this source tree.
22
- */var zr;function Pn(){return zr||(zr=1,process.env.NODE_ENV!=="production"&&(function(){function t(d){if(d==null)return null;if(typeof d=="function")return d.$$typeof===Q?null:d.displayName||d.name||null;if(typeof d=="string")return d;switch(d){case g:return"Fragment";case M:return"Profiler";case _:return"StrictMode";case X:return"Suspense";case R:return"SuspenseList";case se:return"Activity"}if(typeof d=="object")switch(typeof d.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),d.$$typeof){case x:return"Portal";case F:return d.displayName||"Context";case k:return(d._context.displayName||"Context")+".Consumer";case q:var h=d.render;return d=d.displayName,d||(d=h.displayName||h.name||"",d=d!==""?"ForwardRef("+d+")":"ForwardRef"),d;case B:return h=d.displayName||null,h!==null?h:t(d.type)||"Memo";case H:h=d._payload,d=d._init;try{return t(d(h))}catch{}}return null}function e(d){return""+d}function r(d){try{e(d);var h=!1}catch{h=!0}if(h){h=console;var w=h.error,E=typeof Symbol=="function"&&Symbol.toStringTag&&d[Symbol.toStringTag]||d.constructor.name||"Object";return w.call(h,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",E),e(d)}}function s(d){if(d===g)return"<>";if(typeof d=="object"&&d!==null&&d.$$typeof===H)return"<...>";try{var h=t(d);return h?"<"+h+">":"<...>"}catch{return"<...>"}}function a(){var d=J.A;return d===null?null:d.getOwner()}function o(){return Error("react-stack-top-frame")}function i(d){if(G.call(d,"key")){var h=Object.getOwnPropertyDescriptor(d,"key").get;if(h&&h.isReactWarning)return!1}return d.key!==void 0}function l(d,h){function w(){$||($=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",h))}w.isReactWarning=!0,Object.defineProperty(d,"key",{get:w,configurable:!0})}function f(){var d=t(this.type);return A[d]||(A[d]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),d=this.props.ref,d!==void 0?d:null}function u(d,h,w,E,V,ce){var C=w.ref;return d={$$typeof:m,type:d,key:h,props:w,_owner:E},(C!==void 0?C:null)!==null?Object.defineProperty(d,"ref",{enumerable:!1,get:f}):Object.defineProperty(d,"ref",{enumerable:!1,value:null}),d._store={},Object.defineProperty(d._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(d,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(d,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.defineProperty(d,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ce}),Object.freeze&&(Object.freeze(d.props),Object.freeze(d)),d}function p(d,h,w,E,V,ce){var C=h.children;if(C!==void 0)if(E)if(W(C)){for(E=0;E<C.length;E++)b(C[E]);Object.freeze&&Object.freeze(C)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else b(C);if(G.call(h,"key")){C=t(d);var oe=Object.keys(h).filter(function(L){return L!=="key"});E=0<oe.length?"{key: someKey, "+oe.join(": ..., ")+": ...}":"{key: someKey}",Y[C+E]||(oe=0<oe.length?"{"+oe.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
23
- let props = %s;
24
- <%s {...props} />
25
- React keys must be passed directly to JSX without using spread:
26
- let props = %s;
27
- <%s key={someKey} {...props} />`,E,C,oe,C),Y[C+E]=!0)}if(C=null,w!==void 0&&(r(w),C=""+w),i(h)&&(r(h.key),C=""+h.key),"key"in h){w={};for(var ie in h)ie!=="key"&&(w[ie]=h[ie])}else w=h;return C&&l(w,typeof d=="function"?d.displayName||d.name||"Unknown":d),u(d,C,w,a(),V,ce)}function b(d){j(d)?d._store&&(d._store.validated=1):typeof d=="object"&&d!==null&&d.$$typeof===H&&(d._payload.status==="fulfilled"?j(d._payload.value)&&d._payload.value._store&&(d._payload.value._store.validated=1):d._store&&(d._store.validated=1))}function j(d){return typeof d=="object"&&d!==null&&d.$$typeof===m}var P=y,m=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),F=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),Q=Symbol.for("react.client.reference"),J=P.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=Object.prototype.hasOwnProperty,W=Array.isArray,N=console.createTask?console.createTask:function(){return null};P={react_stack_bottom_frame:function(d){return d()}};var $,A={},O=P.react_stack_bottom_frame.bind(P,o)(),D=N(s(o)),Y={};tt.Fragment=g,tt.jsx=function(d,h,w){var E=1e4>J.recentlyCreatedOwnerStacks++;return p(d,h,w,!1,E?Error("react-stack-top-frame"):O,E?N(s(d)):D)},tt.jsxs=function(d,h,w){var E=1e4>J.recentlyCreatedOwnerStacks++;return p(d,h,w,!0,E?Error("react-stack-top-frame"):O,E?N(s(d)):D)}})()),tt}var Ir;function _n(){return Ir||(Ir=1,process.env.NODE_ENV==="production"?mt.exports=kn():mt.exports=Pn()),mt.exports}var n=_n();/**
28
- * @license lucide-react v0.544.0 - ISC
29
- *
30
- * This source code is licensed under the ISC license.
31
- * See the LICENSE file in the root directory of this source tree.
32
- */const Cn=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Tn=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,s)=>s?s.toUpperCase():r.toLowerCase()),Lr=t=>{const e=Tn(t);return e.charAt(0).toUpperCase()+e.slice(1)},qr=(...t)=>t.filter((e,r,s)=>!!e&&e.trim()!==""&&s.indexOf(e)===r).join(" ").trim(),An=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
33
- * @license lucide-react v0.544.0 - ISC
34
- *
35
- * This source code is licensed under the ISC license.
36
- * See the LICENSE file in the root directory of this source tree.
37
- */var On={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
38
- * @license lucide-react v0.544.0 - ISC
39
- *
40
- * This source code is licensed under the ISC license.
41
- * See the LICENSE file in the root directory of this source tree.
42
- */const Un=y.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:a="",children:o,iconNode:i,...l},f)=>y.createElement("svg",{ref:f,...On,width:e,height:e,stroke:t,strokeWidth:s?Number(r)*24/Number(e):r,className:qr("lucide",a),...!o&&!An(l)&&{"aria-hidden":"true"},...l},[...i.map(([u,p])=>y.createElement(u,p)),...Array.isArray(o)?o:[o]]));/**
43
- * @license lucide-react v0.544.0 - ISC
44
- *
45
- * This source code is licensed under the ISC license.
46
- * See the LICENSE file in the root directory of this source tree.
47
- */const K=(t,e)=>{const r=y.forwardRef(({className:s,...a},o)=>y.createElement(Un,{ref:o,iconNode:e,className:qr(`lucide-${Cn(Lr(t))}`,`lucide-${t}`,s),...a}));return r.displayName=Lr(t),r};/**
48
- * @license lucide-react v0.544.0 - ISC
49
- *
50
- * This source code is licensed under the ISC license.
51
- * See the LICENSE file in the root directory of this source tree.
52
- */const Rn=K("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
53
- * @license lucide-react v0.544.0 - ISC
54
- *
55
- * This source code is licensed under the ISC license.
56
- * See the LICENSE file in the root directory of this source tree.
57
- */const zn=K("badge-check",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
58
- * @license lucide-react v0.544.0 - ISC
59
- *
60
- * This source code is licensed under the ISC license.
61
- * See the LICENSE file in the root directory of this source tree.
62
- */const zt=K("camera",[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
63
- * @license lucide-react v0.544.0 - ISC
64
- *
65
- * This source code is licensed under the ISC license.
66
- * See the LICENSE file in the root directory of this source tree.
67
- */const be=K("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
68
- * @license lucide-react v0.544.0 - ISC
69
- *
70
- * This source code is licensed under the ISC license.
71
- * See the LICENSE file in the root directory of this source tree.
72
- */const Ee=K("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
73
- * @license lucide-react v0.544.0 - ISC
74
- *
75
- * This source code is licensed under the ISC license.
76
- * See the LICENSE file in the root directory of this source tree.
77
- */const It=K("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
78
- * @license lucide-react v0.544.0 - ISC
79
- *
80
- * This source code is licensed under the ISC license.
81
- * See the LICENSE file in the root directory of this source tree.
82
- */const In=K("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
83
- * @license lucide-react v0.544.0 - ISC
84
- *
85
- * This source code is licensed under the ISC license.
86
- * See the LICENSE file in the root directory of this source tree.
87
- */const Ln=K("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
88
- * @license lucide-react v0.544.0 - ISC
89
- *
90
- * This source code is licensed under the ISC license.
91
- * See the LICENSE file in the root directory of this source tree.
92
- */const Lt=K("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
93
- * @license lucide-react v0.544.0 - ISC
94
- *
95
- * This source code is licensed under the ISC license.
96
- * See the LICENSE file in the root directory of this source tree.
97
- */const qt=K("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
98
- * @license lucide-react v0.544.0 - ISC
99
- *
100
- * This source code is licensed under the ISC license.
101
- * See the LICENSE file in the root directory of this source tree.
102
- */const qn=K("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]);/**
103
- * @license lucide-react v0.544.0 - ISC
104
- *
105
- * This source code is licensed under the ISC license.
106
- * See the LICENSE file in the root directory of this source tree.
107
- */const Fr=K("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
108
- * @license lucide-react v0.544.0 - ISC
109
- *
110
- * This source code is licensed under the ISC license.
111
- * See the LICENSE file in the root directory of this source tree.
112
- */const Dr=K("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
113
- * @license lucide-react v0.544.0 - ISC
114
- *
115
- * This source code is licensed under the ISC license.
116
- * See the LICENSE file in the root directory of this source tree.
117
- */const Ft=K("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
118
- * @license lucide-react v0.544.0 - ISC
119
- *
120
- * This source code is licensed under the ISC license.
121
- * See the LICENSE file in the root directory of this source tree.
122
- */const Fn=K("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
123
- * @license lucide-react v0.544.0 - ISC
124
- *
125
- * This source code is licensed under the ISC license.
126
- * See the LICENSE file in the root directory of this source tree.
127
- */const ye=K("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
128
- * @license lucide-react v0.544.0 - ISC
129
- *
130
- * This source code is licensed under the ISC license.
131
- * See the LICENSE file in the root directory of this source tree.
132
- */const Vr=K("loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/**
133
- * @license lucide-react v0.544.0 - ISC
134
- *
135
- * This source code is licensed under the ISC license.
136
- * See the LICENSE file in the root directory of this source tree.
137
- */const We=K("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
138
- * @license lucide-react v0.544.0 - ISC
139
- *
140
- * This source code is licensed under the ISC license.
141
- * See the LICENSE file in the root directory of this source tree.
142
- */const Dt=K("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);/**
143
- * @license lucide-react v0.544.0 - ISC
144
- *
145
- * This source code is licensed under the ISC license.
146
- * See the LICENSE file in the root directory of this source tree.
147
- */const Le=K("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]);/**
148
- * @license lucide-react v0.544.0 - ISC
149
- *
150
- * This source code is licensed under the ISC license.
151
- * See the LICENSE file in the root directory of this source tree.
152
- */const Dn=K("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
153
- * @license lucide-react v0.544.0 - ISC
154
- *
155
- * This source code is licensed under the ISC license.
156
- * See the LICENSE file in the root directory of this source tree.
157
- */const Vn=K("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/**
158
- * @license lucide-react v0.544.0 - ISC
159
- *
160
- * This source code is licensed under the ISC license.
161
- * See the LICENSE file in the root directory of this source tree.
162
- */const Mn=K("phone",[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]]);/**
163
- * @license lucide-react v0.544.0 - ISC
164
- *
165
- * This source code is licensed under the ISC license.
166
- * See the LICENSE file in the root directory of this source tree.
167
- */const Bn=K("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
168
- * @license lucide-react v0.544.0 - ISC
169
- *
170
- * This source code is licensed under the ISC license.
171
- * See the LICENSE file in the root directory of this source tree.
172
- */const Vt=K("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
173
- * @license lucide-react v0.544.0 - ISC
174
- *
175
- * This source code is licensed under the ISC license.
176
- * See the LICENSE file in the root directory of this source tree.
177
- */const Mt=K("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
178
- * @license lucide-react v0.544.0 - ISC
179
- *
180
- * This source code is licensed under the ISC license.
181
- * See the LICENSE file in the root directory of this source tree.
182
- */const ht=K("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);/**
183
- * @license lucide-react v0.544.0 - ISC
184
- *
185
- * This source code is licensed under the ISC license.
186
- * See the LICENSE file in the root directory of this source tree.
187
- */const Mr=K("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
188
- * @license lucide-react v0.544.0 - ISC
189
- *
190
- * This source code is licensed under the ISC license.
191
- * See the LICENSE file in the root directory of this source tree.
192
- */const Hn=K("user-x",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/**
193
- * @license lucide-react v0.544.0 - ISC
194
- *
195
- * This source code is licensed under the ISC license.
196
- * See the LICENSE file in the root directory of this source tree.
197
- */const Je=K("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
198
- * @license lucide-react v0.544.0 - ISC
199
- *
200
- * This source code is licensed under the ISC license.
201
- * See the LICENSE file in the root directory of this source tree.
202
- */const rt=K("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Br=y.createContext(null),Wn=({authix:t,children:e})=>n.jsx(Br.Provider,{value:t,children:e}),qe=()=>{const t=y.useContext(Br);if(!t)throw new Error("useAuthix must be used inside <AuthixProvider />");return t},Jn=({logoUrl:t,logoLinkUrl:e,title:r="Create Your Account",subtitle:s="Join our platform today",primaryColor:a="#00C214",gradient:o="linear-gradient(135deg, #22c55e, #00C214)",darkMode:i=!0,showAvatar:l=!1,roles:f=[],showRoleSelector:u=!1,loginUrl:p,onSuccess:b,onError:j})=>{const P=qe(),m={name:"",email:"",password:"",role:f.length?f[0]:"user",...l&&{avatarUrl:""}},[x,g]=y.useState(m),[_,M]=y.useState(!1),[k,F]=y.useState(!1),[q,X]=y.useState(null),[R,B]=y.useState({}),[H,se]=y.useState(!1),Q=i?"text-white":"text-gray-900",J=i?"text-gray-400":"text-gray-600",G=i?"bg-white/5":"bg-black/[0.02]",W=i?"border-white/10":"border-black/10",N="border-red-500",$=i?"bg-black":"bg-white";y.useEffect(()=>{if(typeof window<"u"){const h=()=>se(window.innerWidth<768);return h(),window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)}},[]);const A=h=>{const{name:w,value:E}=h.target;g(V=>({...V,[w]:E})),R[w]&&B(V=>({...V,[w]:void 0}))},O=()=>{const h={};return x.name.trim()||(h.name="Name is required"),x.email.trim()?/\S+@\S+\.\S+/.test(x.email)||(h.email="Invalid email address"):h.email="Email is required",x.password?x.password.length<6&&(h.password="Password must be at least 6 characters"):h.password="Password is required",B(h),Object.keys(h).length===0},D=async h=>{if(h.preventDefault(),!!O()){F(!0),X(null);try{const w={name:x.name,email:x.email,password:x.password,role:x.role,...x.avatarUrl?{avatarUrl:x.avatarUrl}:{}},E=await P.signupUser(w);E.success?(X({type:"success",text:E.message||"Account created successfully!"}),b?.(E.user)):(X({type:"error",text:E.message||"Signup failed"}),j?.(E))}catch(w){X({type:"error",text:w.message||"Signup failed. Please try again."}),j?.(w)}finally{F(!1)}}},Y={width:"100%",padding:H?"10px 14px 10px 44px":"10px 16px 10px 44px",outline:"none",boxSizing:"border-box"},d=i?"text-zinc-300":"text-zinc-700";return n.jsx("div",{className:"flex justify-center items-center",children:n.jsxs("div",{className:`${$} flex flex-col rounded-[10px] ${H?"min-w-[320px] max-w-[340px] p-[30px_24px]":"min-w-[380px] max-w-[390px] p-[30px_28px]"} w-full`,children:[n.jsxs("div",{className:"flex flex-col items-center text-center mb-[10px]",children:[t?n.jsx("a",{href:e||"/",target:"_self",rel:"noopener noreferrer",children:n.jsx("img",{src:t,alt:"Logo",className:"h-[50px] w-[50px] mb-[10px]"})}):n.jsx(Je,{size:40,color:a,className:"mb-[10px]"}),n.jsx("h2",{className:`text-[24px] font-bold ${Q} m-0`,children:r}),n.jsx("p",{className:`text-[14px] ${J}`,children:s})]}),l&&x.avatarUrl&&n.jsx("div",{className:"flex justify-center mb-4",children:n.jsx("img",{src:x.avatarUrl,alt:"Avatar Preview",className:"w-[60px] h-[60px] rounded-full object-cover border-2",style:{borderColor:`${a}30`},onError:h=>{const w=h.target;w.style.display="none"}})}),n.jsxs("form",{onSubmit:D,className:"flex flex-col gap-[14px]",children:[u&&f&&f.length===2&&n.jsxs("div",{className:"flex flex-col gap-[4px]",children:[n.jsx("label",{className:`text-xs ${d}`,children:"Select Role"}),n.jsxs("div",{className:`relative flex rounded-[10px] border ${W} ${G} overflow-hidden cursor-pointer h-[42px]`,children:[n.jsx("div",{className:"absolute top-0 left-0 w-1/2 h-full rounded-[10px] transition-all duration-300 ease-in-out z-0",style:{backgroundColor:i?"#000000":"#ffffff",boxShadow:i?"0 1px 3px rgba(255,255,255,0.05)":"0 1px 3px rgba(0,0,0,0.1)",transform:x.role===f[1]?"translateX(100%)":"translateX(0)"}}),n.jsx("button",{type:"button",onClick:()=>g(h=>({...h,role:f[0]})),className:"flex-1 z-10 border-none bg-transparent flex items-center justify-center transition-colors duration-200 ease-in-out",style:{color:x.role===f[0]?a:i?"#9ca3af":"#6b7280",fontWeight:x.role===f[0]?600:500,fontSize:"12px"},children:f[0].charAt(0).toUpperCase()+f[0].slice(1)}),n.jsx("button",{type:"button",onClick:()=>g(h=>({...h,role:f[1]})),className:"flex-1 z-10 border-none bg-transparent flex items-center justify-center transition-colors duration-200 ease-in-out",style:{color:x.role===f[1]?a:i?"#9ca3af":"#6b7280",fontWeight:x.role===f[1]?600:500,fontSize:"12px"},children:f[1].charAt(0).toUpperCase()+f[1].slice(1)})]})]}),n.jsxs("div",{className:"flex flex-col gap-[2px]",children:[n.jsx("label",{htmlFor:"signup-name",className:`text-xs ${d}`,children:"Full Name"}),n.jsxs("div",{className:"relative",children:[n.jsx(Je,{size:20,className:`absolute left-[14px] top-1/2 -translate-y-1/2 ${J}`,style:{color:i?"#a1a1aa":"#6b7280"}}),n.jsx("input",{id:"signup-name",type:"text",name:"name",placeholder:"Enter your full name",value:x.name,onChange:A,className:`${G} ${Q} ${H?"py-[10px] pl-[44px] pr-[14px]":"py-[10px] pl-[44px] pr-[16px]"} border rounded-[10px] text-[13px] transition-all duration-200 ease-in-out ${R.name?N:W}`,style:Y})]}),R.name&&n.jsx("span",{className:"text-red-500 text-[12px] mt-[2px]",children:R.name})]}),n.jsxs("div",{className:"flex flex-col gap-[2px]",children:[n.jsx("label",{htmlFor:"signup-email",className:`text-xs ${d}`,children:"Email Address"}),n.jsxs("div",{className:"relative",children:[n.jsx(Le,{size:20,className:`absolute left-[14px] top-1/2 -translate-y-1/2 ${J}`,style:{color:i?"#a1a1aa":"#6b7280"}}),n.jsx("input",{id:"signup-email",type:"email",name:"email",placeholder:"Enter your email address",value:x.email,onChange:A,className:`${G} ${Q} ${H?"py-[10px] pl-[44px] pr-[14px]":"py-[10px] pl-[44px] pr-[16px]"} border rounded-[10px] text-[13px] transition-all duration-200 ease-in-out ${R.email?N:W}`,style:Y})]}),R.email&&n.jsx("span",{className:"text-red-500 text-[12px] mt-[2px]",children:R.email})]}),n.jsxs("div",{className:"flex flex-col gap-[2px]",children:[n.jsx("label",{htmlFor:"signup-password",className:`text-xs ${d}`,children:"Password"}),n.jsxs("div",{className:"relative",children:[n.jsx(We,{size:20,className:`absolute left-[14px] top-1/2 -translate-y-1/2 ${J}`,style:{color:i?"#a1a1aa":"#6b7280"}}),n.jsx("input",{id:"signup-password",type:_?"text":"password",name:"password",placeholder:"Create a secure password",value:x.password,onChange:A,className:`${G} ${Q} ${H?"py-[10px] pl-[44px] pr-[14px]":"py-[10px] pl-[44px] pr-[16px]"} border rounded-[10px] text-[13px] transition-all duration-200 ease-in-out ${R.password?N:W}`,style:Y}),n.jsx("button",{type:"button",onClick:()=>M(!_),className:"absolute right-[14px] top-1/2 -translate-y-1/2 bg-transparent border-none cursor-pointer p-1",style:{color:i?"#a1a1aa":"#6b7280"},children:_?n.jsx(Lt,{size:20}):n.jsx(qt,{size:20})})]}),R.password&&n.jsx("span",{className:"text-red-500 text-[12px] mt-[2px]",children:R.password})]}),l&&n.jsxs("div",{className:"flex flex-col gap-[4px]",children:[n.jsx("label",{htmlFor:"signup-avatar",className:`text-xs ${d}`,children:"Avatar URL (Optional)"}),n.jsxs("div",{className:"relative",children:[n.jsx(Fr,{size:20,className:`absolute left-[14px] top-1/2 -translate-y-1/2 ${J}`,style:{color:i?"#a1a1aa":"#6b7280"}}),n.jsx("input",{id:"signup-avatar",type:"url",name:"avatarUrl",placeholder:"Paste your avatar image URL",value:x.avatarUrl||"",onChange:A,className:`${G} ${Q} ${H?"py-[10px] pl-[44px] pr-[14px]":"py-[10px] pl-[44px] pr-[16px]"} border ${W} rounded-[10px] text-[13px] transition-all duration-200 ease-in-out`,style:Y})]})]}),p&&n.jsx("div",{className:"flex justify-between text-[13px]",children:n.jsx("a",{href:p,className:"no-underline font-medium",style:{color:a},children:"Already have an account?"})}),q&&n.jsxs("div",{className:"p-3 rounded-[12px] text-[12px] flex items-start gap-[10px] border",style:{backgroundColor:q.type==="success"?`${a}15`:"rgba(239,68,68,0.1)",borderColor:q.type==="success"?`${a}30`:"rgba(239,68,68,0.3)",color:q.type==="success"?a:"#ef4444"},children:[q.type==="success"?n.jsx(Ee,{size:16}):n.jsx(be,{size:16}),n.jsx("span",{children:q.text})]}),n.jsx("button",{type:"submit",disabled:k,className:`py-2.5 text-white border-none rounded-[10px] text-[14px] font-semibold flex items-center justify-center gap-2 ${k?"opacity-70 cursor-not-allowed":"cursor-pointer"}`,style:{backgroundColor:a},children:k?n.jsxs(n.Fragment,{children:[n.jsx(Vr,{size:18,className:"animate-spin"}),"Creating Account..."]}):"Create Account"})]})]})})},Yn=({logoUrl:t,logoLinkUrl:e,title:r="Sign In to Your Account",subtitle:s="Welcome back! Please enter your details",primaryColor:a="#00C214",darkMode:o=!0,signupUrl:i,onSuccess:l,onError:f})=>{const u=qe(),[p,b]=y.useState("login"),[j,P]=y.useState(1),[m,x]=y.useState(!1),[g,_]=y.useState(!1),[M,k]=y.useState(null),[F,q]=y.useState(""),[X,R]=y.useState(""),[B,H]=y.useState({email:"",otp:"",newPassword:""}),[se,Q]=y.useState(!1),J=o?"text-white":"text-gray-900",G=o?"text-gray-400":"text-gray-600",W=o?"bg-white/5":"bg-black/[0.02]",N=o?"border-white/10":"border-black/10",$=o?"bg-black":"bg-white",A={"--authix-primary":a};y.useEffect(()=>{if(typeof window<"u"){const h=()=>Q(window.innerWidth<768);return h(),window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)}},[]);const O=async h=>{h.preventDefault(),_(!0),k(null);try{const w=await u.loginUser({email:F,password:X}),{user:E}=w;if(!E)throw new Error(w.message||"Login failed");if(typeof document<"u"){const V="a_s_b",ce="true",C=new Date;C.setTime(C.getTime()+1440*60*1e3),document.cookie=`${V}=${ce}; path=/; expires=${C.toUTCString()}; SameSite=Lax`}k({type:"success",text:`Welcome ${E.name}`}),l?.(E)}catch(w){const E=w.message||"Login failed";k({type:"error",text:E}),f?.(w)}finally{_(!1)}},D=h=>{H({...B,[h.target.name]:h.target.value})},Y=async h=>{h.preventDefault(),_(!0),k(null);try{const w=await u.requestResetUserPasswordOTP({email:B.email});w.success?(P(2),k({type:"success",text:w.message||"OTP sent to your email"})):k({type:"error",text:w.message||"Failed to send OTP"})}catch(w){k({type:"error",text:w.message||"Something went wrong"})}finally{_(!1)}},d=async h=>{h.preventDefault(),_(!0),k(null);try{const w=await u.resetUserPassword({email:B.email,otp:B.otp,newPassword:B.newPassword});w.success?(k({type:"success",text:w.message||"Password reset successfully!"}),P(1),H({email:"",otp:"",newPassword:""}),b("login")):k({type:"error",text:w.message||"Reset failed"})}catch(w){k({type:"error",text:w.message||"Something went wrong"})}finally{_(!1)}};return n.jsx("div",{className:"flex justify-center items-center",style:A,children:n.jsxs("div",{className:`${$} flex flex-col rounded-[10px] ${se?"min-w-[320px] max-w-[340px] p-[28px_22px]":"min-w-[380px] max-w-[390px] p-[30px_28px]"} w-full`,children:[n.jsxs("div",{className:"flex flex-col items-center text-center mb-5",children:[t?n.jsx("a",{href:e||"/",children:n.jsx("img",{src:t,className:"h-[46px] w-[46px] mb-2"})}):n.jsx(Je,{size:36,color:a,className:"mb-2"}),n.jsx("h2",{className:`text-[22px] font-bold ${J}`,children:p==="login"?r:j===1?"Forgot Password":"Reset Password"}),n.jsx("p",{className:`text-[13px] ${G}`,children:p==="login"?s:"Follow the steps to reset your password"})]}),M&&n.jsxs("div",{className:`flex items-center gap-2 text-[12px] px-3 py-2 rounded-[8px] mb-3 border
203
- ${M.type==="success"?"bg-green-500/10 text-green-400 border-green-500/20":"bg-red-500/10 text-red-400 border-red-500/20"}`,children:[M.type==="success"?n.jsx(Ee,{size:14}):n.jsx(be,{size:14}),n.jsx("span",{children:M.text})]}),p==="login"&&n.jsxs("form",{onSubmit:O,className:"flex flex-col gap-4",children:[n.jsxs("div",{className:"flex flex-col gap-[2px]",children:[n.jsx("label",{className:`text-xs ${o?"text-zinc-400":"text-zinc-700"}`,children:"Email Address"}),n.jsxs("div",{className:"relative",children:[n.jsx(Le,{size:18,className:`absolute left-3 top-1/2 -translate-y-1/2 ${o?"text-zinc-500":"text-zinc-400"}`}),n.jsx("input",{id:"login-email",type:"email",value:F,onChange:h=>q(h.target.value),placeholder:"Enter your email",className:`w-full text-[13px] rounded-[10px] border outline-none transition
204
- pl-10 pr-3 py-2.5
205
- ${W} ${J} ${N}
206
- focus:border-[var(--authix-primary)]
207
- `})]})]}),n.jsxs("div",{className:"flex flex-col gap-[2px]",children:[n.jsx("label",{className:`text-xs ${o?"text-zinc-400":"text-zinc-700"}`,children:"Password"}),n.jsxs("div",{className:"relative",children:[n.jsx(We,{size:18,className:`absolute left-3 top-1/2 -translate-y-1/2 ${o?"text-zinc-500":"text-zinc-400"}`}),n.jsx("input",{id:"login-password",type:m?"text":"password",value:X,onChange:h=>R(h.target.value),placeholder:"Enter your password",className:`w-full text-[13px] rounded-[10px] border outline-none transition
208
- pl-10 pr-10 py-2.5
209
- ${W} ${J} ${N}
210
- focus:border-[var(--authix-primary)]
211
- `}),n.jsx("button",{type:"button",onClick:()=>x(!m),className:`absolute right-3 top-1/2 -translate-y-1/2 ${o?"text-zinc-500":"text-zinc-400"}`,children:m?n.jsx(Lt,{size:18}):n.jsx(qt,{size:18})})]})]}),n.jsxs("div",{className:"flex justify-between text-[12px]",children:[i&&n.jsx("a",{href:i,className:"font-medium",style:{color:a},children:"Create account"}),n.jsx("button",{type:"button",onClick:()=>b("forgot"),className:"font-medium",style:{color:a},children:"Forgot password?"})]}),n.jsx("button",{type:"submit",disabled:g,className:"w-full flex items-center justify-center gap-2 py-2.5 rounded-[10px] text-[14px] font-semibold text-white disabled:opacity-60",style:{backgroundColor:a},children:g?n.jsxs(n.Fragment,{children:[n.jsx(Vr,{size:16,className:"animate-spin"}),"Signing In..."]}):"Sign In"})]}),p==="forgot"&&n.jsxs("form",{onSubmit:j===1?Y:d,className:"flex flex-col gap-4",children:[j===1&&n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("label",{className:"text-xs text-zinc-400",children:"Email Address"}),n.jsxs("div",{className:"relative",children:[n.jsx(Le,{size:18,className:"absolute left-3 top-1/2 -translate-y-1/2 text-zinc-500"}),n.jsx("input",{type:"email",name:"email",value:B.email,onChange:D,placeholder:"Enter your email",className:`w-full text-[13px] rounded-[10px] border pl-10 pr-3 py-2.5
212
- ${W} ${J} ${N}
213
- `})]})]}),j===2&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("label",{className:"text-xs text-zinc-400",children:"OTP"}),n.jsxs("div",{className:"relative",children:[n.jsx(Dr,{size:18,className:"absolute left-3 top-1/2 -translate-y-1/2 text-zinc-500"}),n.jsx("input",{type:"text",name:"otp",placeholder:"Enter the otp",value:B.otp,onChange:D,className:"w-full text-[13px] rounded-[10px] border pl-10 pr-3 py-2.5"})]})]}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("label",{className:"text-xs text-zinc-400",children:"New Password"}),n.jsxs("div",{className:"relative",children:[n.jsx(We,{size:18,className:"absolute left-3 top-1/2 -translate-y-1/2 text-zinc-500"}),n.jsx("input",{type:"password",name:"newPassword",placeholder:"Enter new password",value:B.newPassword,onChange:D,className:"w-full text-[13px] rounded-[10px] border pl-10 pr-3 py-2.5"})]})]})]}),j===1&&n.jsxs("button",{type:"button",onClick:()=>b("login"),className:"flex items-center gap-1 text-xs text-zinc-400 hover:text-zinc-200 transition",children:[n.jsx(Rn,{size:14}),"Back to login"]}),n.jsx("button",{type:"submit",className:"w-full py-2.5 rounded-[10px] text-white text-[14px] font-semibold",style:{backgroundColor:a},children:j===1?"Send OTP":"Reset Password"})]})]})})},Kn=({children:t,fallback:e=null})=>{const[r,s]=y.useState("loading");y.useEffect(()=>{if(typeof window>"u")return;const l=window.document.cookie.split(";").map(f=>f.trim()).find(f=>f.startsWith("a_s_b="))?.split("=")[1]==="true";s(l?"authenticated":"unauthenticated")},[]);const a=o=>typeof o=="function"?o():o;return r==="loading"?null:r==="unauthenticated"?n.jsx(n.Fragment,{children:a(e)}):n.jsx(n.Fragment,{children:t})},Xn=({children:t,fallback:e=null})=>{const[r,s]=y.useState("loading");y.useEffect(()=>{if(typeof window>"u")return;const l=window.document.cookie.split(";").map(f=>f.trim()).find(f=>f.startsWith("a_s_b="))?.split("=")[1]==="true";s(l?"authenticated":"unauthenticated")},[]);const a=o=>typeof o=="function"?o():o;return r==="loading"?null:r==="authenticated"?n.jsx(n.Fragment,{children:a(e)}):n.jsx(n.Fragment,{children:t})},Gn=({isOpen:t,onClose:e,onSuccess:r,onError:s,userId:a,colors:o,overlayClassName:i,overlayStyle:l,modalClassName:f,modalStyle:u,headerClassName:p,headerStyle:b,iconContainerClassName:j,iconContainerStyle:P,titleClassName:m,titleStyle:x,descriptionClassName:g,descriptionStyle:_,closeButtonClassName:M,closeButtonStyle:k,warningContainerClassName:F,warningContainerStyle:q,warningIconClassName:X,warningIconStyle:R,warningContentClassName:B,warningContentStyle:H,warningItemClassName:se,warningItemStyle:Q,confirmationContainerClassName:J,confirmationContainerStyle:G,confirmationInputClassName:W,confirmationInputStyle:N,confirmationSuccessClassName:$,confirmationSuccessStyle:A,processingContainerClassName:O,processingContainerStyle:D,processingStepClassName:Y,processingStepStyle:d,processingInfoClassName:h,processingInfoStyle:w,successContainerClassName:E,successContainerStyle:V,successContentClassName:ce,successContentStyle:C,successIconClassName:oe,successIconStyle:ie,successRedirectClassName:L,successRedirectStyle:ee,actionsClassName:de,actionsStyle:we,cancelButtonClassName:Ne,cancelButtonStyle:ke,dangerButtonClassName:te,dangerButtonStyle:je,confirmButtonClassName:Pe,confirmButtonStyle:Fe})=>{const S=qe(),[ne,_e]=y.useState(!1),[xe,xt]=y.useState(""),[st,Ce]=y.useState("warning"),[Te,yt]=y.useState(!1);if(y.useEffect(()=>{if(typeof window>"u")return;const Z=()=>{yt(window.innerWidth<640)};return Z(),window.addEventListener("resize",Z),()=>window.removeEventListener("resize",Z)},[]),!t)return null;const gt=async()=>{_e(!0),Ce("processing");try{const Z=await S.deleteUser({userId:a});Z.success?(r(Z.message||"Account deleted successfully"),Ce("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(s(Z.message||"Failed to delete account"),Ce("warning"))}catch(Z){s(Z.response?.data?.message||"Something went wrong"),Ce("warning")}finally{_e(!1)}},Ae=xe.toLowerCase()==="delete my account",Bt=Z=>{Z.target===Z.currentTarget&&st!=="processing"&&st!=="success"&&e()},Ht=()=>{switch(st){case"warning":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:`flex items-center justify-between mb-6 gap-4 ${p||""}`,style:b,children:[n.jsxs("div",{className:`flex items-center gap-3 flex-1 ${j||""}`,style:P,children:[n.jsx("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center flex-shrink-0 ${j||""}`,style:{background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",...P},children:n.jsx(ht,{size:20})}),n.jsx("div",{children:n.jsx("h3",{className:`m-0 text-xl font-bold leading-tight ${m||""}`,style:{color:o.textPrimary,...x},children:"Delete Account"})})]}),n.jsx("button",{onClick:e,"aria-label":"Close modal",className:`bg-transparent border-0 cursor-pointer p-2 rounded w-9 h-9 flex items-center justify-center flex-shrink-0 transition-all hover:bg-white/10 ${M||""}`,style:{color:o.textTertiary,...k},children:n.jsx(rt,{size:20})})]}),n.jsxs("div",{className:`flex gap-4 p-5 rounded-xl mb-5 ${F||""}`,style:{backgroundColor:`${o.error}15`,border:`1px solid ${o.error}30`,...q},children:[n.jsx("div",{className:`flex-shrink-0 flex items-start ${X||""}`,style:{color:o.error,...R},children:n.jsx(Mr,{size:24})}),n.jsxs("div",{className:`flex-1 ${B||""}`,style:H,children:[n.jsx("h4",{className:`m-0 mb-3 text-base font-semibold ${m||""}`,style:{color:o.textPrimary,...x},children:"Before you proceed..."}),n.jsx("div",{className:`flex flex-col gap-2.5 ${B||""}`,style:H,children:[{icon:n.jsx(In,{size:16}),text:"All your data will be permanently deleted"},{icon:n.jsx(Hn,{size:16}),text:"This action cannot be reversed"},{icon:n.jsx(Dt,{size:16}),text:"You will lose access to all services"}].map((Z,Ye)=>n.jsxs("div",{className:`flex items-center gap-2.5 text-sm ${se||""}`,style:{color:o.textSecondary,...Q},children:[n.jsx("div",{className:`flex-shrink-0 ${X||""}`,style:{color:o.error,...R},children:Z.icon}),n.jsx("span",{children:Z.text})]},Ye))})]})]}),n.jsxs("div",{className:`flex gap-3 ${Te?"flex-col-reverse":"flex-row"} justify-end items-stretch ${de||""}`,style:we,children:[n.jsx("button",{onClick:e,className:`py-2.5 px-6 rounded-xl border bg-transparent text-sm font-medium cursor-pointer transition-all hover:-translate-y-0.5 ${Te?"w-full":"flex-1 min-w-[120px]"} ${Ne||""}`,style:{borderColor:o.border,color:o.textPrimary,...ke},children:"Cancel"}),n.jsxs("button",{onClick:()=>Ce("confirmation"),className:`py-2.5 px-6 rounded-xl border-none text-sm font-semibold flex items-center justify-center gap-2 transition-all hover:-translate-y-0.5 ${Te?"w-full":"flex-1 min-w-[140px]"} ${te||""}`,style:{background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",boxShadow:"0 4px 12px rgba(239, 68, 68, 0.4)",...je},children:[n.jsx(ht,{size:16}),"Continue to Delete"]})]})]});case"confirmation":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:`flex items-center gap-3 mb-6 ${p||""}`,style:b,children:[n.jsx("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center flex-shrink-0 ${j||""}`,style:{background:"linear-gradient(135deg, #f59e0b, #d97706)",color:"white",...P},children:n.jsx(Mr,{size:24})}),n.jsx("div",{className:`flex-1 ${p||""}`,style:b,children:n.jsx("h3",{className:`m-0 text-xl font-bold leading-tight ${m||""}`,style:{color:o.textPrimary,...x},children:"Confirm Deletion"})})]}),n.jsxs("div",{className:`mb-6 ${J||""}`,style:G,children:[n.jsxs("p",{className:`mb-4 text-sm leading-relaxed ${g||""}`,style:{color:o.textSecondary,..._},children:["Type"," ",n.jsx("strong",{className:`${m||""}`,style:{color:o.textPrimary,...x},children:'"delete my account"'})," ","to confirm:"]}),n.jsx("input",{type:"text",value:xe,onChange:Z=>xt(Z.target.value),placeholder:"delete my account",autoFocus:!0,className:`w-full py-3.5 px-4 rounded-xl border text-base outline-none transition-all focus:shadow-[0_0_0_3px_rgba(var(--accent),0.2)] ${W||""}`,style:{borderColor:Ae?o.success:o.error,backgroundColor:"transparent",color:o.textPrimary,...N},onFocus:Z=>{Z.currentTarget.style.boxShadow=`0 0 0 3px ${o.accent}20`},onBlur:Z=>{Z.currentTarget.style.boxShadow="none"}}),Ae&&n.jsxs("div",{className:`flex items-center gap-2 mt-2.5 text-sm font-medium ${$||""}`,style:{color:o.success,...A},children:[n.jsx(It,{size:16}),n.jsx("span",{children:"Confirmation accepted"})]})]}),n.jsxs("div",{className:`flex gap-3 flex-col-reverse justify-end items-stretch ${de||""}`,style:we,children:[n.jsx("button",{onClick:()=>{Ce("warning"),xt("")},className:`py-2.5 px-6 rounded-xl border bg-transparent text-sm font-medium cursor-pointer transition-all hover:-translate-y-0.5 ${Te?"w-full":"flex-1 min-w-[120px]"} ${Ne||""}`,style:{borderColor:o.border,color:o.textPrimary,...ke},children:"Go Back"}),n.jsxs("button",{onClick:gt,disabled:!Ae||ne,className:`py-2.5 px-6 rounded-xl border-none text-sm font-semibold flex items-center justify-center gap-2 transition-all hover:-translate-y-0.5 disabled:opacity-60 disabled:cursor-not-allowed disabled:translate-y-0 ${Te?"w-full":"flex-1 min-w-[140px]"} ${Pe||""}`,style:{background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",opacity:!Ae||ne?.6:1,boxShadow:!Ae||ne?"none":"0 4px 12px rgba(239, 68, 68, 0.4)",...Fe},children:[n.jsx(ht,{size:16}),"Yes, Delete My Account"]})]})]});case"processing":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:`flex items-center gap-3 mb-6 ${p||""}`,style:b,children:[n.jsx("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center flex-shrink-0 ${j||""}`,style:{background:"linear-gradient(135deg, #6b7280, #4b5563)",color:"white",...P},children:n.jsx(ye,{size:20,className:"animate-spin"})}),n.jsxs("div",{className:`flex-1 ${p||""}`,style:b,children:[n.jsx("h3",{className:`m-0 text-xl font-bold leading-tight ${m||""}`,style:{color:o.textPrimary,...x},children:"Deleting Account"}),n.jsx("p",{className:`mt-1 text-sm leading-normal ${g||""}`,style:{color:o.textTertiary,..._},children:"Please wait while we process your request"})]})]}),n.jsx("div",{className:`mb-5 ${O||""}`,style:D,children:n.jsx("div",{className:`flex flex-col gap-3 ${O||""}`,style:D,children:[{text:"Removing your data",active:!0},{text:"Closing active sessions",active:!1},{text:"Finalizing deletion",active:!1}].map((Z,Ye)=>n.jsxs("div",{className:`flex items-center gap-3 p-3 rounded-lg transition-all ${Y||""}`,style:{backgroundColor:Z.active?`${o.accent}10`:"transparent",...d},children:[n.jsx("div",{className:`w-2 h-2 rounded-full transition-all ${Y||""}`,style:{backgroundColor:Z.active?o.accent:o.textTertiary,boxShadow:Z.active?`0 0 0 4px ${o.accent}20`:"none",...d}}),n.jsx("span",{className:`text-sm ${Y||""}`,style:{color:Z.active?o.textPrimary:o.textSecondary,fontWeight:Z.active?500:400,...d},children:Z.text})]},Ye))})}),n.jsxs("div",{className:`flex items-center gap-2.5 p-4 rounded-xl text-sm ${h||""}`,style:{backgroundColor:`${o.accent}10`,color:o.textSecondary,...w},children:[n.jsx(Mt,{size:18,className:"flex-shrink-0",style:{color:o.accent}}),n.jsx("span",{children:"You will be redirected to the login page shortly"})]})]});case"success":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:`flex items-center gap-3 mb-6 ${p||""}`,style:b,children:[n.jsx("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center flex-shrink-0 ${j||""}`,style:{background:"linear-gradient(135deg, #10b981, #059669)",color:"white",...P},children:n.jsx(It,{size:20})}),n.jsxs("div",{className:`flex-1 ${p||""}`,style:b,children:[n.jsx("h3",{className:`m-0 text-xl font-bold leading-tight ${m||""}`,style:{color:o.textPrimary,...x},children:"Account Deleted"}),n.jsx("p",{className:`mt-1 text-sm leading-normal ${g||""}`,style:{color:o.textTertiary,..._},children:"Your account has been successfully deleted"})]})]}),n.jsxs("div",{className:`text-center p-5 rounded-xl mb-6 ${E||""}`,style:{backgroundColor:`${o.success}10`,border:`1px solid ${o.success}20`,...V},children:[n.jsx(It,{size:48,className:`mx-auto mb-3 block ${oe||""}`,style:{color:o.success,...ie}}),n.jsx("p",{className:`text-base font-semibold mb-2 m-0 ${m||""}`,style:{color:o.textPrimary,...x},children:"Goodbye!"}),n.jsx("p",{className:`text-sm leading-relaxed m-0 ${g||""}`,style:{color:o.textSecondary,..._},children:"Your account and all associated data have been permanently removed from our systems."})]}),n.jsxs("div",{className:`flex items-center justify-center gap-2.5 p-4 rounded-xl text-sm ${L||""}`,style:{backgroundColor:`${o.accent}10`,color:o.textSecondary,...ee},children:[n.jsx(ye,{size:16,className:"animate-spin",style:{color:o.accent}}),n.jsx("span",{children:"Redirecting to login page..."})]})]})}};return n.jsx("div",{className:`fixed inset-0 flex items-center justify-center p-4 z-[10000] animate-in fade-in duration-300 ${i||""}`,style:{backgroundColor:"rgba(0,0,0,0.8)",backdropFilter:"blur(8px)",...l},onClick:Bt,children:n.jsx("div",{className:`w-full max-w-[480px] p-6 rounded-2xl border shadow-2xl animate-in zoom-in duration-300 ${f||""}`,style:{backgroundColor:o.surface,borderColor:o.border,...u},children:Ht()})})},Zn=({isOpen:t,onClose:e,onUpdate:r,colors:s,overlayClassName:a,overlayStyle:o,modalClassName:i,modalStyle:l,headerClassName:f,headerStyle:u,iconContainerClassName:p,iconContainerStyle:b,titleClassName:j,titleStyle:P,closeButtonClassName:m,closeButtonStyle:x,bodyClassName:g,bodyStyle:_,labelClassName:M,labelStyle:k,inputContainerClassName:F,inputContainerStyle:q,inputClassName:X,inputStyle:R,inputIconClassName:B,inputIconStyle:H,validationClassName:se,validationStyle:Q,successValidationClassName:J,successValidationStyle:G,errorValidationClassName:W,errorValidationStyle:N,warningValidationClassName:$,warningValidationStyle:A,previewClassName:O,previewStyle:D,previewLabelClassName:Y,previewLabelStyle:d,previewImageClassName:h,previewImageStyle:w,actionsClassName:E,actionsStyle:V,cancelButtonClassName:ce,cancelButtonStyle:C,submitButtonClassName:oe,submitButtonStyle:ie})=>{const[L,ee]=y.useState(""),[de,we]=y.useState(!1),[Ne,ke]=y.useState(!1),[te,je]=y.useState({isValid:!1,message:"",type:null});if(y.useEffect(()=>{if(typeof window>"u")return;const S=()=>{ke(window.innerWidth<640)};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]),y.useEffect(()=>{if(!L.trim()){je({isValid:!1,message:"",type:null});return}try{const S=new URL(L),ne=/\.(jpg|jpeg|png|gif|webp|svg)$/i.test(S.pathname);je(ne?{isValid:!0,message:"Valid image URL",type:"success"}:{isValid:!1,message:"URL should point to an image file",type:"warning"})}catch{je({isValid:!1,message:"Please enter a valid URL",type:"error"})}},[L]),!t)return null;const Pe=async()=>{if(!(!L||!te.isValid)){we(!0);try{await r(L)&&(ee(""),e())}finally{we(!1)}}},Fe=S=>{S.target===S.currentTarget&&e()};return n.jsx("div",{className:`fixed inset-0 flex items-center justify-center p-4 z-[1000] ${a||""}`,style:{backgroundColor:"rgba(0,0,0,0.8)",backdropFilter:"blur(8px)",...o},onClick:Fe,children:n.jsxs("div",{className:`w-full max-w-[480px] p-6 rounded-2xl border shadow-2xl animate-in fade-in zoom-in duration-300 ${i||""}`,style:{backgroundColor:s.surface,borderColor:s.border,...l},children:[n.jsxs("div",{className:`flex items-start justify-between mb-6 gap-4 ${f||""}`,style:u,children:[n.jsxs("div",{className:`flex items-center gap-3 flex-1 ${p||""}`,style:b,children:[n.jsx("div",{className:`w-11 h-11 rounded-xl flex items-center justify-center flex-shrink-0 ${p||""}`,style:{background:`linear-gradient(135deg, ${s.accent}20, ${s.accent}40)`,color:s.accent,...b},children:n.jsx(zt,{size:22})}),n.jsx("div",{children:n.jsx("h3",{className:`m-0 text-xl font-bold leading-tight ${j||""}`,style:{color:s.textPrimary,...P},children:"Update Avatar"})})]}),n.jsx("button",{onClick:e,"aria-label":"Close avatar modal",className:`bg-transparent border-0 cursor-pointer p-2 rounded w-9 h-9 flex items-center justify-center flex-shrink-0 transition-all hover:bg-white/10 ${m||""}`,style:{color:s.textTertiary,...x},children:n.jsx(rt,{size:20})})]}),n.jsxs("div",{className:`flex flex-col gap-5 ${g||""}`,style:_,children:[n.jsxs("div",{children:[n.jsxs("label",{htmlFor:"avatar-url",className:`flex items-center gap-1.5 mb-2 text-sm font-medium ${M||""}`,style:{color:s.textPrimary,...k},children:[n.jsx(Fn,{size:16}),"Avatar URL"]}),n.jsxs("div",{className:`relative ${F||""}`,style:q,children:[n.jsx("input",{type:"url",id:"avatar-url",placeholder:"https://example.com/your-avatar.jpg",value:L,onChange:S=>ee(S.target.value),className:`w-full pl-11 pr-4 py-3.5 rounded-xl border text-base outline-none transition-all focus:shadow-[0_0_0_3px_rgba(var(--accent),0.2)] ${X||""}`,style:{borderColor:te.type==="error"?s.error:te.type==="success"?s.success:s.border,backgroundColor:"transparent",color:s.textPrimary,...R},onFocus:S=>{S.currentTarget.style.borderColor=s.accent,S.currentTarget.style.boxShadow=`0 0 0 3px ${s.accent}20`},onBlur:S=>{S.currentTarget.style.borderColor=te.type==="error"?s.error:te.type==="success"?s.success:s.border,S.currentTarget.style.boxShadow="none"},disabled:de}),n.jsx("div",{className:`absolute left-4 top-1/2 -translate-y-1/2 ${B||""}`,style:{color:s.textTertiary,...H},children:n.jsx(Fr,{size:18})})]}),te.message&&n.jsxs("div",{className:`flex items-center gap-1.5 mt-2 text-xs ${te.type==="success"?J||"":te.type==="error"?W||"":$||""} ${se||""}`,style:{color:te.type==="success"?s.success:te.type==="error"?s.error:s.textTertiary,...Q,...te.type==="success"?G:{},...te.type==="error"?N:{},...te.type==="warning"?A:{}},children:[te.type==="success"&&n.jsx(Ee,{size:14}),te.type==="error"&&n.jsx(be,{size:14}),te.type==="warning"&&n.jsx(be,{size:14}),te.message]})]}),L&&te.type==="success"&&n.jsxs("div",{className:`p-4 rounded-xl text-center ${O||""}`,style:{backgroundColor:`${s.success}10`,border:`1px solid ${s.success}20`,...D},children:[n.jsx("p",{className:`text-sm font-medium mb-3 m-0 ${Y||""}`,style:{color:s.textSecondary,...d},children:"Preview"}),n.jsx("img",{src:L,alt:"Avatar preview",className:`w-20 h-20 rounded-full object-cover border-2 mx-auto ${h||""}`,style:{borderColor:`${s.success}40`,...w},onError:S=>{S.currentTarget.style.display="none"}})]})]}),n.jsxs("div",{className:`flex gap-3 ${Ne?"flex-col-reverse":"flex-row"} justify-end items-stretch mt-6 ${E||""}`,style:V,children:[n.jsx("button",{onClick:e,disabled:de,className:`py-2.5 px-6 rounded-xl border bg-transparent text-sm font-medium cursor-pointer transition-all hover:-translate-y-0.5 disabled:opacity-60 disabled:cursor-not-allowed disabled:translate-y-0 ${Ne?"w-full":"flex-1 min-w-[120px]"} ${ce||""}`,style:{borderColor:s.border,color:s.textPrimary,...C},children:"Cancel"}),n.jsx("button",{onClick:Pe,disabled:de||!te.isValid,className:`py-2.5 px-6 rounded-xl border-none text-sm font-semibold flex items-center justify-center gap-2 transition-all hover:-translate-y-0.5 disabled:opacity-60 disabled:cursor-not-allowed disabled:translate-y-0 ${Ne?"w-full":"flex-1 min-w-[140px]"} ${oe||""}`,style:{background:`linear-gradient(135deg, ${s.accent}, ${s.accent}E6)`,color:"#fff",opacity:de||!te.isValid?.6:1,boxShadow:de||!te.isValid?"none":`0 4px 12px ${s.accent}40`,...ie},children:de?n.jsxs(n.Fragment,{children:[n.jsx(ye,{size:16,className:"animate-spin"}),"Updating..."]}):n.jsxs(n.Fragment,{children:[n.jsx(zt,{size:16}),"Update Avatar"]})})]})]})})},Qn=({isOpen:t,onClose:e,onSuccess:r,onError:s,userId:a,colors:o,overlayClassName:i,overlayStyle:l,modalClassName:f,modalStyle:u,headerClassName:p,headerStyle:b,iconContainerClassName:j,iconContainerStyle:P,titleClassName:m,titleStyle:x,closeButtonClassName:g,closeButtonStyle:_,formClassName:M,formStyle:k,formGroupClassName:F,formGroupStyle:q,labelClassName:X,labelStyle:R,inputContainerClassName:B,inputContainerStyle:H,inputClassName:se,inputStyle:Q,inputIconClassName:J,inputIconStyle:G,toggleButtonClassName:W,toggleButtonStyle:N,errorClassName:$,errorStyle:A,actionsClassName:O,actionsStyle:D,cancelButtonClassName:Y,cancelButtonStyle:d,submitButtonClassName:h,submitButtonStyle:w})=>{const E=qe(),[V,ce]=y.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[C,oe]=y.useState({}),[ie,L]=y.useState(!1),[ee,de]=y.useState({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[we,Ne]=y.useState(!1);if(y.useEffect(()=>{if(typeof window>"u")return;const S=()=>{Ne(window.innerWidth<640)};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]),!t)return null;const ke=S=>{const{name:ne,value:_e}=S.target;ce(xe=>({...xe,[ne]:_e})),C[ne]&&oe(xe=>({...xe,[ne]:""}))},te=S=>{de(ne=>({...ne,[S]:!ne[S]}))},je=()=>{const S={};return V.currentPassword||(S.currentPassword="Current password is required"),V.newPassword?V.newPassword.length<6&&(S.newPassword="Password must be at least 6 characters"):S.newPassword="New password is required",V.newPassword!==V.confirmPassword&&(S.confirmPassword="Passwords do not match"),oe(S),Object.keys(S).length===0},Pe=async S=>{if(S.preventDefault(),!!je()){L(!0);try{const{data:ne}=await E.changePassword({currentPassword:V.currentPassword,newPassword:V.newPassword,userId:a});ne.success?(r(ne.message||"Password updated successfully"),ce({currentPassword:"",newPassword:"",confirmPassword:""}),e()):s(ne.message||"Failed to update password")}catch(ne){s(ne.response?.data?.message||"Something went wrong")}finally{L(!1)}}},Fe=[{field:"currentPassword",label:"Current Password",icon:n.jsx(Ft,{size:18})},{field:"newPassword",label:"New Password",icon:n.jsx(We,{size:18})},{field:"confirmPassword",label:"Confirm Password",icon:n.jsx(We,{size:18})}];return n.jsx("div",{className:`fixed inset-0 flex items-center justify-center p-4 z-[1000] ${i||""}`,style:{backgroundColor:"rgba(0,0,0,0.7)",backdropFilter:"blur(6px)",...l},children:n.jsxs("div",{className:`w-full max-w-[440px] p-6 rounded-2xl border shadow-2xl max-h-[90vh] overflow-y-auto ${f||""}`,style:{backgroundColor:o.surface,borderColor:o.border,...u},children:[n.jsxs("div",{className:`flex justify-between items-start mb-6 gap-3 ${p||""}`,style:b,children:[n.jsxs("div",{className:`flex items-center gap-3 flex-1 ${j||""}`,style:P,children:[n.jsx("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center flex-shrink-0 ${j||""}`,style:{background:`linear-gradient(135deg, ${o.accent}20, ${o.accent}40)`,color:o.accent,...P},children:n.jsx(We,{size:20})}),n.jsx("div",{children:n.jsx("h3",{className:`m-0 text-lg font-semibold leading-normal ${m||""}`,style:{color:o.textPrimary,...x},children:"Change Password"})})]}),n.jsx("button",{onClick:e,"aria-label":"Close password change modal",className:`bg-transparent border-0 cursor-pointer p-2 rounded flex-shrink-0 w-9 h-9 flex items-center justify-center transition-all hover:bg-white/10 ${g||""}`,style:{color:o.textTertiary,..._},children:n.jsx(rt,{size:20})})]}),n.jsxs("form",{className:M||"",style:k,onSubmit:Pe,children:[Fe.map(({field:S,label:ne,icon:_e})=>n.jsxs("div",{className:`mb-5 relative ${F||""}`,style:q,children:[n.jsx("label",{htmlFor:S,className:`block mb-2 text-sm font-medium leading-normal ${X||""}`,style:{color:o.textPrimary,...R},children:ne}),n.jsxs("div",{className:`relative ${B||""}`,style:H,children:[n.jsx("div",{className:`absolute left-3.5 top-1/2 -translate-y-1/2 z-[2] ${J||""}`,style:{color:o.textTertiary,...G},children:_e}),n.jsx("input",{type:ee[S]?"text":"password",id:S,name:S,placeholder:`Enter ${ne.toLowerCase()}`,value:V[S],onChange:ke,className:`w-full pl-11 pr-12 py-3.5 rounded-xl border text-base outline-none transition-all focus:shadow-[0_0_0_3px_rgba(var(--accent),0.2)] ${se||""}`,style:{borderColor:C[S]?o.error:o.border,backgroundColor:"transparent",color:o.textPrimary,...Q},onFocus:xe=>{xe.currentTarget.style.borderColor=o.accent,xe.currentTarget.style.boxShadow=`0 0 0 3px ${o.accent}20`},onBlur:xe=>{xe.currentTarget.style.borderColor=C[S]?o.error:o.border,xe.currentTarget.style.boxShadow="none"}}),n.jsx("button",{type:"button",onClick:()=>te(S),className:`absolute right-3.5 top-1/2 -translate-y-1/2 bg-transparent border-0 cursor-pointer p-1 rounded w-8 h-8 flex items-center justify-center transition-all hover:bg-white/10 ${W||""}`,style:{color:o.textTertiary,...N},children:ee[S]?n.jsx(Lt,{size:18}):n.jsx(qt,{size:18})})]}),C[S]&&n.jsxs("div",{className:`text-xs mt-1.5 flex items-center gap-1.5 ${$||""}`,style:{color:o.error,...A},children:[n.jsx("span",{className:"text-base",children:"⚠"}),C[S]]})]},S)),n.jsxs("div",{className:`flex gap-3 ${we?"flex-col-reverse":"flex-row"} justify-end items-stretch ${O||""}`,style:D,children:[n.jsx("button",{type:"button",onClick:e,disabled:ie,className:`py-3.5 px-6 rounded-xl border bg-transparent text-sm font-medium cursor-pointer transition-all hover:-translate-y-0.5 disabled:opacity-60 disabled:cursor-not-allowed disabled:translate-y-0 ${we?"w-full":"flex-1 min-w-[120px]"} ${Y||""}`,style:{borderColor:o.border,color:o.textPrimary,...d},children:"Cancel"}),n.jsx("button",{type:"submit",disabled:ie,className:`py-3.5 px-6 rounded-xl border-none text-sm font-semibold flex items-center justify-center gap-2 transition-all hover:-translate-y-0.5 disabled:opacity-80 disabled:cursor-not-allowed disabled:translate-y-0 ${we?"w-full":"flex-1 min-w-[140px]"} ${h||""}`,style:{background:`linear-gradient(135deg, ${o.accent}, ${o.accent}E6)`,color:"#fff",boxShadow:ie?"none":`0 4px 12px ${o.accent}40`,...w},children:ie?n.jsxs(n.Fragment,{children:[n.jsx(ye,{size:16,className:"animate-spin"}),"Updating..."]}):"Update Password"})]})]})]})})},ea=({isOpen:t,onClose:e,onVerify:r,onSendOTP:s,verifyFormData:a,setVerifyFormData:o,otpSent:i,verifying:l,user:f,colors:u,darkMode:p,overlayClassName:b,overlayStyle:j,modalClassName:P,modalStyle:m,headerClassName:x,headerStyle:g,titleClassName:_,titleStyle:M,closeButtonClassName:k,closeButtonStyle:F,formClassName:q,formStyle:X,formGroupClassName:R,formGroupStyle:B,labelClassName:H,labelStyle:se,inputContainerClassName:Q,inputContainerStyle:J,inputClassName:G,inputStyle:W,emailInputClassName:N,emailInputStyle:$,otpInputClassName:A,otpInputStyle:O,actionsClassName:D,actionsStyle:Y,buttonClassName:d,buttonStyle:h,sendButtonClassName:w,sendButtonStyle:E,verifyButtonClassName:V,verifyButtonStyle:ce})=>{if(!t)return null;const C=()=>{e(),o({email:f?.email||"",otp:""})};return n.jsx("div",{className:`fixed inset-0 flex items-center justify-center z-[100] p-5 ${b||""}`,style:{backgroundColor:p?"rgba(0, 0, 0, 0.8)":"rgba(0, 0, 0, 0.5)",...j},children:n.jsxs("div",{className:`w-full max-w-[440px] rounded-2xl p-6 shadow-lg backdrop-blur-md border ${P||""}`,style:{backgroundColor:u.surface,borderColor:u.border,...m},children:[n.jsxs("div",{className:`flex items-center justify-between mb-6 ${x||""}`,style:g,children:[n.jsx("h3",{className:`m-0 text-xl font-semibold ${_||""}`,style:{color:u.textPrimary,...M},children:"Verify Your Email"}),n.jsx("button",{onClick:C,className:`bg-transparent border-0 cursor-pointer p-1 rounded flex items-center justify-center transition-colors hover:bg-white/10 ${k||""}`,style:{color:u.textTertiary,...F},"aria-label":"Close verification modal",children:n.jsx(rt,{size:20,"aria-hidden":"true"})})]}),n.jsxs("form",{className:`flex flex-col gap-5 ${q||""}`,style:X,onSubmit:r,children:[n.jsxs("div",{className:`flex flex-col gap-2 ${R||""}`,style:B,children:[n.jsx("label",{className:`text-sm font-medium ${H||""}`,style:{color:u.textSecondary,...se},children:"Email"}),n.jsxs("div",{className:`relative flex items-center ${Q||""}`,style:J,children:[n.jsx(Le,{size:18,className:"absolute left-3 pointer-events-none",style:{color:u.textTertiary},"aria-hidden":"true"}),n.jsx("input",{type:"email",value:a.email,onChange:oe=>o(ie=>({...ie,email:oe.target.value})),placeholder:"Enter your email",className:`w-full pl-10 pr-3 py-3 rounded-lg border text-sm outline-none transition-all focus:shadow-[0_0_0_3px_rgba(var(--accent),0.2)] ${G||""} ${N||""}`,style:{backgroundColor:u.surfaceLight,color:u.textPrimary,borderColor:u.border,...W,...$},required:!0,"aria-required":"true","aria-label":"Email address"})]})]}),i&&n.jsxs("div",{className:`flex flex-col gap-2 ${R||""}`,style:B,children:[n.jsx("label",{className:`text-sm font-medium ${H||""}`,style:{color:u.textSecondary,...se},children:"OTP"}),n.jsxs("div",{className:`relative flex items-center ${Q||""}`,style:J,children:[n.jsx(Dr,{size:18,className:"absolute left-3 pointer-events-none",style:{color:u.textTertiary},"aria-hidden":"true"}),n.jsx("input",{type:"text",value:a.otp,onChange:oe=>o(ie=>({...ie,otp:oe.target.value})),placeholder:"Enter OTP",className:`w-full pl-10 pr-3 py-3 rounded-lg border text-sm outline-none transition-all focus:shadow-[0_0_0_3px_rgba(var(--accent),0.2)] ${G||""} ${A||""}`,style:{backgroundColor:u.surfaceLight,color:u.textPrimary,borderColor:u.border,...W,...O},required:!0,"aria-required":"true","aria-label":"One-time password"})]})]}),n.jsx("div",{className:`flex gap-3 ${D||""}`,style:Y,children:i?n.jsxs("button",{type:"submit",disabled:l,className:`flex-1 flex items-center justify-center gap-2 py-3 px-5 rounded-lg border-none text-white font-medium cursor-pointer transition-all text-sm hover:-translate-y-0.5 hover:shadow-lg disabled:opacity-60 disabled:cursor-not-allowed disabled:translate-y-0 ${d||""} ${V||""}`,style:{background:`linear-gradient(to right, ${u.accent}, ${u.accentHover})`,opacity:l?.7:1,...h,...ce},"aria-label":l?"Verifying email":"Verify email",children:[l?n.jsx(ye,{size:16,className:"animate-spin","aria-hidden":"true"}):n.jsx(Ee,{size:16,"aria-hidden":"true"}),l?"Verifying...":"Verify Email"]}):n.jsxs("button",{type:"button",onClick:s,disabled:l,className:`flex-1 flex items-center justify-center gap-2 py-3 px-5 rounded-lg border-none text-white font-medium cursor-pointer transition-all text-sm hover:-translate-y-0.5 hover:shadow-lg disabled:opacity-60 disabled:cursor-not-allowed disabled:translate-y-0 ${d||""} ${w||""}`,style:{background:`linear-gradient(to right, ${u.accent}, ${u.accentHover})`,opacity:l?.7:1,...h,...E},"aria-label":l?"Sending OTP":"Send OTP",children:[l?n.jsx(ye,{size:16,className:"animate-spin","aria-hidden":"true"}):n.jsx(Vt,{size:16,"aria-hidden":"true"}),l?"Sending...":"Send OTP"]})})]})]})})},ta=({darkMode:t=!0,homeUrl:e,onLogout:r,onVerify:s,primaryColor:a="#00C212",containerClassName:o,containerStyle:i,mainContainerClassName:l,mainContainerStyle:f,notificationClassName:u,notificationStyle:p,successNotificationClassName:b,successNotificationStyle:j,errorNotificationClassName:P,errorNotificationStyle:m,loadingContainerClassName:x,loadingContainerStyle:g,noUserContainerClassName:_,noUserContainerStyle:M,leftColumnClassName:k,leftColumnStyle:F,avatarSectionClassName:q,avatarSectionStyle:X,avatarContainerClassName:R,avatarContainerStyle:B,avatarImageClassName:H,avatarImageStyle:se,avatarButtonClassName:Q,avatarButtonStyle:J,userNameClassName:G,userNameStyle:W,userUsernameClassName:N,userUsernameStyle:$,userEmailClassName:A,userEmailStyle:O,verificationBadgeClassName:D,verificationBadgeStyle:Y,actionsContainerClassName:d,actionsContainerStyle:h,editButtonClassName:w,editButtonStyle:E,verifyButtonClassName:V,verifyButtonStyle:ce,moreButtonClassName:C,moreButtonStyle:oe,dropdownClassName:ie,dropdownStyle:L,dropdownItemClassName:ee,dropdownItemStyle:de,rightColumnClassName:we,rightColumnStyle:Ne,personalInfoSectionClassName:ke,personalInfoSectionStyle:te,sectionTitleClassName:je,sectionTitleStyle:Pe,fieldContainerClassName:Fe,fieldContainerStyle:S,fieldLabelClassName:ne,fieldLabelStyle:_e,fieldInputClassName:xe,fieldInputStyle:xt,fieldDisplayClassName:st,fieldDisplayStyle:Ce,securitySectionClassName:Te,securitySectionStyle:yt,securityItemClassName:gt,securityItemStyle:Ae,securityBadgeClassName:Bt,securityBadgeStyle:Ht,securityInfoClassName:Z,securityInfoStyle:Ye})=>{const De=qe(),[Oe,na]=y.useState(null),[U,$e]=y.useState(),[aa,Hr]=y.useState(!0),[Wr,Wt]=y.useState(!1),[bt,Jr]=y.useState(!1),[oa,Yr]=y.useState(!1),[ia,Kr]=y.useState(!1),[la,Xr]=y.useState(!1),[ca,Jt]=y.useState(!1),[wt,Gr]=y.useState(!1),[Zr,Qr]=y.useState(!1),[Ve,es]=y.useState(null),[jt,go]=y.useState(!1),[Ue,vt]=y.useState({email:"",otp:""}),[da,Yt]=y.useState(!1),[ua,Nt]=y.useState(!1);y.useEffect(()=>{if(typeof window<"u"){const v=()=>na(window.innerWidth);return v(),window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)}},[]);const le=(v,z)=>{es({type:v,message:z}),setTimeout(()=>es(null),3e3)},Et=()=>{Qr(!0);const v=setTimeout(()=>{Gr(!1),Qr(!1)},150);return()=>clearTimeout(v)};y.useEffect(()=>{const v=z=>{const re=document.querySelector(".dropdown-container");re&&!re.contains(z.target)&&Et()};return wt&&document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[wt]);const fa=async()=>{if(!Ue.email||!/\S+@\S+\.\S+/.test(Ue.email)){le("error","Please enter a valid email");return}if(!U?.id){le("error","User not found. Cannot send OTP.");return}try{Nt(!0);const v=await De.requestEmailVerificationOTP({userId:U.id,email:Ue.email}),z=v?.data?.success??v?.success,re=v?.data?.message??v?.message;z?(le("success",re||"OTP sent to email!"),Yt(!0)):le("error",re||"Failed to send OTP")}catch(v){const z=v?.response?.data?.message||v?.message||"Server error";le("error",z)}finally{Nt(!1)}},pa=async v=>{if(v.preventDefault(),!Ue.email||!Ue.otp){le("error","Please fill in all fields");return}if(!U){le("error","User not found");return}try{Nt(!0);const z=await De.verifyEmail({email:Ue.email,otp:Ue.otp}),re=z?.data?.success??z?.success,fe=z?.data?.message??z?.message;if(re){le("success",fe||"Email verified!");const Se={...U,isVerified:!0};$e(Se),typeof s=="function"&&s(Se),vt({email:Se.email,otp:""}),Yt(!1),Jt?.(!1)}else le("error",fe||"Verification failed")}catch(z){const re=z?.response?.data?.message||z?.message||"Something went wrong";le("error",re)}finally{Nt(!1)}},ma=async v=>{if(!U)return!1;try{const z=await De.updateUser({userId:U.id,avatarUrl:v});if(z?.success){const re={...U,...z.user,avatarUrl:v};return $e(re),le("success","Avatar updated successfully!"),!0}return le("error",z?.message||"Failed to update avatar"),!1}catch(z){return console.error("Avatar update error:",z),le("error","Failed to update avatar"),!1}},ha=async()=>{if(U){Jr(!0);try{const v=U.email,z=await De.updateUser({userId:U.id,...U});if(z.success&&z.user){const re=z.user.email!==v,fe={...U,...z.user,isVerified:re?!1:U.isVerified};$e(fe),localStorage.setItem("userInfo",JSON.stringify(fe)),le("success",re?"Email updated. Please verify your new email.":"Profile updated successfully"),Wt(!1)}else le("error",z.message||"Update failed")}catch(v){console.error(v),le("error","Update failed")}finally{Jr(!1)}}},xa=async v=>{try{const z=await De.checkIfUserExists(v);z?.success===!0&&z?.exists===!1&&(console.warn("❌ User does not exist on server. Clearing session..."),localStorage.removeItem("userInfo"),$e(null))}catch(z){console.error("⚠️ User validation request failed:",z)}};y.useEffect(()=>{(async()=>{try{Hr(!0);const z=await De.checkUserSession();if(z.user?.id){const re=z.user.id,fe=await De.getUserProfile({userId:re});if(fe.user){const Se=fe.user;$e(Se),xa(re)}else $e(null),localStorage.removeItem("userInfo")}else $e(null),localStorage.removeItem("userInfo")}catch(z){console.error("User init failed:",z),$e(null),localStorage.removeItem("userInfo")}finally{Hr(!1)}})()},[]),y.useEffect(()=>{U?.email&&vt(v=>({...v,email:U.email}))},[U?.email]);const ts=(v,z)=>{let re=parseInt(v.replace("#",""),16),fe=(re>>16)+z,Se=(re>>8&255)+z,Kt=(re&255)+z;return fe=Math.min(255,Math.max(0,fe)),Se=Math.min(255,Math.max(0,Se)),Kt=Math.min(255,Math.max(0,Kt)),`#${(Kt|Se<<8|fe<<16).toString(16).padStart(6,"0")}`},T=t?{background:"#000000",surface:"#09090b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:a,accentHover:ts(a,-15),success:"#10b981",error:"#ef4444",border:"#27272a",warning:"#f59e0b"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:a,accentHover:ts(a,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7",warning:"#d97706"};if(aa)return n.jsx("div",{className:`w-full min-h-[400px] flex items-center justify-center ${x||""}`,style:{color:T.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",...g},children:n.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[n.jsx(ye,{size:40,className:"animate-spin",color:T.accent,"aria-hidden":"true"}),n.jsx("p",{className:"m-0",style:{color:T.textTertiary},children:"Loading your profile..."})]})});if(!U)return n.jsx("div",{className:`w-full min-h-[400px] flex items-center justify-center ${_||""}`,style:{color:T.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",...M},children:n.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[n.jsx(be,{size:40,color:T.error,"aria-hidden":"true"}),n.jsx("p",{className:"m-0",style:{color:T.textTertiary},children:"No profile found. Please log in again."})]})});const ya=[{label:"Username",value:U.username||"Not set",name:"username",type:"text",icon:Je,readonly:!0},{label:"Full Name",value:U.name,name:"name",type:"text",icon:Je},{label:"Email Address",value:U.email,name:"email",type:"email",icon:Le},{label:"Role",value:U.role||"user",name:"role",type:"text",icon:Mt,readonly:!0},{label:"Phone Number",value:U.phone||"Not set",name:"phone",type:"tel",icon:Mn},{label:"Address",value:U.address||"Not provided",name:"address",type:"text",icon:Dn}];return n.jsxs("div",{className:`w-full flex items-center justify-center ${o||""}`,style:{color:T.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",lineHeight:1.5,minHeight:"80vh",...i},children:[Ve&&n.jsxs("div",{className:`fixed top-5 right-5 px-6 py-3 rounded-xl text-sm font-medium border shadow-lg backdrop-blur-sm z-[1000] animate-in slide-in-from-right duration-300 flex items-center gap-2 max-w-[400px] ${Ve.type==="success"?b||"":P||""} ${u||""}`,style:{...Ve.type==="success"?{backgroundColor:t?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",borderColor:t?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)",color:t?"#34d399":"#059669"}:{backgroundColor:t?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)",borderColor:t?"rgba(239, 68, 68, 0.3)":"rgba(239, 68, 68, 0.2)",color:t?"#f87171":"#dc2626"},...p,...Ve.type==="success"?j:{},...Ve.type==="error"?m:{}},role:"alert","aria-live":"polite",children:[Ve.type==="success"?n.jsx(Ee,{size:20,"aria-hidden":"true"}):n.jsx(be,{size:20,"aria-hidden":"true"}),Ve.message]}),n.jsx("div",{className:`max-w-[1200px] mx-auto w-full box-border ${l||""}`,style:f,children:n.jsxs("div",{className:`grid gap-6 grid-cols-1 ${Oe&&window.innerWidth>=1024?"grid-cols-[1fr_2fr] gap-[10px]":""} ${Oe&&window.innerWidth>=768&&window.innerWidth<1024?"gap-[10px]":""} ${Oe&&window.innerWidth>=600&&window.innerWidth<768?"gap-[28px]":""}`,children:[n.jsxs("div",{className:`flex flex-col gap-1.5 h-full ${k||""}`,style:F,children:[n.jsxs("section",{className:`p-6 rounded-2xl border shadow-lg text-center flex flex-col justify-center items-center flex-1 min-h-[300px] relative ${q||""}`,style:{backgroundColor:T.surface,borderColor:T.border,...X},children:[e&&n.jsx("a",{href:e||"/",target:"_self",rel:"noopener noreferrer",className:"absolute top-[18px] left-[18px]",children:n.jsx(qn,{size:20,style:{color:t?"#ffffff":"#000000"}})}),n.jsxs("div",{className:`relative inline-block mb-4 ${R||""}`,style:B,children:[n.jsx("img",{src:U.avatarUrl||`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(U.name)}`,alt:`Profile avatar of ${U.name}`,className:`w-32 h-32 rounded-full object-cover shadow-lg border-3 ${H||""}`,style:{borderColor:T.border,...se},width:128,height:128,loading:"eager"}),n.jsx("button",{onClick:()=>Yr(!0),className:`absolute bottom-2 right-2 bg-transparent border-none cursor-pointer p-2 rounded-full flex items-center justify-center w-8 h-8 transition-all ${Q||""}`,style:{backgroundColor:T.accent,color:"white",...J},"aria-label":"Change profile picture",children:n.jsx(zt,{size:16,"aria-hidden":"true"})})]}),n.jsx("h2",{className:`text-2xl font-semibold mb-1 m-0 ${G||""}`,style:{color:T.textPrimary,...W},children:U.name}),U.username&&n.jsxs("h2",{className:`text-lg font-semibold mb-1 m-0 ${N||""}`,style:{color:T.textTertiary,...$},children:["@",U.username||"Not set"]}),n.jsx("p",{className:`m-0 mb-2 ${A||""}`,style:{color:T.textTertiary,...O},children:U.email}),n.jsxs("div",{className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium mt-2 ${D||""}`,style:{backgroundColor:U.isVerified?t?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)":t?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:U.isVerified?T.success:T.warning,borderColor:U.isVerified?t?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)":t?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)",borderWidth:"1px",borderStyle:"solid",...Y},children:[U.isVerified?n.jsx(Ee,{size:16,"aria-hidden":"true"}):n.jsx(be,{size:16,"aria-hidden":"true"}),U.isVerified?"Email Verified":"Not Verified"]})]}),n.jsx("nav",{className:`flex flex-col gap-1.5 ${d||""}`,style:h,children:Wr?n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>Wt(!1),className:`bg-transparent border text-sm font-medium cursor-pointer transition-all flex items-center justify-center gap-2 min-h-9 px-5 rounded ${Oe&&window.innerWidth<1024?"flex-1":"auto"} ${w||""}`,style:{backgroundColor:T.surfaceLight,borderColor:T.border,color:T.textPrimary,...E},children:[n.jsx(rt,{size:16,"aria-hidden":"true"}),"Cancel"]}),n.jsxs("button",{onClick:ha,disabled:bt,className:`bg-transparent border-none text-sm font-medium cursor-pointer transition-all flex items-center justify-center gap-2 min-h-9 px-5 rounded disabled:opacity-70 disabled:cursor-not-allowed ${Oe&&window.innerWidth<1024?"flex-1":"auto"} ${w||""}`,style:{background:`linear-gradient(to right, ${T.accent}, ${T.accentHover})`,opacity:bt?.7:1,color:"white",...E},children:[bt?n.jsx(ye,{size:16,className:"animate-spin","aria-hidden":"true"}):n.jsx(Bn,{size:16,"aria-hidden":"true"}),bt?"Saving...":"Save Changes"]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>Wt(!0),className:`bg-transparent border-none text-sm font-medium cursor-pointer transition-all flex items-center justify-center gap-2 min-h-9 px-5 rounded ${Oe&&window.innerWidth<1024?"flex-1":"auto"} ${w||""}`,style:{background:`linear-gradient(to right, ${T.accent}, ${T.accentHover})`,color:"white",...E},children:[n.jsx(Vn,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),!U.isVerified&&n.jsxs("button",{onClick:()=>Jt(!0),disabled:jt,className:`bg-transparent border-none text-sm font-medium cursor-pointer transition-all flex items-center justify-center gap-2 min-h-9 px-5 rounded disabled:opacity-70 disabled:cursor-not-allowed ${Oe&&window.innerWidth<1024?"flex-1":"auto"} ${V||""}`,style:{background:"linear-gradient(to right, #fbbf24, #f59e0b)",color:"white",opacity:jt?.7:1,...ce},children:[jt?n.jsx(ye,{size:14,className:"animate-spin","aria-hidden":"true"}):n.jsx(Vt,{size:14,"aria-hidden":"true"}),jt?"Sending...":"Verify Email"]}),n.jsxs("div",{className:"relative",children:[n.jsxs("button",{onClick:()=>Gr(!wt),className:`bg-transparent border-none text-sm font-medium cursor-pointer transition-all flex items-center justify-center gap-2 min-h-9 px-5 rounded w-full box-border ${C||""}`,style:{backgroundColor:T.surfaceLight,color:T.textPrimary,...oe},children:[n.jsx(Ln,{size:16,"aria-hidden":"true"}),"More Actions"]}),wt&&n.jsxs("div",{className:`dropdown-container ${Zr?"closing":""} ${ie||""}`,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:T.surface,borderColor:T.border,borderWidth:"1px",borderStyle:"solid",borderRadius:"12px 12px 0 0",boxShadow:"0 -8px 24px rgba(0, 0, 0, 0.25)",zIndex:200,marginBottom:"6px",overflow:"hidden",animation:`${Zr?"drawerSlideDown":"drawerSlideUp"} 0.25s ease-out forwards`,...L},children:[n.jsxs("button",{onClick:()=>{Kr(!0),Et()},className:`w-full py-3.5 px-4.5 bg-transparent border-none text-sm font-medium cursor-pointer transition-all flex items-center gap-2 text-left ${ee||""}`,style:{color:T.textPrimary,...de},onMouseEnter:v=>v.currentTarget.style.backgroundColor=T.surfaceLight,onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[n.jsx(Ft,{size:14,"aria-hidden":"true"}),"Change Password"]}),r&&n.jsxs("button",{onClick:()=>{r(),Et()},className:`w-full py-3.5 px-4.5 bg-transparent border-none text-sm font-medium cursor-pointer transition-all flex items-center gap-2 text-left ${ee||""}`,style:{color:t?"#fca5a5":"#dc2626",...de},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=t?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[n.jsx(Dt,{size:14,"aria-hidden":"true"}),"Logout"]}),n.jsxs("button",{onClick:()=>{Xr(!0),Et()},className:`w-full py-3.5 px-4.5 bg-transparent border-none text-sm font-semibold cursor-pointer transition-all flex items-center gap-2 text-left ${ee||""}`,style:{color:"#ef4444",...de},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=t?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[n.jsx(ht,{size:14,"aria-hidden":"true"}),"Delete Account"]})]})]})]})})]}),n.jsxs("div",{className:`min-w-0 flex flex-col gap-3 ${we||""}`,style:Ne,children:[n.jsxs("section",{className:`p-6 rounded-2xl border shadow-lg ${ke||""}`,style:{backgroundColor:T.surface,borderColor:T.border,...te},children:[n.jsxs("h2",{className:`text-xl font-semibold mb-6 m-0 flex items-center gap-2 ${je||""}`,style:{color:T.textSecondary,...Pe},children:[n.jsx(Je,{size:20,"aria-hidden":"true"}),"Personal Information"]}),n.jsx("div",{className:`grid gap-5 grid-cols-1 ${Oe&&window.innerWidth>=600?"grid-cols-2 gap-5":""}`,children:ya.map(v=>{const z=v.icon;return n.jsxs("div",{className:`flex flex-col gap-2 ${Fe||""}`,style:S,children:[n.jsxs("label",{className:`text-xs font-medium flex items-center gap-2 ${ne||""}`,style:{color:T.textTertiary,..._e},children:[n.jsx(z,{size:16,"aria-hidden":"true"}),v.label]}),Wr&&!v.readonly?n.jsx("input",{type:v.type,name:v.name,value:U[v.name],onChange:re=>$e(fe=>fe&&{...fe,[re.target.name]:re.target.value}),className:`w-full py-3 px-3 rounded-lg border text-xs outline-none transition-all min-h-11 box-border ${xe||""}`,style:{borderColor:a,backgroundColor:"transparent",color:T.textPrimary,opacity:v.readonly?.7:1,...xt},placeholder:`Enter ${v.label.toLowerCase()}`,"aria-label":v.label}):n.jsx("div",{className:`py-3 px-3 rounded-lg border border-transparent text-xs min-h-11 flex items-center box-border ${st||""}`,style:{color:T.textPrimary,backgroundColor:t?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)",...Ce},children:v.value})]},v.name)})})]}),n.jsxs("section",{className:`p-[30px_24px] rounded-2xl border shadow-lg ${Te||""}`,style:{backgroundColor:T.surface,borderColor:T.border,...yt},children:[n.jsxs("h2",{className:`text-xl font-semibold mb-6 m-0 flex items-center gap-2 ${je||""}`,style:{color:T.textSecondary,...Pe},children:[n.jsx(Mt,{size:20,"aria-hidden":"true"}),"Security Status"]}),n.jsxs("div",{className:`flex flex-col gap-4 ${Te||""}`,style:yt,children:[n.jsxs("div",{className:`flex items-center justify-between py-3 ${gt||""}`,style:Ae,children:[n.jsxs("div",{className:`flex items-center gap-3 ${gt||""}`,style:{color:T.textSecondary,...Ae},children:[n.jsx(Le,{size:16,"aria-hidden":"true"}),n.jsx("span",{children:"Email Verification"})]}),n.jsx("div",{className:`px-3 py-1.5 rounded-lg text-xs font-medium flex items-center gap-1.5 ${Bt||""}`,style:{...U.isVerified?{backgroundColor:t?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",color:T.success,borderColor:t?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)"}:{backgroundColor:t?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:T.warning,borderColor:t?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"},borderWidth:"1px",borderStyle:"solid",...Ht},children:U.isVerified?n.jsxs(n.Fragment,{children:[n.jsx(Ee,{size:16,"aria-hidden":"true"}),"Verified"]}):n.jsxs(n.Fragment,{children:[n.jsx(be,{size:16,"aria-hidden":"true"}),"Not Verified"]})})]}),!U.isVerified&&n.jsx("div",{className:`p-3 rounded-lg ${Z||""}`,style:{backgroundColor:t?"rgba(100, 100, 100, 0.1)":"rgba(0, 0, 0, 0.05)",...Ye},children:n.jsx("p",{className:`text-xs m-0 ${Z||""}`,style:{color:T.textTertiary,...Ye},children:"Verify your email to unlock all features and enhance your account security."})})]})]})]})]})}),n.jsx(Zn,{isOpen:oa,onClose:()=>{Yr(!1)},onUpdate:ma,colors:T}),n.jsx(Qn,{userId:U.id,isOpen:ia,onClose:()=>Kr(!1),onSuccess:v=>le("success",v),onError:v=>le("error",v),colors:T}),n.jsx(Gn,{userId:U.id,isOpen:la,onClose:()=>Xr(!1),onSuccess:v=>le("success",v),onError:v=>le("error",v),colors:T}),n.jsx(ea,{isOpen:ca,onClose:()=>{Jt(!1),Yt(!1),vt({email:U?.email||"",otp:""})},onVerify:pa,onSendOTP:fa,verifyFormData:Ue,setVerifyFormData:vt,otpSent:da,verifying:ua,user:U,colors:T,darkMode:t}),n.jsx("style",{children:`
214
- @keyframes drawerSlideUp {
215
- from {
216
- transform: translateY(20px);
217
- opacity: 0;
218
- }
219
- to {
220
- transform: translateY(0);
221
- opacity: 1;
222
- }
223
- }
224
-
225
- @keyframes drawerSlideDown {
226
- from {
227
- transform: translateY(0);
228
- opacity: 1;
229
- }
230
- to {
231
- transform: translateY(20px);
232
- opacity: 0;
233
- }
234
- }
235
- `})]})},ra=({darkMode:t=!0,menuItems:e,onLogout:r,propUser:s,className:a="",logoutLabel:o="Sign Out",wrapperClassName:i,avatarClassName:l,dropdownClassName:f,menuItemClassName:u,logoutButtonClassName:p})=>{const b=qe(),[j,P]=y.useState(!1),[m,x]=y.useState(null),[g,_]=y.useState(!0),[M,k]=y.useState(null),F=y.useRef(null),q=y.useRef(null),[X,R]=y.useState(!1),[B,H]=y.useState(!1),[se,Q]=y.useState({top:0,left:0}),[J,G]=y.useState("bottom");y.useEffect(()=>{if(typeof window>"u")return;const N=()=>{H(window.innerWidth<768)};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]),y.useEffect(()=>{let N=!0;return(async()=>{try{if(_(!0),k(null),s){if(!s.id||!s.name||!s.email)throw new Error("Invalid user data provided");N&&x(s);return}const A=await b.checkUserSession();if(!N)return;if(!A?.authenticated||!A.user){x(null);return}const O={id:A.user.id,email:A.user.email,name:A.user.email.split("@")[0]};x(O)}catch(A){console.error("User initialization failed:",A),N&&(x(null),k(A.message||"Failed to load user"))}finally{N&&_(!1)}})(),()=>{N=!1}},[s,b]),y.useEffect(()=>{if(typeof window>"u")return;const N=()=>{if(!j||!q.current)return;const $=q.current.getBoundingClientRect(),A=window.innerWidth,O=window.innerHeight,D=280,Y=A-$.right,d=$.left;O-$.bottom;const h=Y>=D||Y>d;R(h)};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[j]),y.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const N=O=>{F.current&&!F.current.contains(O.target)&&!q.current?.contains(O.target)&&P(!1)},$=O=>{O.key==="Escape"&&P(!1)},A=()=>{j&&P(!1)};return j&&(document.addEventListener("mousedown",N),document.addEventListener("keydown",$),window.addEventListener("scroll",A)),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",$),window.removeEventListener("scroll",A)}},[j]),y.useLayoutEffect(()=>{if(!j||!q.current)return;const N=()=>{const $=q.current.getBoundingClientRect(),A=280,O=320,D=window.innerHeight-$.bottom,Y=$.top,d=window.innerWidth-$.right,h=D<O&&Y>O,w=h?$.top-O-8:$.bottom+8;let E=$.right-A;d<A&&(E=$.left),E=Math.max(8,Math.min(E,window.innerWidth-A-8)),G(h?"top":"bottom"),Q({top:w,left:E})};return N(),window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),()=>{window.removeEventListener("resize",N),window.removeEventListener("scroll",N,!0)}},[j]);const W=(N,$)=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),$())};return n.jsxs("div",{className:`relative inline-block ${i||""} ${a||""}`,ref:F,role:"menu","aria-label":"User menu",children:[n.jsx("div",{ref:q,onClick:()=>P(N=>!N),onKeyDown:N=>W(N,()=>P($=>!$)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":j,"aria-label":"Toggle user menu",className:`
236
- inline-flex items-center justify-center rounded-full cursor-pointer
237
- transition-all duration-300 ease-out
238
- ${l||""}
239
- `,children:m?.avatarUrl?n.jsx("img",{src:m.avatarUrl,alt:m?.name||"User avatar",className:`rounded-full object-cover border
240
- ${B?"w-9 h-9":"w-10 h-10"}
241
- `}):n.jsx("div",{className:`
242
- flex items-center justify-center rounded-full border font-semibold uppercase
243
- ${B?"w-9 h-9 text-sm":"w-10 h-10 text-base"}
244
- ${t?"bg-neutral-900 text-white border-neutral-700":"bg-gray-100 text-gray-900 border-gray-200"}
245
- `,children:(m?.name?.charAt(0)||"U").toUpperCase()})}),j&&n.jsx("div",{className:`
246
- fixed z-[1000]
247
- w-[260px] max-h-[340px] overflow-y-auto
248
- rounded-xl border shadow-lg p-2
249
- transition-all duration-200 ease-out
250
-
251
- ${t?"bg-neutral-900 border-neutral-800":"bg-white border-gray-200"}
252
- ${f||""}
253
- `,style:{top:se.top,left:se.left},role:"menu","aria-label":"User options",children:g?n.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 p-3",children:[n.jsx(ye,{size:16,className:`animate-spin ${t?"text-gray-400":"text-gray-500"}`}),n.jsxs("div",{className:"flex items-center gap-2 w-full",children:[n.jsx("div",{className:`w-8 h-8 rounded-full animate-pulse ${t?"bg-neutral-800":"bg-gray-200"}`}),n.jsxs("div",{className:"flex-1 space-y-2",children:[n.jsx("div",{className:`h-2 w-3/4 rounded ${t?"bg-neutral-800":"bg-gray-200"}`}),n.jsx("div",{className:`h-2 w-1/2 rounded ${t?"bg-neutral-800":"bg-gray-200"}`})]})]})]}):m?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 px-2 py-2",children:[n.jsx("img",{src:m.avatarUrl||`https://api.dicebear.com/9.x/initials/svg?seed=${m.name}`,className:"w-7 h-7 rounded-full object-cover border"}),n.jsxs("div",{className:"flex flex-col min-w-0",children:[n.jsx("div",{className:`text-xs font-semibold truncate ${t?"text-white":"text-gray-900"}`,children:m.name}),n.jsx("div",{className:`text-[10px] truncate ${t?"text-neutral-400":"text-gray-500"}`,children:m.email})]})]}),n.jsx("div",{className:"px-1 py-1 space-y-1",children:e?.map((N,$)=>{if(N.type==="divider")return n.jsx("div",{className:`h-px my-1 ${t?"bg-neutral-800":"bg-gray-200/40"}`},$);const A=`flex items-center gap-2 w-full px-2 py-2 rounded-lg text-xs transition-all
254
- ${t?"text-white hover:bg-neutral-800":"text-gray-900 hover:bg-gray-100"}`,O=n.jsxs(n.Fragment,{children:[N.icon&&n.jsx("span",{className:"text-gray-400 text-[11px]",children:N.icon}),n.jsx("span",{className:"flex-1",children:N.label})]});return N.href?n.jsx("a",{href:N.href,className:A,children:O},$):n.jsx("button",{onClick:N.onClick,className:A,children:O},$)})}),n.jsx("div",{className:"px-1 pt-1",children:n.jsxs("button",{onClick:r,className:`
255
- flex items-center gap-2 w-full px-2 py-2 rounded-lg text-xs
256
- text-red-500 hover:bg-red-500/10 transition-all
257
- `,children:[n.jsx(Dt,{size:14}),n.jsx("span",{children:o})]})})]}):n.jsxs("div",{className:"flex items-center justify-center p-3 text-xs text-gray-500",children:[n.jsx(be,{size:14,className:"mr-1"}),M||"Not signed in"]})})]})},sa=({user:t,darkMode:e=!0,primaryColor:r="#00C212",onVerify:s,containerClassName:a,containerStyle:o,buttonClassName:i,buttonStyle:l,sendButtonClassName:f,sendButtonStyle:u,verifyButtonClassName:p,verifyButtonStyle:b,inputClassName:j,inputStyle:P,emailInputClassName:m,emailInputStyle:x,otpInputClassName:g,otpInputStyle:_,notificationClassName:M,notificationStyle:k,successNotificationClassName:F,successNotificationStyle:q,errorNotificationClassName:X,errorNotificationStyle:R,headerClassName:B,headerStyle:H,titleClassName:se,titleStyle:Q,descriptionClassName:J,descriptionStyle:G,warningContainerClassName:W,warningContainerStyle:N})=>{const $=qe();if(!t)return n.jsxs("div",{className:`w-full max-w-[400px] p-6 rounded-xl flex flex-col items-center gap-1 text-center
258
- ${e?"bg-black text-white":"bg-zinc-100 text-zinc-900"}
259
- ${W||""}
260
- `,style:N,children:[n.jsx(be,{size:24,className:"mb-2"}),n.jsx("p",{className:"m-0",children:"User data is required to verify email."})]});const[A,O]=y.useState(!1),[D,Y]=y.useState({email:t?.email||"",otp:""}),[d,h]=y.useState(!1),[w,E]=y.useState(!1),[V,ce]=y.useState(null);y.useEffect(()=>{if(typeof window<"u"){const L=()=>O(window.innerWidth<768);return L(),window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)}},[]),y.useEffect(()=>{t?.email&&Y(L=>({...L,email:t.email}))},[t?.email]);const C=(L,ee)=>{ce({type:L,message:ee}),setTimeout(()=>ce(null),3e3)},oe=async()=>{if(!D.email||!/\S+@\S+\.\S+/.test(D.email)){C("error","Please enter a valid email");return}if(!t?.id){C("error","User ID missing");return}try{E(!0);const L=await $.requestEmailVerificationOTP({userId:t.id,email:D.email});if(console.log("Send OTP response:",L),L.success||L.data?.success){const ee=L.message||L.data?.message||"OTP sent!";C("success",ee),h(!0)}else{const ee=L.message||L.data?.message||"Failed to send OTP";C("error",ee)}}catch(L){console.error("Send OTP error:",L),C("error",L.message||"Server error")}finally{E(!1)}},ie=async L=>{if(L.preventDefault(),!D.email||!D.otp){C("error","Please fill in all fields");return}try{E(!0);const ee=await $.verifyEmail({email:D.email,otp:D.otp});if(ee.success){const de={...t,isVerified:!0};s?.(de),C("success",ee.message||"Email verified!"),h(!1),Y({email:t.email,otp:""})}else C("error",ee.message||"Verification failed")}catch(ee){C("error",ee.message||"Server error")}finally{E(!1)}};return n.jsxs("form",{onSubmit:ie,className:`w-full flex flex-col gap-5 p-6 rounded-xl border shadow-lg backdrop-blur-md
261
- ${e?"bg-zinc-900/60 border-white/10 text-white":"bg-white border-zinc-200 text-black"}
262
- ${A?"max-w-[340px]":"max-w-[400px]"}
263
- ${a||""}
264
- `,style:o,children:[n.jsxs("div",{className:`flex flex-col items-center text-center gap-2 ${B||""}`,style:H,children:[n.jsx(zn,{className:"text-[#00C212]",size:32}),n.jsx("h2",{className:`text-xl font-semibold ${se||""}`,style:Q,children:"Verify Your Email"}),n.jsx("p",{className:`text-sm text-zinc-400 ${J||""}`,style:G,children:"Enter your email and OTP to confirm your account"})]}),V&&n.jsxs("div",{className:`flex items-center gap-2 px-4 py-3 rounded-lg text-sm border
265
- ${V.type==="success"?`text-emerald-500 bg-emerald-500/10 border-emerald-500/30 ${F||""}`:`text-red-500 bg-red-500/10 border-red-500/30 ${X||""}`}
266
- ${M||""}
267
- `,style:V.type==="success"?{...k,...q}:{...k,...R},children:[V.type==="success"?n.jsx(Ee,{size:16}):n.jsx(be,{size:16}),V.message]}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("div",{className:"relative",children:[n.jsx(Le,{size:18,className:"absolute left-3 top-1/2 -translate-y-1/2 text-zinc-400"}),n.jsx("input",{type:"email",value:D.email,onChange:L=>Y(ee=>({...ee,email:L.target.value})),placeholder:"Enter your email",required:!0,className:`w-full h-11 pl-10 pr-3 text-sm rounded-lg border outline-none transition
268
- ${e?"bg-zinc-800/50 border-white/10 text-white placeholder:text-zinc-500 focus:border-emerald-500":"bg-zinc-50 border-zinc-200 text-black placeholder:text-zinc-400 focus:border-emerald-500"}
269
- ${j||""} ${m||""}
270
- `,style:{...P,...x}})]}),n.jsx("small",{className:"text-xs text-zinc-500",children:"We'll send a verification code to this email"})]}),d&&n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("div",{className:"relative",children:[n.jsx(Ft,{size:18,className:"absolute left-3 top-1/2 -translate-y-1/2 text-zinc-400"}),n.jsx("input",{type:"text",value:D.otp,onChange:L=>Y(ee=>({...ee,otp:L.target.value})),placeholder:"Enter OTP",required:!0,className:`w-full h-11 pl-10 pr-3 text-sm rounded-lg border outline-none transition
271
- ${e?"bg-zinc-800/50 border-white/10 text-white placeholder:text-zinc-500 focus:border-emerald-500":"bg-zinc-50 border-zinc-200 text-black placeholder:text-zinc-400 focus:border-emerald-500"}
272
- ${j||""} ${g||""}
273
- `,style:{...P,..._}})]}),n.jsx("small",{className:"text-xs text-zinc-500",children:"Check your inbox for the 6-digit code"})]}),n.jsx("div",{className:"flex gap-3",children:d?n.jsxs("button",{type:"submit",disabled:w,className:`flex-1 flex items-center justify-center gap-2 h-11 rounded-lg text-sm font-medium
274
- bg-[#00C212] hover:bg-[#00C212]/90 text-white
275
- disabled:opacity-60 disabled:cursor-not-allowed transition
276
- ${i||""} ${p||""}
277
- `,style:{...l,...b},children:[w?n.jsx(ye,{size:16,className:"animate-spin"}):n.jsx(Ee,{size:16}),w?"Verifying...":"Verify Email"]}):n.jsxs("button",{type:"button",onClick:oe,disabled:w||!t?.id,className:`flex-1 flex items-center justify-center gap-2 h-11 rounded-lg text-sm font-medium
278
- bg-[#00C212] hover:bg-[#00C212]/90 text-white
279
- disabled:opacity-60 disabled:cursor-not-allowed transition
280
- ${i||""} ${f||""}
281
- `,style:{...l,...u},children:[w?n.jsx(ye,{size:16,className:"animate-spin"}):n.jsx(Vt,{size:16}),w?"Sending...":"Send OTP"]})})]})};pe.AuthixProvider=Wn,pe.NeuctraAuthix=Sn,pe.ReactEmailVerification=sa,pe.ReactSignedIn=Kn,pe.ReactSignedOut=Xn,pe.ReactUserButton=ra,pe.ReactUserLogin=Yn,pe.ReactUserProfile=ta,pe.ReactUserSignUp=Jn,Object.defineProperty(pe,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(B,j){typeof exports=="object"&&typeof module<"u"?j(exports):typeof define=="function"&&define.amd?define(["exports"],j):(B=typeof globalThis<"u"?globalThis:B||self,j(B.NeuctraAuthix={}))})(this,(function(B){"use strict";function j(t,e){return function(){return t.apply(e,arguments)}}const{toString:ht}=Object.prototype,{getPrototypeOf:le}=Object,{iterator:Q,toStringTag:Ae}=Symbol,Z=(t=>e=>{const r=ht.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),C=t=>(t=t.toLowerCase(),e=>Z(e)===t),Y=t=>e=>typeof e===t,{isArray:M}=Array,H=Y("undefined");function V(t){return t!==null&&!H(t)&&t.constructor!==null&&!H(t.constructor)&&A(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Te=C("ArrayBuffer");function mt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Te(t.buffer),e}const wt=Y("string"),A=Y("function"),Oe=Y("number"),J=t=>t!==null&&typeof t=="object",yt=t=>t===!0||t===!1,ee=t=>{if(Z(t)!=="object")return!1;const e=le(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Ae in t)&&!(Q in t)},Et=t=>{if(!J(t)||V(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},gt=C("Date"),bt=C("File"),St=C("Blob"),Rt=C("FileList"),At=t=>J(t)&&A(t.pipe),Tt=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||A(t.append)&&((e=Z(t))==="formdata"||e==="object"&&A(t.toString)&&t.toString()==="[object FormData]"))},Ot=C("URLSearchParams"),[It,Ut,Ct,qt]=["ReadableStream","Request","Response","Headers"].map(C),Pt=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function K(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,s;if(typeof t!="object"&&(t=[t]),M(t))for(n=0,s=t.length;n<s;n++)e.call(null,t[n],n,t);else{if(V(t))return;const i=r?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let c;for(n=0;n<o;n++)c=i[n],e.call(null,t[c],c,t)}}function Ie(t,e){if(V(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n=r.length,s;for(;n-- >0;)if(s=r[n],e===s.toLowerCase())return s;return null}const F=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ue=t=>!H(t)&&t!==F;function de(){const{caseless:t,skipUndefined:e}=Ue(this)&&this||{},r={},n=(s,i)=>{const o=t&&Ie(r,i)||i;ee(r[o])&&ee(s)?r[o]=de(r[o],s):ee(s)?r[o]=de({},s):M(s)?r[o]=s.slice():(!e||!H(s))&&(r[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&K(arguments[s],n);return r}const xt=(t,e,r,{allOwnKeys:n}={})=>(K(e,(s,i)=>{r&&A(s)?t[i]=j(s,r):t[i]=s},{allOwnKeys:n}),t),Dt=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Nt=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},Ft=(t,e,r,n)=>{let s,i,o;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)o=s[i],(!n||n(o,t,e))&&!c[o]&&(e[o]=t[o],c[o]=!0);t=r!==!1&&le(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},_t=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},kt=t=>{if(!t)return null;if(M(t))return t;let e=t.length;if(!Oe(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},Lt=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&le(Uint8Array)),$t=(t,e)=>{const n=(t&&t[Q]).call(t);let s;for(;(s=n.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},Bt=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},jt=C("HTMLFormElement"),Mt=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),Ce=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Ht=C("RegExp"),qe=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};K(r,(s,i)=>{let o;(o=e(s,i,t))!==!1&&(n[i]=o||s)}),Object.defineProperties(t,n)},vt=t=>{qe(t,(e,r)=>{if(A(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(A(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},zt=(t,e)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return M(t)?n(t):n(String(t).split(e)),r},Vt=()=>{},Jt=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Kt(t){return!!(t&&A(t.append)&&t[Ae]==="FormData"&&t[Q])}const Wt=t=>{const e=new Array(10),r=(n,s)=>{if(J(n)){if(e.indexOf(n)>=0)return;if(V(n))return n;if(!("toJSON"in n)){e[s]=n;const i=M(n)?[]:{};return K(n,(o,c)=>{const l=r(o,s+1);!H(l)&&(i[c]=l)}),e[s]=void 0,i}}return n};return r(t,0)},Gt=C("AsyncFunction"),Xt=t=>t&&(J(t)||A(t))&&A(t.then)&&A(t.catch),Pe=((t,e)=>t?setImmediate:e?((r,n)=>(F.addEventListener("message",({source:s,data:i})=>{s===F&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),F.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",A(F.postMessage)),Qt=typeof queueMicrotask<"u"?queueMicrotask.bind(F):typeof process<"u"&&process.nextTick||Pe,a={isArray:M,isArrayBuffer:Te,isBuffer:V,isFormData:Tt,isArrayBufferView:mt,isString:wt,isNumber:Oe,isBoolean:yt,isObject:J,isPlainObject:ee,isEmptyObject:Et,isReadableStream:It,isRequest:Ut,isResponse:Ct,isHeaders:qt,isUndefined:H,isDate:gt,isFile:bt,isBlob:St,isRegExp:Ht,isFunction:A,isStream:At,isURLSearchParams:Ot,isTypedArray:Lt,isFileList:Rt,forEach:K,merge:de,extend:xt,trim:Pt,stripBOM:Dt,inherits:Nt,toFlatObject:Ft,kindOf:Z,kindOfTest:C,endsWith:_t,toArray:kt,forEachEntry:$t,matchAll:Bt,isHTMLForm:jt,hasOwnProperty:Ce,hasOwnProp:Ce,reduceDescriptors:qe,freezeMethods:vt,toObjectSet:zt,toCamelCase:Mt,noop:Vt,toFiniteNumber:Jt,findKey:Ie,global:F,isContextDefined:Ue,isSpecCompliantForm:Kt,toJSONObject:Wt,isAsyncFn:Gt,isThenable:Xt,setImmediate:Pe,asap:Qt,isIterable:t=>t!=null&&A(t[Q])};function w(t,e,r,n,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),s&&(this.response=s,this.status=s.status?s.status:null)}a.inherits(w,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 xe=w.prototype,De={};["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(t=>{De[t]={value:t}}),Object.defineProperties(w,De),Object.defineProperty(xe,"isAxiosError",{value:!0}),w.from=(t,e,r,n,s,i)=>{const o=Object.create(xe);a.toFlatObject(t,o,function(d){return d!==Error.prototype},u=>u!=="isAxiosError");const c=t&&t.message?t.message:"Error",l=e==null&&t?t.code:e;return w.call(o,c,l,r,n,s),t&&o.cause==null&&Object.defineProperty(o,"cause",{value:t,configurable:!0}),o.name=t&&t.name||"Error",i&&Object.assign(o,i),o};const Zt=null;function fe(t){return a.isPlainObject(t)||a.isArray(t)}function Ne(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function Fe(t,e,r){return t?t.concat(e).map(function(s,i){return s=Ne(s),!r&&i?"["+s+"]":s}).join(r?".":""):e}function Yt(t){return a.isArray(t)&&!t.some(fe)}const er=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function te(t,e,r){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,p){return!a.isUndefined(p[m])});const n=r.metaTokens,s=r.visitor||d,i=r.dots,o=r.indexes,l=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(e);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function u(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!l&&a.isBlob(f))throw new w("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?l&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function d(f,m,p){let g=f;if(f&&!p&&typeof f=="object"){if(a.endsWith(m,"{}"))m=n?m:m.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&Yt(f)||(a.isFileList(f)||a.endsWith(m,"[]"))&&(g=a.toArray(f)))return m=Ne(m),g.forEach(function(b,O){!(a.isUndefined(b)||b===null)&&e.append(o===!0?Fe([m],O,i):o===null?m:m+"[]",u(b))}),!1}return fe(f)?!0:(e.append(Fe(p,m,i),u(f)),!1)}const h=[],y=Object.assign(er,{defaultVisitor:d,convertValue:u,isVisitable:fe});function R(f,m){if(!a.isUndefined(f)){if(h.indexOf(f)!==-1)throw Error("Circular reference detected in "+m.join("."));h.push(f),a.forEach(f,function(g,I){(!(a.isUndefined(g)||g===null)&&s.call(e,g,a.isString(I)?I.trim():I,m,y))===!0&&R(g,m?m.concat(I):[I])}),h.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return R(t),e}function _e(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function pe(t,e){this._pairs=[],t&&te(t,this,e)}const ke=pe.prototype;ke.append=function(e,r){this._pairs.push([e,r])},ke.toString=function(e){const r=e?function(n){return e.call(this,n,_e)}:_e;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function tr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Le(t,e,r){if(!e)return t;const n=r&&r.encode||tr;a.isFunction(r)&&(r={serialize:r});const s=r&&r.serialize;let i;if(s?i=s(e,r):i=a.isURLSearchParams(e)?e.toString():new pe(e,r).toString(n),i){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class $e{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Be={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},rr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:pe,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},he=typeof window<"u"&&typeof document<"u",me=typeof navigator=="object"&&navigator||void 0,nr=he&&(!me||["ReactNative","NativeScript","NS"].indexOf(me.product)<0),sr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",or=he&&window.location.href||"http://localhost",S={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:he,hasStandardBrowserEnv:nr,hasStandardBrowserWebWorkerEnv:sr,navigator:me,origin:or},Symbol.toStringTag,{value:"Module"})),...rr};function ir(t,e){return te(t,new S.classes.URLSearchParams,{visitor:function(r,n,s,i){return S.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function ar(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function cr(t){const e={},r=Object.keys(t);let n;const s=r.length;let i;for(n=0;n<s;n++)i=r[n],e[i]=t[i];return e}function je(t){function e(r,n,s,i){let o=r[i++];if(o==="__proto__")return!0;const c=Number.isFinite(+o),l=i>=r.length;return o=!o&&a.isArray(s)?s.length:o,l?(a.hasOwnProp(s,o)?s[o]=[s[o],n]:s[o]=n,!c):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),e(r,n,s[o],i)&&a.isArray(s[o])&&(s[o]=cr(s[o])),!c)}if(a.isFormData(t)&&a.isFunction(t.entries)){const r={};return a.forEachEntry(t,(n,s)=>{e(ar(n),s,r,0)}),r}return null}function ur(t,e,r){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const W={transitional:Be,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=a.isObject(e);if(i&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return s?JSON.stringify(je(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e)||a.isReadableStream(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return ir(e,this.formSerializer).toString();if((c=a.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return te(c?{"files[]":e}:e,l&&new l,this.formSerializer)}}return i||s?(r.setContentType("application/json",!1),ur(e)):e}],transformResponse:[function(e){const r=this.transitional||W.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(e)||a.isReadableStream(e))return e;if(e&&a.isString(e)&&(n&&!this.responseType||s)){const o=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?w.from(c,w.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:S.classes.FormData,Blob:S.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{W.headers[t]={}});const lr=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"]),dr=t=>{const e={};let r,n,s;return t&&t.split(`
2
+ `).forEach(function(o){s=o.indexOf(":"),r=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!r||e[r]&&lr[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},Me=Symbol("internals");function G(t){return t&&String(t).trim().toLowerCase()}function re(t){return t===!1||t==null?t:a.isArray(t)?t.map(re):String(t)}function fr(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const pr=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function we(t,e,r,n,s){if(a.isFunction(n))return n.call(this,e,r);if(s&&(e=r),!!a.isString(e)){if(a.isString(n))return e.indexOf(n)!==-1;if(a.isRegExp(n))return n.test(e)}}function hr(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function mr(t,e){const r=a.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(s,i,o){return this[n].call(this,e,s,i,o)},configurable:!0})})}let T=class{constructor(e){e&&this.set(e)}set(e,r,n){const s=this;function i(c,l,u){const d=G(l);if(!d)throw new Error("header name must be a non-empty string");const h=a.findKey(s,d);(!h||s[h]===void 0||u===!0||u===void 0&&s[h]!==!1)&&(s[h||l]=re(c))}const o=(c,l)=>a.forEach(c,(u,d)=>i(u,d,l));if(a.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(a.isString(e)&&(e=e.trim())&&!pr(e))o(dr(e),r);else if(a.isObject(e)&&a.isIterable(e)){let c={},l,u;for(const d of e){if(!a.isArray(d))throw TypeError("Object iterator must return a key-value pair");c[u=d[0]]=(l=c[u])?a.isArray(l)?[...l,d[1]]:[l,d[1]]:d[1]}o(c,r)}else e!=null&&i(r,e,n);return this}get(e,r){if(e=G(e),e){const n=a.findKey(this,e);if(n){const s=this[n];if(!r)return s;if(r===!0)return fr(s);if(a.isFunction(r))return r.call(this,s,n);if(a.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=G(e),e){const n=a.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||we(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let s=!1;function i(o){if(o=G(o),o){const c=a.findKey(n,o);c&&(!r||we(n,n[c],c,r))&&(delete n[c],s=!0)}}return a.isArray(e)?e.forEach(i):i(e),s}clear(e){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const i=r[n];(!e||we(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const r=this,n={};return a.forEach(this,(s,i)=>{const o=a.findKey(n,i);if(o){r[o]=re(s),delete r[i];return}const c=e?hr(i):String(i).trim();c!==i&&delete r[i],r[c]=re(s),n[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return a.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=e&&a.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(s=>n.set(s)),n}static accessor(e){const n=(this[Me]=this[Me]={accessors:{}}).accessors,s=this.prototype;function i(o){const c=G(o);n[c]||(mr(s,o),n[c]=!0)}return a.isArray(e)?e.forEach(i):i(e),this}};T.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(T.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),a.freezeMethods(T);function ye(t,e){const r=this||W,n=e||r,s=T.from(n.headers);let i=n.data;return a.forEach(t,function(c){i=c.call(r,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function He(t){return!!(t&&t.__CANCEL__)}function v(t,e,r){w.call(this,t??"canceled",w.ERR_CANCELED,e,r),this.name="CanceledError"}a.inherits(v,w,{__CANCEL__:!0});function ve(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new w("Request failed with status code "+r.status,[w.ERR_BAD_REQUEST,w.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function wr(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function yr(t,e){t=t||10;const r=new Array(t),n=new Array(t);let s=0,i=0,o;return e=e!==void 0?e:1e3,function(l){const u=Date.now(),d=n[i];o||(o=u),r[s]=l,n[s]=u;let h=i,y=0;for(;h!==s;)y+=r[h++],h=h%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),u-o<e)return;const R=d&&u-d;return R?Math.round(y*1e3/R):void 0}}function Er(t,e){let r=0,n=1e3/e,s,i;const o=(u,d=Date.now())=>{r=d,s=null,i&&(clearTimeout(i),i=null),t(...u)};return[(...u)=>{const d=Date.now(),h=d-r;h>=n?o(u,d):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},n-h)))},()=>s&&o(s)]}const ne=(t,e,r=3)=>{let n=0;const s=yr(50,250);return Er(i=>{const o=i.loaded,c=i.lengthComputable?i.total:void 0,l=o-n,u=s(l),d=o<=c;n=o;const h={loaded:o,total:c,progress:c?o/c:void 0,bytes:l,rate:u||void 0,estimated:u&&c&&d?(c-o)/u:void 0,event:i,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(h)},r)},ze=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},Ve=t=>(...e)=>a.asap(()=>t(...e)),gr=S.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,S.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(S.origin),S.navigator&&/(msie|trident)/i.test(S.navigator.userAgent)):()=>!0,br=S.hasStandardBrowserEnv?{write(t,e,r,n,s,i){const o=[t+"="+encodeURIComponent(e)];a.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),a.isString(n)&&o.push("path="+n),a.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Sr(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Rr(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Je(t,e,r){let n=!Sr(e);return t&&(n||r==!1)?Rr(t,e):e}const Ke=t=>t instanceof T?{...t}:t;function _(t,e){e=e||{};const r={};function n(u,d,h,y){return a.isPlainObject(u)&&a.isPlainObject(d)?a.merge.call({caseless:y},u,d):a.isPlainObject(d)?a.merge({},d):a.isArray(d)?d.slice():d}function s(u,d,h,y){if(a.isUndefined(d)){if(!a.isUndefined(u))return n(void 0,u,h,y)}else return n(u,d,h,y)}function i(u,d){if(!a.isUndefined(d))return n(void 0,d)}function o(u,d){if(a.isUndefined(d)){if(!a.isUndefined(u))return n(void 0,u)}else return n(void 0,d)}function c(u,d,h){if(h in e)return n(u,d);if(h in t)return n(void 0,u)}const l={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:c,headers:(u,d,h)=>s(Ke(u),Ke(d),h,!0)};return a.forEach(Object.keys({...t,...e}),function(d){const h=l[d]||s,y=h(t[d],e[d],d);a.isUndefined(y)&&h!==c||(r[d]=y)}),r}const We=t=>{const e=_({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:c}=e;if(e.headers=o=T.from(o),e.url=Le(Je(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(r)){if(S.hasStandardBrowserEnv||S.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(r.getHeaders)){const l=r.getHeaders(),u=["content-type","content-length"];Object.entries(l).forEach(([d,h])=>{u.includes(d.toLowerCase())&&o.set(d,h)})}}if(S.hasStandardBrowserEnv&&(n&&a.isFunction(n)&&(n=n(e)),n||n!==!1&&gr(e.url))){const l=s&&i&&br.read(i);l&&o.set(s,l)}return e},Ar=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const s=We(t);let i=s.data;const o=T.from(s.headers).normalize();let{responseType:c,onUploadProgress:l,onDownloadProgress:u}=s,d,h,y,R,f;function m(){R&&R(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let p=new XMLHttpRequest;p.open(s.method.toUpperCase(),s.url,!0),p.timeout=s.timeout;function g(){if(!p)return;const b=T.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),q={data:!c||c==="text"||c==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:b,config:t,request:p};ve(function(U){r(U),m()},function(U){n(U),m()},q),p=null}"onloadend"in p?p.onloadend=g:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(g)},p.onabort=function(){p&&(n(new w("Request aborted",w.ECONNABORTED,t,p)),p=null)},p.onerror=function(O){const q=O&&O.message?O.message:"Network Error",L=new w(q,w.ERR_NETWORK,t,p);L.event=O||null,n(L),p=null},p.ontimeout=function(){let O=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const q=s.transitional||Be;s.timeoutErrorMessage&&(O=s.timeoutErrorMessage),n(new w(O,q.clarifyTimeoutError?w.ETIMEDOUT:w.ECONNABORTED,t,p)),p=null},i===void 0&&o.setContentType(null),"setRequestHeader"in p&&a.forEach(o.toJSON(),function(O,q){p.setRequestHeader(q,O)}),a.isUndefined(s.withCredentials)||(p.withCredentials=!!s.withCredentials),c&&c!=="json"&&(p.responseType=s.responseType),u&&([y,f]=ne(u,!0),p.addEventListener("progress",y)),l&&p.upload&&([h,R]=ne(l),p.upload.addEventListener("progress",h),p.upload.addEventListener("loadend",R)),(s.cancelToken||s.signal)&&(d=b=>{p&&(n(!b||b.type?new v(null,t,p):b),p.abort(),p=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const I=wr(s.url);if(I&&S.protocols.indexOf(I)===-1){n(new w("Unsupported protocol "+I+":",w.ERR_BAD_REQUEST,t));return}p.send(i||null)})},Tr=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,s;const i=function(u){if(!s){s=!0,c();const d=u instanceof Error?u:this.reason;n.abort(d instanceof w?d:new v(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,i(new w(`timeout ${e} of ms exceeded`,w.ETIMEDOUT))},e);const c=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),t=null)};t.forEach(u=>u.addEventListener("abort",i));const{signal:l}=n;return l.unsubscribe=()=>a.asap(c),l}},Or=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let n=0,s;for(;n<r;)s=n+e,yield t.slice(n,s),n=s},Ir=async function*(t,e){for await(const r of Ur(t))yield*Or(r,e)},Ur=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},Ge=(t,e,r,n)=>{const s=Ir(t,e);let i=0,o,c=l=>{o||(o=!0,n&&n(l))};return new ReadableStream({async pull(l){try{const{done:u,value:d}=await s.next();if(u){c(),l.close();return}let h=d.byteLength;if(r){let y=i+=h;r(y)}l.enqueue(new Uint8Array(d))}catch(u){throw c(u),u}},cancel(l){return c(l),s.return()}},{highWaterMark:2})},Xe=64*1024,{isFunction:se}=a,Cr=(({Request:t,Response:e})=>({Request:t,Response:e}))(a.global),{ReadableStream:Qe,TextEncoder:Ze}=a.global,Ye=(t,...e)=>{try{return!!t(...e)}catch{return!1}},qr=t=>{t=a.merge.call({skipUndefined:!0},Cr,t);const{fetch:e,Request:r,Response:n}=t,s=e?se(e):typeof fetch=="function",i=se(r),o=se(n);if(!s)return!1;const c=s&&se(Qe),l=s&&(typeof Ze=="function"?(f=>m=>f.encode(m))(new Ze):async f=>new Uint8Array(await new r(f).arrayBuffer())),u=i&&c&&Ye(()=>{let f=!1;const m=new r(S.origin,{body:new Qe,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!m}),d=o&&c&&Ye(()=>a.isReadableStream(new n("").body)),h={stream:d&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!h[f]&&(h[f]=(m,p)=>{let g=m&&m[f];if(g)return g.call(m);throw new w(`Response type '${f}' is not supported`,w.ERR_NOT_SUPPORT,p)})});const y=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new r(S.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(a.isArrayBufferView(f)||a.isArrayBuffer(f))return f.byteLength;if(a.isURLSearchParams(f)&&(f=f+""),a.isString(f))return(await l(f)).byteLength},R=async(f,m)=>{const p=a.toFiniteNumber(f.getContentLength());return p??y(m)};return async f=>{let{url:m,method:p,data:g,signal:I,cancelToken:b,timeout:O,onDownloadProgress:q,onUploadProgress:L,responseType:U,headers:Se,withCredentials:ae="same-origin",fetchOptions:at}=We(f),ct=e||fetch;U=U?(U+"").toLowerCase():"text";let ce=Tr([I,b&&b.toAbortSignal()],O),X=null;const $=ce&&ce.unsubscribe&&(()=>{ce.unsubscribe()});let ut;try{if(L&&u&&p!=="get"&&p!=="head"&&(ut=await R(Se,g))!==0){let N=new r(m,{method:"POST",body:g,duplex:"half"}),z;if(a.isFormData(g)&&(z=N.headers.get("content-type"))&&Se.setContentType(z),N.body){const[Re,ue]=ze(ut,ne(Ve(L)));g=Ge(N.body,Xe,Re,ue)}}a.isString(ae)||(ae=ae?"include":"omit");const x=i&&"credentials"in r.prototype,lt={...at,signal:ce,method:p.toUpperCase(),headers:Se.normalize().toJSON(),body:g,duplex:"half",credentials:x?ae:void 0};X=i&&new r(m,lt);let D=await(i?ct(X,at):ct(m,lt));const dt=d&&(U==="stream"||U==="response");if(d&&(q||dt&&$)){const N={};["status","statusText","headers"].forEach(ft=>{N[ft]=D[ft]});const z=a.toFiniteNumber(D.headers.get("content-length")),[Re,ue]=q&&ze(z,ne(Ve(q),!0))||[];D=new n(Ge(D.body,Xe,Re,()=>{ue&&ue(),$&&$()}),N)}U=U||"text";let Lr=await h[a.findKey(h,U)||"text"](D,f);return!dt&&$&&$(),await new Promise((N,z)=>{ve(N,z,{data:Lr,headers:T.from(D.headers),status:D.status,statusText:D.statusText,config:f,request:X})})}catch(x){throw $&&$(),x&&x.name==="TypeError"&&/Load failed|fetch/i.test(x.message)?Object.assign(new w("Network Error",w.ERR_NETWORK,f,X),{cause:x.cause||x}):w.from(x,x&&x.code,f,X)}}},Pr=new Map,et=t=>{let e=t?t.env:{};const{fetch:r,Request:n,Response:s}=e,i=[n,s,r];let o=i.length,c=o,l,u,d=Pr;for(;c--;)l=i[c],u=d.get(l),u===void 0&&d.set(l,u=c?new Map:qr(e)),d=u;return u};et();const Ee={http:Zt,xhr:Ar,fetch:{get:et}};a.forEach(Ee,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const tt=t=>`- ${t}`,xr=t=>a.isFunction(t)||t===null||t===!1,rt={getAdapter:(t,e)=>{t=a.isArray(t)?t:[t];const{length:r}=t;let n,s;const i={};for(let o=0;o<r;o++){n=t[o];let c;if(s=n,!xr(n)&&(s=Ee[(c=String(n)).toLowerCase()],s===void 0))throw new w(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(e))))break;i[c||"#"+o]=s}if(!s){const o=Object.entries(i).map(([l,u])=>`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let c=r?o.length>1?`since :
4
+ `+o.map(tt).join(`
5
+ `):" "+tt(o[0]):"as no adapter specified";throw new w("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s},adapters:Ee};function ge(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new v(null,t)}function nt(t){return ge(t),t.headers=T.from(t.headers),t.data=ye.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),rt.getAdapter(t.adapter||W.adapter,t)(t).then(function(n){return ge(t),n.data=ye.call(t,t.transformResponse,n),n.headers=T.from(n.headers),n},function(n){return He(n)||(ge(t),n&&n.response&&(n.response.data=ye.call(t,t.transformResponse,n.response),n.response.headers=T.from(n.response.headers))),Promise.reject(n)})}const st="1.12.2",oe={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{oe[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const ot={};oe.transitional=function(e,r,n){function s(i,o){return"[Axios v"+st+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,c)=>{if(e===!1)throw new w(s(o," has been removed"+(r?" in "+r:"")),w.ERR_DEPRECATED);return r&&!ot[o]&&(ot[o]=!0,console.warn(s(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(i,o,c):!0}},oe.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function Dr(t,e,r){if(typeof t!="object")throw new w("options must be an object",w.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let s=n.length;for(;s-- >0;){const i=n[s],o=e[i];if(o){const c=t[i],l=c===void 0||o(c,i,t);if(l!==!0)throw new w("option "+i+" must be "+l,w.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new w("Unknown option "+i,w.ERR_BAD_OPTION)}}const ie={assertOptions:Dr,validators:oe},P=ie.validators;let k=class{constructor(e){this.defaults=e||{},this.interceptors={request:new $e,response:new $e}}async request(e,r){try{return await this._request(e,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+=`
6
+ `+i):n.stack=i}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=_(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&ie.assertOptions(n,{silentJSONParsing:P.transitional(P.boolean),forcedJSONParsing:P.transitional(P.boolean),clarifyTimeoutError:P.transitional(P.boolean)},!1),s!=null&&(a.isFunction(s)?r.paramsSerializer={serialize:s}:ie.assertOptions(s,{encode:P.function,serialize:P.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),ie.assertOptions(r,{baseUrl:P.spelling("baseURL"),withXsrfToken:P.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[r.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),r.headers=T.concat(o,i);const c=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(r)===!1||(l=l&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,h=0,y;if(!l){const f=[nt.bind(this),void 0];for(f.unshift(...c),f.push(...u),y=f.length,d=Promise.resolve(r);h<y;)d=d.then(f[h++],f[h++]);return d}y=c.length;let R=r;for(;h<y;){const f=c[h++],m=c[h++];try{R=f(R)}catch(p){m.call(this,p);break}}try{d=nt.call(this,R)}catch(f){return Promise.reject(f)}for(h=0,y=u.length;h<y;)d=d.then(u[h++],u[h++]);return d}getUri(e){e=_(this.defaults,e);const r=Je(e.baseURL,e.url,e.allowAbsoluteUrls);return Le(r,e.params,e.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(e){k.prototype[e]=function(r,n){return this.request(_(n||{},{method:e,url:r,data:(n||{}).data}))}}),a.forEach(["post","put","patch"],function(e){function r(n){return function(i,o,c){return this.request(_(c||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}k.prototype[e]=r(),k.prototype[e+"Form"]=r(!0)});let Nr=class pt{constructor(e){if(typeof e!="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(c=>{n.subscribe(c),i=c}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},e(function(i,o,c){n.reason||(n.reason=new v(i,o,c),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new pt(function(s){e=s}),cancel:e}}};function Fr(t){return function(r){return t.apply(null,r)}}function _r(t){return a.isObject(t)&&t.isAxiosError===!0}const be={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(be).forEach(([t,e])=>{be[e]=t});function it(t){const e=new k(t),r=j(k.prototype.request,e);return a.extend(r,k.prototype,e,{allOwnKeys:!0}),a.extend(r,e,null,{allOwnKeys:!0}),r.create=function(s){return it(_(t,s))},r}const E=it(W);E.Axios=k,E.CanceledError=v,E.CancelToken=Nr,E.isCancel=He,E.VERSION=st,E.toFormData=te,E.AxiosError=w,E.Cancel=E.CanceledError,E.all=function(e){return Promise.all(e)},E.spread=Fr,E.isAxiosError=_r,E.mergeConfig=_,E.AxiosHeaders=T,E.formToJSON=t=>je(a.isHTMLForm(t)?new FormData(t):t),E.getAdapter=rt.getAdapter,E.HttpStatusCode=be,E.default=E;const{Axios:zr,AxiosError:Vr,CanceledError:Jr,isCancel:Kr,CancelToken:Wr,VERSION:Gr,all:Xr,Cancel:Qr,isAxiosError:Zr,spread:Yr,toFormData:en,AxiosHeaders:tn,HttpStatusCode:rn,formToJSON:nn,getAdapter:sn,mergeConfig:on}=E;class kr{appName;baseUrl;apiKey;appId;client;constructor(e){if(!e||!e.baseUrl)throw new Error("NeuctraAuthix: 'baseUrl' is required in config");const r=e.apiKey;if(!r)throw new Error("NeuctraAuthix: 'apiKey' is required in config");this.appName=e.appName,this.baseUrl=e.baseUrl.replace(/\/$/,""),this.apiKey=r,this.appId=e.appId||null,this.client=E.create({baseURL:this.baseUrl,headers:{"Content-Type":"application/json","x-api-key":r},timeout:3e4,withCredentials:!0})}async request(e,r,n,s={},i=!1){try{const o={...this.appId?{appId:this.appId}:{},...n||{}};return(await this.client.request({url:r,method:e,data:o,headers:s,withCredentials:i})).data}catch(o){if(E.isAxiosError(o)){const c=o.response?.status??0,l=o.response?.data;let u=l?.message||o.message||"Request failed";throw c===403&&l?.code==="INSUFFICIENT_SCOPE"&&(u=`${u} (called "${r}" with an API key). This endpoint needs an API key — call it from your server, not from client code.`),c===401&&l?.code==="NO_USER_SESSION"&&(u=`${u} Sign the user in with loginUser() first — this endpoint acts on the signed-in user's own data.`),c===409&&l?.code==="VERSION_CONFLICT"?{message:`${u} Re-read the record to get its current version, then retry the update.`,status:c,code:"VERSION_CONFLICT",isConflict:!0,currentVersion:l?.currentVersion,expectedVersion:l?.expectedVersion}:c===429?{message:u,status:c,code:l?.code||"RATE_LIMITED",isRateLimited:!0,resetDate:l?.resetDate}:{message:u,status:c,code:l?.code}}throw{message:o.message||"Unexpected error occurred"}}}async signupUser(e){const{name:r,email:n,password:s}=e;if(!r||!n||!s)throw new Error("signup: 'name', 'email', and 'password' are required");return await this.request("POST","/users/signup",e,{},!0)}async loginUser(e){const{email:r,password:n}=e;if(!r||!n)throw new Error("login: 'email' and 'password' are required");try{return await this.request("POST","/users/login",{email:r,password:n},{},!0)}catch(s){throw new Error(s.message||"Login failed due to an unknown error")}}async logoutUser(){try{return(await this.request("POST","/users/logout",{},{},!0))?.success?(typeof window<"u"&&(document.cookie="a_s_b=; path=/; Max-Age=0; SameSite=Lax",window.location.protocol==="https:"&&(document.cookie="a_s_b=; path=/; Max-Age=0; SameSite=Lax; Secure"),window.location.reload()),{success:!0}):{success:!1}}catch(e){throw new Error(e?.message||"Logout failed due to an unknown error")}}async changePassword(e){const{userId:r,currentPassword:n,newPassword:s}=e;if(!r)throw new Error("changePassword: 'userId' is required");if(!n||!s)throw new Error("changePassword: both 'currentPassword' and 'newPassword' are required");return await this.request("PUT",`/users/change-password/${r}`,{currentPassword:n,newPassword:s},{},!0)}async requestEmailVerificationOTP(e){const{userId:r,email:n}=e;if(!r)throw{message:"requestEmailVerificationOTP: 'userId' is required",status:400};if(!n)throw{message:"requestEmailVerificationOTP: 'email' is required",status:400};try{return await this.request("POST",`/users/send-verify-otp/${encodeURIComponent(r)}`,{email:n},{},!0)}catch(s){throw console.error("requestEmailVerificationOTP Error:",s),{message:s?.message||"Failed to send verification OTP",status:s?.status||500}}}async verifyEmail(e){const{email:r,otp:n}=e;if(!r)throw new Error("verifyEmail: 'email' is required");if(!n)throw new Error("verifyEmail: 'otp' is required");try{return await this.request("POST","/users/verify-email",{email:r,otp:n},{},!0)}catch(s){throw{message:s.message||"Failed to verify email",status:s.status||500}}}async checkUserSession(){if(typeof window>"u")return{authenticated:!1};const e=()=>{document.cookie="a_s_b=; path=/; Max-Age=0; SameSite=Lax",window.location.protocol==="https:"&&(document.cookie="a_s_b=; path=/; Max-Age=0; SameSite=Lax; Secure")};try{const r=await this.request("GET","/users/session",void 0,{},!0);return r?.authenticated||e(),r??{authenticated:!1}}catch{return e(),{authenticated:!1}}}async getUser(e){const r=this.appId;if(!r)throw new Error("getUser: 'appId' is required in SDK config");if(!e?.id&&!e?.username)throw new Error("getUser: either 'id' or 'username' is required");const n=new URLSearchParams;return e.id&&n.append("id",e.id),e.username&&n.append("username",e.username),await this.request("GET",`/users/${encodeURIComponent(r)}/user?${n.toString()}`,void 0,{},!0)}async updateUser(e){const{userId:r,...n}=e;if(!r)throw new Error("updateUser: 'userId' is required");if(!n.appId)throw new Error("updateUser: 'appId' is required");return await this.request("PUT",`/users/update/${r}`,n,{},!0)}async deleteUser(e){const{userId:r}=e;if(!r)throw new Error("deleteUser: 'userId' is required");return await this.request("DELETE",`/users/delete/${r}`,{},{},!0)}async getUserProfile(e){const{userId:r}=e;if(!r)throw new Error("getProfile: 'userId' and 'appId' are required");try{return await this.request("POST","/users/profile",{userId:r},{},!0)}catch(n){throw{message:n.message||"Failed to fetch profile",status:n.status||500}}}async requestResetUserPasswordOTP(e){const{email:r}=e;if(!r)throw new Error("forgotPassword: 'email' is required");return await this.request("POST","/users/forgot-password",{email:r})}async resetUserPassword(e){const{email:r,otp:n,newPassword:s}=e;if(!r||!n||!s)throw new Error("resetPassword: 'email', 'otp' and 'newPassword' are required");return await this.request("POST","/users/reset-password",{email:r,otp:n,newPassword:s})}async checkIfUserExists(e){if(!e)throw new Error("checkUser: 'userId' is required");return await this.request("GET",`/users/check-user/${e}?appId=${this.appId}`)}async addUserData(e){const{userId:r,dataCategory:n,data:s}=e;if(!r)throw new Error("addUserData: 'userId' is required");if(!n)throw new Error("addUserData: 'dataCategory' is required");if(!s)throw new Error("addUserData: 'data' is required");return await this.request("POST",`/users/${r}/data`,{dataCategory:n,...s},{},!1)}async getUserData(e){const{userId:r,limit:n=20,cursor:s,category:i,parentId:o}=e;if(!r)throw new Error("getUserData: 'userId' is required");const c=`/users/${encodeURIComponent(r)}/data`,l=new URLSearchParams;l.set("limit",String(n)),s&&l.set("cursor",s),i&&l.set("category",i),o&&l.set("parentId",o);const u=l.toString();return this.request("GET",u?`${c}?${u}`:c,void 0,{},!1)}async getSingleUserData(e){const{userId:r,dataId:n}=e;if(!r||!n)throw new Error("getSingleUserData: 'userId' and 'dataId' are required");return await this.request("GET",`/users/${r}/data/${n}`,void 0,{},!1)}async searchInUserData(e){const{userId:r,category:n,q:s,keys:i,limit:o,cursor:c}=e||{};if(!r)throw new Error("searchUserData: 'userId' is required");return await this.request("POST",`/users/${encodeURIComponent(r)}/data/search`,{category:n,q:s,keys:i&&Object.keys(i).length>0?i:{},...o!==void 0?{limit:o}:{},...c?{cursor:c}:{}},{},!1)}async*iterateUserData(e){let r;do{const n=await this.getUserData({...e,cursor:r});yield n,r=n?.nextCursor||void 0}while(r)}async updateUserData(e){const{userId:r,dataId:n,data:s,version:i}=e;if(!r||!n)throw new Error("updateUserData: 'userId' and 'dataId' are required");if(!s)throw new Error("updateUserData: 'data' is required");return await this.request("PUT",`/users/${r}/data/${n}`,{...s,...i!==void 0?{version:i}:{}},{},!1)}async deleteUserData(e){const{userId:r,dataId:n}=e;if(!r||!n)throw new Error("deleteUserData: 'userId' and 'dataId' are required");return await this.request("DELETE",`/users/${r}/data/${n}`,void 0,{},!1)}async deleteManyUserData(e){const{userId:r,dataIds:n}=e||{};if(!r)throw new Error("deleteManyUserData: 'userId' is required");if(!Array.isArray(n)||n.length===0)throw new Error("deleteManyUserData: 'dataIds' must be a non-empty array");return await this.request("POST",`/users/${encodeURIComponent(r)}/data-bulk-delete`,{dataIds:n},{},!1)}async batch(e){const{userId:r,operations:n}=e||{};if(!r)throw new Error("batch: 'userId' is required");if(!Array.isArray(n)||n.length===0)throw new Error("batch: 'operations' must be a non-empty array");const s=n.findIndex(i=>!i||!["create","update","delete"].includes(i.type));if(s!==-1)throw new Error(`batch: operations[${s}].type must be "create", "update", or "delete"`);return await this.request("POST",`/users/${encodeURIComponent(r)}/data-batch`,{operations:n},{},!1)}async addAppData(e){const r=this.appId;if(!r)throw new Error("addAppData: 'appId' is required");const{dataCategory:n,data:s}=e;if(!n)throw new Error("addAppData: 'dataCategory' is required");if(!s||typeof s!="object")throw new Error("addAppData: 'data' is required");return await this.request("POST",`/app/${encodeURIComponent(r)}/data/${encodeURIComponent(n)}`,s,{},!1)}async getAppData(e){const r=this.appId;if(!r)throw new Error("getAppData: 'appId' is required");const n=typeof e=="string"?{category:e}:e||{},{category:s,limit:i,cursor:o}=n,c=s?`/app/${encodeURIComponent(r)}/app-data/${encodeURIComponent(s)}`:`/app/${encodeURIComponent(r)}/app-data`,l=new URLSearchParams;i!==void 0&&l.set("limit",String(i)),o&&l.set("cursor",o);const u=l.toString();return await this.request("GET",u?`${c}?${u}`:c,void 0,{},!1)}async getSingleAppData(e){const r=this.appId;if(!r)throw new Error("getSingleAppData: 'appId' is required");if(!e?.dataId)throw new Error("getSingleAppData: 'dataId' is required");return await this.request("GET",`/app/${encodeURIComponent(r)}/data/${encodeURIComponent(e.dataId)}`,void 0,{},!1)}async searchInAppData(e){const r=this.appId;if(!r)throw new Error("searchInAppData: 'appId' is required");const{category:n,q:s,keys:i,limit:o,cursor:c}=e||{};return await this.request("POST",`/app/${encodeURIComponent(r)}/app-data/search`,{category:n,q:s,keys:i&&Object.keys(i).length>0?i:{},...o!==void 0?{limit:o}:{},...c?{cursor:c}:{}},{},!1)}async updateAppData(e){const r=this.appId;if(!r)throw new Error("updateAppData: 'appId' is required");if(!e?.dataId)throw new Error("updateAppData: 'dataId' is required");if(!e?.data||typeof e.data!="object")throw new Error("updateAppData: 'data' is required");return await this.request("PATCH",`/app/${encodeURIComponent(r)}/data/${encodeURIComponent(e.dataId)}`,e.data,{},!1)}async deleteAppData(e){const r=this.appId;if(!r)throw new Error("deleteAppData: 'appId' is required");if(!e?.dataId)throw new Error("deleteAppData: 'dataId' is required");return await this.request("DELETE",`/app/${encodeURIComponent(r)}/data/${encodeURIComponent(e.dataId)}`,void 0,{},!1)}async getAllUsersFromApp(e={}){const r=this.appId;if(!r)throw new Error("getAllUsersFromApp: 'appId' is required");const{cursor:n,limit:s}=e,i={};return n&&(i.cursor=n),s!==void 0&&(i.limit=s),await this.request("POST",`/app/global/${encodeURIComponent(r)}/all-app-users`,i,{},!1)}async searchInAllAppUsers(e={}){const r=this.appId;if(!r)throw new Error("searchInAllAppUsers: 'appId' is required");const{q:n,keys:s={},limit:i,cursor:o}=e,c={};return n&&(c.q=n),s&&Object.keys(s).length>0&&(c.keys=s),i!==void 0&&(c.limit=i),o&&(c.cursor=o),await this.request("POST",`/app/global/${encodeURIComponent(r)}/all-app-users/search`,c,{},!1)}async getAllUsersDataFromApp(e={}){const r=this.appId;if(!r)throw new Error("getAllUsersDataFromApp: 'appId' is required");const{category:n,cursor:s,limit:i}=e,o={};return n&&(o.category=n),s&&(o.cursor=s),i!==void 0&&(o.limit=i),await this.request("POST",`/app/global/${encodeURIComponent(r)}/all-app-users-data`,o,{},!1)}async searchInAllAppUsersData(e={}){const r=this.appId;if(!r)throw new Error("searchInAllAppUsersData: 'appId' is required");const{category:n,q:s,keys:i={},limit:o,cursor:c}=e,l={};return n&&(l.category=n),s&&(l.q=s),i&&Object.keys(i).length>0&&(l.keys=i),o!==void 0&&(l.limit=o),c&&(l.cursor=c),await this.request("POST",`/app/global/${encodeURIComponent(r)}/all-app-users-data/search`,l,{},!1)}}B.NeuctraAuthix=kr,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})}));