@neuctra/authix 1.1.6 → 1.1.7

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.
@@ -0,0 +1,583 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react");function Ot(e,t){return function(){return e.apply(t,arguments)}}const{toString:ir}=Object.prototype,{getPrototypeOf:nt}=Object,{iterator:Fe,toStringTag:At}=Symbol,Le=(e=>t=>{const r=ir.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),ne=e=>(e=e.toLowerCase(),t=>Le(t)===e),Me=e=>t=>typeof t===e,{isArray:we}=Array,ye=Me("undefined");function Ee(e){return e!==null&&!ye(e)&&e.constructor!==null&&!ye(e.constructor)&&te(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const zt=ne("ArrayBuffer");function lr(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&zt(e.buffer),t}const cr=Me("string"),te=Me("function"),_t=Me("number"),Ce=e=>e!==null&&typeof e=="object",dr=e=>e===!0||e===!1,ze=e=>{if(Le(e)!=="object")return!1;const t=nt(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(At in e)&&!(Fe in e)},ur=e=>{if(!Ce(e)||Ee(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},pr=ne("Date"),fr=ne("File"),xr=ne("Blob"),hr=ne("FileList"),gr=e=>Ce(e)&&te(e.pipe),mr=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||te(e.append)&&((t=Le(e))==="formdata"||t==="object"&&te(e.toString)&&e.toString()==="[object FormData]"))},yr=ne("URLSearchParams"),[br,wr,Sr,jr]=["ReadableStream","Request","Response","Headers"].map(ne),vr=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Te(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let s,a;if(typeof e!="object"&&(e=[e]),we(e))for(s=0,a=e.length;s<a;s++)t.call(null,e[s],s,e);else{if(Ee(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let l;for(s=0;s<o;s++)l=i[s],t.call(null,e[l],l,e)}}function Nt(e,t){if(Ee(e))return null;t=t.toLowerCase();const r=Object.keys(e);let s=r.length,a;for(;s-- >0;)if(a=r[s],t===a.toLowerCase())return a;return null}const ue=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,$t=e=>!ye(e)&&e!==ue;function Ge(){const{caseless:e,skipUndefined:t}=$t(this)&&this||{},r={},s=(a,i)=>{const o=e&&Nt(r,i)||i;ze(r[o])&&ze(a)?r[o]=Ge(r[o],a):ze(a)?r[o]=Ge({},a):we(a)?r[o]=a.slice():(!t||!ye(a))&&(r[o]=a)};for(let a=0,i=arguments.length;a<i;a++)arguments[a]&&Te(arguments[a],s);return r}const kr=(e,t,r,{allOwnKeys:s}={})=>(Te(t,(a,i)=>{r&&te(a)?e[i]=Ot(a,r):e[i]=a},{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 a,i,o;const l={};if(t=t||{},e==null)return t;do{for(a=Object.getOwnPropertyNames(e),i=a.length;i-- >0;)o=a[i],(!s||s(o,e,t))&&!l[o]&&(t[o]=e[o],l[o]=!0);e=r!==!1&&nt(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(we(e))return e;let t=e.length;if(!_t(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"&&nt(Uint8Array)),Or=(e,t)=>{const s=(e&&e[Fe]).call(e);let a;for(;(a=s.next())&&!a.done;){const i=a.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=ne("HTMLFormElement"),_r=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,s,a){return s.toUpperCase()+a}),ct=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Nr=ne("RegExp"),Ut=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),s={};Te(r,(a,i)=>{let o;(o=t(a,i,e))!==!1&&(s[i]=o||a)}),Object.defineProperties(e,s)},$r=e=>{Ut(e,(t,r)=>{if(te(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const s=e[r];if(te(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Ur=(e,t)=>{const r={},s=a=>{a.forEach(i=>{r[i]=!0})};return we(e)?s(e):s(String(e).split(t)),r},Dr=()=>{},Fr=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Lr(e){return!!(e&&te(e.append)&&e[At]==="FormData"&&e[Fe])}const Mr=e=>{const t=new Array(10),r=(s,a)=>{if(Ce(s)){if(t.indexOf(s)>=0)return;if(Ee(s))return s;if(!("toJSON"in s)){t[a]=s;const i=we(s)?[]:{};return Te(s,(o,l)=>{const g=r(o,a+1);!ye(g)&&(i[l]=g)}),t[a]=void 0,i}}return s};return r(e,0)},Br=ne("AsyncFunction"),Wr=e=>e&&(Ce(e)||te(e))&&te(e.then)&&te(e.catch),Dt=((e,t)=>e?setImmediate:t?((r,s)=>(ue.addEventListener("message",({source:a,data:i})=>{a===ue&&i===r&&s.length&&s.shift()()},!1),a=>{s.push(a),ue.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",te(ue.postMessage)),qr=typeof queueMicrotask<"u"?queueMicrotask.bind(ue):typeof process<"u"&&process.nextTick||Dt,Hr=e=>e!=null&&te(e[Fe]),u={isArray:we,isArrayBuffer:zt,isBuffer:Ee,isFormData:mr,isArrayBufferView:lr,isString:cr,isNumber:_t,isBoolean:dr,isObject:Ce,isPlainObject:ze,isEmptyObject:ur,isReadableStream:br,isRequest:wr,isResponse:Sr,isHeaders:jr,isUndefined:ye,isDate:pr,isFile:fr,isBlob:xr,isRegExp:Nr,isFunction:te,isStream:gr,isURLSearchParams:yr,isTypedArray:Pr,isFileList:hr,forEach:Te,merge:Ge,extend:kr,trim:vr,stripBOM:Er,inherits:Cr,toFlatObject:Tr,kindOf:Le,kindOfTest:ne,endsWith:Rr,toArray:Ir,forEachEntry:Or,matchAll:Ar,isHTMLForm:zr,hasOwnProperty:ct,hasOwnProp:ct,reduceDescriptors:Ut,freezeMethods:$r,toObjectSet:Ur,toCamelCase:_r,noop:Dr,toFiniteNumber:Fr,findKey:Nt,global:ue,isContextDefined:$t,isSpecCompliantForm:Lr,toJSONObject:Mr,isAsyncFn:Br,isThenable:Wr,setImmediate:Dt,asap:qr,isIterable:Hr};function z(e,t,r,s,a){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),a&&(this.response=a,this.status=a.status?a.status:null)}u.inherits(z,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 Ft=z.prototype,Lt={};["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=>{Lt[e]={value:e}});Object.defineProperties(z,Lt);Object.defineProperty(Ft,"isAxiosError",{value:!0});z.from=(e,t,r,s,a,i)=>{const o=Object.create(Ft);u.toFlatObject(e,o,function(c){return c!==Error.prototype},p=>p!=="isAxiosError");const l=e&&e.message?e.message:"Error",g=t==null&&e?e.code:t;return z.call(o,l,g,r,s,a),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};const Vr=null;function Ze(e){return u.isPlainObject(e)||u.isArray(e)}function Mt(e){return u.endsWith(e,"[]")?e.slice(0,-2):e}function dt(e,t,r){return e?e.concat(t).map(function(a,i){return a=Mt(a),!r&&i?"["+a+"]":a}).join(r?".":""):t}function Yr(e){return u.isArray(e)&&!e.some(Ze)}const Kr=u.toFlatObject(u,{},null,function(t){return/^is[A-Z]/.test(t)});function Be(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(w,h){return!u.isUndefined(h[w])});const s=r.metaTokens,a=r.visitor||c,i=r.dots,o=r.indexes,g=(r.Blob||typeof Blob<"u"&&Blob)&&u.isSpecCompliantForm(t);if(!u.isFunction(a))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(!g&&u.isBlob(d))throw new z("Blob is not supported. Use a Buffer instead.");return u.isArrayBuffer(d)||u.isTypedArray(d)?g&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function c(d,w,h){let $=d;if(d&&!h&&typeof d=="object"){if(u.endsWith(w,"{}"))w=s?w:w.slice(0,-2),d=JSON.stringify(d);else if(u.isArray(d)&&Yr(d)||(u.isFileList(d)||u.endsWith(w,"[]"))&&($=u.toArray(d)))return w=Mt(w),$.forEach(function(P,E){!(u.isUndefined(P)||P===null)&&t.append(o===!0?dt([w],E,i):o===null?w:w+"[]",p(P))}),!1}return Ze(d)?!0:(t.append(dt(h,w,i),p(d)),!1)}const m=[],I=Object.assign(Kr,{defaultVisitor:c,convertValue:p,isVisitable:Ze});function j(d,w){if(!u.isUndefined(d)){if(m.indexOf(d)!==-1)throw Error("Circular reference detected in "+w.join("."));m.push(d),u.forEach(d,function($,_){(!(u.isUndefined($)||$===null)&&a.call(t,$,u.isString(_)?_.trim():_,w,I))===!0&&j($,w?w.concat(_):[_])}),m.pop()}}if(!u.isObject(e))throw new TypeError("data must be an object");return j(e),t}function ut(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function st(e,t){this._pairs=[],e&&Be(e,this,t)}const Bt=st.prototype;Bt.append=function(t,r){this._pairs.push([t,r])};Bt.toString=function(t){const r=t?function(s){return t.call(this,s,ut)}:ut;return this._pairs.map(function(a){return r(a[0])+"="+r(a[1])},"").join("&")};function Jr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Wt(e,t,r){if(!t)return e;const s=r&&r.encode||Jr;u.isFunction(r)&&(r={serialize:r});const a=r&&r.serialize;let i;if(a?i=a(t,r):i=u.isURLSearchParams(t)?t.toString():new st(t,r).toString(s),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class pt{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 qt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Xr=typeof URLSearchParams<"u"?URLSearchParams:st,Gr=typeof FormData<"u"?FormData:null,Zr=typeof Blob<"u"?Blob:null,Qr={isBrowser:!0,classes:{URLSearchParams:Xr,FormData:Gr,Blob:Zr},protocols:["http","https","file","blob","url","data"]},at=typeof window<"u"&&typeof document<"u",Qe=typeof navigator=="object"&&navigator||void 0,en=at&&(!Qe||["ReactNative","NativeScript","NS"].indexOf(Qe.product)<0),tn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",rn=at&&window.location.href||"http://localhost",nn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:at,hasStandardBrowserEnv:en,hasStandardBrowserWebWorkerEnv:tn,navigator:Qe,origin:rn},Symbol.toStringTag,{value:"Module"})),ee={...nn,...Qr};function sn(e,t){return Be(e,new ee.classes.URLSearchParams,{visitor:function(r,s,a,i){return ee.isNode&&u.isBuffer(r)?(this.append(s,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function an(e){return u.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function on(e){const t={},r=Object.keys(e);let s;const a=r.length;let i;for(s=0;s<a;s++)i=r[s],t[i]=e[i];return t}function Ht(e){function t(r,s,a,i){let o=r[i++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),g=i>=r.length;return o=!o&&u.isArray(a)?a.length:o,g?(u.hasOwnProp(a,o)?a[o]=[a[o],s]:a[o]=s,!l):((!a[o]||!u.isObject(a[o]))&&(a[o]=[]),t(r,s,a[o],i)&&u.isArray(a[o])&&(a[o]=on(a[o])),!l)}if(u.isFormData(e)&&u.isFunction(e.entries)){const r={};return u.forEachEntry(e,(s,a)=>{t(an(s),a,r,0)}),r}return null}function ln(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 Re={transitional:qt,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const s=r.getContentType()||"",a=s.indexOf("application/json")>-1,i=u.isObject(t);if(i&&u.isHTMLForm(t)&&(t=new FormData(t)),u.isFormData(t))return a?JSON.stringify(Ht(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 sn(t,this.formSerializer).toString();if((l=u.isFileList(t))||s.indexOf("multipart/form-data")>-1){const g=this.env&&this.env.FormData;return Be(l?{"files[]":t}:t,g&&new g,this.formSerializer)}}return i||a?(r.setContentType("application/json",!1),ln(t)):t}],transformResponse:[function(t){const r=this.transitional||Re.transitional,s=r&&r.forcedJSONParsing,a=this.responseType==="json";if(u.isResponse(t)||u.isReadableStream(t))return t;if(t&&u.isString(t)&&(s&&!this.responseType||a)){const o=!(r&&r.silentJSONParsing)&&a;try{return JSON.parse(t,this.parseReviver)}catch(l){if(o)throw l.name==="SyntaxError"?z.from(l,z.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=>{Re.headers[e]={}});const cn=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"]),dn=e=>{const t={};let r,s,a;return e&&e.split(`
2
+ `).forEach(function(o){a=o.indexOf(":"),r=o.substring(0,a).trim().toLowerCase(),s=o.substring(a+1).trim(),!(!r||t[r]&&cn[r])&&(r==="set-cookie"?t[r]?t[r].push(s):t[r]=[s]:t[r]=t[r]?t[r]+", "+s:s)}),t},ft=Symbol("internals");function je(e){return e&&String(e).trim().toLowerCase()}function _e(e){return e===!1||e==null?e:u.isArray(e)?e.map(_e):String(e)}function un(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 pn=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ye(e,t,r,s,a){if(u.isFunction(s))return s.call(this,t,r);if(a&&(t=r),!!u.isString(t)){if(u.isString(s))return t.indexOf(s)!==-1;if(u.isRegExp(s))return s.test(t)}}function fn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,s)=>r.toUpperCase()+s)}function xn(e,t){const r=u.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+r,{value:function(a,i,o){return this[s].call(this,t,a,i,o)},configurable:!0})})}let re=class{constructor(t){t&&this.set(t)}set(t,r,s){const a=this;function i(l,g,p){const c=je(g);if(!c)throw new Error("header name must be a non-empty string");const m=u.findKey(a,c);(!m||a[m]===void 0||p===!0||p===void 0&&a[m]!==!1)&&(a[m||g]=_e(l))}const o=(l,g)=>u.forEach(l,(p,c)=>i(p,c,g));if(u.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(u.isString(t)&&(t=t.trim())&&!pn(t))o(dn(t),r);else if(u.isObject(t)&&u.isIterable(t)){let l={},g,p;for(const c of t){if(!u.isArray(c))throw TypeError("Object iterator must return a key-value pair");l[p=c[0]]=(g=l[p])?u.isArray(g)?[...g,c[1]]:[g,c[1]]:c[1]}o(l,r)}else t!=null&&i(r,t,s);return this}get(t,r){if(t=je(t),t){const s=u.findKey(this,t);if(s){const a=this[s];if(!r)return a;if(r===!0)return un(a);if(u.isFunction(r))return r.call(this,a,s);if(u.isRegExp(r))return r.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=je(t),t){const s=u.findKey(this,t);return!!(s&&this[s]!==void 0&&(!r||Ye(this,this[s],s,r)))}return!1}delete(t,r){const s=this;let a=!1;function i(o){if(o=je(o),o){const l=u.findKey(s,o);l&&(!r||Ye(s,s[l],l,r))&&(delete s[l],a=!0)}}return u.isArray(t)?t.forEach(i):i(t),a}clear(t){const r=Object.keys(this);let s=r.length,a=!1;for(;s--;){const i=r[s];(!t||Ye(this,this[i],i,t,!0))&&(delete this[i],a=!0)}return a}normalize(t){const r=this,s={};return u.forEach(this,(a,i)=>{const o=u.findKey(s,i);if(o){r[o]=_e(a),delete r[i];return}const l=t?fn(i):String(i).trim();l!==i&&delete r[i],r[l]=_e(a),s[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return u.forEach(this,(s,a)=>{s!=null&&s!==!1&&(r[a]=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(a=>s.set(a)),s}static accessor(t){const s=(this[ft]=this[ft]={accessors:{}}).accessors,a=this.prototype;function i(o){const l=je(o);s[l]||(xn(a,o),s[l]=!0)}return u.isArray(t)?t.forEach(i):i(t),this}};re.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);u.reduceDescriptors(re.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[r]=s}}});u.freezeMethods(re);function Ke(e,t){const r=this||Re,s=t||r,a=re.from(s.headers);let i=s.data;return u.forEach(e,function(l){i=l.call(r,i,a.normalize(),t?t.status:void 0)}),a.normalize(),i}function Vt(e){return!!(e&&e.__CANCEL__)}function Se(e,t,r){z.call(this,e??"canceled",z.ERR_CANCELED,t,r),this.name="CanceledError"}u.inherits(Se,z,{__CANCEL__:!0});function Yt(e,t,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?e(r):t(new z("Request failed with status code "+r.status,[z.ERR_BAD_REQUEST,z.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function hn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function gn(e,t){e=e||10;const r=new Array(e),s=new Array(e);let a=0,i=0,o;return t=t!==void 0?t:1e3,function(g){const p=Date.now(),c=s[i];o||(o=p),r[a]=g,s[a]=p;let m=i,I=0;for(;m!==a;)I+=r[m++],m=m%e;if(a=(a+1)%e,a===i&&(i=(i+1)%e),p-o<t)return;const j=c&&p-c;return j?Math.round(I*1e3/j):void 0}}function mn(e,t){let r=0,s=1e3/t,a,i;const o=(p,c=Date.now())=>{r=c,a=null,i&&(clearTimeout(i),i=null),e(...p)};return[(...p)=>{const c=Date.now(),m=c-r;m>=s?o(p,c):(a=p,i||(i=setTimeout(()=>{i=null,o(a)},s-m)))},()=>a&&o(a)]}const De=(e,t,r=3)=>{let s=0;const a=gn(50,250);return mn(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,g=o-s,p=a(g),c=o<=l;s=o;const m={loaded:o,total:l,progress:l?o/l:void 0,bytes:g,rate:p||void 0,estimated:p&&l&&c?(l-o)/p:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(m)},r)},xt=(e,t)=>{const r=e!=null;return[s=>t[0]({lengthComputable:r,total:e,loaded:s}),t[1]]},ht=e=>(...t)=>u.asap(()=>e(...t)),yn=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,bn=ee.hasStandardBrowserEnv?{write(e,t,r,s,a,i){const o=[e+"="+encodeURIComponent(t)];u.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),u.isString(s)&&o.push("path="+s),u.isString(a)&&o.push("domain="+a),i===!0&&o.push("secure"),document.cookie=o.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 wn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Sn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Kt(e,t,r){let s=!wn(t);return e&&(s||r==!1)?Sn(e,t):t}const gt=e=>e instanceof re?{...e}:e;function xe(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 a(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 o(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 g={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(p,c,m)=>a(gt(p),gt(c),m,!0)};return u.forEach(Object.keys({...e,...t}),function(c){const m=g[c]||a,I=m(e[c],t[c],c);u.isUndefined(I)&&m!==l||(r[c]=I)}),r}const Jt=e=>{const t=xe({},e);let{data:r,withXSRFToken:s,xsrfHeaderName:a,xsrfCookieName:i,headers:o,auth:l}=t;if(t.headers=o=re.from(o),t.url=Wt(Kt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),u.isFormData(r)){if(ee.hasStandardBrowserEnv||ee.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(u.isFunction(r.getHeaders)){const g=r.getHeaders(),p=["content-type","content-length"];Object.entries(g).forEach(([c,m])=>{p.includes(c.toLowerCase())&&o.set(c,m)})}}if(ee.hasStandardBrowserEnv&&(s&&u.isFunction(s)&&(s=s(t)),s||s!==!1&&yn(t.url))){const g=a&&i&&bn.read(i);g&&o.set(a,g)}return t},jn=typeof XMLHttpRequest<"u",vn=jn&&function(e){return new Promise(function(r,s){const a=Jt(e);let i=a.data;const o=re.from(a.headers).normalize();let{responseType:l,onUploadProgress:g,onDownloadProgress:p}=a,c,m,I,j,d;function w(){j&&j(),d&&d(),a.cancelToken&&a.cancelToken.unsubscribe(c),a.signal&&a.signal.removeEventListener("abort",c)}let h=new XMLHttpRequest;h.open(a.method.toUpperCase(),a.url,!0),h.timeout=a.timeout;function $(){if(!h)return;const P=re.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),L={data:!l||l==="text"||l==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:P,config:e,request:h};Yt(function(O){r(O),w()},function(O){s(O),w()},L),h=null}"onloadend"in h?h.onloadend=$:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout($)},h.onabort=function(){h&&(s(new z("Request aborted",z.ECONNABORTED,e,h)),h=null)},h.onerror=function(E){const L=E&&E.message?E.message:"Network Error",y=new z(L,z.ERR_NETWORK,e,h);y.event=E||null,s(y),h=null},h.ontimeout=function(){let E=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const L=a.transitional||qt;a.timeoutErrorMessage&&(E=a.timeoutErrorMessage),s(new z(E,L.clarifyTimeoutError?z.ETIMEDOUT:z.ECONNABORTED,e,h)),h=null},i===void 0&&o.setContentType(null),"setRequestHeader"in h&&u.forEach(o.toJSON(),function(E,L){h.setRequestHeader(L,E)}),u.isUndefined(a.withCredentials)||(h.withCredentials=!!a.withCredentials),l&&l!=="json"&&(h.responseType=a.responseType),p&&([I,d]=De(p,!0),h.addEventListener("progress",I)),g&&h.upload&&([m,j]=De(g),h.upload.addEventListener("progress",m),h.upload.addEventListener("loadend",j)),(a.cancelToken||a.signal)&&(c=P=>{h&&(s(!P||P.type?new Se(null,e,h):P),h.abort(),h=null)},a.cancelToken&&a.cancelToken.subscribe(c),a.signal&&(a.signal.aborted?c():a.signal.addEventListener("abort",c)));const _=hn(a.url);if(_&&ee.protocols.indexOf(_)===-1){s(new z("Unsupported protocol "+_+":",z.ERR_BAD_REQUEST,e));return}h.send(i||null)})},kn=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let s=new AbortController,a;const i=function(p){if(!a){a=!0,l();const c=p instanceof Error?p:this.reason;s.abort(c instanceof z?c:new Se(c instanceof Error?c.message:c))}};let o=t&&setTimeout(()=>{o=null,i(new z(`timeout ${t} of ms exceeded`,z.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(p=>{p.unsubscribe?p.unsubscribe(i):p.removeEventListener("abort",i)}),e=null)};e.forEach(p=>p.addEventListener("abort",i));const{signal:g}=s;return g.unsubscribe=()=>u.asap(l),g}},En=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let s=0,a;for(;s<r;)a=s+t,yield e.slice(s,a),s=a},Cn=async function*(e,t){for await(const r of Tn(e))yield*En(r,t)},Tn=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()}},mt=(e,t,r,s)=>{const a=Cn(e,t);let i=0,o,l=g=>{o||(o=!0,s&&s(g))};return new ReadableStream({async pull(g){try{const{done:p,value:c}=await a.next();if(p){l(),g.close();return}let m=c.byteLength;if(r){let I=i+=m;r(I)}g.enqueue(new Uint8Array(c))}catch(p){throw l(p),p}},cancel(g){return l(g),a.return()}},{highWaterMark:2})},yt=64*1024,{isFunction:Oe}=u,Rn=(({Request:e,Response:t})=>({Request:e,Response:t}))(u.global),{ReadableStream:bt,TextEncoder:wt}=u.global,St=(e,...t)=>{try{return!!e(...t)}catch{return!1}},In=e=>{e=u.merge.call({skipUndefined:!0},Rn,e);const{fetch:t,Request:r,Response:s}=e,a=t?Oe(t):typeof fetch=="function",i=Oe(r),o=Oe(s);if(!a)return!1;const l=a&&Oe(bt),g=a&&(typeof wt=="function"?(d=>w=>d.encode(w))(new wt):async d=>new Uint8Array(await new r(d).arrayBuffer())),p=i&&l&&St(()=>{let d=!1;const w=new r(ee.origin,{body:new bt,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!w}),c=o&&l&&St(()=>u.isReadableStream(new s("").body)),m={stream:c&&(d=>d.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!m[d]&&(m[d]=(w,h)=>{let $=w&&w[d];if($)return $.call(w);throw new z(`Response type '${d}' is not supported`,z.ERR_NOT_SUPPORT,h)})});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 g(d)).byteLength},j=async(d,w)=>{const h=u.toFiniteNumber(d.getContentLength());return h??I(w)};return async d=>{let{url:w,method:h,data:$,signal:_,cancelToken:P,timeout:E,onDownloadProgress:L,onUploadProgress:y,responseType:O,headers:b,withCredentials:N="same-origin",fetchOptions:J}=Jt(d),D=t||fetch;O=O?(O+"").toLowerCase():"text";let H=kn([_,P&&P.toAbortSignal()],E),Q=null;const k=H&&H.unsubscribe&&(()=>{H.unsubscribe()});let G;try{if(y&&p&&h!=="get"&&h!=="head"&&(G=await j(b,$))!==0){let x=new r(w,{method:"POST",body:$,duplex:"half"}),R;if(u.isFormData($)&&(R=x.headers.get("content-type"))&&b.setContentType(R),x.body){const[U,f]=xt(G,De(ht(y)));$=mt(x.body,yt,U,f)}}u.isString(N)||(N=N?"include":"omit");const M=i&&"credentials"in r.prototype,F={...J,signal:H,method:h.toUpperCase(),headers:b.normalize().toJSON(),body:$,duplex:"half",credentials:M?N:void 0};Q=i&&new r(w,F);let T=await(i?D(Q,J):D(w,F));const V=c&&(O==="stream"||O==="response");if(c&&(L||V&&k)){const x={};["status","statusText","headers"].forEach(v=>{x[v]=T[v]});const R=u.toFiniteNumber(T.headers.get("content-length")),[U,f]=L&&xt(R,De(ht(L),!0))||[];T=new s(mt(T.body,yt,U,()=>{f&&f(),k&&k()}),x)}O=O||"text";let K=await m[u.findKey(m,O)||"text"](T,d);return!V&&k&&k(),await new Promise((x,R)=>{Yt(x,R,{data:K,headers:re.from(T.headers),status:T.status,statusText:T.statusText,config:d,request:Q})})}catch(M){throw k&&k(),M&&M.name==="TypeError"&&/Load failed|fetch/i.test(M.message)?Object.assign(new z("Network Error",z.ERR_NETWORK,d,Q),{cause:M.cause||M}):z.from(M,M&&M.code,d,Q)}}},Pn=new Map,Xt=e=>{let t=e?e.env:{};const{fetch:r,Request:s,Response:a}=t,i=[s,a,r];let o=i.length,l=o,g,p,c=Pn;for(;l--;)g=i[l],p=c.get(g),p===void 0&&c.set(g,p=l?new Map:In(t)),c=p;return p};Xt();const et={http:Vr,xhr:vn,fetch:{get:Xt}};u.forEach(et,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const jt=e=>`- ${e}`,On=e=>u.isFunction(e)||e===null||e===!1,Gt={getAdapter:(e,t)=>{e=u.isArray(e)?e:[e];const{length:r}=e;let s,a;const i={};for(let o=0;o<r;o++){s=e[o];let l;if(a=s,!On(s)&&(a=et[(l=String(s)).toLowerCase()],a===void 0))throw new z(`Unknown adapter '${l}'`);if(a&&(u.isFunction(a)||(a=a.get(t))))break;i[l||"#"+o]=a}if(!a){const o=Object.entries(i).map(([g,p])=>`adapter ${g} `+(p===!1?"is not supported by the environment":"is not available in the build"));let l=r?o.length>1?`since :
4
+ `+o.map(jt).join(`
5
+ `):" "+jt(o[0]):"as no adapter specified";throw new z("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return a},adapters:et};function Je(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Se(null,e)}function vt(e){return Je(e),e.headers=re.from(e.headers),e.data=Ke.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Gt.getAdapter(e.adapter||Re.adapter,e)(e).then(function(s){return Je(e),s.data=Ke.call(e,e.transformResponse,s),s.headers=re.from(s.headers),s},function(s){return Vt(s)||(Je(e),s&&s.response&&(s.response.data=Ke.call(e,e.transformResponse,s.response),s.response.headers=re.from(s.response.headers))),Promise.reject(s)})}const Zt="1.12.2",We={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{We[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const kt={};We.transitional=function(t,r,s){function a(i,o){return"[Axios v"+Zt+"] Transitional option '"+i+"'"+o+(s?". "+s:"")}return(i,o,l)=>{if(t===!1)throw new z(a(o," has been removed"+(r?" in "+r:"")),z.ERR_DEPRECATED);return r&&!kt[o]&&(kt[o]=!0,console.warn(a(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,o,l):!0}};We.spelling=function(t){return(r,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function An(e,t,r){if(typeof e!="object")throw new z("options must be an object",z.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let a=s.length;for(;a-- >0;){const i=s[a],o=t[i];if(o){const l=e[i],g=l===void 0||o(l,i,e);if(g!==!0)throw new z("option "+i+" must be "+g,z.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new z("Unknown option "+i,z.ERR_BAD_OPTION)}}const Ne={assertOptions:An,validators:We},ae=Ne.validators;let pe=class{constructor(t){this.defaults=t||{},this.interceptors={request:new pt,response:new pt}}async request(t,r){try{return await this._request(t,r)}catch(s){if(s instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const i=a.stack?a.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=xe(this.defaults,r);const{transitional:s,paramsSerializer:a,headers:i}=r;s!==void 0&&Ne.assertOptions(s,{silentJSONParsing:ae.transitional(ae.boolean),forcedJSONParsing:ae.transitional(ae.boolean),clarifyTimeoutError:ae.transitional(ae.boolean)},!1),a!=null&&(u.isFunction(a)?r.paramsSerializer={serialize:a}:Ne.assertOptions(a,{encode:ae.function,serialize:ae.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Ne.assertOptions(r,{baseUrl:ae.spelling("baseURL"),withXsrfToken:ae.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&u.merge(i.common,i[r.method]);i&&u.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),r.headers=re.concat(o,i);const l=[];let g=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(r)===!1||(g=g&&w.synchronous,l.unshift(w.fulfilled,w.rejected))});const p=[];this.interceptors.response.forEach(function(w){p.push(w.fulfilled,w.rejected)});let c,m=0,I;if(!g){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 j=r;for(;m<I;){const d=l[m++],w=l[m++];try{j=d(j)}catch(h){w.call(this,h);break}}try{c=vt.call(this,j)}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=xe(this.defaults,t);const r=Kt(t.baseURL,t.url,t.allowAbsoluteUrls);return Wt(r,t.params,t.paramsSerializer)}};u.forEach(["delete","get","head","options"],function(t){pe.prototype[t]=function(r,s){return this.request(xe(s||{},{method:t,url:r,data:(s||{}).data}))}});u.forEach(["post","put","patch"],function(t){function r(s){return function(i,o,l){return this.request(xe(l||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}pe.prototype[t]=r(),pe.prototype[t+"Form"]=r(!0)});let zn=class Qt{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(a=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](a);s._listeners=null}),this.promise.then=a=>{let i;const o=new Promise(l=>{s.subscribe(l),i=l}).then(a);return o.cancel=function(){s.unsubscribe(i)},o},t(function(i,o,l){s.reason||(s.reason=new Se(i,o,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 Qt(function(a){t=a}),cancel:t}}};function _n(e){return function(r){return e.apply(null,r)}}function Nn(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 er(e){const t=new pe(e),r=Ot(pe.prototype.request,t);return u.extend(r,pe.prototype,t,{allOwnKeys:!0}),u.extend(r,t,null,{allOwnKeys:!0}),r.create=function(a){return er(xe(e,a))},r}const B=er(Re);B.Axios=pe;B.CanceledError=Se;B.CancelToken=zn;B.isCancel=Vt;B.VERSION=Zt;B.toFormData=Be;B.AxiosError=z;B.Cancel=B.CanceledError;B.all=function(t){return Promise.all(t)};B.spread=_n;B.isAxiosError=Nn;B.mergeConfig=xe;B.AxiosHeaders=re;B.formToJSON=e=>Ht(u.isHTMLForm(e)?new FormData(e):e);B.getAdapter=Gt.getAdapter;B.HttpStatusCode=tt;B.default=B;const{Axios:Xs,AxiosError:Gs,CanceledError:Zs,isCancel:Qs,CancelToken:ea,VERSION:ta,all:ra,Cancel:na,isAxiosError:sa,spread:aa,toFormData:oa,AxiosHeaders:ia,HttpStatusCode:la,formToJSON:ca,getAdapter:da,mergeConfig:ua}=B;class $n{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=B.create({baseURL:this.baseUrl,headers:{"Content-Type":"application/json",...this.apiKey?{"x-api-key":this.apiKey}:{}},timeout:1e4})}async request(t,r,s,a={}){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:a})).data}catch(i){if(console.error("❌ [Request Error]:",i),i.isAxiosError){const o=i.response?.status||0,l=i.response?.data?.message||i.message||"Unknown Axios error occurred";throw new Error(`Request failed (${o}): ${l}`)}throw new Error(`Unexpected error: ${i.message||"Unknown failure"}`)}}async signup(t){const{name:r,email:s,password:a}=t;if(!r||!s||!a)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:a}=t;if(!r||!s)throw new Error("login: 'email' and 'password' are required");return this.request("POST","/users/login",{email:r,password:s,appId:a||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:a,appId:i}=t;if(!r)throw new Error("changePassword: 'userId' is required");if(!s||!a)throw new Error("changePassword: both 'currentPassword' and 'newPassword' are required");return this.request("PUT",`/users/change-password/${r}`,{currentPassword:s,newPassword:a,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:a}=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:a||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:a,appId:i}=t;if(!r||!s||!a)throw new Error("resetPassword: 'email', 'otp' and 'newPassword' are required");return this.request("POST","/users/reset-password",{email:r,otp:s,newPassword:a,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:a}=t;if(!r||!s)throw new Error("updateUserData: 'userId' and 'dataId' are required");if(!a)throw new Error("updateUserData: 'data' is required");return this.request("PUT",`/users/${r}/data/${s}`,a)}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 Ae={exports:{}},ve={};/**
7
+ * @license React
8
+ * react-jsx-runtime.production.js
9
+ *
10
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
11
+ *
12
+ * This source code is licensed under the MIT license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ */var Et;function Un(){if(Et)return ve;Et=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,a,i){var o=null;if(i!==void 0&&(o=""+i),a.key!==void 0&&(o=""+a.key),"key"in a){i={};for(var l in a)l!=="key"&&(i[l]=a[l])}else i=a;return a=i.ref,{$$typeof:e,type:s,key:o,ref:a!==void 0?a:null,props:i}}return ve.Fragment=t,ve.jsx=r,ve.jsxs=r,ve}var ke={};/**
15
+ * @license React
16
+ * react-jsx-runtime.development.js
17
+ *
18
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
19
+ *
20
+ * This source code is licensed under the MIT license found in the
21
+ * LICENSE file in the root directory of this source tree.
22
+ */var Ct;function Dn(){return Ct||(Ct=1,process.env.NODE_ENV!=="production"&&(function(){function e(x){if(x==null)return null;if(typeof x=="function")return x.$$typeof===D?null:x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case h:return"Fragment";case _:return"Profiler";case $:return"StrictMode";case y:return"Suspense";case O:return"SuspenseList";case J: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 w:return"Portal";case E:return x.displayName||"Context";case P:return(x._context.displayName||"Context")+".Consumer";case L:var R=x.render;return x=x.displayName,x||(x=R.displayName||R.name||"",x=x!==""?"ForwardRef("+x+")":"ForwardRef"),x;case b:return R=x.displayName||null,R!==null?R:e(x.type)||"Memo";case N:R=x._payload,x=x._init;try{return e(x(R))}catch{}}return null}function t(x){return""+x}function r(x){try{t(x);var R=!1}catch{R=!0}if(R){R=console;var U=R.error,f=typeof Symbol=="function"&&Symbol.toStringTag&&x[Symbol.toStringTag]||x.constructor.name||"Object";return U.call(R,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",f),t(x)}}function s(x){if(x===h)return"<>";if(typeof x=="object"&&x!==null&&x.$$typeof===N)return"<...>";try{var R=e(x);return R?"<"+R+">":"<...>"}catch{return"<...>"}}function a(){var x=H.A;return x===null?null:x.getOwner()}function i(){return Error("react-stack-top-frame")}function o(x){if(Q.call(x,"key")){var R=Object.getOwnPropertyDescriptor(x,"key").get;if(R&&R.isReactWarning)return!1}return x.key!==void 0}function l(x,R){function U(){M||(M=!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)",R))}U.isReactWarning=!0,Object.defineProperty(x,"key",{get:U,configurable:!0})}function g(){var x=e(this.type);return F[x]||(F[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,R,U,f,v,X){var Y=U.ref;return x={$$typeof:d,type:x,key:R,props:U,_owner:f},(Y!==void 0?Y:null)!==null?Object.defineProperty(x,"ref",{enumerable:!1,get:g}):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:v}),Object.defineProperty(x,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.freeze&&(Object.freeze(x.props),Object.freeze(x)),x}function c(x,R,U,f,v,X){var Y=R.children;if(Y!==void 0)if(f)if(k(Y)){for(f=0;f<Y.length;f++)m(Y[f]);Object.freeze&&Object.freeze(Y)}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(Y);if(Q.call(R,"key")){Y=e(x);var se=Object.keys(R).filter(function(ce){return ce!=="key"});f=0<se.length?"{key: someKey, "+se.join(": ..., ")+": ...}":"{key: someKey}",K[Y+f]||(se=0<se.length?"{"+se.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
23
+ let props = %s;
24
+ <%s {...props} />
25
+ React keys must be passed directly to JSX without using spread:
26
+ let props = %s;
27
+ <%s key={someKey} {...props} />`,f,Y,se,Y),K[Y+f]=!0)}if(Y=null,U!==void 0&&(r(U),Y=""+U),o(R)&&(r(R.key),Y=""+R.key),"key"in R){U={};for(var le in R)le!=="key"&&(U[le]=R[le])}else U=R;return Y&&l(U,typeof x=="function"?x.displayName||x.name||"Unknown":x),p(x,Y,U,a(),v,X)}function m(x){I(x)?x._store&&(x._store.validated=1):typeof x=="object"&&x!==null&&x.$$typeof===N&&(x._payload.status==="fulfilled"?I(x._payload.value)&&x._payload.value._store&&(x._payload.value._store.validated=1):x._store&&(x._store.validated=1))}function I(x){return typeof x=="object"&&x!==null&&x.$$typeof===d}var j=S,d=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),E=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),D=Symbol.for("react.client.reference"),H=j.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=Object.prototype.hasOwnProperty,k=Array.isArray,G=console.createTask?console.createTask:function(){return null};j={react_stack_bottom_frame:function(x){return x()}};var M,F={},T=j.react_stack_bottom_frame.bind(j,i)(),V=G(s(i)),K={};ke.Fragment=h,ke.jsx=function(x,R,U){var f=1e4>H.recentlyCreatedOwnerStacks++;return c(x,R,U,!1,f?Error("react-stack-top-frame"):T,f?G(s(x)):V)},ke.jsxs=function(x,R,U){var f=1e4>H.recentlyCreatedOwnerStacks++;return c(x,R,U,!0,f?Error("react-stack-top-frame"):T,f?G(s(x)):V)}})()),ke}var Tt;function Fn(){return Tt||(Tt=1,process.env.NODE_ENV==="production"?Ae.exports=Un():Ae.exports=Dn()),Ae.exports}var n=Fn();const Ln=async(e,t)=>{const{name:r,email:s,password:a,appId:i,phone:o,address:l,avatarUrl:g,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||!a||!i)throw new Error("Name, email, password, and appId are required");try{const j=await B.post(`${m}/users/signup`,{name:r,email:s,password:a,appId:i,phone:o,address:l,avatarUrl:g,isActive:p,role:c},{headers:{"Content-Type":"application/json","x-api-key":I}});return j.data?.user&&localStorage.setItem("userInfo",JSON.stringify(j.data.user)),j.data.user}catch(j){const d=j.response?.data?.message||j.message||"Signup failed";if(console.error("Signup API Error:",d),j.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 j.response?.status===404?{success:!1,message:"Invalid or inactive app",status:404}:{success:!1,message:d,status:j.response?.status||500}}};/**
28
+ * @license lucide-react v0.544.0 - ISC
29
+ *
30
+ * This source code is licensed under the ISC license.
31
+ * See the LICENSE file in the root directory of this source tree.
32
+ */const Mn=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Bn=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,s)=>s?s.toUpperCase():r.toLowerCase()),Rt=e=>{const t=Bn(e);return t.charAt(0).toUpperCase()+t.slice(1)},tr=(...e)=>e.filter((t,r,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===r).join(" ").trim(),Wn=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
33
+ * @license lucide-react v0.544.0 - ISC
34
+ *
35
+ * This source code is licensed under the ISC license.
36
+ * See the LICENSE file in the root directory of this source tree.
37
+ */var qn={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
38
+ * @license lucide-react v0.544.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */const Hn=S.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:a="",children:i,iconNode:o,...l},g)=>S.createElement("svg",{ref:g,...qn,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:tr("lucide",a),...!i&&!Wn(l)&&{"aria-hidden":"true"},...l},[...o.map(([p,c])=>S.createElement(p,c)),...Array.isArray(i)?i:[i]]));/**
43
+ * @license lucide-react v0.544.0 - ISC
44
+ *
45
+ * This source code is licensed under the ISC license.
46
+ * See the LICENSE file in the root directory of this source tree.
47
+ */const W=(e,t)=>{const r=S.forwardRef(({className:s,...a},i)=>S.createElement(Hn,{ref:i,iconNode:t,className:tr(`lucide-${Mn(Rt(e))}`,`lucide-${e}`,s),...a}));return r.displayName=Rt(e),r};/**
48
+ * @license lucide-react v0.544.0 - ISC
49
+ *
50
+ * This source code is licensed under the ISC license.
51
+ * See the LICENSE file in the root directory of this source tree.
52
+ */const Vn=[["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"}]],rt=W("camera",Vn);/**
53
+ * @license lucide-react v0.544.0 - ISC
54
+ *
55
+ * This source code is licensed under the ISC license.
56
+ * See the LICENSE file in the root directory of this source tree.
57
+ */const Yn=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Kn=W("chevron-down",Yn);/**
58
+ * @license lucide-react v0.544.0 - ISC
59
+ *
60
+ * This source code is licensed under the ISC license.
61
+ * See the LICENSE file in the root directory of this source tree.
62
+ */const Jn=[["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"}]],oe=W("circle-alert",Jn);/**
63
+ * @license lucide-react v0.544.0 - ISC
64
+ *
65
+ * This source code is licensed under the ISC license.
66
+ * See the LICENSE file in the root directory of this source tree.
67
+ */const Xn=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],fe=W("circle-check-big",Xn);/**
68
+ * @license lucide-react v0.544.0 - ISC
69
+ *
70
+ * This source code is licensed under the ISC license.
71
+ * See the LICENSE file in the root directory of this source tree.
72
+ */const Gn=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Xe=W("circle-check",Gn);/**
73
+ * @license lucide-react v0.544.0 - ISC
74
+ *
75
+ * This source code is licensed under the ISC license.
76
+ * See the LICENSE file in the root directory of this source tree.
77
+ */const Zn=[["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"}]],Qn=W("database",Zn);/**
78
+ * @license lucide-react v0.544.0 - ISC
79
+ *
80
+ * This source code is licensed under the ISC license.
81
+ * See the LICENSE file in the root directory of this source tree.
82
+ */const es=[["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"}]],ts=W("ellipsis-vertical",es);/**
83
+ * @license lucide-react v0.544.0 - ISC
84
+ *
85
+ * This source code is licensed under the ISC license.
86
+ * See the LICENSE file in the root directory of this source tree.
87
+ */const rs=[["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"}]],ot=W("eye-off",rs);/**
88
+ * @license lucide-react v0.544.0 - ISC
89
+ *
90
+ * This source code is licensed under the ISC license.
91
+ * See the LICENSE file in the root directory of this source tree.
92
+ */const ns=[["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"}]],it=W("eye",ns);/**
93
+ * @license lucide-react v0.544.0 - ISC
94
+ *
95
+ * This source code is licensed under the ISC license.
96
+ * See the LICENSE file in the root directory of this source tree.
97
+ */const ss=[["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"}]],as=W("house",ss);/**
98
+ * @license lucide-react v0.544.0 - ISC
99
+ *
100
+ * This source code is licensed under the ISC license.
101
+ * See the LICENSE file in the root directory of this source tree.
102
+ */const os=[["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"}]],rr=W("image",os);/**
103
+ * @license lucide-react v0.544.0 - ISC
104
+ *
105
+ * This source code is licensed under the ISC license.
106
+ * See the LICENSE file in the root directory of this source tree.
107
+ */const is=[["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"}]],nr=W("key-round",is);/**
108
+ * @license lucide-react v0.544.0 - ISC
109
+ *
110
+ * This source code is licensed under the ISC license.
111
+ * See the LICENSE file in the root directory of this source tree.
112
+ */const ls=[["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"}]],sr=W("key",ls);/**
113
+ * @license lucide-react v0.544.0 - ISC
114
+ *
115
+ * This source code is licensed under the ISC license.
116
+ * See the LICENSE file in the root directory of this source tree.
117
+ */const cs=[["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"}]],ds=W("link-2",cs);/**
118
+ * @license lucide-react v0.544.0 - ISC
119
+ *
120
+ * This source code is licensed under the ISC license.
121
+ * See the LICENSE file in the root directory of this source tree.
122
+ */const us=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ie=W("loader-circle",us);/**
123
+ * @license lucide-react v0.544.0 - ISC
124
+ *
125
+ * This source code is licensed under the ISC license.
126
+ * See the LICENSE file in the root directory of this source tree.
127
+ */const ps=[["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"}]],fs=W("loader",ps);/**
128
+ * @license lucide-react v0.544.0 - ISC
129
+ *
130
+ * This source code is licensed under the ISC license.
131
+ * See the LICENSE file in the root directory of this source tree.
132
+ */const xs=[["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"}]],me=W("lock",xs);/**
133
+ * @license lucide-react v0.544.0 - ISC
134
+ *
135
+ * This source code is licensed under the ISC license.
136
+ * See the LICENSE file in the root directory of this source tree.
137
+ */const hs=[["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"}]],lt=W("log-out",hs);/**
138
+ * @license lucide-react v0.544.0 - ISC
139
+ *
140
+ * This source code is licensed under the ISC license.
141
+ * See the LICENSE file in the root directory of this source tree.
142
+ */const gs=[["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"}]],he=W("mail",gs);/**
143
+ * @license lucide-react v0.544.0 - ISC
144
+ *
145
+ * This source code is licensed under the ISC license.
146
+ * See the LICENSE file in the root directory of this source tree.
147
+ */const ms=[["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"}]],ys=W("map-pin",ms);/**
148
+ * @license lucide-react v0.544.0 - ISC
149
+ *
150
+ * This source code is licensed under the ISC license.
151
+ * See the LICENSE file in the root directory of this source tree.
152
+ */const bs=[["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"}]],ws=W("pen-line",bs);/**
153
+ * @license lucide-react v0.544.0 - ISC
154
+ *
155
+ * This source code is licensed under the ISC license.
156
+ * See the LICENSE file in the root directory of this source tree.
157
+ */const Ss=[["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"}]],js=W("phone",Ss);/**
158
+ * @license lucide-react v0.544.0 - ISC
159
+ *
160
+ * This source code is licensed under the ISC license.
161
+ * See the LICENSE file in the root directory of this source tree.
162
+ */const vs=[["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"}]],ks=W("save",vs);/**
163
+ * @license lucide-react v0.544.0 - ISC
164
+ *
165
+ * This source code is licensed under the ISC license.
166
+ * See the LICENSE file in the root directory of this source tree.
167
+ */const Es=[["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"}]],ar=W("send",Es);/**
168
+ * @license lucide-react v0.544.0 - ISC
169
+ *
170
+ * This source code is licensed under the ISC license.
171
+ * See the LICENSE file in the root directory of this source tree.
172
+ */const Cs=[["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"}]],Ts=W("settings",Cs);/**
173
+ * @license lucide-react v0.544.0 - ISC
174
+ *
175
+ * This source code is licensed under the ISC license.
176
+ * See the LICENSE file in the root directory of this source tree.
177
+ */const Rs=[["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"}]],or=W("shield",Rs);/**
178
+ * @license lucide-react v0.544.0 - ISC
179
+ *
180
+ * This source code is licensed under the ISC license.
181
+ * See the LICENSE file in the root directory of this source tree.
182
+ */const Is=[["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"}]],$e=W("trash-2",Is);/**
183
+ * @license lucide-react v0.544.0 - ISC
184
+ *
185
+ * This source code is licensed under the ISC license.
186
+ * See the LICENSE file in the root directory of this source tree.
187
+ */const Ps=[["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"}]],It=W("triangle-alert",Ps);/**
188
+ * @license lucide-react v0.544.0 - ISC
189
+ *
190
+ * This source code is licensed under the ISC license.
191
+ * See the LICENSE file in the root directory of this source tree.
192
+ */const Os=[["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"}]],As=W("user-x",Os);/**
193
+ * @license lucide-react v0.544.0 - ISC
194
+ *
195
+ * This source code is licensed under the ISC license.
196
+ * See the LICENSE file in the root directory of this source tree.
197
+ */const zs=[["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"}]],be=W("user",zs);/**
198
+ * @license lucide-react v0.544.0 - ISC
199
+ *
200
+ * This source code is licensed under the ISC license.
201
+ * See the LICENSE file in the root directory of this source tree.
202
+ */const _s=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ie=W("x",_s),Ue={baseUrl:"",apiKey:"",appId:""},Ns=e=>{if(!e.baseUrl||!e.apiKey||!e.appId)throw new Error("baseUrl, apiKey, and appId are required");Ue.baseUrl=e.baseUrl,Ue.apiKey=e.apiKey,Ue.appId=e.appId},ge=()=>Ue,$s=({logoUrl:e,logoLinkUrl:t,title:r="Create Your Account",subtitle:s="Join our platform today",footerText:a="Secure authentication powered by Neuctra Authix",primaryColor:i="#00C214",gradient:o="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,showAvatar:g=!1,loginUrl:p,onSuccess:c,onError:m})=>{const{baseUrl:I,apiKey:j,appId:d}=ge(),w={name:"",email:"",password:"",...g&&{avatarUrl:""}},[h,$]=S.useState(w),[_,P]=S.useState(!1),[E,L]=S.useState(!1),[y,O]=S.useState(null),[b,N]=S.useState({}),J=typeof window<"u"?window.innerWidth<768:!1,D=l?"#ffffff":"#111827",H=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)",G=V=>{const{name:K,value:x}=V.target;$(R=>({...R,[K]:x})),b[K]&&N(R=>({...R,[K]:void 0}))},M=()=>{const V={};return h.name.trim()||(V.name="Name is required"),h.email.trim()?/\S+@\S+\.\S+/.test(h.email)||(V.email="Invalid email address"):V.email="Email is required",h.password?h.password.length<6&&(V.password="Password must be at least 6 characters"):V.password="Password is required",N(V),Object.keys(V).length===0},F=async V=>{if(V.preventDefault(),!!M()){L(!0),O(null);try{const K={...h,appId:d},x=await Ln(K,{baseUrl:I,apiKey:j});O({type:"success",text:"Account created successfully!"}),c&&c(x)}catch(K){const x=K.message||"Signup failed. Please try again.";O({type:"error",text:x}),m&&m(K)}finally{L(!1)}}},T={width:"100%",padding:J?"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:J?"320px":"380px",width:"100%",maxWidth:J?"340px":"390px",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:J?"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(be,{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:H},children:s})]}),g&&h.avatarUrl&&n.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"16px"},children:n.jsx("img",{src:h.avatarUrl,alt:"Avatar Preview",style:{width:"60px",height:"60px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${i}30`},onError:V=>{const K=V.target;K.style.display="none"}})}),n.jsxs("form",{onSubmit:F,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(be,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"signup-name",type:"text",name:"name",placeholder:"Enter your full name",value:h.name,onChange:G,style:{...T,borderColor:b.name?"#ef4444":k}})]}),b.name&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:b.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:H}}),n.jsx("input",{id:"signup-email",type:"email",name:"email",placeholder:"Enter your email address",value:h.email,onChange:G,style:{...T,borderColor:b.email?"#ef4444":k}})]}),b.email&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:b.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(me,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"signup-password",type:_?"text":"password",name:"password",placeholder:"Create a secure password",value:h.password,onChange:G,style:{...T,borderColor:b.password?"#ef4444":k}}),n.jsx("button",{type:"button",onClick:()=>P(!_),style:{position:"absolute",right:"14px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:H,cursor:"pointer",padding:"4px"},children:_?n.jsx(ot,{size:20}):n.jsx(it,{size:20})})]}),b.password&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:b.password})]}),g&&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(rr,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"signup-avatar",type:"url",name:"avatarUrl",placeholder:"Paste your avatar image URL",value:h.avatarUrl||"",onChange:G,style:T})]})]}),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(fe,{size:20}):n.jsx(oe,{size:20}),n.jsx("span",{children:y.text})]}),n.jsx("button",{type:"submit",disabled:E,style:{padding:"12px",background:o,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600,cursor:E?"not-allowed":"pointer",opacity:E?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:E?n.jsxs(n.Fragment,{children:[n.jsx(fs,{size:18,style:{animation:"spin 1s linear infinite"}}),"Creating Account..."]}):"Create Account"})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:H,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]}),n.jsx("style",{children:`
203
+ @keyframes spin {
204
+ from { transform: rotate(0deg); }
205
+ to { transform: rotate(360deg); }
206
+ }
207
+ `})]})},Us=async(e,t)=>{const{email:r,password:s,appId:a}=e,{baseUrl:i,apiKey:o}=t;if(!o)throw new Error("API key is required for login");try{const l=await B.post(`${i}/users/login`,{email:r,password:s,appId:a},{headers:{"Content-Type":"application/json","x-api-key":o}});return l.data?.user&&localStorage.setItem("userInfo",JSON.stringify(l.data.user)),l.data.user}catch(l){const g=l.response?.data?.message||l.message||"Login failed";throw console.error("Login API Error:",g),{success:!1,message:g,status:l.response?.status||500}}},Ds=({logoUrl:e,logoLinkUrl:t,title:r="Sign In to Your Account",subtitle:s="Welcome back! Please enter your details",footerText:a="Secure authentication powered by Neuctra Authix",primaryColor:i="#00C214",gradient:o="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,signupUrl:g,onSuccess:p,onError:c})=>{const{baseUrl:m,apiKey:I,appId:j}=ge(),[d,w]=S.useState("login"),[h,$]=S.useState(1),[_,P]=S.useState(!1),[E,L]=S.useState(!1),[y,O]=S.useState(null),[b,N]=S.useState(""),[J,D]=S.useState(""),[H,Q]=S.useState({email:"",otp:"",newPassword:"",appId:j}),k=window.innerWidth<768,G=l?"#ffffff":"#111827",M=l?"#a1a1aa":"#6b7280",F=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",T=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",V=async f=>{f.preventDefault(),L(!0),O(null);try{const v=await Us({email:b,password:J,appId:j},{baseUrl:m,apiKey:I});O({type:"success",text:`Welcome ${v.name}`}),p?.(v)}catch(v){const X=v.message||"Login failed";O({type:"error",text:X}),c?.(v)}finally{L(!1)}},K=f=>{Q({...H,[f.target.name]:f.target.value})},x=async f=>{f.preventDefault(),L(!0),O(null);try{const v=await B.post(`${m}/users/forgot-password`,{email:H.email,appId:j},{headers:{"x-api-key":I}});v.data.success?($(2),O({type:"success",text:"OTP sent to your email"})):O({type:"error",text:v.data.message||"Failed to send OTP"})}catch(v){O({type:"error",text:v.response?.data?.message||"Something went wrong"})}finally{L(!1)}},R=async f=>{f.preventDefault(),L(!0),O(null);try{const v=await B.post(`${m}/users/reset-password`,H,{headers:{"x-api-key":I}});v.data.success?(O({type:"success",text:"Password reset successfully!"}),$(1),Q({email:"",otp:"",newPassword:"",appId:j}),w("login")):O({type:"error",text:v.data.message||"Reset failed"})}catch(v){O({type:"error",text:v.response?.data?.message||"Something went wrong"})}finally{L(!1)}},U={width:"100%",padding:k?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:F,border:`1px solid ${T}`,borderRadius:"10px",color:G,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(be,{size:40,color:i,style:{marginBottom:"10px"}}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:G,margin:0},children:d==="login"?r:h===1?"Forgot Password":"Reset Password"}),n.jsx("p",{style:{fontSize:"14px",color:M},children:d==="login"?s:"Follow the steps to reset your password"})]}),d==="login"&&n.jsxs("form",{onSubmit:V,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:M}}),n.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:b,onChange:f=>N(f.target.value),style:U})]})]}),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(me,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:M}}),n.jsx("input",{id:"login-password",type:_?"text":"password",placeholder:"Enter your password",value:J,onChange:f=>D(f.target.value),style:U}),n.jsx("button",{type:"button",onClick:()=>P(!_),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:M,cursor:"pointer"},children:_?n.jsx(ot,{size:20}):n.jsx(it,{size:20})})]})]}),n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:[g&&n.jsx("a",{href:g,style:{color:i,textDecoration:"none",fontWeight:500},children:"Create new account"}),n.jsx("button",{type:"button",onClick:()=>w("forgot"),style:{background:"none",border:"none",color:i,fontWeight:500,cursor:"pointer"},children:"Forgot password?"})]}),n.jsx("button",{type:"submit",disabled:E,style:{padding:"12px",background:o,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600},children:E?"Signing In...":"Sign In"})]}),d==="forgot"&&n.jsxs("form",{onSubmit:h===1?x:R,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[h===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:M}}),n.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:H.email,onChange:K,style:U})]})]}):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(nr,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:M}}),n.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:H.otp,onChange:K,style:U})]})]}),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(me,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:M}}),n.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:H.newPassword,onChange:K,style:U})]})]})]}),n.jsx("button",{type:"submit",disabled:E,style:{padding:"12px",background:o,color:"#fff",border:"none",fontSize:"14px",borderRadius:"10px",fontWeight:600},children:E?"Please wait...":h===1?"Send Reset OTP":"Reset Password"}),n.jsx("button",{type:"button",onClick:()=>{w("login"),$(1)},style:{background:"none",border:"none",fontSize:"14px",color:M,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(fe,{size:20}):n.jsx(oe,{size:20}),n.jsx("span",{children:y.text})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:M,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]})})},Fs=()=>{if(typeof window>"u")return!1;try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},Ls=({children:e,fallback:t=null,width:r,height:s})=>{const[a,i]=S.useState(!1);return S.useEffect(()=>{const o=()=>i(Fs());return o(),window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[]),a?n.jsx("span",{style:{display:"inline-flex",alignItems:"center",verticalAlign:"middle",width:r,height:s},children:e}):n.jsx(n.Fragment,{children:t})},Pt=()=>{if(typeof window>"u")return!1;try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},Ms=({children:e,fallback:t=null,width:r,height:s})=>{const[a,i]=S.useState(!Pt());return S.useEffect(()=>{const o=()=>i(!Pt());return o(),window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[]),a?n.jsx("span",{style:{display:"inline-flex",alignItems:"center",verticalAlign:"middle",width:r,height:s},children:e}):n.jsx(n.Fragment,{children:t})},Bs=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:a,token:i,colors:o})=>{const{baseUrl:l,apiKey:g,appId:p}=ge(),[c,m]=S.useState(!1),[I,j]=S.useState(""),[d,w]=S.useState("warning"),[h,$]=S.useState(!1);if(S.useEffect(()=>{const y=()=>{$(window.innerWidth<640)};return y(),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[]),!e)return null;const _=async()=>{m(!0),w("processing");try{const{data:y}=await B.delete(`${l}/users/delete/${a}`,{data:{appId:p},headers:{"x-api-key":g}});y.success?(r(y.message||"Account deleted successfully"),w("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(s(y.message||"Failed to delete account"),w("warning"))}catch(y){s(y.response?.data?.message||"Something went wrong"),w("warning")}finally{m(!1)}},P=I.toLowerCase()==="delete my account",E=y=>{y.target===y.currentTarget&&d!=="processing"&&d!=="success"&&t()},L=()=>{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:o.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:o.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=o.border,y.currentTarget.style.color=o.textPrimary},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent",y.currentTarget.style.color=o.textTertiary},children:n.jsx(Ie,{size:20})})]}),n.jsxs("div",{style:{display:"flex",gap:"16px",padding:"20px",background:`${o.error}15`,border:`1px solid ${o.error}30`,borderRadius:"12px",marginBottom:"20px"},children:[n.jsx("div",{style:{color:o.error,flexShrink:0,display:"flex",alignItems:"flex-start"},children:n.jsx(It,{size:24})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h4",{style:{color:o.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(Qn,{size:16}),text:"All your data will be permanently deleted"},{icon:n.jsx(As,{size:16}),text:"This action cannot be reversed"},{icon:n.jsx(lt,{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:o.textSecondary},children:[n.jsx("div",{style:{color:o.error,flexShrink:0},children:y.icon}),n.jsx("span",{children:y.text})]},O))})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:h?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:t,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${o.border}`,background:"transparent",color:o.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:h?"none":1,minWidth:h?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:y=>{y.currentTarget.style.backgroundColor=o.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:()=>w("confirmation"),style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:"pointer",flex:h?"none":1,minWidth:h?"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(It,{size:24})}),n.jsx("div",{style:{flex:1},children:n.jsx("h3",{style:{color:o.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:o.textSecondary,marginBottom:"16px",fontSize:"14px",lineHeight:"1.5"},children:["Type"," ",n.jsx("strong",{style:{color:o.textPrimary},children:'"delete my account"'})," ","to confirm:"]}),n.jsx("input",{type:"text",value:I,onChange:y=>j(y.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${P?o.success:o.error}`,backgroundColor:"transparent",color:o.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:y=>{y.target.style.boxShadow=`0 0 0 3px ${o.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:o.success,fontSize:"14px",fontWeight:500},children:[n.jsx(Xe,{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:()=>{w("warning"),j("")},style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${o.border}`,background:"transparent",color:o.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:h?"none":1,minWidth:h?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:y=>{y.currentTarget.style.backgroundColor=o.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:_,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:h?"none":1,minWidth:h?"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(ie,{size:20,style:{animation:"spin 1s linear infinite"}})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:o.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Deleting Account"}),n.jsx("p",{style:{color:o.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?`${o.accent}10`:"transparent"},children:[n.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:y.active?o.accent:o.textTertiary,transition:"all 0.3s ease",boxShadow:y.active?`0 0 0 4px ${o.accent}20`:"none"}}),n.jsx("span",{style:{fontSize:"14px",color:y.active?o.textPrimary:o.textSecondary,fontWeight:y.active?500:400},children:y.text})]},O))})}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${o.accent}10`,borderRadius:"10px",fontSize:"14px",color:o.textSecondary},children:[n.jsx(or,{size:18,style:{color:o.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(Xe,{size:20})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:o.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Account Deleted"}),n.jsx("p",{style:{color:o.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:`${o.success}10`,border:`1px solid ${o.success}20`,borderRadius:"12px",marginBottom:"24px"},children:[n.jsx(Xe,{size:48,style:{color:o.success,marginBottom:"12px",display:"block",margin:"0 auto 12px auto"}}),n.jsx("p",{style:{color:o.textPrimary,fontSize:"16px",fontWeight:600,margin:"0 0 8px 0"},children:"Goodbye!"}),n.jsx("p",{style:{color:o.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:`${o.accent}10`,borderRadius:"10px",fontSize:"14px",color:o.textSecondary,justifyContent:"center"},children:[n.jsx(ie,{size:16,style:{animation:"spin 1s linear infinite",color:o.accent}}),n.jsx("span",{children:"Redirecting to login page..."})]})]})}};return n.jsxs("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.8)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:1e4,animation:"fadeIn 0.3s ease-out"},onClick:E,children:[n.jsx("div",{style:{backgroundColor:o.surface,border:`1px solid ${o.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:L()}),n.jsx("style",{children:`
208
+ @keyframes fadeIn {
209
+ from { opacity: 0; }
210
+ to { opacity: 1; }
211
+ }
212
+
213
+ @keyframes scaleIn {
214
+ from {
215
+ opacity: 0;
216
+ transform: scale(0.9) translateY(20px);
217
+ }
218
+ to {
219
+ opacity: 1;
220
+ transform: scale(1) translateY(0);
221
+ }
222
+ }
223
+
224
+ @keyframes spin {
225
+ from { transform: rotate(0deg); }
226
+ to { transform: rotate(360deg); }
227
+ }
228
+
229
+ .delete-modal-container {
230
+ animation: scaleIn 0.3s ease-out;
231
+ }
232
+
233
+ /* Mobile responsiveness */
234
+ @media (max-width: 480px) {
235
+ .delete-modal-container {
236
+ padding: 20px 16px;
237
+ margin: 0;
238
+ border-radius: 16px 16px 0 0;
239
+ max-height: 90vh;
240
+ overflow-y: auto;
241
+ }
242
+ }
243
+
244
+ @media (max-width: 360px) {
245
+ .delete-modal-container {
246
+ padding: 16px 12px;
247
+ }
248
+ }
249
+
250
+ /* Reduced motion support */
251
+ @media (prefers-reduced-motion: reduce) {
252
+ .delete-modal-container {
253
+ animation: none;
254
+ }
255
+
256
+ * {
257
+ transition: none !important;
258
+ animation: none !important;
259
+ }
260
+ }
261
+ `})]})},Ws=({isOpen:e,onClose:t,onUpdate:r,colors:s})=>{const[a,i]=S.useState(""),[o,l]=S.useState(!1),[g,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(!a.trim()){m({isValid:!1,message:"",type:null});return}try{const d=new URL(a),w=/\.(jpg|jpeg|png|gif|webp|svg)$/i.test(d.pathname);m(w?{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"})}},[a]),!e)return null;const I=async()=>{if(!(!a||!c.isValid)){l(!0);try{await r(a)&&(i(""),t())}finally{l(!1)}}},j=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:j,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(Ie,{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(ds,{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:a,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:o}),n.jsx("div",{style:{position:"absolute",left:"16px",top:"50%",transform:"translateY(-50%)",color:s.textTertiary},children:n.jsx(rr,{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(fe,{size:14}),c.type==="error"&&n.jsx(oe,{size:14}),c.type==="warning"&&n.jsx(oe,{size:14}),c.message]})]}),a&&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:a,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:g?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch",marginTop:"24px"},children:[n.jsx("button",{onClick:t,disabled:o,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${s.border}`,background:"transparent",color:s.textPrimary,fontSize:"14px",fontWeight:500,cursor:o?"not-allowed":"pointer",flex:g?"none":1,minWidth:g?"100%":"120px",opacity:o?.6:1,transition:"all 0.2s ease"},onMouseOver:d=>{o||(d.currentTarget.style.backgroundColor=s.border,d.currentTarget.style.transform="translateY(-1px)")},onMouseOut:d=>{o||(d.currentTarget.style.backgroundColor="transparent",d.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),n.jsx("button",{onClick:I,disabled:o||!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:o||!c.isValid?"not-allowed":"pointer",flex:g?"none":1,minWidth:g?"100%":"140px",opacity:o||!c.isValid?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:o||!c.isValid?"none":`0 4px 12px ${s.accent}40`},onMouseOver:d=>{!o&&c.isValid&&(d.currentTarget.style.transform="translateY(-1px)",d.currentTarget.style.boxShadow=`0 6px 20px ${s.accent}60`)},onMouseOut:d=>{!o&&c.isValid&&(d.currentTarget.style.transform="translateY(0)",d.currentTarget.style.boxShadow=`0 4px 12px ${s.accent}40`)},children:o?n.jsxs(n.Fragment,{children:[n.jsx(ie,{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
+ @keyframes modalSlideIn {
263
+ from {
264
+ opacity: 0;
265
+ transform: scale(0.9) translateY(20px);
266
+ }
267
+ to {
268
+ opacity: 1;
269
+ transform: scale(1) translateY(0);
270
+ }
271
+ }
272
+
273
+ @keyframes spin {
274
+ from { transform: rotate(0deg); }
275
+ to { transform: rotate(360deg); }
276
+ }
277
+
278
+ .avatar-modal-container {
279
+ animation: modalSlideIn 0.3s ease-out;
280
+ }
281
+
282
+ /* Mobile responsiveness */
283
+ @media (max-width: 480px) {
284
+ .avatar-modal-container {
285
+ padding: 20px 16px;
286
+ margin: 0;
287
+ border-radius: 16px 16px 0 0;
288
+ max-height: 90vh;
289
+ overflow-y: auto;
290
+ }
291
+ }
292
+
293
+ @media (max-width: 360px) {
294
+ .avatar-modal-container {
295
+ padding: 16px 12px;
296
+ }
297
+ }
298
+
299
+ /* Reduced motion support */
300
+ @media (prefers-reduced-motion: reduce) {
301
+ .avatar-modal-container {
302
+ animation: none;
303
+ }
304
+
305
+ * {
306
+ transition: none !important;
307
+ }
308
+ }
309
+ `})]})},qs=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:a,colors:i})=>{const{baseUrl:o,apiKey:l,appId:g}=ge(),[p,c]=S.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[m,I]=S.useState({}),[j,d]=S.useState(!1),[w,h]=S.useState({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[$,_]=S.useState(!1);if(S.useEffect(()=>{const b=()=>{_(window.innerWidth<640)};return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[]),!e)return null;const P=b=>{const{name:N,value:J}=b.target;c(D=>({...D,[N]:J})),m[N]&&I(D=>({...D,[N]:""}))},E=b=>{h(N=>({...N,[b]:!N[b]}))},L=()=>{const b={};return p.currentPassword||(b.currentPassword="Current password is required"),p.newPassword?p.newPassword.length<6&&(b.newPassword="Password must be at least 6 characters"):b.newPassword="New password is required",p.newPassword!==p.confirmPassword&&(b.confirmPassword="Passwords do not match"),I(b),Object.keys(b).length===0},y=async b=>{if(b.preventDefault(),!!L()){d(!0);try{const{data:N}=await B.put(`${o}/users/change-password/${a}`,{appId:g,currentPassword:p.currentPassword,newPassword:p.newPassword},{headers:{"x-api-key":l}});N.success?(r(N.message||"Password updated successfully"),c({currentPassword:"",newPassword:"",confirmPassword:""}),t()):s(N.message||"Failed to update password")}catch(N){s(N.response?.data?.message||"Something went wrong")}finally{d(!1)}}},O=[{field:"currentPassword",label:"Current Password",icon:n.jsx(sr,{size:18})},{field:"newPassword",label:"New Password",icon:n.jsx(me,{size:18})},{field:"confirmPassword",label:"Confirm Password",icon:n.jsx(me,{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(me,{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:b=>{b.currentTarget.style.backgroundColor=i.border,b.currentTarget.style.color=i.textPrimary},onMouseOut:b=>{b.currentTarget.style.backgroundColor="transparent",b.currentTarget.style.color=i.textTertiary},children:n.jsx(Ie,{size:20})})]}),n.jsxs("form",{onSubmit:y,children:[O.map(({field:b,label:N,icon:J})=>n.jsxs("div",{style:{marginBottom:"20px",position:"relative"},children:[n.jsx("label",{htmlFor:b,style:{display:"block",marginBottom:"8px",color:i.textPrimary,fontSize:"14px",fontWeight:500,lineHeight:"1.4"},children:N}),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:J}),n.jsx("input",{type:w[b]?"text":"password",id:b,name:b,placeholder:`Enter ${N.toLowerCase()}`,value:p[b],onChange:P,style:{width:"100%",padding:"14px 48px 14px 44px",borderRadius:"10px",border:`1.5px solid ${m[b]?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[b]?i.error:i.border,D.target.style.boxShadow="none"}}),n.jsx("button",{type:"button",onClick:()=>E(b),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:w[b]?n.jsx(ot,{size:18}):n.jsx(it,{size:18})})]}),m[b]&&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[b]]})]},b)),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:$?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{type:"button",onClick:t,disabled:j,style:{padding:"14px 24px",borderRadius:"10px",border:`1.5px solid ${i.border}`,background:"transparent",color:i.textPrimary,fontSize:"14px",fontWeight:500,cursor:j?"not-allowed":"pointer",flex:$?"none":1,minWidth:$?"100%":"120px",opacity:j?.6:1,transition:"all 0.2s ease"},onMouseOver:b=>{j||(b.currentTarget.style.backgroundColor=i.border,b.currentTarget.style.transform="translateY(-1px)")},onMouseOut:b=>{j||(b.currentTarget.style.backgroundColor="transparent",b.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),n.jsx("button",{type:"submit",disabled:j,style:{padding:"14px 24px",borderRadius:"10px",border:"none",background:`linear-gradient(135deg, ${i.accent}, ${i.accent}E6)`,color:"#fff",fontSize:"14px",fontWeight:600,cursor:j?"not-allowed":"pointer",flex:$?"none":1,minWidth:$?"100%":"140px",opacity:j?.8:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:j?"none":`0 4px 12px ${i.accent}40`},onMouseOver:b=>{j||(b.currentTarget.style.transform="translateY(-1px)",b.currentTarget.style.boxShadow=`0 6px 20px ${i.accent}60`)},onMouseOut:b=>{j||(b.currentTarget.style.transform="translateY(0)",b.currentTarget.style.boxShadow=`0 4px 12px ${i.accent}40`)},children:j?n.jsxs(n.Fragment,{children:[n.jsx(ie,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):"Update Password"})]})]}),n.jsx("style",{children:`
310
+ @keyframes spin {
311
+ from { transform: rotate(0deg); }
312
+ to { transform: rotate(360deg); }
313
+ }
314
+
315
+ .change-password-modal::-webkit-scrollbar {
316
+ width: 6px;
317
+ }
318
+
319
+ .change-password-modal::-webkit-scrollbar-track {
320
+ background: transparent;
321
+ }
322
+
323
+ .change-password-modal::-webkit-scrollbar-thumb {
324
+ background: ${i.border};
325
+ border-radius: 3px;
326
+ }
327
+
328
+ .change-password-modal::-webkit-scrollbar-thumb:hover {
329
+ background: ${i.textTertiary};
330
+ }
331
+
332
+ /* Mobile responsiveness */
333
+ @media (max-width: 480px) {
334
+ .change-password-modal {
335
+ padding: 20px 16px;
336
+ margin: 0;
337
+ border-radius: 12px 12px 0 0;
338
+ max-height: 85vh;
339
+ }
340
+ }
341
+
342
+ @media (max-width: 360px) {
343
+ .change-password-modal {
344
+ padding: 16px 12px;
345
+ }
346
+ }
347
+ `})]})})},Hs=({isOpen:e,onClose:t,onVerify:r,onSendOTP:s,verifyFormData:a,setVerifyFormData:i,otpSent:o,verifying:l,user:g,colors:p,darkMode:c})=>{if(!e)return null;const m=()=>{t(),i({email:g?.email||"",otp:"",appId:a.appId})};return n.jsxs("div",{className:"modal-overlay",style:{backgroundColor:c?"rgba(0, 0, 0, 0.8)":"rgba(0, 0, 0, 0.5)"},children:[n.jsxs("div",{className:"verify-email-modal",style:{backgroundColor:p.surface,border:`1px solid ${p.border}`},children:[n.jsxs("div",{className:"modal-header",children:[n.jsx("h3",{style:{color:p.textPrimary},children:"Verify Your Email"}),n.jsx("button",{onClick:m,className:"close-btn",style:{color:p.textTertiary},"aria-label":"Close verification modal",children:n.jsx(Ie,{size:20,"aria-hidden":"true"})})]}),n.jsxs("form",{className:"verify-form",onSubmit:r,children:[n.jsxs("div",{className:"form-group",children:[n.jsx("label",{style:{color:p.textSecondary},children:"Email"}),n.jsxs("div",{className:"input-container",children:[n.jsx(he,{size:18,style:{color:p.textTertiary},"aria-hidden":"true"}),n.jsx("input",{type:"email",value:a.email,onChange:I=>i(j=>({...j,email:I.target.value})),placeholder:"Enter your email",style:{backgroundColor:p.surfaceLight,color:p.textPrimary,borderColor:p.border},required:!0,"aria-required":"true","aria-label":"Email address"})]})]}),o&&n.jsxs("div",{className:"form-group",children:[n.jsx("label",{style:{color:p.textSecondary},children:"OTP"}),n.jsxs("div",{className:"input-container",children:[n.jsx(nr,{size:18,style:{color:p.textTertiary},"aria-hidden":"true"}),n.jsx("input",{type:"text",value:a.otp,onChange:I=>i(j=>({...j,otp:I.target.value})),placeholder:"Enter OTP",style:{backgroundColor:p.surfaceLight,color:p.textPrimary,borderColor:p.border},required:!0,"aria-required":"true","aria-label":"One-time password"})]})]}),n.jsx("div",{className:"modal-actions",children:o?n.jsxs("button",{type:"submit",disabled:l,className:"btn-primary",style:{background:`linear-gradient(to right, ${p.accent}, ${p.accentHover})`,opacity:l?.7:1},"aria-label":l?"Verifying email":"Verify email",children:[l?n.jsx(ie,{size:16,className:"spinner","aria-hidden":"true"}):n.jsx(fe,{size:16,"aria-hidden":"true"}),l?"Verifying...":"Verify Email"]}):n.jsxs("button",{type:"button",onClick:s,disabled:l,className:"btn-primary",style:{background:`linear-gradient(to right, ${p.accent}, ${p.accentHover})`,opacity:l?.7:1},"aria-label":l?"Sending OTP":"Send OTP",children:[l?n.jsx(ie,{size:16,className:"spinner","aria-hidden":"true"}):n.jsx(ar,{size:16,"aria-hidden":"true"}),l?"Sending...":"Send OTP"]})})]})]}),n.jsx("style",{children:`
348
+ .modal-overlay {
349
+ position: fixed;
350
+ top: 0;
351
+ left: 0;
352
+ right: 0;
353
+ bottom: 0;
354
+ display: flex;
355
+ align-items: center;
356
+ justify-content: center;
357
+ z-index: 100;
358
+ padding: 20px;
359
+ }
360
+
361
+ .verify-email-modal {
362
+ width: 100%;
363
+ max-width: 440px;
364
+ border-radius: 16px;
365
+ padding: 24px;
366
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
367
+ backdrop-filter: blur(8px);
368
+ }
369
+
370
+ .modal-header {
371
+ display: flex;
372
+ align-items: center;
373
+ justify-content: space-between;
374
+ margin-bottom: 24px;
375
+ }
376
+
377
+ .modal-header h3 {
378
+ margin: 0;
379
+ font-size: 20px;
380
+ font-weight: 600;
381
+ }
382
+
383
+ .close-btn {
384
+ background: none;
385
+ border: none;
386
+ cursor: pointer;
387
+ padding: 4px;
388
+ border-radius: 4px;
389
+ transition: background-color 0.2s ease;
390
+ display: flex;
391
+ align-items: center;
392
+ justify-content: center;
393
+ }
394
+
395
+ .close-btn:hover {
396
+ background-color: ${c?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)"};
397
+ }
398
+
399
+ .verify-form {
400
+ display: flex;
401
+ flex-direction: column;
402
+ gap: 20px;
403
+ }
404
+
405
+ .form-group {
406
+ display: flex;
407
+ flex-direction: column;
408
+ gap: 8px;
409
+ }
410
+
411
+ .form-group label {
412
+ font-size: 14px;
413
+ font-weight: 500;
414
+ }
415
+
416
+ .input-container {
417
+ position: relative;
418
+ display: flex;
419
+ align-items: center;
420
+ }
421
+
422
+ .input-container svg {
423
+ position: absolute;
424
+ left: 12px;
425
+ pointer-events: none;
426
+ }
427
+
428
+ .input-container input {
429
+ width: 100%;
430
+ padding: 12px 12px 12px 40px;
431
+ border-radius: 8px;
432
+ border: 1px solid;
433
+ font-size: 14px;
434
+ outline: none;
435
+ transition: border-color 0.2s ease;
436
+ background-color: transparent;
437
+ }
438
+
439
+ .input-container input:focus {
440
+ border-color: ${p.accent};
441
+ box-shadow: 0 0 0 3px ${p.accent}20;
442
+ }
443
+
444
+ .modal-actions {
445
+ display: flex;
446
+ gap: 12px;
447
+ }
448
+
449
+ .modal-actions .btn-primary {
450
+ flex: 1;
451
+ padding: 12px 20px;
452
+ border: none;
453
+ border-radius: 8px;
454
+ color: white;
455
+ font-weight: 500;
456
+ cursor: pointer;
457
+ transition: all 0.2s ease;
458
+ display: flex;
459
+ align-items: center;
460
+ justify-content: center;
461
+ gap: 8px;
462
+ font-size: 14px;
463
+ }
464
+
465
+ .modal-actions .btn-primary:hover:not(:disabled) {
466
+ transform: translateY(-1px);
467
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
468
+ }
469
+
470
+ .modal-actions .btn-primary:disabled {
471
+ opacity: 0.6;
472
+ cursor: not-allowed;
473
+ transform: none;
474
+ }
475
+
476
+ .spinner {
477
+ animation: spin 1s linear infinite;
478
+ }
479
+
480
+ @keyframes spin {
481
+ from { transform: rotate(0deg); }
482
+ to { transform: rotate(360deg); }
483
+ }
484
+
485
+ @media (prefers-reduced-motion: reduce) {
486
+ .close-btn, .modal-actions .btn-primary {
487
+ transition: none;
488
+ }
489
+
490
+ .spinner {
491
+ animation: none;
492
+ }
493
+ }
494
+ `})]})},Vs=({token:e,user:t=null,darkMode:r=!0,homeUrl:s,onLogout:a,onVerify:i,primaryColor:o="#00C212"})=>{const{baseUrl:l,apiKey:g,appId:p}=ge(),[c,m]=S.useState(t),[I,j]=S.useState(!0),[d,w]=S.useState(!1),[h,$]=S.useState(!1),[_,P]=S.useState(!1),[E,L]=S.useState(!1),[y,O]=S.useState(!1),[b,N]=S.useState(!1),[J,D]=S.useState(!1),[H,Q]=S.useState(!1),[k,G]=S.useState(null),[M,F]=S.useState(!1),[T,V]=S.useState({email:"",otp:"",appId:p}),[K,x]=S.useState(!1),[R,U]=S.useState(!1),f=(C,q)=>{G({type:C,message:q}),setTimeout(()=>G(null),3e3)},v=()=>{Q(!0);const C=setTimeout(()=>{D(!1),Q(!1)},150);return()=>clearTimeout(C)};S.useEffect(()=>{const C=q=>{const Z=document.querySelector(".dropdown-container");Z&&!Z.contains(q.target)&&v()};return J&&document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)}},[J]);const X=async()=>{if(!T.email||!/\S+@\S+\.\S+/.test(T.email)){f("error","Please enter a valid email");return}try{U(!0);const C=await B.post(`${l}/users/send-verify-otp/${c?.id}`,{email:T.email},{headers:{"x-api-key":g,"x-app-id":p}});C.data.success?(f("success",C.data.message||"OTP sent to email!"),x(!0)):f("error",C.data.message||"Failed to send OTP")}catch(C){f("error",C.response?.data?.message||"Server error")}finally{U(!1)}},Y=async C=>{if(C.preventDefault(),!T.email||!T.otp){f("error","Please fill in all fields");return}try{U(!0);const q=await B.post(`${l}/users/verify-email`,T);if(q.data.success){if(f("success",q.data.message||"Email verified!"),c){const Z={...c,isVerified:!0};m(Z),localStorage.setItem("userInfo",JSON.stringify({...Z,token:e})),typeof i=="function"&&i(Z)}V({email:"",otp:"",appId:p}),x(!1),N(!1)}else f("error",q.data.message||"Verification failed")}catch(q){f("error",q.response?.data?.message||"Something went wrong")}finally{U(!1)}},se=async C=>{if(!c)return!1;try{const q={...c,avatarUrl:C},{data:Z}=await B.put(`${l}/users/update/${c.id}`,q,{headers:{"x-api-key":g}});return Z.success?(m(q),localStorage.setItem("userInfo",JSON.stringify({...q,token:e})),f("success","Avatar updated successfully!"),!0):(f("error",Z.message||"Failed to update avatar"),!1)}catch(q){return console.error("Avatar update error:",q),f("error","Failed to update avatar"),!1}},le=async()=>{if(c){$(!0);try{const{data:C}=await B.put(`${l}/users/update/${c.id}`,c,{headers:{"x-api-key":g}});C.success?(m(C.user),w(!1),localStorage.setItem("userInfo",JSON.stringify({...C.user,token:e})),f("success","Profile updated successfully")):f("error",C.message)}catch(C){console.error(C),f("error","Update failed")}finally{$(!1)}}},ce=async C=>{try{const{data:q}=await B.get(`${l}/users/check-user/${C}?appId=${p}`,{headers:{"x-api-key":g}});(!q.success||!q.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),m(null))}catch(q){console.error("User check failed:",q),localStorage.removeItem("userInfo"),m(null)}};S.useEffect(()=>{(()=>{if(t)m(t),j(!1),ce(t.id);else{const q=localStorage.getItem("userInfo");if(q){const Z=JSON.parse(q);m(Z),j(!1),ce(Z.id)}else j(!1)}})()},[t]),S.useEffect(()=>{c?.email&&V(C=>({...C,email:c.email}))},[c?.email]);const Pe=(C,q)=>{let Z=parseInt(C.replace("#",""),16),de=(Z>>16)+q,He=(Z>>8&255)+q,Ve=(Z&255)+q;return de=Math.min(255,Math.max(0,de)),He=Math.min(255,Math.max(0,He)),Ve=Math.min(255,Math.max(0,Ve)),`#${(Ve|He<<8|de<<16).toString(16).padStart(6,"0")}`},A=r?{background:"#000000",surface:"#09090b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:o,accentHover:Pe(o,-15),success:"#10b981",error:"#ef4444",border:"#27272a",warning:"#f59e0b"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:o,accentHover:Pe(o,-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:A.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(ie,{size:40,color:A.accent,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}),n.jsx("p",{style:{color:A.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:A.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(oe,{size:40,color:A.error,"aria-hidden":"true"}),n.jsx("p",{style:{color:A.textTertiary,margin:0},children:"No profile found. Please log in again."})]})});const qe=[{label:"Full Name",value:c.name,name:"name",type:"text",icon:be},{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:js},{label:"Address",value:c.address||"Not provided",name:"address",type:"text",icon:ys}];return n.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:A.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(fe,{size:20,"aria-hidden":"true"}):n.jsx(oe,{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:A.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(as,{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 ${A.border}`},width:128,height:128,loading:"eager"}),n.jsx("button",{onClick:()=>P(!0),style:{position:"absolute",bottom:"8px",right:"8px",backgroundColor:A.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:A.textPrimary},children:c.name}),n.jsx("p",{style:{color:A.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?A.success:A.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(fe,{size:16,"aria-hidden":"true"}):n.jsx(oe,{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:()=>w(!1),style:{backgroundColor:A.surfaceLight,border:`1px solid ${A.border}`,color:A.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(Ie,{size:16,"aria-hidden":"true"}),"Cancel"]}),n.jsxs("button",{onClick:le,disabled:h,style:{background:`linear-gradient(to right, ${A.accent}, ${A.accentHover})`,opacity:h?.7:1,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:h?"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:[h?n.jsx(ie,{size:16,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(ks,{size:16,"aria-hidden":"true"}),h?"Saving...":"Save Changes"]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>w(!0),style:{background:`linear-gradient(to right, ${A.accent}, ${A.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(ws,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),!c.isVerified&&n.jsxs("button",{onClick:()=>N(!0),disabled:M,style:{background:"linear-gradient(to right, #fbbf24, #f59e0b)",color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:M?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",minHeight:"36px",opacity:M?.7:1,flex:window.innerWidth<1024?"1":"auto"},children:[M?n.jsx(ie,{size:14,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(ar,{size:14,"aria-hidden":"true"}),M?"Sending...":"Verify Email"]}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("button",{style:{backgroundColor:A.surfaceLight,color:A.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(!J),children:[n.jsx(ts,{size:16,"aria-hidden":"true"}),"More Actions"]}),J&&n.jsxs("div",{className:`dropdown-container ${H?"closing":""}`,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:A.surface,border:`1px solid ${A.border}`,borderRadius:"12px 12px 0 0",boxShadow:"0 -8px 24px rgba(0, 0, 0, 0.25)",zIndex:200,marginBottom:"6px",overflow:"hidden",animation:`${H?"drawerSlideDown":"drawerSlideUp"} 0.25s ease-out forwards`},children:[n.jsxs("button",{onClick:()=>{L(!0),v()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:A.textPrimary,cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:C=>C.currentTarget.style.backgroundColor=A.surfaceLight,onMouseLeave:C=>C.currentTarget.style.backgroundColor="transparent",children:[n.jsx(sr,{size:14,"aria-hidden":"true"}),"Change Password"]}),a&&n.jsxs("button",{onClick:()=>{a(),v()},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:C=>{C.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:C=>C.currentTarget.style.backgroundColor="transparent",children:[n.jsx(lt,{size:14,"aria-hidden":"true"}),"Logout"]}),n.jsxs("button",{onClick:()=>{O(!0),v()},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:C=>{C.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:C=>C.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:A.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:A.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(be,{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:qe.map(C=>{const q=C.icon;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[n.jsxs("label",{style:{color:A.textTertiary,fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(q,{size:16,"aria-hidden":"true"}),C.label]}),d?n.jsx("input",{type:C.type,name:C.name,value:c[C.name],onChange:Z=>m(de=>de&&{...de,[Z.target.name]:Z.target.value}),style:{padding:"12px",borderRadius:"8px",border:`1px solid ${o}`,backgroundColor:"transparent",color:A.textPrimary,fontSize:"12px",outline:"none",transition:"border-color 0.2s ease",minHeight:"44px",width:"100%",boxSizing:"border-box"},placeholder:`Enter ${C.label.toLowerCase()}`,"aria-label":C.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:A.textPrimary,backgroundColor:r?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:C.value})]},C.name)})})]}),n.jsxs("section",{style:{backgroundColor:A.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:A.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(or,{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:A.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:A.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:A.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(fe,{size:16,"aria-hidden":"true"}),"Verified"]}):n.jsxs(n.Fragment,{children:[n.jsx(oe,{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:A.textTertiary,fontSize:"12px",margin:0},children:"Verify your email to unlock all features and enhance your account security."})})]})]})]})]})}),n.jsx(Ws,{isOpen:_,onClose:()=>{P(!1)},onUpdate:se,colors:A}),n.jsx(qs,{baseUrl:l,apiKey:g,appId:p,userId:c.id,isOpen:E,onClose:()=>L(!1),onSuccess:C=>f("success",C),onError:C=>f("error",C),colors:A}),n.jsx(Bs,{baseUrl:l,apiKey:g,appId:p,userId:c.id,token:e,isOpen:y,onClose:()=>O(!1),onSuccess:C=>f("success",C),onError:C=>f("error",C),colors:A}),n.jsx(Hs,{isOpen:b,onClose:()=>{N(!1),x(!1),V({email:c?.email||"",otp:"",appId:p})},onVerify:Y,onSendOTP:X,verifyFormData:T,setVerifyFormData:V,otpSent:K,verifying:R,user:c,colors:A,darkMode:r}),n.jsx("style",{children:`
495
+ @keyframes slideIn {
496
+ from {
497
+ transform: translateX(100%);
498
+ opacity: 0;
499
+ }
500
+ to {
501
+ transform: translateX(0);
502
+ opacity: 1;
503
+ }
504
+ }
505
+
506
+ @keyframes spin {
507
+ from {
508
+ transform: rotate(0deg);
509
+ }
510
+ to {
511
+ transform: rotate(360deg);
512
+ }
513
+ }
514
+
515
+ @keyframes drawerSlideUp {
516
+ from {
517
+ transform: translateY(20px);
518
+ opacity: 0;
519
+ }
520
+ to {
521
+ transform: translateY(0);
522
+ opacity: 1;
523
+ }
524
+ }
525
+
526
+ @keyframes drawerSlideDown {
527
+ from {
528
+ transform: translateY(0);
529
+ opacity: 1;
530
+ }
531
+ to {
532
+ transform: translateY(20px);
533
+ opacity: 0;
534
+ }
535
+ }
536
+
537
+
538
+ @keyframes slideUp {
539
+ from {
540
+ transform: translateY(10px);
541
+ opacity: 0;
542
+ }
543
+ to {
544
+ transform: translateY(0);
545
+ opacity: 1;
546
+ }
547
+ }
548
+
549
+ /* Responsive design using container queries as fallback */
550
+ @media (max-width: 599px) {
551
+ .profile-main-container {
552
+ padding: 0 12px;
553
+ }
554
+ }
555
+
556
+ @media (min-width: 600px) and (max-width: 767px) {
557
+ .profile-main-container {
558
+ padding: 0 20px;
559
+ }
560
+ }
561
+
562
+ @media (min-width: 768px) and (max-width: 1023px) {
563
+ .profile-main-container {
564
+ padding: 0 24px;
565
+ }
566
+ }
567
+
568
+ @media (min-width: 1024px) {
569
+ .profile-main-container {
570
+ padding: 0 32px;
571
+ }
572
+ }
573
+
574
+ /* Reduced motion support */
575
+ @media (prefers-reduced-motion: reduce) {
576
+ * {
577
+ animation-duration: 0.01ms !important;
578
+ animation-iteration-count: 1 !important;
579
+ transition-duration: 0.01ms !important;
580
+ }
581
+ }
582
+ `})]})},Ys=({darkMode:e=!0,primaryColor:t="#3b82f6",onLogout:r,varient:s="classic",propUser:a,className:i="",profileUrl:o,settingsUrl:l,showProfileMenuItem:g=!0,showSettingsMenuItem:p=!0,showViewProfileMenuItem:c=!0,profileLabel:m="My Profile",settingsLabel:I="Settings",viewProfileLabel:j="View Profile",logoutLabel:d="Sign Out"})=>{const{baseUrl:w,apiKey:h,appId:$}=ge(),[_,P]=S.useState(!1),[E,L]=S.useState(null),[y,O]=S.useState(!0),[b,N]=S.useState(null),J=S.useRef(null),D=S.useRef(null),[H,Q]=S.useState(!1),[k,G]=S.useState(!1);S.useEffect(()=>{const f=()=>{G(window.innerWidth<768)};return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[]);const M=async f=>{try{if(!f)throw new Error("Invalid user ID");const{data:v}=await B.get(`${w}/users/check-user/${f}?appId=${$}`,{headers:{"x-api-key":h},timeout:1e4});(!v.success||!v.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),L(null),N("Session expired"))}catch(v){console.error("User validation failed:",v);const X=v.response?.status===404?"User not found":v.code==="NETWORK_ERROR"?"Network error":"Validation failed";N(X),v.response?.status===404&&(localStorage.removeItem("userInfo"),L(null))}};S.useEffect(()=>{(async()=>{try{if(O(!0),N(null),a){if(!a.id||!a.name||!a.email)throw new Error("Invalid user data provided");L(a),await M(a.id)}else{const v=localStorage.getItem("userInfo");if(v)try{const X=JSON.parse(v);if(!X.id||!X.name||!X.email)throw new Error("Invalid stored user data");L(X),await M(X.id)}catch(X){console.error("Failed to parse stored user data:",X),localStorage.removeItem("userInfo"),N("Invalid user data")}}}catch(v){console.error("User initialization failed:",v),N(v.message||"Failed to load user")}finally{O(!1)}})()},[a]),S.useEffect(()=>{const f=()=>{if(_&&D.current){const v=D.current.getBoundingClientRect(),X=window.innerWidth,Y=window.innerHeight,se=280,le=300,ce=X-v.right,Pe=v.left,A=Y-v.bottom,qe=ce>=se||ce>Pe;Q(qe),A<le&&v.top>le}};return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[_]),S.useEffect(()=>{const f=Y=>{J.current&&!J.current.contains(Y.target)&&!D.current?.contains(Y.target)&&P(!1)},v=Y=>{Y.key==="Escape"&&P(!1)},X=()=>{_&&P(!1)};return _&&(document.addEventListener("mousedown",f),document.addEventListener("keydown",v),window.addEventListener("scroll",X,{passive:!0})),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v),window.removeEventListener("scroll",X)}},[_]);const F=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"},T={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:F.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 ${F.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:F.textPrimary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:k?"80px":"120px"},userEmail:{fontSize:k?"11px":"12px",color:F.textTertiary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:k?"80px":"120px"},chevron:{transition:"transform 0.2s ease",transform:_?"rotate(180deg)":"rotate(0deg)",color:F.textTertiary,flexShrink:0},dropdown:{position:"absolute",top:"100%",marginTop:"8px",[H?"left":"right"]:"0",backgroundColor:F.surfaceElevated,border:`1px solid ${F.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:_?1:0,pointerEvents:_?"auto":"none",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",transform:_?"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 ${F.borderLight}`,flexShrink:0},dropdownUserInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0},dropdownUserName:{fontSize:k?"15px":"16px",fontWeight:600,color:F.textPrimary,lineHeight:"1.2",marginBottom:"2px",overflow:"hidden",textOverflow:"ellipsis"},dropdownUserEmail:{fontSize:k?"13px":"14px",color:F.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:F.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:F.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:F.error,textAlign:"left",outline:"none"},loadingText:{padding:k?"16px 12px":"20px 16px",textAlign:"center",color:F.textSecondary,fontSize:k?"13px":"14px"},errorState:{padding:k?"16px 12px":"20px 16px",textAlign:"center",color:F.textSecondary,fontSize:k?"13px":"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexDirection:"column"},retryButton:{marginTop:"8px",padding:"8px 16px",backgroundColor:F.accent,color:"#ffffff",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.2s ease"}},V=()=>{N(null),O(!0);const f=localStorage.getItem("userInfo");if(f)try{const v=JSON.parse(f);L(v),M(v.id)}catch{N("Invalid user data")}O(!1)},K=(f,v)=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),v())},x=()=>o||E?.profileUrl,R=()=>{const f=x();f&&window.open(f,"_self","noopener,noreferrer")},U=()=>{l&&window.open(l,"_self","noopener,noreferrer")};return n.jsxs("div",{style:T.wrapper,ref:J,className:i,role:"menu","aria-label":"User menu",children:[s==="classic"?n.jsx("div",{ref:D,onClick:()=>P(f=>!f),onKeyDown:f=>K(f,()=>P(v=>!v)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":_,"aria-label":"Toggle user menu",children:E?.avatarUrl?n.jsx("img",{src:E.avatarUrl,alt:`${E?.name||"User"}'s avatar`,style:{width:k?"34px":"40px",height:k?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${F.borderLight}`,flexShrink:0},loading:"lazy",onError:f=>{const v=f.target;v.onerror=null,v.src=`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(E?.name||"User")}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(E?.name||"User")}`,alt:"Default user avatar",style:{width:k?"34px":"40px",height:k?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${F.borderLight}`,flexShrink:0},loading:"lazy"})}):n.jsxs("div",{ref:D,style:T.avatarButton,onClick:()=>P(f=>!f),onKeyDown:f=>K(f,()=>P(v=>!v)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":_,"aria-label":"Toggle user menu",onMouseOver:f=>{f.currentTarget.style.backgroundColor=F.surfaceHover,f.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"},onMouseOut:f=>{f.currentTarget.style.backgroundColor=F.surface,f.currentTarget.style.boxShadow="none"},onBlur:f=>{f.currentTarget.style.outline="none"},children:[E?.avatarUrl?n.jsx("img",{src:E.avatarUrl,alt:`${E.name}'s avatar`,style:T.avatarImage,loading:"lazy",onError:f=>{const v=f.target;v.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:T.avatarImage,loading:"lazy"}),!k&&n.jsxs("div",{style:T.userInfo,children:[n.jsx("div",{style:T.userName,title:E?.name,children:E?.name||"Guest"}),E?.email&&n.jsx("div",{style:T.userEmail,title:E.email,children:E.email})]}),n.jsx(Kn,{size:k?14:16,style:T.chevron,"aria-hidden":"true"})]}),_&&n.jsx("div",{style:T.dropdown,role:"menu","aria-label":"User options",children:y?n.jsx("div",{style:T.loadingText,role:"status","aria-live":"polite",children:"Loading user information..."}):E?n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:T.userSection,children:[E?.avatarUrl?n.jsx("img",{src:E.avatarUrl,alt:`${E.name}'s profile picture`,style:T.dropdownAvatar,loading:"lazy",onError:f=>{const v=f.target;v.src=`https://api.dicebear.com/9.x/initials/svg?seed=${E.name}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${E.name}`,alt:`${E.name}'s default avatar`,style:T.dropdownAvatar,loading:"lazy"}),n.jsxs("div",{style:T.dropdownUserInfo,children:[n.jsx("div",{style:T.dropdownUserName,title:E.name,children:E.name}),n.jsx("div",{style:T.dropdownUserEmail,title:E.email,children:E.email})]})]}),n.jsxs("div",{style:T.dropdownSection,children:[g&&x()&&n.jsxs("button",{style:T.menuItem,onClick:R,onMouseOver:f=>{f.currentTarget.style.backgroundColor=F.surfaceHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor="transparent"},onKeyDown:f=>K(f,R),role:"menuitem",tabIndex:0,children:[n.jsx(be,{style:T.icon,"aria-hidden":"true"}),n.jsx("span",{style:T.menuItemText,children:m})]}),p&&l&&n.jsxs("button",{style:T.menuItem,onClick:U,onMouseOver:f=>{f.currentTarget.style.backgroundColor=F.surfaceHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor="transparent"},onKeyDown:f=>K(f,U),role:"menuitem",tabIndex:0,children:[n.jsx(Ts,{style:T.icon,"aria-hidden":"true"}),n.jsx("span",{style:T.menuItemText,children:I})]}),c&&E.profileUrl&&n.jsxs("a",{href:E.profileUrl,target:"_self",rel:"noopener noreferrer",style:T.menuItem,onMouseOver:f=>{f.currentTarget.style.backgroundColor=F.surfaceHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor="transparent"},role:"menuitem",tabIndex:0,children:[n.jsx(he,{style:T.icon,"aria-hidden":"true"}),n.jsx("span",{style:T.menuItemText,children:j})]})]}),n.jsx("div",{style:T.dropdownSection,children:n.jsxs("button",{style:T.logoutButton,onClick:r,onMouseOver:f=>{f.currentTarget.style.backgroundColor=F.surfaceHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor="transparent"},onKeyDown:f=>K(f,r),role:"menuitem",tabIndex:0,children:[n.jsx(lt,{style:{...T.icon,color:F.error},"aria-hidden":"true"}),n.jsx("span",{style:T.menuItemText,children:d})]})})]}):n.jsxs("div",{style:T.errorState,role:"alert",children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(oe,{size:16,"aria-hidden":"true"}),n.jsx("span",{children:b||"Not signed in"})]}),b&&b!=="Not signed in"&&n.jsx("button",{style:T.retryButton,onClick:V,onMouseOver:f=>{f.currentTarget.style.backgroundColor=F.accentHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor=F.accent},children:"Try Again"})]})})]})};exports.NeuctraAuthix=$n;exports.ReactSignedIn=Ls;exports.ReactSignedOut=Ms;exports.ReactUserButton=Ys;exports.ReactUserLogin=Ds;exports.ReactUserProfile=Vs;exports.ReactUserSignUp=$s;exports.getSdkConfig=ge;exports.setSdkConfig=Ns;
583
+ //# sourceMappingURL=index.cjs.js.map