@neuctra/authix 1.1.2 → 1.1.4

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.
@@ -1,9 +1,9 @@
1
- (function(te,j){typeof exports=="object"&&typeof module<"u"?j(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],j):(te=typeof globalThis<"u"?globalThis:te||self,j(te.NeuctraAuthix={},te.React))})(this,(function(te,j){"use strict";function dt(e,t){return function(){return e.apply(t,arguments)}}const{toString:ir}=Object.prototype,{getPrototypeOf:Ve}=Object,{iterator:_e,toStringTag:ut}=Symbol,Ae=(e=>t=>{const r=ir.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),oe=e=>(e=e.toLowerCase(),t=>Ae(t)===e),ze=e=>t=>typeof t===e,{isArray:ye}=Array,be=ze("undefined");function ke(e){return e!==null&&!be(e)&&e.constructor!==null&&!be(e.constructor)&&re(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const pt=oe("ArrayBuffer");function lr(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&pt(e.buffer),t}const cr=ze("string"),re=ze("function"),ft=ze("number"),Ee=e=>e!==null&&typeof e=="object",dr=e=>e===!0||e===!1,Ne=e=>{if(Ae(e)!=="object")return!1;const t=Ve(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(ut in e)&&!(_e in e)},ur=e=>{if(!Ee(e)||ke(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},pr=oe("Date"),fr=oe("File"),xr=oe("Blob"),hr=oe("FileList"),gr=e=>Ee(e)&&re(e.pipe),mr=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||re(e.append)&&((t=Ae(e))==="formdata"||t==="object"&&re(e.toString)&&e.toString()==="[object FormData]"))},yr=oe("URLSearchParams"),[br,wr,Sr,jr]=["ReadableStream","Request","Response","Headers"].map(oe),vr=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ce(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(ke(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 xt(e,t){if(ke(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,ht=e=>!be(e)&&e!==ue;function Ye(){const{caseless:e,skipUndefined:t}=ht(this)&&this||{},r={},s=(o,i)=>{const a=e&&xt(r,i)||i;Ne(r[a])&&Ne(o)?r[a]=Ye(r[a],o):Ne(o)?r[a]=Ye({},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]&&Ce(arguments[o],s);return r}const kr=(e,t,r,{allOwnKeys:s}={})=>(Ce(t,(o,i)=>{r&&re(o)?e[i]=dt(o,r):e[i]=o},{allOwnKeys:s}),e),Er=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Cr=(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)},Tr=(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&&Ve(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Rr=(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},Ir=e=>{if(!e)return null;if(ye(e))return e;let t=e.length;if(!ft(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Pr=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Ve(Uint8Array)),Or=(e,t)=>{const s=(e&&e[_e]).call(e);let o;for(;(o=s.next())&&!o.done;){const i=o.value;t.call(e,i[0],i[1])}},_r=(e,t)=>{let r;const s=[];for(;(r=e.exec(t))!==null;)s.push(r);return s},Ar=oe("HTMLFormElement"),zr=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,s,o){return s.toUpperCase()+o}),gt=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Nr=oe("RegExp"),mt=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),s={};Ce(r,(o,i)=>{let a;(a=t(o,i,e))!==!1&&(s[i]=a||o)}),Object.defineProperties(e,s)},Ur=e=>{mt(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+"'")})}})},Dr=(e,t)=>{const r={},s=o=>{o.forEach(i=>{r[i]=!0})};return ye(e)?s(e):s(String(e).split(t)),r},Fr=()=>{},Lr=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Mr(e){return!!(e&&re(e.append)&&e[ut]==="FormData"&&e[_e])}const Br=e=>{const t=new Array(10),r=(s,o)=>{if(Ee(s)){if(t.indexOf(s)>=0)return;if(ke(s))return s;if(!("toJSON"in s)){t[o]=s;const i=ye(s)?[]:{};return Ce(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)},Wr=oe("AsyncFunction"),$r=e=>e&&(Ee(e)||re(e))&&re(e.then)&&re(e.catch),yt=((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)),Hr=typeof queueMicrotask<"u"?queueMicrotask.bind(ue):typeof process<"u"&&process.nextTick||yt,u={isArray:ye,isArrayBuffer:pt,isBuffer:ke,isFormData:mr,isArrayBufferView:lr,isString:cr,isNumber:ft,isBoolean:dr,isObject:Ee,isPlainObject:Ne,isEmptyObject:ur,isReadableStream:br,isRequest:wr,isResponse:Sr,isHeaders:jr,isUndefined:be,isDate:pr,isFile:fr,isBlob:xr,isRegExp:Nr,isFunction:re,isStream:gr,isURLSearchParams:yr,isTypedArray:Pr,isFileList:hr,forEach:Ce,merge:Ye,extend:kr,trim:vr,stripBOM:Er,inherits:Cr,toFlatObject:Tr,kindOf:Ae,kindOfTest:oe,endsWith:Rr,toArray:Ir,forEachEntry:Or,matchAll:_r,isHTMLForm:Ar,hasOwnProperty:gt,hasOwnProp:gt,reduceDescriptors:mt,freezeMethods:Ur,toObjectSet:Dr,toCamelCase:zr,noop:Fr,toFiniteNumber:Lr,findKey:xt,global:ue,isContextDefined:ht,isSpecCompliantForm:Mr,toJSONObject:Br,isAsyncFn:Wr,isThenable:$r,setImmediate:yt,asap:Hr,isIterable:e=>e!=null&&re(e[_e])};function A(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)}u.inherits(A,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:u.toJSONObject(this.config),code:this.code,status:this.status}}});const bt=A.prototype,wt={};["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=>{wt[e]={value:e}}),Object.defineProperties(A,wt),Object.defineProperty(bt,"isAxiosError",{value:!0}),A.from=(e,t,r,s,o,i)=>{const a=Object.create(bt);u.toFlatObject(e,a,function(c){return c!==Error.prototype},p=>p!=="isAxiosError");const l=e&&e.message?e.message:"Error",h=t==null&&e?e.code:t;return A.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 Vr=null;function qe(e){return u.isPlainObject(e)||u.isArray(e)}function St(e){return u.endsWith(e,"[]")?e.slice(0,-2):e}function jt(e,t,r){return e?e.concat(t).map(function(o,i){return o=St(o),!r&&i?"["+o+"]":o}).join(r?".":""):t}function Yr(e){return u.isArray(e)&&!e.some(qe)}const qr=u.toFlatObject(u,{},null,function(t){return/^is[A-Z]/.test(t)});function Ue(e,t,r){if(!u.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=u.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,g){return!u.isUndefined(g[b])});const s=r.metaTokens,o=r.visitor||c,i=r.dots,a=r.indexes,h=(r.Blob||typeof Blob<"u"&&Blob)&&u.isSpecCompliantForm(t);if(!u.isFunction(o))throw new TypeError("visitor must be a function");function p(d){if(d===null)return"";if(u.isDate(d))return d.toISOString();if(u.isBoolean(d))return d.toString();if(!h&&u.isBlob(d))throw new A("Blob is not supported. Use a Buffer instead.");return u.isArrayBuffer(d)||u.isTypedArray(d)?h&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function c(d,b,g){let U=d;if(d&&!g&&typeof d=="object"){if(u.endsWith(b,"{}"))b=s?b:b.slice(0,-2),d=JSON.stringify(d);else if(u.isArray(d)&&Yr(d)||(u.isFileList(d)||u.endsWith(b,"[]"))&&(U=u.toArray(d)))return b=St(b),U.forEach(function(P,C){!(u.isUndefined(P)||P===null)&&t.append(a===!0?jt([b],C,i):a===null?b:b+"[]",p(P))}),!1}return qe(d)?!0:(t.append(jt(g,b,i),p(d)),!1)}const m=[],I=Object.assign(qr,{defaultVisitor:c,convertValue:p,isVisitable:qe});function v(d,b){if(!u.isUndefined(d)){if(m.indexOf(d)!==-1)throw Error("Circular reference detected in "+b.join("."));m.push(d),u.forEach(d,function(U,z){(!(u.isUndefined(U)||U===null)&&o.call(t,U,u.isString(z)?z.trim():z,b,I))===!0&&v(U,b?b.concat(z):[z])}),m.pop()}}if(!u.isObject(e))throw new TypeError("data must be an object");return v(e),t}function vt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function Ke(e,t){this._pairs=[],e&&Ue(e,this,t)}const kt=Ke.prototype;kt.append=function(t,r){this._pairs.push([t,r])},kt.toString=function(t){const r=t?function(s){return t.call(this,s,vt)}:vt;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};function Kr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Et(e,t,r){if(!t)return e;const s=r&&r.encode||Kr;u.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let i;if(o?i=o(t,r):i=u.isURLSearchParams(t)?t.toString():new Ke(t,r).toString(s),i){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Ct{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){u.forEach(this.handlers,function(s){s!==null&&t(s)})}}const Tt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Jr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ke,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Je=typeof window<"u"&&typeof document<"u",Xe=typeof navigator=="object"&&navigator||void 0,Xr=Je&&(!Xe||["ReactNative","NativeScript","NS"].indexOf(Xe.product)<0),Gr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Zr=Je&&window.location.href||"http://localhost",ee={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Je,hasStandardBrowserEnv:Xr,hasStandardBrowserWebWorkerEnv:Gr,navigator:Xe,origin:Zr},Symbol.toStringTag,{value:"Module"})),...Jr};function Qr(e,t){return Ue(e,new ee.classes.URLSearchParams,{visitor:function(r,s,o,i){return ee.isNode&&u.isBuffer(r)?(this.append(s,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function en(e){return u.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function tn(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 Rt(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&&u.isArray(o)?o.length:a,h?(u.hasOwnProp(o,a)?o[a]=[o[a],s]:o[a]=s,!l):((!o[a]||!u.isObject(o[a]))&&(o[a]=[]),t(r,s,o[a],i)&&u.isArray(o[a])&&(o[a]=tn(o[a])),!l)}if(u.isFormData(e)&&u.isFunction(e.entries)){const r={};return u.forEachEntry(e,(s,o)=>{t(en(s),o,r,0)}),r}return null}function rn(e,t,r){if(u.isString(e))try{return(t||JSON.parse)(e),u.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(r||JSON.stringify)(e)}const Te={transitional:Tt,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const s=r.getContentType()||"",o=s.indexOf("application/json")>-1,i=u.isObject(t);if(i&&u.isHTMLForm(t)&&(t=new FormData(t)),u.isFormData(t))return o?JSON.stringify(Rt(t)):t;if(u.isArrayBuffer(t)||u.isBuffer(t)||u.isStream(t)||u.isFile(t)||u.isBlob(t)||u.isReadableStream(t))return t;if(u.isArrayBufferView(t))return t.buffer;if(u.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 Qr(t,this.formSerializer).toString();if((l=u.isFileList(t))||s.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return Ue(l?{"files[]":t}:t,h&&new h,this.formSerializer)}}return i||o?(r.setContentType("application/json",!1),rn(t)):t}],transformResponse:[function(t){const r=this.transitional||Te.transitional,s=r&&r.forcedJSONParsing,o=this.responseType==="json";if(u.isResponse(t)||u.isReadableStream(t))return t;if(t&&u.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"?A.from(l,A.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}}};u.forEach(["delete","get","head","post","put","patch"],e=>{Te.headers[e]={}});const nn=u.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"]),sn=e=>{const t={};let r,s,o;return e&&e.split(`
2
- `).forEach(function(a){o=a.indexOf(":"),r=a.substring(0,o).trim().toLowerCase(),s=a.substring(o+1).trim(),!(!r||t[r]&&nn[r])&&(r==="set-cookie"?t[r]?t[r].push(s):t[r]=[s]:t[r]=t[r]?t[r]+", "+s:s)}),t},It=Symbol("internals");function Re(e){return e&&String(e).trim().toLowerCase()}function De(e){return e===!1||e==null?e:u.isArray(e)?e.map(De):String(e)}function on(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 an=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ge(e,t,r,s,o){if(u.isFunction(s))return s.call(this,t,r);if(o&&(t=r),!!u.isString(t)){if(u.isString(s))return t.indexOf(s)!==-1;if(u.isRegExp(s))return s.test(t)}}function ln(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,s)=>r.toUpperCase()+s)}function cn(e,t){const r=u.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,p){const c=Re(h);if(!c)throw new Error("header name must be a non-empty string");const m=u.findKey(o,c);(!m||o[m]===void 0||p===!0||p===void 0&&o[m]!==!1)&&(o[m||h]=De(l))}const a=(l,h)=>u.forEach(l,(p,c)=>i(p,c,h));if(u.isPlainObject(t)||t instanceof this.constructor)a(t,r);else if(u.isString(t)&&(t=t.trim())&&!an(t))a(sn(t),r);else if(u.isObject(t)&&u.isIterable(t)){let l={},h,p;for(const c of t){if(!u.isArray(c))throw TypeError("Object iterator must return a key-value pair");l[p=c[0]]=(h=l[p])?u.isArray(h)?[...h,c[1]]:[h,c[1]]:c[1]}a(l,r)}else t!=null&&i(r,t,s);return this}get(t,r){if(t=Re(t),t){const s=u.findKey(this,t);if(s){const o=this[s];if(!r)return o;if(r===!0)return on(o);if(u.isFunction(r))return r.call(this,o,s);if(u.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Re(t),t){const s=u.findKey(this,t);return!!(s&&this[s]!==void 0&&(!r||Ge(this,this[s],s,r)))}return!1}delete(t,r){const s=this;let o=!1;function i(a){if(a=Re(a),a){const l=u.findKey(s,a);l&&(!r||Ge(s,s[l],l,r))&&(delete s[l],o=!0)}}return u.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||Ge(this,this[i],i,t,!0))&&(delete this[i],o=!0)}return o}normalize(t){const r=this,s={};return u.forEach(this,(o,i)=>{const a=u.findKey(s,i);if(a){r[a]=De(o),delete r[i];return}const l=t?ln(i):String(i).trim();l!==i&&delete r[i],r[l]=De(o),s[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return u.forEach(this,(s,o)=>{s!=null&&s!==!1&&(r[o]=t&&u.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[It]=this[It]={accessors:{}}).accessors,o=this.prototype;function i(a){const l=Re(a);s[l]||(cn(o,a),s[l]=!0)}return u.isArray(t)?t.forEach(i):i(t),this}};ne.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),u.reduceDescriptors(ne.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[r]=s}}}),u.freezeMethods(ne);function Ze(e,t){const r=this||Te,s=t||r,o=ne.from(s.headers);let i=s.data;return u.forEach(e,function(l){i=l.call(r,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function Pt(e){return!!(e&&e.__CANCEL__)}function we(e,t,r){A.call(this,e??"canceled",A.ERR_CANCELED,t,r),this.name="CanceledError"}u.inherits(we,A,{__CANCEL__:!0});function Ot(e,t,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?e(r):t(new A("Request failed with status code "+r.status,[A.ERR_BAD_REQUEST,A.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function dn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function un(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 p=Date.now(),c=s[i];a||(a=p),r[o]=h,s[o]=p;let m=i,I=0;for(;m!==o;)I+=r[m++],m=m%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),p-a<t)return;const v=c&&p-c;return v?Math.round(I*1e3/v):void 0}}function pn(e,t){let r=0,s=1e3/t,o,i;const a=(p,c=Date.now())=>{r=c,o=null,i&&(clearTimeout(i),i=null),e(...p)};return[(...p)=>{const c=Date.now(),m=c-r;m>=s?a(p,c):(o=p,i||(i=setTimeout(()=>{i=null,a(o)},s-m)))},()=>o&&a(o)]}const Fe=(e,t,r=3)=>{let s=0;const o=un(50,250);return pn(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,h=a-s,p=o(h),c=a<=l;s=a;const m={loaded:a,total:l,progress:l?a/l:void 0,bytes:h,rate:p||void 0,estimated:p&&l&&c?(l-a)/p:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(m)},r)},_t=(e,t)=>{const r=e!=null;return[s=>t[0]({lengthComputable:r,total:e,loaded:s}),t[1]]},At=e=>(...t)=>u.asap(()=>e(...t)),fn=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,xn=ee.hasStandardBrowserEnv?{write(e,t,r,s,o,i){const a=[e+"="+encodeURIComponent(t)];u.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),u.isString(s)&&a.push("path="+s),u.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 hn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function gn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function zt(e,t,r){let s=!hn(t);return e&&(s||r==!1)?gn(e,t):t}const Nt=e=>e instanceof ne?{...e}:e;function pe(e,t){t=t||{};const r={};function s(p,c,m,I){return u.isPlainObject(p)&&u.isPlainObject(c)?u.merge.call({caseless:I},p,c):u.isPlainObject(c)?u.merge({},c):u.isArray(c)?c.slice():c}function o(p,c,m,I){if(u.isUndefined(c)){if(!u.isUndefined(p))return s(void 0,p,m,I)}else return s(p,c,m,I)}function i(p,c){if(!u.isUndefined(c))return s(void 0,c)}function a(p,c){if(u.isUndefined(c)){if(!u.isUndefined(p))return s(void 0,p)}else return s(void 0,c)}function l(p,c,m){if(m in t)return s(p,c);if(m in e)return s(void 0,p)}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:(p,c,m)=>o(Nt(p),Nt(c),m,!0)};return u.forEach(Object.keys({...e,...t}),function(c){const m=h[c]||o,I=m(e[c],t[c],c);u.isUndefined(I)&&m!==l||(r[c]=I)}),r}const Ut=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=Et(zt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),u.isFormData(r)){if(ee.hasStandardBrowserEnv||ee.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(u.isFunction(r.getHeaders)){const h=r.getHeaders(),p=["content-type","content-length"];Object.entries(h).forEach(([c,m])=>{p.includes(c.toLowerCase())&&a.set(c,m)})}}if(ee.hasStandardBrowserEnv&&(s&&u.isFunction(s)&&(s=s(t)),s||s!==!1&&fn(t.url))){const h=o&&i&&xn.read(i);h&&a.set(o,h)}return t},mn=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,s){const o=Ut(e);let i=o.data;const a=ne.from(o.headers).normalize();let{responseType:l,onUploadProgress:h,onDownloadProgress:p}=o,c,m,I,v,d;function b(){v&&v(),d&&d(),o.cancelToken&&o.cancelToken.unsubscribe(c),o.signal&&o.signal.removeEventListener("abort",c)}let g=new XMLHttpRequest;g.open(o.method.toUpperCase(),o.url,!0),g.timeout=o.timeout;function U(){if(!g)return;const P=ne.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),M={data:!l||l==="text"||l==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:P,config:e,request:g};Ot(function(O){r(O),b()},function(O){s(O),b()},M),g=null}"onloadend"in g?g.onloadend=U:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(U)},g.onabort=function(){g&&(s(new A("Request aborted",A.ECONNABORTED,e,g)),g=null)},g.onerror=function(C){const M=C&&C.message?C.message:"Network Error",y=new A(M,A.ERR_NETWORK,e,g);y.event=C||null,s(y),g=null},g.ontimeout=function(){let C=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const M=o.transitional||Tt;o.timeoutErrorMessage&&(C=o.timeoutErrorMessage),s(new A(C,M.clarifyTimeoutError?A.ETIMEDOUT:A.ECONNABORTED,e,g)),g=null},i===void 0&&a.setContentType(null),"setRequestHeader"in g&&u.forEach(a.toJSON(),function(C,M){g.setRequestHeader(M,C)}),u.isUndefined(o.withCredentials)||(g.withCredentials=!!o.withCredentials),l&&l!=="json"&&(g.responseType=o.responseType),p&&([I,d]=Fe(p,!0),g.addEventListener("progress",I)),h&&g.upload&&([m,v]=Fe(h),g.upload.addEventListener("progress",m),g.upload.addEventListener("loadend",v)),(o.cancelToken||o.signal)&&(c=P=>{g&&(s(!P||P.type?new we(null,e,g):P),g.abort(),g=null)},o.cancelToken&&o.cancelToken.subscribe(c),o.signal&&(o.signal.aborted?c():o.signal.addEventListener("abort",c)));const z=dn(o.url);if(z&&ee.protocols.indexOf(z)===-1){s(new A("Unsupported protocol "+z+":",A.ERR_BAD_REQUEST,e));return}g.send(i||null)})},yn=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let s=new AbortController,o;const i=function(p){if(!o){o=!0,l();const c=p instanceof Error?p:this.reason;s.abort(c instanceof A?c:new we(c instanceof Error?c.message:c))}};let a=t&&setTimeout(()=>{a=null,i(new A(`timeout ${t} of ms exceeded`,A.ETIMEDOUT))},t);const l=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(p=>{p.unsubscribe?p.unsubscribe(i):p.removeEventListener("abort",i)}),e=null)};e.forEach(p=>p.addEventListener("abort",i));const{signal:h}=s;return h.unsubscribe=()=>u.asap(l),h}},bn=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},wn=async function*(e,t){for await(const r of Sn(e))yield*bn(r,t)},Sn=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()}},Dt=(e,t,r,s)=>{const o=wn(e,t);let i=0,a,l=h=>{a||(a=!0,s&&s(h))};return new ReadableStream({async pull(h){try{const{done:p,value:c}=await o.next();if(p){l(),h.close();return}let m=c.byteLength;if(r){let I=i+=m;r(I)}h.enqueue(new Uint8Array(c))}catch(p){throw l(p),p}},cancel(h){return l(h),o.return()}},{highWaterMark:2})},Ft=64*1024,{isFunction:Le}=u,jn=(({Request:e,Response:t})=>({Request:e,Response:t}))(u.global),{ReadableStream:Lt,TextEncoder:Mt}=u.global,Bt=(e,...t)=>{try{return!!e(...t)}catch{return!1}},vn=e=>{e=u.merge.call({skipUndefined:!0},jn,e);const{fetch:t,Request:r,Response:s}=e,o=t?Le(t):typeof fetch=="function",i=Le(r),a=Le(s);if(!o)return!1;const l=o&&Le(Lt),h=o&&(typeof Mt=="function"?(d=>b=>d.encode(b))(new Mt):async d=>new Uint8Array(await new r(d).arrayBuffer())),p=i&&l&&Bt(()=>{let d=!1;const b=new r(ee.origin,{body:new Lt,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!b}),c=a&&l&&Bt(()=>u.isReadableStream(new s("").body)),m={stream:c&&(d=>d.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!m[d]&&(m[d]=(b,g)=>{let U=b&&b[d];if(U)return U.call(b);throw new A(`Response type '${d}' is not supported`,A.ERR_NOT_SUPPORT,g)})});const I=async d=>{if(d==null)return 0;if(u.isBlob(d))return d.size;if(u.isSpecCompliantForm(d))return(await new r(ee.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(u.isArrayBufferView(d)||u.isArrayBuffer(d))return d.byteLength;if(u.isURLSearchParams(d)&&(d=d+""),u.isString(d))return(await h(d)).byteLength},v=async(d,b)=>{const g=u.toFiniteNumber(d.getContentLength());return g??I(b)};return async d=>{let{url:b,method:g,data:U,signal:z,cancelToken:P,timeout:C,onDownloadProgress:M,onUploadProgress:y,responseType:O,headers:w,withCredentials:F="same-origin",fetchOptions:K}=Ut(d),D=t||fetch;O=O?(O+"").toLowerCase():"text";let q=yn([z,P&&P.toAbortSignal()],C),Q=null;const k=q&&q.unsubscribe&&(()=>{q.unsubscribe()});let Z;try{if(y&&p&&g!=="get"&&g!=="head"&&(Z=await v(w,U))!==0){let E=new r(b,{method:"POST",body:U,duplex:"half"}),N;if(u.isFormData(U)&&(N=E.headers.get("content-type"))&&w.setContentType(N),E.body){const[W,f]=_t(Z,Fe(At(y)));U=Dt(E.body,Ft,W,f)}}u.isString(F)||(F=F?"include":"omit");const B=i&&"credentials"in r.prototype,L={...K,signal:q,method:g.toUpperCase(),headers:w.normalize().toJSON(),body:U,duplex:"half",credentials:B?F:void 0};Q=i&&new r(b,L);let R=await(i?D(Q,K):D(b,L));const Y=c&&(O==="stream"||O==="response");if(c&&(M||Y&&k)){const E={};["status","statusText","headers"].forEach(S=>{E[S]=R[S]});const N=u.toFiniteNumber(R.headers.get("content-length")),[W,f]=M&&_t(N,Fe(At(M),!0))||[];R=new s(Dt(R.body,Ft,W,()=>{f&&f(),k&&k()}),E)}O=O||"text";let x=await m[u.findKey(m,O)||"text"](R,d);return!Y&&k&&k(),await new Promise((E,N)=>{Ot(E,N,{data:x,headers:ne.from(R.headers),status:R.status,statusText:R.statusText,config:d,request:Q})})}catch(B){throw k&&k(),B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new A("Network Error",A.ERR_NETWORK,d,Q),{cause:B.cause||B}):A.from(B,B&&B.code,d,Q)}}},kn=new Map,Wt=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,p,c=kn;for(;l--;)h=i[l],p=c.get(h),p===void 0&&c.set(h,p=l?new Map:vn(t)),c=p;return p};Wt();const Qe={http:Vr,xhr:mn,fetch:{get:Wt}};u.forEach(Qe,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const $t=e=>`- ${e}`,En=e=>u.isFunction(e)||e===null||e===!1,Ht={getAdapter:(e,t)=>{e=u.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,!En(s)&&(o=Qe[(l=String(s)).toLowerCase()],o===void 0))throw new A(`Unknown adapter '${l}'`);if(o&&(u.isFunction(o)||(o=o.get(t))))break;i[l||"#"+a]=o}if(!o){const a=Object.entries(i).map(([h,p])=>`adapter ${h} `+(p===!1?"is not supported by the environment":"is not available in the build"));let l=r?a.length>1?`since :
4
- `+a.map($t).join(`
5
- `):" "+$t(a[0]):"as no adapter specified";throw new A("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return o},adapters:Qe};function et(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new we(null,e)}function Vt(e){return et(e),e.headers=ne.from(e.headers),e.data=Ze.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ht.getAdapter(e.adapter||Te.adapter,e)(e).then(function(s){return et(e),s.data=Ze.call(e,e.transformResponse,s),s.headers=ne.from(s.headers),s},function(s){return Pt(s)||(et(e),s&&s.response&&(s.response.data=Ze.call(e,e.transformResponse,s.response),s.response.headers=ne.from(s.response.headers))),Promise.reject(s)})}const Yt="1.12.2",Me={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Me[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const qt={};Me.transitional=function(t,r,s){function o(i,a){return"[Axios v"+Yt+"] Transitional option '"+i+"'"+a+(s?". "+s:"")}return(i,a,l)=>{if(t===!1)throw new A(o(a," has been removed"+(r?" in "+r:"")),A.ERR_DEPRECATED);return r&&!qt[a]&&(qt[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}},Me.spelling=function(t){return(r,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function Cn(e,t,r){if(typeof e!="object")throw new A("options must be an object",A.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 A("option "+i+" must be "+h,A.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new A("Unknown option "+i,A.ERR_BAD_OPTION)}}const Be={assertOptions:Cn,validators:Me},ie=Be.validators;let fe=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Ct,response:new Ct}}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&&Be.assertOptions(s,{silentJSONParsing:ie.transitional(ie.boolean),forcedJSONParsing:ie.transitional(ie.boolean),clarifyTimeoutError:ie.transitional(ie.boolean)},!1),o!=null&&(u.isFunction(o)?r.paramsSerializer={serialize:o}:Be.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),Be.assertOptions(r,{baseUrl:ie.spelling("baseURL"),withXsrfToken:ie.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=i&&u.merge(i.common,i[r.method]);i&&u.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 p=[];this.interceptors.response.forEach(function(b){p.push(b.fulfilled,b.rejected)});let c,m=0,I;if(!h){const d=[Vt.bind(this),void 0];for(d.unshift(...l),d.push(...p),I=d.length,c=Promise.resolve(r);m<I;)c=c.then(d[m++],d[m++]);return c}I=l.length;let v=r;for(;m<I;){const d=l[m++],b=l[m++];try{v=d(v)}catch(g){b.call(this,g);break}}try{c=Vt.call(this,v)}catch(d){return Promise.reject(d)}for(m=0,I=p.length;m<I;)c=c.then(p[m++],p[m++]);return c}getUri(t){t=pe(this.defaults,t);const r=zt(t.baseURL,t.url,t.allowAbsoluteUrls);return Et(r,t.params,t.paramsSerializer)}};u.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}))}}),u.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 Tn=class ar{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 ar(function(o){t=o}),cancel:t}}};function Rn(e){return function(r){return e.apply(null,r)}}function In(e){return u.isObject(e)&&e.isAxiosError===!0}const tt={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(tt).forEach(([e,t])=>{tt[t]=e});function Kt(e){const t=new fe(e),r=dt(fe.prototype.request,t);return u.extend(r,fe.prototype,t,{allOwnKeys:!0}),u.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return Kt(pe(e,o))},r}const $=Kt(Te);$.Axios=fe,$.CanceledError=we,$.CancelToken=Tn,$.isCancel=Pt,$.VERSION=Yt,$.toFormData=Ue,$.AxiosError=A,$.Cancel=$.CanceledError,$.all=function(t){return Promise.all(t)},$.spread=Rn,$.isAxiosError=In,$.mergeConfig=pe,$.AxiosHeaders=ne,$.formToJSON=e=>Rt(u.isHTMLForm(e)?new FormData(e):e),$.getAdapter=Ht.getAdapter,$.HttpStatusCode=tt,$.default=$;const{Axios:ys,AxiosError:bs,CanceledError:ws,isCancel:Ss,CancelToken:js,VERSION:vs,all:ks,Cancel:Es,isAxiosError:Cs,spread:Ts,toFormData:Rs,AxiosHeaders:Is,HttpStatusCode:Ps,formToJSON:Os,getAdapter:_s,mergeConfig:As}=$;class Pn{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=$.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)throw new Error("HTTP method is required");if(!r)throw new Error("Request path is required");try{const i={...this.appId?{appId:this.appId}:{},...s||{}};return(await this.client.request({url:r,method:t,data:i,headers:o})).data}catch(i){if(console.error("❌ [Request Error]:",i),i.isAxiosError){const a=i.response?.status||0,l=i.response?.data?.message||i.message||"Unknown Axios error occurred";throw new Error(`Request failed (${a}): ${l}`)}throw new Error(`Unexpected error: ${i.message||"Unknown failure"}`)}}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 We={exports:{}},Ie={};/**
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 dt(e,t){return function(){return e.apply(t,arguments)}}const{toString:lr}=Object.prototype,{getPrototypeOf:Ve}=Object,{iterator:_e,toStringTag:ut}=Symbol,Ae=(e=>t=>{const r=lr.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),oe=e=>(e=e.toLowerCase(),t=>Ae(t)===e),ze=e=>t=>typeof t===e,{isArray:ye}=Array,be=ze("undefined");function ke(e){return e!==null&&!be(e)&&e.constructor!==null&&!be(e.constructor)&&re(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const pt=oe("ArrayBuffer");function cr(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&pt(e.buffer),t}const dr=ze("string"),re=ze("function"),ft=ze("number"),Ee=e=>e!==null&&typeof e=="object",ur=e=>e===!0||e===!1,Ne=e=>{if(Ae(e)!=="object")return!1;const t=Ve(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(ut in e)&&!(_e in e)},pr=e=>{if(!Ee(e)||ke(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},fr=oe("Date"),xr=oe("File"),hr=oe("Blob"),gr=oe("FileList"),mr=e=>Ee(e)&&re(e.pipe),yr=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||re(e.append)&&((t=Ae(e))==="formdata"||t==="object"&&re(e.toString)&&e.toString()==="[object FormData]"))},br=oe("URLSearchParams"),[wr,Sr,jr,vr]=["ReadableStream","Request","Response","Headers"].map(oe),kr=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ce(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(ke(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 xt(e,t){if(ke(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,ht=e=>!be(e)&&e!==ue;function Ye(){const{caseless:e,skipUndefined:t}=ht(this)&&this||{},r={},s=(o,i)=>{const a=e&&xt(r,i)||i;Ne(r[a])&&Ne(o)?r[a]=Ye(r[a],o):Ne(o)?r[a]=Ye({},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]&&Ce(arguments[o],s);return r}const Er=(e,t,r,{allOwnKeys:s}={})=>(Ce(t,(o,i)=>{r&&re(o)?e[i]=dt(o,r):e[i]=o},{allOwnKeys:s}),e),Cr=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Tr=(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)},Rr=(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&&Ve(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Ir=(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},Pr=e=>{if(!e)return null;if(ye(e))return e;let t=e.length;if(!ft(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Or=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Ve(Uint8Array)),_r=(e,t)=>{const s=(e&&e[_e]).call(e);let o;for(;(o=s.next())&&!o.done;){const i=o.value;t.call(e,i[0],i[1])}},Ar=(e,t)=>{let r;const s=[];for(;(r=e.exec(t))!==null;)s.push(r);return s},zr=oe("HTMLFormElement"),Nr=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,s,o){return s.toUpperCase()+o}),gt=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Ur=oe("RegExp"),mt=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),s={};Ce(r,(o,i)=>{let a;(a=t(o,i,e))!==!1&&(s[i]=a||o)}),Object.defineProperties(e,s)},Dr=e=>{mt(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+"'")})}})},Fr=(e,t)=>{const r={},s=o=>{o.forEach(i=>{r[i]=!0})};return ye(e)?s(e):s(String(e).split(t)),r},Lr=()=>{},Mr=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Br(e){return!!(e&&re(e.append)&&e[ut]==="FormData"&&e[_e])}const Wr=e=>{const t=new Array(10),r=(s,o)=>{if(Ee(s)){if(t.indexOf(s)>=0)return;if(ke(s))return s;if(!("toJSON"in s)){t[o]=s;const i=ye(s)?[]:{};return Ce(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)},Hr=oe("AsyncFunction"),$r=e=>e&&(Ee(e)||re(e))&&re(e.then)&&re(e.catch),yt=((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)),Vr=typeof queueMicrotask<"u"?queueMicrotask.bind(ue):typeof process<"u"&&process.nextTick||yt,u={isArray:ye,isArrayBuffer:pt,isBuffer:ke,isFormData:yr,isArrayBufferView:cr,isString:dr,isNumber:ft,isBoolean:ur,isObject:Ee,isPlainObject:Ne,isEmptyObject:pr,isReadableStream:wr,isRequest:Sr,isResponse:jr,isHeaders:vr,isUndefined:be,isDate:fr,isFile:xr,isBlob:hr,isRegExp:Ur,isFunction:re,isStream:mr,isURLSearchParams:br,isTypedArray:Or,isFileList:gr,forEach:Ce,merge:Ye,extend:Er,trim:kr,stripBOM:Cr,inherits:Tr,toFlatObject:Rr,kindOf:Ae,kindOfTest:oe,endsWith:Ir,toArray:Pr,forEachEntry:_r,matchAll:Ar,isHTMLForm:zr,hasOwnProperty:gt,hasOwnProp:gt,reduceDescriptors:mt,freezeMethods:Dr,toObjectSet:Fr,toCamelCase:Nr,noop:Lr,toFiniteNumber:Mr,findKey:xt,global:ue,isContextDefined:ht,isSpecCompliantForm:Br,toJSONObject:Wr,isAsyncFn:Hr,isThenable:$r,setImmediate:yt,asap:Vr,isIterable:e=>e!=null&&re(e[_e])};function A(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)}u.inherits(A,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:u.toJSONObject(this.config),code:this.code,status:this.status}}});const bt=A.prototype,wt={};["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=>{wt[e]={value:e}}),Object.defineProperties(A,wt),Object.defineProperty(bt,"isAxiosError",{value:!0}),A.from=(e,t,r,s,o,i)=>{const a=Object.create(bt);u.toFlatObject(e,a,function(c){return c!==Error.prototype},p=>p!=="isAxiosError");const l=e&&e.message?e.message:"Error",h=t==null&&e?e.code:t;return A.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 Yr=null;function qe(e){return u.isPlainObject(e)||u.isArray(e)}function St(e){return u.endsWith(e,"[]")?e.slice(0,-2):e}function jt(e,t,r){return e?e.concat(t).map(function(o,i){return o=St(o),!r&&i?"["+o+"]":o}).join(r?".":""):t}function qr(e){return u.isArray(e)&&!e.some(qe)}const Kr=u.toFlatObject(u,{},null,function(t){return/^is[A-Z]/.test(t)});function Ue(e,t,r){if(!u.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=u.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,g){return!u.isUndefined(g[b])});const s=r.metaTokens,o=r.visitor||c,i=r.dots,a=r.indexes,h=(r.Blob||typeof Blob<"u"&&Blob)&&u.isSpecCompliantForm(t);if(!u.isFunction(o))throw new TypeError("visitor must be a function");function p(d){if(d===null)return"";if(u.isDate(d))return d.toISOString();if(u.isBoolean(d))return d.toString();if(!h&&u.isBlob(d))throw new A("Blob is not supported. Use a Buffer instead.");return u.isArrayBuffer(d)||u.isTypedArray(d)?h&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function c(d,b,g){let U=d;if(d&&!g&&typeof d=="object"){if(u.endsWith(b,"{}"))b=s?b:b.slice(0,-2),d=JSON.stringify(d);else if(u.isArray(d)&&qr(d)||(u.isFileList(d)||u.endsWith(b,"[]"))&&(U=u.toArray(d)))return b=St(b),U.forEach(function(P,C){!(u.isUndefined(P)||P===null)&&t.append(a===!0?jt([b],C,i):a===null?b:b+"[]",p(P))}),!1}return qe(d)?!0:(t.append(jt(g,b,i),p(d)),!1)}const m=[],I=Object.assign(Kr,{defaultVisitor:c,convertValue:p,isVisitable:qe});function v(d,b){if(!u.isUndefined(d)){if(m.indexOf(d)!==-1)throw Error("Circular reference detected in "+b.join("."));m.push(d),u.forEach(d,function(U,z){(!(u.isUndefined(U)||U===null)&&o.call(t,U,u.isString(z)?z.trim():z,b,I))===!0&&v(U,b?b.concat(z):[z])}),m.pop()}}if(!u.isObject(e))throw new TypeError("data must be an object");return v(e),t}function vt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function Ke(e,t){this._pairs=[],e&&Ue(e,this,t)}const kt=Ke.prototype;kt.append=function(t,r){this._pairs.push([t,r])},kt.toString=function(t){const r=t?function(s){return t.call(this,s,vt)}:vt;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};function Jr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Et(e,t,r){if(!t)return e;const s=r&&r.encode||Jr;u.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let i;if(o?i=o(t,r):i=u.isURLSearchParams(t)?t.toString():new Ke(t,r).toString(s),i){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Ct{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){u.forEach(this.handlers,function(s){s!==null&&t(s)})}}const Tt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Xr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ke,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Je=typeof window<"u"&&typeof document<"u",Xe=typeof navigator=="object"&&navigator||void 0,Gr=Je&&(!Xe||["ReactNative","NativeScript","NS"].indexOf(Xe.product)<0),Zr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Qr=Je&&window.location.href||"http://localhost",ee={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Je,hasStandardBrowserEnv:Gr,hasStandardBrowserWebWorkerEnv:Zr,navigator:Xe,origin:Qr},Symbol.toStringTag,{value:"Module"})),...Xr};function en(e,t){return Ue(e,new ee.classes.URLSearchParams,{visitor:function(r,s,o,i){return ee.isNode&&u.isBuffer(r)?(this.append(s,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function tn(e){return u.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function rn(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 Rt(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&&u.isArray(o)?o.length:a,h?(u.hasOwnProp(o,a)?o[a]=[o[a],s]:o[a]=s,!l):((!o[a]||!u.isObject(o[a]))&&(o[a]=[]),t(r,s,o[a],i)&&u.isArray(o[a])&&(o[a]=rn(o[a])),!l)}if(u.isFormData(e)&&u.isFunction(e.entries)){const r={};return u.forEachEntry(e,(s,o)=>{t(tn(s),o,r,0)}),r}return null}function nn(e,t,r){if(u.isString(e))try{return(t||JSON.parse)(e),u.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(r||JSON.stringify)(e)}const Te={transitional:Tt,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const s=r.getContentType()||"",o=s.indexOf("application/json")>-1,i=u.isObject(t);if(i&&u.isHTMLForm(t)&&(t=new FormData(t)),u.isFormData(t))return o?JSON.stringify(Rt(t)):t;if(u.isArrayBuffer(t)||u.isBuffer(t)||u.isStream(t)||u.isFile(t)||u.isBlob(t)||u.isReadableStream(t))return t;if(u.isArrayBufferView(t))return t.buffer;if(u.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 en(t,this.formSerializer).toString();if((l=u.isFileList(t))||s.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return Ue(l?{"files[]":t}:t,h&&new h,this.formSerializer)}}return i||o?(r.setContentType("application/json",!1),nn(t)):t}],transformResponse:[function(t){const r=this.transitional||Te.transitional,s=r&&r.forcedJSONParsing,o=this.responseType==="json";if(u.isResponse(t)||u.isReadableStream(t))return t;if(t&&u.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"?A.from(l,A.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}}};u.forEach(["delete","get","head","post","put","patch"],e=>{Te.headers[e]={}});const sn=u.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"]),on=e=>{const t={};let r,s,o;return e&&e.split(`
2
+ `).forEach(function(a){o=a.indexOf(":"),r=a.substring(0,o).trim().toLowerCase(),s=a.substring(o+1).trim(),!(!r||t[r]&&sn[r])&&(r==="set-cookie"?t[r]?t[r].push(s):t[r]=[s]:t[r]=t[r]?t[r]+", "+s:s)}),t},It=Symbol("internals");function Re(e){return e&&String(e).trim().toLowerCase()}function De(e){return e===!1||e==null?e:u.isArray(e)?e.map(De):String(e)}function an(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 ln=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ge(e,t,r,s,o){if(u.isFunction(s))return s.call(this,t,r);if(o&&(t=r),!!u.isString(t)){if(u.isString(s))return t.indexOf(s)!==-1;if(u.isRegExp(s))return s.test(t)}}function cn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,s)=>r.toUpperCase()+s)}function dn(e,t){const r=u.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,p){const c=Re(h);if(!c)throw new Error("header name must be a non-empty string");const m=u.findKey(o,c);(!m||o[m]===void 0||p===!0||p===void 0&&o[m]!==!1)&&(o[m||h]=De(l))}const a=(l,h)=>u.forEach(l,(p,c)=>i(p,c,h));if(u.isPlainObject(t)||t instanceof this.constructor)a(t,r);else if(u.isString(t)&&(t=t.trim())&&!ln(t))a(on(t),r);else if(u.isObject(t)&&u.isIterable(t)){let l={},h,p;for(const c of t){if(!u.isArray(c))throw TypeError("Object iterator must return a key-value pair");l[p=c[0]]=(h=l[p])?u.isArray(h)?[...h,c[1]]:[h,c[1]]:c[1]}a(l,r)}else t!=null&&i(r,t,s);return this}get(t,r){if(t=Re(t),t){const s=u.findKey(this,t);if(s){const o=this[s];if(!r)return o;if(r===!0)return an(o);if(u.isFunction(r))return r.call(this,o,s);if(u.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Re(t),t){const s=u.findKey(this,t);return!!(s&&this[s]!==void 0&&(!r||Ge(this,this[s],s,r)))}return!1}delete(t,r){const s=this;let o=!1;function i(a){if(a=Re(a),a){const l=u.findKey(s,a);l&&(!r||Ge(s,s[l],l,r))&&(delete s[l],o=!0)}}return u.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||Ge(this,this[i],i,t,!0))&&(delete this[i],o=!0)}return o}normalize(t){const r=this,s={};return u.forEach(this,(o,i)=>{const a=u.findKey(s,i);if(a){r[a]=De(o),delete r[i];return}const l=t?cn(i):String(i).trim();l!==i&&delete r[i],r[l]=De(o),s[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return u.forEach(this,(s,o)=>{s!=null&&s!==!1&&(r[o]=t&&u.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[It]=this[It]={accessors:{}}).accessors,o=this.prototype;function i(a){const l=Re(a);s[l]||(dn(o,a),s[l]=!0)}return u.isArray(t)?t.forEach(i):i(t),this}};ne.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),u.reduceDescriptors(ne.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[r]=s}}}),u.freezeMethods(ne);function Ze(e,t){const r=this||Te,s=t||r,o=ne.from(s.headers);let i=s.data;return u.forEach(e,function(l){i=l.call(r,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function Pt(e){return!!(e&&e.__CANCEL__)}function we(e,t,r){A.call(this,e??"canceled",A.ERR_CANCELED,t,r),this.name="CanceledError"}u.inherits(we,A,{__CANCEL__:!0});function Ot(e,t,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?e(r):t(new A("Request failed with status code "+r.status,[A.ERR_BAD_REQUEST,A.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function un(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function pn(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 p=Date.now(),c=s[i];a||(a=p),r[o]=h,s[o]=p;let m=i,I=0;for(;m!==o;)I+=r[m++],m=m%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),p-a<t)return;const v=c&&p-c;return v?Math.round(I*1e3/v):void 0}}function fn(e,t){let r=0,s=1e3/t,o,i;const a=(p,c=Date.now())=>{r=c,o=null,i&&(clearTimeout(i),i=null),e(...p)};return[(...p)=>{const c=Date.now(),m=c-r;m>=s?a(p,c):(o=p,i||(i=setTimeout(()=>{i=null,a(o)},s-m)))},()=>o&&a(o)]}const Fe=(e,t,r=3)=>{let s=0;const o=pn(50,250);return fn(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,h=a-s,p=o(h),c=a<=l;s=a;const m={loaded:a,total:l,progress:l?a/l:void 0,bytes:h,rate:p||void 0,estimated:p&&l&&c?(l-a)/p:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(m)},r)},_t=(e,t)=>{const r=e!=null;return[s=>t[0]({lengthComputable:r,total:e,loaded:s}),t[1]]},At=e=>(...t)=>u.asap(()=>e(...t)),xn=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,hn=ee.hasStandardBrowserEnv?{write(e,t,r,s,o,i){const a=[e+"="+encodeURIComponent(t)];u.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),u.isString(s)&&a.push("path="+s),u.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 gn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function mn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function zt(e,t,r){let s=!gn(t);return e&&(s||r==!1)?mn(e,t):t}const Nt=e=>e instanceof ne?{...e}:e;function pe(e,t){t=t||{};const r={};function s(p,c,m,I){return u.isPlainObject(p)&&u.isPlainObject(c)?u.merge.call({caseless:I},p,c):u.isPlainObject(c)?u.merge({},c):u.isArray(c)?c.slice():c}function o(p,c,m,I){if(u.isUndefined(c)){if(!u.isUndefined(p))return s(void 0,p,m,I)}else return s(p,c,m,I)}function i(p,c){if(!u.isUndefined(c))return s(void 0,c)}function a(p,c){if(u.isUndefined(c)){if(!u.isUndefined(p))return s(void 0,p)}else return s(void 0,c)}function l(p,c,m){if(m in t)return s(p,c);if(m in e)return s(void 0,p)}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:(p,c,m)=>o(Nt(p),Nt(c),m,!0)};return u.forEach(Object.keys({...e,...t}),function(c){const m=h[c]||o,I=m(e[c],t[c],c);u.isUndefined(I)&&m!==l||(r[c]=I)}),r}const Ut=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=Et(zt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),u.isFormData(r)){if(ee.hasStandardBrowserEnv||ee.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(u.isFunction(r.getHeaders)){const h=r.getHeaders(),p=["content-type","content-length"];Object.entries(h).forEach(([c,m])=>{p.includes(c.toLowerCase())&&a.set(c,m)})}}if(ee.hasStandardBrowserEnv&&(s&&u.isFunction(s)&&(s=s(t)),s||s!==!1&&xn(t.url))){const h=o&&i&&hn.read(i);h&&a.set(o,h)}return t},yn=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,s){const o=Ut(e);let i=o.data;const a=ne.from(o.headers).normalize();let{responseType:l,onUploadProgress:h,onDownloadProgress:p}=o,c,m,I,v,d;function b(){v&&v(),d&&d(),o.cancelToken&&o.cancelToken.unsubscribe(c),o.signal&&o.signal.removeEventListener("abort",c)}let g=new XMLHttpRequest;g.open(o.method.toUpperCase(),o.url,!0),g.timeout=o.timeout;function U(){if(!g)return;const P=ne.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),M={data:!l||l==="text"||l==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:P,config:e,request:g};Ot(function(O){r(O),b()},function(O){s(O),b()},M),g=null}"onloadend"in g?g.onloadend=U:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(U)},g.onabort=function(){g&&(s(new A("Request aborted",A.ECONNABORTED,e,g)),g=null)},g.onerror=function(C){const M=C&&C.message?C.message:"Network Error",y=new A(M,A.ERR_NETWORK,e,g);y.event=C||null,s(y),g=null},g.ontimeout=function(){let C=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const M=o.transitional||Tt;o.timeoutErrorMessage&&(C=o.timeoutErrorMessage),s(new A(C,M.clarifyTimeoutError?A.ETIMEDOUT:A.ECONNABORTED,e,g)),g=null},i===void 0&&a.setContentType(null),"setRequestHeader"in g&&u.forEach(a.toJSON(),function(C,M){g.setRequestHeader(M,C)}),u.isUndefined(o.withCredentials)||(g.withCredentials=!!o.withCredentials),l&&l!=="json"&&(g.responseType=o.responseType),p&&([I,d]=Fe(p,!0),g.addEventListener("progress",I)),h&&g.upload&&([m,v]=Fe(h),g.upload.addEventListener("progress",m),g.upload.addEventListener("loadend",v)),(o.cancelToken||o.signal)&&(c=P=>{g&&(s(!P||P.type?new we(null,e,g):P),g.abort(),g=null)},o.cancelToken&&o.cancelToken.subscribe(c),o.signal&&(o.signal.aborted?c():o.signal.addEventListener("abort",c)));const z=un(o.url);if(z&&ee.protocols.indexOf(z)===-1){s(new A("Unsupported protocol "+z+":",A.ERR_BAD_REQUEST,e));return}g.send(i||null)})},bn=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let s=new AbortController,o;const i=function(p){if(!o){o=!0,l();const c=p instanceof Error?p:this.reason;s.abort(c instanceof A?c:new we(c instanceof Error?c.message:c))}};let a=t&&setTimeout(()=>{a=null,i(new A(`timeout ${t} of ms exceeded`,A.ETIMEDOUT))},t);const l=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(p=>{p.unsubscribe?p.unsubscribe(i):p.removeEventListener("abort",i)}),e=null)};e.forEach(p=>p.addEventListener("abort",i));const{signal:h}=s;return h.unsubscribe=()=>u.asap(l),h}},wn=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},Sn=async function*(e,t){for await(const r of jn(e))yield*wn(r,t)},jn=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()}},Dt=(e,t,r,s)=>{const o=Sn(e,t);let i=0,a,l=h=>{a||(a=!0,s&&s(h))};return new ReadableStream({async pull(h){try{const{done:p,value:c}=await o.next();if(p){l(),h.close();return}let m=c.byteLength;if(r){let I=i+=m;r(I)}h.enqueue(new Uint8Array(c))}catch(p){throw l(p),p}},cancel(h){return l(h),o.return()}},{highWaterMark:2})},Ft=64*1024,{isFunction:Le}=u,vn=(({Request:e,Response:t})=>({Request:e,Response:t}))(u.global),{ReadableStream:Lt,TextEncoder:Mt}=u.global,Bt=(e,...t)=>{try{return!!e(...t)}catch{return!1}},kn=e=>{e=u.merge.call({skipUndefined:!0},vn,e);const{fetch:t,Request:r,Response:s}=e,o=t?Le(t):typeof fetch=="function",i=Le(r),a=Le(s);if(!o)return!1;const l=o&&Le(Lt),h=o&&(typeof Mt=="function"?(d=>b=>d.encode(b))(new Mt):async d=>new Uint8Array(await new r(d).arrayBuffer())),p=i&&l&&Bt(()=>{let d=!1;const b=new r(ee.origin,{body:new Lt,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!b}),c=a&&l&&Bt(()=>u.isReadableStream(new s("").body)),m={stream:c&&(d=>d.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!m[d]&&(m[d]=(b,g)=>{let U=b&&b[d];if(U)return U.call(b);throw new A(`Response type '${d}' is not supported`,A.ERR_NOT_SUPPORT,g)})});const I=async d=>{if(d==null)return 0;if(u.isBlob(d))return d.size;if(u.isSpecCompliantForm(d))return(await new r(ee.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(u.isArrayBufferView(d)||u.isArrayBuffer(d))return d.byteLength;if(u.isURLSearchParams(d)&&(d=d+""),u.isString(d))return(await h(d)).byteLength},v=async(d,b)=>{const g=u.toFiniteNumber(d.getContentLength());return g??I(b)};return async d=>{let{url:b,method:g,data:U,signal:z,cancelToken:P,timeout:C,onDownloadProgress:M,onUploadProgress:y,responseType:O,headers:w,withCredentials:F="same-origin",fetchOptions:K}=Ut(d),D=t||fetch;O=O?(O+"").toLowerCase():"text";let q=bn([z,P&&P.toAbortSignal()],C),Q=null;const k=q&&q.unsubscribe&&(()=>{q.unsubscribe()});let Z;try{if(y&&p&&g!=="get"&&g!=="head"&&(Z=await v(w,U))!==0){let E=new r(b,{method:"POST",body:U,duplex:"half"}),N;if(u.isFormData(U)&&(N=E.headers.get("content-type"))&&w.setContentType(N),E.body){const[W,f]=_t(Z,Fe(At(y)));U=Dt(E.body,Ft,W,f)}}u.isString(F)||(F=F?"include":"omit");const B=i&&"credentials"in r.prototype,L={...K,signal:q,method:g.toUpperCase(),headers:w.normalize().toJSON(),body:U,duplex:"half",credentials:B?F:void 0};Q=i&&new r(b,L);let R=await(i?D(Q,K):D(b,L));const Y=c&&(O==="stream"||O==="response");if(c&&(M||Y&&k)){const E={};["status","statusText","headers"].forEach(j=>{E[j]=R[j]});const N=u.toFiniteNumber(R.headers.get("content-length")),[W,f]=M&&_t(N,Fe(At(M),!0))||[];R=new s(Dt(R.body,Ft,W,()=>{f&&f(),k&&k()}),E)}O=O||"text";let x=await m[u.findKey(m,O)||"text"](R,d);return!Y&&k&&k(),await new Promise((E,N)=>{Ot(E,N,{data:x,headers:ne.from(R.headers),status:R.status,statusText:R.statusText,config:d,request:Q})})}catch(B){throw k&&k(),B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new A("Network Error",A.ERR_NETWORK,d,Q),{cause:B.cause||B}):A.from(B,B&&B.code,d,Q)}}},En=new Map,Wt=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,p,c=En;for(;l--;)h=i[l],p=c.get(h),p===void 0&&c.set(h,p=l?new Map:kn(t)),c=p;return p};Wt();const Qe={http:Yr,xhr:yn,fetch:{get:Wt}};u.forEach(Qe,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ht=e=>`- ${e}`,Cn=e=>u.isFunction(e)||e===null||e===!1,$t={getAdapter:(e,t)=>{e=u.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,!Cn(s)&&(o=Qe[(l=String(s)).toLowerCase()],o===void 0))throw new A(`Unknown adapter '${l}'`);if(o&&(u.isFunction(o)||(o=o.get(t))))break;i[l||"#"+a]=o}if(!o){const a=Object.entries(i).map(([h,p])=>`adapter ${h} `+(p===!1?"is not supported by the environment":"is not available in the build"));let l=r?a.length>1?`since :
4
+ `+a.map(Ht).join(`
5
+ `):" "+Ht(a[0]):"as no adapter specified";throw new A("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return o},adapters:Qe};function et(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new we(null,e)}function Vt(e){return et(e),e.headers=ne.from(e.headers),e.data=Ze.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),$t.getAdapter(e.adapter||Te.adapter,e)(e).then(function(s){return et(e),s.data=Ze.call(e,e.transformResponse,s),s.headers=ne.from(s.headers),s},function(s){return Pt(s)||(et(e),s&&s.response&&(s.response.data=Ze.call(e,e.transformResponse,s.response),s.response.headers=ne.from(s.response.headers))),Promise.reject(s)})}const Yt="1.12.2",Me={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Me[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const qt={};Me.transitional=function(t,r,s){function o(i,a){return"[Axios v"+Yt+"] Transitional option '"+i+"'"+a+(s?". "+s:"")}return(i,a,l)=>{if(t===!1)throw new A(o(a," has been removed"+(r?" in "+r:"")),A.ERR_DEPRECATED);return r&&!qt[a]&&(qt[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}},Me.spelling=function(t){return(r,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function Tn(e,t,r){if(typeof e!="object")throw new A("options must be an object",A.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 A("option "+i+" must be "+h,A.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new A("Unknown option "+i,A.ERR_BAD_OPTION)}}const Be={assertOptions:Tn,validators:Me},ie=Be.validators;let fe=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Ct,response:new Ct}}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&&Be.assertOptions(s,{silentJSONParsing:ie.transitional(ie.boolean),forcedJSONParsing:ie.transitional(ie.boolean),clarifyTimeoutError:ie.transitional(ie.boolean)},!1),o!=null&&(u.isFunction(o)?r.paramsSerializer={serialize:o}:Be.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),Be.assertOptions(r,{baseUrl:ie.spelling("baseURL"),withXsrfToken:ie.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=i&&u.merge(i.common,i[r.method]);i&&u.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 p=[];this.interceptors.response.forEach(function(b){p.push(b.fulfilled,b.rejected)});let c,m=0,I;if(!h){const d=[Vt.bind(this),void 0];for(d.unshift(...l),d.push(...p),I=d.length,c=Promise.resolve(r);m<I;)c=c.then(d[m++],d[m++]);return c}I=l.length;let v=r;for(;m<I;){const d=l[m++],b=l[m++];try{v=d(v)}catch(g){b.call(this,g);break}}try{c=Vt.call(this,v)}catch(d){return Promise.reject(d)}for(m=0,I=p.length;m<I;)c=c.then(p[m++],p[m++]);return c}getUri(t){t=pe(this.defaults,t);const r=zt(t.baseURL,t.url,t.allowAbsoluteUrls);return Et(r,t.params,t.paramsSerializer)}};u.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}))}}),u.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 Rn=class ir{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 ir(function(o){t=o}),cancel:t}}};function In(e){return function(r){return e.apply(null,r)}}function Pn(e){return u.isObject(e)&&e.isAxiosError===!0}const tt={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(tt).forEach(([e,t])=>{tt[t]=e});function Kt(e){const t=new fe(e),r=dt(fe.prototype.request,t);return u.extend(r,fe.prototype,t,{allOwnKeys:!0}),u.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return Kt(pe(e,o))},r}const H=Kt(Te);H.Axios=fe,H.CanceledError=we,H.CancelToken=Rn,H.isCancel=Pt,H.VERSION=Yt,H.toFormData=Ue,H.AxiosError=A,H.Cancel=H.CanceledError,H.all=function(t){return Promise.all(t)},H.spread=In,H.isAxiosError=Pn,H.mergeConfig=pe,H.AxiosHeaders=ne,H.formToJSON=e=>Rt(u.isHTMLForm(e)?new FormData(e):e),H.getAdapter=$t.getAdapter,H.HttpStatusCode=tt,H.default=H;const{Axios:ys,AxiosError:bs,CanceledError:ws,isCancel:Ss,CancelToken:js,VERSION:vs,all:ks,Cancel:Es,isAxiosError:Cs,spread:Ts,toFormData:Rs,AxiosHeaders:Is,HttpStatusCode:Ps,formToJSON:Os,getAdapter:_s,mergeConfig:As}=H;class On{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=H.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)throw new Error("HTTP method is required");if(!r)throw new Error("Request path is required");try{const i={...this.appId?{appId:this.appId}:{},...s||{}};return(await this.client.request({url:r,method:t,data:i,headers:o})).data}catch(i){if(console.error("❌ [Request Error]:",i),i.isAxiosError){const a=i.response?.status||0,l=i.response?.data?.message||i.message||"Unknown Axios error occurred";throw new Error(`Request failed (${a}): ${l}`)}throw new Error(`Unexpected error: ${i.message||"Unknown failure"}`)}}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 We={exports:{}},Ie={};/**
7
7
  * @license React
8
8
  * react-jsx-runtime.production.js
9
9
  *
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * This source code is licensed under the MIT license found in the
13
13
  * LICENSE file in the root directory of this source tree.
14
- */var Jt;function On(){if(Jt)return Ie;Jt=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,o,i){var a=null;if(i!==void 0&&(a=""+i),o.key!==void 0&&(a=""+o.key),"key"in o){i={};for(var l in o)l!=="key"&&(i[l]=o[l])}else i=o;return o=i.ref,{$$typeof:e,type:s,key:a,ref:o!==void 0?o:null,props:i}}return Ie.Fragment=t,Ie.jsx=r,Ie.jsxs=r,Ie}var Pe={};/**
14
+ */var Jt;function _n(){if(Jt)return Ie;Jt=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,o,i){var a=null;if(i!==void 0&&(a=""+i),o.key!==void 0&&(a=""+o.key),"key"in o){i={};for(var l in o)l!=="key"&&(i[l]=o[l])}else i=o;return o=i.ref,{$$typeof:e,type:s,key:a,ref:o!==void 0?o:null,props:i}}return Ie.Fragment=t,Ie.jsx=r,Ie.jsxs=r,Ie}var Pe={};/**
15
15
  * @license React
16
16
  * react-jsx-runtime.development.js
17
17
  *
@@ -19,192 +19,192 @@
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 Xt;function _n(){return Xt||(Xt=1,process.env.NODE_ENV!=="production"&&(function(){function e(x){if(x==null)return null;if(typeof x=="function")return x.$$typeof===K?null:x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case b:return"Fragment";case U:return"Profiler";case g:return"StrictMode";case M:return"Suspense";case y:return"SuspenseList";case F:return"Activity"}if(typeof x=="object")switch(typeof x.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),x.$$typeof){case d:return"Portal";case P:return(x.displayName||"Context")+".Provider";case z:return(x._context.displayName||"Context")+".Consumer";case C:var E=x.render;return x=x.displayName,x||(x=E.displayName||E.name||"",x=x!==""?"ForwardRef("+x+")":"ForwardRef"),x;case O:return E=x.displayName||null,E!==null?E:e(x.type)||"Memo";case w:E=x._payload,x=x._init;try{return e(x(E))}catch{}}return null}function t(x){return""+x}function r(x){try{t(x);var E=!1}catch{E=!0}if(E){E=console;var N=E.error,W=typeof Symbol=="function"&&Symbol.toStringTag&&x[Symbol.toStringTag]||x.constructor.name||"Object";return N.call(E,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",W),t(x)}}function s(x){if(x===b)return"<>";if(typeof x=="object"&&x!==null&&x.$$typeof===w)return"<...>";try{var E=e(x);return E?"<"+E+">":"<...>"}catch{return"<...>"}}function o(){var x=D.A;return x===null?null:x.getOwner()}function i(){return Error("react-stack-top-frame")}function a(x){if(q.call(x,"key")){var E=Object.getOwnPropertyDescriptor(x,"key").get;if(E&&E.isReactWarning)return!1}return x.key!==void 0}function l(x,E){function N(){Z||(Z=!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)",E))}N.isReactWarning=!0,Object.defineProperty(x,"key",{get:N,configurable:!0})}function h(){var x=e(this.type);return B[x]||(B[x]=!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.")),x=this.props.ref,x!==void 0?x:null}function p(x,E,N,W,f,S,J,se){return N=S.ref,x={$$typeof:v,type:x,key:E,props:S,_owner:f},(N!==void 0?N:null)!==null?Object.defineProperty(x,"ref",{enumerable:!1,get:h}):Object.defineProperty(x,"ref",{enumerable:!1,value:null}),x._store={},Object.defineProperty(x._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(x,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(x,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:J}),Object.defineProperty(x,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:se}),Object.freeze&&(Object.freeze(x.props),Object.freeze(x)),x}function c(x,E,N,W,f,S,J,se){var X=E.children;if(X!==void 0)if(W)if(Q(X)){for(W=0;W<X.length;W++)m(X[W]);Object.freeze&&Object.freeze(X)}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 m(X);if(q.call(E,"key")){X=e(x);var ae=Object.keys(E).filter(function(ve){return ve!=="key"});W=0<ae.length?"{key: someKey, "+ae.join(": ..., ")+": ...}":"{key: someKey}",Y[X+W]||(ae=0<ae.length?"{"+ae.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
22
+ */var Xt;function An(){return Xt||(Xt=1,process.env.NODE_ENV!=="production"&&(function(){function e(x){if(x==null)return null;if(typeof x=="function")return x.$$typeof===K?null:x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case b:return"Fragment";case U:return"Profiler";case g:return"StrictMode";case M:return"Suspense";case y:return"SuspenseList";case F:return"Activity"}if(typeof x=="object")switch(typeof x.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),x.$$typeof){case d:return"Portal";case P:return(x.displayName||"Context")+".Provider";case z:return(x._context.displayName||"Context")+".Consumer";case C:var E=x.render;return x=x.displayName,x||(x=E.displayName||E.name||"",x=x!==""?"ForwardRef("+x+")":"ForwardRef"),x;case O:return E=x.displayName||null,E!==null?E:e(x.type)||"Memo";case w:E=x._payload,x=x._init;try{return e(x(E))}catch{}}return null}function t(x){return""+x}function r(x){try{t(x);var E=!1}catch{E=!0}if(E){E=console;var N=E.error,W=typeof Symbol=="function"&&Symbol.toStringTag&&x[Symbol.toStringTag]||x.constructor.name||"Object";return N.call(E,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",W),t(x)}}function s(x){if(x===b)return"<>";if(typeof x=="object"&&x!==null&&x.$$typeof===w)return"<...>";try{var E=e(x);return E?"<"+E+">":"<...>"}catch{return"<...>"}}function o(){var x=D.A;return x===null?null:x.getOwner()}function i(){return Error("react-stack-top-frame")}function a(x){if(q.call(x,"key")){var E=Object.getOwnPropertyDescriptor(x,"key").get;if(E&&E.isReactWarning)return!1}return x.key!==void 0}function l(x,E){function N(){Z||(Z=!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)",E))}N.isReactWarning=!0,Object.defineProperty(x,"key",{get:N,configurable:!0})}function h(){var x=e(this.type);return B[x]||(B[x]=!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.")),x=this.props.ref,x!==void 0?x:null}function p(x,E,N,W,f,j,J,se){return N=j.ref,x={$$typeof:v,type:x,key:E,props:j,_owner:f},(N!==void 0?N:null)!==null?Object.defineProperty(x,"ref",{enumerable:!1,get:h}):Object.defineProperty(x,"ref",{enumerable:!1,value:null}),x._store={},Object.defineProperty(x._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(x,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(x,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:J}),Object.defineProperty(x,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:se}),Object.freeze&&(Object.freeze(x.props),Object.freeze(x)),x}function c(x,E,N,W,f,j,J,se){var X=E.children;if(X!==void 0)if(W)if(Q(X)){for(W=0;W<X.length;W++)m(X[W]);Object.freeze&&Object.freeze(X)}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 m(X);if(q.call(E,"key")){X=e(x);var ae=Object.keys(E).filter(function(ve){return ve!=="key"});W=0<ae.length?"{key: someKey, "+ae.join(": ..., ")+": ...}":"{key: someKey}",Y[X+W]||(ae=0<ae.length?"{"+ae.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} />`,W,X,ae,X),Y[X+W]=!0)}if(X=null,N!==void 0&&(r(N),X=""+N),a(E)&&(r(E.key),X=""+E.key),"key"in E){N={};for(var de in E)de!=="key"&&(N[de]=E[de])}else N=E;return X&&l(N,typeof x=="function"?x.displayName||x.name||"Unknown":x),p(x,X,S,f,o(),N,J,se)}function m(x){typeof x=="object"&&x!==null&&x.$$typeof===v&&x._store&&(x._store.validated=1)}var I=j,v=Symbol.for("react.transitional.element"),d=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),P=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),K=Symbol.for("react.client.reference"),D=I.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,Q=Array.isArray,k=console.createTask?console.createTask:function(){return null};I={react_stack_bottom_frame:function(x){return x()}};var Z,B={},L=I.react_stack_bottom_frame.bind(I,i)(),R=k(s(i)),Y={};Pe.Fragment=b,Pe.jsx=function(x,E,N,W,f){var S=1e4>D.recentlyCreatedOwnerStacks++;return c(x,E,N,!1,W,f,S?Error("react-stack-top-frame"):L,S?k(s(x)):R)},Pe.jsxs=function(x,E,N,W,f){var S=1e4>D.recentlyCreatedOwnerStacks++;return c(x,E,N,!0,W,f,S?Error("react-stack-top-frame"):L,S?k(s(x)):R)}})()),Pe}var Gt;function An(){return Gt||(Gt=1,process.env.NODE_ENV==="production"?We.exports=On():We.exports=_n()),We.exports}var n=An();const zn=async(e,t)=>{const{name:r,email:s,password:o,appId:i,phone:a,address:l,avatarUrl:h,isActive:p=!0,role:c="user"}=e,{baseUrl:m,apiKey:I}=t;if(!I)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 v=await $.post(`${m}/users/signup`,{name:r,email:s,password:o,appId:i,phone:a,address:l,avatarUrl:h,isActive:p,role:c},{headers:{"Content-Type":"application/json","x-api-key":I}});return v.data?.user&&localStorage.setItem("userInfo",JSON.stringify(v.data.user)),v.data.user}catch(v){const d=v.response?.data?.message||v.message||"Signup failed";if(console.error("Signup API Error:",d),v.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 v.response?.status===404?{success:!1,message:"Invalid or inactive app",status:404}:{success:!1,message:d,status:v.response?.status||500}}};/**
27
+ <%s key={someKey} {...props} />`,W,X,ae,X),Y[X+W]=!0)}if(X=null,N!==void 0&&(r(N),X=""+N),a(E)&&(r(E.key),X=""+E.key),"key"in E){N={};for(var de in E)de!=="key"&&(N[de]=E[de])}else N=E;return X&&l(N,typeof x=="function"?x.displayName||x.name||"Unknown":x),p(x,X,j,f,o(),N,J,se)}function m(x){typeof x=="object"&&x!==null&&x.$$typeof===v&&x._store&&(x._store.validated=1)}var I=S,v=Symbol.for("react.transitional.element"),d=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),P=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),K=Symbol.for("react.client.reference"),D=I.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,Q=Array.isArray,k=console.createTask?console.createTask:function(){return null};I={react_stack_bottom_frame:function(x){return x()}};var Z,B={},L=I.react_stack_bottom_frame.bind(I,i)(),R=k(s(i)),Y={};Pe.Fragment=b,Pe.jsx=function(x,E,N,W,f){var j=1e4>D.recentlyCreatedOwnerStacks++;return c(x,E,N,!1,W,f,j?Error("react-stack-top-frame"):L,j?k(s(x)):R)},Pe.jsxs=function(x,E,N,W,f){var j=1e4>D.recentlyCreatedOwnerStacks++;return c(x,E,N,!0,W,f,j?Error("react-stack-top-frame"):L,j?k(s(x)):R)}})()),Pe}var Gt;function zn(){return Gt||(Gt=1,process.env.NODE_ENV==="production"?We.exports=_n():We.exports=An()),We.exports}var n=zn();const Nn=async(e,t)=>{const{name:r,email:s,password:o,appId:i,phone:a,address:l,avatarUrl:h,isActive:p=!0,role:c="user"}=e,{baseUrl:m,apiKey:I}=t;if(!I)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 v=await H.post(`${m}/users/signup`,{name:r,email:s,password:o,appId:i,phone:a,address:l,avatarUrl:h,isActive:p,role:c},{headers:{"Content-Type":"application/json","x-api-key":I}});return v.data?.user&&localStorage.setItem("userInfo",JSON.stringify(v.data.user)),v.data.user}catch(v){const d=v.response?.data?.message||v.message||"Signup failed";if(console.error("Signup API Error:",d),v.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 v.response?.status===404?{success:!1,message:"Invalid or inactive app",status:404}:{success:!1,message:d,status:v.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.
31
31
  * See the LICENSE file in the root directory of this source tree.
32
- */const Nn=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Un=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,s)=>s?s.toUpperCase():r.toLowerCase()),Zt=e=>{const t=Un(e);return t.charAt(0).toUpperCase()+t.slice(1)},Qt=(...e)=>e.filter((t,r,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===r).join(" ").trim(),Dn=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
32
+ */const Un=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Dn=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,s)=>s?s.toUpperCase():r.toLowerCase()),Zt=e=>{const t=Dn(e);return t.charAt(0).toUpperCase()+t.slice(1)},Qt=(...e)=>e.filter((t,r,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===r).join(" ").trim(),Fn=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
33
33
  * @license lucide-react v0.544.0 - ISC
34
34
  *
35
35
  * This source code is licensed under the ISC license.
36
36
  * See the LICENSE file in the root directory of this source tree.
37
- */var Fn={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
37
+ */var Ln={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
38
38
  * @license lucide-react v0.544.0 - ISC
39
39
  *
40
40
  * This source code is licensed under the ISC license.
41
41
  * See the LICENSE file in the root directory of this source tree.
42
- */const Ln=j.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:o="",children:i,iconNode:a,...l},h)=>j.createElement("svg",{ref:h,...Fn,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:Qt("lucide",o),...!i&&!Dn(l)&&{"aria-hidden":"true"},...l},[...a.map(([p,c])=>j.createElement(p,c)),...Array.isArray(i)?i:[i]]));/**
42
+ */const Mn=S.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:o="",children:i,iconNode:a,...l},h)=>S.createElement("svg",{ref:h,...Ln,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:Qt("lucide",o),...!i&&!Fn(l)&&{"aria-hidden":"true"},...l},[...a.map(([p,c])=>S.createElement(p,c)),...Array.isArray(i)?i:[i]]));/**
43
43
  * @license lucide-react v0.544.0 - ISC
44
44
  *
45
45
  * This source code is licensed under the ISC license.
46
46
  * See the LICENSE file in the root directory of this source tree.
47
- */const H=(e,t)=>{const r=j.forwardRef(({className:s,...o},i)=>j.createElement(Ln,{ref:i,iconNode:t,className:Qt(`lucide-${Nn(Zt(e))}`,`lucide-${e}`,s),...o}));return r.displayName=Zt(e),r};/**
47
+ */const $=(e,t)=>{const r=S.forwardRef(({className:s,...o},i)=>S.createElement(Mn,{ref:i,iconNode:t,className:Qt(`lucide-${Un(Zt(e))}`,`lucide-${e}`,s),...o}));return r.displayName=Zt(e),r};/**
48
48
  * @license lucide-react v0.544.0 - ISC
49
49
  *
50
50
  * This source code is licensed under the ISC license.
51
51
  * See the LICENSE file in the root directory of this source tree.
52
- */const rt=H("camera",[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
52
+ */const rt=$("camera",[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
53
53
  * @license lucide-react v0.544.0 - ISC
54
54
  *
55
55
  * This source code is licensed under the ISC license.
56
56
  * See the LICENSE file in the root directory of this source tree.
57
- */const Mn=H("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
57
+ */const Bn=$("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
58
58
  * @license lucide-react v0.544.0 - ISC
59
59
  *
60
60
  * This source code is licensed under the ISC license.
61
61
  * See the LICENSE file in the root directory of this source tree.
62
- */const le=H("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
62
+ */const le=$("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
63
63
  * @license lucide-react v0.544.0 - ISC
64
64
  *
65
65
  * This source code is licensed under the ISC license.
66
66
  * See the LICENSE file in the root directory of this source tree.
67
- */const xe=H("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
67
+ */const xe=$("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
68
68
  * @license lucide-react v0.544.0 - ISC
69
69
  *
70
70
  * This source code is licensed under the ISC license.
71
71
  * See the LICENSE file in the root directory of this source tree.
72
- */const nt=H("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
72
+ */const nt=$("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
73
73
  * @license lucide-react v0.544.0 - ISC
74
74
  *
75
75
  * This source code is licensed under the ISC license.
76
76
  * See the LICENSE file in the root directory of this source tree.
77
- */const Bn=H("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
77
+ */const Wn=$("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
78
78
  * @license lucide-react v0.544.0 - ISC
79
79
  *
80
80
  * This source code is licensed under the ISC license.
81
81
  * See the LICENSE file in the root directory of this source tree.
82
- */const Wn=H("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
82
+ */const Hn=$("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
83
83
  * @license lucide-react v0.544.0 - ISC
84
84
  *
85
85
  * This source code is licensed under the ISC license.
86
86
  * See the LICENSE file in the root directory of this source tree.
87
- */const st=H("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
87
+ */const st=$("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
88
88
  * @license lucide-react v0.544.0 - ISC
89
89
  *
90
90
  * This source code is licensed under the ISC license.
91
91
  * See the LICENSE file in the root directory of this source tree.
92
- */const ot=H("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
92
+ */const ot=$("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
93
93
  * @license lucide-react v0.544.0 - ISC
94
94
  *
95
95
  * This source code is licensed under the ISC license.
96
96
  * See the LICENSE file in the root directory of this source tree.
97
- */const $n=H("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]);/**
97
+ */const $n=$("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]);/**
98
98
  * @license lucide-react v0.544.0 - ISC
99
99
  *
100
100
  * This source code is licensed under the ISC license.
101
101
  * See the LICENSE file in the root directory of this source tree.
102
- */const er=H("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
102
+ */const er=$("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
103
103
  * @license lucide-react v0.544.0 - ISC
104
104
  *
105
105
  * This source code is licensed under the ISC license.
106
106
  * See the LICENSE file in the root directory of this source tree.
107
- */const tr=H("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
107
+ */const tr=$("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
108
108
  * @license lucide-react v0.544.0 - ISC
109
109
  *
110
110
  * This source code is licensed under the ISC license.
111
111
  * See the LICENSE file in the root directory of this source tree.
112
- */const rr=H("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
112
+ */const rr=$("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
113
113
  * @license lucide-react v0.544.0 - ISC
114
114
  *
115
115
  * This source code is licensed under the ISC license.
116
116
  * See the LICENSE file in the root directory of this source tree.
117
- */const Hn=H("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
117
+ */const Vn=$("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
118
118
  * @license lucide-react v0.544.0 - ISC
119
119
  *
120
120
  * This source code is licensed under the ISC license.
121
121
  * See the LICENSE file in the root directory of this source tree.
122
- */const ce=H("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
122
+ */const ce=$("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
123
123
  * @license lucide-react v0.544.0 - ISC
124
124
  *
125
125
  * This source code is licensed under the ISC license.
126
126
  * See the LICENSE file in the root directory of this source tree.
127
- */const Vn=H("loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/**
127
+ */const Yn=$("loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/**
128
128
  * @license lucide-react v0.544.0 - ISC
129
129
  *
130
130
  * This source code is licensed under the ISC license.
131
131
  * See the LICENSE file in the root directory of this source tree.
132
- */const Se=H("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
132
+ */const Se=$("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
133
133
  * @license lucide-react v0.544.0 - ISC
134
134
  *
135
135
  * This source code is licensed under the ISC license.
136
136
  * See the LICENSE file in the root directory of this source tree.
137
- */const at=H("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);/**
137
+ */const at=$("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);/**
138
138
  * @license lucide-react v0.544.0 - ISC
139
139
  *
140
140
  * This source code is licensed under the ISC license.
141
141
  * See the LICENSE file in the root directory of this source tree.
142
- */const he=H("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]);/**
142
+ */const he=$("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]);/**
143
143
  * @license lucide-react v0.544.0 - ISC
144
144
  *
145
145
  * This source code is licensed under the ISC license.
146
146
  * See the LICENSE file in the root directory of this source tree.
147
- */const Yn=H("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
147
+ */const qn=$("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
148
148
  * @license lucide-react v0.544.0 - ISC
149
149
  *
150
150
  * This source code is licensed under the ISC license.
151
151
  * See the LICENSE file in the root directory of this source tree.
152
- */const qn=H("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/**
152
+ */const Kn=$("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/**
153
153
  * @license lucide-react v0.544.0 - ISC
154
154
  *
155
155
  * This source code is licensed under the ISC license.
156
156
  * See the LICENSE file in the root directory of this source tree.
157
- */const Kn=H("phone",[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]]);/**
157
+ */const Jn=$("phone",[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]]);/**
158
158
  * @license lucide-react v0.544.0 - ISC
159
159
  *
160
160
  * This source code is licensed under the ISC license.
161
161
  * See the LICENSE file in the root directory of this source tree.
162
- */const Jn=H("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
162
+ */const Xn=$("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
163
163
  * @license lucide-react v0.544.0 - ISC
164
164
  *
165
165
  * This source code is licensed under the ISC license.
166
166
  * See the LICENSE file in the root directory of this source tree.
167
- */const nr=H("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
167
+ */const nr=$("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
168
168
  * @license lucide-react v0.544.0 - ISC
169
169
  *
170
170
  * This source code is licensed under the ISC license.
171
171
  * See the LICENSE file in the root directory of this source tree.
172
- */const Xn=H("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
172
+ */const Gn=$("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
173
173
  * @license lucide-react v0.544.0 - ISC
174
174
  *
175
175
  * This source code is licensed under the ISC license.
176
176
  * See the LICENSE file in the root directory of this source tree.
177
- */const sr=H("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
177
+ */const sr=$("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
178
178
  * @license lucide-react v0.544.0 - ISC
179
179
  *
180
180
  * This source code is licensed under the ISC license.
181
181
  * See the LICENSE file in the root directory of this source tree.
182
- */const $e=H("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);/**
182
+ */const He=$("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);/**
183
183
  * @license lucide-react v0.544.0 - ISC
184
184
  *
185
185
  * This source code is licensed under the ISC license.
186
186
  * See the LICENSE file in the root directory of this source tree.
187
- */const or=H("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
187
+ */const or=$("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
188
188
  * @license lucide-react v0.544.0 - ISC
189
189
  *
190
190
  * This source code is licensed under the ISC license.
191
191
  * See the LICENSE file in the root directory of this source tree.
192
- */const Gn=H("user-x",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/**
192
+ */const Zn=$("user-x",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/**
193
193
  * @license lucide-react v0.544.0 - ISC
194
194
  *
195
195
  * This source code is licensed under the ISC license.
196
196
  * See the LICENSE file in the root directory of this source tree.
197
- */const je=H("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
197
+ */const je=$("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
198
198
  * @license lucide-react v0.544.0 - ISC
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 Oe=H("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),He={baseUrl:"",apiKey:"",appId:""},Zn=e=>{if(!e.baseUrl||!e.apiKey||!e.appId)throw new Error("baseUrl, apiKey, and appId are required");He.baseUrl=e.baseUrl,He.apiKey=e.apiKey,He.appId=e.appId},ge=()=>He,Qn=({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:p,onSuccess:c,onError:m})=>{const{baseUrl:I,apiKey:v,appId:d}=ge(),b={name:"",email:"",password:"",...h&&{avatarUrl:""}},[g,U]=j.useState(b),[z,P]=j.useState(!1),[C,M]=j.useState(!1),[y,O]=j.useState(null),[w,F]=j.useState({}),K=typeof window<"u"?window.innerWidth<768:!1,D=l?"#ffffff":"#111827",q=l?"#a1a1aa":"#6b7280",Q=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",k=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",Z=Y=>{const{name:x,value:E}=Y.target;U(N=>({...N,[x]:E})),w[x]&&F(N=>({...N,[x]:void 0}))},B=()=>{const Y={};return g.name.trim()||(Y.name="Name is required"),g.email.trim()?/\S+@\S+\.\S+/.test(g.email)||(Y.email="Invalid email address"):Y.email="Email is required",g.password?g.password.length<6&&(Y.password="Password must be at least 6 characters"):Y.password="Password is required",F(Y),Object.keys(Y).length===0},L=async Y=>{if(Y.preventDefault(),!!B()){M(!0),O(null);try{const x={...g,appId:d},E=await zn(x,{baseUrl:I,apiKey:v});O({type:"success",text:"Account created successfully!"}),c&&c(E)}catch(x){const E=x.message||"Signup failed. Please try again.";O({type:"error",text:E}),m&&m(x)}finally{M(!1)}}},R={width:"100%",padding:K?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:Q,border:`1px solid ${k}`,borderRadius:"10px",color:D,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:D,margin:0},children:r}),n.jsx("p",{style:{fontSize:"14px",color:q},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:Y=>{const x=Y.target;x.style.display="none"}})}),n.jsxs("form",{onSubmit:L,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:D},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:q}}),n.jsx("input",{id:"signup-name",type:"text",name:"name",placeholder:"Enter your full name",value:g.name,onChange:Z,style:{...R,borderColor:w.name?"#ef4444":k}})]}),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:D},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:q}}),n.jsx("input",{id:"signup-email",type:"email",name:"email",placeholder:"Enter your email address",value:g.email,onChange:Z,style:{...R,borderColor:w.email?"#ef4444":k}})]}),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:D},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:q}}),n.jsx("input",{id:"signup-password",type:z?"text":"password",name:"password",placeholder:"Create a secure password",value:g.password,onChange:Z,style:{...R,borderColor:w.password?"#ef4444":k}}),n.jsx("button",{type:"button",onClick:()=>P(!z),style:{position:"absolute",right:"14px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:q,cursor:"pointer",padding:"4px"},children:z?n.jsx(st,{size:20}):n.jsx(ot,{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:D},children:"Avatar URL (Optional)"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(er,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:q}}),n.jsx("input",{id:"signup-avatar",type:"url",name:"avatarUrl",placeholder:"Paste your avatar image URL",value:g.avatarUrl||"",onChange:Z,style:R})]})]}),p&&n.jsx("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:n.jsx("a",{href:p,style:{color:i,textDecoration:"none",fontWeight:500},children:"Already have an account?"})}),y&&n.jsxs("div",{style:{padding:"12px",borderRadius:"12px",fontSize:"12px",display:"flex",alignItems:"start",gap:"10px",backgroundColor:y.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:y.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:y.type==="success"?i:"#ef4444"},children:[y.type==="success"?n.jsx(xe,{size:20}):n.jsx(le,{size:20}),n.jsx("span",{children:y.text})]}),n.jsx("button",{type:"submit",disabled:C,style:{padding:"12px",background:a,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600,cursor:C?"not-allowed":"pointer",opacity:C?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:C?n.jsxs(n.Fragment,{children:[n.jsx(Vn,{size:18,style:{animation:"spin 1s linear infinite"}}),"Creating Account..."]}):"Create Account"})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:q,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:`
202
+ */const Oe=$("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),$e={baseUrl:"",apiKey:"",appId:""},Qn=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,es=({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:p,onSuccess:c,onError:m})=>{const{baseUrl:I,apiKey:v,appId:d}=ge(),b={name:"",email:"",password:"",...h&&{avatarUrl:""}},[g,U]=S.useState(b),[z,P]=S.useState(!1),[C,M]=S.useState(!1),[y,O]=S.useState(null),[w,F]=S.useState({}),K=typeof window<"u"?window.innerWidth<768:!1,D=l?"#ffffff":"#111827",q=l?"#a1a1aa":"#6b7280",Q=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",k=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",Z=Y=>{const{name:x,value:E}=Y.target;U(N=>({...N,[x]:E})),w[x]&&F(N=>({...N,[x]:void 0}))},B=()=>{const Y={};return g.name.trim()||(Y.name="Name is required"),g.email.trim()?/\S+@\S+\.\S+/.test(g.email)||(Y.email="Invalid email address"):Y.email="Email is required",g.password?g.password.length<6&&(Y.password="Password must be at least 6 characters"):Y.password="Password is required",F(Y),Object.keys(Y).length===0},L=async Y=>{if(Y.preventDefault(),!!B()){M(!0),O(null);try{const x={...g,appId:d},E=await Nn(x,{baseUrl:I,apiKey:v});O({type:"success",text:"Account created successfully!"}),c&&c(E)}catch(x){const E=x.message||"Signup failed. Please try again.";O({type:"error",text:E}),m&&m(x)}finally{M(!1)}}},R={width:"100%",padding:K?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:Q,border:`1px solid ${k}`,borderRadius:"10px",color:D,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:D,margin:0},children:r}),n.jsx("p",{style:{fontSize:"14px",color:q},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:Y=>{const x=Y.target;x.style.display="none"}})}),n.jsxs("form",{onSubmit:L,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:D},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:q}}),n.jsx("input",{id:"signup-name",type:"text",name:"name",placeholder:"Enter your full name",value:g.name,onChange:Z,style:{...R,borderColor:w.name?"#ef4444":k}})]}),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:D},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:q}}),n.jsx("input",{id:"signup-email",type:"email",name:"email",placeholder:"Enter your email address",value:g.email,onChange:Z,style:{...R,borderColor:w.email?"#ef4444":k}})]}),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:D},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:q}}),n.jsx("input",{id:"signup-password",type:z?"text":"password",name:"password",placeholder:"Create a secure password",value:g.password,onChange:Z,style:{...R,borderColor:w.password?"#ef4444":k}}),n.jsx("button",{type:"button",onClick:()=>P(!z),style:{position:"absolute",right:"14px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:q,cursor:"pointer",padding:"4px"},children:z?n.jsx(st,{size:20}):n.jsx(ot,{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:D},children:"Avatar URL (Optional)"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(er,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:q}}),n.jsx("input",{id:"signup-avatar",type:"url",name:"avatarUrl",placeholder:"Paste your avatar image URL",value:g.avatarUrl||"",onChange:Z,style:R})]})]}),p&&n.jsx("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:n.jsx("a",{href:p,style:{color:i,textDecoration:"none",fontWeight:500},children:"Already have an account?"})}),y&&n.jsxs("div",{style:{padding:"12px",borderRadius:"12px",fontSize:"12px",display:"flex",alignItems:"start",gap:"10px",backgroundColor:y.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:y.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:y.type==="success"?i:"#ef4444"},children:[y.type==="success"?n.jsx(xe,{size:20}):n.jsx(le,{size:20}),n.jsx("span",{children:y.text})]}),n.jsx("button",{type:"submit",disabled:C,style:{padding:"12px",background:a,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600,cursor:C?"not-allowed":"pointer",opacity:C?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:C?n.jsxs(n.Fragment,{children:[n.jsx(Yn,{size:18,style:{animation:"spin 1s linear infinite"}}),"Creating Account..."]}):"Create Account"})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:q,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
- `})]})},es=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 $.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}}},ts=({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:p,onError:c})=>{const{baseUrl:m,apiKey:I,appId:v}=ge(),[d,b]=j.useState("login"),[g,U]=j.useState(1),[z,P]=j.useState(!1),[C,M]=j.useState(!1),[y,O]=j.useState(null),[w,F]=j.useState(""),[K,D]=j.useState(""),[q,Q]=j.useState({email:"",otp:"",newPassword:"",appId:v}),k=window.innerWidth<768,Z=l?"#ffffff":"#111827",B=l?"#a1a1aa":"#6b7280",L=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",R=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",Y=async f=>{f.preventDefault(),M(!0),O(null);try{const S=await es({email:w,password:K,appId:v},{baseUrl:m,apiKey:I});O({type:"success",text:`Welcome ${S.name}`}),p?.(S)}catch(S){const J=S.message||"Login failed";O({type:"error",text:J}),c?.(S)}finally{M(!1)}},x=f=>{Q({...q,[f.target.name]:f.target.value})},E=async f=>{f.preventDefault(),M(!0),O(null);try{const S=await $.post(`${m}/users/forgot-password`,{email:q.email,appId:v},{headers:{"x-api-key":I}});S.data.success?(U(2),O({type:"success",text:"OTP sent to your email"})):O({type:"error",text:S.data.message||"Failed to send OTP"})}catch(S){O({type:"error",text:S.response?.data?.message||"Something went wrong"})}finally{M(!1)}},N=async f=>{f.preventDefault(),M(!0),O(null);try{const S=await $.post(`${m}/users/reset-password`,q,{headers:{"x-api-key":I}});S.data.success?(O({type:"success",text:"Password reset successfully!"}),U(1),Q({email:"",otp:"",newPassword:"",appId:v}),b("login")):O({type:"error",text:S.data.message||"Reset failed"})}catch(S){O({type:"error",text:S.response?.data?.message||"Something went wrong"})}finally{M(!1)}},W={width:"100%",padding:k?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:L,border:`1px solid ${R}`,borderRadius:"10px",color:Z,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:k?"320px":"380px",maxWidth:k?"340px":"390px",width:"100%",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:Z,margin:0},children:d==="login"?r:g===1?"Forgot Password":"Reset Password"}),n.jsx("p",{style:{fontSize:"14px",color:B},children:d==="login"?s:"Follow the steps to reset your password"})]}),d==="login"&&n.jsxs("form",{onSubmit:Y,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:B}}),n.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:w,onChange:f=>F(f.target.value),style:W})]})]}),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:B}}),n.jsx("input",{id:"login-password",type:z?"text":"password",placeholder:"Enter your password",value:K,onChange:f=>D(f.target.value),style:W}),n.jsx("button",{type:"button",onClick:()=>P(!z),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:B,cursor:"pointer"},children:z?n.jsx(st,{size:20}):n.jsx(ot,{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:C,style:{padding:"12px",background:a,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600},children:C?"Signing In...":"Sign In"})]}),d==="forgot"&&n.jsxs("form",{onSubmit:g===1?E:N,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:B}}),n.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:q.email,onChange:x,style:W})]})]}):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(tr,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:B}}),n.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:q.otp,onChange:x,style:W})]})]}),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:B}}),n.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:q.newPassword,onChange:x,style:W})]})]})]}),n.jsx("button",{type:"submit",disabled:C,style:{padding:"12px",background:a,color:"#fff",border:"none",fontSize:"14px",borderRadius:"10px",fontWeight:600},children:C?"Please wait...":g===1?"Send Reset OTP":"Reset Password"}),n.jsx("button",{type:"button",onClick:()=>{b("login"),U(1)},style:{background:"none",border:"none",fontSize:"14px",color:B,marginTop:"6px",cursor:"pointer"},children:"Back to Login"})]}),y&&n.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:y.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:y.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:y.type==="success"?i:"#ef4444"},children:[y.type==="success"?n.jsx(xe,{size:20}):n.jsx(le,{size:20}),n.jsx("span",{children:y.text})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:B,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]})})},rs=()=>{try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},ns=({children:e,fallback:t=null,width:r,height:s})=>{if(!rs())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})},ss=()=>{try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},os=({children:e,fallback:t=null,width:r,height:s})=>{if(ss())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})},as=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:o,token:i,colors:a})=>{const{baseUrl:l,apiKey:h,appId:p}=ge(),[c,m]=j.useState(!1),[I,v]=j.useState(""),[d,b]=j.useState("warning"),[g,U]=j.useState(!1);if(j.useEffect(()=>{const y=()=>{U(window.innerWidth<640)};return y(),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[]),!e)return null;const z=async()=>{m(!0),b("processing");try{const{data:y}=await $.delete(`${l}/users/delete/${o}`,{data:{appId:p},headers:{"x-api-key":h}});y.success?(r(y.message||"Account deleted successfully"),b("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(s(y.message||"Failed to delete account"),b("warning"))}catch(y){s(y.response?.data?.message||"Something went wrong"),b("warning")}finally{m(!1)}},P=I.toLowerCase()==="delete my account",C=y=>{y.target===y.currentTarget&&d!=="processing"&&d!=="success"&&t()},M=()=>{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($e,{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:y=>{y.currentTarget.style.backgroundColor=a.border,y.currentTarget.style.color=a.textPrimary},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent",y.currentTarget.style.color=a.textTertiary},children:n.jsx(Oe,{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(or,{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(Bn,{size:16}),text:"All your data will be permanently deleted"},{icon:n.jsx(Gn,{size:16}),text:"This action cannot be reversed"},{icon:n.jsx(at,{size:16}),text:"You will lose access to all services"}].map((y,O)=>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:y.icon}),n.jsx("span",{children:y.text})]},O))})]})]}),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:y=>{y.currentTarget.style.backgroundColor=a.border,y.currentTarget.style.transform="translateY(-1px)"},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent",y.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:y=>{y.currentTarget.style.transform="translateY(-1px)",y.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)"},onMouseOut:y=>{y.currentTarget.style.transform="translateY(0)",y.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)"},children:[n.jsx($e,{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(or,{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:I,onChange:y=>v(y.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${P?a.success:a.error}`,backgroundColor:"transparent",color:a.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:y=>{y.target.style.boxShadow=`0 0 0 3px ${a.accent}20`},onBlur:y=>{y.target.style.boxShadow="none"},autoFocus:!0}),P&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"10px",color:a.success,fontSize:"14px",fontWeight:500},children:[n.jsx(nt,{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"),v("")},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:y=>{y.currentTarget.style.backgroundColor=a.border,y.currentTarget.style.transform="translateY(-1px)"},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent",y.currentTarget.style.transform="translateY(0)"},children:"Go Back"}),n.jsxs("button",{onClick:z,disabled:!P||c,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:!P||c?"not-allowed":"pointer",flex:g?"none":1,minWidth:g?"100%":"140px",opacity:!P||c?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:!P||c?"none":"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:y=>{P&&!c&&(y.currentTarget.style.transform="translateY(-1px)",y.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)")},onMouseOut:y=>{P&&!c&&(y.currentTarget.style.transform="translateY(0)",y.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)")},children:[n.jsx($e,{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((y,O)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",borderRadius:"8px",transition:"all 0.2s ease",backgroundColor:y.active?`${a.accent}10`:"transparent"},children:[n.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:y.active?a.accent:a.textTertiary,transition:"all 0.3s ease",boxShadow:y.active?`0 0 0 4px ${a.accent}20`:"none"}}),n.jsx("span",{style:{fontSize:"14px",color:y.active?a.textPrimary:a.textSecondary,fontWeight:y.active?500:400},children:y.text})]},O))})}),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(sr,{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(nt,{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(nt,{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:C,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:M()}),n.jsx("style",{children:`
207
+ `})]})},ts=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 H.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}}},rs=({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:p,onError:c})=>{const{baseUrl:m,apiKey:I,appId:v}=ge(),[d,b]=S.useState("login"),[g,U]=S.useState(1),[z,P]=S.useState(!1),[C,M]=S.useState(!1),[y,O]=S.useState(null),[w,F]=S.useState(""),[K,D]=S.useState(""),[q,Q]=S.useState({email:"",otp:"",newPassword:"",appId:v}),k=window.innerWidth<768,Z=l?"#ffffff":"#111827",B=l?"#a1a1aa":"#6b7280",L=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",R=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",Y=async f=>{f.preventDefault(),M(!0),O(null);try{const j=await ts({email:w,password:K,appId:v},{baseUrl:m,apiKey:I});O({type:"success",text:`Welcome ${j.name}`}),p?.(j)}catch(j){const J=j.message||"Login failed";O({type:"error",text:J}),c?.(j)}finally{M(!1)}},x=f=>{Q({...q,[f.target.name]:f.target.value})},E=async f=>{f.preventDefault(),M(!0),O(null);try{const j=await H.post(`${m}/users/forgot-password`,{email:q.email,appId:v},{headers:{"x-api-key":I}});j.data.success?(U(2),O({type:"success",text:"OTP sent to your email"})):O({type:"error",text:j.data.message||"Failed to send OTP"})}catch(j){O({type:"error",text:j.response?.data?.message||"Something went wrong"})}finally{M(!1)}},N=async f=>{f.preventDefault(),M(!0),O(null);try{const j=await H.post(`${m}/users/reset-password`,q,{headers:{"x-api-key":I}});j.data.success?(O({type:"success",text:"Password reset successfully!"}),U(1),Q({email:"",otp:"",newPassword:"",appId:v}),b("login")):O({type:"error",text:j.data.message||"Reset failed"})}catch(j){O({type:"error",text:j.response?.data?.message||"Something went wrong"})}finally{M(!1)}},W={width:"100%",padding:k?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:L,border:`1px solid ${R}`,borderRadius:"10px",color:Z,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:k?"320px":"380px",maxWidth:k?"340px":"390px",width:"100%",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:Z,margin:0},children:d==="login"?r:g===1?"Forgot Password":"Reset Password"}),n.jsx("p",{style:{fontSize:"14px",color:B},children:d==="login"?s:"Follow the steps to reset your password"})]}),d==="login"&&n.jsxs("form",{onSubmit:Y,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:B}}),n.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:w,onChange:f=>F(f.target.value),style:W})]})]}),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:B}}),n.jsx("input",{id:"login-password",type:z?"text":"password",placeholder:"Enter your password",value:K,onChange:f=>D(f.target.value),style:W}),n.jsx("button",{type:"button",onClick:()=>P(!z),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:B,cursor:"pointer"},children:z?n.jsx(st,{size:20}):n.jsx(ot,{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:C,style:{padding:"12px",background:a,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600},children:C?"Signing In...":"Sign In"})]}),d==="forgot"&&n.jsxs("form",{onSubmit:g===1?E:N,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:B}}),n.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:q.email,onChange:x,style:W})]})]}):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(tr,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:B}}),n.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:q.otp,onChange:x,style:W})]})]}),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:B}}),n.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:q.newPassword,onChange:x,style:W})]})]})]}),n.jsx("button",{type:"submit",disabled:C,style:{padding:"12px",background:a,color:"#fff",border:"none",fontSize:"14px",borderRadius:"10px",fontWeight:600},children:C?"Please wait...":g===1?"Send Reset OTP":"Reset Password"}),n.jsx("button",{type:"button",onClick:()=>{b("login"),U(1)},style:{background:"none",border:"none",fontSize:"14px",color:B,marginTop:"6px",cursor:"pointer"},children:"Back to Login"})]}),y&&n.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:y.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:y.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:y.type==="success"?i:"#ef4444"},children:[y.type==="success"?n.jsx(xe,{size:20}):n.jsx(le,{size:20}),n.jsx("span",{children:y.text})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:B,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]})})},ns=()=>{if(typeof window>"u")return!1;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})=>{const[o,i]=S.useState(!1);return S.useEffect(()=>{const a=()=>i(ns());return a(),window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)},[]),o?n.jsx("span",{style:{display:"inline-flex",alignItems:"center",verticalAlign:"middle",width:r,height:s},children:e}):n.jsx(n.Fragment,{children:t})},ar=()=>{if(typeof window>"u")return!1;try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},os=({children:e,fallback:t=null,width:r,height:s})=>{const[o,i]=S.useState(!ar());return S.useEffect(()=>{const a=()=>i(!ar());return a(),window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)},[]),o?n.jsx("span",{style:{display:"inline-flex",alignItems:"center",verticalAlign:"middle",width:r,height:s},children:e}):n.jsx(n.Fragment,{children:t})},as=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:o,token:i,colors:a})=>{const{baseUrl:l,apiKey:h,appId:p}=ge(),[c,m]=S.useState(!1),[I,v]=S.useState(""),[d,b]=S.useState("warning"),[g,U]=S.useState(!1);if(S.useEffect(()=>{const y=()=>{U(window.innerWidth<640)};return y(),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[]),!e)return null;const z=async()=>{m(!0),b("processing");try{const{data:y}=await H.delete(`${l}/users/delete/${o}`,{data:{appId:p},headers:{"x-api-key":h}});y.success?(r(y.message||"Account deleted successfully"),b("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(s(y.message||"Failed to delete account"),b("warning"))}catch(y){s(y.response?.data?.message||"Something went wrong"),b("warning")}finally{m(!1)}},P=I.toLowerCase()==="delete my account",C=y=>{y.target===y.currentTarget&&d!=="processing"&&d!=="success"&&t()},M=()=>{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(He,{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:y=>{y.currentTarget.style.backgroundColor=a.border,y.currentTarget.style.color=a.textPrimary},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent",y.currentTarget.style.color=a.textTertiary},children:n.jsx(Oe,{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(or,{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(Wn,{size:16}),text:"All your data will be permanently deleted"},{icon:n.jsx(Zn,{size:16}),text:"This action cannot be reversed"},{icon:n.jsx(at,{size:16}),text:"You will lose access to all services"}].map((y,O)=>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:y.icon}),n.jsx("span",{children:y.text})]},O))})]})]}),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:y=>{y.currentTarget.style.backgroundColor=a.border,y.currentTarget.style.transform="translateY(-1px)"},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent",y.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:y=>{y.currentTarget.style.transform="translateY(-1px)",y.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)"},onMouseOut:y=>{y.currentTarget.style.transform="translateY(0)",y.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)"},children:[n.jsx(He,{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(or,{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:I,onChange:y=>v(y.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${P?a.success:a.error}`,backgroundColor:"transparent",color:a.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:y=>{y.target.style.boxShadow=`0 0 0 3px ${a.accent}20`},onBlur:y=>{y.target.style.boxShadow="none"},autoFocus:!0}),P&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"10px",color:a.success,fontSize:"14px",fontWeight:500},children:[n.jsx(nt,{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"),v("")},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:y=>{y.currentTarget.style.backgroundColor=a.border,y.currentTarget.style.transform="translateY(-1px)"},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent",y.currentTarget.style.transform="translateY(0)"},children:"Go Back"}),n.jsxs("button",{onClick:z,disabled:!P||c,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:!P||c?"not-allowed":"pointer",flex:g?"none":1,minWidth:g?"100%":"140px",opacity:!P||c?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:!P||c?"none":"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:y=>{P&&!c&&(y.currentTarget.style.transform="translateY(-1px)",y.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)")},onMouseOut:y=>{P&&!c&&(y.currentTarget.style.transform="translateY(0)",y.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)")},children:[n.jsx(He,{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((y,O)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",borderRadius:"8px",transition:"all 0.2s ease",backgroundColor:y.active?`${a.accent}10`:"transparent"},children:[n.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:y.active?a.accent:a.textTertiary,transition:"all 0.3s ease",boxShadow:y.active?`0 0 0 4px ${a.accent}20`:"none"}}),n.jsx("span",{style:{fontSize:"14px",color:y.active?a.textPrimary:a.textSecondary,fontWeight:y.active?500:400},children:y.text})]},O))})}),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(sr,{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(nt,{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(nt,{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:C,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:M()}),n.jsx("style",{children:`
208
208
  @keyframes fadeIn {
209
209
  from { opacity: 0; }
210
210
  to { opacity: 1; }
@@ -258,7 +258,7 @@ React keys must be passed directly to JSX without using spread:
258
258
  animation: none !important;
259
259
  }
260
260
  }
261
- `})]})},is=({isOpen:e,onClose:t,onUpdate:r,colors:s})=>{const[o,i]=j.useState(""),[a,l]=j.useState(!1),[h,p]=j.useState(!1),[c,m]=j.useState({isValid:!1,message:"",type:null});if(j.useEffect(()=>{const d=()=>{p(window.innerWidth<640)};return d(),window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[]),j.useEffect(()=>{if(!o.trim()){m({isValid:!1,message:"",type:null});return}try{const d=new URL(o),b=/\.(jpg|jpeg|png|gif|webp|svg)$/i.test(d.pathname);m(b?{isValid:!0,message:"Valid image URL",type:"success"}:{isValid:!1,message:"URL should point to an image file",type:"warning"})}catch{m({isValid:!1,message:"Please enter a valid URL",type:"error"})}},[o]),!e)return null;const I=async()=>{if(!(!o||!c.isValid)){l(!0);try{await r(o)&&(i(""),t())}finally{l(!1)}}},v=d=>{d.target===d.currentTarget&&t()};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:1e3},onClick:v,children:[n.jsxs("div",{style:{backgroundColor:s.surface,border:`1px solid ${s.border}`,borderRadius:"20px",width:"100%",maxWidth:"480px",padding:"24px",boxShadow:"0 32px 64px rgba(0,0,0,0.4)",animation:"modalSlideIn 0.3s ease-out"},className:"avatar-modal-container",children:[n.jsxs("div",{style:{display:"flex",alignItems:"flex-start",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:"44px",height:"44px",borderRadius:"12px",background:`linear-gradient(135deg, ${s.accent}20, ${s.accent}40)`,display:"flex",alignItems:"center",justifyContent:"center",color:s.accent,flexShrink:0},children:n.jsx(rt,{size:22})}),n.jsx("div",{children:n.jsx("h3",{style:{color:s.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Update Avatar"})})]}),n.jsx("button",{onClick:t,"aria-label":"Close avatar modal",style:{background:"transparent",border:"none",color:s.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:d=>{d.currentTarget.style.backgroundColor=s.border,d.currentTarget.style.color=s.textPrimary},onMouseOut:d=>{d.currentTarget.style.backgroundColor="transparent",d.currentTarget.style.color=s.textTertiary},children:n.jsx(Oe,{size:20})})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[n.jsxs("div",{children:[n.jsxs("label",{htmlFor:"avatar-url",style:{display:"flex",marginBottom:"8px",color:s.textPrimary,fontSize:"14px",fontWeight:500,alignItems:"center",gap:"6px"},children:[n.jsx(Hn,{size:16}),"Avatar URL"]}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx("input",{type:"url",id:"avatar-url",placeholder:"https://example.com/your-avatar.jpg",value:o,onChange:d=>i(d.target.value),style:{width:"100%",padding:"14px 16px",paddingLeft:"44px",borderRadius:"12px",border:`1.5px solid ${c.type==="error"?s.error:c.type==="success"?s.success:s.border}`,backgroundColor:"transparent",color:s.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:d=>{d.target.style.borderColor=s.accent,d.target.style.boxShadow=`0 0 0 3px ${s.accent}20`},onBlur:d=>{d.target.style.borderColor=c.type==="error"?s.error:c.type==="success"?s.success:s.border,d.target.style.boxShadow="none"},disabled:a}),n.jsx("div",{style:{position:"absolute",left:"16px",top:"50%",transform:"translateY(-50%)",color:s.textTertiary},children:n.jsx(er,{size:18})})]}),c.message&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"8px",fontSize:"13px",color:c.type==="success"?s.success:c.type==="error"?s.error:s.textTertiary},children:[c.type==="success"&&n.jsx(xe,{size:14}),c.type==="error"&&n.jsx(le,{size:14}),c.type==="warning"&&n.jsx(le,{size:14}),c.message]})]}),o&&c.type==="success"&&n.jsxs("div",{style:{padding:"16px",backgroundColor:`${s.success}10`,border:`1px solid ${s.success}20`,borderRadius:"12px",textAlign:"center"},children:[n.jsx("p",{style:{color:s.textSecondary,fontSize:"13px",fontWeight:500,margin:"0 0 12px 0"},children:"Preview"}),n.jsx("img",{src:o,alt:"Avatar preview",style:{width:"80px",height:"80px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${s.success}40`,margin:"0 auto"},onError:d=>{d.currentTarget.style.display="none"}})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:h?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch",marginTop:"24px"},children:[n.jsx("button",{onClick:t,disabled:a,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${s.border}`,background:"transparent",color:s.textPrimary,fontSize:"14px",fontWeight:500,cursor:a?"not-allowed":"pointer",flex:h?"none":1,minWidth:h?"100%":"120px",opacity:a?.6:1,transition:"all 0.2s ease"},onMouseOver:d=>{a||(d.currentTarget.style.backgroundColor=s.border,d.currentTarget.style.transform="translateY(-1px)")},onMouseOut:d=>{a||(d.currentTarget.style.backgroundColor="transparent",d.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),n.jsx("button",{onClick:I,disabled:a||!c.isValid,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:`linear-gradient(135deg, ${s.accent}, ${s.accent}E6)`,color:"#fff",fontSize:"14px",fontWeight:600,cursor:a||!c.isValid?"not-allowed":"pointer",flex:h?"none":1,minWidth:h?"100%":"140px",opacity:a||!c.isValid?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:a||!c.isValid?"none":`0 4px 12px ${s.accent}40`},onMouseOver:d=>{!a&&c.isValid&&(d.currentTarget.style.transform="translateY(-1px)",d.currentTarget.style.boxShadow=`0 6px 20px ${s.accent}60`)},onMouseOut:d=>{!a&&c.isValid&&(d.currentTarget.style.transform="translateY(0)",d.currentTarget.style.boxShadow=`0 4px 12px ${s.accent}40`)},children:a?n.jsxs(n.Fragment,{children:[n.jsx(ce,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):n.jsxs(n.Fragment,{children:[n.jsx(rt,{size:16}),"Update Avatar"]})})]})]}),n.jsx("style",{children:`
261
+ `})]})},is=({isOpen:e,onClose:t,onUpdate:r,colors:s})=>{const[o,i]=S.useState(""),[a,l]=S.useState(!1),[h,p]=S.useState(!1),[c,m]=S.useState({isValid:!1,message:"",type:null});if(S.useEffect(()=>{const d=()=>{p(window.innerWidth<640)};return d(),window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[]),S.useEffect(()=>{if(!o.trim()){m({isValid:!1,message:"",type:null});return}try{const d=new URL(o),b=/\.(jpg|jpeg|png|gif|webp|svg)$/i.test(d.pathname);m(b?{isValid:!0,message:"Valid image URL",type:"success"}:{isValid:!1,message:"URL should point to an image file",type:"warning"})}catch{m({isValid:!1,message:"Please enter a valid URL",type:"error"})}},[o]),!e)return null;const I=async()=>{if(!(!o||!c.isValid)){l(!0);try{await r(o)&&(i(""),t())}finally{l(!1)}}},v=d=>{d.target===d.currentTarget&&t()};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:1e3},onClick:v,children:[n.jsxs("div",{style:{backgroundColor:s.surface,border:`1px solid ${s.border}`,borderRadius:"20px",width:"100%",maxWidth:"480px",padding:"24px",boxShadow:"0 32px 64px rgba(0,0,0,0.4)",animation:"modalSlideIn 0.3s ease-out"},className:"avatar-modal-container",children:[n.jsxs("div",{style:{display:"flex",alignItems:"flex-start",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:"44px",height:"44px",borderRadius:"12px",background:`linear-gradient(135deg, ${s.accent}20, ${s.accent}40)`,display:"flex",alignItems:"center",justifyContent:"center",color:s.accent,flexShrink:0},children:n.jsx(rt,{size:22})}),n.jsx("div",{children:n.jsx("h3",{style:{color:s.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Update Avatar"})})]}),n.jsx("button",{onClick:t,"aria-label":"Close avatar modal",style:{background:"transparent",border:"none",color:s.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:d=>{d.currentTarget.style.backgroundColor=s.border,d.currentTarget.style.color=s.textPrimary},onMouseOut:d=>{d.currentTarget.style.backgroundColor="transparent",d.currentTarget.style.color=s.textTertiary},children:n.jsx(Oe,{size:20})})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[n.jsxs("div",{children:[n.jsxs("label",{htmlFor:"avatar-url",style:{display:"flex",marginBottom:"8px",color:s.textPrimary,fontSize:"14px",fontWeight:500,alignItems:"center",gap:"6px"},children:[n.jsx(Vn,{size:16}),"Avatar URL"]}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx("input",{type:"url",id:"avatar-url",placeholder:"https://example.com/your-avatar.jpg",value:o,onChange:d=>i(d.target.value),style:{width:"100%",padding:"14px 16px",paddingLeft:"44px",borderRadius:"12px",border:`1.5px solid ${c.type==="error"?s.error:c.type==="success"?s.success:s.border}`,backgroundColor:"transparent",color:s.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:d=>{d.target.style.borderColor=s.accent,d.target.style.boxShadow=`0 0 0 3px ${s.accent}20`},onBlur:d=>{d.target.style.borderColor=c.type==="error"?s.error:c.type==="success"?s.success:s.border,d.target.style.boxShadow="none"},disabled:a}),n.jsx("div",{style:{position:"absolute",left:"16px",top:"50%",transform:"translateY(-50%)",color:s.textTertiary},children:n.jsx(er,{size:18})})]}),c.message&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"8px",fontSize:"13px",color:c.type==="success"?s.success:c.type==="error"?s.error:s.textTertiary},children:[c.type==="success"&&n.jsx(xe,{size:14}),c.type==="error"&&n.jsx(le,{size:14}),c.type==="warning"&&n.jsx(le,{size:14}),c.message]})]}),o&&c.type==="success"&&n.jsxs("div",{style:{padding:"16px",backgroundColor:`${s.success}10`,border:`1px solid ${s.success}20`,borderRadius:"12px",textAlign:"center"},children:[n.jsx("p",{style:{color:s.textSecondary,fontSize:"13px",fontWeight:500,margin:"0 0 12px 0"},children:"Preview"}),n.jsx("img",{src:o,alt:"Avatar preview",style:{width:"80px",height:"80px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${s.success}40`,margin:"0 auto"},onError:d=>{d.currentTarget.style.display="none"}})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:h?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch",marginTop:"24px"},children:[n.jsx("button",{onClick:t,disabled:a,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${s.border}`,background:"transparent",color:s.textPrimary,fontSize:"14px",fontWeight:500,cursor:a?"not-allowed":"pointer",flex:h?"none":1,minWidth:h?"100%":"120px",opacity:a?.6:1,transition:"all 0.2s ease"},onMouseOver:d=>{a||(d.currentTarget.style.backgroundColor=s.border,d.currentTarget.style.transform="translateY(-1px)")},onMouseOut:d=>{a||(d.currentTarget.style.backgroundColor="transparent",d.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),n.jsx("button",{onClick:I,disabled:a||!c.isValid,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:`linear-gradient(135deg, ${s.accent}, ${s.accent}E6)`,color:"#fff",fontSize:"14px",fontWeight:600,cursor:a||!c.isValid?"not-allowed":"pointer",flex:h?"none":1,minWidth:h?"100%":"140px",opacity:a||!c.isValid?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:a||!c.isValid?"none":`0 4px 12px ${s.accent}40`},onMouseOver:d=>{!a&&c.isValid&&(d.currentTarget.style.transform="translateY(-1px)",d.currentTarget.style.boxShadow=`0 6px 20px ${s.accent}60`)},onMouseOut:d=>{!a&&c.isValid&&(d.currentTarget.style.transform="translateY(0)",d.currentTarget.style.boxShadow=`0 4px 12px ${s.accent}40`)},children:a?n.jsxs(n.Fragment,{children:[n.jsx(ce,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):n.jsxs(n.Fragment,{children:[n.jsx(rt,{size:16}),"Update Avatar"]})})]})]}),n.jsx("style",{children:`
262
262
  @keyframes modalSlideIn {
263
263
  from {
264
264
  opacity: 0;
@@ -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
- `})]})},ls=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:o,colors:i})=>{const{baseUrl:a,apiKey:l,appId:h}=ge(),[p,c]=j.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[m,I]=j.useState({}),[v,d]=j.useState(!1),[b,g]=j.useState({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[U,z]=j.useState(!1);if(j.useEffect(()=>{const w=()=>{z(window.innerWidth<640)};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]),!e)return null;const P=w=>{const{name:F,value:K}=w.target;c(D=>({...D,[F]:K})),m[F]&&I(D=>({...D,[F]:""}))},C=w=>{g(F=>({...F,[w]:!F[w]}))},M=()=>{const w={};return p.currentPassword||(w.currentPassword="Current password is required"),p.newPassword?p.newPassword.length<6&&(w.newPassword="Password must be at least 6 characters"):w.newPassword="New password is required",p.newPassword!==p.confirmPassword&&(w.confirmPassword="Passwords do not match"),I(w),Object.keys(w).length===0},y=async w=>{if(w.preventDefault(),!!M()){d(!0);try{const{data:F}=await $.put(`${a}/users/change-password/${o}`,{appId:h,currentPassword:p.currentPassword,newPassword:p.newPassword},{headers:{"x-api-key":l}});F.success?(r(F.message||"Password updated successfully"),c({currentPassword:"",newPassword:"",confirmPassword:""}),t()):s(F.message||"Failed to update password")}catch(F){s(F.response?.data?.message||"Something went wrong")}finally{d(!1)}}},O=[{field:"currentPassword",label:"Current Password",icon:n.jsx(rr,{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(Oe,{size:20})})]}),n.jsxs("form",{onSubmit:y,children:[O.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:p[w],onChange:P,style:{width:"100%",padding:"14px 48px 14px 44px",borderRadius:"10px",border:`1.5px solid ${m[w]?i.error:i.border}`,backgroundColor:"transparent",color:i.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:D=>{D.target.style.borderColor=i.accent,D.target.style.boxShadow=`0 0 0 3px ${i.accent}20`},onBlur:D=>{D.target.style.borderColor=m[w]?i.error:i.border,D.target.style.boxShadow="none"}}),n.jsx("button",{type:"button",onClick:()=>C(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:D=>{D.currentTarget.style.backgroundColor=i.border,D.currentTarget.style.color=i.textPrimary},onMouseOut:D=>{D.currentTarget.style.backgroundColor="transparent",D.currentTarget.style.color=i.textTertiary},children:b[w]?n.jsx(st,{size:18}):n.jsx(ot,{size:18})})]}),m[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:"⚠"}),m[w]]})]},w)),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:U?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{type:"button",onClick:t,disabled:v,style:{padding:"14px 24px",borderRadius:"10px",border:`1.5px solid ${i.border}`,background:"transparent",color:i.textPrimary,fontSize:"14px",fontWeight:500,cursor:v?"not-allowed":"pointer",flex:U?"none":1,minWidth:U?"100%":"120px",opacity:v?.6:1,transition:"all 0.2s ease"},onMouseOver:w=>{v||(w.currentTarget.style.backgroundColor=i.border,w.currentTarget.style.transform="translateY(-1px)")},onMouseOut:w=>{v||(w.currentTarget.style.backgroundColor="transparent",w.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),n.jsx("button",{type:"submit",disabled:v,style:{padding:"14px 24px",borderRadius:"10px",border:"none",background:`linear-gradient(135deg, ${i.accent}, ${i.accent}E6)`,color:"#fff",fontSize:"14px",fontWeight:600,cursor:v?"not-allowed":"pointer",flex:U?"none":1,minWidth:U?"100%":"140px",opacity:v?.8:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:v?"none":`0 4px 12px ${i.accent}40`},onMouseOver:w=>{v||(w.currentTarget.style.transform="translateY(-1px)",w.currentTarget.style.boxShadow=`0 6px 20px ${i.accent}60`)},onMouseOut:w=>{v||(w.currentTarget.style.transform="translateY(0)",w.currentTarget.style.boxShadow=`0 4px 12px ${i.accent}40`)},children:v?n.jsxs(n.Fragment,{children:[n.jsx(ce,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):"Update Password"})]})]}),n.jsx("style",{children:`
309
+ `})]})},ls=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:o,colors:i})=>{const{baseUrl:a,apiKey:l,appId:h}=ge(),[p,c]=S.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[m,I]=S.useState({}),[v,d]=S.useState(!1),[b,g]=S.useState({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[U,z]=S.useState(!1);if(S.useEffect(()=>{const w=()=>{z(window.innerWidth<640)};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]),!e)return null;const P=w=>{const{name:F,value:K}=w.target;c(D=>({...D,[F]:K})),m[F]&&I(D=>({...D,[F]:""}))},C=w=>{g(F=>({...F,[w]:!F[w]}))},M=()=>{const w={};return p.currentPassword||(w.currentPassword="Current password is required"),p.newPassword?p.newPassword.length<6&&(w.newPassword="Password must be at least 6 characters"):w.newPassword="New password is required",p.newPassword!==p.confirmPassword&&(w.confirmPassword="Passwords do not match"),I(w),Object.keys(w).length===0},y=async w=>{if(w.preventDefault(),!!M()){d(!0);try{const{data:F}=await H.put(`${a}/users/change-password/${o}`,{appId:h,currentPassword:p.currentPassword,newPassword:p.newPassword},{headers:{"x-api-key":l}});F.success?(r(F.message||"Password updated successfully"),c({currentPassword:"",newPassword:"",confirmPassword:""}),t()):s(F.message||"Failed to update password")}catch(F){s(F.response?.data?.message||"Something went wrong")}finally{d(!1)}}},O=[{field:"currentPassword",label:"Current Password",icon:n.jsx(rr,{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(Oe,{size:20})})]}),n.jsxs("form",{onSubmit:y,children:[O.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:p[w],onChange:P,style:{width:"100%",padding:"14px 48px 14px 44px",borderRadius:"10px",border:`1.5px solid ${m[w]?i.error:i.border}`,backgroundColor:"transparent",color:i.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:D=>{D.target.style.borderColor=i.accent,D.target.style.boxShadow=`0 0 0 3px ${i.accent}20`},onBlur:D=>{D.target.style.borderColor=m[w]?i.error:i.border,D.target.style.boxShadow="none"}}),n.jsx("button",{type:"button",onClick:()=>C(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:D=>{D.currentTarget.style.backgroundColor=i.border,D.currentTarget.style.color=i.textPrimary},onMouseOut:D=>{D.currentTarget.style.backgroundColor="transparent",D.currentTarget.style.color=i.textTertiary},children:b[w]?n.jsx(st,{size:18}):n.jsx(ot,{size:18})})]}),m[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:"⚠"}),m[w]]})]},w)),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:U?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{type:"button",onClick:t,disabled:v,style:{padding:"14px 24px",borderRadius:"10px",border:`1.5px solid ${i.border}`,background:"transparent",color:i.textPrimary,fontSize:"14px",fontWeight:500,cursor:v?"not-allowed":"pointer",flex:U?"none":1,minWidth:U?"100%":"120px",opacity:v?.6:1,transition:"all 0.2s ease"},onMouseOver:w=>{v||(w.currentTarget.style.backgroundColor=i.border,w.currentTarget.style.transform="translateY(-1px)")},onMouseOut:w=>{v||(w.currentTarget.style.backgroundColor="transparent",w.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),n.jsx("button",{type:"submit",disabled:v,style:{padding:"14px 24px",borderRadius:"10px",border:"none",background:`linear-gradient(135deg, ${i.accent}, ${i.accent}E6)`,color:"#fff",fontSize:"14px",fontWeight:600,cursor:v?"not-allowed":"pointer",flex:U?"none":1,minWidth:U?"100%":"140px",opacity:v?.8:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:v?"none":`0 4px 12px ${i.accent}40`},onMouseOver:w=>{v||(w.currentTarget.style.transform="translateY(-1px)",w.currentTarget.style.boxShadow=`0 6px 20px ${i.accent}60`)},onMouseOut:w=>{v||(w.currentTarget.style.transform="translateY(0)",w.currentTarget.style.boxShadow=`0 4px 12px ${i.accent}40`)},children:v?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
- `})]})},ds=({token:e,user:t=null,darkMode:r=!0,homeUrl:s,onLogout:o,onVerify:i,primaryColor:a="#00C212"})=>{const{baseUrl:l,apiKey:h,appId:p}=ge(),[c,m]=j.useState(t),[I,v]=j.useState(!0),[d,b]=j.useState(!1),[g,U]=j.useState(!1),[z,P]=j.useState(!1),[C,M]=j.useState(!1),[y,O]=j.useState(!1),[w,F]=j.useState(!1),[K,D]=j.useState(!1),[q,Q]=j.useState(!1),[k,Z]=j.useState(null),[B,L]=j.useState(!1),[R,Y]=j.useState({email:"",otp:"",appId:p}),[x,E]=j.useState(!1),[N,W]=j.useState(!1),f=(T,V)=>{Z({type:T,message:V}),setTimeout(()=>Z(null),3e3)},S=()=>{Q(!0);const T=setTimeout(()=>{D(!1),Q(!1)},150);return()=>clearTimeout(T)};j.useEffect(()=>{const T=V=>{const G=document.querySelector(".dropdown-container");G&&!G.contains(V.target)&&S()};return K&&document.addEventListener("mousedown",T),()=>{document.removeEventListener("mousedown",T)}},[K]);const J=async()=>{if(!R.email||!/\S+@\S+\.\S+/.test(R.email)){f("error","Please enter a valid email");return}try{W(!0);const T=await $.post(`${l}/users/send-verify-otp/${c?.id}`,{email:R.email},{headers:{"x-api-key":h,"x-app-id":p}});T.data.success?(f("success",T.data.message||"OTP sent to email!"),E(!0)):f("error",T.data.message||"Failed to send OTP")}catch(T){f("error",T.response?.data?.message||"Server error")}finally{W(!1)}},se=async T=>{if(T.preventDefault(),!R.email||!R.otp){f("error","Please fill in all fields");return}try{W(!0);const V=await $.post(`${l}/users/verify-email`,R);if(V.data.success){if(f("success",V.data.message||"Email verified!"),c){const G={...c,isVerified:!0};m(G),localStorage.setItem("userInfo",JSON.stringify({...G,token:e})),typeof i=="function"&&i(G)}Y({email:"",otp:"",appId:p}),E(!1),F(!1)}else f("error",V.data.message||"Verification failed")}catch(V){f("error",V.response?.data?.message||"Something went wrong")}finally{W(!1)}},X=async T=>{if(!c)return!1;try{const V={...c,avatarUrl:T},{data:G}=await $.put(`${l}/users/update/${c.id}`,V,{headers:{"x-api-key":h}});return G.success?(m(V),localStorage.setItem("userInfo",JSON.stringify({...V,token:e})),f("success","Avatar updated successfully!"),!0):(f("error",G.message||"Failed to update avatar"),!1)}catch(V){return console.error("Avatar update error:",V),f("error","Failed to update avatar"),!1}},ae=async()=>{if(c){U(!0);try{const{data:T}=await $.put(`${l}/users/update/${c.id}`,c,{headers:{"x-api-key":h}});T.success?(m(T.user),b(!1),localStorage.setItem("userInfo",JSON.stringify({...T.user,token:e})),f("success","Profile updated successfully")):f("error",T.message)}catch(T){console.error(T),f("error","Update failed")}finally{U(!1)}}},de=async T=>{try{const{data:V}=await $.get(`${l}/users/check-user/${T}?appId=${p}`,{headers:{"x-api-key":h}});(!V.success||!V.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),m(null))}catch(V){console.error("User check failed:",V),localStorage.removeItem("userInfo"),m(null)}};j.useEffect(()=>{(()=>{if(t)m(t),v(!1),de(t.id);else{const V=localStorage.getItem("userInfo");if(V){const G=JSON.parse(V);m(G),v(!1),de(G.id)}else v(!1)}})()},[t]),j.useEffect(()=>{c?.email&&Y(T=>({...T,email:c.email}))},[c?.email]);const ve=(T,V)=>{let G=parseInt(T.replace("#",""),16),me=(G>>16)+V,lt=(G>>8&255)+V,ct=(G&255)+V;return me=Math.min(255,Math.max(0,me)),lt=Math.min(255,Math.max(0,lt)),ct=Math.min(255,Math.max(0,ct)),`#${(ct|lt<<8|me<<16).toString(16).padStart(6,"0")}`},_=r?{background:"#000000",surface:"#09090b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:a,accentHover:ve(a,-15),success:"#10b981",error:"#ef4444",border:"#27272a",warning:"#f59e0b"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:a,accentHover:ve(a,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7",warning:"#d97706"};if(I)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:_.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:_.accent,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}),n.jsx("p",{style:{color:_.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:_.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:_.error,"aria-hidden":"true"}),n.jsx("p",{style:{color:_.textTertiary,margin:0},children:"No profile found. Please log in again."})]})});const it=[{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:Kn},{label:"Address",value:c.address||"Not provided",name:"address",type:"text",icon:Yn}];return n.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:_.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",lineHeight:1.5,minHeight:"80vh"},children:[k&&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",...k.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:[k.type==="success"?n.jsx(xe,{size:20,"aria-hidden":"true"}):n.jsx(le,{size:20,"aria-hidden":"true"}),k.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:_.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($n,{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 ${_.border}`},width:128,height:128,loading:"eager"}),n.jsx("button",{onClick:()=>P(!0),style:{position:"absolute",bottom:"8px",right:"8px",backgroundColor:_.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(rt,{size:16,"aria-hidden":"true"})})]}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:600,margin:"0 0 4px 0",color:_.textPrimary},children:c.name}),n.jsx("p",{style:{color:_.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?_.success:_.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:d?n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>b(!1),style:{backgroundColor:_.surfaceLight,border:`1px solid ${_.border}`,color:_.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(Oe,{size:16,"aria-hidden":"true"}),"Cancel"]}),n.jsxs("button",{onClick:ae,disabled:g,style:{background:`linear-gradient(to right, ${_.accent}, ${_.accentHover})`,opacity:g?.7:1,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:g?"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:[g?n.jsx(ce,{size:16,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(Jn,{size:16,"aria-hidden":"true"}),g?"Saving...":"Save Changes"]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>b(!0),style:{background:`linear-gradient(to right, ${_.accent}, ${_.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(qn,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),!c.isVerified&&n.jsxs("button",{onClick:()=>F(!0),disabled:B,style:{background:"linear-gradient(to right, #fbbf24, #f59e0b)",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",minHeight:"36px",opacity:B?.7:1,flex:window.innerWidth<1024?"1":"auto"},children:[B?n.jsx(ce,{size:14,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(nr,{size:14,"aria-hidden":"true"}),B?"Sending...":"Verify Email"]}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("button",{style:{backgroundColor:_.surfaceLight,color:_.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:()=>D(!K),children:[n.jsx(Wn,{size:16,"aria-hidden":"true"}),"More Actions"]}),K&&n.jsxs("div",{className:`dropdown-container ${q?"closing":""}`,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:_.surface,border:`1px solid ${_.border}`,borderRadius:"12px 12px 0 0",boxShadow:"0 -8px 24px rgba(0, 0, 0, 0.25)",zIndex:200,marginBottom:"6px",overflow:"hidden",animation:`${q?"drawerSlideDown":"drawerSlideUp"} 0.25s ease-out forwards`},children:[n.jsxs("button",{onClick:()=>{M(!0),S()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:_.textPrimary,cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:T=>T.currentTarget.style.backgroundColor=_.surfaceLight,onMouseLeave:T=>T.currentTarget.style.backgroundColor="transparent",children:[n.jsx(rr,{size:14,"aria-hidden":"true"}),"Change Password"]}),o&&n.jsxs("button",{onClick:()=>{o(),S()},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:T=>{T.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:T=>T.currentTarget.style.backgroundColor="transparent",children:[n.jsx(at,{size:14,"aria-hidden":"true"}),"Logout"]}),n.jsxs("button",{onClick:()=>{O(!0),S()},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:T=>{T.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:T=>T.currentTarget.style.backgroundColor="transparent",children:[n.jsx($e,{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:_.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:_.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:it.map(T=>{const V=T.icon;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[n.jsxs("label",{style:{color:_.textTertiary,fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(V,{size:16,"aria-hidden":"true"}),T.label]}),d?n.jsx("input",{type:T.type,name:T.name,value:c[T.name],onChange:G=>m(me=>me&&{...me,[G.target.name]:G.target.value}),style:{padding:"12px",borderRadius:"8px",border:`1px solid ${a}`,backgroundColor:"transparent",color:_.textPrimary,fontSize:"12px",outline:"none",transition:"border-color 0.2s ease",minHeight:"44px",width:"100%",boxSizing:"border-box"},placeholder:`Enter ${T.label.toLowerCase()}`,"aria-label":T.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:_.textPrimary,backgroundColor:r?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:T.value})]},T.name)})})]}),n.jsxs("section",{style:{backgroundColor:_.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:_.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(sr,{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:_.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:_.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:_.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:_.textTertiary,fontSize:"12px",margin:0},children:"Verify your email to unlock all features and enhance your account security."})})]})]})]})]})}),n.jsx(is,{isOpen:z,onClose:()=>{P(!1)},onUpdate:X,colors:_}),n.jsx(ls,{baseUrl:l,apiKey:h,appId:p,userId:c.id,isOpen:C,onClose:()=>M(!1),onSuccess:T=>f("success",T),onError:T=>f("error",T),colors:_}),n.jsx(as,{baseUrl:l,apiKey:h,appId:p,userId:c.id,token:e,isOpen:y,onClose:()=>O(!1),onSuccess:T=>f("success",T),onError:T=>f("error",T),colors:_}),n.jsx(cs,{isOpen:w,onClose:()=>{F(!1),E(!1),Y({email:c?.email||"",otp:"",appId:p})},onVerify:se,onSendOTP:J,verifyFormData:R,setVerifyFormData:Y,otpSent:x,verifying:N,user:c,colors:_,darkMode:r}),n.jsx("style",{children:`
494
+ `})]})},ds=({token:e,user:t=null,darkMode:r=!0,homeUrl:s,onLogout:o,onVerify:i,primaryColor:a="#00C212"})=>{const{baseUrl:l,apiKey:h,appId:p}=ge(),[c,m]=S.useState(t),[I,v]=S.useState(!0),[d,b]=S.useState(!1),[g,U]=S.useState(!1),[z,P]=S.useState(!1),[C,M]=S.useState(!1),[y,O]=S.useState(!1),[w,F]=S.useState(!1),[K,D]=S.useState(!1),[q,Q]=S.useState(!1),[k,Z]=S.useState(null),[B,L]=S.useState(!1),[R,Y]=S.useState({email:"",otp:"",appId:p}),[x,E]=S.useState(!1),[N,W]=S.useState(!1),f=(T,V)=>{Z({type:T,message:V}),setTimeout(()=>Z(null),3e3)},j=()=>{Q(!0);const T=setTimeout(()=>{D(!1),Q(!1)},150);return()=>clearTimeout(T)};S.useEffect(()=>{const T=V=>{const G=document.querySelector(".dropdown-container");G&&!G.contains(V.target)&&j()};return K&&document.addEventListener("mousedown",T),()=>{document.removeEventListener("mousedown",T)}},[K]);const J=async()=>{if(!R.email||!/\S+@\S+\.\S+/.test(R.email)){f("error","Please enter a valid email");return}try{W(!0);const T=await H.post(`${l}/users/send-verify-otp/${c?.id}`,{email:R.email},{headers:{"x-api-key":h,"x-app-id":p}});T.data.success?(f("success",T.data.message||"OTP sent to email!"),E(!0)):f("error",T.data.message||"Failed to send OTP")}catch(T){f("error",T.response?.data?.message||"Server error")}finally{W(!1)}},se=async T=>{if(T.preventDefault(),!R.email||!R.otp){f("error","Please fill in all fields");return}try{W(!0);const V=await H.post(`${l}/users/verify-email`,R);if(V.data.success){if(f("success",V.data.message||"Email verified!"),c){const G={...c,isVerified:!0};m(G),localStorage.setItem("userInfo",JSON.stringify({...G,token:e})),typeof i=="function"&&i(G)}Y({email:"",otp:"",appId:p}),E(!1),F(!1)}else f("error",V.data.message||"Verification failed")}catch(V){f("error",V.response?.data?.message||"Something went wrong")}finally{W(!1)}},X=async T=>{if(!c)return!1;try{const V={...c,avatarUrl:T},{data:G}=await H.put(`${l}/users/update/${c.id}`,V,{headers:{"x-api-key":h}});return G.success?(m(V),localStorage.setItem("userInfo",JSON.stringify({...V,token:e})),f("success","Avatar updated successfully!"),!0):(f("error",G.message||"Failed to update avatar"),!1)}catch(V){return console.error("Avatar update error:",V),f("error","Failed to update avatar"),!1}},ae=async()=>{if(c){U(!0);try{const{data:T}=await H.put(`${l}/users/update/${c.id}`,c,{headers:{"x-api-key":h}});T.success?(m(T.user),b(!1),localStorage.setItem("userInfo",JSON.stringify({...T.user,token:e})),f("success","Profile updated successfully")):f("error",T.message)}catch(T){console.error(T),f("error","Update failed")}finally{U(!1)}}},de=async T=>{try{const{data:V}=await H.get(`${l}/users/check-user/${T}?appId=${p}`,{headers:{"x-api-key":h}});(!V.success||!V.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),m(null))}catch(V){console.error("User check failed:",V),localStorage.removeItem("userInfo"),m(null)}};S.useEffect(()=>{(()=>{if(t)m(t),v(!1),de(t.id);else{const V=localStorage.getItem("userInfo");if(V){const G=JSON.parse(V);m(G),v(!1),de(G.id)}else v(!1)}})()},[t]),S.useEffect(()=>{c?.email&&Y(T=>({...T,email:c.email}))},[c?.email]);const ve=(T,V)=>{let G=parseInt(T.replace("#",""),16),me=(G>>16)+V,lt=(G>>8&255)+V,ct=(G&255)+V;return me=Math.min(255,Math.max(0,me)),lt=Math.min(255,Math.max(0,lt)),ct=Math.min(255,Math.max(0,ct)),`#${(ct|lt<<8|me<<16).toString(16).padStart(6,"0")}`},_=r?{background:"#000000",surface:"#09090b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:a,accentHover:ve(a,-15),success:"#10b981",error:"#ef4444",border:"#27272a",warning:"#f59e0b"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:a,accentHover:ve(a,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7",warning:"#d97706"};if(I)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:_.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:_.accent,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}),n.jsx("p",{style:{color:_.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:_.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:_.error,"aria-hidden":"true"}),n.jsx("p",{style:{color:_.textTertiary,margin:0},children:"No profile found. Please log in again."})]})});const it=[{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:Jn},{label:"Address",value:c.address||"Not provided",name:"address",type:"text",icon:qn}];return n.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:_.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",lineHeight:1.5,minHeight:"80vh"},children:[k&&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",...k.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:[k.type==="success"?n.jsx(xe,{size:20,"aria-hidden":"true"}):n.jsx(le,{size:20,"aria-hidden":"true"}),k.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:_.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($n,{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 ${_.border}`},width:128,height:128,loading:"eager"}),n.jsx("button",{onClick:()=>P(!0),style:{position:"absolute",bottom:"8px",right:"8px",backgroundColor:_.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(rt,{size:16,"aria-hidden":"true"})})]}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:600,margin:"0 0 4px 0",color:_.textPrimary},children:c.name}),n.jsx("p",{style:{color:_.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?_.success:_.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:d?n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>b(!1),style:{backgroundColor:_.surfaceLight,border:`1px solid ${_.border}`,color:_.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(Oe,{size:16,"aria-hidden":"true"}),"Cancel"]}),n.jsxs("button",{onClick:ae,disabled:g,style:{background:`linear-gradient(to right, ${_.accent}, ${_.accentHover})`,opacity:g?.7:1,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:g?"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:[g?n.jsx(ce,{size:16,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(Xn,{size:16,"aria-hidden":"true"}),g?"Saving...":"Save Changes"]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>b(!0),style:{background:`linear-gradient(to right, ${_.accent}, ${_.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(Kn,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),!c.isVerified&&n.jsxs("button",{onClick:()=>F(!0),disabled:B,style:{background:"linear-gradient(to right, #fbbf24, #f59e0b)",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",minHeight:"36px",opacity:B?.7:1,flex:window.innerWidth<1024?"1":"auto"},children:[B?n.jsx(ce,{size:14,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(nr,{size:14,"aria-hidden":"true"}),B?"Sending...":"Verify Email"]}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("button",{style:{backgroundColor:_.surfaceLight,color:_.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:()=>D(!K),children:[n.jsx(Hn,{size:16,"aria-hidden":"true"}),"More Actions"]}),K&&n.jsxs("div",{className:`dropdown-container ${q?"closing":""}`,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:_.surface,border:`1px solid ${_.border}`,borderRadius:"12px 12px 0 0",boxShadow:"0 -8px 24px rgba(0, 0, 0, 0.25)",zIndex:200,marginBottom:"6px",overflow:"hidden",animation:`${q?"drawerSlideDown":"drawerSlideUp"} 0.25s ease-out forwards`},children:[n.jsxs("button",{onClick:()=>{M(!0),j()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:_.textPrimary,cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:T=>T.currentTarget.style.backgroundColor=_.surfaceLight,onMouseLeave:T=>T.currentTarget.style.backgroundColor="transparent",children:[n.jsx(rr,{size:14,"aria-hidden":"true"}),"Change Password"]}),o&&n.jsxs("button",{onClick:()=>{o(),j()},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:T=>{T.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:T=>T.currentTarget.style.backgroundColor="transparent",children:[n.jsx(at,{size:14,"aria-hidden":"true"}),"Logout"]}),n.jsxs("button",{onClick:()=>{O(!0),j()},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:T=>{T.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:T=>T.currentTarget.style.backgroundColor="transparent",children:[n.jsx(He,{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:_.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:_.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:it.map(T=>{const V=T.icon;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[n.jsxs("label",{style:{color:_.textTertiary,fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(V,{size:16,"aria-hidden":"true"}),T.label]}),d?n.jsx("input",{type:T.type,name:T.name,value:c[T.name],onChange:G=>m(me=>me&&{...me,[G.target.name]:G.target.value}),style:{padding:"12px",borderRadius:"8px",border:`1px solid ${a}`,backgroundColor:"transparent",color:_.textPrimary,fontSize:"12px",outline:"none",transition:"border-color 0.2s ease",minHeight:"44px",width:"100%",boxSizing:"border-box"},placeholder:`Enter ${T.label.toLowerCase()}`,"aria-label":T.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:_.textPrimary,backgroundColor:r?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:T.value})]},T.name)})})]}),n.jsxs("section",{style:{backgroundColor:_.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:_.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(sr,{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:_.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:_.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:_.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:_.textTertiary,fontSize:"12px",margin:0},children:"Verify your email to unlock all features and enhance your account security."})})]})]})]})]})}),n.jsx(is,{isOpen:z,onClose:()=>{P(!1)},onUpdate:X,colors:_}),n.jsx(ls,{baseUrl:l,apiKey:h,appId:p,userId:c.id,isOpen:C,onClose:()=>M(!1),onSuccess:T=>f("success",T),onError:T=>f("error",T),colors:_}),n.jsx(as,{baseUrl:l,apiKey:h,appId:p,userId:c.id,token:e,isOpen:y,onClose:()=>O(!1),onSuccess:T=>f("success",T),onError:T=>f("error",T),colors:_}),n.jsx(cs,{isOpen:w,onClose:()=>{F(!1),E(!1),Y({email:c?.email||"",otp:"",appId:p})},onVerify:se,onSendOTP:J,verifyFormData:R,setVerifyFormData:Y,otpSent:x,verifying:N,user:c,colors:_,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
- `})]})},us=({darkMode:e=!0,primaryColor:t="#3b82f6",onLogout:r,varient:s="classic",propUser:o,className:i="",profileUrl:a,settingsUrl:l,showProfileMenuItem:h=!0,showSettingsMenuItem:p=!0,showViewProfileMenuItem:c=!0,profileLabel:m="My Profile",settingsLabel:I="Settings",viewProfileLabel:v="View Profile",logoutLabel:d="Sign Out"})=>{const{baseUrl:b,apiKey:g,appId:U}=ge(),[z,P]=j.useState(!1),[C,M]=j.useState(null),[y,O]=j.useState(!0),[w,F]=j.useState(null),K=j.useRef(null),D=j.useRef(null),[q,Q]=j.useState(!1),[k,Z]=j.useState(!1);j.useEffect(()=>{const f=()=>{Z(window.innerWidth<768)};return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[]);const B=async f=>{try{if(!f)throw new Error("Invalid user ID");const{data:S}=await $.get(`${b}/users/check-user/${f}?appId=${U}`,{headers:{"x-api-key":g},timeout:1e4});(!S.success||!S.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),M(null),F("Session expired"))}catch(S){console.error("User validation failed:",S);const J=S.response?.status===404?"User not found":S.code==="NETWORK_ERROR"?"Network error":"Validation failed";F(J),S.response?.status===404&&(localStorage.removeItem("userInfo"),M(null))}};j.useEffect(()=>{(async()=>{try{if(O(!0),F(null),o){if(!o.id||!o.name||!o.email)throw new Error("Invalid user data provided");M(o),await B(o.id)}else{const S=localStorage.getItem("userInfo");if(S)try{const J=JSON.parse(S);if(!J.id||!J.name||!J.email)throw new Error("Invalid stored user data");M(J),await B(J.id)}catch(J){console.error("Failed to parse stored user data:",J),localStorage.removeItem("userInfo"),F("Invalid user data")}}}catch(S){console.error("User initialization failed:",S),F(S.message||"Failed to load user")}finally{O(!1)}})()},[o]),j.useEffect(()=>{const f=()=>{if(z&&D.current){const S=D.current.getBoundingClientRect(),J=window.innerWidth,se=window.innerHeight,X=280,ae=300,de=J-S.right,ve=S.left,_=se-S.bottom,it=de>=X||de>ve;Q(it),_<ae&&S.top>ae}};return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[z]),j.useEffect(()=>{const f=se=>{K.current&&!K.current.contains(se.target)&&!D.current?.contains(se.target)&&P(!1)},S=se=>{se.key==="Escape"&&P(!1)},J=()=>{z&&P(!1)};return z&&(document.addEventListener("mousedown",f),document.addEventListener("keydown",S),window.addEventListener("scroll",J,{passive:!0})),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",S),window.removeEventListener("scroll",J)}},[z]);const L=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"},R={wrapper:{position:"relative",display:"inline-block"},avatarButton:{display:"flex",alignItems:"center",gap:k?"6px":"8px",padding:k?"6px 10px 6px 6px":"8px 12px 8px 8px",borderRadius:"24px",backgroundColor:L.surface,cursor:"pointer",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",minWidth:k?"auto":"140px",maxWidth:k?"200px":"none",outline:"none"},avatarImage:{width:k?"28px":"32px",height:k?"28px":"32px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${L.borderLight}`,flexShrink:0},userInfo:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,minWidth:0,overflow:"hidden"},userName:{fontSize:k?"13px":"14px",fontWeight:600,color:L.textPrimary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:k?"80px":"120px"},userEmail:{fontSize:k?"11px":"12px",color:L.textTertiary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:k?"80px":"120px"},chevron:{transition:"transform 0.2s ease",transform:z?"rotate(180deg)":"rotate(0deg)",color:L.textTertiary,flexShrink:0},dropdown:{position:"absolute",top:"100%",marginTop:"8px",[q?"left":"right"]:"0",backgroundColor:L.surfaceElevated,border:`1px solid ${L.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:z?1:0,pointerEvents:z?"auto":"none",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",transform:z?"translateY(0) scale(1)":"translateY(-8px) scale(0.95)",overflow:"hidden"},dropdownSection:{padding:k?"10px 12px":"0px 16px","&:last-child":{borderBottom:"none"}},userSection:{display:"flex",alignItems:"center",gap:k?"10px":"12px",padding:k?"14px":"16px"},dropdownAvatar:{width:k?"40px":"48px",height:k?"40px":"48px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${L.borderLight}`,flexShrink:0},dropdownUserInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0},dropdownUserName:{fontSize:k?"15px":"16px",fontWeight:600,color:L.textPrimary,lineHeight:"1.2",marginBottom:"2px",overflow:"hidden",textOverflow:"ellipsis"},dropdownUserEmail:{fontSize:k?"13px":"14px",color:L.textSecondary,lineHeight:"1.2",overflow:"hidden",textOverflow:"ellipsis"},menuItem:{display:"flex",alignItems:"center",gap:k?"10px":"12px",padding:k?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",color:L.textPrimary,textDecoration:"none",border:"none",background:"none",width:"100%",fontSize:k?"13px":"14px",textAlign:"left",outline:"none"},menuItemText:{flex:1},icon:{width:k?"16px":"18px",height:k?"16px":"18px",color:L.textSecondary,flexShrink:0},logoutButton:{display:"flex",alignItems:"center",gap:k?"10px":"12px",padding:k?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",background:"none",border:"none",width:"100%",fontSize:k?"13px":"14px",color:L.error,textAlign:"left",outline:"none"},loadingText:{padding:k?"16px 12px":"20px 16px",textAlign:"center",color:L.textSecondary,fontSize:k?"13px":"14px"},errorState:{padding:k?"16px 12px":"20px 16px",textAlign:"center",color:L.textSecondary,fontSize:k?"13px":"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexDirection:"column"},retryButton:{marginTop:"8px",padding:"8px 16px",backgroundColor:L.accent,color:"#ffffff",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.2s ease"}},Y=()=>{F(null),O(!0);const f=localStorage.getItem("userInfo");if(f)try{const S=JSON.parse(f);M(S),B(S.id)}catch{F("Invalid user data")}O(!1)},x=(f,S)=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),S())},E=()=>a||C?.profileUrl,N=()=>{const f=E();f&&window.open(f,"_self","noopener,noreferrer")},W=()=>{l&&window.open(l,"_self","noopener,noreferrer")};return n.jsxs("div",{style:R.wrapper,ref:K,className:i,role:"menu","aria-label":"User menu",children:[s==="classic"?n.jsx("div",{ref:D,onClick:()=>P(f=>!f),onKeyDown:f=>x(f,()=>P(S=>!S)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":z,"aria-label":"Toggle user menu",children:C?.avatarUrl?n.jsx("img",{src:C.avatarUrl,alt:`${C?.name||"User"}'s avatar`,style:{width:k?"34px":"40px",height:k?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${L.borderLight}`,flexShrink:0},loading:"lazy",onError:f=>{const S=f.target;S.onerror=null,S.src=`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(C?.name||"User")}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(C?.name||"User")}`,alt:"Default user avatar",style:{width:k?"34px":"40px",height:k?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${L.borderLight}`,flexShrink:0},loading:"lazy"})}):n.jsxs("div",{ref:D,style:R.avatarButton,onClick:()=>P(f=>!f),onKeyDown:f=>x(f,()=>P(S=>!S)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":z,"aria-label":"Toggle user menu",onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.surfaceHover,f.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"},onMouseOut:f=>{f.currentTarget.style.backgroundColor=L.surface,f.currentTarget.style.boxShadow="none"},onBlur:f=>{f.currentTarget.style.outline="none"},children:[C?.avatarUrl?n.jsx("img",{src:C.avatarUrl,alt:`${C.name}'s avatar`,style:R.avatarImage,loading:"lazy",onError:f=>{const S=f.target;S.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:R.avatarImage,loading:"lazy"}),!k&&n.jsxs("div",{style:R.userInfo,children:[n.jsx("div",{style:R.userName,title:C?.name,children:C?.name||"Guest"}),C?.email&&n.jsx("div",{style:R.userEmail,title:C.email,children:C.email})]}),n.jsx(Mn,{size:k?14:16,style:R.chevron,"aria-hidden":"true"})]}),z&&n.jsx("div",{style:R.dropdown,role:"menu","aria-label":"User options",children:y?n.jsx("div",{style:R.loadingText,role:"status","aria-live":"polite",children:"Loading user information..."}):C?n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:R.userSection,children:[C?.avatarUrl?n.jsx("img",{src:C.avatarUrl,alt:`${C.name}'s profile picture`,style:R.dropdownAvatar,loading:"lazy",onError:f=>{const S=f.target;S.src=`https://api.dicebear.com/9.x/initials/svg?seed=${C.name}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${C.name}`,alt:`${C.name}'s default avatar`,style:R.dropdownAvatar,loading:"lazy"}),n.jsxs("div",{style:R.dropdownUserInfo,children:[n.jsx("div",{style:R.dropdownUserName,title:C.name,children:C.name}),n.jsx("div",{style:R.dropdownUserEmail,title:C.email,children:C.email})]})]}),n.jsxs("div",{style:R.dropdownSection,children:[h&&E()&&n.jsxs("button",{style:R.menuItem,onClick:N,onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.surfaceHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor="transparent"},onKeyDown:f=>x(f,N),role:"menuitem",tabIndex:0,children:[n.jsx(je,{style:R.icon,"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:m})]}),p&&l&&n.jsxs("button",{style:R.menuItem,onClick:W,onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.surfaceHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor="transparent"},onKeyDown:f=>x(f,W),role:"menuitem",tabIndex:0,children:[n.jsx(Xn,{style:R.icon,"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:I})]}),c&&C.profileUrl&&n.jsxs("a",{href:C.profileUrl,target:"_self",rel:"noopener noreferrer",style:R.menuItem,onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.surfaceHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor="transparent"},role:"menuitem",tabIndex:0,children:[n.jsx(he,{style:R.icon,"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:v})]})]}),n.jsx("div",{style:R.dropdownSection,children:n.jsxs("button",{style:R.logoutButton,onClick:r,onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.surfaceHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor="transparent"},onKeyDown:f=>x(f,r),role:"menuitem",tabIndex:0,children:[n.jsx(at,{style:{...R.icon,color:L.error},"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:d})]})})]}):n.jsxs("div",{style:R.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:R.retryButton,onClick:Y,onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.accentHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor=L.accent},children:"Try Again"})]})})]})};te.NeuctraAuthix=Pn,te.ReactSignedIn=ns,te.ReactSignedOut=os,te.ReactUserButton=us,te.ReactUserLogin=ts,te.ReactUserProfile=ds,te.ReactUserSignUp=Qn,te.getSdkConfig=ge,te.setSdkConfig=Zn,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));
582
+ `})]})},us=({darkMode:e=!0,primaryColor:t="#3b82f6",onLogout:r,varient:s="classic",propUser:o,className:i="",profileUrl:a,settingsUrl:l,showProfileMenuItem:h=!0,showSettingsMenuItem:p=!0,showViewProfileMenuItem:c=!0,profileLabel:m="My Profile",settingsLabel:I="Settings",viewProfileLabel:v="View Profile",logoutLabel:d="Sign Out"})=>{const{baseUrl:b,apiKey:g,appId:U}=ge(),[z,P]=S.useState(!1),[C,M]=S.useState(null),[y,O]=S.useState(!0),[w,F]=S.useState(null),K=S.useRef(null),D=S.useRef(null),[q,Q]=S.useState(!1),[k,Z]=S.useState(!1);S.useEffect(()=>{const f=()=>{Z(window.innerWidth<768)};return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[]);const B=async f=>{try{if(!f)throw new Error("Invalid user ID");const{data:j}=await H.get(`${b}/users/check-user/${f}?appId=${U}`,{headers:{"x-api-key":g},timeout:1e4});(!j.success||!j.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),M(null),F("Session expired"))}catch(j){console.error("User validation failed:",j);const J=j.response?.status===404?"User not found":j.code==="NETWORK_ERROR"?"Network error":"Validation failed";F(J),j.response?.status===404&&(localStorage.removeItem("userInfo"),M(null))}};S.useEffect(()=>{(async()=>{try{if(O(!0),F(null),o){if(!o.id||!o.name||!o.email)throw new Error("Invalid user data provided");M(o),await B(o.id)}else{const j=localStorage.getItem("userInfo");if(j)try{const J=JSON.parse(j);if(!J.id||!J.name||!J.email)throw new Error("Invalid stored user data");M(J),await B(J.id)}catch(J){console.error("Failed to parse stored user data:",J),localStorage.removeItem("userInfo"),F("Invalid user data")}}}catch(j){console.error("User initialization failed:",j),F(j.message||"Failed to load user")}finally{O(!1)}})()},[o]),S.useEffect(()=>{const f=()=>{if(z&&D.current){const j=D.current.getBoundingClientRect(),J=window.innerWidth,se=window.innerHeight,X=280,ae=300,de=J-j.right,ve=j.left,_=se-j.bottom,it=de>=X||de>ve;Q(it),_<ae&&j.top>ae}};return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[z]),S.useEffect(()=>{const f=se=>{K.current&&!K.current.contains(se.target)&&!D.current?.contains(se.target)&&P(!1)},j=se=>{se.key==="Escape"&&P(!1)},J=()=>{z&&P(!1)};return z&&(document.addEventListener("mousedown",f),document.addEventListener("keydown",j),window.addEventListener("scroll",J,{passive:!0})),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",j),window.removeEventListener("scroll",J)}},[z]);const L=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"},R={wrapper:{position:"relative",display:"inline-block"},avatarButton:{display:"flex",alignItems:"center",gap:k?"6px":"8px",padding:k?"6px 10px 6px 6px":"8px 12px 8px 8px",borderRadius:"24px",backgroundColor:L.surface,cursor:"pointer",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",minWidth:k?"auto":"140px",maxWidth:k?"200px":"none",outline:"none"},avatarImage:{width:k?"28px":"32px",height:k?"28px":"32px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${L.borderLight}`,flexShrink:0},userInfo:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,minWidth:0,overflow:"hidden"},userName:{fontSize:k?"13px":"14px",fontWeight:600,color:L.textPrimary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:k?"80px":"120px"},userEmail:{fontSize:k?"11px":"12px",color:L.textTertiary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:k?"80px":"120px"},chevron:{transition:"transform 0.2s ease",transform:z?"rotate(180deg)":"rotate(0deg)",color:L.textTertiary,flexShrink:0},dropdown:{position:"absolute",top:"100%",marginTop:"8px",[q?"left":"right"]:"0",backgroundColor:L.surfaceElevated,border:`1px solid ${L.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:z?1:0,pointerEvents:z?"auto":"none",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",transform:z?"translateY(0) scale(1)":"translateY(-8px) scale(0.95)",overflow:"hidden"},dropdownSection:{padding:k?"10px 12px":"0px 16px","&:last-child":{borderBottom:"none"}},userSection:{display:"flex",alignItems:"center",gap:k?"10px":"12px",padding:k?"14px":"16px"},dropdownAvatar:{width:k?"40px":"48px",height:k?"40px":"48px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${L.borderLight}`,flexShrink:0},dropdownUserInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0},dropdownUserName:{fontSize:k?"15px":"16px",fontWeight:600,color:L.textPrimary,lineHeight:"1.2",marginBottom:"2px",overflow:"hidden",textOverflow:"ellipsis"},dropdownUserEmail:{fontSize:k?"13px":"14px",color:L.textSecondary,lineHeight:"1.2",overflow:"hidden",textOverflow:"ellipsis"},menuItem:{display:"flex",alignItems:"center",gap:k?"10px":"12px",padding:k?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",color:L.textPrimary,textDecoration:"none",border:"none",background:"none",width:"100%",fontSize:k?"13px":"14px",textAlign:"left",outline:"none"},menuItemText:{flex:1},icon:{width:k?"16px":"18px",height:k?"16px":"18px",color:L.textSecondary,flexShrink:0},logoutButton:{display:"flex",alignItems:"center",gap:k?"10px":"12px",padding:k?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",background:"none",border:"none",width:"100%",fontSize:k?"13px":"14px",color:L.error,textAlign:"left",outline:"none"},loadingText:{padding:k?"16px 12px":"20px 16px",textAlign:"center",color:L.textSecondary,fontSize:k?"13px":"14px"},errorState:{padding:k?"16px 12px":"20px 16px",textAlign:"center",color:L.textSecondary,fontSize:k?"13px":"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexDirection:"column"},retryButton:{marginTop:"8px",padding:"8px 16px",backgroundColor:L.accent,color:"#ffffff",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.2s ease"}},Y=()=>{F(null),O(!0);const f=localStorage.getItem("userInfo");if(f)try{const j=JSON.parse(f);M(j),B(j.id)}catch{F("Invalid user data")}O(!1)},x=(f,j)=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),j())},E=()=>a||C?.profileUrl,N=()=>{const f=E();f&&window.open(f,"_self","noopener,noreferrer")},W=()=>{l&&window.open(l,"_self","noopener,noreferrer")};return n.jsxs("div",{style:R.wrapper,ref:K,className:i,role:"menu","aria-label":"User menu",children:[s==="classic"?n.jsx("div",{ref:D,onClick:()=>P(f=>!f),onKeyDown:f=>x(f,()=>P(j=>!j)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":z,"aria-label":"Toggle user menu",children:C?.avatarUrl?n.jsx("img",{src:C.avatarUrl,alt:`${C?.name||"User"}'s avatar`,style:{width:k?"34px":"40px",height:k?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${L.borderLight}`,flexShrink:0},loading:"lazy",onError:f=>{const j=f.target;j.onerror=null,j.src=`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(C?.name||"User")}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(C?.name||"User")}`,alt:"Default user avatar",style:{width:k?"34px":"40px",height:k?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${L.borderLight}`,flexShrink:0},loading:"lazy"})}):n.jsxs("div",{ref:D,style:R.avatarButton,onClick:()=>P(f=>!f),onKeyDown:f=>x(f,()=>P(j=>!j)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":z,"aria-label":"Toggle user menu",onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.surfaceHover,f.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"},onMouseOut:f=>{f.currentTarget.style.backgroundColor=L.surface,f.currentTarget.style.boxShadow="none"},onBlur:f=>{f.currentTarget.style.outline="none"},children:[C?.avatarUrl?n.jsx("img",{src:C.avatarUrl,alt:`${C.name}'s avatar`,style:R.avatarImage,loading:"lazy",onError:f=>{const j=f.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:R.avatarImage,loading:"lazy"}),!k&&n.jsxs("div",{style:R.userInfo,children:[n.jsx("div",{style:R.userName,title:C?.name,children:C?.name||"Guest"}),C?.email&&n.jsx("div",{style:R.userEmail,title:C.email,children:C.email})]}),n.jsx(Bn,{size:k?14:16,style:R.chevron,"aria-hidden":"true"})]}),z&&n.jsx("div",{style:R.dropdown,role:"menu","aria-label":"User options",children:y?n.jsx("div",{style:R.loadingText,role:"status","aria-live":"polite",children:"Loading user information..."}):C?n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:R.userSection,children:[C?.avatarUrl?n.jsx("img",{src:C.avatarUrl,alt:`${C.name}'s profile picture`,style:R.dropdownAvatar,loading:"lazy",onError:f=>{const j=f.target;j.src=`https://api.dicebear.com/9.x/initials/svg?seed=${C.name}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${C.name}`,alt:`${C.name}'s default avatar`,style:R.dropdownAvatar,loading:"lazy"}),n.jsxs("div",{style:R.dropdownUserInfo,children:[n.jsx("div",{style:R.dropdownUserName,title:C.name,children:C.name}),n.jsx("div",{style:R.dropdownUserEmail,title:C.email,children:C.email})]})]}),n.jsxs("div",{style:R.dropdownSection,children:[h&&E()&&n.jsxs("button",{style:R.menuItem,onClick:N,onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.surfaceHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor="transparent"},onKeyDown:f=>x(f,N),role:"menuitem",tabIndex:0,children:[n.jsx(je,{style:R.icon,"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:m})]}),p&&l&&n.jsxs("button",{style:R.menuItem,onClick:W,onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.surfaceHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor="transparent"},onKeyDown:f=>x(f,W),role:"menuitem",tabIndex:0,children:[n.jsx(Gn,{style:R.icon,"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:I})]}),c&&C.profileUrl&&n.jsxs("a",{href:C.profileUrl,target:"_self",rel:"noopener noreferrer",style:R.menuItem,onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.surfaceHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor="transparent"},role:"menuitem",tabIndex:0,children:[n.jsx(he,{style:R.icon,"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:v})]})]}),n.jsx("div",{style:R.dropdownSection,children:n.jsxs("button",{style:R.logoutButton,onClick:r,onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.surfaceHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor="transparent"},onKeyDown:f=>x(f,r),role:"menuitem",tabIndex:0,children:[n.jsx(at,{style:{...R.icon,color:L.error},"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:d})]})})]}):n.jsxs("div",{style:R.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:R.retryButton,onClick:Y,onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.accentHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor=L.accent},children:"Try Again"})]})})]})};te.NeuctraAuthix=On,te.ReactSignedIn=ss,te.ReactSignedOut=os,te.ReactUserButton=us,te.ReactUserLogin=rs,te.ReactUserProfile=ds,te.ReactUserSignUp=es,te.getSdkConfig=ge,te.setSdkConfig=Qn,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));