@neuctra/authix 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/neuctra-authix.es.js +284 -269
- package/dist/neuctra-authix.umd.js +10 -10
- package/dist/src/sdk/index.d.ts +81 -21
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(te,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],S):(te=typeof globalThis<"u"?globalThis:te||self,S(te.NeuctraAuthix={},te.React))})(this,(function(te,S){"use strict";function ct(e,t){return function(){return e.apply(t,arguments)}}const{toString:ar}=Object.prototype,{getPrototypeOf:He}=Object,{iterator:Oe,toStringTag:dt}=Symbol,_e=(e=>t=>{const r=ar.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),ae=e=>(e=e.toLowerCase(),t=>_e(t)===e),Ae=e=>t=>typeof t===e,{isArray:ye}=Array,be=Ae("undefined");function ve(e){return e!==null&&!be(e)&&e.constructor!==null&&!be(e.constructor)&&re(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ut=ae("ArrayBuffer");function ir(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ut(e.buffer),t}const lr=Ae("string"),re=Ae("function"),pt=Ae("number"),ke=e=>e!==null&&typeof e=="object",cr=e=>e===!0||e===!1,ze=e=>{if(_e(e)!=="object")return!1;const t=He(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(dt in e)&&!(Oe in e)},dr=e=>{if(!ke(e)||ve(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},ur=ae("Date"),pr=ae("File"),fr=ae("Blob"),xr=ae("FileList"),hr=e=>ke(e)&&re(e.pipe),gr=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||re(e.append)&&((t=_e(e))==="formdata"||t==="object"&&re(e.toString)&&e.toString()==="[object FormData]"))},mr=ae("URLSearchParams"),[yr,br,wr,Sr]=["ReadableStream","Request","Response","Headers"].map(ae),jr=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ee(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let s,o;if(typeof e!="object"&&(e=[e]),ye(e))for(s=0,o=e.length;s<o;s++)t.call(null,e[s],s,e);else{if(ve(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let l;for(s=0;s<a;s++)l=i[s],t.call(null,e[l],l,e)}}function ft(e,t){if(ve(e))return null;t=t.toLowerCase();const r=Object.keys(e);let s=r.length,o;for(;s-- >0;)if(o=r[s],t===o.toLowerCase())return o;return null}const ue=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,xt=e=>!be(e)&&e!==ue;function Ve(){const{caseless:e,skipUndefined:t}=xt(this)&&this||{},r={},s=(o,i)=>{const a=e&&ft(r,i)||i;ze(r[a])&&ze(o)?r[a]=Ve(r[a],o):ze(o)?r[a]=Ve({},o):ye(o)?r[a]=o.slice():(!t||!be(o))&&(r[a]=o)};for(let o=0,i=arguments.length;o<i;o++)arguments[o]&&Ee(arguments[o],s);return r}const vr=(e,t,r,{allOwnKeys:s}={})=>(Ee(t,(o,i)=>{r&&re(o)?e[i]=ct(o,r):e[i]=o},{allOwnKeys:s}),e),kr=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Er=(e,t,r,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},Cr=(e,t,r,s)=>{let o,i,a;const l={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],(!s||s(a,e,t))&&!l[a]&&(t[a]=e[a],l[a]=!0);e=r!==!1&&He(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Tr=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const s=e.indexOf(t,r);return s!==-1&&s===r},Rr=e=>{if(!e)return null;if(ye(e))return e;let t=e.length;if(!pt(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Ir=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&He(Uint8Array)),Pr=(e,t)=>{const s=(e&&e[Oe]).call(e);let o;for(;(o=s.next())&&!o.done;){const i=o.value;t.call(e,i[0],i[1])}},Or=(e,t)=>{let r;const s=[];for(;(r=e.exec(t))!==null;)s.push(r);return s},_r=ae("HTMLFormElement"),Ar=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,s,o){return s.toUpperCase()+o}),ht=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),zr=ae("RegExp"),gt=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),s={};Ee(r,(o,i)=>{let a;(a=t(o,i,e))!==!1&&(s[i]=a||o)}),Object.defineProperties(e,s)},Nr=e=>{gt(e,(t,r)=>{if(re(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const s=e[r];if(re(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Ur=(e,t)=>{const r={},s=o=>{o.forEach(i=>{r[i]=!0})};return ye(e)?s(e):s(String(e).split(t)),r},Dr=()=>{},Fr=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Lr(e){return!!(e&&re(e.append)&&e[dt]==="FormData"&&e[Oe])}const Mr=e=>{const t=new Array(10),r=(s,o)=>{if(ke(s)){if(t.indexOf(s)>=0)return;if(ve(s))return s;if(!("toJSON"in s)){t[o]=s;const i=ye(s)?[]:{};return Ee(s,(a,l)=>{const h=r(a,o+1);!be(h)&&(i[l]=h)}),t[o]=void 0,i}}return s};return r(e,0)},Br=ae("AsyncFunction"),Wr=e=>e&&(ke(e)||re(e))&&re(e.then)&&re(e.catch),mt=((e,t)=>e?setImmediate:t?((r,s)=>(ue.addEventListener("message",({source:o,data:i})=>{o===ue&&i===r&&s.length&&s.shift()()},!1),o=>{s.push(o),ue.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",re(ue.postMessage)),$r=typeof queueMicrotask<"u"?queueMicrotask.bind(ue):typeof process<"u"&&process.nextTick||mt,p={isArray:ye,isArrayBuffer:ut,isBuffer:ve,isFormData:gr,isArrayBufferView:ir,isString:lr,isNumber:pt,isBoolean:cr,isObject:ke,isPlainObject:ze,isEmptyObject:dr,isReadableStream:yr,isRequest:br,isResponse:wr,isHeaders:Sr,isUndefined:be,isDate:ur,isFile:pr,isBlob:fr,isRegExp:zr,isFunction:re,isStream:hr,isURLSearchParams:mr,isTypedArray:Ir,isFileList:xr,forEach:Ee,merge:Ve,extend:vr,trim:jr,stripBOM:kr,inherits:Er,toFlatObject:Cr,kindOf:_e,kindOfTest:ae,endsWith:Tr,toArray:Rr,forEachEntry:Pr,matchAll:Or,isHTMLForm:_r,hasOwnProperty:ht,hasOwnProp:ht,reduceDescriptors:gt,freezeMethods:Nr,toObjectSet:Ur,toCamelCase:Ar,noop:Dr,toFiniteNumber:Fr,findKey:ft,global:ue,isContextDefined:xt,isSpecCompliantForm:Lr,toJSONObject:Mr,isAsyncFn:Br,isThenable:Wr,setImmediate:mt,asap:$r,isIterable:e=>e!=null&&re(e[Oe])};function U(e,t,r,s,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o,this.status=o.status?o.status:null)}p.inherits(U,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:p.toJSONObject(this.config),code:this.code,status:this.status}}});const yt=U.prototype,bt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{bt[e]={value:e}}),Object.defineProperties(U,bt),Object.defineProperty(yt,"isAxiosError",{value:!0}),U.from=(e,t,r,s,o,i)=>{const a=Object.create(yt);p.toFlatObject(e,a,function(u){return u!==Error.prototype},c=>c!=="isAxiosError");const l=e&&e.message?e.message:"Error",h=t==null&&e?e.code:t;return U.call(a,l,h,r,s,o),e&&a.cause==null&&Object.defineProperty(a,"cause",{value:e,configurable:!0}),a.name=e&&e.name||"Error",i&&Object.assign(a,i),a};const Hr=null;function Ye(e){return p.isPlainObject(e)||p.isArray(e)}function wt(e){return p.endsWith(e,"[]")?e.slice(0,-2):e}function St(e,t,r){return e?e.concat(t).map(function(o,i){return o=wt(o),!r&&i?"["+o+"]":o}).join(r?".":""):t}function Vr(e){return p.isArray(e)&&!e.some(Ye)}const Yr=p.toFlatObject(p,{},null,function(t){return/^is[A-Z]/.test(t)});function Ne(e,t,r){if(!p.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=p.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,g){return!p.isUndefined(g[b])});const s=r.metaTokens,o=r.visitor||u,i=r.dots,a=r.indexes,h=(r.Blob||typeof Blob<"u"&&Blob)&&p.isSpecCompliantForm(t);if(!p.isFunction(o))throw new TypeError("visitor must be a function");function c(d){if(d===null)return"";if(p.isDate(d))return d.toISOString();if(p.isBoolean(d))return d.toString();if(!h&&p.isBlob(d))throw new U("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(d)||p.isTypedArray(d)?h&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function u(d,b,g){let M=d;if(d&&!g&&typeof d=="object"){if(p.endsWith(b,"{}"))b=s?b:b.slice(0,-2),d=JSON.stringify(d);else if(p.isArray(d)&&Vr(d)||(p.isFileList(d)||p.endsWith(b,"[]"))&&(M=p.toArray(d)))return b=wt(b),M.forEach(function(_,T){!(p.isUndefined(_)||_===null)&&t.append(a===!0?St([b],T,i):a===null?b:b+"[]",c(_))}),!1}return Ye(d)?!0:(t.append(St(g,b,i),c(d)),!1)}const y=[],R=Object.assign(Yr,{defaultVisitor:u,convertValue:c,isVisitable:Ye});function k(d,b){if(!p.isUndefined(d)){if(y.indexOf(d)!==-1)throw Error("Circular reference detected in "+b.join("."));y.push(d),p.forEach(d,function(M,D){(!(p.isUndefined(M)||M===null)&&o.call(t,M,p.isString(D)?D.trim():D,b,R))===!0&&k(M,b?b.concat(D):[D])}),y.pop()}}if(!p.isObject(e))throw new TypeError("data must be an object");return k(e),t}function jt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function qe(e,t){this._pairs=[],e&&Ne(e,this,t)}const vt=qe.prototype;vt.append=function(t,r){this._pairs.push([t,r])},vt.toString=function(t){const r=t?function(s){return t.call(this,s,jt)}:jt;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};function qr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function kt(e,t,r){if(!t)return e;const s=r&&r.encode||qr;p.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let i;if(o?i=o(t,r):i=p.isURLSearchParams(t)?t.toString():new qe(t,r).toString(s),i){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Et{constructor(){this.handlers=[]}use(t,r,s){return this.handlers.push({fulfilled:t,rejected:r,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){p.forEach(this.handlers,function(s){s!==null&&t(s)})}}const Ct={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Kr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:qe,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Ke=typeof window<"u"&&typeof document<"u",Je=typeof navigator=="object"&&navigator||void 0,Jr=Ke&&(!Je||["ReactNative","NativeScript","NS"].indexOf(Je.product)<0),Xr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Gr=Ke&&window.location.href||"http://localhost",ee={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ke,hasStandardBrowserEnv:Jr,hasStandardBrowserWebWorkerEnv:Xr,navigator:Je,origin:Gr},Symbol.toStringTag,{value:"Module"})),...Kr};function Zr(e,t){return Ne(e,new ee.classes.URLSearchParams,{visitor:function(r,s,o,i){return ee.isNode&&p.isBuffer(r)?(this.append(s,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function Qr(e){return p.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function en(e){const t={},r=Object.keys(e);let s;const o=r.length;let i;for(s=0;s<o;s++)i=r[s],t[i]=e[i];return t}function Tt(e){function t(r,s,o,i){let a=r[i++];if(a==="__proto__")return!0;const l=Number.isFinite(+a),h=i>=r.length;return a=!a&&p.isArray(o)?o.length:a,h?(p.hasOwnProp(o,a)?o[a]=[o[a],s]:o[a]=s,!l):((!o[a]||!p.isObject(o[a]))&&(o[a]=[]),t(r,s,o[a],i)&&p.isArray(o[a])&&(o[a]=en(o[a])),!l)}if(p.isFormData(e)&&p.isFunction(e.entries)){const r={};return p.forEachEntry(e,(s,o)=>{t(Qr(s),o,r,0)}),r}return null}function tn(e,t,r){if(p.isString(e))try{return(t||JSON.parse)(e),p.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(r||JSON.stringify)(e)}const Ce={transitional:Ct,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const s=r.getContentType()||"",o=s.indexOf("application/json")>-1,i=p.isObject(t);if(i&&p.isHTMLForm(t)&&(t=new FormData(t)),p.isFormData(t))return o?JSON.stringify(Tt(t)):t;if(p.isArrayBuffer(t)||p.isBuffer(t)||p.isStream(t)||p.isFile(t)||p.isBlob(t)||p.isReadableStream(t))return t;if(p.isArrayBufferView(t))return t.buffer;if(p.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(i){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Zr(t,this.formSerializer).toString();if((l=p.isFileList(t))||s.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return Ne(l?{"files[]":t}:t,h&&new h,this.formSerializer)}}return i||o?(r.setContentType("application/json",!1),tn(t)):t}],transformResponse:[function(t){const r=this.transitional||Ce.transitional,s=r&&r.forcedJSONParsing,o=this.responseType==="json";if(p.isResponse(t)||p.isReadableStream(t))return t;if(t&&p.isString(t)&&(s&&!this.responseType||o)){const a=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t,this.parseReviver)}catch(l){if(a)throw l.name==="SyntaxError"?U.from(l,U.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ee.classes.FormData,Blob:ee.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(["delete","get","head","post","put","patch"],e=>{Ce.headers[e]={}});const rn=p.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"]),nn=e=>{const t={};let r,s,o;return e&&e.split(`
|
|
1
|
+
(function(te,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],S):(te=typeof globalThis<"u"?globalThis:te||self,S(te.NeuctraAuthix={},te.React))})(this,(function(te,S){"use strict";function ct(e,t){return function(){return e.apply(t,arguments)}}const{toString:ar}=Object.prototype,{getPrototypeOf:He}=Object,{iterator:Oe,toStringTag:dt}=Symbol,_e=(e=>t=>{const r=ar.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),ae=e=>(e=e.toLowerCase(),t=>_e(t)===e),Ae=e=>t=>typeof t===e,{isArray:ye}=Array,be=Ae("undefined");function ve(e){return e!==null&&!be(e)&&e.constructor!==null&&!be(e.constructor)&&re(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ut=ae("ArrayBuffer");function ir(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ut(e.buffer),t}const lr=Ae("string"),re=Ae("function"),pt=Ae("number"),ke=e=>e!==null&&typeof e=="object",cr=e=>e===!0||e===!1,ze=e=>{if(_e(e)!=="object")return!1;const t=He(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(dt in e)&&!(Oe in e)},dr=e=>{if(!ke(e)||ve(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},ur=ae("Date"),pr=ae("File"),fr=ae("Blob"),xr=ae("FileList"),hr=e=>ke(e)&&re(e.pipe),gr=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||re(e.append)&&((t=_e(e))==="formdata"||t==="object"&&re(e.toString)&&e.toString()==="[object FormData]"))},mr=ae("URLSearchParams"),[yr,br,wr,Sr]=["ReadableStream","Request","Response","Headers"].map(ae),jr=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ee(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let s,o;if(typeof e!="object"&&(e=[e]),ye(e))for(s=0,o=e.length;s<o;s++)t.call(null,e[s],s,e);else{if(ve(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let l;for(s=0;s<a;s++)l=i[s],t.call(null,e[l],l,e)}}function ft(e,t){if(ve(e))return null;t=t.toLowerCase();const r=Object.keys(e);let s=r.length,o;for(;s-- >0;)if(o=r[s],t===o.toLowerCase())return o;return null}const ue=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,xt=e=>!be(e)&&e!==ue;function Ve(){const{caseless:e,skipUndefined:t}=xt(this)&&this||{},r={},s=(o,i)=>{const a=e&&ft(r,i)||i;ze(r[a])&&ze(o)?r[a]=Ve(r[a],o):ze(o)?r[a]=Ve({},o):ye(o)?r[a]=o.slice():(!t||!be(o))&&(r[a]=o)};for(let o=0,i=arguments.length;o<i;o++)arguments[o]&&Ee(arguments[o],s);return r}const vr=(e,t,r,{allOwnKeys:s}={})=>(Ee(t,(o,i)=>{r&&re(o)?e[i]=ct(o,r):e[i]=o},{allOwnKeys:s}),e),kr=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Er=(e,t,r,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},Cr=(e,t,r,s)=>{let o,i,a;const l={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],(!s||s(a,e,t))&&!l[a]&&(t[a]=e[a],l[a]=!0);e=r!==!1&&He(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Tr=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const s=e.indexOf(t,r);return s!==-1&&s===r},Rr=e=>{if(!e)return null;if(ye(e))return e;let t=e.length;if(!pt(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Ir=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&He(Uint8Array)),Pr=(e,t)=>{const s=(e&&e[Oe]).call(e);let o;for(;(o=s.next())&&!o.done;){const i=o.value;t.call(e,i[0],i[1])}},Or=(e,t)=>{let r;const s=[];for(;(r=e.exec(t))!==null;)s.push(r);return s},_r=ae("HTMLFormElement"),Ar=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,s,o){return s.toUpperCase()+o}),ht=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),zr=ae("RegExp"),gt=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),s={};Ee(r,(o,i)=>{let a;(a=t(o,i,e))!==!1&&(s[i]=a||o)}),Object.defineProperties(e,s)},Nr=e=>{gt(e,(t,r)=>{if(re(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const s=e[r];if(re(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Ur=(e,t)=>{const r={},s=o=>{o.forEach(i=>{r[i]=!0})};return ye(e)?s(e):s(String(e).split(t)),r},Dr=()=>{},Fr=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Lr(e){return!!(e&&re(e.append)&&e[dt]==="FormData"&&e[Oe])}const Mr=e=>{const t=new Array(10),r=(s,o)=>{if(ke(s)){if(t.indexOf(s)>=0)return;if(ve(s))return s;if(!("toJSON"in s)){t[o]=s;const i=ye(s)?[]:{};return Ee(s,(a,l)=>{const h=r(a,o+1);!be(h)&&(i[l]=h)}),t[o]=void 0,i}}return s};return r(e,0)},Br=ae("AsyncFunction"),Wr=e=>e&&(ke(e)||re(e))&&re(e.then)&&re(e.catch),mt=((e,t)=>e?setImmediate:t?((r,s)=>(ue.addEventListener("message",({source:o,data:i})=>{o===ue&&i===r&&s.length&&s.shift()()},!1),o=>{s.push(o),ue.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",re(ue.postMessage)),$r=typeof queueMicrotask<"u"?queueMicrotask.bind(ue):typeof process<"u"&&process.nextTick||mt,p={isArray:ye,isArrayBuffer:ut,isBuffer:ve,isFormData:gr,isArrayBufferView:ir,isString:lr,isNumber:pt,isBoolean:cr,isObject:ke,isPlainObject:ze,isEmptyObject:dr,isReadableStream:yr,isRequest:br,isResponse:wr,isHeaders:Sr,isUndefined:be,isDate:ur,isFile:pr,isBlob:fr,isRegExp:zr,isFunction:re,isStream:hr,isURLSearchParams:mr,isTypedArray:Ir,isFileList:xr,forEach:Ee,merge:Ve,extend:vr,trim:jr,stripBOM:kr,inherits:Er,toFlatObject:Cr,kindOf:_e,kindOfTest:ae,endsWith:Tr,toArray:Rr,forEachEntry:Pr,matchAll:Or,isHTMLForm:_r,hasOwnProperty:ht,hasOwnProp:ht,reduceDescriptors:gt,freezeMethods:Nr,toObjectSet:Ur,toCamelCase:Ar,noop:Dr,toFiniteNumber:Fr,findKey:ft,global:ue,isContextDefined:xt,isSpecCompliantForm:Lr,toJSONObject:Mr,isAsyncFn:Br,isThenable:Wr,setImmediate:mt,asap:$r,isIterable:e=>e!=null&&re(e[Oe])};function U(e,t,r,s,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o,this.status=o.status?o.status:null)}p.inherits(U,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:p.toJSONObject(this.config),code:this.code,status:this.status}}});const yt=U.prototype,bt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{bt[e]={value:e}}),Object.defineProperties(U,bt),Object.defineProperty(yt,"isAxiosError",{value:!0}),U.from=(e,t,r,s,o,i)=>{const a=Object.create(yt);p.toFlatObject(e,a,function(u){return u!==Error.prototype},c=>c!=="isAxiosError");const l=e&&e.message?e.message:"Error",h=t==null&&e?e.code:t;return U.call(a,l,h,r,s,o),e&&a.cause==null&&Object.defineProperty(a,"cause",{value:e,configurable:!0}),a.name=e&&e.name||"Error",i&&Object.assign(a,i),a};const Hr=null;function Ye(e){return p.isPlainObject(e)||p.isArray(e)}function wt(e){return p.endsWith(e,"[]")?e.slice(0,-2):e}function St(e,t,r){return e?e.concat(t).map(function(o,i){return o=wt(o),!r&&i?"["+o+"]":o}).join(r?".":""):t}function Vr(e){return p.isArray(e)&&!e.some(Ye)}const Yr=p.toFlatObject(p,{},null,function(t){return/^is[A-Z]/.test(t)});function Ne(e,t,r){if(!p.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=p.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,g){return!p.isUndefined(g[b])});const s=r.metaTokens,o=r.visitor||u,i=r.dots,a=r.indexes,h=(r.Blob||typeof Blob<"u"&&Blob)&&p.isSpecCompliantForm(t);if(!p.isFunction(o))throw new TypeError("visitor must be a function");function c(d){if(d===null)return"";if(p.isDate(d))return d.toISOString();if(p.isBoolean(d))return d.toString();if(!h&&p.isBlob(d))throw new U("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(d)||p.isTypedArray(d)?h&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function u(d,b,g){let M=d;if(d&&!g&&typeof d=="object"){if(p.endsWith(b,"{}"))b=s?b:b.slice(0,-2),d=JSON.stringify(d);else if(p.isArray(d)&&Vr(d)||(p.isFileList(d)||p.endsWith(b,"[]"))&&(M=p.toArray(d)))return b=wt(b),M.forEach(function(_,E){!(p.isUndefined(_)||_===null)&&t.append(a===!0?St([b],E,i):a===null?b:b+"[]",c(_))}),!1}return Ye(d)?!0:(t.append(St(g,b,i),c(d)),!1)}const y=[],R=Object.assign(Yr,{defaultVisitor:u,convertValue:c,isVisitable:Ye});function k(d,b){if(!p.isUndefined(d)){if(y.indexOf(d)!==-1)throw Error("Circular reference detected in "+b.join("."));y.push(d),p.forEach(d,function(M,D){(!(p.isUndefined(M)||M===null)&&o.call(t,M,p.isString(D)?D.trim():D,b,R))===!0&&k(M,b?b.concat(D):[D])}),y.pop()}}if(!p.isObject(e))throw new TypeError("data must be an object");return k(e),t}function jt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function qe(e,t){this._pairs=[],e&&Ne(e,this,t)}const vt=qe.prototype;vt.append=function(t,r){this._pairs.push([t,r])},vt.toString=function(t){const r=t?function(s){return t.call(this,s,jt)}:jt;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};function qr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function kt(e,t,r){if(!t)return e;const s=r&&r.encode||qr;p.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let i;if(o?i=o(t,r):i=p.isURLSearchParams(t)?t.toString():new qe(t,r).toString(s),i){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Et{constructor(){this.handlers=[]}use(t,r,s){return this.handlers.push({fulfilled:t,rejected:r,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){p.forEach(this.handlers,function(s){s!==null&&t(s)})}}const Ct={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Kr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:qe,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Ke=typeof window<"u"&&typeof document<"u",Je=typeof navigator=="object"&&navigator||void 0,Jr=Ke&&(!Je||["ReactNative","NativeScript","NS"].indexOf(Je.product)<0),Xr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Gr=Ke&&window.location.href||"http://localhost",ee={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ke,hasStandardBrowserEnv:Jr,hasStandardBrowserWebWorkerEnv:Xr,navigator:Je,origin:Gr},Symbol.toStringTag,{value:"Module"})),...Kr};function Zr(e,t){return Ne(e,new ee.classes.URLSearchParams,{visitor:function(r,s,o,i){return ee.isNode&&p.isBuffer(r)?(this.append(s,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function Qr(e){return p.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function en(e){const t={},r=Object.keys(e);let s;const o=r.length;let i;for(s=0;s<o;s++)i=r[s],t[i]=e[i];return t}function Tt(e){function t(r,s,o,i){let a=r[i++];if(a==="__proto__")return!0;const l=Number.isFinite(+a),h=i>=r.length;return a=!a&&p.isArray(o)?o.length:a,h?(p.hasOwnProp(o,a)?o[a]=[o[a],s]:o[a]=s,!l):((!o[a]||!p.isObject(o[a]))&&(o[a]=[]),t(r,s,o[a],i)&&p.isArray(o[a])&&(o[a]=en(o[a])),!l)}if(p.isFormData(e)&&p.isFunction(e.entries)){const r={};return p.forEachEntry(e,(s,o)=>{t(Qr(s),o,r,0)}),r}return null}function tn(e,t,r){if(p.isString(e))try{return(t||JSON.parse)(e),p.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(r||JSON.stringify)(e)}const Ce={transitional:Ct,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const s=r.getContentType()||"",o=s.indexOf("application/json")>-1,i=p.isObject(t);if(i&&p.isHTMLForm(t)&&(t=new FormData(t)),p.isFormData(t))return o?JSON.stringify(Tt(t)):t;if(p.isArrayBuffer(t)||p.isBuffer(t)||p.isStream(t)||p.isFile(t)||p.isBlob(t)||p.isReadableStream(t))return t;if(p.isArrayBufferView(t))return t.buffer;if(p.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(i){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Zr(t,this.formSerializer).toString();if((l=p.isFileList(t))||s.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return Ne(l?{"files[]":t}:t,h&&new h,this.formSerializer)}}return i||o?(r.setContentType("application/json",!1),tn(t)):t}],transformResponse:[function(t){const r=this.transitional||Ce.transitional,s=r&&r.forcedJSONParsing,o=this.responseType==="json";if(p.isResponse(t)||p.isReadableStream(t))return t;if(t&&p.isString(t)&&(s&&!this.responseType||o)){const a=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t,this.parseReviver)}catch(l){if(a)throw l.name==="SyntaxError"?U.from(l,U.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ee.classes.FormData,Blob:ee.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(["delete","get","head","post","put","patch"],e=>{Ce.headers[e]={}});const rn=p.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"]),nn=e=>{const t={};let r,s,o;return e&&e.split(`
|
|
2
2
|
`).forEach(function(a){o=a.indexOf(":"),r=a.substring(0,o).trim().toLowerCase(),s=a.substring(o+1).trim(),!(!r||t[r]&&rn[r])&&(r==="set-cookie"?t[r]?t[r].push(s):t[r]=[s]:t[r]=t[r]?t[r]+", "+s:s)}),t},Rt=Symbol("internals");function Te(e){return e&&String(e).trim().toLowerCase()}function Ue(e){return e===!1||e==null?e:p.isArray(e)?e.map(Ue):String(e)}function sn(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=r.exec(e);)t[s[1]]=s[2];return t}const on=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Xe(e,t,r,s,o){if(p.isFunction(s))return s.call(this,t,r);if(o&&(t=r),!!p.isString(t)){if(p.isString(s))return t.indexOf(s)!==-1;if(p.isRegExp(s))return s.test(t)}}function an(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,s)=>r.toUpperCase()+s)}function ln(e,t){const r=p.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+r,{value:function(o,i,a){return this[s].call(this,t,o,i,a)},configurable:!0})})}let ne=class{constructor(t){t&&this.set(t)}set(t,r,s){const o=this;function i(l,h,c){const u=Te(h);if(!u)throw new Error("header name must be a non-empty string");const y=p.findKey(o,u);(!y||o[y]===void 0||c===!0||c===void 0&&o[y]!==!1)&&(o[y||h]=Ue(l))}const a=(l,h)=>p.forEach(l,(c,u)=>i(c,u,h));if(p.isPlainObject(t)||t instanceof this.constructor)a(t,r);else if(p.isString(t)&&(t=t.trim())&&!on(t))a(nn(t),r);else if(p.isObject(t)&&p.isIterable(t)){let l={},h,c;for(const u of t){if(!p.isArray(u))throw TypeError("Object iterator must return a key-value pair");l[c=u[0]]=(h=l[c])?p.isArray(h)?[...h,u[1]]:[h,u[1]]:u[1]}a(l,r)}else t!=null&&i(r,t,s);return this}get(t,r){if(t=Te(t),t){const s=p.findKey(this,t);if(s){const o=this[s];if(!r)return o;if(r===!0)return sn(o);if(p.isFunction(r))return r.call(this,o,s);if(p.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Te(t),t){const s=p.findKey(this,t);return!!(s&&this[s]!==void 0&&(!r||Xe(this,this[s],s,r)))}return!1}delete(t,r){const s=this;let o=!1;function i(a){if(a=Te(a),a){const l=p.findKey(s,a);l&&(!r||Xe(s,s[l],l,r))&&(delete s[l],o=!0)}}return p.isArray(t)?t.forEach(i):i(t),o}clear(t){const r=Object.keys(this);let s=r.length,o=!1;for(;s--;){const i=r[s];(!t||Xe(this,this[i],i,t,!0))&&(delete this[i],o=!0)}return o}normalize(t){const r=this,s={};return p.forEach(this,(o,i)=>{const a=p.findKey(s,i);if(a){r[a]=Ue(o),delete r[i];return}const l=t?an(i):String(i).trim();l!==i&&delete r[i],r[l]=Ue(o),s[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return p.forEach(this,(s,o)=>{s!=null&&s!==!1&&(r[o]=t&&p.isArray(s)?s.join(", "):s)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
3
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const s=new this(t);return r.forEach(o=>s.set(o)),s}static accessor(t){const s=(this[Rt]=this[Rt]={accessors:{}}).accessors,o=this.prototype;function i(a){const l=Te(a);s[l]||(ln(o,a),s[l]=!0)}return p.isArray(t)?t.forEach(i):i(t),this}};ne.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),p.reduceDescriptors(ne.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[r]=s}}}),p.freezeMethods(ne);function Ge(e,t){const r=this||Ce,s=t||r,o=ne.from(s.headers);let i=s.data;return p.forEach(e,function(l){i=l.call(r,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function It(e){return!!(e&&e.__CANCEL__)}function we(e,t,r){U.call(this,e??"canceled",U.ERR_CANCELED,t,r),this.name="CanceledError"}p.inherits(we,U,{__CANCEL__:!0});function Pt(e,t,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?e(r):t(new U("Request failed with status code "+r.status,[U.ERR_BAD_REQUEST,U.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function cn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function dn(e,t){e=e||10;const r=new Array(e),s=new Array(e);let o=0,i=0,a;return t=t!==void 0?t:1e3,function(h){const c=Date.now(),u=s[i];a||(a=c),r[o]=h,s[o]=c;let y=i,R=0;for(;y!==o;)R+=r[y++],y=y%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-a<t)return;const k=u&&c-u;return k?Math.round(R*1e3/k):void 0}}function un(e,t){let r=0,s=1e3/t,o,i;const a=(c,u=Date.now())=>{r=u,o=null,i&&(clearTimeout(i),i=null),e(...c)};return[(...c)=>{const u=Date.now(),y=u-r;y>=s?a(c,u):(o=c,i||(i=setTimeout(()=>{i=null,a(o)},s-y)))},()=>o&&a(o)]}const De=(e,t,r=3)=>{let s=0;const o=dn(50,250);return un(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,h=a-s,c=o(h),u=a<=l;s=a;const y={loaded:a,total:l,progress:l?a/l:void 0,bytes:h,rate:c||void 0,estimated:c&&l&&u?(l-a)/c:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(y)},r)},Ot=(e,t)=>{const r=e!=null;return[s=>t[0]({lengthComputable:r,total:e,loaded:s}),t[1]]},_t=e=>(...t)=>p.asap(()=>e(...t)),pn=ee.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,ee.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(ee.origin),ee.navigator&&/(msie|trident)/i.test(ee.navigator.userAgent)):()=>!0,fn=ee.hasStandardBrowserEnv?{write(e,t,r,s,o,i){const a=[e+"="+encodeURIComponent(t)];p.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),p.isString(s)&&a.push("path="+s),p.isString(o)&&a.push("domain="+o),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function xn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function hn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function At(e,t,r){let s=!xn(t);return e&&(s||r==!1)?hn(e,t):t}const zt=e=>e instanceof ne?{...e}:e;function pe(e,t){t=t||{};const r={};function s(c,u,y,R){return p.isPlainObject(c)&&p.isPlainObject(u)?p.merge.call({caseless:R},c,u):p.isPlainObject(u)?p.merge({},u):p.isArray(u)?u.slice():u}function o(c,u,y,R){if(p.isUndefined(u)){if(!p.isUndefined(c))return s(void 0,c,y,R)}else return s(c,u,y,R)}function i(c,u){if(!p.isUndefined(u))return s(void 0,u)}function a(c,u){if(p.isUndefined(u)){if(!p.isUndefined(c))return s(void 0,c)}else return s(void 0,u)}function l(c,u,y){if(y in t)return s(c,u);if(y in e)return s(void 0,c)}const h={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(c,u,y)=>o(zt(c),zt(u),y,!0)};return p.forEach(Object.keys({...e,...t}),function(u){const y=h[u]||o,R=y(e[u],t[u],u);p.isUndefined(R)&&y!==l||(r[u]=R)}),r}const Nt=e=>{const t=pe({},e);let{data:r,withXSRFToken:s,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:l}=t;if(t.headers=a=ne.from(a),t.url=kt(At(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),p.isFormData(r)){if(ee.hasStandardBrowserEnv||ee.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(p.isFunction(r.getHeaders)){const h=r.getHeaders(),c=["content-type","content-length"];Object.entries(h).forEach(([u,y])=>{c.includes(u.toLowerCase())&&a.set(u,y)})}}if(ee.hasStandardBrowserEnv&&(s&&p.isFunction(s)&&(s=s(t)),s||s!==!1&&pn(t.url))){const h=o&&i&&fn.read(i);h&&a.set(o,h)}return t},gn=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,s){const o=Nt(e);let i=o.data;const a=ne.from(o.headers).normalize();let{responseType:l,onUploadProgress:h,onDownloadProgress:c}=o,u,y,R,k,d;function b(){k&&k(),d&&d(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let g=new XMLHttpRequest;g.open(o.method.toUpperCase(),o.url,!0),g.timeout=o.timeout;function M(){if(!g)return;const _=ne.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),B={data:!l||l==="text"||l==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:_,config:e,request:g};Pt(function(N){r(N),b()},function(N){s(N),b()},B),g=null}"onloadend"in g?g.onloadend=M:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(M)},g.onabort=function(){g&&(s(new U("Request aborted",U.ECONNABORTED,e,g)),g=null)},g.onerror=function(T){const B=T&&T.message?T.message:"Network Error",m=new U(B,U.ERR_NETWORK,e,g);m.event=T||null,s(m),g=null},g.ontimeout=function(){let T=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const B=o.transitional||Ct;o.timeoutErrorMessage&&(T=o.timeoutErrorMessage),s(new U(T,B.clarifyTimeoutError?U.ETIMEDOUT:U.ECONNABORTED,e,g)),g=null},i===void 0&&a.setContentType(null),"setRequestHeader"in g&&p.forEach(a.toJSON(),function(T,B){g.setRequestHeader(B,T)}),p.isUndefined(o.withCredentials)||(g.withCredentials=!!o.withCredentials),l&&l!=="json"&&(g.responseType=o.responseType),c&&([R,d]=De(c,!0),g.addEventListener("progress",R)),h&&g.upload&&([y,k]=De(h),g.upload.addEventListener("progress",y),g.upload.addEventListener("loadend",k)),(o.cancelToken||o.signal)&&(u=_=>{g&&(s(!_||_.type?new we(null,e,g):_),g.abort(),g=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));const D=cn(o.url);if(D&&ee.protocols.indexOf(D)===-1){s(new U("Unsupported protocol "+D+":",U.ERR_BAD_REQUEST,e));return}g.send(i||null)})},mn=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let s=new AbortController,o;const i=function(c){if(!o){o=!0,l();const u=c instanceof Error?c:this.reason;s.abort(u instanceof U?u:new we(u instanceof Error?u.message:u))}};let a=t&&setTimeout(()=>{a=null,i(new U(`timeout ${t} of ms exceeded`,U.ETIMEDOUT))},t);const l=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),e=null)};e.forEach(c=>c.addEventListener("abort",i));const{signal:h}=s;return h.unsubscribe=()=>p.asap(l),h}},yn=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let s=0,o;for(;s<r;)o=s+t,yield e.slice(s,o),s=o},bn=async function*(e,t){for await(const r of wn(e))yield*yn(r,t)},wn=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:s}=await t.read();if(r)break;yield s}}finally{await t.cancel()}},Ut=(e,t,r,s)=>{const o=bn(e,t);let i=0,a,l=h=>{a||(a=!0,s&&s(h))};return new ReadableStream({async pull(h){try{const{done:c,value:u}=await o.next();if(c){l(),h.close();return}let y=u.byteLength;if(r){let R=i+=y;r(R)}h.enqueue(new Uint8Array(u))}catch(c){throw l(c),c}},cancel(h){return l(h),o.return()}},{highWaterMark:2})},Dt=64*1024,{isFunction:Fe}=p,Sn=(({Request:e,Response:t})=>({Request:e,Response:t}))(p.global),{ReadableStream:Ft,TextEncoder:Lt}=p.global,Mt=(e,...t)=>{try{return!!e(...t)}catch{return!1}},jn=e=>{e=p.merge.call({skipUndefined:!0},Sn,e);const{fetch:t,Request:r,Response:s}=e,o=t?Fe(t):typeof fetch=="function",i=Fe(r),a=Fe(s);if(!o)return!1;const l=o&&Fe(Ft),h=o&&(typeof Lt=="function"?(d=>b=>d.encode(b))(new Lt):async d=>new Uint8Array(await new r(d).arrayBuffer())),c=i&&l&&Mt(()=>{let d=!1;const b=new r(ee.origin,{body:new Ft,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!b}),u=a&&l&&Mt(()=>p.isReadableStream(new s("").body)),y={stream:u&&(d=>d.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!y[d]&&(y[d]=(b,g)=>{let M=b&&b[d];if(M)return M.call(b);throw new U(`Response type '${d}' is not supported`,U.ERR_NOT_SUPPORT,g)})});const R=async d=>{if(d==null)return 0;if(p.isBlob(d))return d.size;if(p.isSpecCompliantForm(d))return(await new r(ee.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(p.isArrayBufferView(d)||p.isArrayBuffer(d))return d.byteLength;if(p.isURLSearchParams(d)&&(d=d+""),p.isString(d))return(await h(d)).byteLength},k=async(d,b)=>{const g=p.toFiniteNumber(d.getContentLength());return g??R(b)};return async d=>{let{url:b,method:g,data:M,signal:D,cancelToken:_,timeout:T,onDownloadProgress:B,onUploadProgress:m,responseType:N,headers:w,withCredentials:F="same-origin",fetchOptions:K}=Nt(d),L=t||fetch;N=N?(N+"").toLowerCase():"text";let Y=mn([D,_&&_.toAbortSignal()],T),Z=null;const E=Y&&Y.unsubscribe&&(()=>{Y.unsubscribe()});let J;try{if(m&&c&&g!=="get"&&g!=="head"&&(J=await k(w,M))!==0){let C=new r(b,{method:"POST",body:M,duplex:"half"}),z;if(p.isFormData(M)&&(z=C.headers.get("content-type"))&&w.setContentType(z),C.body){const[O,x]=Ot(J,De(_t(m)));M=Ut(C.body,Dt,O,x)}}p.isString(F)||(F=F?"include":"omit");const H=i&&"credentials"in r.prototype,A={...K,signal:Y,method:g.toUpperCase(),headers:w.normalize().toJSON(),body:M,duplex:"half",credentials:H?F:void 0};Z=i&&new r(b,A);let I=await(i?L(Z,K):L(b,A));const q=u&&(N==="stream"||N==="response");if(u&&(B||q&&E)){const C={};["status","statusText","headers"].forEach(j=>{C[j]=I[j]});const z=p.toFiniteNumber(I.headers.get("content-length")),[O,x]=B&&Ot(z,De(_t(B),!0))||[];I=new s(Ut(I.body,Dt,O,()=>{x&&x(),E&&E()}),C)}N=N||"text";let f=await y[p.findKey(y,N)||"text"](I,d);return!q&&E&&E(),await new Promise((C,z)=>{Pt(C,z,{data:f,headers:ne.from(I.headers),status:I.status,statusText:I.statusText,config:d,request:Z})})}catch(H){throw E&&E(),H&&H.name==="TypeError"&&/Load failed|fetch/i.test(H.message)?Object.assign(new U("Network Error",U.ERR_NETWORK,d,Z),{cause:H.cause||H}):U.from(H,H&&H.code,d,Z)}}},vn=new Map,Bt=e=>{let t=e?e.env:{};const{fetch:r,Request:s,Response:o}=t,i=[s,o,r];let a=i.length,l=a,h,c,u=vn;for(;l--;)h=i[l],c=u.get(h),c===void 0&&u.set(h,c=l?new Map:jn(t)),u=c;return c};Bt();const Ze={http:Hr,xhr:gn,fetch:{get:Bt}};p.forEach(Ze,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Wt=e=>`- ${e}`,kn=e=>p.isFunction(e)||e===null||e===!1,$t={getAdapter:(e,t)=>{e=p.isArray(e)?e:[e];const{length:r}=e;let s,o;const i={};for(let a=0;a<r;a++){s=e[a];let l;if(o=s,!kn(s)&&(o=Ze[(l=String(s)).toLowerCase()],o===void 0))throw new U(`Unknown adapter '${l}'`);if(o&&(p.isFunction(o)||(o=o.get(t))))break;i[l||"#"+a]=o}if(!o){const a=Object.entries(i).map(([h,c])=>`adapter ${h} `+(c===!1?"is not supported by the environment":"is not available in the build"));let l=r?a.length>1?`since :
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const s=new this(t);return r.forEach(o=>s.set(o)),s}static accessor(t){const s=(this[Rt]=this[Rt]={accessors:{}}).accessors,o=this.prototype;function i(a){const l=Te(a);s[l]||(ln(o,a),s[l]=!0)}return p.isArray(t)?t.forEach(i):i(t),this}};ne.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),p.reduceDescriptors(ne.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[r]=s}}}),p.freezeMethods(ne);function Ge(e,t){const r=this||Ce,s=t||r,o=ne.from(s.headers);let i=s.data;return p.forEach(e,function(l){i=l.call(r,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function It(e){return!!(e&&e.__CANCEL__)}function we(e,t,r){U.call(this,e??"canceled",U.ERR_CANCELED,t,r),this.name="CanceledError"}p.inherits(we,U,{__CANCEL__:!0});function Pt(e,t,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?e(r):t(new U("Request failed with status code "+r.status,[U.ERR_BAD_REQUEST,U.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function cn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function dn(e,t){e=e||10;const r=new Array(e),s=new Array(e);let o=0,i=0,a;return t=t!==void 0?t:1e3,function(h){const c=Date.now(),u=s[i];a||(a=c),r[o]=h,s[o]=c;let y=i,R=0;for(;y!==o;)R+=r[y++],y=y%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-a<t)return;const k=u&&c-u;return k?Math.round(R*1e3/k):void 0}}function un(e,t){let r=0,s=1e3/t,o,i;const a=(c,u=Date.now())=>{r=u,o=null,i&&(clearTimeout(i),i=null),e(...c)};return[(...c)=>{const u=Date.now(),y=u-r;y>=s?a(c,u):(o=c,i||(i=setTimeout(()=>{i=null,a(o)},s-y)))},()=>o&&a(o)]}const De=(e,t,r=3)=>{let s=0;const o=dn(50,250);return un(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,h=a-s,c=o(h),u=a<=l;s=a;const y={loaded:a,total:l,progress:l?a/l:void 0,bytes:h,rate:c||void 0,estimated:c&&l&&u?(l-a)/c:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(y)},r)},Ot=(e,t)=>{const r=e!=null;return[s=>t[0]({lengthComputable:r,total:e,loaded:s}),t[1]]},_t=e=>(...t)=>p.asap(()=>e(...t)),pn=ee.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,ee.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(ee.origin),ee.navigator&&/(msie|trident)/i.test(ee.navigator.userAgent)):()=>!0,fn=ee.hasStandardBrowserEnv?{write(e,t,r,s,o,i){const a=[e+"="+encodeURIComponent(t)];p.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),p.isString(s)&&a.push("path="+s),p.isString(o)&&a.push("domain="+o),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function xn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function hn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function At(e,t,r){let s=!xn(t);return e&&(s||r==!1)?hn(e,t):t}const zt=e=>e instanceof ne?{...e}:e;function pe(e,t){t=t||{};const r={};function s(c,u,y,R){return p.isPlainObject(c)&&p.isPlainObject(u)?p.merge.call({caseless:R},c,u):p.isPlainObject(u)?p.merge({},u):p.isArray(u)?u.slice():u}function o(c,u,y,R){if(p.isUndefined(u)){if(!p.isUndefined(c))return s(void 0,c,y,R)}else return s(c,u,y,R)}function i(c,u){if(!p.isUndefined(u))return s(void 0,u)}function a(c,u){if(p.isUndefined(u)){if(!p.isUndefined(c))return s(void 0,c)}else return s(void 0,u)}function l(c,u,y){if(y in t)return s(c,u);if(y in e)return s(void 0,c)}const h={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(c,u,y)=>o(zt(c),zt(u),y,!0)};return p.forEach(Object.keys({...e,...t}),function(u){const y=h[u]||o,R=y(e[u],t[u],u);p.isUndefined(R)&&y!==l||(r[u]=R)}),r}const Nt=e=>{const t=pe({},e);let{data:r,withXSRFToken:s,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:l}=t;if(t.headers=a=ne.from(a),t.url=kt(At(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),p.isFormData(r)){if(ee.hasStandardBrowserEnv||ee.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(p.isFunction(r.getHeaders)){const h=r.getHeaders(),c=["content-type","content-length"];Object.entries(h).forEach(([u,y])=>{c.includes(u.toLowerCase())&&a.set(u,y)})}}if(ee.hasStandardBrowserEnv&&(s&&p.isFunction(s)&&(s=s(t)),s||s!==!1&&pn(t.url))){const h=o&&i&&fn.read(i);h&&a.set(o,h)}return t},gn=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,s){const o=Nt(e);let i=o.data;const a=ne.from(o.headers).normalize();let{responseType:l,onUploadProgress:h,onDownloadProgress:c}=o,u,y,R,k,d;function b(){k&&k(),d&&d(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let g=new XMLHttpRequest;g.open(o.method.toUpperCase(),o.url,!0),g.timeout=o.timeout;function M(){if(!g)return;const _=ne.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),B={data:!l||l==="text"||l==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:_,config:e,request:g};Pt(function(N){r(N),b()},function(N){s(N),b()},B),g=null}"onloadend"in g?g.onloadend=M:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(M)},g.onabort=function(){g&&(s(new U("Request aborted",U.ECONNABORTED,e,g)),g=null)},g.onerror=function(E){const B=E&&E.message?E.message:"Network Error",m=new U(B,U.ERR_NETWORK,e,g);m.event=E||null,s(m),g=null},g.ontimeout=function(){let E=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const B=o.transitional||Ct;o.timeoutErrorMessage&&(E=o.timeoutErrorMessage),s(new U(E,B.clarifyTimeoutError?U.ETIMEDOUT:U.ECONNABORTED,e,g)),g=null},i===void 0&&a.setContentType(null),"setRequestHeader"in g&&p.forEach(a.toJSON(),function(E,B){g.setRequestHeader(B,E)}),p.isUndefined(o.withCredentials)||(g.withCredentials=!!o.withCredentials),l&&l!=="json"&&(g.responseType=o.responseType),c&&([R,d]=De(c,!0),g.addEventListener("progress",R)),h&&g.upload&&([y,k]=De(h),g.upload.addEventListener("progress",y),g.upload.addEventListener("loadend",k)),(o.cancelToken||o.signal)&&(u=_=>{g&&(s(!_||_.type?new we(null,e,g):_),g.abort(),g=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));const D=cn(o.url);if(D&&ee.protocols.indexOf(D)===-1){s(new U("Unsupported protocol "+D+":",U.ERR_BAD_REQUEST,e));return}g.send(i||null)})},mn=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let s=new AbortController,o;const i=function(c){if(!o){o=!0,l();const u=c instanceof Error?c:this.reason;s.abort(u instanceof U?u:new we(u instanceof Error?u.message:u))}};let a=t&&setTimeout(()=>{a=null,i(new U(`timeout ${t} of ms exceeded`,U.ETIMEDOUT))},t);const l=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),e=null)};e.forEach(c=>c.addEventListener("abort",i));const{signal:h}=s;return h.unsubscribe=()=>p.asap(l),h}},yn=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let s=0,o;for(;s<r;)o=s+t,yield e.slice(s,o),s=o},bn=async function*(e,t){for await(const r of wn(e))yield*yn(r,t)},wn=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:s}=await t.read();if(r)break;yield s}}finally{await t.cancel()}},Ut=(e,t,r,s)=>{const o=bn(e,t);let i=0,a,l=h=>{a||(a=!0,s&&s(h))};return new ReadableStream({async pull(h){try{const{done:c,value:u}=await o.next();if(c){l(),h.close();return}let y=u.byteLength;if(r){let R=i+=y;r(R)}h.enqueue(new Uint8Array(u))}catch(c){throw l(c),c}},cancel(h){return l(h),o.return()}},{highWaterMark:2})},Dt=64*1024,{isFunction:Fe}=p,Sn=(({Request:e,Response:t})=>({Request:e,Response:t}))(p.global),{ReadableStream:Ft,TextEncoder:Lt}=p.global,Mt=(e,...t)=>{try{return!!e(...t)}catch{return!1}},jn=e=>{e=p.merge.call({skipUndefined:!0},Sn,e);const{fetch:t,Request:r,Response:s}=e,o=t?Fe(t):typeof fetch=="function",i=Fe(r),a=Fe(s);if(!o)return!1;const l=o&&Fe(Ft),h=o&&(typeof Lt=="function"?(d=>b=>d.encode(b))(new Lt):async d=>new Uint8Array(await new r(d).arrayBuffer())),c=i&&l&&Mt(()=>{let d=!1;const b=new r(ee.origin,{body:new Ft,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!b}),u=a&&l&&Mt(()=>p.isReadableStream(new s("").body)),y={stream:u&&(d=>d.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!y[d]&&(y[d]=(b,g)=>{let M=b&&b[d];if(M)return M.call(b);throw new U(`Response type '${d}' is not supported`,U.ERR_NOT_SUPPORT,g)})});const R=async d=>{if(d==null)return 0;if(p.isBlob(d))return d.size;if(p.isSpecCompliantForm(d))return(await new r(ee.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(p.isArrayBufferView(d)||p.isArrayBuffer(d))return d.byteLength;if(p.isURLSearchParams(d)&&(d=d+""),p.isString(d))return(await h(d)).byteLength},k=async(d,b)=>{const g=p.toFiniteNumber(d.getContentLength());return g??R(b)};return async d=>{let{url:b,method:g,data:M,signal:D,cancelToken:_,timeout:E,onDownloadProgress:B,onUploadProgress:m,responseType:N,headers:w,withCredentials:F="same-origin",fetchOptions:K}=Nt(d),L=t||fetch;N=N?(N+"").toLowerCase():"text";let Y=mn([D,_&&_.toAbortSignal()],E),Z=null;const C=Y&&Y.unsubscribe&&(()=>{Y.unsubscribe()});let J;try{if(m&&c&&g!=="get"&&g!=="head"&&(J=await k(w,M))!==0){let T=new r(b,{method:"POST",body:M,duplex:"half"}),z;if(p.isFormData(M)&&(z=T.headers.get("content-type"))&&w.setContentType(z),T.body){const[O,x]=Ot(J,De(_t(m)));M=Ut(T.body,Dt,O,x)}}p.isString(F)||(F=F?"include":"omit");const H=i&&"credentials"in r.prototype,A={...K,signal:Y,method:g.toUpperCase(),headers:w.normalize().toJSON(),body:M,duplex:"half",credentials:H?F:void 0};Z=i&&new r(b,A);let I=await(i?L(Z,K):L(b,A));const q=u&&(N==="stream"||N==="response");if(u&&(B||q&&C)){const T={};["status","statusText","headers"].forEach(j=>{T[j]=I[j]});const z=p.toFiniteNumber(I.headers.get("content-length")),[O,x]=B&&Ot(z,De(_t(B),!0))||[];I=new s(Ut(I.body,Dt,O,()=>{x&&x(),C&&C()}),T)}N=N||"text";let f=await y[p.findKey(y,N)||"text"](I,d);return!q&&C&&C(),await new Promise((T,z)=>{Pt(T,z,{data:f,headers:ne.from(I.headers),status:I.status,statusText:I.statusText,config:d,request:Z})})}catch(H){throw C&&C(),H&&H.name==="TypeError"&&/Load failed|fetch/i.test(H.message)?Object.assign(new U("Network Error",U.ERR_NETWORK,d,Z),{cause:H.cause||H}):U.from(H,H&&H.code,d,Z)}}},vn=new Map,Bt=e=>{let t=e?e.env:{};const{fetch:r,Request:s,Response:o}=t,i=[s,o,r];let a=i.length,l=a,h,c,u=vn;for(;l--;)h=i[l],c=u.get(h),c===void 0&&u.set(h,c=l?new Map:jn(t)),u=c;return c};Bt();const Ze={http:Hr,xhr:gn,fetch:{get:Bt}};p.forEach(Ze,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Wt=e=>`- ${e}`,kn=e=>p.isFunction(e)||e===null||e===!1,$t={getAdapter:(e,t)=>{e=p.isArray(e)?e:[e];const{length:r}=e;let s,o;const i={};for(let a=0;a<r;a++){s=e[a];let l;if(o=s,!kn(s)&&(o=Ze[(l=String(s)).toLowerCase()],o===void 0))throw new U(`Unknown adapter '${l}'`);if(o&&(p.isFunction(o)||(o=o.get(t))))break;i[l||"#"+a]=o}if(!o){const a=Object.entries(i).map(([h,c])=>`adapter ${h} `+(c===!1?"is not supported by the environment":"is not available in the build"));let l=r?a.length>1?`since :
|
|
4
4
|
`+a.map(Wt).join(`
|
|
5
5
|
`):" "+Wt(a[0]):"as no adapter specified";throw new U("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return o},adapters:Ze};function Qe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new we(null,e)}function Ht(e){return Qe(e),e.headers=ne.from(e.headers),e.data=Ge.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),$t.getAdapter(e.adapter||Ce.adapter,e)(e).then(function(s){return Qe(e),s.data=Ge.call(e,e.transformResponse,s),s.headers=ne.from(s.headers),s},function(s){return It(s)||(Qe(e),s&&s.response&&(s.response.data=Ge.call(e,e.transformResponse,s.response),s.response.headers=ne.from(s.response.headers))),Promise.reject(s)})}const Vt="1.12.2",Le={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Le[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const Yt={};Le.transitional=function(t,r,s){function o(i,a){return"[Axios v"+Vt+"] Transitional option '"+i+"'"+a+(s?". "+s:"")}return(i,a,l)=>{if(t===!1)throw new U(o(a," has been removed"+(r?" in "+r:"")),U.ERR_DEPRECATED);return r&&!Yt[a]&&(Yt[a]=!0,console.warn(o(a," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,a,l):!0}},Le.spelling=function(t){return(r,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function En(e,t,r){if(typeof e!="object")throw new U("options must be an object",U.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let o=s.length;for(;o-- >0;){const i=s[o],a=t[i];if(a){const l=e[i],h=l===void 0||a(l,i,e);if(h!==!0)throw new U("option "+i+" must be "+h,U.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new U("Unknown option "+i,U.ERR_BAD_OPTION)}}const Me={assertOptions:En,validators:Le},ie=Me.validators;let fe=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Et,response:new Et}}async request(t,r){try{return await this._request(t,r)}catch(s){if(s instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{s.stack?i&&!String(s.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(s.stack+=`
|
|
6
|
-
`+i):s.stack=i}catch{}}throw s}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=pe(this.defaults,r);const{transitional:s,paramsSerializer:o,headers:i}=r;s!==void 0&&Me.assertOptions(s,{silentJSONParsing:ie.transitional(ie.boolean),forcedJSONParsing:ie.transitional(ie.boolean),clarifyTimeoutError:ie.transitional(ie.boolean)},!1),o!=null&&(p.isFunction(o)?r.paramsSerializer={serialize:o}:Me.assertOptions(o,{encode:ie.function,serialize:ie.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Me.assertOptions(r,{baseUrl:ie.spelling("baseURL"),withXsrfToken:ie.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=i&&p.merge(i.common,i[r.method]);i&&p.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),r.headers=ne.concat(a,i);const l=[];let h=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(r)===!1||(h=h&&b.synchronous,l.unshift(b.fulfilled,b.rejected))});const c=[];this.interceptors.response.forEach(function(b){c.push(b.fulfilled,b.rejected)});let u,y=0,R;if(!h){const d=[Ht.bind(this),void 0];for(d.unshift(...l),d.push(...c),R=d.length,u=Promise.resolve(r);y<R;)u=u.then(d[y++],d[y++]);return u}R=l.length;let k=r;for(;y<R;){const d=l[y++],b=l[y++];try{k=d(k)}catch(g){b.call(this,g);break}}try{u=Ht.call(this,k)}catch(d){return Promise.reject(d)}for(y=0,R=c.length;y<R;)u=u.then(c[y++],c[y++]);return u}getUri(t){t=pe(this.defaults,t);const r=At(t.baseURL,t.url,t.allowAbsoluteUrls);return kt(r,t.params,t.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(t){fe.prototype[t]=function(r,s){return this.request(pe(s||{},{method:t,url:r,data:(s||{}).data}))}}),p.forEach(["post","put","patch"],function(t){function r(s){return function(i,a,l){return this.request(pe(l||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}fe.prototype[t]=r(),fe.prototype[t+"Form"]=r(!0)});let Cn=class or{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const s=this;this.promise.then(o=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](o);s._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(l=>{s.subscribe(l),i=l}).then(o);return a.cancel=function(){s.unsubscribe(i)},a},t(function(i,a,l){s.reason||(s.reason=new we(i,a,l),r(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=s=>{t.abort(s)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new or(function(o){t=o}),cancel:t}}};function Tn(e){return function(r){return e.apply(null,r)}}function Rn(e){return p.isObject(e)&&e.isAxiosError===!0}const et={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(et).forEach(([e,t])=>{et[t]=e});function qt(e){const t=new fe(e),r=ct(fe.prototype.request,t);return p.extend(r,fe.prototype,t,{allOwnKeys:!0}),p.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return qt(pe(e,o))},r}const W=qt(Ce);W.Axios=fe,W.CanceledError=we,W.CancelToken=Cn,W.isCancel=It,W.VERSION=Vt,W.toFormData=Ne,W.AxiosError=U,W.Cancel=W.CanceledError,W.all=function(t){return Promise.all(t)},W.spread=Tn,W.isAxiosError=Rn,W.mergeConfig=pe,W.AxiosHeaders=ne,W.formToJSON=e=>Tt(p.isHTMLForm(e)?new FormData(e):e),W.getAdapter=$t.getAdapter,W.HttpStatusCode=et,W.default=W;const{Axios:ms,AxiosError:ys,CanceledError:bs,isCancel:ws,CancelToken:Ss,VERSION:js,all:vs,Cancel:ks,isAxiosError:Es,spread:Cs,toFormData:Ts,AxiosHeaders:Rs,HttpStatusCode:Is,formToJSON:Ps,getAdapter:Os,mergeConfig:_s}=W;class In{baseUrl;apiKey;appId;client;constructor(t){if(!t||!t.baseUrl)throw new Error("NeuctraAuthixClient: 'baseUrl' is required in config");this.baseUrl=t.baseUrl.replace(/\/$/,""),this.apiKey=t.apiKey||null,this.appId=t.appId||null,this.client=W.create({baseURL:this.baseUrl,headers:{"Content-Type":"application/json",...this.apiKey?{"x-api-key":this.apiKey}:{}},timeout:1e4})}async request(t,r,s,o={}){if(!t)
|
|
6
|
+
`+i):s.stack=i}catch{}}throw s}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=pe(this.defaults,r);const{transitional:s,paramsSerializer:o,headers:i}=r;s!==void 0&&Me.assertOptions(s,{silentJSONParsing:ie.transitional(ie.boolean),forcedJSONParsing:ie.transitional(ie.boolean),clarifyTimeoutError:ie.transitional(ie.boolean)},!1),o!=null&&(p.isFunction(o)?r.paramsSerializer={serialize:o}:Me.assertOptions(o,{encode:ie.function,serialize:ie.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Me.assertOptions(r,{baseUrl:ie.spelling("baseURL"),withXsrfToken:ie.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=i&&p.merge(i.common,i[r.method]);i&&p.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),r.headers=ne.concat(a,i);const l=[];let h=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(r)===!1||(h=h&&b.synchronous,l.unshift(b.fulfilled,b.rejected))});const c=[];this.interceptors.response.forEach(function(b){c.push(b.fulfilled,b.rejected)});let u,y=0,R;if(!h){const d=[Ht.bind(this),void 0];for(d.unshift(...l),d.push(...c),R=d.length,u=Promise.resolve(r);y<R;)u=u.then(d[y++],d[y++]);return u}R=l.length;let k=r;for(;y<R;){const d=l[y++],b=l[y++];try{k=d(k)}catch(g){b.call(this,g);break}}try{u=Ht.call(this,k)}catch(d){return Promise.reject(d)}for(y=0,R=c.length;y<R;)u=u.then(c[y++],c[y++]);return u}getUri(t){t=pe(this.defaults,t);const r=At(t.baseURL,t.url,t.allowAbsoluteUrls);return kt(r,t.params,t.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(t){fe.prototype[t]=function(r,s){return this.request(pe(s||{},{method:t,url:r,data:(s||{}).data}))}}),p.forEach(["post","put","patch"],function(t){function r(s){return function(i,a,l){return this.request(pe(l||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}fe.prototype[t]=r(),fe.prototype[t+"Form"]=r(!0)});let Cn=class or{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const s=this;this.promise.then(o=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](o);s._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(l=>{s.subscribe(l),i=l}).then(o);return a.cancel=function(){s.unsubscribe(i)},a},t(function(i,a,l){s.reason||(s.reason=new we(i,a,l),r(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=s=>{t.abort(s)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new or(function(o){t=o}),cancel:t}}};function Tn(e){return function(r){return e.apply(null,r)}}function Rn(e){return p.isObject(e)&&e.isAxiosError===!0}const et={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(et).forEach(([e,t])=>{et[t]=e});function qt(e){const t=new fe(e),r=ct(fe.prototype.request,t);return p.extend(r,fe.prototype,t,{allOwnKeys:!0}),p.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return qt(pe(e,o))},r}const W=qt(Ce);W.Axios=fe,W.CanceledError=we,W.CancelToken=Cn,W.isCancel=It,W.VERSION=Vt,W.toFormData=Ne,W.AxiosError=U,W.Cancel=W.CanceledError,W.all=function(t){return Promise.all(t)},W.spread=Tn,W.isAxiosError=Rn,W.mergeConfig=pe,W.AxiosHeaders=ne,W.formToJSON=e=>Tt(p.isHTMLForm(e)?new FormData(e):e),W.getAdapter=$t.getAdapter,W.HttpStatusCode=et,W.default=W;const{Axios:ms,AxiosError:ys,CanceledError:bs,isCancel:ws,CancelToken:Ss,VERSION:js,all:vs,Cancel:ks,isAxiosError:Es,spread:Cs,toFormData:Ts,AxiosHeaders:Rs,HttpStatusCode:Is,formToJSON:Ps,getAdapter:Os,mergeConfig:_s}=W;class In{baseUrl;apiKey;appId;client;constructor(t){if(!t||!t.baseUrl)throw new Error("NeuctraAuthixClient: 'baseUrl' is required in config");this.baseUrl=t.baseUrl.replace(/\/$/,""),this.apiKey=t.apiKey||null,this.appId=t.appId||null,this.client=W.create({baseURL:this.baseUrl,headers:{"Content-Type":"application/json",...this.apiKey?{"x-api-key":this.apiKey}:{}},timeout:1e4})}async request(t,r,s,o={}){if(!t)return{success:!1,message:"HTTP method is required"};if(!r)return{success:!1,message:"Request path is required"};try{const i={...this.appId?{appId:this.appId}:{},...s||{}};return{success:!0,data:(await this.client.request({url:r,method:t,data:i,headers:o})).data,message:"✅ Request completed successfully"}}catch(i){if(console.error("❌ [Request Error]:",i),i.isAxiosError&&!i.response)return{success:!1,message:`🌐 Network error: ${i.message}`};if(i.response){const a=i.response.status,l=i.response.data?.message||i.response.statusText||"Server returned an error";return{success:!1,message:`⚠️ Request failed (${a}): ${l}`}}return{success:!1,message:`🚨 Unexpected error: ${i.message||"Something went wrong"}`}}}async signup(t){const{name:r,email:s,password:o}=t;if(!r||!s||!o)throw new Error("signup: 'name', 'email', and 'password' are required");return this.request("POST","/users/signup",t)}async login(t){const{email:r,password:s,appId:o}=t;if(!r||!s)throw new Error("login: 'email' and 'password' are required");return this.request("POST","/users/login",{email:r,password:s,appId:o||this.appId})}async updateUser(t){const{userId:r,appId:s}=t;if(!r)throw new Error("updateUser: 'userId' is required");return this.request("PUT",`/users/update/${r}`,{...t,appId:s||this.appId})}async changePassword(t){const{userId:r,currentPassword:s,newPassword:o,appId:i}=t;if(!r)throw new Error("changePassword: 'userId' is required");if(!s||!o)throw new Error("changePassword: both 'currentPassword' and 'newPassword' are required");return this.request("PUT",`/users/change-password/${r}`,{currentPassword:s,newPassword:o,appId:i||this.appId})}async deleteUser(t){const{userId:r,appId:s}=t;if(!r)throw new Error("deleteUser: 'userId' is required");return this.request("DELETE",`/users/delete/${r}`,{appId:s||this.appId})}async getProfile(t){const{token:r}=t;if(!r)throw new Error("getProfile: 'token' is required");return this.request("GET","/users/profile",{},{Authorization:`Bearer ${r}`})}async sendVerifyOTP(t){const{token:r,appId:s}=t;if(!r)throw new Error("sendVerifyOTP: 'token' is required");return this.request("POST","/users/send-verify-otp",{appId:s||this.appId},{Authorization:`Bearer ${r}`})}async verifyEmail(t){const{token:r,otp:s,appId:o}=t;if(!r)throw new Error("verifyEmail: 'token' is required");if(!s)throw new Error("verifyEmail: 'otp' is required");return this.request("POST","/users/verify-email",{otp:s,appId:o||this.appId},{Authorization:`Bearer ${r}`})}async forgotPassword(t){const{email:r,appId:s}=t;if(!r)throw new Error("forgotPassword: 'email' is required");return this.request("POST","/users/forgot-password",{email:r,appId:s||this.appId})}async resetPassword(t){const{email:r,otp:s,newPassword:o,appId:i}=t;if(!r||!s||!o)throw new Error("resetPassword: 'email', 'otp' and 'newPassword' are required");return this.request("POST","/users/reset-password",{email:r,otp:s,newPassword:o,appId:i||this.appId})}async getUserData(t){const{userId:r}=t;if(!r)throw new Error("getUserData: 'userId' is required");return this.request("GET",`/users/${r}/data`)}async getSingleUserData(t){const{userId:r,dataId:s}=t;if(!r||!s)throw new Error("getSingleUserData: 'userId' and 'dataId' are required");return this.request("GET",`/users/${r}/data/${s}`)}async addUserData(t){const{userId:r,data:s}=t;if(!r)throw new Error("addUserData: 'userId' is required");if(!s)throw new Error("addUserData: 'data' is required");return this.request("POST",`/users/${r}/data`,s)}async updateUserData(t){const{userId:r,dataId:s,data:o}=t;if(!r||!s)throw new Error("updateUserData: 'userId' and 'dataId' are required");if(!o)throw new Error("updateUserData: 'data' is required");return this.request("PUT",`/users/${r}/data/${s}`,o)}async deleteUserData(t){const{userId:r,dataId:s}=t;if(!r||!s)throw new Error("deleteUserData: 'userId' and 'dataId' are required");return this.request("DELETE",`/users/${r}/data/${s}`)}}var Be={exports:{}},Re={};/**
|
|
7
7
|
* @license React
|
|
8
8
|
* react-jsx-runtime.production.js
|
|
9
9
|
*
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
*
|
|
20
20
|
* This source code is licensed under the MIT license found in the
|
|
21
21
|
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/var Jt;function On(){return Jt||(Jt=1,process.env.NODE_ENV!=="production"&&(function(){function e(f){if(f==null)return null;if(typeof f=="function")return f.$$typeof===K?null:f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case b:return"Fragment";case M:return"Profiler";case g:return"StrictMode";case B:return"Suspense";case m:return"SuspenseList";case F:return"Activity"}if(typeof f=="object")switch(typeof f.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),f.$$typeof){case d:return"Portal";case _:return(f.displayName||"Context")+".Provider";case D:return(f._context.displayName||"Context")+".Consumer";case
|
|
22
|
+
*/var Jt;function On(){return Jt||(Jt=1,process.env.NODE_ENV!=="production"&&(function(){function e(f){if(f==null)return null;if(typeof f=="function")return f.$$typeof===K?null:f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case b:return"Fragment";case M:return"Profiler";case g:return"StrictMode";case B:return"Suspense";case m:return"SuspenseList";case F:return"Activity"}if(typeof f=="object")switch(typeof f.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),f.$$typeof){case d:return"Portal";case _:return(f.displayName||"Context")+".Provider";case D:return(f._context.displayName||"Context")+".Consumer";case E:var T=f.render;return f=f.displayName,f||(f=T.displayName||T.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case N:return T=f.displayName||null,T!==null?T:e(f.type)||"Memo";case w:T=f._payload,f=f._init;try{return e(f(T))}catch{}}return null}function t(f){return""+f}function r(f){try{t(f);var T=!1}catch{T=!0}if(T){T=console;var z=T.error,O=typeof Symbol=="function"&&Symbol.toStringTag&&f[Symbol.toStringTag]||f.constructor.name||"Object";return z.call(T,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",O),t(f)}}function s(f){if(f===b)return"<>";if(typeof f=="object"&&f!==null&&f.$$typeof===w)return"<...>";try{var T=e(f);return T?"<"+T+">":"<...>"}catch{return"<...>"}}function o(){var f=L.A;return f===null?null:f.getOwner()}function i(){return Error("react-stack-top-frame")}function a(f){if(Y.call(f,"key")){var T=Object.getOwnPropertyDescriptor(f,"key").get;if(T&&T.isReactWarning)return!1}return f.key!==void 0}function l(f,T){function z(){J||(J=!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)",T))}z.isReactWarning=!0,Object.defineProperty(f,"key",{get:z,configurable:!0})}function h(){var f=e(this.type);return H[f]||(H[f]=!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.")),f=this.props.ref,f!==void 0?f:null}function c(f,T,z,O,x,j,X,se){return z=j.ref,f={$$typeof:k,type:f,key:T,props:j,_owner:x},(z!==void 0?z:null)!==null?Object.defineProperty(f,"ref",{enumerable:!1,get:h}):Object.defineProperty(f,"ref",{enumerable:!1,value:null}),f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(f,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(f,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.defineProperty(f,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:se}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f}function u(f,T,z,O,x,j,X,se){var G=T.children;if(G!==void 0)if(O)if(Z(G)){for(O=0;O<G.length;O++)y(G[O]);Object.freeze&&Object.freeze(G)}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 y(G);if(Y.call(T,"key")){G=e(f);var oe=Object.keys(T).filter(function(P){return P!=="key"});O=0<oe.length?"{key: someKey, "+oe.join(": ..., ")+": ...}":"{key: someKey}",q[G+O]||(oe=0<oe.length?"{"+oe.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
23
23
|
let props = %s;
|
|
24
24
|
<%s {...props} />
|
|
25
25
|
React keys must be passed directly to JSX without using spread:
|
|
26
26
|
let props = %s;
|
|
27
|
-
<%s key={someKey} {...props} />`,O,G,oe,G),q[G+O]=!0)}if(G=null,z!==void 0&&(r(z),G=""+z),a(
|
|
27
|
+
<%s key={someKey} {...props} />`,O,G,oe,G),q[G+O]=!0)}if(G=null,z!==void 0&&(r(z),G=""+z),a(T)&&(r(T.key),G=""+T.key),"key"in T){z={};for(var de in T)de!=="key"&&(z[de]=T[de])}else z=T;return G&&l(z,typeof f=="function"?f.displayName||f.name||"Unknown":f),c(f,G,j,x,o(),z,X,se)}function y(f){typeof f=="object"&&f!==null&&f.$$typeof===k&&f._store&&(f._store.validated=1)}var R=S,k=Symbol.for("react.transitional.element"),d=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),_=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),K=Symbol.for("react.client.reference"),L=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,Z=Array.isArray,C=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(f){return f()}};var J,H={},A=R.react_stack_bottom_frame.bind(R,i)(),I=C(s(i)),q={};Ie.Fragment=b,Ie.jsx=function(f,T,z,O,x){var j=1e4>L.recentlyCreatedOwnerStacks++;return u(f,T,z,!1,O,x,j?Error("react-stack-top-frame"):A,j?C(s(f)):I)},Ie.jsxs=function(f,T,z,O,x){var j=1e4>L.recentlyCreatedOwnerStacks++;return u(f,T,z,!0,O,x,j?Error("react-stack-top-frame"):A,j?C(s(f)):I)}})()),Ie}var Xt;function _n(){return Xt||(Xt=1,process.env.NODE_ENV==="production"?Be.exports=Pn():Be.exports=On()),Be.exports}var n=_n();const An=async(e,t)=>{const{name:r,email:s,password:o,appId:i,phone:a,address:l,avatarUrl:h,isActive:c=!0,role:u="user"}=e,{baseUrl:y,apiKey:R}=t;if(!R)throw new Error("API key is required for signup");if(!r||!s||!o||!i)throw new Error("Name, email, password, and appId are required");try{const k=await W.post(`${y}/users/signup`,{name:r,email:s,password:o,appId:i,phone:a,address:l,avatarUrl:h,isActive:c,role:u},{headers:{"Content-Type":"application/json","x-api-key":R}});return k.data?.user&&localStorage.setItem("userInfo",JSON.stringify(k.data.user)),k.data.user}catch(k){const d=k.response?.data?.message||k.message||"Signup failed";if(console.error("Signup API Error:",d),k.response?.status===400){if(d.includes("already exists"))throw{success:!1,message:"User with this email already exists for this app",status:400};if(d.includes("inactive"))throw{success:!1,message:"Cannot signup under an inactive app",status:400}}throw k.response?.status===404?{success:!1,message:"Invalid or inactive app",status:404}:{success:!1,message:d,status:k.response?.status||500}}};/**
|
|
28
28
|
* @license lucide-react v0.544.0 - ISC
|
|
29
29
|
*
|
|
30
30
|
* This source code is licensed under the ISC license.
|
|
@@ -199,12 +199,12 @@ React keys must be passed directly to JSX without using spread:
|
|
|
199
199
|
*
|
|
200
200
|
* This source code is licensed under the ISC license.
|
|
201
201
|
* See the LICENSE file in the root directory of this source tree.
|
|
202
|
-
*/const Pe=$("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),$e={baseUrl:"",apiKey:"",appId:""},Gn=e=>{if(!e.baseUrl||!e.apiKey||!e.appId)throw new Error("baseUrl, apiKey, and appId are required");$e.baseUrl=e.baseUrl,$e.apiKey=e.apiKey,$e.appId=e.appId},ge=()=>$e,Zn=({logoUrl:e,logoLinkUrl:t,title:r="Create Your Account",subtitle:s="Join our platform today",footerText:o="Secure authentication powered by Neuctra Authix",primaryColor:i="#00C214",gradient:a="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,showAvatar:h=!1,loginUrl:c,onSuccess:u,onError:y})=>{const{baseUrl:R,apiKey:k,appId:d}=ge(),b={name:"",email:"",password:"",...h&&{avatarUrl:""}},[g,M]=S.useState(b),[D,_]=S.useState(!1),[
|
|
202
|
+
*/const Pe=$("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),$e={baseUrl:"",apiKey:"",appId:""},Gn=e=>{if(!e.baseUrl||!e.apiKey||!e.appId)throw new Error("baseUrl, apiKey, and appId are required");$e.baseUrl=e.baseUrl,$e.apiKey=e.apiKey,$e.appId=e.appId},ge=()=>$e,Zn=({logoUrl:e,logoLinkUrl:t,title:r="Create Your Account",subtitle:s="Join our platform today",footerText:o="Secure authentication powered by Neuctra Authix",primaryColor:i="#00C214",gradient:a="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,showAvatar:h=!1,loginUrl:c,onSuccess:u,onError:y})=>{const{baseUrl:R,apiKey:k,appId:d}=ge(),b={name:"",email:"",password:"",...h&&{avatarUrl:""}},[g,M]=S.useState(b),[D,_]=S.useState(!1),[E,B]=S.useState(!1),[m,N]=S.useState(null),[w,F]=S.useState({}),K=typeof window<"u"?window.innerWidth<768:!1,L=l?"#ffffff":"#111827",Y=l?"#a1a1aa":"#6b7280",Z=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",C=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",J=q=>{const{name:f,value:T}=q.target;M(z=>({...z,[f]:T})),w[f]&&F(z=>({...z,[f]:void 0}))},H=()=>{const q={};return g.name.trim()||(q.name="Name is required"),g.email.trim()?/\S+@\S+\.\S+/.test(g.email)||(q.email="Invalid email address"):q.email="Email is required",g.password?g.password.length<6&&(q.password="Password must be at least 6 characters"):q.password="Password is required",F(q),Object.keys(q).length===0},A=async q=>{if(q.preventDefault(),!!H()){B(!0),N(null);try{const f={...g,appId:d},T=await An(f,{baseUrl:R,apiKey:k});N({type:"success",text:"Account created successfully!"}),u&&u(T)}catch(f){const T=f.message||"Signup failed. Please try again.";N({type:"error",text:T}),y&&y(f)}finally{B(!1)}}},I={width:"100%",padding:K?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:Z,border:`1px solid ${C}`,borderRadius:"10px",color:L,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"};return n.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:[n.jsxs("div",{style:{minWidth:K?"320px":"380px",width:"100%",maxWidth:K?"340px":"390px",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:K?"30px 24px":"18px 28px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[e?n.jsx("a",{href:t||"/",target:"_self",rel:"noopener noreferrer",children:n.jsx("img",{src:e,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):n.jsx(je,{size:40,color:i,style:{marginBottom:"10px"}}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:L,margin:0},children:r}),n.jsx("p",{style:{fontSize:"14px",color:Y},children:s})]}),h&&g.avatarUrl&&n.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"16px"},children:n.jsx("img",{src:g.avatarUrl,alt:"Avatar Preview",style:{width:"60px",height:"60px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${i}30`},onError:q=>{const f=q.target;f.style.display="none"}})}),n.jsxs("form",{onSubmit:A,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-name",style:{fontSize:"14px",fontWeight:500,color:L},children:"Full Name"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(je,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:Y}}),n.jsx("input",{id:"signup-name",type:"text",name:"name",placeholder:"Enter your full name",value:g.name,onChange:J,style:{...I,borderColor:w.name?"#ef4444":C}})]}),w.name&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:w.name})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-email",style:{fontSize:"14px",fontWeight:500,color:L},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(he,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:Y}}),n.jsx("input",{id:"signup-email",type:"email",name:"email",placeholder:"Enter your email address",value:g.email,onChange:J,style:{...I,borderColor:w.email?"#ef4444":C}})]}),w.email&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:w.email})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-password",style:{fontSize:"14px",fontWeight:500,color:L},children:"Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:Y}}),n.jsx("input",{id:"signup-password",type:D?"text":"password",name:"password",placeholder:"Create a secure password",value:g.password,onChange:J,style:{...I,borderColor:w.password?"#ef4444":C}}),n.jsx("button",{type:"button",onClick:()=>_(!D),style:{position:"absolute",right:"14px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:Y,cursor:"pointer",padding:"4px"},children:D?n.jsx(nt,{size:20}):n.jsx(st,{size:20})})]}),w.password&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:w.password})]}),h&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-avatar",style:{fontSize:"14px",fontWeight:500,color:L},children:"Avatar URL (Optional)"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Qt,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:Y}}),n.jsx("input",{id:"signup-avatar",type:"url",name:"avatarUrl",placeholder:"Paste your avatar image URL",value:g.avatarUrl||"",onChange:J,style:I})]})]}),c&&n.jsx("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:n.jsx("a",{href:c,style:{color:i,textDecoration:"none",fontWeight:500},children:"Already have an account?"})}),m&&n.jsxs("div",{style:{padding:"12px",borderRadius:"12px",fontSize:"12px",display:"flex",alignItems:"start",gap:"10px",backgroundColor:m.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:m.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:m.type==="success"?i:"#ef4444"},children:[m.type==="success"?n.jsx(xe,{size:20}):n.jsx(le,{size:20}),n.jsx("span",{children:m.text})]}),n.jsx("button",{type:"submit",disabled:E,style:{padding:"12px",background:a,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600,cursor:E?"not-allowed":"pointer",opacity:E?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:E?n.jsxs(n.Fragment,{children:[n.jsx(Hn,{size:18,style:{animation:"spin 1s linear infinite"}}),"Creating Account..."]}):"Create Account"})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:Y,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]}),n.jsx("style",{children:`
|
|
203
203
|
@keyframes spin {
|
|
204
204
|
from { transform: rotate(0deg); }
|
|
205
205
|
to { transform: rotate(360deg); }
|
|
206
206
|
}
|
|
207
|
-
`})]})},Qn=async(e,t)=>{const{email:r,password:s,appId:o}=e,{baseUrl:i,apiKey:a}=t;if(!a)throw new Error("API key is required for login");try{const l=await W.post(`${i}/users/login`,{email:r,password:s,appId:o},{headers:{"Content-Type":"application/json","x-api-key":a}});return l.data?.user&&localStorage.setItem("userInfo",JSON.stringify(l.data.user)),l.data.user}catch(l){const h=l.response?.data?.message||l.message||"Login failed";throw console.error("Login API Error:",h),{success:!1,message:h,status:l.response?.status||500}}},es=({logoUrl:e,logoLinkUrl:t,title:r="Sign In to Your Account",subtitle:s="Welcome back! Please enter your details",footerText:o="Secure authentication powered by Neuctra Authix",primaryColor:i="#00C214",gradient:a="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,signupUrl:h,onSuccess:c,onError:u})=>{const{baseUrl:y,apiKey:R,appId:k}=ge(),[d,b]=S.useState("login"),[g,M]=S.useState(1),[D,_]=S.useState(!1),[T,B]=S.useState(!1),[m,N]=S.useState(null),[w,F]=S.useState(""),[K,L]=S.useState(""),[Y,Z]=S.useState({email:"",otp:"",newPassword:"",appId:k}),E=window.innerWidth<768,J=l?"#ffffff":"#111827",H=l?"#a1a1aa":"#6b7280",A=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",I=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",q=async x=>{x.preventDefault(),B(!0),N(null);try{const j=await Qn({email:w,password:K,appId:k},{baseUrl:y,apiKey:R});N({type:"success",text:`Welcome ${j.name}`}),c?.(j)}catch(j){const X=j.message||"Login failed";N({type:"error",text:X}),u?.(j)}finally{B(!1)}},f=x=>{Z({...Y,[x.target.name]:x.target.value})},C=async x=>{x.preventDefault(),B(!0),N(null);try{const j=await W.post(`${y}/users/forgot-password`,{email:Y.email,appId:k},{headers:{"x-api-key":R}});j.data.success?(M(2),N({type:"success",text:"OTP sent to your email"})):N({type:"error",text:j.data.message||"Failed to send OTP"})}catch(j){N({type:"error",text:j.response?.data?.message||"Something went wrong"})}finally{B(!1)}},z=async x=>{x.preventDefault(),B(!0),N(null);try{const j=await W.post(`${y}/users/reset-password`,Y,{headers:{"x-api-key":R}});j.data.success?(N({type:"success",text:"Password reset successfully!"}),M(1),Z({email:"",otp:"",newPassword:"",appId:k}),b("login")):N({type:"error",text:j.data.message||"Reset failed"})}catch(j){N({type:"error",text:j.response?.data?.message||"Something went wrong"})}finally{B(!1)}},O={width:"100%",padding:E?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:A,border:`1px solid ${I}`,borderRadius:"10px",color:J,fontSize:"15px",outline:"none",transition:"all 0.2s ease"};return n.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:n.jsxs("div",{style:{minWidth:E?"320px":"380px",maxWidth:E?"340px":"390px",width:"100%",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:E?"30px 24px":"18px 28px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[e?n.jsx("a",{href:t||"/",target:"_self",rel:"noopener noreferrer",children:n.jsx("img",{src:e,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):n.jsx(je,{size:40,color:i,style:{marginBottom:"10px"}}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:J,margin:0},children:d==="login"?r:g===1?"Forgot Password":"Reset Password"}),n.jsx("p",{style:{fontSize:"14px",color:H},children:d==="login"?s:"Follow the steps to reset your password"})]}),d==="login"&&n.jsxs("form",{onSubmit:q,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"login-email",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(he,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:w,onChange:x=>F(x.target.value),style:O})]})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"login-password",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"login-password",type:D?"text":"password",placeholder:"Enter your password",value:K,onChange:x=>L(x.target.value),style:O}),n.jsx("button",{type:"button",onClick:()=>_(!D),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:H,cursor:"pointer"},children:D?n.jsx(nt,{size:20}):n.jsx(st,{size:20})})]})]}),n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:[h&&n.jsx("a",{href:h,style:{color:i,textDecoration:"none",fontWeight:500},children:"Create new account"}),n.jsx("button",{type:"button",onClick:()=>b("forgot"),style:{background:"none",border:"none",color:i,fontWeight:500,cursor:"pointer"},children:"Forgot password?"})]}),n.jsx("button",{type:"submit",disabled:T,style:{padding:"12px",background:a,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600},children:T?"Signing In...":"Sign In"})]}),d==="forgot"&&n.jsxs("form",{onSubmit:g===1?C:z,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[g===1?n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"forgot-email",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(he,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:Y.email,onChange:f,style:O})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[n.jsx("label",{htmlFor:"otp",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"One-Time Password (OTP)"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(er,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:Y.otp,onChange:f,style:O})]})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[n.jsx("label",{htmlFor:"newPassword",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"New Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:Y.newPassword,onChange:f,style:O})]})]})]}),n.jsx("button",{type:"submit",disabled:T,style:{padding:"12px",background:a,color:"#fff",border:"none",fontSize:"14px",borderRadius:"10px",fontWeight:600},children:T?"Please wait...":g===1?"Send Reset OTP":"Reset Password"}),n.jsx("button",{type:"button",onClick:()=>{b("login"),M(1)},style:{background:"none",border:"none",fontSize:"14px",color:H,marginTop:"6px",cursor:"pointer"},children:"Back to Login"})]}),m&&n.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:m.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:m.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:m.type==="success"?i:"#ef4444"},children:[m.type==="success"?n.jsx(xe,{size:20}):n.jsx(le,{size:20}),n.jsx("span",{children:m.text})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:H,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]})})},ts=()=>{try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},rs=({children:e,fallback:t=null,width:r,height:s})=>{if(!ts())return n.jsx(n.Fragment,{children:t});const o={display:"inline-flex",alignItems:"center",verticalAlign:"middle",...r?{width:r}:{},...s?{height:s}:{}};return n.jsx("span",{style:o,children:e})},ns=()=>{try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},ss=({children:e,fallback:t=null,width:r,height:s})=>{if(ns())return n.jsx(n.Fragment,{children:t});const o={display:"inline-flex",alignItems:"center",verticalAlign:"middle",...r?{width:r}:{},...s?{height:s}:{}};return n.jsx("span",{style:o,children:e})},os=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:o,token:i,colors:a})=>{const{baseUrl:l,apiKey:h,appId:c}=ge(),[u,y]=S.useState(!1),[R,k]=S.useState(""),[d,b]=S.useState("warning"),[g,M]=S.useState(!1);if(S.useEffect(()=>{const m=()=>{M(window.innerWidth<640)};return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[]),!e)return null;const D=async()=>{y(!0),b("processing");try{const{data:m}=await W.delete(`${l}/users/delete/${o}`,{data:{appId:c},headers:{"x-api-key":h}});m.success?(r(m.message||"Account deleted successfully"),b("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(s(m.message||"Failed to delete account"),b("warning"))}catch(m){s(m.response?.data?.message||"Something went wrong"),b("warning")}finally{y(!1)}},_=R.toLowerCase()==="delete my account",T=m=>{m.target===m.currentTarget&&d!=="processing"&&d!=="success"&&t()},B=()=>{switch(d){case"warning":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #ef4444, #dc2626)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(We,{size:20})}),n.jsx("div",{children:n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Delete Account"})})]}),n.jsx("button",{onClick:t,"aria-label":"Close modal",style:{background:"transparent",border:"none",color:a.textTertiary,cursor:"pointer",padding:"8px",borderRadius:"8px",width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.2s ease"},onMouseOver:m=>{m.currentTarget.style.backgroundColor=a.border,m.currentTarget.style.color=a.textPrimary},onMouseOut:m=>{m.currentTarget.style.backgroundColor="transparent",m.currentTarget.style.color=a.textTertiary},children:n.jsx(Pe,{size:20})})]}),n.jsxs("div",{style:{display:"flex",gap:"16px",padding:"20px",background:`${a.error}15`,border:`1px solid ${a.error}30`,borderRadius:"12px",marginBottom:"20px"},children:[n.jsx("div",{style:{color:a.error,flexShrink:0,display:"flex",alignItems:"flex-start"},children:n.jsx(sr,{size:24})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h4",{style:{color:a.textPrimary,margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Before you proceed..."}),n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[{icon:n.jsx(Mn,{size:16}),text:"All your data will be permanently deleted"},{icon:n.jsx(Xn,{size:16}),text:"This action cannot be reversed"},{icon:n.jsx(ot,{size:16}),text:"You will lose access to all services"}].map((m,N)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",fontSize:"14px",color:a.textSecondary},children:[n.jsx("div",{style:{color:a.error,flexShrink:0},children:m.icon}),n.jsx("span",{children:m.text})]},N))})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:g?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:t,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:g?"none":1,minWidth:g?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:m=>{m.currentTarget.style.backgroundColor=a.border,m.currentTarget.style.transform="translateY(-1px)"},onMouseOut:m=>{m.currentTarget.style.backgroundColor="transparent",m.currentTarget.style.transform="translateY(0)"},children:"Cancel"}),n.jsxs("button",{onClick:()=>b("confirmation"),style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:"pointer",flex:g?"none":1,minWidth:g?"100%":"140px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:m=>{m.currentTarget.style.transform="translateY(-1px)",m.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)"},onMouseOut:m=>{m.currentTarget.style.transform="translateY(0)",m.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)"},children:[n.jsx(We,{size:16}),"Continue to Delete"]})]})]});case"confirmation":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #f59e0b, #d97706)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(sr,{size:24})}),n.jsx("div",{style:{flex:1},children:n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Confirm Deletion"})})]}),n.jsxs("div",{style:{marginBottom:"24px"},children:[n.jsxs("p",{style:{color:a.textSecondary,marginBottom:"16px",fontSize:"14px",lineHeight:"1.5"},children:["Type"," ",n.jsx("strong",{style:{color:a.textPrimary},children:'"delete my account"'})," ","to confirm:"]}),n.jsx("input",{type:"text",value:R,onChange:m=>k(m.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${_?a.success:a.error}`,backgroundColor:"transparent",color:a.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:m=>{m.target.style.boxShadow=`0 0 0 3px ${a.accent}20`},onBlur:m=>{m.target.style.boxShadow="none"},autoFocus:!0}),_&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"10px",color:a.success,fontSize:"14px",fontWeight:500},children:[n.jsx(rt,{size:16}),n.jsx("span",{children:"Confirmation accepted"})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:()=>{b("warning"),k("")},style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:g?"none":1,minWidth:g?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:m=>{m.currentTarget.style.backgroundColor=a.border,m.currentTarget.style.transform="translateY(-1px)"},onMouseOut:m=>{m.currentTarget.style.backgroundColor="transparent",m.currentTarget.style.transform="translateY(0)"},children:"Go Back"}),n.jsxs("button",{onClick:D,disabled:!_||u,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:!_||u?"not-allowed":"pointer",flex:g?"none":1,minWidth:g?"100%":"140px",opacity:!_||u?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:!_||u?"none":"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:m=>{_&&!u&&(m.currentTarget.style.transform="translateY(-1px)",m.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)")},onMouseOut:m=>{_&&!u&&(m.currentTarget.style.transform="translateY(0)",m.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)")},children:[n.jsx(We,{size:16}),"Yes, Delete My Account"]})]})]});case"processing":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #6b7280, #4b5563)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(ce,{size:20,style:{animation:"spin 1s linear infinite"}})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Deleting Account"}),n.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Please wait while we process your request"})]})]}),n.jsx("div",{style:{marginBottom:"20px"},children:n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[{text:"Removing your data",active:!0},{text:"Closing active sessions",active:!1},{text:"Finalizing deletion",active:!1}].map((m,N)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",borderRadius:"8px",transition:"all 0.2s ease",backgroundColor:m.active?`${a.accent}10`:"transparent"},children:[n.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:m.active?a.accent:a.textTertiary,transition:"all 0.3s ease",boxShadow:m.active?`0 0 0 4px ${a.accent}20`:"none"}}),n.jsx("span",{style:{fontSize:"14px",color:m.active?a.textPrimary:a.textSecondary,fontWeight:m.active?500:400},children:m.text})]},N))})}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${a.accent}10`,borderRadius:"10px",fontSize:"14px",color:a.textSecondary},children:[n.jsx(nr,{size:18,style:{color:a.accent,flexShrink:0}}),n.jsx("span",{children:"You will be redirected to the login page shortly"})]})]});case"success":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #10b981, #059669)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(rt,{size:20})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Account Deleted"}),n.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Your account has been successfully deleted"})]})]}),n.jsxs("div",{style:{textAlign:"center",padding:"20px",background:`${a.success}10`,border:`1px solid ${a.success}20`,borderRadius:"12px",marginBottom:"24px"},children:[n.jsx(rt,{size:48,style:{color:a.success,marginBottom:"12px",display:"block",margin:"0 auto 12px auto"}}),n.jsx("p",{style:{color:a.textPrimary,fontSize:"16px",fontWeight:600,margin:"0 0 8px 0"},children:"Goodbye!"}),n.jsx("p",{style:{color:a.textSecondary,fontSize:"14px",margin:0,lineHeight:"1.5"},children:"Your account and all associated data have been permanently removed from our systems."})]}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${a.accent}10`,borderRadius:"10px",fontSize:"14px",color:a.textSecondary,justifyContent:"center"},children:[n.jsx(ce,{size:16,style:{animation:"spin 1s linear infinite",color:a.accent}}),n.jsx("span",{children:"Redirecting to login page..."})]})]})}};return n.jsxs("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.8)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:1e4,animation:"fadeIn 0.3s ease-out"},onClick:T,children:[n.jsx("div",{style:{backgroundColor:a.surface,border:`1px solid ${a.border}`,borderRadius:"20px",width:"100%",maxWidth:"480px",padding:"24px",boxShadow:"0 32px 64px rgba(0,0,0,0.4)",animation:"scaleIn 0.3s ease-out"},className:"delete-modal-container",children:B()}),n.jsx("style",{children:`
|
|
207
|
+
`})]})},Qn=async(e,t)=>{const{email:r,password:s,appId:o}=e,{baseUrl:i,apiKey:a}=t;if(!a)throw new Error("API key is required for login");try{const l=await W.post(`${i}/users/login`,{email:r,password:s,appId:o},{headers:{"Content-Type":"application/json","x-api-key":a}});return l.data?.user&&localStorage.setItem("userInfo",JSON.stringify(l.data.user)),l.data.user}catch(l){const h=l.response?.data?.message||l.message||"Login failed";throw console.error("Login API Error:",h),{success:!1,message:h,status:l.response?.status||500}}},es=({logoUrl:e,logoLinkUrl:t,title:r="Sign In to Your Account",subtitle:s="Welcome back! Please enter your details",footerText:o="Secure authentication powered by Neuctra Authix",primaryColor:i="#00C214",gradient:a="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,signupUrl:h,onSuccess:c,onError:u})=>{const{baseUrl:y,apiKey:R,appId:k}=ge(),[d,b]=S.useState("login"),[g,M]=S.useState(1),[D,_]=S.useState(!1),[E,B]=S.useState(!1),[m,N]=S.useState(null),[w,F]=S.useState(""),[K,L]=S.useState(""),[Y,Z]=S.useState({email:"",otp:"",newPassword:"",appId:k}),C=window.innerWidth<768,J=l?"#ffffff":"#111827",H=l?"#a1a1aa":"#6b7280",A=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",I=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",q=async x=>{x.preventDefault(),B(!0),N(null);try{const j=await Qn({email:w,password:K,appId:k},{baseUrl:y,apiKey:R});N({type:"success",text:`Welcome ${j.name}`}),c?.(j)}catch(j){const X=j.message||"Login failed";N({type:"error",text:X}),u?.(j)}finally{B(!1)}},f=x=>{Z({...Y,[x.target.name]:x.target.value})},T=async x=>{x.preventDefault(),B(!0),N(null);try{const j=await W.post(`${y}/users/forgot-password`,{email:Y.email,appId:k},{headers:{"x-api-key":R}});j.data.success?(M(2),N({type:"success",text:"OTP sent to your email"})):N({type:"error",text:j.data.message||"Failed to send OTP"})}catch(j){N({type:"error",text:j.response?.data?.message||"Something went wrong"})}finally{B(!1)}},z=async x=>{x.preventDefault(),B(!0),N(null);try{const j=await W.post(`${y}/users/reset-password`,Y,{headers:{"x-api-key":R}});j.data.success?(N({type:"success",text:"Password reset successfully!"}),M(1),Z({email:"",otp:"",newPassword:"",appId:k}),b("login")):N({type:"error",text:j.data.message||"Reset failed"})}catch(j){N({type:"error",text:j.response?.data?.message||"Something went wrong"})}finally{B(!1)}},O={width:"100%",padding:C?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:A,border:`1px solid ${I}`,borderRadius:"10px",color:J,fontSize:"15px",outline:"none",transition:"all 0.2s ease"};return n.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:n.jsxs("div",{style:{minWidth:C?"320px":"380px",maxWidth:C?"340px":"390px",width:"100%",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:C?"30px 24px":"18px 28px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[e?n.jsx("a",{href:t||"/",target:"_self",rel:"noopener noreferrer",children:n.jsx("img",{src:e,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):n.jsx(je,{size:40,color:i,style:{marginBottom:"10px"}}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:J,margin:0},children:d==="login"?r:g===1?"Forgot Password":"Reset Password"}),n.jsx("p",{style:{fontSize:"14px",color:H},children:d==="login"?s:"Follow the steps to reset your password"})]}),d==="login"&&n.jsxs("form",{onSubmit:q,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"login-email",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(he,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:w,onChange:x=>F(x.target.value),style:O})]})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"login-password",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"login-password",type:D?"text":"password",placeholder:"Enter your password",value:K,onChange:x=>L(x.target.value),style:O}),n.jsx("button",{type:"button",onClick:()=>_(!D),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:H,cursor:"pointer"},children:D?n.jsx(nt,{size:20}):n.jsx(st,{size:20})})]})]}),n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:[h&&n.jsx("a",{href:h,style:{color:i,textDecoration:"none",fontWeight:500},children:"Create new account"}),n.jsx("button",{type:"button",onClick:()=>b("forgot"),style:{background:"none",border:"none",color:i,fontWeight:500,cursor:"pointer"},children:"Forgot password?"})]}),n.jsx("button",{type:"submit",disabled:E,style:{padding:"12px",background:a,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600},children:E?"Signing In...":"Sign In"})]}),d==="forgot"&&n.jsxs("form",{onSubmit:g===1?T:z,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[g===1?n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"forgot-email",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(he,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:Y.email,onChange:f,style:O})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[n.jsx("label",{htmlFor:"otp",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"One-Time Password (OTP)"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(er,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:Y.otp,onChange:f,style:O})]})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[n.jsx("label",{htmlFor:"newPassword",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"New Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:Y.newPassword,onChange:f,style:O})]})]})]}),n.jsx("button",{type:"submit",disabled:E,style:{padding:"12px",background:a,color:"#fff",border:"none",fontSize:"14px",borderRadius:"10px",fontWeight:600},children:E?"Please wait...":g===1?"Send Reset OTP":"Reset Password"}),n.jsx("button",{type:"button",onClick:()=>{b("login"),M(1)},style:{background:"none",border:"none",fontSize:"14px",color:H,marginTop:"6px",cursor:"pointer"},children:"Back to Login"})]}),m&&n.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:m.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:m.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:m.type==="success"?i:"#ef4444"},children:[m.type==="success"?n.jsx(xe,{size:20}):n.jsx(le,{size:20}),n.jsx("span",{children:m.text})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:H,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]})})},ts=()=>{try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},rs=({children:e,fallback:t=null,width:r,height:s})=>{if(!ts())return n.jsx(n.Fragment,{children:t});const o={display:"inline-flex",alignItems:"center",verticalAlign:"middle",...r?{width:r}:{},...s?{height:s}:{}};return n.jsx("span",{style:o,children:e})},ns=()=>{try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},ss=({children:e,fallback:t=null,width:r,height:s})=>{if(ns())return n.jsx(n.Fragment,{children:t});const o={display:"inline-flex",alignItems:"center",verticalAlign:"middle",...r?{width:r}:{},...s?{height:s}:{}};return n.jsx("span",{style:o,children:e})},os=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:o,token:i,colors:a})=>{const{baseUrl:l,apiKey:h,appId:c}=ge(),[u,y]=S.useState(!1),[R,k]=S.useState(""),[d,b]=S.useState("warning"),[g,M]=S.useState(!1);if(S.useEffect(()=>{const m=()=>{M(window.innerWidth<640)};return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[]),!e)return null;const D=async()=>{y(!0),b("processing");try{const{data:m}=await W.delete(`${l}/users/delete/${o}`,{data:{appId:c},headers:{"x-api-key":h}});m.success?(r(m.message||"Account deleted successfully"),b("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(s(m.message||"Failed to delete account"),b("warning"))}catch(m){s(m.response?.data?.message||"Something went wrong"),b("warning")}finally{y(!1)}},_=R.toLowerCase()==="delete my account",E=m=>{m.target===m.currentTarget&&d!=="processing"&&d!=="success"&&t()},B=()=>{switch(d){case"warning":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #ef4444, #dc2626)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(We,{size:20})}),n.jsx("div",{children:n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Delete Account"})})]}),n.jsx("button",{onClick:t,"aria-label":"Close modal",style:{background:"transparent",border:"none",color:a.textTertiary,cursor:"pointer",padding:"8px",borderRadius:"8px",width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.2s ease"},onMouseOver:m=>{m.currentTarget.style.backgroundColor=a.border,m.currentTarget.style.color=a.textPrimary},onMouseOut:m=>{m.currentTarget.style.backgroundColor="transparent",m.currentTarget.style.color=a.textTertiary},children:n.jsx(Pe,{size:20})})]}),n.jsxs("div",{style:{display:"flex",gap:"16px",padding:"20px",background:`${a.error}15`,border:`1px solid ${a.error}30`,borderRadius:"12px",marginBottom:"20px"},children:[n.jsx("div",{style:{color:a.error,flexShrink:0,display:"flex",alignItems:"flex-start"},children:n.jsx(sr,{size:24})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h4",{style:{color:a.textPrimary,margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Before you proceed..."}),n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[{icon:n.jsx(Mn,{size:16}),text:"All your data will be permanently deleted"},{icon:n.jsx(Xn,{size:16}),text:"This action cannot be reversed"},{icon:n.jsx(ot,{size:16}),text:"You will lose access to all services"}].map((m,N)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",fontSize:"14px",color:a.textSecondary},children:[n.jsx("div",{style:{color:a.error,flexShrink:0},children:m.icon}),n.jsx("span",{children:m.text})]},N))})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:g?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:t,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:g?"none":1,minWidth:g?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:m=>{m.currentTarget.style.backgroundColor=a.border,m.currentTarget.style.transform="translateY(-1px)"},onMouseOut:m=>{m.currentTarget.style.backgroundColor="transparent",m.currentTarget.style.transform="translateY(0)"},children:"Cancel"}),n.jsxs("button",{onClick:()=>b("confirmation"),style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:"pointer",flex:g?"none":1,minWidth:g?"100%":"140px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:m=>{m.currentTarget.style.transform="translateY(-1px)",m.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)"},onMouseOut:m=>{m.currentTarget.style.transform="translateY(0)",m.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)"},children:[n.jsx(We,{size:16}),"Continue to Delete"]})]})]});case"confirmation":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #f59e0b, #d97706)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(sr,{size:24})}),n.jsx("div",{style:{flex:1},children:n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Confirm Deletion"})})]}),n.jsxs("div",{style:{marginBottom:"24px"},children:[n.jsxs("p",{style:{color:a.textSecondary,marginBottom:"16px",fontSize:"14px",lineHeight:"1.5"},children:["Type"," ",n.jsx("strong",{style:{color:a.textPrimary},children:'"delete my account"'})," ","to confirm:"]}),n.jsx("input",{type:"text",value:R,onChange:m=>k(m.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${_?a.success:a.error}`,backgroundColor:"transparent",color:a.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:m=>{m.target.style.boxShadow=`0 0 0 3px ${a.accent}20`},onBlur:m=>{m.target.style.boxShadow="none"},autoFocus:!0}),_&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"10px",color:a.success,fontSize:"14px",fontWeight:500},children:[n.jsx(rt,{size:16}),n.jsx("span",{children:"Confirmation accepted"})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:()=>{b("warning"),k("")},style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:g?"none":1,minWidth:g?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:m=>{m.currentTarget.style.backgroundColor=a.border,m.currentTarget.style.transform="translateY(-1px)"},onMouseOut:m=>{m.currentTarget.style.backgroundColor="transparent",m.currentTarget.style.transform="translateY(0)"},children:"Go Back"}),n.jsxs("button",{onClick:D,disabled:!_||u,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:!_||u?"not-allowed":"pointer",flex:g?"none":1,minWidth:g?"100%":"140px",opacity:!_||u?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:!_||u?"none":"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:m=>{_&&!u&&(m.currentTarget.style.transform="translateY(-1px)",m.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)")},onMouseOut:m=>{_&&!u&&(m.currentTarget.style.transform="translateY(0)",m.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)")},children:[n.jsx(We,{size:16}),"Yes, Delete My Account"]})]})]});case"processing":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #6b7280, #4b5563)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(ce,{size:20,style:{animation:"spin 1s linear infinite"}})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Deleting Account"}),n.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Please wait while we process your request"})]})]}),n.jsx("div",{style:{marginBottom:"20px"},children:n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[{text:"Removing your data",active:!0},{text:"Closing active sessions",active:!1},{text:"Finalizing deletion",active:!1}].map((m,N)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",borderRadius:"8px",transition:"all 0.2s ease",backgroundColor:m.active?`${a.accent}10`:"transparent"},children:[n.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:m.active?a.accent:a.textTertiary,transition:"all 0.3s ease",boxShadow:m.active?`0 0 0 4px ${a.accent}20`:"none"}}),n.jsx("span",{style:{fontSize:"14px",color:m.active?a.textPrimary:a.textSecondary,fontWeight:m.active?500:400},children:m.text})]},N))})}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${a.accent}10`,borderRadius:"10px",fontSize:"14px",color:a.textSecondary},children:[n.jsx(nr,{size:18,style:{color:a.accent,flexShrink:0}}),n.jsx("span",{children:"You will be redirected to the login page shortly"})]})]});case"success":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #10b981, #059669)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(rt,{size:20})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Account Deleted"}),n.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Your account has been successfully deleted"})]})]}),n.jsxs("div",{style:{textAlign:"center",padding:"20px",background:`${a.success}10`,border:`1px solid ${a.success}20`,borderRadius:"12px",marginBottom:"24px"},children:[n.jsx(rt,{size:48,style:{color:a.success,marginBottom:"12px",display:"block",margin:"0 auto 12px auto"}}),n.jsx("p",{style:{color:a.textPrimary,fontSize:"16px",fontWeight:600,margin:"0 0 8px 0"},children:"Goodbye!"}),n.jsx("p",{style:{color:a.textSecondary,fontSize:"14px",margin:0,lineHeight:"1.5"},children:"Your account and all associated data have been permanently removed from our systems."})]}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${a.accent}10`,borderRadius:"10px",fontSize:"14px",color:a.textSecondary,justifyContent:"center"},children:[n.jsx(ce,{size:16,style:{animation:"spin 1s linear infinite",color:a.accent}}),n.jsx("span",{children:"Redirecting to login page..."})]})]})}};return n.jsxs("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.8)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:1e4,animation:"fadeIn 0.3s ease-out"},onClick:E,children:[n.jsx("div",{style:{backgroundColor:a.surface,border:`1px solid ${a.border}`,borderRadius:"20px",width:"100%",maxWidth:"480px",padding:"24px",boxShadow:"0 32px 64px rgba(0,0,0,0.4)",animation:"scaleIn 0.3s ease-out"},className:"delete-modal-container",children:B()}),n.jsx("style",{children:`
|
|
208
208
|
@keyframes fadeIn {
|
|
209
209
|
from { opacity: 0; }
|
|
210
210
|
to { opacity: 1; }
|
|
@@ -306,7 +306,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
306
306
|
transition: none !important;
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
|
-
`})]})},is=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:o,colors:i})=>{const{baseUrl:a,apiKey:l,appId:h}=ge(),[c,u]=S.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[y,R]=S.useState({}),[k,d]=S.useState(!1),[b,g]=S.useState({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[M,D]=S.useState(!1);if(S.useEffect(()=>{const w=()=>{D(window.innerWidth<640)};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]),!e)return null;const _=w=>{const{name:F,value:K}=w.target;u(L=>({...L,[F]:K})),y[F]&&R(L=>({...L,[F]:""}))},
|
|
309
|
+
`})]})},is=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:o,colors:i})=>{const{baseUrl:a,apiKey:l,appId:h}=ge(),[c,u]=S.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[y,R]=S.useState({}),[k,d]=S.useState(!1),[b,g]=S.useState({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[M,D]=S.useState(!1);if(S.useEffect(()=>{const w=()=>{D(window.innerWidth<640)};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]),!e)return null;const _=w=>{const{name:F,value:K}=w.target;u(L=>({...L,[F]:K})),y[F]&&R(L=>({...L,[F]:""}))},E=w=>{g(F=>({...F,[w]:!F[w]}))},B=()=>{const w={};return c.currentPassword||(w.currentPassword="Current password is required"),c.newPassword?c.newPassword.length<6&&(w.newPassword="Password must be at least 6 characters"):w.newPassword="New password is required",c.newPassword!==c.confirmPassword&&(w.confirmPassword="Passwords do not match"),R(w),Object.keys(w).length===0},m=async w=>{if(w.preventDefault(),!!B()){d(!0);try{const{data:F}=await W.put(`${a}/users/change-password/${o}`,{appId:h,currentPassword:c.currentPassword,newPassword:c.newPassword},{headers:{"x-api-key":l}});F.success?(r(F.message||"Password updated successfully"),u({currentPassword:"",newPassword:"",confirmPassword:""}),t()):s(F.message||"Failed to update password")}catch(F){s(F.response?.data?.message||"Something went wrong")}finally{d(!1)}}},N=[{field:"currentPassword",label:"Current Password",icon:n.jsx(tr,{size:18})},{field:"newPassword",label:"New Password",icon:n.jsx(Se,{size:18})},{field:"confirmPassword",label:"Confirm Password",icon:n.jsx(Se,{size:18})}];return n.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.7)",backdropFilter:"blur(6px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:1e3},children:n.jsxs("div",{style:{backgroundColor:i.surface,border:`1px solid ${i.border}`,borderRadius:"16px",maxWidth:"440px",width:"100%",padding:"24px",boxShadow:"0 20px 60px rgba(0,0,0,0.4)",maxHeight:"90vh",overflowY:"auto"},className:"change-password-modal",children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"24px",gap:"12px"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"10px",background:`linear-gradient(135deg, ${i.accent}20, ${i.accent}40)`,display:"flex",alignItems:"center",justifyContent:"center",color:i.accent,flexShrink:0},children:n.jsx(Se,{size:20})}),n.jsx("div",{children:n.jsx("h3",{style:{color:i.textPrimary,margin:0,fontSize:"18px",fontWeight:600,lineHeight:"1.4"},children:"Change Password"})})]}),n.jsx("button",{onClick:t,"aria-label":"Close password change modal",style:{background:"transparent",border:"none",color:i.textTertiary,cursor:"pointer",padding:"8px",borderRadius:"8px",flexShrink:0,width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center"},onMouseOver:w=>{w.currentTarget.style.backgroundColor=i.border,w.currentTarget.style.color=i.textPrimary},onMouseOut:w=>{w.currentTarget.style.backgroundColor="transparent",w.currentTarget.style.color=i.textTertiary},children:n.jsx(Pe,{size:20})})]}),n.jsxs("form",{onSubmit:m,children:[N.map(({field:w,label:F,icon:K})=>n.jsxs("div",{style:{marginBottom:"20px",position:"relative"},children:[n.jsx("label",{htmlFor:w,style:{display:"block",marginBottom:"8px",color:i.textPrimary,fontSize:"14px",fontWeight:500,lineHeight:"1.4"},children:F}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx("div",{style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:i.textTertiary,zIndex:2},children:K}),n.jsx("input",{type:b[w]?"text":"password",id:w,name:w,placeholder:`Enter ${F.toLowerCase()}`,value:c[w],onChange:_,style:{width:"100%",padding:"14px 48px 14px 44px",borderRadius:"10px",border:`1.5px solid ${y[w]?i.error:i.border}`,backgroundColor:"transparent",color:i.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:L=>{L.target.style.borderColor=i.accent,L.target.style.boxShadow=`0 0 0 3px ${i.accent}20`},onBlur:L=>{L.target.style.borderColor=y[w]?i.error:i.border,L.target.style.boxShadow="none"}}),n.jsx("button",{type:"button",onClick:()=>E(w),style:{position:"absolute",right:"14px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",cursor:"pointer",color:i.textTertiary,padding:"4px",borderRadius:"4px",width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center"},onMouseOver:L=>{L.currentTarget.style.backgroundColor=i.border,L.currentTarget.style.color=i.textPrimary},onMouseOut:L=>{L.currentTarget.style.backgroundColor="transparent",L.currentTarget.style.color=i.textTertiary},children:b[w]?n.jsx(nt,{size:18}):n.jsx(st,{size:18})})]}),y[w]&&n.jsxs("div",{style:{fontSize:"13px",color:i.error,marginTop:"6px",display:"flex",alignItems:"center",gap:"6px"},children:[n.jsx("span",{style:{fontSize:"16px"},children:"⚠"}),y[w]]})]},w)),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:M?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{type:"button",onClick:t,disabled:k,style:{padding:"14px 24px",borderRadius:"10px",border:`1.5px solid ${i.border}`,background:"transparent",color:i.textPrimary,fontSize:"14px",fontWeight:500,cursor:k?"not-allowed":"pointer",flex:M?"none":1,minWidth:M?"100%":"120px",opacity:k?.6:1,transition:"all 0.2s ease"},onMouseOver:w=>{k||(w.currentTarget.style.backgroundColor=i.border,w.currentTarget.style.transform="translateY(-1px)")},onMouseOut:w=>{k||(w.currentTarget.style.backgroundColor="transparent",w.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),n.jsx("button",{type:"submit",disabled:k,style:{padding:"14px 24px",borderRadius:"10px",border:"none",background:`linear-gradient(135deg, ${i.accent}, ${i.accent}E6)`,color:"#fff",fontSize:"14px",fontWeight:600,cursor:k?"not-allowed":"pointer",flex:M?"none":1,minWidth:M?"100%":"140px",opacity:k?.8:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:k?"none":`0 4px 12px ${i.accent}40`},onMouseOver:w=>{k||(w.currentTarget.style.transform="translateY(-1px)",w.currentTarget.style.boxShadow=`0 6px 20px ${i.accent}60`)},onMouseOut:w=>{k||(w.currentTarget.style.transform="translateY(0)",w.currentTarget.style.boxShadow=`0 4px 12px ${i.accent}40`)},children:k?n.jsxs(n.Fragment,{children:[n.jsx(ce,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):"Update Password"})]})]}),n.jsx("style",{children:`
|
|
310
310
|
@keyframes spin {
|
|
311
311
|
from { transform: rotate(0deg); }
|
|
312
312
|
to { transform: rotate(360deg); }
|
|
@@ -491,7 +491,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
491
491
|
animation: none;
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
|
-
`})]})},cs=({token:e,user:t=null,darkMode:r=!0,homeUrl:s,onLogout:o,primaryColor:i="#00C212"})=>{const{baseUrl:a,apiKey:l,appId:h}=ge(),[c,u]=S.useState(t),[y,R]=S.useState(!0),[k,d]=S.useState(!1),[b,g]=S.useState(!1),[M,D]=S.useState(!1),[_,T]=S.useState(!1),[B,m]=S.useState(!1),[N,w]=S.useState(!1),[F,K]=S.useState(!1),[L,Y]=S.useState(!1),[Z,E]=S.useState(null),[J,H]=S.useState(!1),[A,I]=S.useState({email:"",otp:"",appId:h}),[q,f]=S.useState(!1),[C,z]=S.useState(!1),O=(v,V)=>{E({type:v,message:V}),setTimeout(()=>E(null),3e3)},x=()=>{Y(!0);const v=setTimeout(()=>{K(!1),Y(!1)},150);return()=>clearTimeout(v)};S.useEffect(()=>{const v=V=>{const Q=document.querySelector(".dropdown-container");Q&&!Q.contains(V.target)&&x()};return F&&document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[F]);const j=async()=>{if(!A.email||!/\S+@\S+\.\S+/.test(A.email)){O("error","Please enter a valid email");return}try{z(!0);const v=await W.post(`${a}/users/send-verify-otp/${c?.id}`,{email:A.email},{headers:{"x-api-key":l,"x-app-id":h}});v.data.success?(O("success",v.data.message||"OTP sent to email!"),f(!0)):O("error",v.data.message||"Failed to send OTP")}catch(v){O("error",v.response?.data?.message||"Server error")}finally{z(!1)}},X=async v=>{if(v.preventDefault(),!A.email||!A.otp){O("error","Please fill in all fields");return}try{z(!0);const V=await W.post(`${a}/users/verify-email`,A);if(V.data.success){if(O("success",V.data.message||"Email verified!"),c){const Q={...c,isVerified:!0};u(Q),localStorage.setItem("userInfo",JSON.stringify({...Q,token:e}))}I({email:"",otp:"",appId:h}),f(!1),w(!1)}else O("error",V.data.message||"Verification failed")}catch(V){O("error",V.response?.data?.message||"Something went wrong")}finally{z(!1)}},se=async v=>{if(!c)return!1;try{const V={...c,avatarUrl:v},{data:Q}=await W.put(`${a}/users/update/${c.id}`,V,{headers:{"x-api-key":l}});return Q.success?(u(V),localStorage.setItem("userInfo",JSON.stringify({...V,token:e})),O("success","Avatar updated successfully!"),!0):(O("error",Q.message||"Failed to update avatar"),!1)}catch(V){return console.error("Avatar update error:",V),O("error","Failed to update avatar"),!1}},G=async()=>{if(c){g(!0);try{const{data:v}=await W.put(`${a}/users/update/${c.id}`,c,{headers:{"x-api-key":l}});v.success?(u(v.user),d(!1),localStorage.setItem("userInfo",JSON.stringify({...v.user,token:e})),O("success","Profile updated successfully")):O("error",v.message)}catch(v){console.error(v),O("error","Update failed")}finally{g(!1)}}},oe=async v=>{try{const{data:V}=await W.get(`${a}/users/check-user/${v}?appId=${h}`,{headers:{"x-api-key":l}});(!V.success||!V.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),u(null))}catch(V){console.error("User check failed:",V),localStorage.removeItem("userInfo"),u(null)}};S.useEffect(()=>{(()=>{if(t)u(t),R(!1),oe(t.id);else{const V=localStorage.getItem("userInfo");if(V){const Q=JSON.parse(V);u(Q),R(!1),oe(Q.id)}else R(!1)}})()},[t]),S.useEffect(()=>{c?.email&&I(v=>({...v,email:c.email}))},[c?.email]);const de=(v,V)=>{let Q=parseInt(v.replace("#",""),16),me=(Q>>16)+V,it=(Q>>8&255)+V,lt=(Q&255)+V;return me=Math.min(255,Math.max(0,me)),it=Math.min(255,Math.max(0,it)),lt=Math.min(255,Math.max(0,lt)),`#${(lt|it<<8|me<<16).toString(16).padStart(6,"0")}`},P=r?{background:"#000000",surface:"#09090b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:i,accentHover:de(i,-15),success:"#10b981",error:"#ef4444",border:"#27272a",warning:"#f59e0b"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:i,accentHover:de(i,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7",warning:"#d97706"};if(y)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:P.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",textAlign:"center"},children:[n.jsx(ce,{size:40,color:P.accent,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}),n.jsx("p",{style:{color:P.textTertiary,margin:0},children:"Loading your profile..."})]})});if(!c)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:P.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",textAlign:"center"},children:[n.jsx(le,{size:40,color:P.error,"aria-hidden":"true"}),n.jsx("p",{style:{color:P.textTertiary,margin:0},children:"No profile found. Please log in again."})]})});const at=[{label:"Full Name",value:c.name,name:"name",type:"text",icon:je},{label:"Email Address",value:c.email,name:"email",type:"email",icon:he},{label:"Phone Number",value:c.phone||"Not set",name:"phone",type:"tel",icon:qn},{label:"Address",value:c.address||"Not provided",name:"address",type:"text",icon:Vn}];return n.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:P.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",lineHeight:1.5,minHeight:"80vh"},children:[Z&&n.jsxs("div",{style:{position:"fixed",top:"20px",right:"20px",padding:"12px 24px",borderRadius:"12px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",backdropFilter:"blur(8px)",border:"1px solid",zIndex:1e3,display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",fontWeight:500,maxWidth:"400px",animation:"slideIn 0.3s ease-out",...Z.type==="success"?{backgroundColor:r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",borderColor:r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)",color:r?"#34d399":"#059669"}:{backgroundColor:r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)",borderColor:r?"rgba(239, 68, 68, 0.3)":"rgba(239, 68, 68, 0.2)",color:r?"#f87171":"#dc2626"}},role:"alert","aria-live":"polite",children:[Z.type==="success"?n.jsx(xe,{size:20,"aria-hidden":"true"}):n.jsx(le,{size:20,"aria-hidden":"true"}),Z.message]}),n.jsx("div",{style:{maxWidth:"1200px",margin:"0 auto",width:"100%",boxSizing:"border-box"},children:n.jsxs("div",{style:{display:"grid",gap:"24px",gridTemplateColumns:"1fr",...window.innerWidth>=1024&&{gridTemplateColumns:"1fr 2fr",gap:"10px"},...window.innerWidth>=768&&window.innerWidth<1024&&{gap:"10px"},...window.innerWidth>=600&&window.innerWidth<768&&{gap:"28px"}},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",height:"100%"},children:[n.jsxs("section",{style:{backgroundColor:P.surface,borderRadius:"16px",position:"relative",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",textAlign:"center",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",flex:1,minHeight:"300px"},children:[s&&n.jsx("a",{href:s||"/",target:"_self",rel:"noopener noreferrer",style:{position:"absolute",top:"18px",left:"18px"},children:n.jsx(Wn,{size:20,style:{color:r?"#ffffff":"#000000"}})}),n.jsxs("div",{style:{position:"relative",display:"inline-block",marginBottom:"16px"},children:[n.jsx("img",{src:c.avatarUrl||`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(c.name)}`,alt:`Profile avatar of ${c.name}`,style:{width:"128px",height:"128px",borderRadius:"50%",objectFit:"cover",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.3)",border:`3px solid ${P.border}`},width:128,height:128,loading:"eager"}),n.jsx("button",{onClick:()=>D(!0),style:{position:"absolute",bottom:"8px",right:"8px",backgroundColor:P.accent,color:"white",padding:"8px",borderRadius:"50%",border:"none",cursor:"pointer",transition:"all 0.2s ease",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px"},"aria-label":"Change profile picture",children:n.jsx(tt,{size:16,"aria-hidden":"true"})})]}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:600,margin:"0 0 4px 0",color:P.textPrimary},children:c.name}),n.jsx("p",{style:{color:P.textTertiary,margin:"0 0 8px 0"},children:c.email}),n.jsxs("div",{style:{backgroundColor:c.isVerified?r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)":r?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:c.isVerified?P.success:P.warning,border:`1px solid ${c.isVerified?r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)":r?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`,padding:"6px 12px",borderRadius:"20px",fontSize:"12px",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"6px",marginTop:"8px"},children:[c.isVerified?n.jsx(xe,{size:16,"aria-hidden":"true"}):n.jsx(le,{size:16,"aria-hidden":"true"}),c.isVerified?"Email Verified":"Not Verified"]})]}),n.jsx("nav",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:k?n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>d(!1),style:{backgroundColor:P.surfaceLight,border:`1px solid ${P.border}`,color:P.textPrimary,padding:"10px 20px",borderRadius:"6px",borderStyle:"solid",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[n.jsx(Pe,{size:16,"aria-hidden":"true"}),"Cancel"]}),n.jsxs("button",{onClick:G,disabled:b,style:{background:`linear-gradient(to right, ${P.accent}, ${P.accentHover})`,opacity:b?.7:1,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:b?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[b?n.jsx(ce,{size:16,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(Kn,{size:16,"aria-hidden":"true"}),b?"Saving...":"Save Changes"]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>d(!0),style:{background:`linear-gradient(to right, ${P.accent}, ${P.accentHover})`,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[n.jsx(Yn,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("button",{style:{backgroundColor:P.surfaceLight,color:P.textPrimary,padding:"10px 20px",borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",width:"100%",boxSizing:"border-box"},onClick:()=>K(!F),children:[n.jsx(Bn,{size:16,"aria-hidden":"true"}),"More Actions"]}),F&&n.jsxs("div",{className:`dropdown-container ${L?"closing":""}`,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:P.surface,border:`1px solid ${P.border}`,borderRadius:"12px 12px 0 0",boxShadow:"0 -8px 24px rgba(0, 0, 0, 0.25)",zIndex:200,marginBottom:"6px",overflow:"hidden",animation:`${L?"drawerSlideDown":"drawerSlideUp"} 0.25s ease-out forwards`},children:[n.jsxs("button",{onClick:()=>{T(!0),x()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:P.textPrimary,cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>v.currentTarget.style.backgroundColor=P.surfaceLight,onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[n.jsx(tr,{size:14,"aria-hidden":"true"}),"Change Password"]}),!c.isVerified&&n.jsxs("button",{onClick:()=>{w(!0),x()},disabled:J,style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:J?P.textTertiary:P.warning,cursor:J?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left",opacity:J?.6:1},onMouseEnter:v=>{J||(v.currentTarget.style.backgroundColor=P.surfaceLight)},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[J?n.jsx(ce,{size:14,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(rr,{size:14,"aria-hidden":"true"}),J?"Sending...":"Verify Email"]}),o&&n.jsxs("button",{onClick:()=>{o(),x()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:r?"#fca5a5":"#dc2626",cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[n.jsx(ot,{size:14,"aria-hidden":"true"}),"Logout"]}),n.jsxs("button",{onClick:()=>{m(!0),x()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:"#ef4444",cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:600,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[n.jsx(We,{size:14,"aria-hidden":"true"}),"Delete Account"]})]})]})]})})]}),n.jsxs("div",{style:{minWidth:0,display:"flex",flexDirection:"column",gap:"12px"},children:[n.jsxs("section",{style:{backgroundColor:P.surface,borderRadius:"16px",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[n.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:P.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(je,{size:20,"aria-hidden":"true"}),"Personal Information"]}),n.jsx("div",{style:{display:"grid",gap:"20px",gridTemplateColumns:"1fr",...window.innerWidth>=600&&{gridTemplateColumns:"1fr 1fr",gap:"20px"}},children:at.map(v=>{const V=v.icon;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[n.jsxs("label",{style:{color:P.textTertiary,fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(V,{size:16,"aria-hidden":"true"}),v.label]}),k?n.jsx("input",{type:v.type,name:v.name,value:c[v.name],onChange:Q=>u(me=>me&&{...me,[Q.target.name]:Q.target.value}),style:{padding:"12px",borderRadius:"8px",border:`1px solid ${i}`,backgroundColor:"transparent",color:P.textPrimary,fontSize:"12px",outline:"none",transition:"border-color 0.2s ease",minHeight:"44px",width:"100%",boxSizing:"border-box"},placeholder:`Enter ${v.label.toLowerCase()}`,"aria-label":v.label}):n.jsx("div",{style:{padding:"12px",borderRadius:"8px",border:"1px solid transparent",fontSize:"12px",minHeight:"44px",display:"flex",alignItems:"center",boxSizing:"border-box",color:P.textPrimary,backgroundColor:r?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:v.value})]},v.name)})})]}),n.jsxs("section",{style:{backgroundColor:P.surface,borderRadius:"16px",padding:"30px 24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[n.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:P.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(nr,{size:20,"aria-hidden":"true"}),"Security Status"]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",color:P.textSecondary},children:[n.jsx(he,{size:16,"aria-hidden":"true"}),n.jsx("span",{children:"Email Verification"})]}),n.jsx("div",{style:{padding:"6px 12px",borderRadius:"8px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px",...c.isVerified?{backgroundColor:r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",color:P.success,border:`1px solid ${r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)"}`}:{backgroundColor:r?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:P.warning,border:`1px solid ${r?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`}},children:c.isVerified?n.jsxs(n.Fragment,{children:[n.jsx(xe,{size:16,"aria-hidden":"true"}),"Verified"]}):n.jsxs(n.Fragment,{children:[n.jsx(le,{size:16,"aria-hidden":"true"}),"Not Verified"]})})]}),!c.isVerified&&n.jsx("div",{style:{padding:"12px",borderRadius:"8px",backgroundColor:r?"rgba(100, 100, 100, 0.1)":"rgba(0, 0, 0, 0.05)"},children:n.jsx("p",{style:{color:P.textTertiary,fontSize:"12px",margin:0},children:"Verify your email to unlock all features and enhance your account security."})})]})]})]})]})}),n.jsx(as,{isOpen:M,onClose:()=>{D(!1)},onUpdate:se,colors:P}),n.jsx(is,{baseUrl:a,apiKey:l,appId:h,userId:c.id,isOpen:_,onClose:()=>T(!1),onSuccess:v=>O("success",v),onError:v=>O("error",v),colors:P}),n.jsx(os,{baseUrl:a,apiKey:l,appId:h,userId:c.id,token:e,isOpen:B,onClose:()=>m(!1),onSuccess:v=>O("success",v),onError:v=>O("error",v),colors:P}),n.jsx(ls,{isOpen:N,onClose:()=>{w(!1),f(!1),I({email:c?.email||"",otp:"",appId:h})},onVerify:X,onSendOTP:j,verifyFormData:A,setVerifyFormData:I,otpSent:q,verifying:C,user:c,colors:P,darkMode:r}),n.jsx("style",{children:`
|
|
494
|
+
`})]})},cs=({token:e,user:t=null,darkMode:r=!0,homeUrl:s,onLogout:o,primaryColor:i="#00C212"})=>{const{baseUrl:a,apiKey:l,appId:h}=ge(),[c,u]=S.useState(t),[y,R]=S.useState(!0),[k,d]=S.useState(!1),[b,g]=S.useState(!1),[M,D]=S.useState(!1),[_,E]=S.useState(!1),[B,m]=S.useState(!1),[N,w]=S.useState(!1),[F,K]=S.useState(!1),[L,Y]=S.useState(!1),[Z,C]=S.useState(null),[J,H]=S.useState(!1),[A,I]=S.useState({email:"",otp:"",appId:h}),[q,f]=S.useState(!1),[T,z]=S.useState(!1),O=(v,V)=>{C({type:v,message:V}),setTimeout(()=>C(null),3e3)},x=()=>{Y(!0);const v=setTimeout(()=>{K(!1),Y(!1)},150);return()=>clearTimeout(v)};S.useEffect(()=>{const v=V=>{const Q=document.querySelector(".dropdown-container");Q&&!Q.contains(V.target)&&x()};return F&&document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[F]);const j=async()=>{if(!A.email||!/\S+@\S+\.\S+/.test(A.email)){O("error","Please enter a valid email");return}try{z(!0);const v=await W.post(`${a}/users/send-verify-otp/${c?.id}`,{email:A.email},{headers:{"x-api-key":l,"x-app-id":h}});v.data.success?(O("success",v.data.message||"OTP sent to email!"),f(!0)):O("error",v.data.message||"Failed to send OTP")}catch(v){O("error",v.response?.data?.message||"Server error")}finally{z(!1)}},X=async v=>{if(v.preventDefault(),!A.email||!A.otp){O("error","Please fill in all fields");return}try{z(!0);const V=await W.post(`${a}/users/verify-email`,A);if(V.data.success){if(O("success",V.data.message||"Email verified!"),c){const Q={...c,isVerified:!0};u(Q),localStorage.setItem("userInfo",JSON.stringify({...Q,token:e}))}I({email:"",otp:"",appId:h}),f(!1),w(!1)}else O("error",V.data.message||"Verification failed")}catch(V){O("error",V.response?.data?.message||"Something went wrong")}finally{z(!1)}},se=async v=>{if(!c)return!1;try{const V={...c,avatarUrl:v},{data:Q}=await W.put(`${a}/users/update/${c.id}`,V,{headers:{"x-api-key":l}});return Q.success?(u(V),localStorage.setItem("userInfo",JSON.stringify({...V,token:e})),O("success","Avatar updated successfully!"),!0):(O("error",Q.message||"Failed to update avatar"),!1)}catch(V){return console.error("Avatar update error:",V),O("error","Failed to update avatar"),!1}},G=async()=>{if(c){g(!0);try{const{data:v}=await W.put(`${a}/users/update/${c.id}`,c,{headers:{"x-api-key":l}});v.success?(u(v.user),d(!1),localStorage.setItem("userInfo",JSON.stringify({...v.user,token:e})),O("success","Profile updated successfully")):O("error",v.message)}catch(v){console.error(v),O("error","Update failed")}finally{g(!1)}}},oe=async v=>{try{const{data:V}=await W.get(`${a}/users/check-user/${v}?appId=${h}`,{headers:{"x-api-key":l}});(!V.success||!V.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),u(null))}catch(V){console.error("User check failed:",V),localStorage.removeItem("userInfo"),u(null)}};S.useEffect(()=>{(()=>{if(t)u(t),R(!1),oe(t.id);else{const V=localStorage.getItem("userInfo");if(V){const Q=JSON.parse(V);u(Q),R(!1),oe(Q.id)}else R(!1)}})()},[t]),S.useEffect(()=>{c?.email&&I(v=>({...v,email:c.email}))},[c?.email]);const de=(v,V)=>{let Q=parseInt(v.replace("#",""),16),me=(Q>>16)+V,it=(Q>>8&255)+V,lt=(Q&255)+V;return me=Math.min(255,Math.max(0,me)),it=Math.min(255,Math.max(0,it)),lt=Math.min(255,Math.max(0,lt)),`#${(lt|it<<8|me<<16).toString(16).padStart(6,"0")}`},P=r?{background:"#000000",surface:"#09090b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:i,accentHover:de(i,-15),success:"#10b981",error:"#ef4444",border:"#27272a",warning:"#f59e0b"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:i,accentHover:de(i,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7",warning:"#d97706"};if(y)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:P.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",textAlign:"center"},children:[n.jsx(ce,{size:40,color:P.accent,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}),n.jsx("p",{style:{color:P.textTertiary,margin:0},children:"Loading your profile..."})]})});if(!c)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:P.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",textAlign:"center"},children:[n.jsx(le,{size:40,color:P.error,"aria-hidden":"true"}),n.jsx("p",{style:{color:P.textTertiary,margin:0},children:"No profile found. Please log in again."})]})});const at=[{label:"Full Name",value:c.name,name:"name",type:"text",icon:je},{label:"Email Address",value:c.email,name:"email",type:"email",icon:he},{label:"Phone Number",value:c.phone||"Not set",name:"phone",type:"tel",icon:qn},{label:"Address",value:c.address||"Not provided",name:"address",type:"text",icon:Vn}];return n.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:P.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",lineHeight:1.5,minHeight:"80vh"},children:[Z&&n.jsxs("div",{style:{position:"fixed",top:"20px",right:"20px",padding:"12px 24px",borderRadius:"12px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",backdropFilter:"blur(8px)",border:"1px solid",zIndex:1e3,display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",fontWeight:500,maxWidth:"400px",animation:"slideIn 0.3s ease-out",...Z.type==="success"?{backgroundColor:r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",borderColor:r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)",color:r?"#34d399":"#059669"}:{backgroundColor:r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)",borderColor:r?"rgba(239, 68, 68, 0.3)":"rgba(239, 68, 68, 0.2)",color:r?"#f87171":"#dc2626"}},role:"alert","aria-live":"polite",children:[Z.type==="success"?n.jsx(xe,{size:20,"aria-hidden":"true"}):n.jsx(le,{size:20,"aria-hidden":"true"}),Z.message]}),n.jsx("div",{style:{maxWidth:"1200px",margin:"0 auto",width:"100%",boxSizing:"border-box"},children:n.jsxs("div",{style:{display:"grid",gap:"24px",gridTemplateColumns:"1fr",...window.innerWidth>=1024&&{gridTemplateColumns:"1fr 2fr",gap:"10px"},...window.innerWidth>=768&&window.innerWidth<1024&&{gap:"10px"},...window.innerWidth>=600&&window.innerWidth<768&&{gap:"28px"}},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",height:"100%"},children:[n.jsxs("section",{style:{backgroundColor:P.surface,borderRadius:"16px",position:"relative",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",textAlign:"center",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",flex:1,minHeight:"300px"},children:[s&&n.jsx("a",{href:s||"/",target:"_self",rel:"noopener noreferrer",style:{position:"absolute",top:"18px",left:"18px"},children:n.jsx(Wn,{size:20,style:{color:r?"#ffffff":"#000000"}})}),n.jsxs("div",{style:{position:"relative",display:"inline-block",marginBottom:"16px"},children:[n.jsx("img",{src:c.avatarUrl||`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(c.name)}`,alt:`Profile avatar of ${c.name}`,style:{width:"128px",height:"128px",borderRadius:"50%",objectFit:"cover",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.3)",border:`3px solid ${P.border}`},width:128,height:128,loading:"eager"}),n.jsx("button",{onClick:()=>D(!0),style:{position:"absolute",bottom:"8px",right:"8px",backgroundColor:P.accent,color:"white",padding:"8px",borderRadius:"50%",border:"none",cursor:"pointer",transition:"all 0.2s ease",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px"},"aria-label":"Change profile picture",children:n.jsx(tt,{size:16,"aria-hidden":"true"})})]}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:600,margin:"0 0 4px 0",color:P.textPrimary},children:c.name}),n.jsx("p",{style:{color:P.textTertiary,margin:"0 0 8px 0"},children:c.email}),n.jsxs("div",{style:{backgroundColor:c.isVerified?r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)":r?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:c.isVerified?P.success:P.warning,border:`1px solid ${c.isVerified?r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)":r?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`,padding:"6px 12px",borderRadius:"20px",fontSize:"12px",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"6px",marginTop:"8px"},children:[c.isVerified?n.jsx(xe,{size:16,"aria-hidden":"true"}):n.jsx(le,{size:16,"aria-hidden":"true"}),c.isVerified?"Email Verified":"Not Verified"]})]}),n.jsx("nav",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:k?n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>d(!1),style:{backgroundColor:P.surfaceLight,border:`1px solid ${P.border}`,color:P.textPrimary,padding:"10px 20px",borderRadius:"6px",borderStyle:"solid",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[n.jsx(Pe,{size:16,"aria-hidden":"true"}),"Cancel"]}),n.jsxs("button",{onClick:G,disabled:b,style:{background:`linear-gradient(to right, ${P.accent}, ${P.accentHover})`,opacity:b?.7:1,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:b?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[b?n.jsx(ce,{size:16,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(Kn,{size:16,"aria-hidden":"true"}),b?"Saving...":"Save Changes"]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>d(!0),style:{background:`linear-gradient(to right, ${P.accent}, ${P.accentHover})`,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[n.jsx(Yn,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("button",{style:{backgroundColor:P.surfaceLight,color:P.textPrimary,padding:"10px 20px",borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",width:"100%",boxSizing:"border-box"},onClick:()=>K(!F),children:[n.jsx(Bn,{size:16,"aria-hidden":"true"}),"More Actions"]}),F&&n.jsxs("div",{className:`dropdown-container ${L?"closing":""}`,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:P.surface,border:`1px solid ${P.border}`,borderRadius:"12px 12px 0 0",boxShadow:"0 -8px 24px rgba(0, 0, 0, 0.25)",zIndex:200,marginBottom:"6px",overflow:"hidden",animation:`${L?"drawerSlideDown":"drawerSlideUp"} 0.25s ease-out forwards`},children:[n.jsxs("button",{onClick:()=>{E(!0),x()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:P.textPrimary,cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>v.currentTarget.style.backgroundColor=P.surfaceLight,onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[n.jsx(tr,{size:14,"aria-hidden":"true"}),"Change Password"]}),!c.isVerified&&n.jsxs("button",{onClick:()=>{w(!0),x()},disabled:J,style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:J?P.textTertiary:P.warning,cursor:J?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left",opacity:J?.6:1},onMouseEnter:v=>{J||(v.currentTarget.style.backgroundColor=P.surfaceLight)},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[J?n.jsx(ce,{size:14,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(rr,{size:14,"aria-hidden":"true"}),J?"Sending...":"Verify Email"]}),o&&n.jsxs("button",{onClick:()=>{o(),x()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:r?"#fca5a5":"#dc2626",cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[n.jsx(ot,{size:14,"aria-hidden":"true"}),"Logout"]}),n.jsxs("button",{onClick:()=>{m(!0),x()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:"#ef4444",cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:600,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[n.jsx(We,{size:14,"aria-hidden":"true"}),"Delete Account"]})]})]})]})})]}),n.jsxs("div",{style:{minWidth:0,display:"flex",flexDirection:"column",gap:"12px"},children:[n.jsxs("section",{style:{backgroundColor:P.surface,borderRadius:"16px",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[n.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:P.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(je,{size:20,"aria-hidden":"true"}),"Personal Information"]}),n.jsx("div",{style:{display:"grid",gap:"20px",gridTemplateColumns:"1fr",...window.innerWidth>=600&&{gridTemplateColumns:"1fr 1fr",gap:"20px"}},children:at.map(v=>{const V=v.icon;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[n.jsxs("label",{style:{color:P.textTertiary,fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(V,{size:16,"aria-hidden":"true"}),v.label]}),k?n.jsx("input",{type:v.type,name:v.name,value:c[v.name],onChange:Q=>u(me=>me&&{...me,[Q.target.name]:Q.target.value}),style:{padding:"12px",borderRadius:"8px",border:`1px solid ${i}`,backgroundColor:"transparent",color:P.textPrimary,fontSize:"12px",outline:"none",transition:"border-color 0.2s ease",minHeight:"44px",width:"100%",boxSizing:"border-box"},placeholder:`Enter ${v.label.toLowerCase()}`,"aria-label":v.label}):n.jsx("div",{style:{padding:"12px",borderRadius:"8px",border:"1px solid transparent",fontSize:"12px",minHeight:"44px",display:"flex",alignItems:"center",boxSizing:"border-box",color:P.textPrimary,backgroundColor:r?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:v.value})]},v.name)})})]}),n.jsxs("section",{style:{backgroundColor:P.surface,borderRadius:"16px",padding:"30px 24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[n.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:P.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(nr,{size:20,"aria-hidden":"true"}),"Security Status"]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",color:P.textSecondary},children:[n.jsx(he,{size:16,"aria-hidden":"true"}),n.jsx("span",{children:"Email Verification"})]}),n.jsx("div",{style:{padding:"6px 12px",borderRadius:"8px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px",...c.isVerified?{backgroundColor:r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",color:P.success,border:`1px solid ${r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)"}`}:{backgroundColor:r?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:P.warning,border:`1px solid ${r?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`}},children:c.isVerified?n.jsxs(n.Fragment,{children:[n.jsx(xe,{size:16,"aria-hidden":"true"}),"Verified"]}):n.jsxs(n.Fragment,{children:[n.jsx(le,{size:16,"aria-hidden":"true"}),"Not Verified"]})})]}),!c.isVerified&&n.jsx("div",{style:{padding:"12px",borderRadius:"8px",backgroundColor:r?"rgba(100, 100, 100, 0.1)":"rgba(0, 0, 0, 0.05)"},children:n.jsx("p",{style:{color:P.textTertiary,fontSize:"12px",margin:0},children:"Verify your email to unlock all features and enhance your account security."})})]})]})]})]})}),n.jsx(as,{isOpen:M,onClose:()=>{D(!1)},onUpdate:se,colors:P}),n.jsx(is,{baseUrl:a,apiKey:l,appId:h,userId:c.id,isOpen:_,onClose:()=>E(!1),onSuccess:v=>O("success",v),onError:v=>O("error",v),colors:P}),n.jsx(os,{baseUrl:a,apiKey:l,appId:h,userId:c.id,token:e,isOpen:B,onClose:()=>m(!1),onSuccess:v=>O("success",v),onError:v=>O("error",v),colors:P}),n.jsx(ls,{isOpen:N,onClose:()=>{w(!1),f(!1),I({email:c?.email||"",otp:"",appId:h})},onVerify:X,onSendOTP:j,verifyFormData:A,setVerifyFormData:I,otpSent:q,verifying:T,user:c,colors:P,darkMode:r}),n.jsx("style",{children:`
|
|
495
495
|
@keyframes slideIn {
|
|
496
496
|
from {
|
|
497
497
|
transform: translateX(100%);
|
|
@@ -579,4 +579,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
579
579
|
transition-duration: 0.01ms !important;
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
`})]})},ds=({darkMode:e=!0,primaryColor:t="#3b82f6",onLogout:r,varient:s="classic",propUser:o,className:i="",profileUrl:a,settingsUrl:l,showProfileMenuItem:h=!0,showSettingsMenuItem:c=!0,showViewProfileMenuItem:u=!0,profileLabel:y="My Profile",settingsLabel:R="Settings",viewProfileLabel:k="View Profile",logoutLabel:d="Sign Out"})=>{const{baseUrl:b,apiKey:g,appId:M}=ge(),[D,_]=S.useState(!1),[T,B]=S.useState(null),[m,N]=S.useState(!0),[w,F]=S.useState(null),K=S.useRef(null),L=S.useRef(null),[Y,Z]=S.useState(!1),[E,J]=S.useState(!1);S.useEffect(()=>{const x=()=>{J(window.innerWidth<768)};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const H=async x=>{try{if(!x)throw new Error("Invalid user ID");const{data:j}=await W.get(`${b}/users/check-user/${x}?appId=${M}`,{headers:{"x-api-key":g},timeout:1e4});(!j.success||!j.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),B(null),F("Session expired"))}catch(j){console.error("User validation failed:",j);const X=j.response?.status===404?"User not found":j.code==="NETWORK_ERROR"?"Network error":"Validation failed";F(X),j.response?.status===404&&(localStorage.removeItem("userInfo"),B(null))}};S.useEffect(()=>{(async()=>{try{if(N(!0),F(null),o){if(!o.id||!o.name||!o.email)throw new Error("Invalid user data provided");B(o),await H(o.id)}else{const j=localStorage.getItem("userInfo");if(j)try{const X=JSON.parse(j);if(!X.id||!X.name||!X.email)throw new Error("Invalid stored user data");B(X),await H(X.id)}catch(X){console.error("Failed to parse stored user data:",X),localStorage.removeItem("userInfo"),F("Invalid user data")}}}catch(j){console.error("User initialization failed:",j),F(j.message||"Failed to load user")}finally{N(!1)}})()},[o]),S.useEffect(()=>{const x=()=>{if(D&&L.current){const j=L.current.getBoundingClientRect(),X=window.innerWidth,se=window.innerHeight,G=280,oe=300,de=X-j.right,P=j.left,at=se-j.bottom,v=de>=G||de>P;Z(v),at<oe&&j.top>oe}};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[D]),S.useEffect(()=>{const x=se=>{K.current&&!K.current.contains(se.target)&&!L.current?.contains(se.target)&&_(!1)},j=se=>{se.key==="Escape"&&_(!1)},X=()=>{D&&_(!1)};return D&&(document.addEventListener("mousedown",x),document.addEventListener("keydown",j),window.addEventListener("scroll",X,{passive:!0})),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",j),window.removeEventListener("scroll",X)}},[D]);const A=e?{surface:"#000000",surfaceElevated:"#000000",surfaceHover:"#262626",border:"#262626",borderLight:"#404040",textPrimary:"#ffffff",textSecondary:"#a3a3a3",textTertiary:"#737373",accent:t,accentHover:`${t}e6`,error:"#ef4444"}:{surface:"#ffffff",surfaceElevated:"#fafafa",surfaceHover:"#f5f5f5",border:"#e5e5e5",borderLight:"#f0f0f0",textPrimary:"#171717",textSecondary:"#525252",textTertiary:"#a3a3a3",accent:t,accentHover:`${t}e6`,error:"#ef4444"},I={wrapper:{position:"relative",display:"inline-block"},avatarButton:{display:"flex",alignItems:"center",gap:E?"6px":"8px",padding:E?"6px 10px 6px 6px":"8px 12px 8px 8px",borderRadius:"24px",backgroundColor:A.surface,cursor:"pointer",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",minWidth:E?"auto":"140px",maxWidth:E?"200px":"none",outline:"none"},avatarImage:{width:E?"28px":"32px",height:E?"28px":"32px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${A.borderLight}`,flexShrink:0},userInfo:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,minWidth:0,overflow:"hidden"},userName:{fontSize:E?"13px":"14px",fontWeight:600,color:A.textPrimary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:E?"80px":"120px"},userEmail:{fontSize:E?"11px":"12px",color:A.textTertiary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:E?"80px":"120px"},chevron:{transition:"transform 0.2s ease",transform:D?"rotate(180deg)":"rotate(0deg)",color:A.textTertiary,flexShrink:0},dropdown:{position:"absolute",top:"100%",marginTop:"8px",[Y?"left":"right"]:"0",backgroundColor:A.surfaceElevated,border:`1px solid ${A.border}`,borderRadius:"12px",boxShadow:"0 20px 40px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.1)",width:"min(280px, 90vw)",maxWidth:"calc(100vw - 20px)",padding:"6px 6px 16px 6px",zIndex:1e3,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",opacity:D?1:0,pointerEvents:D?"auto":"none",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",transform:D?"translateY(0) scale(1)":"translateY(-8px) scale(0.95)",overflow:"hidden"},dropdownSection:{padding:E?"10px 12px":"0px 16px","&:last-child":{borderBottom:"none"}},userSection:{display:"flex",alignItems:"center",gap:E?"10px":"12px",padding:E?"14px":"16px"},dropdownAvatar:{width:E?"40px":"48px",height:E?"40px":"48px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${A.borderLight}`,flexShrink:0},dropdownUserInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0},dropdownUserName:{fontSize:E?"15px":"16px",fontWeight:600,color:A.textPrimary,lineHeight:"1.2",marginBottom:"2px",overflow:"hidden",textOverflow:"ellipsis"},dropdownUserEmail:{fontSize:E?"13px":"14px",color:A.textSecondary,lineHeight:"1.2",overflow:"hidden",textOverflow:"ellipsis"},menuItem:{display:"flex",alignItems:"center",gap:E?"10px":"12px",padding:E?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",color:A.textPrimary,textDecoration:"none",border:"none",background:"none",width:"100%",fontSize:E?"13px":"14px",textAlign:"left",outline:"none"},menuItemText:{flex:1},icon:{width:E?"16px":"18px",height:E?"16px":"18px",color:A.textSecondary,flexShrink:0},logoutButton:{display:"flex",alignItems:"center",gap:E?"10px":"12px",padding:E?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",background:"none",border:"none",width:"100%",fontSize:E?"13px":"14px",color:A.error,textAlign:"left",outline:"none"},loadingText:{padding:E?"16px 12px":"20px 16px",textAlign:"center",color:A.textSecondary,fontSize:E?"13px":"14px"},errorState:{padding:E?"16px 12px":"20px 16px",textAlign:"center",color:A.textSecondary,fontSize:E?"13px":"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexDirection:"column"},retryButton:{marginTop:"8px",padding:"8px 16px",backgroundColor:A.accent,color:"#ffffff",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.2s ease"}},q=()=>{F(null),N(!0);const x=localStorage.getItem("userInfo");if(x)try{const j=JSON.parse(x);B(j),H(j.id)}catch{F("Invalid user data")}N(!1)},f=(x,j)=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),j())},C=()=>a||T?.profileUrl,z=()=>{const x=C();x&&window.open(x,"_self","noopener,noreferrer")},O=()=>{l&&window.open(l,"_self","noopener,noreferrer")};return n.jsxs("div",{style:I.wrapper,ref:K,className:i,role:"menu","aria-label":"User menu",children:[s==="classic"?n.jsx("div",{ref:L,onClick:()=>_(x=>!x),onKeyDown:x=>f(x,()=>_(j=>!j)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":D,"aria-label":"Toggle user menu",children:T?.avatarUrl?n.jsx("img",{src:T.avatarUrl,alt:`${T.name}'s avatar`,style:{width:E?"34px":"40px",height:E?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${A.borderLight}`,flexShrink:0},loading:"lazy",onError:x=>{const j=x.target;j.src="https://api.dicebear.com/9.x/glass/svg?seed=Kingston"}}):n.jsx("img",{src:"https://api.dicebear.com/9.x/glass/svg?seed=Kingston",alt:"Default user avatar",style:{width:E?"34px":"40px",height:E?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${A.borderLight}`,flexShrink:0},loading:"lazy"})}):n.jsxs("div",{ref:L,style:I.avatarButton,onClick:()=>_(x=>!x),onKeyDown:x=>f(x,()=>_(j=>!j)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":D,"aria-label":"Toggle user menu",onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover,x.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"},onMouseOut:x=>{x.currentTarget.style.backgroundColor=A.surface,x.currentTarget.style.boxShadow="none"},onBlur:x=>{x.currentTarget.style.outline="none"},children:[T?.avatarUrl?n.jsx("img",{src:T.avatarUrl,alt:`${T.name}'s avatar`,style:I.avatarImage,loading:"lazy",onError:x=>{const j=x.target;j.src="https://api.dicebear.com/9.x/glass/svg?seed=Kingston"}}):n.jsx("img",{src:"https://api.dicebear.com/9.x/glass/svg?seed=Kingston",alt:"Default user avatar",style:I.avatarImage,loading:"lazy"}),!E&&n.jsxs("div",{style:I.userInfo,children:[n.jsx("div",{style:I.userName,title:T?.name,children:T?.name||"Guest"}),T?.email&&n.jsx("div",{style:I.userEmail,title:T.email,children:T.email})]}),n.jsx(Ln,{size:E?14:16,style:I.chevron,"aria-hidden":"true"})]}),D&&n.jsx("div",{style:I.dropdown,role:"menu","aria-label":"User options",children:m?n.jsx("div",{style:I.loadingText,role:"status","aria-live":"polite",children:"Loading user information..."}):T?n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:I.userSection,children:[T?.avatarUrl?n.jsx("img",{src:T.avatarUrl,alt:`${T.name}'s profile picture`,style:I.dropdownAvatar,loading:"lazy",onError:x=>{const j=x.target;j.src=`https://api.dicebear.com/9.x/initials/svg?seed=${T.name}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${T.name}`,alt:`${T.name}'s default avatar`,style:I.dropdownAvatar,loading:"lazy"}),n.jsxs("div",{style:I.dropdownUserInfo,children:[n.jsx("div",{style:I.dropdownUserName,title:T.name,children:T.name}),n.jsx("div",{style:I.dropdownUserEmail,title:T.email,children:T.email})]})]}),n.jsxs("div",{style:I.dropdownSection,children:[h&&C()&&n.jsxs("button",{style:I.menuItem,onClick:z,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>f(x,z),role:"menuitem",tabIndex:0,children:[n.jsx(je,{style:I.icon,"aria-hidden":"true"}),n.jsx("span",{style:I.menuItemText,children:y})]}),c&&l&&n.jsxs("button",{style:I.menuItem,onClick:O,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>f(x,O),role:"menuitem",tabIndex:0,children:[n.jsx(Jn,{style:I.icon,"aria-hidden":"true"}),n.jsx("span",{style:I.menuItemText,children:R})]}),u&&T.profileUrl&&n.jsxs("a",{href:T.profileUrl,target:"_self",rel:"noopener noreferrer",style:I.menuItem,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},role:"menuitem",tabIndex:0,children:[n.jsx(he,{style:I.icon,"aria-hidden":"true"}),n.jsx("span",{style:I.menuItemText,children:k})]})]}),n.jsx("div",{style:I.dropdownSection,children:n.jsxs("button",{style:I.logoutButton,onClick:r,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>f(x,r),role:"menuitem",tabIndex:0,children:[n.jsx(ot,{style:{...I.icon,color:A.error},"aria-hidden":"true"}),n.jsx("span",{style:I.menuItemText,children:d})]})})]}):n.jsxs("div",{style:I.errorState,role:"alert",children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(le,{size:16,"aria-hidden":"true"}),n.jsx("span",{children:w||"Not signed in"})]}),w&&w!=="Not signed in"&&n.jsx("button",{style:I.retryButton,onClick:q,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.accentHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor=A.accent},children:"Try Again"})]})})]})};te.NeuctraAuthix=In,te.ReactSignedIn=rs,te.ReactSignedOut=ss,te.ReactUserButton=ds,te.ReactUserLogin=es,te.ReactUserProfile=cs,te.ReactUserSignUp=Zn,te.getSdkConfig=ge,te.setSdkConfig=Gn,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));
|
|
582
|
+
`})]})},ds=({darkMode:e=!0,primaryColor:t="#3b82f6",onLogout:r,varient:s="classic",propUser:o,className:i="",profileUrl:a,settingsUrl:l,showProfileMenuItem:h=!0,showSettingsMenuItem:c=!0,showViewProfileMenuItem:u=!0,profileLabel:y="My Profile",settingsLabel:R="Settings",viewProfileLabel:k="View Profile",logoutLabel:d="Sign Out"})=>{const{baseUrl:b,apiKey:g,appId:M}=ge(),[D,_]=S.useState(!1),[E,B]=S.useState(null),[m,N]=S.useState(!0),[w,F]=S.useState(null),K=S.useRef(null),L=S.useRef(null),[Y,Z]=S.useState(!1),[C,J]=S.useState(!1);S.useEffect(()=>{const x=()=>{J(window.innerWidth<768)};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const H=async x=>{try{if(!x)throw new Error("Invalid user ID");const{data:j}=await W.get(`${b}/users/check-user/${x}?appId=${M}`,{headers:{"x-api-key":g},timeout:1e4});(!j.success||!j.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),B(null),F("Session expired"))}catch(j){console.error("User validation failed:",j);const X=j.response?.status===404?"User not found":j.code==="NETWORK_ERROR"?"Network error":"Validation failed";F(X),j.response?.status===404&&(localStorage.removeItem("userInfo"),B(null))}};S.useEffect(()=>{(async()=>{try{if(N(!0),F(null),o){if(!o.id||!o.name||!o.email)throw new Error("Invalid user data provided");B(o),await H(o.id)}else{const j=localStorage.getItem("userInfo");if(j)try{const X=JSON.parse(j);if(!X.id||!X.name||!X.email)throw new Error("Invalid stored user data");B(X),await H(X.id)}catch(X){console.error("Failed to parse stored user data:",X),localStorage.removeItem("userInfo"),F("Invalid user data")}}}catch(j){console.error("User initialization failed:",j),F(j.message||"Failed to load user")}finally{N(!1)}})()},[o]),S.useEffect(()=>{const x=()=>{if(D&&L.current){const j=L.current.getBoundingClientRect(),X=window.innerWidth,se=window.innerHeight,G=280,oe=300,de=X-j.right,P=j.left,at=se-j.bottom,v=de>=G||de>P;Z(v),at<oe&&j.top>oe}};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[D]),S.useEffect(()=>{const x=se=>{K.current&&!K.current.contains(se.target)&&!L.current?.contains(se.target)&&_(!1)},j=se=>{se.key==="Escape"&&_(!1)},X=()=>{D&&_(!1)};return D&&(document.addEventListener("mousedown",x),document.addEventListener("keydown",j),window.addEventListener("scroll",X,{passive:!0})),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",j),window.removeEventListener("scroll",X)}},[D]);const A=e?{surface:"#000000",surfaceElevated:"#000000",surfaceHover:"#262626",border:"#262626",borderLight:"#404040",textPrimary:"#ffffff",textSecondary:"#a3a3a3",textTertiary:"#737373",accent:t,accentHover:`${t}e6`,error:"#ef4444"}:{surface:"#ffffff",surfaceElevated:"#fafafa",surfaceHover:"#f5f5f5",border:"#e5e5e5",borderLight:"#f0f0f0",textPrimary:"#171717",textSecondary:"#525252",textTertiary:"#a3a3a3",accent:t,accentHover:`${t}e6`,error:"#ef4444"},I={wrapper:{position:"relative",display:"inline-block"},avatarButton:{display:"flex",alignItems:"center",gap:C?"6px":"8px",padding:C?"6px 10px 6px 6px":"8px 12px 8px 8px",borderRadius:"24px",backgroundColor:A.surface,cursor:"pointer",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",minWidth:C?"auto":"140px",maxWidth:C?"200px":"none",outline:"none"},avatarImage:{width:C?"28px":"32px",height:C?"28px":"32px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${A.borderLight}`,flexShrink:0},userInfo:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,minWidth:0,overflow:"hidden"},userName:{fontSize:C?"13px":"14px",fontWeight:600,color:A.textPrimary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:C?"80px":"120px"},userEmail:{fontSize:C?"11px":"12px",color:A.textTertiary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:C?"80px":"120px"},chevron:{transition:"transform 0.2s ease",transform:D?"rotate(180deg)":"rotate(0deg)",color:A.textTertiary,flexShrink:0},dropdown:{position:"absolute",top:"100%",marginTop:"8px",[Y?"left":"right"]:"0",backgroundColor:A.surfaceElevated,border:`1px solid ${A.border}`,borderRadius:"12px",boxShadow:"0 20px 40px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.1)",width:"min(280px, 90vw)",maxWidth:"calc(100vw - 20px)",padding:"6px 6px 16px 6px",zIndex:1e3,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",opacity:D?1:0,pointerEvents:D?"auto":"none",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",transform:D?"translateY(0) scale(1)":"translateY(-8px) scale(0.95)",overflow:"hidden"},dropdownSection:{padding:C?"10px 12px":"0px 16px","&:last-child":{borderBottom:"none"}},userSection:{display:"flex",alignItems:"center",gap:C?"10px":"12px",padding:C?"14px":"16px"},dropdownAvatar:{width:C?"40px":"48px",height:C?"40px":"48px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${A.borderLight}`,flexShrink:0},dropdownUserInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0},dropdownUserName:{fontSize:C?"15px":"16px",fontWeight:600,color:A.textPrimary,lineHeight:"1.2",marginBottom:"2px",overflow:"hidden",textOverflow:"ellipsis"},dropdownUserEmail:{fontSize:C?"13px":"14px",color:A.textSecondary,lineHeight:"1.2",overflow:"hidden",textOverflow:"ellipsis"},menuItem:{display:"flex",alignItems:"center",gap:C?"10px":"12px",padding:C?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",color:A.textPrimary,textDecoration:"none",border:"none",background:"none",width:"100%",fontSize:C?"13px":"14px",textAlign:"left",outline:"none"},menuItemText:{flex:1},icon:{width:C?"16px":"18px",height:C?"16px":"18px",color:A.textSecondary,flexShrink:0},logoutButton:{display:"flex",alignItems:"center",gap:C?"10px":"12px",padding:C?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",background:"none",border:"none",width:"100%",fontSize:C?"13px":"14px",color:A.error,textAlign:"left",outline:"none"},loadingText:{padding:C?"16px 12px":"20px 16px",textAlign:"center",color:A.textSecondary,fontSize:C?"13px":"14px"},errorState:{padding:C?"16px 12px":"20px 16px",textAlign:"center",color:A.textSecondary,fontSize:C?"13px":"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexDirection:"column"},retryButton:{marginTop:"8px",padding:"8px 16px",backgroundColor:A.accent,color:"#ffffff",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.2s ease"}},q=()=>{F(null),N(!0);const x=localStorage.getItem("userInfo");if(x)try{const j=JSON.parse(x);B(j),H(j.id)}catch{F("Invalid user data")}N(!1)},f=(x,j)=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),j())},T=()=>a||E?.profileUrl,z=()=>{const x=T();x&&window.open(x,"_self","noopener,noreferrer")},O=()=>{l&&window.open(l,"_self","noopener,noreferrer")};return n.jsxs("div",{style:I.wrapper,ref:K,className:i,role:"menu","aria-label":"User menu",children:[s==="classic"?n.jsx("div",{ref:L,onClick:()=>_(x=>!x),onKeyDown:x=>f(x,()=>_(j=>!j)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":D,"aria-label":"Toggle user menu",children:E?.avatarUrl?n.jsx("img",{src:E.avatarUrl,alt:`${E?.name||"User"}'s avatar`,style:{width:C?"34px":"40px",height:C?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${A.borderLight}`,flexShrink:0},loading:"lazy",onError:x=>{const j=x.target;j.onerror=null,j.src=`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(E?.name||"User")}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(E?.name||"User")}`,alt:"Default user avatar",style:{width:C?"34px":"40px",height:C?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${A.borderLight}`,flexShrink:0},loading:"lazy"})}):n.jsxs("div",{ref:L,style:I.avatarButton,onClick:()=>_(x=>!x),onKeyDown:x=>f(x,()=>_(j=>!j)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":D,"aria-label":"Toggle user menu",onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover,x.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"},onMouseOut:x=>{x.currentTarget.style.backgroundColor=A.surface,x.currentTarget.style.boxShadow="none"},onBlur:x=>{x.currentTarget.style.outline="none"},children:[E?.avatarUrl?n.jsx("img",{src:E.avatarUrl,alt:`${E.name}'s avatar`,style:I.avatarImage,loading:"lazy",onError:x=>{const j=x.target;j.src="https://api.dicebear.com/9.x/glass/svg?seed=Kingston"}}):n.jsx("img",{src:"https://api.dicebear.com/9.x/glass/svg?seed=Kingston",alt:"Default user avatar",style:I.avatarImage,loading:"lazy"}),!C&&n.jsxs("div",{style:I.userInfo,children:[n.jsx("div",{style:I.userName,title:E?.name,children:E?.name||"Guest"}),E?.email&&n.jsx("div",{style:I.userEmail,title:E.email,children:E.email})]}),n.jsx(Ln,{size:C?14:16,style:I.chevron,"aria-hidden":"true"})]}),D&&n.jsx("div",{style:I.dropdown,role:"menu","aria-label":"User options",children:m?n.jsx("div",{style:I.loadingText,role:"status","aria-live":"polite",children:"Loading user information..."}):E?n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:I.userSection,children:[E?.avatarUrl?n.jsx("img",{src:E.avatarUrl,alt:`${E.name}'s profile picture`,style:I.dropdownAvatar,loading:"lazy",onError:x=>{const j=x.target;j.src=`https://api.dicebear.com/9.x/initials/svg?seed=${E.name}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${E.name}`,alt:`${E.name}'s default avatar`,style:I.dropdownAvatar,loading:"lazy"}),n.jsxs("div",{style:I.dropdownUserInfo,children:[n.jsx("div",{style:I.dropdownUserName,title:E.name,children:E.name}),n.jsx("div",{style:I.dropdownUserEmail,title:E.email,children:E.email})]})]}),n.jsxs("div",{style:I.dropdownSection,children:[h&&T()&&n.jsxs("button",{style:I.menuItem,onClick:z,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>f(x,z),role:"menuitem",tabIndex:0,children:[n.jsx(je,{style:I.icon,"aria-hidden":"true"}),n.jsx("span",{style:I.menuItemText,children:y})]}),c&&l&&n.jsxs("button",{style:I.menuItem,onClick:O,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>f(x,O),role:"menuitem",tabIndex:0,children:[n.jsx(Jn,{style:I.icon,"aria-hidden":"true"}),n.jsx("span",{style:I.menuItemText,children:R})]}),u&&E.profileUrl&&n.jsxs("a",{href:E.profileUrl,target:"_self",rel:"noopener noreferrer",style:I.menuItem,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},role:"menuitem",tabIndex:0,children:[n.jsx(he,{style:I.icon,"aria-hidden":"true"}),n.jsx("span",{style:I.menuItemText,children:k})]})]}),n.jsx("div",{style:I.dropdownSection,children:n.jsxs("button",{style:I.logoutButton,onClick:r,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>f(x,r),role:"menuitem",tabIndex:0,children:[n.jsx(ot,{style:{...I.icon,color:A.error},"aria-hidden":"true"}),n.jsx("span",{style:I.menuItemText,children:d})]})})]}):n.jsxs("div",{style:I.errorState,role:"alert",children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(le,{size:16,"aria-hidden":"true"}),n.jsx("span",{children:w||"Not signed in"})]}),w&&w!=="Not signed in"&&n.jsx("button",{style:I.retryButton,onClick:q,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.accentHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor=A.accent},children:"Try Again"})]})})]})};te.NeuctraAuthix=In,te.ReactSignedIn=rs,te.ReactSignedOut=ss,te.ReactUserButton=ds,te.ReactUserLogin=es,te.ReactUserProfile=cs,te.ReactUserSignUp=Zn,te.getSdkConfig=ge,te.setSdkConfig=Gn,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));
|