@neuctra/authix 1.1.39 → 1.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/neuctra-authix.es.js +23 -21
- package/dist/neuctra-authix.umd.js +21 -21
- package/dist/sdk/index.d.ts +6 -12
- package/dist/sdk/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -2090,7 +2090,10 @@ class ca {
|
|
|
2090
2090
|
const r = this.appId;
|
|
2091
2091
|
if (!r) throw new Error("getAppData: 'appId' is required");
|
|
2092
2092
|
const s = e ? `?category=${encodeURIComponent(e)}` : "";
|
|
2093
|
-
return this.request(
|
|
2093
|
+
return (await this.request(
|
|
2094
|
+
"GET",
|
|
2095
|
+
`/app/${r}/data${s}`
|
|
2096
|
+
))?.data || [];
|
|
2094
2097
|
}
|
|
2095
2098
|
/**
|
|
2096
2099
|
* Get a single data item from app.appData[] by id
|
|
@@ -2100,56 +2103,55 @@ class ca {
|
|
|
2100
2103
|
if (!r) throw new Error("getSingleAppData: 'appId' is required");
|
|
2101
2104
|
if (!e.dataId)
|
|
2102
2105
|
throw new Error("getSingleAppData: 'dataId' is required");
|
|
2103
|
-
return this.request(
|
|
2106
|
+
return (await this.request(
|
|
2104
2107
|
"GET",
|
|
2105
2108
|
`/app/${r}/data/${e.dataId}`
|
|
2106
|
-
);
|
|
2109
|
+
))?.data;
|
|
2107
2110
|
}
|
|
2108
2111
|
/**
|
|
2109
2112
|
* 🔍 Search app data items by dynamic keys
|
|
2110
2113
|
* @example
|
|
2111
2114
|
* sdk.searchAppDataByKeys({
|
|
2112
|
-
* dataCategory: "
|
|
2113
|
-
*
|
|
2114
|
-
* status: "
|
|
2115
|
-
*
|
|
2115
|
+
* dataCategory: "order",
|
|
2116
|
+
* buyerId: "user123",
|
|
2117
|
+
* status: "Processing",
|
|
2118
|
+
* q: "iphone"
|
|
2116
2119
|
* })
|
|
2117
2120
|
*/
|
|
2118
2121
|
async searchAppDataByKeys(e) {
|
|
2119
2122
|
const r = this.appId;
|
|
2120
2123
|
if (!r)
|
|
2121
|
-
throw new Error("searchAppDataByKeys: 'appId' is required
|
|
2124
|
+
throw new Error("searchAppDataByKeys: 'appId' is required");
|
|
2122
2125
|
const s = new URLSearchParams(
|
|
2123
2126
|
Object.entries(e).reduce(
|
|
2124
|
-
(
|
|
2127
|
+
(i, [o, l]) => (l != null && (i[o] = String(l)), i),
|
|
2125
2128
|
{}
|
|
2126
2129
|
)
|
|
2127
2130
|
).toString();
|
|
2128
|
-
return this.request(
|
|
2131
|
+
return (await this.request(
|
|
2129
2132
|
"GET",
|
|
2130
|
-
`/app/${
|
|
2131
|
-
);
|
|
2133
|
+
`/app/${r}/data/searchByKeys${s ? `?${s}` : ""}`
|
|
2134
|
+
))?.data || [];
|
|
2132
2135
|
}
|
|
2133
2136
|
/**
|
|
2134
2137
|
* Add a new item to app.appData[] under a specific category
|
|
2135
2138
|
*/
|
|
2136
2139
|
async addAppData(e) {
|
|
2137
2140
|
const r = this.appId;
|
|
2138
|
-
if (!r)
|
|
2139
|
-
throw new Error("addAppData: 'appId' is required");
|
|
2141
|
+
if (!r) throw new Error("addAppData: 'appId' is required");
|
|
2140
2142
|
const { dataCategory: s, data: a } = e;
|
|
2141
2143
|
if (!s)
|
|
2142
2144
|
throw new Error("addAppData: 'dataCategory' is required");
|
|
2143
2145
|
if (!a || typeof a != "object")
|
|
2144
2146
|
throw new Error("addAppData: 'data' is required");
|
|
2145
|
-
return this.request(
|
|
2147
|
+
return (await this.request(
|
|
2146
2148
|
"POST",
|
|
2147
2149
|
`/app/${r}/data/${encodeURIComponent(s)}`,
|
|
2148
2150
|
{
|
|
2149
2151
|
item: a
|
|
2150
|
-
//
|
|
2152
|
+
// ✅ matches controller
|
|
2151
2153
|
}
|
|
2152
|
-
);
|
|
2154
|
+
))?.data;
|
|
2153
2155
|
}
|
|
2154
2156
|
/**
|
|
2155
2157
|
* Update an item in app.appData[] by id
|
|
@@ -2159,11 +2161,11 @@ class ca {
|
|
|
2159
2161
|
if (!r) throw new Error("updateAppData: 'appId' is required");
|
|
2160
2162
|
if (!e.dataId) throw new Error("updateAppData: 'dataId' is required");
|
|
2161
2163
|
if (!e.data) throw new Error("updateAppData: 'data' is required");
|
|
2162
|
-
return this.request(
|
|
2164
|
+
return (await this.request(
|
|
2163
2165
|
"PATCH",
|
|
2164
2166
|
`/app/${r}/data/${e.dataId}`,
|
|
2165
2167
|
e.data
|
|
2166
|
-
);
|
|
2168
|
+
))?.data;
|
|
2167
2169
|
}
|
|
2168
2170
|
/**
|
|
2169
2171
|
* Delete an item from app.appData[] by id
|
|
@@ -2172,10 +2174,10 @@ class ca {
|
|
|
2172
2174
|
const r = this.appId;
|
|
2173
2175
|
if (!r) throw new Error("deleteAppData: 'appId' is required");
|
|
2174
2176
|
if (!e.dataId) throw new Error("deleteAppData: 'dataId' is required");
|
|
2175
|
-
return this.request(
|
|
2177
|
+
return (await this.request(
|
|
2176
2178
|
"DELETE",
|
|
2177
2179
|
`/app/${r}/data/${e.dataId}`
|
|
2178
|
-
);
|
|
2180
|
+
))?.data;
|
|
2179
2181
|
}
|
|
2180
2182
|
}
|
|
2181
2183
|
var Ae = { exports: {} }, Ee = {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(Q,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],w):(Q=typeof globalThis<"u"?globalThis:Q||self,w(Q.NeuctraAuthix={},Q.React))})(this,(function(Q,w){"use strict";function ct(t,e){return function(){return t.apply(e,arguments)}}const{toString:ir}=Object.prototype,{getPrototypeOf:We}=Object,{iterator:Re,toStringTag:ut}=Symbol,Ae=(t=>e=>{const r=ir.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),se=t=>(t=t.toLowerCase(),e=>Ae(e)===t),ze=t=>e=>typeof e===t,{isArray:me}=Array,ye=ze("undefined");function je(t){return t!==null&&!ye(t)&&t.constructor!==null&&!ye(t.constructor)&&re(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const pt=se("ArrayBuffer");function lr(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&pt(t.buffer),e}const dr=ze("string"),re=ze("function"),ft=ze("number"),ve=t=>t!==null&&typeof t=="object",cr=t=>t===!0||t===!1,_e=t=>{if(Ae(t)!=="object")return!1;const e=We(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(ut in t)&&!(Re in t)},ur=t=>{if(!ve(t)||je(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},pr=se("Date"),fr=se("File"),xr=se("Blob"),hr=se("FileList"),gr=t=>ve(t)&&re(t.pipe),mr=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||re(t.append)&&((e=Ae(t))==="formdata"||e==="object"&&re(t.toString)&&t.toString()==="[object FormData]"))},yr=se("URLSearchParams"),[br,wr,Sr,jr]=["ReadableStream","Request","Response","Headers"].map(se),vr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ee(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let s,o;if(typeof t!="object"&&(t=[t]),me(t))for(s=0,o=t.length;s<o;s++)e.call(null,t[s],s,t);else{if(je(t))return;const i=r?Object.getOwnPropertyNames(t):Object.keys(t),a=i.length;let l;for(s=0;s<a;s++)l=i[s],e.call(null,t[l],l,t)}}function xt(t,e){if(je(t))return null;e=e.toLowerCase();const r=Object.keys(t);let s=r.length,o;for(;s-- >0;)if(o=r[s],e===o.toLowerCase())return o;return null}const pe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ht=t=>!ye(t)&&t!==pe;function He(){const{caseless:t,skipUndefined:e}=ht(this)&&this||{},r={},s=(o,i)=>{const a=t&&xt(r,i)||i;_e(r[a])&&_e(o)?r[a]=He(r[a],o):_e(o)?r[a]=He({},o):me(o)?r[a]=o.slice():(!e||!ye(o))&&(r[a]=o)};for(let o=0,i=arguments.length;o<i;o++)arguments[o]&&Ee(arguments[o],s);return r}const Er=(t,e,r,{allOwnKeys:s}={})=>(Ee(e,(o,i)=>{r&&re(o)?t[i]=ct(o,r):t[i]=o},{allOwnKeys:s}),t),kr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Cr=(t,e,r,s)=>{t.prototype=Object.create(e.prototype,s),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},Tr=(t,e,r,s)=>{let o,i,a;const l={};if(e=e||{},t==null)return e;do{for(o=Object.getOwnPropertyNames(t),i=o.length;i-- >0;)a=o[i],(!s||s(a,t,e))&&!l[a]&&(e[a]=t[a],l[a]=!0);t=r!==!1&&We(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},Ir=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const s=t.indexOf(e,r);return s!==-1&&s===r},Pr=t=>{if(!t)return null;if(me(t))return t;let e=t.length;if(!ft(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},Or=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&We(Uint8Array)),Rr=(t,e)=>{const s=(t&&t[Re]).call(t);let o;for(;(o=s.next())&&!o.done;){const i=o.value;e.call(t,i[0],i[1])}},Ar=(t,e)=>{let r;const s=[];for(;(r=t.exec(e))!==null;)s.push(r);return s},zr=se("HTMLFormElement"),_r=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,s,o){return s.toUpperCase()+o}),gt=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),$r=se("RegExp"),mt=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),s={};Ee(r,(o,i)=>{let a;(a=e(o,i,t))!==!1&&(s[i]=a||o)}),Object.defineProperties(t,s)},Nr=t=>{mt(t,(e,r)=>{if(re(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const s=t[r];if(re(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Ur=(t,e)=>{const r={},s=o=>{o.forEach(i=>{r[i]=!0})};return me(t)?s(t):s(String(t).split(e)),r},Dr=()=>{},Lr=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Fr(t){return!!(t&&re(t.append)&&t[ut]==="FormData"&&t[Re])}const qr=t=>{const e=new Array(10),r=(s,o)=>{if(ve(s)){if(e.indexOf(s)>=0)return;if(je(s))return s;if(!("toJSON"in s)){e[o]=s;const i=me(s)?[]:{};return Ee(s,(a,l)=>{const h=r(a,o+1);!ye(h)&&(i[l]=h)}),e[o]=void 0,i}}return s};return r(t,0)},Mr=se("AsyncFunction"),Br=t=>t&&(ve(t)||re(t))&&re(t.then)&&re(t.catch),yt=((t,e)=>t?setImmediate:e?((r,s)=>(pe.addEventListener("message",({source:o,data:i})=>{o===pe&&i===r&&s.length&&s.shift()()},!1),o=>{s.push(o),pe.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",re(pe.postMessage)),Wr=typeof queueMicrotask<"u"?queueMicrotask.bind(pe):typeof process<"u"&&process.nextTick||yt,p={isArray:me,isArrayBuffer:pt,isBuffer:je,isFormData:mr,isArrayBufferView:lr,isString:dr,isNumber:ft,isBoolean:cr,isObject:ve,isPlainObject:_e,isEmptyObject:ur,isReadableStream:br,isRequest:wr,isResponse:Sr,isHeaders:jr,isUndefined:ye,isDate:pr,isFile:fr,isBlob:xr,isRegExp:$r,isFunction:re,isStream:gr,isURLSearchParams:yr,isTypedArray:Or,isFileList:hr,forEach:Ee,merge:He,extend:Er,trim:vr,stripBOM:kr,inherits:Cr,toFlatObject:Tr,kindOf:Ae,kindOfTest:se,endsWith:Ir,toArray:Pr,forEachEntry:Rr,matchAll:Ar,isHTMLForm:zr,hasOwnProperty:gt,hasOwnProp:gt,reduceDescriptors:mt,freezeMethods:Nr,toObjectSet:Ur,toCamelCase:_r,noop:Dr,toFiniteNumber:Lr,findKey:xt,global:pe,isContextDefined:ht,isSpecCompliantForm:Fr,toJSONObject:qr,isAsyncFn:Mr,isThenable:Br,setImmediate:yt,asap:Wr,isIterable:t=>t!=null&&re(t[Re])};function D(t,e,r,s,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o,this.status=o.status?o.status:null)}p.inherits(D,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:p.toJSONObject(this.config),code:this.code,status:this.status}}});const bt=D.prototype,wt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{wt[t]={value:t}}),Object.defineProperties(D,wt),Object.defineProperty(bt,"isAxiosError",{value:!0}),D.from=(t,e,r,s,o,i)=>{const a=Object.create(bt);p.toFlatObject(t,a,function(u){return u!==Error.prototype},d=>d!=="isAxiosError");const l=t&&t.message?t.message:"Error",h=e==null&&t?t.code:e;return D.call(a,l,h,r,s,o),t&&a.cause==null&&Object.defineProperty(a,"cause",{value:t,configurable:!0}),a.name=t&&t.name||"Error",i&&Object.assign(a,i),a};const Hr=null;function Ve(t){return p.isPlainObject(t)||p.isArray(t)}function St(t){return p.endsWith(t,"[]")?t.slice(0,-2):t}function jt(t,e,r){return t?t.concat(e).map(function(o,i){return o=St(o),!r&&i?"["+o+"]":o}).join(r?".":""):e}function Vr(t){return p.isArray(t)&&!t.some(Ve)}const Yr=p.toFlatObject(p,{},null,function(e){return/^is[A-Z]/.test(e)});function $e(t,e,r){if(!p.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=p.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(j,m){return!p.isUndefined(m[j])});const s=r.metaTokens,o=r.visitor||u,i=r.dots,a=r.indexes,h=(r.Blob||typeof Blob<"u"&&Blob)&&p.isSpecCompliantForm(e);if(!p.isFunction(o))throw new TypeError("visitor must be a function");function d(c){if(c===null)return"";if(p.isDate(c))return c.toISOString();if(p.isBoolean(c))return c.toString();if(!h&&p.isBlob(c))throw new D("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(c)||p.isTypedArray(c)?h&&typeof Blob=="function"?new Blob([c]):Buffer.from(c):c}function u(c,j,m){let _=c;if(c&&!m&&typeof c=="object"){if(p.endsWith(j,"{}"))j=s?j:j.slice(0,-2),c=JSON.stringify(c);else if(p.isArray(c)&&Vr(c)||(p.isFileList(c)||p.endsWith(j,"[]"))&&(_=p.toArray(c)))return j=St(j),_.forEach(function(z,T){!(p.isUndefined(z)||z===null)&&e.append(a===!0?jt([j],T,i):a===null?j:j+"[]",d(z))}),!1}return Ve(c)?!0:(e.append(jt(m,j,i),d(c)),!1)}const b=[],y=Object.assign(Yr,{defaultVisitor:u,convertValue:d,isVisitable:Ve});function S(c,j){if(!p.isUndefined(c)){if(b.indexOf(c)!==-1)throw Error("Circular reference detected in "+j.join("."));b.push(c),p.forEach(c,function(_,P){(!(p.isUndefined(_)||_===null)&&o.call(e,_,p.isString(P)?P.trim():P,j,y))===!0&&S(_,j?j.concat(P):[P])}),b.pop()}}if(!p.isObject(t))throw new TypeError("data must be an object");return S(t),e}function vt(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function Ye(t,e){this._pairs=[],t&&$e(t,this,e)}const Et=Ye.prototype;Et.append=function(e,r){this._pairs.push([e,r])},Et.toString=function(e){const r=e?function(s){return e.call(this,s,vt)}:vt;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};function Kr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function kt(t,e,r){if(!e)return t;const s=r&&r.encode||Kr;p.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let i;if(o?i=o(e,r):i=p.isURLSearchParams(e)?e.toString():new Ye(e,r).toString(s),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class Ct{constructor(){this.handlers=[]}use(e,r,s){return this.handlers.push({fulfilled:e,rejected:r,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){p.forEach(this.handlers,function(s){s!==null&&e(s)})}}const Tt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Jr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ye,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Ke=typeof window<"u"&&typeof document<"u",Je=typeof navigator=="object"&&navigator||void 0,Gr=Ke&&(!Je||["ReactNative","NativeScript","NS"].indexOf(Je.product)<0),Xr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Zr=Ke&&window.location.href||"http://localhost",ee={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ke,hasStandardBrowserEnv:Gr,hasStandardBrowserWebWorkerEnv:Xr,navigator:Je,origin:Zr},Symbol.toStringTag,{value:"Module"})),...Jr};function Qr(t,e){return $e(t,new ee.classes.URLSearchParams,{visitor:function(r,s,o,i){return ee.isNode&&p.isBuffer(r)?(this.append(s,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function en(t){return p.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function tn(t){const e={},r=Object.keys(t);let s;const o=r.length;let i;for(s=0;s<o;s++)i=r[s],e[i]=t[i];return e}function It(t){function e(r,s,o,i){let a=r[i++];if(a==="__proto__")return!0;const l=Number.isFinite(+a),h=i>=r.length;return a=!a&&p.isArray(o)?o.length:a,h?(p.hasOwnProp(o,a)?o[a]=[o[a],s]:o[a]=s,!l):((!o[a]||!p.isObject(o[a]))&&(o[a]=[]),e(r,s,o[a],i)&&p.isArray(o[a])&&(o[a]=tn(o[a])),!l)}if(p.isFormData(t)&&p.isFunction(t.entries)){const r={};return p.forEachEntry(t,(s,o)=>{e(en(s),o,r,0)}),r}return null}function rn(t,e,r){if(p.isString(t))try{return(e||JSON.parse)(t),p.trim(t)}catch(s){if(s.name!=="SyntaxError")throw s}return(r||JSON.stringify)(t)}const ke={transitional:Tt,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const s=r.getContentType()||"",o=s.indexOf("application/json")>-1,i=p.isObject(e);if(i&&p.isHTMLForm(e)&&(e=new FormData(e)),p.isFormData(e))return o?JSON.stringify(It(e)):e;if(p.isArrayBuffer(e)||p.isBuffer(e)||p.isStream(e)||p.isFile(e)||p.isBlob(e)||p.isReadableStream(e))return e;if(p.isArrayBufferView(e))return e.buffer;if(p.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(i){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Qr(e,this.formSerializer).toString();if((l=p.isFileList(e))||s.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return $e(l?{"files[]":e}:e,h&&new h,this.formSerializer)}}return i||o?(r.setContentType("application/json",!1),rn(e)):e}],transformResponse:[function(e){const r=this.transitional||ke.transitional,s=r&&r.forcedJSONParsing,o=this.responseType==="json";if(p.isResponse(e)||p.isReadableStream(e))return e;if(e&&p.isString(e)&&(s&&!this.responseType||o)){const a=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(e,this.parseReviver)}catch(l){if(a)throw l.name==="SyntaxError"?D.from(l,D.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ee.classes.FormData,Blob:ee.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(["delete","get","head","post","put","patch"],t=>{ke.headers[t]={}});const nn=p.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),sn=t=>{const e={};let r,s,o;return t&&t.split(`
|
|
2
|
-
`).forEach(function(
|
|
3
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const s=new this(e);return r.forEach(o=>s.set(o)),s}static accessor(e){const s=(this[Pt]=this[Pt]={accessors:{}}).accessors,o=this.prototype;function i(a){const l=Ce(a);s[l]||(dn(o,a),s[l]=!0)}return p.isArray(e)?e.forEach(i):i(e),this}};ne.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),p.reduceDescriptors(ne.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(s){this[r]=s}}}),p.freezeMethods(ne);function Xe(t,e){const r=this||ke,s=e||r,o=ne.from(s.headers);let i=s.data;return p.forEach(t,function(l){i=l.call(r,i,o.normalize(),e?e.status:void 0)}),o.normalize(),i}function Ot(t){return!!(t&&t.__CANCEL__)}function be(t,e,r){D.call(this,t??"canceled",D.ERR_CANCELED,e,r),this.name="CanceledError"}p.inherits(be,D,{__CANCEL__:!0});function Rt(t,e,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?t(r):e(new D("Request failed with status code "+r.status,[D.ERR_BAD_REQUEST,D.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function cn(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function un(t,e){t=t||10;const r=new Array(t),s=new Array(t);let o=0,i=0,a;return e=e!==void 0?e:1e3,function(h){const d=Date.now(),u=s[i];a||(a=d),r[o]=h,s[o]=d;let b=i,y=0;for(;b!==o;)y+=r[b++],b=b%t;if(o=(o+1)%t,o===i&&(i=(i+1)%t),d-a<e)return;const S=u&&d-u;return S?Math.round(y*1e3/S):void 0}}function pn(t,e){let r=0,s=1e3/e,o,i;const a=(d,u=Date.now())=>{r=u,o=null,i&&(clearTimeout(i),i=null),t(...d)};return[(...d)=>{const u=Date.now(),b=u-r;b>=s?a(d,u):(o=d,i||(i=setTimeout(()=>{i=null,a(o)},s-b)))},()=>o&&a(o)]}const Ue=(t,e,r=3)=>{let s=0;const o=un(50,250);return pn(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,h=a-s,d=o(h),u=a<=l;s=a;const b={loaded:a,total:l,progress:l?a/l:void 0,bytes:h,rate:d||void 0,estimated:d&&l&&u?(l-a)/d:void 0,event:i,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(b)},r)},At=(t,e)=>{const r=t!=null;return[s=>e[0]({lengthComputable:r,total:t,loaded:s}),e[1]]},zt=t=>(...e)=>p.asap(()=>t(...e)),fn=ee.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,ee.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(ee.origin),ee.navigator&&/(msie|trident)/i.test(ee.navigator.userAgent)):()=>!0,xn=ee.hasStandardBrowserEnv?{write(t,e,r,s,o,i){const a=[t+"="+encodeURIComponent(e)];p.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),p.isString(s)&&a.push("path="+s),p.isString(o)&&a.push("domain="+o),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function hn(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function gn(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function _t(t,e,r){let s=!hn(e);return t&&(s||r==!1)?gn(t,e):e}const $t=t=>t instanceof ne?{...t}:t;function fe(t,e){e=e||{};const r={};function s(d,u,b,y){return p.isPlainObject(d)&&p.isPlainObject(u)?p.merge.call({caseless:y},d,u):p.isPlainObject(u)?p.merge({},u):p.isArray(u)?u.slice():u}function o(d,u,b,y){if(p.isUndefined(u)){if(!p.isUndefined(d))return s(void 0,d,b,y)}else return s(d,u,b,y)}function i(d,u){if(!p.isUndefined(u))return s(void 0,u)}function a(d,u){if(p.isUndefined(u)){if(!p.isUndefined(d))return s(void 0,d)}else return s(void 0,u)}function l(d,u,b){if(b in e)return s(d,u);if(b in t)return s(void 0,d)}const h={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(d,u,b)=>o($t(d),$t(u),b,!0)};return p.forEach(Object.keys({...t,...e}),function(u){const b=h[u]||o,y=b(t[u],e[u],u);p.isUndefined(y)&&b!==l||(r[u]=y)}),r}const Nt=t=>{const e=fe({},t);let{data:r,withXSRFToken:s,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:l}=e;if(e.headers=a=ne.from(a),e.url=kt(_t(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),p.isFormData(r)){if(ee.hasStandardBrowserEnv||ee.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(p.isFunction(r.getHeaders)){const h=r.getHeaders(),d=["content-type","content-length"];Object.entries(h).forEach(([u,b])=>{d.includes(u.toLowerCase())&&a.set(u,b)})}}if(ee.hasStandardBrowserEnv&&(s&&p.isFunction(s)&&(s=s(e)),s||s!==!1&&fn(e.url))){const h=o&&i&&xn.read(i);h&&a.set(o,h)}return e},mn=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,s){const o=Nt(t);let i=o.data;const a=ne.from(o.headers).normalize();let{responseType:l,onUploadProgress:h,onDownloadProgress:d}=o,u,b,y,S,c;function j(){S&&S(),c&&c(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let m=new XMLHttpRequest;m.open(o.method.toUpperCase(),o.url,!0),m.timeout=o.timeout;function _(){if(!m)return;const z=ne.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),q={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:z,config:t,request:m};Rt(function(O){r(O),j()},function(O){s(O),j()},q),m=null}"onloadend"in m?m.onloadend=_:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(_)},m.onabort=function(){m&&(s(new D("Request aborted",D.ECONNABORTED,t,m)),m=null)},m.onerror=function(T){const q=T&&T.message?T.message:"Network Error",g=new D(q,D.ERR_NETWORK,t,m);g.event=T||null,s(g),m=null},m.ontimeout=function(){let T=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const q=o.transitional||Tt;o.timeoutErrorMessage&&(T=o.timeoutErrorMessage),s(new D(T,q.clarifyTimeoutError?D.ETIMEDOUT:D.ECONNABORTED,t,m)),m=null},i===void 0&&a.setContentType(null),"setRequestHeader"in m&&p.forEach(a.toJSON(),function(T,q){m.setRequestHeader(q,T)}),p.isUndefined(o.withCredentials)||(m.withCredentials=!!o.withCredentials),l&&l!=="json"&&(m.responseType=o.responseType),d&&([y,c]=Ue(d,!0),m.addEventListener("progress",y)),h&&m.upload&&([b,S]=Ue(h),m.upload.addEventListener("progress",b),m.upload.addEventListener("loadend",S)),(o.cancelToken||o.signal)&&(u=z=>{m&&(s(!z||z.type?new be(null,t,m):z),m.abort(),m=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));const P=cn(o.url);if(P&&ee.protocols.indexOf(P)===-1){s(new D("Unsupported protocol "+P+":",D.ERR_BAD_REQUEST,t));return}m.send(i||null)})},yn=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let s=new AbortController,o;const i=function(d){if(!o){o=!0,l();const u=d instanceof Error?d:this.reason;s.abort(u instanceof D?u:new be(u instanceof Error?u.message:u))}};let a=e&&setTimeout(()=>{a=null,i(new D(`timeout ${e} of ms exceeded`,D.ETIMEDOUT))},e);const l=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),t=null)};t.forEach(d=>d.addEventListener("abort",i));const{signal:h}=s;return h.unsubscribe=()=>p.asap(l),h}},bn=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let s=0,o;for(;s<r;)o=s+e,yield t.slice(s,o),s=o},wn=async function*(t,e){for await(const r of Sn(t))yield*bn(r,e)},Sn=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:s}=await e.read();if(r)break;yield s}}finally{await e.cancel()}},Ut=(t,e,r,s)=>{const o=wn(t,e);let i=0,a,l=h=>{a||(a=!0,s&&s(h))};return new ReadableStream({async pull(h){try{const{done:d,value:u}=await o.next();if(d){l(),h.close();return}let b=u.byteLength;if(r){let y=i+=b;r(y)}h.enqueue(new Uint8Array(u))}catch(d){throw l(d),d}},cancel(h){return l(h),o.return()}},{highWaterMark:2})},Dt=64*1024,{isFunction:De}=p,jn=(({Request:t,Response:e})=>({Request:t,Response:e}))(p.global),{ReadableStream:Lt,TextEncoder:Ft}=p.global,qt=(t,...e)=>{try{return!!t(...e)}catch{return!1}},vn=t=>{t=p.merge.call({skipUndefined:!0},jn,t);const{fetch:e,Request:r,Response:s}=t,o=e?De(e):typeof fetch=="function",i=De(r),a=De(s);if(!o)return!1;const l=o&&De(Lt),h=o&&(typeof Ft=="function"?(c=>j=>c.encode(j))(new Ft):async c=>new Uint8Array(await new r(c).arrayBuffer())),d=i&&l&&qt(()=>{let c=!1;const j=new r(ee.origin,{body:new Lt,method:"POST",get duplex(){return c=!0,"half"}}).headers.has("Content-Type");return c&&!j}),u=a&&l&&qt(()=>p.isReadableStream(new s("").body)),b={stream:u&&(c=>c.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(c=>{!b[c]&&(b[c]=(j,m)=>{let _=j&&j[c];if(_)return _.call(j);throw new D(`Response type '${c}' is not supported`,D.ERR_NOT_SUPPORT,m)})});const y=async c=>{if(c==null)return 0;if(p.isBlob(c))return c.size;if(p.isSpecCompliantForm(c))return(await new r(ee.origin,{method:"POST",body:c}).arrayBuffer()).byteLength;if(p.isArrayBufferView(c)||p.isArrayBuffer(c))return c.byteLength;if(p.isURLSearchParams(c)&&(c=c+""),p.isString(c))return(await h(c)).byteLength},S=async(c,j)=>{const m=p.toFiniteNumber(c.getContentLength());return m??y(j)};return async c=>{let{url:j,method:m,data:_,signal:P,cancelToken:z,timeout:T,onDownloadProgress:q,onUploadProgress:g,responseType:O,headers:v,withCredentials:U="same-origin",fetchOptions:B}=Nt(c),F=e||fetch;O=O?(O+"").toLowerCase():"text";let V=yn([P,z&&z.toAbortSignal()],T),Z=null;const I=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let J;try{if(g&&d&&m!=="get"&&m!=="head"&&(J=await S(v,_))!==0){let f=new r(j,{method:"POST",body:_,duplex:"half"}),E;if(p.isFormData(_)&&(E=f.headers.get("content-type"))&&v.setContentType(E),f.body){const[x,k]=At(J,Ue(zt(g)));_=Ut(f.body,Dt,x,k)}}p.isString(U)||(U=U?"include":"omit");const A=i&&"credentials"in r.prototype,R={...B,signal:V,method:m.toUpperCase(),headers:v.normalize().toJSON(),body:_,duplex:"half",credentials:A?U:void 0};Z=i&&new r(j,R);let K=await(i?F(Z,B):F(j,R));const te=u&&(O==="stream"||O==="response");if(u&&(q||te&&I)){const f={};["status","statusText","headers"].forEach($=>{f[$]=K[$]});const E=p.toFiniteNumber(K.headers.get("content-length")),[x,k]=q&&At(E,Ue(zt(q),!0))||[];K=new s(Ut(K.body,Dt,x,()=>{k&&k(),I&&I()}),f)}O=O||"text";let G=await b[p.findKey(b,O)||"text"](K,c);return!te&&I&&I(),await new Promise((f,E)=>{Rt(f,E,{data:G,headers:ne.from(K.headers),status:K.status,statusText:K.statusText,config:c,request:Z})})}catch(A){throw I&&I(),A&&A.name==="TypeError"&&/Load failed|fetch/i.test(A.message)?Object.assign(new D("Network Error",D.ERR_NETWORK,c,Z),{cause:A.cause||A}):D.from(A,A&&A.code,c,Z)}}},En=new Map,Mt=t=>{let e=t?t.env:{};const{fetch:r,Request:s,Response:o}=e,i=[s,o,r];let a=i.length,l=a,h,d,u=En;for(;l--;)h=i[l],d=u.get(h),d===void 0&&u.set(h,d=l?new Map:vn(e)),u=d;return d};Mt();const Ze={http:Hr,xhr:mn,fetch:{get:Mt}};p.forEach(Ze,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Bt=t=>`- ${t}`,kn=t=>p.isFunction(t)||t===null||t===!1,Wt={getAdapter:(t,e)=>{t=p.isArray(t)?t:[t];const{length:r}=t;let s,o;const i={};for(let a=0;a<r;a++){s=t[a];let l;if(o=s,!kn(s)&&(o=Ze[(l=String(s)).toLowerCase()],o===void 0))throw new D(`Unknown adapter '${l}'`);if(o&&(p.isFunction(o)||(o=o.get(e))))break;i[l||"#"+a]=o}if(!o){const a=Object.entries(i).map(([h,d])=>`adapter ${h} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=r?a.length>1?`since :
|
|
4
|
-
`+
|
|
5
|
-
`):" "+Bt(
|
|
6
|
-
`+i):s.stack=i}catch{}}throw s}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=fe(this.defaults,r);const{transitional:s,paramsSerializer:o,headers:i}=r;s!==void 0&&Fe.assertOptions(s,{silentJSONParsing:ie.transitional(ie.boolean),forcedJSONParsing:ie.transitional(ie.boolean),clarifyTimeoutError:ie.transitional(ie.boolean)},!1),o!=null&&(p.isFunction(o)?r.paramsSerializer={serialize:o}:Fe.assertOptions(o,{encode:ie.function,serialize:ie.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Fe.assertOptions(r,{baseUrl:ie.spelling("baseURL"),withXsrfToken:ie.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=i&&p.merge(i.common,i[r.method]);i&&p.forEach(["delete","get","head","post","put","patch","common"],c=>{delete i[c]}),r.headers=ne.concat(a,i);const l=[];let h=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(r)===!1||(h=h&&j.synchronous,l.unshift(j.fulfilled,j.rejected))});const d=[];this.interceptors.response.forEach(function(j){d.push(j.fulfilled,j.rejected)});let u,b=0,y;if(!h){const c=[Ht.bind(this),void 0];for(c.unshift(...l),c.push(...d),y=c.length,u=Promise.resolve(r);b<y;)u=u.then(c[b++],c[b++]);return u}y=l.length;let S=r;for(;b<y;){const c=l[b++],j=l[b++];try{S=c(S)}catch(m){j.call(this,m);break}}try{u=Ht.call(this,S)}catch(c){return Promise.reject(c)}for(b=0,y=d.length;b<y;)u=u.then(d[b++],d[b++]);return u}getUri(e){e=fe(this.defaults,e);const r=_t(e.baseURL,e.url,e.allowAbsoluteUrls);return kt(r,e.params,e.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(e){xe.prototype[e]=function(r,s){return this.request(fe(s||{},{method:e,url:r,data:(s||{}).data}))}}),p.forEach(["post","put","patch"],function(e){function r(s){return function(i,a,l){return this.request(fe(l||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}xe.prototype[e]=r(),xe.prototype[e+"Form"]=r(!0)});let Tn=class ar{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const s=this;this.promise.then(o=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](o);s._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(l=>{s.subscribe(l),i=l}).then(o);return a.cancel=function(){s.unsubscribe(i)},a},e(function(i,a,l){s.reason||(s.reason=new be(i,a,l),r(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=s=>{e.abort(s)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new ar(function(o){e=o}),cancel:e}}};function In(t){return function(r){return t.apply(null,r)}}function Pn(t){return p.isObject(t)&&t.isAxiosError===!0}const et={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(et).forEach(([t,e])=>{et[e]=t});function Kt(t){const e=new xe(t),r=ct(xe.prototype.request,e);return p.extend(r,xe.prototype,e,{allOwnKeys:!0}),p.extend(r,e,null,{allOwnKeys:!0}),r.create=function(o){return Kt(fe(t,o))},r}const M=Kt(ke);M.Axios=xe,M.CanceledError=be,M.CancelToken=Tn,M.isCancel=Ot,M.VERSION=Vt,M.toFormData=$e,M.AxiosError=D,M.Cancel=M.CanceledError,M.all=function(e){return Promise.all(e)},M.spread=In,M.isAxiosError=Pn,M.mergeConfig=fe,M.AxiosHeaders=ne,M.formToJSON=t=>It(p.isHTMLForm(t)?new FormData(t):t),M.getAdapter=Wt.getAdapter,M.HttpStatusCode=et,M.default=M;const{Axios:bs,AxiosError:ws,CanceledError:Ss,isCancel:js,CancelToken:vs,VERSION:Es,all:ks,Cancel:Cs,isAxiosError:Ts,spread:Is,toFormData:Ps,AxiosHeaders:Os,HttpStatusCode:Rs,formToJSON:As,getAdapter:zs,mergeConfig:_s}=M;class On{baseUrl;apiKey;appId;client;constructor(e){if(!e||!e.baseUrl)throw new Error("NeuctraAuthixClient: 'baseUrl' is required in config");this.baseUrl=e.baseUrl.replace(/\/$/,""),this.apiKey=e.apiKey||null,this.appId=e.appId||null,this.client=M.create({baseURL:this.baseUrl,headers:{"Content-Type":"application/json",...this.apiKey?{"x-api-key":this.apiKey}:{}},timeout:1e4})}async request(e,r,s,o={}){if(!e)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:e,data:i,headers:o})).data}catch(i){if(console.error("❌ [Request Error]:",i),i.isAxiosError){const a=i.response?.status||0,l=i.response?.data?.message||i.message||"Unknown Axios error occurred";throw new Error(`Request failed (${a}): ${l}`)}throw new Error(`Unexpected error: ${i.message||"Unknown failure"}`)}}async signup(e){const{name:r,email:s,password:o}=e;if(!r||!s||!o)throw new Error("signup: 'name', 'email', and 'password' are required");return this.request("POST","/users/signup",e)}async login(e){const{email:r,password:s,appId:o}=e;if(!r||!s)throw new Error("login: 'email' and 'password' are required");return this.request("POST","/users/login",{email:r,password:s,appId:o||this.appId})}async updateUser(e){const{userId:r,appId:s}=e;if(!r)throw new Error("updateUser: 'userId' is required");return this.request("PUT",`/users/update/${r}`,{...e,appId:s||this.appId})}async changePassword(e){const{userId:r,currentPassword:s,newPassword:o,appId:i}=e;if(!r)throw new Error("changePassword: 'userId' is required");if(!s||!o)throw new Error("changePassword: both 'currentPassword' and 'newPassword' are required");return this.request("PUT",`/users/change-password/${r}`,{currentPassword:s,newPassword:o,appId:i||this.appId})}async deleteUser(e){const{userId:r,appId:s}=e;if(!r)throw new Error("deleteUser: 'userId' is required");return this.request("DELETE",`/users/delete/${r}`,{appId:s||this.appId})}async getProfile(e){const{token:r}=e;if(!r)throw new Error("getProfile: 'token' is required");return this.request("GET","/users/profile",{},{Authorization:`Bearer ${r}`})}async sendVerifyOTP(e){const{token:r,appId:s}=e;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(e){const{token:r,otp:s,appId:o}=e;if(!r)throw new Error("verifyEmail: 'token' is required");if(!s)throw new Error("verifyEmail: 'otp' is required");return this.request("POST","/users/verify-email",{otp:s,appId:o||this.appId},{Authorization:`Bearer ${r}`})}async forgotPassword(e){const{email:r,appId:s}=e;if(!r)throw new Error("forgotPassword: 'email' is required");return this.request("POST","/users/forgot-password",{email:r,appId:s||this.appId})}async resetPassword(e){const{email:r,otp:s,newPassword:o,appId:i}=e;if(!r||!s||!o)throw new Error("resetPassword: 'email', 'otp' and 'newPassword' are required");return this.request("POST","/users/reset-password",{email:r,otp:s,newPassword:o,appId:i||this.appId})}async checkUser(e){if(!e)throw new Error("checkUser: 'userId' is required");if(!this.appId)throw new Error("checkUser: SDK 'appId' is missing in config");return this.request("GET",`/users/check-user/${e}?appId=${this.appId}`)}async searchAllUsersData(e){if(!this.appId)throw new Error("searchAllUsersData: appId missing");const r=new URLSearchParams(e).toString();return this.request("GET",`/users/${this.appId}/data/search?${r}`)}async searchUserData(e){const{userId:r,...s}=e;if(!r)throw new Error("userId required");const o=new URLSearchParams(s).toString();return this.request("GET",`/users/${r}/data/search?${o}`)}async searchUserDataByKeys(e){const{userId:r,...s}=e;if(!r)throw new Error("searchUserDataByKeys: 'userId' is required");const o=new URLSearchParams(Object.entries(s).reduce((i,[a,l])=>(l!=null&&(i[a]=String(l)),i),{})).toString();return this.request("GET",`/users/${r}/data/searchbyref?${o}`)}async searchAllUsersDataByKeys(e){const r=this.appId;if(!r)throw new Error("searchAllUsersDataByKeys: 'appId' is required on SDK initialization");const s=new URLSearchParams(Object.entries(e).reduce((o,[i,a])=>(a!=null&&(o[i]=String(a)),o),{})).toString();return this.request("GET",`/users/${encodeURIComponent(r)}/data/searchbyref/all?${s}`)}async getAllUsersData(){if(!this.appId)throw new Error("getAllUsersData: SDK 'appId' is missing in config");return this.request("GET",`/users/all-data/${this.appId}/data`)}async getUserData(e){const{userId:r}=e;if(!r)throw new Error("getUserData: 'userId' is required");return this.request("GET",`/users/${r}/data`)}async getSingleUserData(e){const{userId:r,dataId:s}=e;if(!r||!s)throw new Error("getSingleUserData: 'userId' and 'dataId' are required");return this.request("GET",`/users/${r}/data/${s}`)}async addUserData(e){const{userId:r,dataCategory:s,data:o}=e;if(!r)throw new Error("addUserData: 'userId' is required");if(!s)throw new Error("addUserData: 'dataCategory' is required");if(!o)throw new Error("addUserData: 'data' is required");return this.request("POST",`/users/${r}/data`,{dataCategory:s,...o})}async updateUserData(e){const{userId:r,dataId:s,data:o}=e;if(!r||!s)throw new Error("updateUserData: 'userId' and 'dataId' are required");if(!o)throw new Error("updateUserData: 'data' is required");return this.request("PUT",`/users/${r}/data/${s}`,o)}async deleteUserData(e){const{userId:r,dataId:s}=e;if(!r||!s)throw new Error("deleteUserData: 'userId' and 'dataId' are required");return this.request("DELETE",`/users/${r}/data/${s}`)}async getAppData(e){const r=this.appId;if(!r)throw new Error("getAppData: 'appId' is required");const s=e?`?category=${encodeURIComponent(e)}`:"";return this.request("GET",`/app/${r}/data${s}`)}async getSingleAppData(e){const r=this.appId;if(!r)throw new Error("getSingleAppData: 'appId' is required");if(!e.dataId)throw new Error("getSingleAppData: 'dataId' is required");return this.request("GET",`/app/${r}/data/${e.dataId}`)}async searchAppDataByKeys(e){const r=this.appId;if(!r)throw new Error("searchAppDataByKeys: 'appId' is required in SDK config");const s=new URLSearchParams(Object.entries(e).reduce((o,[i,a])=>(a!=null&&(o[i]=String(a)),o),{})).toString();return this.request("GET",`/app/${encodeURIComponent(r)}/data/searchByKeys${s?`?${s}`:""}`)}async addAppData(e){const r=this.appId;if(!r)throw new Error("addAppData: 'appId' is required");const{dataCategory:s,data:o}=e;if(!s)throw new Error("addAppData: 'dataCategory' is required");if(!o||typeof o!="object")throw new Error("addAppData: 'data' is required");return this.request("POST",`/app/${r}/data/${encodeURIComponent(s)}`,{item:o})}async updateAppData(e){const r=this.appId;if(!r)throw new Error("updateAppData: 'appId' is required");if(!e.dataId)throw new Error("updateAppData: 'dataId' is required");if(!e.data)throw new Error("updateAppData: 'data' is required");return this.request("PATCH",`/app/${r}/data/${e.dataId}`,e.data)}async deleteAppData(e){const r=this.appId;if(!r)throw new Error("deleteAppData: 'appId' is required");if(!e.dataId)throw new Error("deleteAppData: 'dataId' is required");return this.request("DELETE",`/app/${r}/data/${e.dataId}`)}}var qe={exports:{}},Te={};/**
|
|
1
|
+
(function(Q,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],w):(Q=typeof globalThis<"u"?globalThis:Q||self,w(Q.NeuctraAuthix={},Q.React))})(this,(function(Q,w){"use strict";function ct(t,e){return function(){return t.apply(e,arguments)}}const{toString:ir}=Object.prototype,{getPrototypeOf:We}=Object,{iterator:Re,toStringTag:ut}=Symbol,Ae=(t=>e=>{const r=ir.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),se=t=>(t=t.toLowerCase(),e=>Ae(e)===t),ze=t=>e=>typeof e===t,{isArray:me}=Array,ye=ze("undefined");function je(t){return t!==null&&!ye(t)&&t.constructor!==null&&!ye(t.constructor)&&re(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const pt=se("ArrayBuffer");function lr(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&pt(t.buffer),e}const dr=ze("string"),re=ze("function"),ft=ze("number"),ve=t=>t!==null&&typeof t=="object",cr=t=>t===!0||t===!1,_e=t=>{if(Ae(t)!=="object")return!1;const e=We(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(ut in t)&&!(Re in t)},ur=t=>{if(!ve(t)||je(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},pr=se("Date"),fr=se("File"),xr=se("Blob"),hr=se("FileList"),gr=t=>ve(t)&&re(t.pipe),mr=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||re(t.append)&&((e=Ae(t))==="formdata"||e==="object"&&re(t.toString)&&t.toString()==="[object FormData]"))},yr=se("URLSearchParams"),[br,wr,Sr,jr]=["ReadableStream","Request","Response","Headers"].map(se),vr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ee(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let s,a;if(typeof t!="object"&&(t=[t]),me(t))for(s=0,a=t.length;s<a;s++)e.call(null,t[s],s,t);else{if(je(t))return;const i=r?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let l;for(s=0;s<o;s++)l=i[s],e.call(null,t[l],l,t)}}function xt(t,e){if(je(t))return null;e=e.toLowerCase();const r=Object.keys(t);let s=r.length,a;for(;s-- >0;)if(a=r[s],e===a.toLowerCase())return a;return null}const pe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ht=t=>!ye(t)&&t!==pe;function He(){const{caseless:t,skipUndefined:e}=ht(this)&&this||{},r={},s=(a,i)=>{const o=t&&xt(r,i)||i;_e(r[o])&&_e(a)?r[o]=He(r[o],a):_e(a)?r[o]=He({},a):me(a)?r[o]=a.slice():(!e||!ye(a))&&(r[o]=a)};for(let a=0,i=arguments.length;a<i;a++)arguments[a]&&Ee(arguments[a],s);return r}const Er=(t,e,r,{allOwnKeys:s}={})=>(Ee(e,(a,i)=>{r&&re(a)?t[i]=ct(a,r):t[i]=a},{allOwnKeys:s}),t),kr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Cr=(t,e,r,s)=>{t.prototype=Object.create(e.prototype,s),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},Tr=(t,e,r,s)=>{let a,i,o;const l={};if(e=e||{},t==null)return e;do{for(a=Object.getOwnPropertyNames(t),i=a.length;i-- >0;)o=a[i],(!s||s(o,t,e))&&!l[o]&&(e[o]=t[o],l[o]=!0);t=r!==!1&&We(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},Ir=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const s=t.indexOf(e,r);return s!==-1&&s===r},Pr=t=>{if(!t)return null;if(me(t))return t;let e=t.length;if(!ft(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},Or=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&We(Uint8Array)),Rr=(t,e)=>{const s=(t&&t[Re]).call(t);let a;for(;(a=s.next())&&!a.done;){const i=a.value;e.call(t,i[0],i[1])}},Ar=(t,e)=>{let r;const s=[];for(;(r=t.exec(e))!==null;)s.push(r);return s},zr=se("HTMLFormElement"),_r=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,s,a){return s.toUpperCase()+a}),gt=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),$r=se("RegExp"),mt=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),s={};Ee(r,(a,i)=>{let o;(o=e(a,i,t))!==!1&&(s[i]=o||a)}),Object.defineProperties(t,s)},Nr=t=>{mt(t,(e,r)=>{if(re(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const s=t[r];if(re(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Ur=(t,e)=>{const r={},s=a=>{a.forEach(i=>{r[i]=!0})};return me(t)?s(t):s(String(t).split(e)),r},Dr=()=>{},Lr=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Fr(t){return!!(t&&re(t.append)&&t[ut]==="FormData"&&t[Re])}const qr=t=>{const e=new Array(10),r=(s,a)=>{if(ve(s)){if(e.indexOf(s)>=0)return;if(je(s))return s;if(!("toJSON"in s)){e[a]=s;const i=me(s)?[]:{};return Ee(s,(o,l)=>{const h=r(o,a+1);!ye(h)&&(i[l]=h)}),e[a]=void 0,i}}return s};return r(t,0)},Mr=se("AsyncFunction"),Br=t=>t&&(ve(t)||re(t))&&re(t.then)&&re(t.catch),yt=((t,e)=>t?setImmediate:e?((r,s)=>(pe.addEventListener("message",({source:a,data:i})=>{a===pe&&i===r&&s.length&&s.shift()()},!1),a=>{s.push(a),pe.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",re(pe.postMessage)),Wr=typeof queueMicrotask<"u"?queueMicrotask.bind(pe):typeof process<"u"&&process.nextTick||yt,p={isArray:me,isArrayBuffer:pt,isBuffer:je,isFormData:mr,isArrayBufferView:lr,isString:dr,isNumber:ft,isBoolean:cr,isObject:ve,isPlainObject:_e,isEmptyObject:ur,isReadableStream:br,isRequest:wr,isResponse:Sr,isHeaders:jr,isUndefined:ye,isDate:pr,isFile:fr,isBlob:xr,isRegExp:$r,isFunction:re,isStream:gr,isURLSearchParams:yr,isTypedArray:Or,isFileList:hr,forEach:Ee,merge:He,extend:Er,trim:vr,stripBOM:kr,inherits:Cr,toFlatObject:Tr,kindOf:Ae,kindOfTest:se,endsWith:Ir,toArray:Pr,forEachEntry:Rr,matchAll:Ar,isHTMLForm:zr,hasOwnProperty:gt,hasOwnProp:gt,reduceDescriptors:mt,freezeMethods:Nr,toObjectSet:Ur,toCamelCase:_r,noop:Dr,toFiniteNumber:Lr,findKey:xt,global:pe,isContextDefined:ht,isSpecCompliantForm:Fr,toJSONObject:qr,isAsyncFn:Mr,isThenable:Br,setImmediate:yt,asap:Wr,isIterable:t=>t!=null&&re(t[Re])};function D(t,e,r,s,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),s&&(this.request=s),a&&(this.response=a,this.status=a.status?a.status:null)}p.inherits(D,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:p.toJSONObject(this.config),code:this.code,status:this.status}}});const bt=D.prototype,wt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{wt[t]={value:t}}),Object.defineProperties(D,wt),Object.defineProperty(bt,"isAxiosError",{value:!0}),D.from=(t,e,r,s,a,i)=>{const o=Object.create(bt);p.toFlatObject(t,o,function(u){return u!==Error.prototype},d=>d!=="isAxiosError");const l=t&&t.message?t.message:"Error",h=e==null&&t?t.code:e;return D.call(o,l,h,r,s,a),t&&o.cause==null&&Object.defineProperty(o,"cause",{value:t,configurable:!0}),o.name=t&&t.name||"Error",i&&Object.assign(o,i),o};const Hr=null;function Ve(t){return p.isPlainObject(t)||p.isArray(t)}function St(t){return p.endsWith(t,"[]")?t.slice(0,-2):t}function jt(t,e,r){return t?t.concat(e).map(function(a,i){return a=St(a),!r&&i?"["+a+"]":a}).join(r?".":""):e}function Vr(t){return p.isArray(t)&&!t.some(Ve)}const Yr=p.toFlatObject(p,{},null,function(e){return/^is[A-Z]/.test(e)});function $e(t,e,r){if(!p.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=p.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(j,m){return!p.isUndefined(m[j])});const s=r.metaTokens,a=r.visitor||u,i=r.dots,o=r.indexes,h=(r.Blob||typeof Blob<"u"&&Blob)&&p.isSpecCompliantForm(e);if(!p.isFunction(a))throw new TypeError("visitor must be a function");function d(c){if(c===null)return"";if(p.isDate(c))return c.toISOString();if(p.isBoolean(c))return c.toString();if(!h&&p.isBlob(c))throw new D("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(c)||p.isTypedArray(c)?h&&typeof Blob=="function"?new Blob([c]):Buffer.from(c):c}function u(c,j,m){let _=c;if(c&&!m&&typeof c=="object"){if(p.endsWith(j,"{}"))j=s?j:j.slice(0,-2),c=JSON.stringify(c);else if(p.isArray(c)&&Vr(c)||(p.isFileList(c)||p.endsWith(j,"[]"))&&(_=p.toArray(c)))return j=St(j),_.forEach(function(z,T){!(p.isUndefined(z)||z===null)&&e.append(o===!0?jt([j],T,i):o===null?j:j+"[]",d(z))}),!1}return Ve(c)?!0:(e.append(jt(m,j,i),d(c)),!1)}const b=[],y=Object.assign(Yr,{defaultVisitor:u,convertValue:d,isVisitable:Ve});function S(c,j){if(!p.isUndefined(c)){if(b.indexOf(c)!==-1)throw Error("Circular reference detected in "+j.join("."));b.push(c),p.forEach(c,function(_,P){(!(p.isUndefined(_)||_===null)&&a.call(e,_,p.isString(P)?P.trim():P,j,y))===!0&&S(_,j?j.concat(P):[P])}),b.pop()}}if(!p.isObject(t))throw new TypeError("data must be an object");return S(t),e}function vt(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function Ye(t,e){this._pairs=[],t&&$e(t,this,e)}const Et=Ye.prototype;Et.append=function(e,r){this._pairs.push([e,r])},Et.toString=function(e){const r=e?function(s){return e.call(this,s,vt)}:vt;return this._pairs.map(function(a){return r(a[0])+"="+r(a[1])},"").join("&")};function Kr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function kt(t,e,r){if(!e)return t;const s=r&&r.encode||Kr;p.isFunction(r)&&(r={serialize:r});const a=r&&r.serialize;let i;if(a?i=a(e,r):i=p.isURLSearchParams(e)?e.toString():new Ye(e,r).toString(s),i){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class Ct{constructor(){this.handlers=[]}use(e,r,s){return this.handlers.push({fulfilled:e,rejected:r,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){p.forEach(this.handlers,function(s){s!==null&&e(s)})}}const Tt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Jr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ye,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Ke=typeof window<"u"&&typeof document<"u",Je=typeof navigator=="object"&&navigator||void 0,Gr=Ke&&(!Je||["ReactNative","NativeScript","NS"].indexOf(Je.product)<0),Xr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Zr=Ke&&window.location.href||"http://localhost",ee={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ke,hasStandardBrowserEnv:Gr,hasStandardBrowserWebWorkerEnv:Xr,navigator:Je,origin:Zr},Symbol.toStringTag,{value:"Module"})),...Jr};function Qr(t,e){return $e(t,new ee.classes.URLSearchParams,{visitor:function(r,s,a,i){return ee.isNode&&p.isBuffer(r)?(this.append(s,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function en(t){return p.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function tn(t){const e={},r=Object.keys(t);let s;const a=r.length;let i;for(s=0;s<a;s++)i=r[s],e[i]=t[i];return e}function It(t){function e(r,s,a,i){let o=r[i++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),h=i>=r.length;return o=!o&&p.isArray(a)?a.length:o,h?(p.hasOwnProp(a,o)?a[o]=[a[o],s]:a[o]=s,!l):((!a[o]||!p.isObject(a[o]))&&(a[o]=[]),e(r,s,a[o],i)&&p.isArray(a[o])&&(a[o]=tn(a[o])),!l)}if(p.isFormData(t)&&p.isFunction(t.entries)){const r={};return p.forEachEntry(t,(s,a)=>{e(en(s),a,r,0)}),r}return null}function rn(t,e,r){if(p.isString(t))try{return(e||JSON.parse)(t),p.trim(t)}catch(s){if(s.name!=="SyntaxError")throw s}return(r||JSON.stringify)(t)}const ke={transitional:Tt,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const s=r.getContentType()||"",a=s.indexOf("application/json")>-1,i=p.isObject(e);if(i&&p.isHTMLForm(e)&&(e=new FormData(e)),p.isFormData(e))return a?JSON.stringify(It(e)):e;if(p.isArrayBuffer(e)||p.isBuffer(e)||p.isStream(e)||p.isFile(e)||p.isBlob(e)||p.isReadableStream(e))return e;if(p.isArrayBufferView(e))return e.buffer;if(p.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(i){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Qr(e,this.formSerializer).toString();if((l=p.isFileList(e))||s.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return $e(l?{"files[]":e}:e,h&&new h,this.formSerializer)}}return i||a?(r.setContentType("application/json",!1),rn(e)):e}],transformResponse:[function(e){const r=this.transitional||ke.transitional,s=r&&r.forcedJSONParsing,a=this.responseType==="json";if(p.isResponse(e)||p.isReadableStream(e))return e;if(e&&p.isString(e)&&(s&&!this.responseType||a)){const o=!(r&&r.silentJSONParsing)&&a;try{return JSON.parse(e,this.parseReviver)}catch(l){if(o)throw l.name==="SyntaxError"?D.from(l,D.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ee.classes.FormData,Blob:ee.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(["delete","get","head","post","put","patch"],t=>{ke.headers[t]={}});const nn=p.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),sn=t=>{const e={};let r,s,a;return t&&t.split(`
|
|
2
|
+
`).forEach(function(o){a=o.indexOf(":"),r=o.substring(0,a).trim().toLowerCase(),s=o.substring(a+1).trim(),!(!r||e[r]&&nn[r])&&(r==="set-cookie"?e[r]?e[r].push(s):e[r]=[s]:e[r]=e[r]?e[r]+", "+s:s)}),e},Pt=Symbol("internals");function Ce(t){return t&&String(t).trim().toLowerCase()}function Ne(t){return t===!1||t==null?t:p.isArray(t)?t.map(Ne):String(t)}function an(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=r.exec(t);)e[s[1]]=s[2];return e}const on=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Ge(t,e,r,s,a){if(p.isFunction(s))return s.call(this,e,r);if(a&&(e=r),!!p.isString(e)){if(p.isString(s))return e.indexOf(s)!==-1;if(p.isRegExp(s))return s.test(e)}}function ln(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,s)=>r.toUpperCase()+s)}function dn(t,e){const r=p.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(t,s+r,{value:function(a,i,o){return this[s].call(this,e,a,i,o)},configurable:!0})})}let ne=class{constructor(e){e&&this.set(e)}set(e,r,s){const a=this;function i(l,h,d){const u=Ce(h);if(!u)throw new Error("header name must be a non-empty string");const b=p.findKey(a,u);(!b||a[b]===void 0||d===!0||d===void 0&&a[b]!==!1)&&(a[b||h]=Ne(l))}const o=(l,h)=>p.forEach(l,(d,u)=>i(d,u,h));if(p.isPlainObject(e)||e instanceof this.constructor)o(e,r);else if(p.isString(e)&&(e=e.trim())&&!on(e))o(sn(e),r);else if(p.isObject(e)&&p.isIterable(e)){let l={},h,d;for(const u of e){if(!p.isArray(u))throw TypeError("Object iterator must return a key-value pair");l[d=u[0]]=(h=l[d])?p.isArray(h)?[...h,u[1]]:[h,u[1]]:u[1]}o(l,r)}else e!=null&&i(r,e,s);return this}get(e,r){if(e=Ce(e),e){const s=p.findKey(this,e);if(s){const a=this[s];if(!r)return a;if(r===!0)return an(a);if(p.isFunction(r))return r.call(this,a,s);if(p.isRegExp(r))return r.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Ce(e),e){const s=p.findKey(this,e);return!!(s&&this[s]!==void 0&&(!r||Ge(this,this[s],s,r)))}return!1}delete(e,r){const s=this;let a=!1;function i(o){if(o=Ce(o),o){const l=p.findKey(s,o);l&&(!r||Ge(s,s[l],l,r))&&(delete s[l],a=!0)}}return p.isArray(e)?e.forEach(i):i(e),a}clear(e){const r=Object.keys(this);let s=r.length,a=!1;for(;s--;){const i=r[s];(!e||Ge(this,this[i],i,e,!0))&&(delete this[i],a=!0)}return a}normalize(e){const r=this,s={};return p.forEach(this,(a,i)=>{const o=p.findKey(s,i);if(o){r[o]=Ne(a),delete r[i];return}const l=e?ln(i):String(i).trim();l!==i&&delete r[i],r[l]=Ne(a),s[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return p.forEach(this,(s,a)=>{s!=null&&s!==!1&&(r[a]=e&&p.isArray(s)?s.join(", "):s)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const s=new this(e);return r.forEach(a=>s.set(a)),s}static accessor(e){const s=(this[Pt]=this[Pt]={accessors:{}}).accessors,a=this.prototype;function i(o){const l=Ce(o);s[l]||(dn(a,o),s[l]=!0)}return p.isArray(e)?e.forEach(i):i(e),this}};ne.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),p.reduceDescriptors(ne.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(s){this[r]=s}}}),p.freezeMethods(ne);function Xe(t,e){const r=this||ke,s=e||r,a=ne.from(s.headers);let i=s.data;return p.forEach(t,function(l){i=l.call(r,i,a.normalize(),e?e.status:void 0)}),a.normalize(),i}function Ot(t){return!!(t&&t.__CANCEL__)}function be(t,e,r){D.call(this,t??"canceled",D.ERR_CANCELED,e,r),this.name="CanceledError"}p.inherits(be,D,{__CANCEL__:!0});function Rt(t,e,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?t(r):e(new D("Request failed with status code "+r.status,[D.ERR_BAD_REQUEST,D.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function cn(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function un(t,e){t=t||10;const r=new Array(t),s=new Array(t);let a=0,i=0,o;return e=e!==void 0?e:1e3,function(h){const d=Date.now(),u=s[i];o||(o=d),r[a]=h,s[a]=d;let b=i,y=0;for(;b!==a;)y+=r[b++],b=b%t;if(a=(a+1)%t,a===i&&(i=(i+1)%t),d-o<e)return;const S=u&&d-u;return S?Math.round(y*1e3/S):void 0}}function pn(t,e){let r=0,s=1e3/e,a,i;const o=(d,u=Date.now())=>{r=u,a=null,i&&(clearTimeout(i),i=null),t(...d)};return[(...d)=>{const u=Date.now(),b=u-r;b>=s?o(d,u):(a=d,i||(i=setTimeout(()=>{i=null,o(a)},s-b)))},()=>a&&o(a)]}const Ue=(t,e,r=3)=>{let s=0;const a=un(50,250);return pn(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,h=o-s,d=a(h),u=o<=l;s=o;const b={loaded:o,total:l,progress:l?o/l:void 0,bytes:h,rate:d||void 0,estimated:d&&l&&u?(l-o)/d:void 0,event:i,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(b)},r)},At=(t,e)=>{const r=t!=null;return[s=>e[0]({lengthComputable:r,total:t,loaded:s}),e[1]]},zt=t=>(...e)=>p.asap(()=>t(...e)),fn=ee.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,ee.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(ee.origin),ee.navigator&&/(msie|trident)/i.test(ee.navigator.userAgent)):()=>!0,xn=ee.hasStandardBrowserEnv?{write(t,e,r,s,a,i){const o=[t+"="+encodeURIComponent(e)];p.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),p.isString(s)&&o.push("path="+s),p.isString(a)&&o.push("domain="+a),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function hn(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function gn(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function _t(t,e,r){let s=!hn(e);return t&&(s||r==!1)?gn(t,e):e}const $t=t=>t instanceof ne?{...t}:t;function fe(t,e){e=e||{};const r={};function s(d,u,b,y){return p.isPlainObject(d)&&p.isPlainObject(u)?p.merge.call({caseless:y},d,u):p.isPlainObject(u)?p.merge({},u):p.isArray(u)?u.slice():u}function a(d,u,b,y){if(p.isUndefined(u)){if(!p.isUndefined(d))return s(void 0,d,b,y)}else return s(d,u,b,y)}function i(d,u){if(!p.isUndefined(u))return s(void 0,u)}function o(d,u){if(p.isUndefined(u)){if(!p.isUndefined(d))return s(void 0,d)}else return s(void 0,u)}function l(d,u,b){if(b in e)return s(d,u);if(b in t)return s(void 0,d)}const h={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:(d,u,b)=>a($t(d),$t(u),b,!0)};return p.forEach(Object.keys({...t,...e}),function(u){const b=h[u]||a,y=b(t[u],e[u],u);p.isUndefined(y)&&b!==l||(r[u]=y)}),r}const Nt=t=>{const e=fe({},t);let{data:r,withXSRFToken:s,xsrfHeaderName:a,xsrfCookieName:i,headers:o,auth:l}=e;if(e.headers=o=ne.from(o),e.url=kt(_t(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),p.isFormData(r)){if(ee.hasStandardBrowserEnv||ee.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(p.isFunction(r.getHeaders)){const h=r.getHeaders(),d=["content-type","content-length"];Object.entries(h).forEach(([u,b])=>{d.includes(u.toLowerCase())&&o.set(u,b)})}}if(ee.hasStandardBrowserEnv&&(s&&p.isFunction(s)&&(s=s(e)),s||s!==!1&&fn(e.url))){const h=a&&i&&xn.read(i);h&&o.set(a,h)}return e},mn=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,s){const a=Nt(t);let i=a.data;const o=ne.from(a.headers).normalize();let{responseType:l,onUploadProgress:h,onDownloadProgress:d}=a,u,b,y,S,c;function j(){S&&S(),c&&c(),a.cancelToken&&a.cancelToken.unsubscribe(u),a.signal&&a.signal.removeEventListener("abort",u)}let m=new XMLHttpRequest;m.open(a.method.toUpperCase(),a.url,!0),m.timeout=a.timeout;function _(){if(!m)return;const z=ne.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),q={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:z,config:t,request:m};Rt(function(O){r(O),j()},function(O){s(O),j()},q),m=null}"onloadend"in m?m.onloadend=_:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(_)},m.onabort=function(){m&&(s(new D("Request aborted",D.ECONNABORTED,t,m)),m=null)},m.onerror=function(T){const q=T&&T.message?T.message:"Network Error",g=new D(q,D.ERR_NETWORK,t,m);g.event=T||null,s(g),m=null},m.ontimeout=function(){let T=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const q=a.transitional||Tt;a.timeoutErrorMessage&&(T=a.timeoutErrorMessage),s(new D(T,q.clarifyTimeoutError?D.ETIMEDOUT:D.ECONNABORTED,t,m)),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&p.forEach(o.toJSON(),function(T,q){m.setRequestHeader(q,T)}),p.isUndefined(a.withCredentials)||(m.withCredentials=!!a.withCredentials),l&&l!=="json"&&(m.responseType=a.responseType),d&&([y,c]=Ue(d,!0),m.addEventListener("progress",y)),h&&m.upload&&([b,S]=Ue(h),m.upload.addEventListener("progress",b),m.upload.addEventListener("loadend",S)),(a.cancelToken||a.signal)&&(u=z=>{m&&(s(!z||z.type?new be(null,t,m):z),m.abort(),m=null)},a.cancelToken&&a.cancelToken.subscribe(u),a.signal&&(a.signal.aborted?u():a.signal.addEventListener("abort",u)));const P=cn(a.url);if(P&&ee.protocols.indexOf(P)===-1){s(new D("Unsupported protocol "+P+":",D.ERR_BAD_REQUEST,t));return}m.send(i||null)})},yn=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let s=new AbortController,a;const i=function(d){if(!a){a=!0,l();const u=d instanceof Error?d:this.reason;s.abort(u instanceof D?u:new be(u instanceof Error?u.message:u))}};let o=e&&setTimeout(()=>{o=null,i(new D(`timeout ${e} of ms exceeded`,D.ETIMEDOUT))},e);const l=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),t=null)};t.forEach(d=>d.addEventListener("abort",i));const{signal:h}=s;return h.unsubscribe=()=>p.asap(l),h}},bn=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let s=0,a;for(;s<r;)a=s+e,yield t.slice(s,a),s=a},wn=async function*(t,e){for await(const r of Sn(t))yield*bn(r,e)},Sn=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:s}=await e.read();if(r)break;yield s}}finally{await e.cancel()}},Ut=(t,e,r,s)=>{const a=wn(t,e);let i=0,o,l=h=>{o||(o=!0,s&&s(h))};return new ReadableStream({async pull(h){try{const{done:d,value:u}=await a.next();if(d){l(),h.close();return}let b=u.byteLength;if(r){let y=i+=b;r(y)}h.enqueue(new Uint8Array(u))}catch(d){throw l(d),d}},cancel(h){return l(h),a.return()}},{highWaterMark:2})},Dt=64*1024,{isFunction:De}=p,jn=(({Request:t,Response:e})=>({Request:t,Response:e}))(p.global),{ReadableStream:Lt,TextEncoder:Ft}=p.global,qt=(t,...e)=>{try{return!!t(...e)}catch{return!1}},vn=t=>{t=p.merge.call({skipUndefined:!0},jn,t);const{fetch:e,Request:r,Response:s}=t,a=e?De(e):typeof fetch=="function",i=De(r),o=De(s);if(!a)return!1;const l=a&&De(Lt),h=a&&(typeof Ft=="function"?(c=>j=>c.encode(j))(new Ft):async c=>new Uint8Array(await new r(c).arrayBuffer())),d=i&&l&&qt(()=>{let c=!1;const j=new r(ee.origin,{body:new Lt,method:"POST",get duplex(){return c=!0,"half"}}).headers.has("Content-Type");return c&&!j}),u=o&&l&&qt(()=>p.isReadableStream(new s("").body)),b={stream:u&&(c=>c.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(c=>{!b[c]&&(b[c]=(j,m)=>{let _=j&&j[c];if(_)return _.call(j);throw new D(`Response type '${c}' is not supported`,D.ERR_NOT_SUPPORT,m)})});const y=async c=>{if(c==null)return 0;if(p.isBlob(c))return c.size;if(p.isSpecCompliantForm(c))return(await new r(ee.origin,{method:"POST",body:c}).arrayBuffer()).byteLength;if(p.isArrayBufferView(c)||p.isArrayBuffer(c))return c.byteLength;if(p.isURLSearchParams(c)&&(c=c+""),p.isString(c))return(await h(c)).byteLength},S=async(c,j)=>{const m=p.toFiniteNumber(c.getContentLength());return m??y(j)};return async c=>{let{url:j,method:m,data:_,signal:P,cancelToken:z,timeout:T,onDownloadProgress:q,onUploadProgress:g,responseType:O,headers:v,withCredentials:U="same-origin",fetchOptions:B}=Nt(c),F=e||fetch;O=O?(O+"").toLowerCase():"text";let V=yn([P,z&&z.toAbortSignal()],T),Z=null;const I=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let J;try{if(g&&d&&m!=="get"&&m!=="head"&&(J=await S(v,_))!==0){let f=new r(j,{method:"POST",body:_,duplex:"half"}),E;if(p.isFormData(_)&&(E=f.headers.get("content-type"))&&v.setContentType(E),f.body){const[x,k]=At(J,Ue(zt(g)));_=Ut(f.body,Dt,x,k)}}p.isString(U)||(U=U?"include":"omit");const A=i&&"credentials"in r.prototype,R={...B,signal:V,method:m.toUpperCase(),headers:v.normalize().toJSON(),body:_,duplex:"half",credentials:A?U:void 0};Z=i&&new r(j,R);let K=await(i?F(Z,B):F(j,R));const te=u&&(O==="stream"||O==="response");if(u&&(q||te&&I)){const f={};["status","statusText","headers"].forEach($=>{f[$]=K[$]});const E=p.toFiniteNumber(K.headers.get("content-length")),[x,k]=q&&At(E,Ue(zt(q),!0))||[];K=new s(Ut(K.body,Dt,x,()=>{k&&k(),I&&I()}),f)}O=O||"text";let G=await b[p.findKey(b,O)||"text"](K,c);return!te&&I&&I(),await new Promise((f,E)=>{Rt(f,E,{data:G,headers:ne.from(K.headers),status:K.status,statusText:K.statusText,config:c,request:Z})})}catch(A){throw I&&I(),A&&A.name==="TypeError"&&/Load failed|fetch/i.test(A.message)?Object.assign(new D("Network Error",D.ERR_NETWORK,c,Z),{cause:A.cause||A}):D.from(A,A&&A.code,c,Z)}}},En=new Map,Mt=t=>{let e=t?t.env:{};const{fetch:r,Request:s,Response:a}=e,i=[s,a,r];let o=i.length,l=o,h,d,u=En;for(;l--;)h=i[l],d=u.get(h),d===void 0&&u.set(h,d=l?new Map:vn(e)),u=d;return d};Mt();const Ze={http:Hr,xhr:mn,fetch:{get:Mt}};p.forEach(Ze,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Bt=t=>`- ${t}`,kn=t=>p.isFunction(t)||t===null||t===!1,Wt={getAdapter:(t,e)=>{t=p.isArray(t)?t:[t];const{length:r}=t;let s,a;const i={};for(let o=0;o<r;o++){s=t[o];let l;if(a=s,!kn(s)&&(a=Ze[(l=String(s)).toLowerCase()],a===void 0))throw new D(`Unknown adapter '${l}'`);if(a&&(p.isFunction(a)||(a=a.get(e))))break;i[l||"#"+o]=a}if(!a){const o=Object.entries(i).map(([h,d])=>`adapter ${h} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=r?o.length>1?`since :
|
|
4
|
+
`+o.map(Bt).join(`
|
|
5
|
+
`):" "+Bt(o[0]):"as no adapter specified";throw new D("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return a},adapters:Ze};function Qe(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new be(null,t)}function Ht(t){return Qe(t),t.headers=ne.from(t.headers),t.data=Xe.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Wt.getAdapter(t.adapter||ke.adapter,t)(t).then(function(s){return Qe(t),s.data=Xe.call(t,t.transformResponse,s),s.headers=ne.from(s.headers),s},function(s){return Ot(s)||(Qe(t),s&&s.response&&(s.response.data=Xe.call(t,t.transformResponse,s.response),s.response.headers=ne.from(s.response.headers))),Promise.reject(s)})}const Vt="1.12.2",Le={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Le[t]=function(s){return typeof s===t||"a"+(e<1?"n ":" ")+t}});const Yt={};Le.transitional=function(e,r,s){function a(i,o){return"[Axios v"+Vt+"] Transitional option '"+i+"'"+o+(s?". "+s:"")}return(i,o,l)=>{if(e===!1)throw new D(a(o," has been removed"+(r?" in "+r:"")),D.ERR_DEPRECATED);return r&&!Yt[o]&&(Yt[o]=!0,console.warn(a(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(i,o,l):!0}},Le.spelling=function(e){return(r,s)=>(console.warn(`${s} is likely a misspelling of ${e}`),!0)};function Cn(t,e,r){if(typeof t!="object")throw new D("options must be an object",D.ERR_BAD_OPTION_VALUE);const s=Object.keys(t);let a=s.length;for(;a-- >0;){const i=s[a],o=e[i];if(o){const l=t[i],h=l===void 0||o(l,i,t);if(h!==!0)throw new D("option "+i+" must be "+h,D.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new D("Unknown option "+i,D.ERR_BAD_OPTION)}}const Fe={assertOptions:Cn,validators:Le},ie=Fe.validators;let xe=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ct,response:new Ct}}async request(e,r){try{return await this._request(e,r)}catch(s){if(s instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const 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(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=fe(this.defaults,r);const{transitional:s,paramsSerializer:a,headers:i}=r;s!==void 0&&Fe.assertOptions(s,{silentJSONParsing:ie.transitional(ie.boolean),forcedJSONParsing:ie.transitional(ie.boolean),clarifyTimeoutError:ie.transitional(ie.boolean)},!1),a!=null&&(p.isFunction(a)?r.paramsSerializer={serialize:a}:Fe.assertOptions(a,{encode:ie.function,serialize:ie.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Fe.assertOptions(r,{baseUrl:ie.spelling("baseURL"),withXsrfToken:ie.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&p.merge(i.common,i[r.method]);i&&p.forEach(["delete","get","head","post","put","patch","common"],c=>{delete i[c]}),r.headers=ne.concat(o,i);const l=[];let h=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(r)===!1||(h=h&&j.synchronous,l.unshift(j.fulfilled,j.rejected))});const d=[];this.interceptors.response.forEach(function(j){d.push(j.fulfilled,j.rejected)});let u,b=0,y;if(!h){const c=[Ht.bind(this),void 0];for(c.unshift(...l),c.push(...d),y=c.length,u=Promise.resolve(r);b<y;)u=u.then(c[b++],c[b++]);return u}y=l.length;let S=r;for(;b<y;){const c=l[b++],j=l[b++];try{S=c(S)}catch(m){j.call(this,m);break}}try{u=Ht.call(this,S)}catch(c){return Promise.reject(c)}for(b=0,y=d.length;b<y;)u=u.then(d[b++],d[b++]);return u}getUri(e){e=fe(this.defaults,e);const r=_t(e.baseURL,e.url,e.allowAbsoluteUrls);return kt(r,e.params,e.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(e){xe.prototype[e]=function(r,s){return this.request(fe(s||{},{method:e,url:r,data:(s||{}).data}))}}),p.forEach(["post","put","patch"],function(e){function r(s){return function(i,o,l){return this.request(fe(l||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}xe.prototype[e]=r(),xe.prototype[e+"Form"]=r(!0)});let Tn=class or{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const 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},e(function(i,o,l){s.reason||(s.reason=new be(i,o,l),r(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=s=>{e.abort(s)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new or(function(a){e=a}),cancel:e}}};function In(t){return function(r){return t.apply(null,r)}}function Pn(t){return p.isObject(t)&&t.isAxiosError===!0}const et={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(et).forEach(([t,e])=>{et[e]=t});function Kt(t){const e=new xe(t),r=ct(xe.prototype.request,e);return p.extend(r,xe.prototype,e,{allOwnKeys:!0}),p.extend(r,e,null,{allOwnKeys:!0}),r.create=function(a){return Kt(fe(t,a))},r}const M=Kt(ke);M.Axios=xe,M.CanceledError=be,M.CancelToken=Tn,M.isCancel=Ot,M.VERSION=Vt,M.toFormData=$e,M.AxiosError=D,M.Cancel=M.CanceledError,M.all=function(e){return Promise.all(e)},M.spread=In,M.isAxiosError=Pn,M.mergeConfig=fe,M.AxiosHeaders=ne,M.formToJSON=t=>It(p.isHTMLForm(t)?new FormData(t):t),M.getAdapter=Wt.getAdapter,M.HttpStatusCode=et,M.default=M;const{Axios:bs,AxiosError:ws,CanceledError:Ss,isCancel:js,CancelToken:vs,VERSION:Es,all:ks,Cancel:Cs,isAxiosError:Ts,spread:Is,toFormData:Ps,AxiosHeaders:Os,HttpStatusCode:Rs,formToJSON:As,getAdapter:zs,mergeConfig:_s}=M;class On{baseUrl;apiKey;appId;client;constructor(e){if(!e||!e.baseUrl)throw new Error("NeuctraAuthixClient: 'baseUrl' is required in config");this.baseUrl=e.baseUrl.replace(/\/$/,""),this.apiKey=e.apiKey||null,this.appId=e.appId||null,this.client=M.create({baseURL:this.baseUrl,headers:{"Content-Type":"application/json",...this.apiKey?{"x-api-key":this.apiKey}:{}},timeout:1e4})}async request(e,r,s,a={}){if(!e)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:e,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(e){const{name:r,email:s,password:a}=e;if(!r||!s||!a)throw new Error("signup: 'name', 'email', and 'password' are required");return this.request("POST","/users/signup",e)}async login(e){const{email:r,password:s,appId:a}=e;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(e){const{userId:r,appId:s}=e;if(!r)throw new Error("updateUser: 'userId' is required");return this.request("PUT",`/users/update/${r}`,{...e,appId:s||this.appId})}async changePassword(e){const{userId:r,currentPassword:s,newPassword:a,appId:i}=e;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(e){const{userId:r,appId:s}=e;if(!r)throw new Error("deleteUser: 'userId' is required");return this.request("DELETE",`/users/delete/${r}`,{appId:s||this.appId})}async getProfile(e){const{token:r}=e;if(!r)throw new Error("getProfile: 'token' is required");return this.request("GET","/users/profile",{},{Authorization:`Bearer ${r}`})}async sendVerifyOTP(e){const{token:r,appId:s}=e;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(e){const{token:r,otp:s,appId:a}=e;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(e){const{email:r,appId:s}=e;if(!r)throw new Error("forgotPassword: 'email' is required");return this.request("POST","/users/forgot-password",{email:r,appId:s||this.appId})}async resetPassword(e){const{email:r,otp:s,newPassword:a,appId:i}=e;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 checkUser(e){if(!e)throw new Error("checkUser: 'userId' is required");if(!this.appId)throw new Error("checkUser: SDK 'appId' is missing in config");return this.request("GET",`/users/check-user/${e}?appId=${this.appId}`)}async searchAllUsersData(e){if(!this.appId)throw new Error("searchAllUsersData: appId missing");const r=new URLSearchParams(e).toString();return this.request("GET",`/users/${this.appId}/data/search?${r}`)}async searchUserData(e){const{userId:r,...s}=e;if(!r)throw new Error("userId required");const a=new URLSearchParams(s).toString();return this.request("GET",`/users/${r}/data/search?${a}`)}async searchUserDataByKeys(e){const{userId:r,...s}=e;if(!r)throw new Error("searchUserDataByKeys: 'userId' is required");const a=new URLSearchParams(Object.entries(s).reduce((i,[o,l])=>(l!=null&&(i[o]=String(l)),i),{})).toString();return this.request("GET",`/users/${r}/data/searchbyref?${a}`)}async searchAllUsersDataByKeys(e){const r=this.appId;if(!r)throw new Error("searchAllUsersDataByKeys: 'appId' is required on SDK initialization");const s=new URLSearchParams(Object.entries(e).reduce((a,[i,o])=>(o!=null&&(a[i]=String(o)),a),{})).toString();return this.request("GET",`/users/${encodeURIComponent(r)}/data/searchbyref/all?${s}`)}async getAllUsersData(){if(!this.appId)throw new Error("getAllUsersData: SDK 'appId' is missing in config");return this.request("GET",`/users/all-data/${this.appId}/data`)}async getUserData(e){const{userId:r}=e;if(!r)throw new Error("getUserData: 'userId' is required");return this.request("GET",`/users/${r}/data`)}async getSingleUserData(e){const{userId:r,dataId:s}=e;if(!r||!s)throw new Error("getSingleUserData: 'userId' and 'dataId' are required");return this.request("GET",`/users/${r}/data/${s}`)}async addUserData(e){const{userId:r,dataCategory:s,data:a}=e;if(!r)throw new Error("addUserData: 'userId' is required");if(!s)throw new Error("addUserData: 'dataCategory' is required");if(!a)throw new Error("addUserData: 'data' is required");return this.request("POST",`/users/${r}/data`,{dataCategory:s,...a})}async updateUserData(e){const{userId:r,dataId:s,data:a}=e;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(e){const{userId:r,dataId:s}=e;if(!r||!s)throw new Error("deleteUserData: 'userId' and 'dataId' are required");return this.request("DELETE",`/users/${r}/data/${s}`)}async getAppData(e){const r=this.appId;if(!r)throw new Error("getAppData: 'appId' is required");const s=e?`?category=${encodeURIComponent(e)}`:"";return(await this.request("GET",`/app/${r}/data${s}`))?.data||[]}async getSingleAppData(e){const r=this.appId;if(!r)throw new Error("getSingleAppData: 'appId' is required");if(!e.dataId)throw new Error("getSingleAppData: 'dataId' is required");return(await this.request("GET",`/app/${r}/data/${e.dataId}`))?.data}async searchAppDataByKeys(e){const r=this.appId;if(!r)throw new Error("searchAppDataByKeys: 'appId' is required");const s=new URLSearchParams(Object.entries(e).reduce((i,[o,l])=>(l!=null&&(i[o]=String(l)),i),{})).toString();return(await this.request("GET",`/app/${r}/data/searchByKeys${s?`?${s}`:""}`))?.data||[]}async addAppData(e){const r=this.appId;if(!r)throw new Error("addAppData: 'appId' is required");const{dataCategory:s,data:a}=e;if(!s)throw new Error("addAppData: 'dataCategory' is required");if(!a||typeof a!="object")throw new Error("addAppData: 'data' is required");return(await this.request("POST",`/app/${r}/data/${encodeURIComponent(s)}`,{item:a}))?.data}async updateAppData(e){const r=this.appId;if(!r)throw new Error("updateAppData: 'appId' is required");if(!e.dataId)throw new Error("updateAppData: 'dataId' is required");if(!e.data)throw new Error("updateAppData: 'data' is required");return(await this.request("PATCH",`/app/${r}/data/${e.dataId}`,e.data))?.data}async deleteAppData(e){const r=this.appId;if(!r)throw new Error("deleteAppData: 'appId' is required");if(!e.dataId)throw new Error("deleteAppData: 'dataId' is required");return(await this.request("DELETE",`/app/${r}/data/${e.dataId}`))?.data}}var qe={exports:{}},Te={};/**
|
|
7
7
|
* @license React
|
|
8
8
|
* react-jsx-runtime.production.js
|
|
9
9
|
*
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* This source code is licensed under the MIT license found in the
|
|
13
13
|
* LICENSE file in the root directory of this source tree.
|
|
14
|
-
*/var Jt;function Rn(){if(Jt)return Te;Jt=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(s,
|
|
14
|
+
*/var Jt;function Rn(){if(Jt)return Te;Jt=1;var t=Symbol.for("react.transitional.element"),e=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:t,type:s,key:o,ref:a!==void 0?a:null,props:i}}return Te.Fragment=e,Te.jsx=r,Te.jsxs=r,Te}var Ie={};/**
|
|
15
15
|
* @license React
|
|
16
16
|
* react-jsx-runtime.development.js
|
|
17
17
|
*
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
*
|
|
20
20
|
* This source code is licensed under the MIT license found in the
|
|
21
21
|
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/var Gt;function An(){return Gt||(Gt=1,process.env.NODE_ENV!=="production"&&(function(){function t(f){if(f==null)return null;if(typeof f=="function")return f.$$typeof===F?null:f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case m:return"Fragment";case P:return"Profiler";case _:return"StrictMode";case g:return"Suspense";case O:return"SuspenseList";case B:return"Activity"}if(typeof f=="object")switch(typeof f.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),f.$$typeof){case j:return"Portal";case T:return f.displayName||"Context";case z:return(f._context.displayName||"Context")+".Consumer";case q:var E=f.render;return f=f.displayName,f||(f=E.displayName||E.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case v:return E=f.displayName||null,E!==null?E:t(f.type)||"Memo";case U:E=f._payload,f=f._init;try{return t(f(E))}catch{}}return null}function e(f){return""+f}function r(f){try{e(f);var E=!1}catch{E=!0}if(E){E=console;var x=E.error,k=typeof Symbol=="function"&&Symbol.toStringTag&&f[Symbol.toStringTag]||f.constructor.name||"Object";return x.call(E,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",k),e(f)}}function s(f){if(f===m)return"<>";if(typeof f=="object"&&f!==null&&f.$$typeof===U)return"<...>";try{var E=t(f);return E?"<"+E+">":"<...>"}catch{return"<...>"}}function
|
|
22
|
+
*/var Gt;function An(){return Gt||(Gt=1,process.env.NODE_ENV!=="production"&&(function(){function t(f){if(f==null)return null;if(typeof f=="function")return f.$$typeof===F?null:f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case m:return"Fragment";case P:return"Profiler";case _:return"StrictMode";case g:return"Suspense";case O:return"SuspenseList";case B:return"Activity"}if(typeof f=="object")switch(typeof f.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),f.$$typeof){case j:return"Portal";case T:return f.displayName||"Context";case z:return(f._context.displayName||"Context")+".Consumer";case q:var E=f.render;return f=f.displayName,f||(f=E.displayName||E.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case v:return E=f.displayName||null,E!==null?E:t(f.type)||"Memo";case U:E=f._payload,f=f._init;try{return t(f(E))}catch{}}return null}function e(f){return""+f}function r(f){try{e(f);var E=!1}catch{E=!0}if(E){E=console;var x=E.error,k=typeof Symbol=="function"&&Symbol.toStringTag&&f[Symbol.toStringTag]||f.constructor.name||"Object";return x.call(E,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",k),e(f)}}function s(f){if(f===m)return"<>";if(typeof f=="object"&&f!==null&&f.$$typeof===U)return"<...>";try{var E=t(f);return E?"<"+E+">":"<...>"}catch{return"<...>"}}function a(){var f=V.A;return f===null?null:f.getOwner()}function i(){return Error("react-stack-top-frame")}function o(f){if(Z.call(f,"key")){var E=Object.getOwnPropertyDescriptor(f,"key").get;if(E&&E.isReactWarning)return!1}return f.key!==void 0}function l(f,E){function x(){A||(A=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",E))}x.isReactWarning=!0,Object.defineProperty(f,"key",{get:x,configurable:!0})}function h(){var f=t(this.type);return R[f]||(R[f]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),f=this.props.ref,f!==void 0?f:null}function d(f,E,x,k,$,N){var Y=x.ref;return f={$$typeof:c,type:f,key:E,props:x,_owner:k},(Y!==void 0?Y:null)!==null?Object.defineProperty(f,"ref",{enumerable:!1,get:h}):Object.defineProperty(f,"ref",{enumerable:!1,value:null}),f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(f,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(f,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:$}),Object.defineProperty(f,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:N}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f}function u(f,E,x,k,$,N){var Y=E.children;if(Y!==void 0)if(k)if(I(Y)){for(k=0;k<Y.length;k++)b(Y[k]);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 b(Y);if(Z.call(E,"key")){Y=t(f);var oe=Object.keys(E).filter(function(Oe){return Oe!=="key"});k=0<oe.length?"{key: someKey, "+oe.join(": ..., ")+": ...}":"{key: someKey}",G[Y+k]||(oe=0<oe.length?"{"+oe.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
23
23
|
let props = %s;
|
|
24
24
|
<%s {...props} />
|
|
25
25
|
React keys must be passed directly to JSX without using spread:
|
|
26
26
|
let props = %s;
|
|
27
|
-
<%s key={someKey} {...props} />`,k,Y,
|
|
27
|
+
<%s key={someKey} {...props} />`,k,Y,oe,Y),G[Y+k]=!0)}if(Y=null,x!==void 0&&(r(x),Y=""+x),o(E)&&(r(E.key),Y=""+E.key),"key"in E){x={};for(var he in E)he!=="key"&&(x[he]=E[he])}else x=E;return Y&&l(x,typeof f=="function"?f.displayName||f.name||"Unknown":f),d(f,Y,x,a(),$,N)}function b(f){y(f)?f._store&&(f._store.validated=1):typeof f=="object"&&f!==null&&f.$$typeof===U&&(f._payload.status==="fulfilled"?y(f._payload.value)&&f._payload.value._store&&(f._payload.value._store.validated=1):f._store&&(f._store.validated=1))}function y(f){return typeof f=="object"&&f!==null&&f.$$typeof===c}var S=w,c=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),T=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),F=Symbol.for("react.client.reference"),V=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,I=Array.isArray,J=console.createTask?console.createTask:function(){return null};S={react_stack_bottom_frame:function(f){return f()}};var A,R={},K=S.react_stack_bottom_frame.bind(S,i)(),te=J(s(i)),G={};Ie.Fragment=m,Ie.jsx=function(f,E,x){var k=1e4>V.recentlyCreatedOwnerStacks++;return u(f,E,x,!1,k?Error("react-stack-top-frame"):K,k?J(s(f)):te)},Ie.jsxs=function(f,E,x){var k=1e4>V.recentlyCreatedOwnerStacks++;return u(f,E,x,!0,k?Error("react-stack-top-frame"):K,k?J(s(f)):te)}})()),Ie}var Xt;function zn(){return Xt||(Xt=1,process.env.NODE_ENV==="production"?qe.exports=Rn():qe.exports=An()),qe.exports}var n=zn();const _n=async(t,e)=>{const{name:r,email:s,password:a,appId:i,phone:o,address:l,avatarUrl:h,isActive:d=!0,role:u="user"}=t,{baseUrl:b,apiKey:y}=e;if(!y)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 S=await M.post(`${b}/users/signup`,{name:r,email:s,password:a,appId:i,phone:o,address:l,avatarUrl:h,isActive:d,role:u},{headers:{"Content-Type":"application/json","x-api-key":y}});return S.data?.user&&localStorage.setItem("userInfo",JSON.stringify(S.data.user)),S.data.user}catch(S){const c=S.response?.data?.message||S.message||"Signup failed";if(console.error("Signup API Error:",c),S.response?.status===400){if(c.includes("already exists"))throw{success:!1,message:"User with this email already exists for this app",status:400};if(c.includes("inactive"))throw{success:!1,message:"Cannot signup under an inactive app",status:400}}throw S.response?.status===404?{success:!1,message:"Invalid or inactive app",status:404}:{success:!1,message:c,status:S.response?.status||500}}};/**
|
|
28
28
|
* @license lucide-react v0.544.0 - ISC
|
|
29
29
|
*
|
|
30
30
|
* This source code is licensed under the ISC license.
|
|
@@ -39,12 +39,12 @@ React keys must be passed directly to JSX without using spread:
|
|
|
39
39
|
*
|
|
40
40
|
* This source code is licensed under the ISC license.
|
|
41
41
|
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/const Ln=w.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:
|
|
42
|
+
*/const Ln=w.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:a="",children:i,iconNode:o,...l},h)=>w.createElement("svg",{ref:h,...Dn,width:e,height:e,stroke:t,strokeWidth:s?Number(r)*24/Number(e):r,className:Qt("lucide",a),...!i&&!Un(l)&&{"aria-hidden":"true"},...l},[...o.map(([d,u])=>w.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
|
|
43
43
|
* @license lucide-react v0.544.0 - ISC
|
|
44
44
|
*
|
|
45
45
|
* This source code is licensed under the ISC license.
|
|
46
46
|
* See the LICENSE file in the root directory of this source tree.
|
|
47
|
-
*/const W=(t,e)=>{const r=w.forwardRef(({className:s,...
|
|
47
|
+
*/const W=(t,e)=>{const r=w.forwardRef(({className:s,...a},i)=>w.createElement(Ln,{ref:i,iconNode:e,className:Qt(`lucide-${$n(Zt(t))}`,`lucide-${t}`,s),...a}));return r.displayName=Zt(t),r};/**
|
|
48
48
|
* @license lucide-react v0.544.0 - ISC
|
|
49
49
|
*
|
|
50
50
|
* This source code is licensed under the ISC license.
|
|
@@ -109,7 +109,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
109
109
|
*
|
|
110
110
|
* This source code is licensed under the ISC license.
|
|
111
111
|
* See the LICENSE file in the root directory of this source tree.
|
|
112
|
-
*/const
|
|
112
|
+
*/const at=W("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
|
|
113
113
|
* @license lucide-react v0.544.0 - ISC
|
|
114
114
|
*
|
|
115
115
|
* This source code is licensed under the ISC license.
|
|
@@ -119,7 +119,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
119
119
|
*
|
|
120
120
|
* This source code is licensed under the ISC license.
|
|
121
121
|
* See the LICENSE file in the root directory of this source tree.
|
|
122
|
-
*/const
|
|
122
|
+
*/const ae=W("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
123
123
|
* @license lucide-react v0.544.0 - ISC
|
|
124
124
|
*
|
|
125
125
|
* This source code is licensed under the ISC license.
|
|
@@ -134,7 +134,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
134
134
|
*
|
|
135
135
|
* This source code is licensed under the ISC license.
|
|
136
136
|
* See the LICENSE file in the root directory of this source tree.
|
|
137
|
-
*/const
|
|
137
|
+
*/const ot=W("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);/**
|
|
138
138
|
* @license lucide-react v0.544.0 - ISC
|
|
139
139
|
*
|
|
140
140
|
* This source code is licensed under the ISC license.
|
|
@@ -199,12 +199,12 @@ React keys must be passed directly to JSX without using spread:
|
|
|
199
199
|
*
|
|
200
200
|
* This source code is licensed under the ISC license.
|
|
201
201
|
* See the LICENSE file in the root directory of this source tree.
|
|
202
|
-
*/const Pe=W("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Be={baseUrl:"",apiKey:"",appId:""},Zn=t=>{if(!t.baseUrl||!t.apiKey||!t.appId)throw new Error("baseUrl, apiKey, and appId are required");Be.baseUrl=t.baseUrl,Be.apiKey=t.apiKey,Be.appId=t.appId},ue=()=>Be,Qn=({logoUrl:t,logoLinkUrl:e,title:r="Create Your Account",subtitle:s="Join our platform today",footerText:
|
|
202
|
+
*/const Pe=W("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Be={baseUrl:"",apiKey:"",appId:""},Zn=t=>{if(!t.baseUrl||!t.apiKey||!t.appId)throw new Error("baseUrl, apiKey, and appId are required");Be.baseUrl=t.baseUrl,Be.apiKey=t.apiKey,Be.appId=t.appId},ue=()=>Be,Qn=({logoUrl:t,logoLinkUrl:e,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:h=!1,roles:d=[],showRoleSelector:u=!1,loginUrl:b,onSuccess:y,onError:S})=>{const{baseUrl:c,apiKey:j,appId:m}=ue(),_={name:"",email:"",password:"",role:d.length?d[0]:"user",...h&&{avatarUrl:""}},[P,z]=w.useState(_),[T,q]=w.useState(!1),[g,O]=w.useState(!1),[v,U]=w.useState(null),[B,F]=w.useState({}),[V,Z]=w.useState(!1),I=l?"#ffffff":"#111827",J=l?"#a1a1aa":"#6b7280",A=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",R=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)";w.useEffect(()=>{if(typeof window<"u"){const E=()=>Z(window.innerWidth<768);return E(),window.addEventListener("resize",E),()=>window.removeEventListener("resize",E)}},[]);const K=E=>{const{name:x,value:k}=E.target;z($=>({...$,[x]:k})),B[x]&&F($=>({...$,[x]:void 0}))},te=()=>{const E={};return P.name.trim()||(E.name="Name is required"),P.email.trim()?/\S+@\S+\.\S+/.test(P.email)||(E.email="Invalid email address"):E.email="Email is required",P.password?P.password.length<6&&(E.password="Password must be at least 6 characters"):E.password="Password is required",F(E),Object.keys(E).length===0},G=async E=>{if(E.preventDefault(),!!te()){O(!0),U(null);try{const x={...P,appId:m},k=await _n(x,{baseUrl:c,apiKey:j});U({type:"success",text:"Account created successfully!"}),y&&y(k)}catch(x){const k=x.message||"Signup failed. Please try again.";U({type:"error",text:k}),S&&S(x)}finally{O(!1)}}},f={width:"100%",padding:V?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:A,border:`1px solid ${R}`,borderRadius:"10px",color:I,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:V?"320px":"380px",width:"100%",maxWidth:V?"340px":"390px",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:V?"30px 24px":"20px 28px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[t?n.jsx("a",{href:e||"/",target:"_self",rel:"noopener noreferrer",children:n.jsx("img",{src:t,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):n.jsx(Se,{size:40,color:i,style:{marginBottom:"10px"}}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:I,margin:0},children:r}),n.jsx("p",{style:{fontSize:"14px",color:J},children:s})]}),h&&P.avatarUrl&&n.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"16px"},children:n.jsx("img",{src:P.avatarUrl,alt:"Avatar Preview",style:{width:"60px",height:"60px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${i}30`},onError:E=>{const x=E.target;x.style.display="none"}})}),n.jsxs("form",{onSubmit:G,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[u&&d&&d.length===2&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{style:{fontSize:"14px",fontWeight:500,color:I},children:"Select Role"}),n.jsxs("div",{style:{position:"relative",display:"flex",borderRadius:"10px",border:`1px solid ${R}`,backgroundColor:A,overflow:"hidden",cursor:"pointer",height:"42px"},children:[n.jsx("div",{style:{position:"absolute",top:0,left:0,width:"50%",height:"100%",backgroundColor:l?"#000000":"#ffffff",boxShadow:l?"0 1px 3px rgba(255,255,255,0.05)":"0 1px 3px rgba(0,0,0,0.1)",borderRadius:"10px",transition:"transform 0.3s ease, background-color 0.3s ease",transform:P.role===d[1]?"translateX(100%)":"translateX(0)",zIndex:0}}),n.jsx("button",{type:"button",onClick:()=>z(E=>({...E,role:d[0]})),style:{flex:1,zIndex:10,border:"none",background:"transparent",color:P.role===d[0]?i:l?"#9ca3af":"#6b7280",fontWeight:P.role===d[0]?600:500,fontSize:"14px",display:"flex",alignItems:"center",justifyContent:"center",transition:"color 0.2s ease"},children:d[0].charAt(0).toUpperCase()+d[0].slice(1)}),n.jsx("button",{type:"button",onClick:()=>z(E=>({...E,role:d[1]})),style:{flex:1,zIndex:10,border:"none",background:"transparent",color:P.role===d[1]?i:l?"#9ca3af":"#6b7280",fontWeight:P.role===d[1]?600:500,fontSize:"14px",display:"flex",alignItems:"center",justifyContent:"center",transition:"color 0.2s ease"},children:d[1].charAt(0).toUpperCase()+d[1].slice(1)})]})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-name",style:{fontSize:"14px",fontWeight:500,color:I},children:"Full Name"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:J}}),n.jsx("input",{id:"signup-name",type:"text",name:"name",placeholder:"Enter your full name",value:P.name,onChange:K,style:{...f,borderColor:B.name?"#ef4444":R}})]}),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:I},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(ce,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:J}}),n.jsx("input",{id:"signup-email",type:"email",name:"email",placeholder:"Enter your email address",value:P.email,onChange:K,style:{...f,borderColor:B.email?"#ef4444":R}})]}),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:I},children:"Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(we,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:J}}),n.jsx("input",{id:"signup-password",type:T?"text":"password",name:"password",placeholder:"Create a secure password",value:P.password,onChange:K,style:{...f,borderColor:B.password?"#ef4444":R}}),n.jsx("button",{type:"button",onClick:()=>q(!T),style:{position:"absolute",right:"14px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:J,cursor:"pointer",padding:"4px"},children:T?n.jsx(nt,{size:20}):n.jsx(st,{size:20})})]}),B.password&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:B.password})]}),h&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-avatar",style:{fontSize:"14px",fontWeight:500,color:I},children:"Avatar URL (Optional)"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(er,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:J}}),n.jsx("input",{id:"signup-avatar",type:"url",name:"avatarUrl",placeholder:"Paste your avatar image URL",value:P.avatarUrl||"",onChange:K,style:f})]})]}),b&&n.jsx("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:n.jsx("a",{href:b,style:{color:i,textDecoration:"none",fontWeight:500},children:"Already have an account?"})}),v&&n.jsxs("div",{style:{padding:"12px",borderRadius:"12px",fontSize:"12px",display:"flex",alignItems:"start",gap:"10px",backgroundColor:v.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:v.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:v.type==="success"?i:"#ef4444"},children:[v.type==="success"?n.jsx(de,{size:20}):n.jsx(le,{size:20}),n.jsx("span",{children:v.text})]}),n.jsx("button",{type:"submit",disabled:g,style:{padding:"12px",background:o,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600,cursor:g?"not-allowed":"pointer",opacity:g?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:g?n.jsxs(n.Fragment,{children:[n.jsx(Hn,{size:18,style:{animation:"spin 1s linear infinite"}}),"Creating Account..."]}):"Create Account"})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:J,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]}),n.jsx("style",{children:`
|
|
203
203
|
@keyframes spin {
|
|
204
204
|
from { transform: rotate(0deg); }
|
|
205
205
|
to { transform: rotate(360deg); }
|
|
206
206
|
}
|
|
207
|
-
`})]})},es=async(t,e)=>{const{email:r,password:s,appId:o}=t,{baseUrl:i,apiKey:a}=e;if(!a)throw new Error("API key is required for login");try{const l=await M.post(`${i}/users/login`,{email:r,password:s,appId:o},{headers:{"Content-Type":"application/json","x-api-key":a}});return l.data?.user&&localStorage.setItem("userInfo",JSON.stringify(l.data.user)),l.data.user}catch(l){const h=l.response?.data?.message||l.message||"Login failed";throw console.error("Login API Error:",h),{success:!1,message:h,status:l.response?.status||500}}},ts=({logoUrl:t,logoLinkUrl:e,title:r="Sign In to Your Account",subtitle:s="Welcome back! Please enter your details",footerText:o="Secure authentication powered by Neuctra Authix",primaryColor:i="#00C214",gradient:a="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,signupUrl:h,onSuccess:d,onError:u})=>{const{baseUrl:b,apiKey:y,appId:S}=ue(),[c,j]=w.useState("login"),[m,_]=w.useState(1),[P,z]=w.useState(!1),[T,q]=w.useState(!1),[g,O]=w.useState(null),[v,U]=w.useState(""),[B,F]=w.useState(""),[V,Z]=w.useState({email:"",otp:"",newPassword:"",appId:S}),[I,J]=w.useState(!1),A=l?"#ffffff":"#111827",R=l?"#a1a1aa":"#6b7280",K=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",te=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)";w.useEffect(()=>{if(typeof window<"u"){const $=()=>J(window.innerWidth<768);return $(),window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)}},[]);const G=async $=>{$.preventDefault(),q(!0),O(null);try{const N=await es({email:v,password:B,appId:S},{baseUrl:b,apiKey:y});O({type:"success",text:`Welcome ${N.name}`}),d?.(N)}catch(N){const Y=N.message||"Login failed";O({type:"error",text:Y}),u?.(N)}finally{q(!1)}},f=$=>{Z({...V,[$.target.name]:$.target.value})},E=async $=>{$.preventDefault(),q(!0),O(null);try{const N=await M.post(`${b}/users/forgot-password`,{email:V.email,appId:S},{headers:{"x-api-key":y}});N.data.success?(_(2),O({type:"success",text:"OTP sent to your email"})):O({type:"error",text:N.data.message||"Failed to send OTP"})}catch(N){O({type:"error",text:N.response?.data?.message||"Something went wrong"})}finally{q(!1)}},x=async $=>{$.preventDefault(),q(!0),O(null);try{const N=await M.post(`${b}/users/reset-password`,V,{headers:{"x-api-key":y}});N.data.success?(O({type:"success",text:"Password reset successfully!"}),_(1),Z({email:"",otp:"",newPassword:"",appId:S}),j("login")):O({type:"error",text:N.data.message||"Reset failed"})}catch(N){O({type:"error",text:N.response?.data?.message||"Something went wrong"})}finally{q(!1)}},k={width:"100%",padding:I?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:K,border:`1px solid ${te}`,borderRadius:"10px",color:A,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:I?"320px":"380px",maxWidth:I?"340px":"390px",width:"100%",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:I?"30px 24px":"18px 28px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[t?n.jsx("a",{href:e||"/",target:"_self",rel:"noopener noreferrer",children:n.jsx("img",{src:t,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):n.jsx(Se,{size:40,color:i,style:{marginBottom:"10px"}}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:A,margin:0},children:c==="login"?r:m===1?"Forgot Password":"Reset Password"}),n.jsx("p",{style:{fontSize:"14px",color:R},children:c==="login"?s:"Follow the steps to reset your password"})]}),c==="login"&&n.jsxs("form",{onSubmit:G,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(ce,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:R}}),n.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:v,onChange:$=>U($.target.value),style:k})]})]}),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(we,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:R}}),n.jsx("input",{id:"login-password",type:P?"text":"password",placeholder:"Enter your password",value:B,onChange:$=>F($.target.value),style:k}),n.jsx("button",{type:"button",onClick:()=>z(!P),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:R,cursor:"pointer"},children:P?n.jsx(nt,{size:20}):n.jsx(st,{size:20})})]})]}),n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:[h&&n.jsx("a",{href:h,style:{color:i,textDecoration:"none",fontWeight:500},children:"Create new account"}),n.jsx("button",{type:"button",onClick:()=>j("forgot"),style:{background:"none",border:"none",color:i,fontWeight:500,cursor:"pointer"},children:"Forgot password?"})]}),n.jsx("button",{type:"submit",disabled:T,style:{padding:"12px",background:a,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600},children:T?"Signing In...":"Sign In"})]}),c==="forgot"&&n.jsxs("form",{onSubmit:m===1?E:x,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[m===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(ce,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:R}}),n.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:V.email,onChange:f,style:k})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[n.jsx("label",{htmlFor:"otp",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"One-Time Password (OTP)"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(tr,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:R}}),n.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:V.otp,onChange:f,style:k})]})]}),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(we,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:R}}),n.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:V.newPassword,onChange:f,style:k})]})]})]}),n.jsx("button",{type:"submit",disabled:T,style:{padding:"12px",background:a,color:"#fff",border:"none",fontSize:"14px",borderRadius:"10px",fontWeight:600},children:T?"Please wait...":m===1?"Send Reset OTP":"Reset Password"}),n.jsx("button",{type:"button",onClick:()=>{j("login"),_(1)},style:{background:"none",border:"none",fontSize:"14px",color:R,marginTop:"6px",cursor:"pointer"},children:"Back to Login"})]}),g&&n.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:g.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:g.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:g.type==="success"?i:"#ef4444"},children:[g.type==="success"?n.jsx(de,{size:20}):n.jsx(le,{size:20}),n.jsx("span",{children:g.text})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:R,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]})})},rs=({children:t,fallback:e=null,className:r,width:s,height:o})=>{const[i,a]=w.useState(()=>{if(typeof window>"u")return!1;try{const l=localStorage.getItem("userInfo");return!!(l&&l!=="undefined"&&l!=="null")}catch{return!1}});return w.useEffect(()=>{const l=()=>{if(!(typeof window>"u"))try{const h=localStorage.getItem("userInfo");a(!!(h&&h!=="undefined"&&h!=="null"))}catch{a(!1)}};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}},[]),i?n.jsx("div",{className:r,style:{display:"flex",alignItems:"center",width:s,height:o},children:t}):typeof e=="function"?e():e},ns=({children:t,fallback:e=null,className:r,width:s,height:o})=>{const[i,a]=w.useState(()=>{if(typeof window>"u")return!0;try{const l=localStorage.getItem("userInfo");return!l||l==="undefined"||l==="null"}catch{return!0}});return w.useEffect(()=>{const l=()=>{try{const h=localStorage.getItem("userInfo");a(!h||h==="undefined"||h==="null")}catch{a(!0)}};return l(),window.addEventListener("storage",l),()=>window.removeEventListener("storage",l)},[]),i?n.jsx("div",{className:r,style:{display:"flex",alignItems:"center",width:s,height:o},children:t}):typeof e=="function"?e():e},ss=({isOpen:t,onClose:e,onSuccess:r,onError:s,userId:o,token:i,colors:a})=>{const{baseUrl:l,apiKey:h,appId:d}=ue(),[u,b]=w.useState(!1),[y,S]=w.useState(""),[c,j]=w.useState("warning"),[m,_]=w.useState(!1);if(w.useEffect(()=>{if(typeof window>"u")return;const g=()=>{_(window.innerWidth<640)};return g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[]),!t)return null;const P=async()=>{b(!0),j("processing");try{const{data:g}=await M.delete(`${l}/users/delete/${o}`,{data:{appId:d},headers:{"x-api-key":h}});g.success?(r(g.message||"Account deleted successfully"),j("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(s(g.message||"Failed to delete account"),j("warning"))}catch(g){s(g.response?.data?.message||"Something went wrong"),j("warning")}finally{b(!1)}},z=y.toLowerCase()==="delete my account",T=g=>{g.target===g.currentTarget&&c!=="processing"&&c!=="success"&&e()},q=()=>{switch(c){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(Me,{size:20})}),n.jsx("div",{children:n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Delete Account"})})]}),n.jsx("button",{onClick:e,"aria-label":"Close modal",style:{background:"transparent",border:"none",color:a.textTertiary,cursor:"pointer",padding:"8px",borderRadius:"8px",width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.2s ease"},onMouseOver:g=>{g.currentTarget.style.backgroundColor=a.border,g.currentTarget.style.color=a.textPrimary},onMouseOut:g=>{g.currentTarget.style.backgroundColor="transparent",g.currentTarget.style.color=a.textTertiary},children:n.jsx(Pe,{size:20})})]}),n.jsxs("div",{style:{display:"flex",gap:"16px",padding:"20px",background:`${a.error}15`,border:`1px solid ${a.error}30`,borderRadius:"12px",marginBottom:"20px"},children:[n.jsx("div",{style:{color:a.error,flexShrink:0,display:"flex",alignItems:"flex-start"},children:n.jsx(nr,{size:24})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h4",{style:{color:a.textPrimary,margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Before you proceed..."}),n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[{icon:n.jsx(qn,{size:16}),text:"All your data will be permanently deleted"},{icon:n.jsx(Xn,{size:16}),text:"This action cannot be reversed"},{icon:n.jsx(at,{size:16}),text:"You will lose access to all services"}].map((g,O)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",fontSize:"14px",color:a.textSecondary},children:[n.jsx("div",{style:{color:a.error,flexShrink:0},children:g.icon}),n.jsx("span",{children:g.text})]},O))})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:m?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:e,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:m?"none":1,minWidth:m?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:g=>{g.currentTarget.style.backgroundColor=a.border,g.currentTarget.style.transform="translateY(-1px)"},onMouseOut:g=>{g.currentTarget.style.backgroundColor="transparent",g.currentTarget.style.transform="translateY(0)"},children:"Cancel"}),n.jsxs("button",{onClick:()=>j("confirmation"),style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:"pointer",flex:m?"none":1,minWidth:m?"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:g=>{g.currentTarget.style.transform="translateY(-1px)",g.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)"},onMouseOut:g=>{g.currentTarget.style.transform="translateY(0)",g.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)"},children:[n.jsx(Me,{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(nr,{size:24})}),n.jsx("div",{style:{flex:1},children:n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Confirm Deletion"})})]}),n.jsxs("div",{style:{marginBottom:"24px"},children:[n.jsxs("p",{style:{color:a.textSecondary,marginBottom:"16px",fontSize:"14px",lineHeight:"1.5"},children:["Type"," ",n.jsx("strong",{style:{color:a.textPrimary},children:'"delete my account"'})," ","to confirm:"]}),n.jsx("input",{type:"text",value:y,onChange:g=>S(g.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${z?a.success:a.error}`,backgroundColor:"transparent",color:a.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:g=>{g.target.style.boxShadow=`0 0 0 3px ${a.accent}20`},onBlur:g=>{g.target.style.boxShadow="none"},autoFocus:!0}),z&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"10px",color:a.success,fontSize:"14px",fontWeight:500},children:[n.jsx(rt,{size:16}),n.jsx("span",{children:"Confirmation accepted"})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:()=>{j("warning"),S("")},style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:m?"none":1,minWidth:m?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:g=>{g.currentTarget.style.backgroundColor=a.border,g.currentTarget.style.transform="translateY(-1px)"},onMouseOut:g=>{g.currentTarget.style.backgroundColor="transparent",g.currentTarget.style.transform="translateY(0)"},children:"Go Back"}),n.jsxs("button",{onClick:P,disabled:!z||u,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:!z||u?"not-allowed":"pointer",flex:m?"none":1,minWidth:m?"100%":"140px",opacity:!z||u?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:!z||u?"none":"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:g=>{z&&!u&&(g.currentTarget.style.transform="translateY(-1px)",g.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)")},onMouseOut:g=>{z&&!u&&(g.currentTarget.style.transform="translateY(0)",g.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)")},children:[n.jsx(Me,{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(oe,{size:20,style:{animation:"spin 1s linear infinite"}})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Deleting Account"}),n.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Please wait while we process your request"})]})]}),n.jsx("div",{style:{marginBottom:"20px"},children:n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[{text:"Removing your data",active:!0},{text:"Closing active sessions",active:!1},{text:"Finalizing deletion",active:!1}].map((g,O)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",borderRadius:"8px",transition:"all 0.2s ease",backgroundColor:g.active?`${a.accent}10`:"transparent"},children:[n.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:g.active?a.accent:a.textTertiary,transition:"all 0.3s ease",boxShadow:g.active?`0 0 0 4px ${a.accent}20`:"none"}}),n.jsx("span",{style:{fontSize:"14px",color:g.active?a.textPrimary:a.textSecondary,fontWeight:g.active?500:400},children:g.text})]},O))})}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${a.accent}10`,borderRadius:"10px",fontSize:"14px",color:a.textSecondary},children:[n.jsx(rr,{size:18,style:{color:a.accent,flexShrink:0}}),n.jsx("span",{children:"You will be redirected to the login page shortly"})]})]});case"success":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #10b981, #059669)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(rt,{size:20})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Account Deleted"}),n.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Your account has been successfully deleted"})]})]}),n.jsxs("div",{style:{textAlign:"center",padding:"20px",background:`${a.success}10`,border:`1px solid ${a.success}20`,borderRadius:"12px",marginBottom:"24px"},children:[n.jsx(rt,{size:48,style:{color:a.success,marginBottom:"12px",display:"block",margin:"0 auto 12px auto"}}),n.jsx("p",{style:{color:a.textPrimary,fontSize:"16px",fontWeight:600,margin:"0 0 8px 0"},children:"Goodbye!"}),n.jsx("p",{style:{color:a.textSecondary,fontSize:"14px",margin:0,lineHeight:"1.5"},children:"Your account and all associated data have been permanently removed from our systems."})]}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${a.accent}10`,borderRadius:"10px",fontSize:"14px",color:a.textSecondary,justifyContent:"center"},children:[n.jsx(oe,{size:16,style:{animation:"spin 1s linear infinite",color:a.accent}}),n.jsx("span",{children:"Redirecting to login page..."})]})]})}};return n.jsxs("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.8)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:1e4,animation:"fadeIn 0.3s ease-out"},onClick:T,children:[n.jsx("div",{style:{backgroundColor:a.surface,border:`1px solid ${a.border}`,borderRadius:"20px",width:"100%",maxWidth:"480px",padding:"24px",boxShadow:"0 32px 64px rgba(0,0,0,0.4)",animation:"scaleIn 0.3s ease-out"},className:"delete-modal-container",children:q()}),n.jsx("style",{children:`
|
|
207
|
+
`})]})},es=async(t,e)=>{const{email:r,password:s,appId:a}=t,{baseUrl:i,apiKey:o}=e;if(!o)throw new Error("API key is required for login");try{const l=await M.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 h=l.response?.data?.message||l.message||"Login failed";throw console.error("Login API Error:",h),{success:!1,message:h,status:l.response?.status||500}}},ts=({logoUrl:t,logoLinkUrl:e,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:h,onSuccess:d,onError:u})=>{const{baseUrl:b,apiKey:y,appId:S}=ue(),[c,j]=w.useState("login"),[m,_]=w.useState(1),[P,z]=w.useState(!1),[T,q]=w.useState(!1),[g,O]=w.useState(null),[v,U]=w.useState(""),[B,F]=w.useState(""),[V,Z]=w.useState({email:"",otp:"",newPassword:"",appId:S}),[I,J]=w.useState(!1),A=l?"#ffffff":"#111827",R=l?"#a1a1aa":"#6b7280",K=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",te=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)";w.useEffect(()=>{if(typeof window<"u"){const $=()=>J(window.innerWidth<768);return $(),window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)}},[]);const G=async $=>{$.preventDefault(),q(!0),O(null);try{const N=await es({email:v,password:B,appId:S},{baseUrl:b,apiKey:y});O({type:"success",text:`Welcome ${N.name}`}),d?.(N)}catch(N){const Y=N.message||"Login failed";O({type:"error",text:Y}),u?.(N)}finally{q(!1)}},f=$=>{Z({...V,[$.target.name]:$.target.value})},E=async $=>{$.preventDefault(),q(!0),O(null);try{const N=await M.post(`${b}/users/forgot-password`,{email:V.email,appId:S},{headers:{"x-api-key":y}});N.data.success?(_(2),O({type:"success",text:"OTP sent to your email"})):O({type:"error",text:N.data.message||"Failed to send OTP"})}catch(N){O({type:"error",text:N.response?.data?.message||"Something went wrong"})}finally{q(!1)}},x=async $=>{$.preventDefault(),q(!0),O(null);try{const N=await M.post(`${b}/users/reset-password`,V,{headers:{"x-api-key":y}});N.data.success?(O({type:"success",text:"Password reset successfully!"}),_(1),Z({email:"",otp:"",newPassword:"",appId:S}),j("login")):O({type:"error",text:N.data.message||"Reset failed"})}catch(N){O({type:"error",text:N.response?.data?.message||"Something went wrong"})}finally{q(!1)}},k={width:"100%",padding:I?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:K,border:`1px solid ${te}`,borderRadius:"10px",color:A,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:I?"320px":"380px",maxWidth:I?"340px":"390px",width:"100%",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:I?"30px 24px":"18px 28px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[t?n.jsx("a",{href:e||"/",target:"_self",rel:"noopener noreferrer",children:n.jsx("img",{src:t,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):n.jsx(Se,{size:40,color:i,style:{marginBottom:"10px"}}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:A,margin:0},children:c==="login"?r:m===1?"Forgot Password":"Reset Password"}),n.jsx("p",{style:{fontSize:"14px",color:R},children:c==="login"?s:"Follow the steps to reset your password"})]}),c==="login"&&n.jsxs("form",{onSubmit:G,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(ce,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:R}}),n.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:v,onChange:$=>U($.target.value),style:k})]})]}),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(we,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:R}}),n.jsx("input",{id:"login-password",type:P?"text":"password",placeholder:"Enter your password",value:B,onChange:$=>F($.target.value),style:k}),n.jsx("button",{type:"button",onClick:()=>z(!P),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:R,cursor:"pointer"},children:P?n.jsx(nt,{size:20}):n.jsx(st,{size:20})})]})]}),n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:[h&&n.jsx("a",{href:h,style:{color:i,textDecoration:"none",fontWeight:500},children:"Create new account"}),n.jsx("button",{type:"button",onClick:()=>j("forgot"),style:{background:"none",border:"none",color:i,fontWeight:500,cursor:"pointer"},children:"Forgot password?"})]}),n.jsx("button",{type:"submit",disabled:T,style:{padding:"12px",background:o,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600},children:T?"Signing In...":"Sign In"})]}),c==="forgot"&&n.jsxs("form",{onSubmit:m===1?E:x,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[m===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(ce,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:R}}),n.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:V.email,onChange:f,style:k})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[n.jsx("label",{htmlFor:"otp",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"One-Time Password (OTP)"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(tr,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:R}}),n.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:V.otp,onChange:f,style:k})]})]}),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(we,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:R}}),n.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:V.newPassword,onChange:f,style:k})]})]})]}),n.jsx("button",{type:"submit",disabled:T,style:{padding:"12px",background:o,color:"#fff",border:"none",fontSize:"14px",borderRadius:"10px",fontWeight:600},children:T?"Please wait...":m===1?"Send Reset OTP":"Reset Password"}),n.jsx("button",{type:"button",onClick:()=>{j("login"),_(1)},style:{background:"none",border:"none",fontSize:"14px",color:R,marginTop:"6px",cursor:"pointer"},children:"Back to Login"})]}),g&&n.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:g.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:g.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:g.type==="success"?i:"#ef4444"},children:[g.type==="success"?n.jsx(de,{size:20}):n.jsx(le,{size:20}),n.jsx("span",{children:g.text})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:R,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]})})},rs=({children:t,fallback:e=null,className:r,width:s,height:a})=>{const[i,o]=w.useState(()=>{if(typeof window>"u")return!1;try{const l=localStorage.getItem("userInfo");return!!(l&&l!=="undefined"&&l!=="null")}catch{return!1}});return w.useEffect(()=>{const l=()=>{if(!(typeof window>"u"))try{const h=localStorage.getItem("userInfo");o(!!(h&&h!=="undefined"&&h!=="null"))}catch{o(!1)}};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}},[]),i?n.jsx("div",{className:r,style:{display:"flex",alignItems:"center",width:s,height:a},children:t}):typeof e=="function"?e():e},ns=({children:t,fallback:e=null,className:r,width:s,height:a})=>{const[i,o]=w.useState(()=>{if(typeof window>"u")return!0;try{const l=localStorage.getItem("userInfo");return!l||l==="undefined"||l==="null"}catch{return!0}});return w.useEffect(()=>{const l=()=>{try{const h=localStorage.getItem("userInfo");o(!h||h==="undefined"||h==="null")}catch{o(!0)}};return l(),window.addEventListener("storage",l),()=>window.removeEventListener("storage",l)},[]),i?n.jsx("div",{className:r,style:{display:"flex",alignItems:"center",width:s,height:a},children:t}):typeof e=="function"?e():e},ss=({isOpen:t,onClose:e,onSuccess:r,onError:s,userId:a,token:i,colors:o})=>{const{baseUrl:l,apiKey:h,appId:d}=ue(),[u,b]=w.useState(!1),[y,S]=w.useState(""),[c,j]=w.useState("warning"),[m,_]=w.useState(!1);if(w.useEffect(()=>{if(typeof window>"u")return;const g=()=>{_(window.innerWidth<640)};return g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[]),!t)return null;const P=async()=>{b(!0),j("processing");try{const{data:g}=await M.delete(`${l}/users/delete/${a}`,{data:{appId:d},headers:{"x-api-key":h}});g.success?(r(g.message||"Account deleted successfully"),j("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(s(g.message||"Failed to delete account"),j("warning"))}catch(g){s(g.response?.data?.message||"Something went wrong"),j("warning")}finally{b(!1)}},z=y.toLowerCase()==="delete my account",T=g=>{g.target===g.currentTarget&&c!=="processing"&&c!=="success"&&e()},q=()=>{switch(c){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(Me,{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:e,"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:g=>{g.currentTarget.style.backgroundColor=o.border,g.currentTarget.style.color=o.textPrimary},onMouseOut:g=>{g.currentTarget.style.backgroundColor="transparent",g.currentTarget.style.color=o.textTertiary},children:n.jsx(Pe,{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(nr,{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(Xn,{size:16}),text:"This action cannot be reversed"},{icon:n.jsx(ot,{size:16}),text:"You will lose access to all services"}].map((g,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:g.icon}),n.jsx("span",{children:g.text})]},O))})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:m?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:e,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${o.border}`,background:"transparent",color:o.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:m?"none":1,minWidth:m?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:g=>{g.currentTarget.style.backgroundColor=o.border,g.currentTarget.style.transform="translateY(-1px)"},onMouseOut:g=>{g.currentTarget.style.backgroundColor="transparent",g.currentTarget.style.transform="translateY(0)"},children:"Cancel"}),n.jsxs("button",{onClick:()=>j("confirmation"),style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:"pointer",flex:m?"none":1,minWidth:m?"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:g=>{g.currentTarget.style.transform="translateY(-1px)",g.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)"},onMouseOut:g=>{g.currentTarget.style.transform="translateY(0)",g.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)"},children:[n.jsx(Me,{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(nr,{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:y,onChange:g=>S(g.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${z?o.success:o.error}`,backgroundColor:"transparent",color:o.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:g=>{g.target.style.boxShadow=`0 0 0 3px ${o.accent}20`},onBlur:g=>{g.target.style.boxShadow="none"},autoFocus:!0}),z&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"10px",color:o.success,fontSize:"14px",fontWeight:500},children:[n.jsx(rt,{size:16}),n.jsx("span",{children:"Confirmation accepted"})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:()=>{j("warning"),S("")},style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${o.border}`,background:"transparent",color:o.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:m?"none":1,minWidth:m?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:g=>{g.currentTarget.style.backgroundColor=o.border,g.currentTarget.style.transform="translateY(-1px)"},onMouseOut:g=>{g.currentTarget.style.backgroundColor="transparent",g.currentTarget.style.transform="translateY(0)"},children:"Go Back"}),n.jsxs("button",{onClick:P,disabled:!z||u,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:!z||u?"not-allowed":"pointer",flex:m?"none":1,minWidth:m?"100%":"140px",opacity:!z||u?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:!z||u?"none":"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:g=>{z&&!u&&(g.currentTarget.style.transform="translateY(-1px)",g.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)")},onMouseOut:g=>{z&&!u&&(g.currentTarget.style.transform="translateY(0)",g.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)")},children:[n.jsx(Me,{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(ae,{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((g,O)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",borderRadius:"8px",transition:"all 0.2s ease",backgroundColor:g.active?`${o.accent}10`:"transparent"},children:[n.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:g.active?o.accent:o.textTertiary,transition:"all 0.3s ease",boxShadow:g.active?`0 0 0 4px ${o.accent}20`:"none"}}),n.jsx("span",{style:{fontSize:"14px",color:g.active?o.textPrimary:o.textSecondary,fontWeight:g.active?500:400},children:g.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(rr,{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(rt,{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(rt,{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(ae,{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:T,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:q()}),n.jsx("style",{children:`
|
|
208
208
|
@keyframes fadeIn {
|
|
209
209
|
from { opacity: 0; }
|
|
210
210
|
to { opacity: 1; }
|
|
@@ -258,7 +258,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
258
258
|
animation: none !important;
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
`})]})},
|
|
261
|
+
`})]})},as=({isOpen:t,onClose:e,onUpdate:r,colors:s})=>{const[a,i]=w.useState(""),[o,l]=w.useState(!1),[h,d]=w.useState(!1),[u,b]=w.useState({isValid:!1,message:"",type:null});if(w.useEffect(()=>{if(typeof window>"u")return;const c=()=>{d(window.innerWidth<640)};return c(),window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[]),w.useEffect(()=>{if(!a.trim()){b({isValid:!1,message:"",type:null});return}try{const c=new URL(a),j=/\.(jpg|jpeg|png|gif|webp|svg)$/i.test(c.pathname);b(j?{isValid:!0,message:"Valid image URL",type:"success"}:{isValid:!1,message:"URL should point to an image file",type:"warning"})}catch{b({isValid:!1,message:"Please enter a valid URL",type:"error"})}},[a]),!t)return null;const y=async()=>{if(!(!a||!u.isValid)){l(!0);try{await r(a)&&(i(""),e())}finally{l(!1)}}},S=c=>{c.target===c.currentTarget&&e()};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:S,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(tt,{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:e,"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:c=>{c.currentTarget.style.backgroundColor=s.border,c.currentTarget.style.color=s.textPrimary},onMouseOut:c=>{c.currentTarget.style.backgroundColor="transparent",c.currentTarget.style.color=s.textTertiary},children:n.jsx(Pe,{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(Wn,{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:c=>i(c.target.value),style:{width:"100%",padding:"14px 16px",paddingLeft:"44px",borderRadius:"12px",border:`1.5px solid ${u.type==="error"?s.error:u.type==="success"?s.success:s.border}`,backgroundColor:"transparent",color:s.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:c=>{c.target.style.borderColor=s.accent,c.target.style.boxShadow=`0 0 0 3px ${s.accent}20`},onBlur:c=>{c.target.style.borderColor=u.type==="error"?s.error:u.type==="success"?s.success:s.border,c.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(er,{size:18})})]}),u.message&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"8px",fontSize:"13px",color:u.type==="success"?s.success:u.type==="error"?s.error:s.textTertiary},children:[u.type==="success"&&n.jsx(de,{size:14}),u.type==="error"&&n.jsx(le,{size:14}),u.type==="warning"&&n.jsx(le,{size:14}),u.message]})]}),a&&u.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:c=>{c.currentTarget.style.display="none"}})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:h?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch",marginTop:"24px"},children:[n.jsx("button",{onClick:e,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:h?"none":1,minWidth:h?"100%":"120px",opacity:o?.6:1,transition:"all 0.2s ease"},onMouseOver:c=>{o||(c.currentTarget.style.backgroundColor=s.border,c.currentTarget.style.transform="translateY(-1px)")},onMouseOut:c=>{o||(c.currentTarget.style.backgroundColor="transparent",c.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),n.jsx("button",{onClick:y,disabled:o||!u.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||!u.isValid?"not-allowed":"pointer",flex:h?"none":1,minWidth:h?"100%":"140px",opacity:o||!u.isValid?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:o||!u.isValid?"none":`0 4px 12px ${s.accent}40`},onMouseOver:c=>{!o&&u.isValid&&(c.currentTarget.style.transform="translateY(-1px)",c.currentTarget.style.boxShadow=`0 6px 20px ${s.accent}60`)},onMouseOut:c=>{!o&&u.isValid&&(c.currentTarget.style.transform="translateY(0)",c.currentTarget.style.boxShadow=`0 4px 12px ${s.accent}40`)},children:o?n.jsxs(n.Fragment,{children:[n.jsx(ae,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):n.jsxs(n.Fragment,{children:[n.jsx(tt,{size:16}),"Update Avatar"]})})]})]}),n.jsx("style",{children:`
|
|
262
262
|
@keyframes modalSlideIn {
|
|
263
263
|
from {
|
|
264
264
|
opacity: 0;
|
|
@@ -306,7 +306,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
306
306
|
transition: none !important;
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
|
-
`})]})},
|
|
309
|
+
`})]})},os=({isOpen:t,onClose:e,onSuccess:r,onError:s,userId:a,colors:i})=>{const{baseUrl:o,apiKey:l,appId:h}=ue(),[d,u]=w.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[b,y]=w.useState({}),[S,c]=w.useState(!1),[j,m]=w.useState({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[_,P]=w.useState(!1);if(w.useEffect(()=>{if(typeof window>"u")return;const v=()=>{P(window.innerWidth<640)};return v(),window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)},[]),!t)return null;const z=v=>{const{name:U,value:B}=v.target;u(F=>({...F,[U]:B})),b[U]&&y(F=>({...F,[U]:""}))},T=v=>{m(U=>({...U,[v]:!U[v]}))},q=()=>{const v={};return d.currentPassword||(v.currentPassword="Current password is required"),d.newPassword?d.newPassword.length<6&&(v.newPassword="Password must be at least 6 characters"):v.newPassword="New password is required",d.newPassword!==d.confirmPassword&&(v.confirmPassword="Passwords do not match"),y(v),Object.keys(v).length===0},g=async v=>{if(v.preventDefault(),!!q()){c(!0);try{const{data:U}=await M.put(`${o}/users/change-password/${a}`,{appId:h,currentPassword:d.currentPassword,newPassword:d.newPassword},{headers:{"x-api-key":l}});U.success?(r(U.message||"Password updated successfully"),u({currentPassword:"",newPassword:"",confirmPassword:""}),e()):s(U.message||"Failed to update password")}catch(U){s(U.response?.data?.message||"Something went wrong")}finally{c(!1)}}},O=[{field:"currentPassword",label:"Current Password",icon:n.jsx(at,{size:18})},{field:"newPassword",label:"New Password",icon:n.jsx(we,{size:18})},{field:"confirmPassword",label:"Confirm Password",icon:n.jsx(we,{size:18})}];return n.jsx("div",{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(we,{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:e,"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:v=>{v.currentTarget.style.backgroundColor=i.border,v.currentTarget.style.color=i.textPrimary},onMouseOut:v=>{v.currentTarget.style.backgroundColor="transparent",v.currentTarget.style.color=i.textTertiary},children:n.jsx(Pe,{size:20})})]}),n.jsxs("form",{onSubmit:g,children:[O.map(({field:v,label:U,icon:B})=>n.jsxs("div",{style:{marginBottom:"20px",position:"relative"},children:[n.jsx("label",{htmlFor:v,style:{display:"block",marginBottom:"8px",color:i.textPrimary,fontSize:"14px",fontWeight:500,lineHeight:"1.4"},children:U}),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:B}),n.jsx("input",{type:j[v]?"text":"password",id:v,name:v,placeholder:`Enter ${U.toLowerCase()}`,value:d[v],onChange:z,style:{width:"100%",padding:"14px 48px 14px 44px",borderRadius:"10px",border:`1.5px solid ${b[v]?i.error:i.border}`,backgroundColor:"transparent",color:i.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:F=>{F.target.style.borderColor=i.accent,F.target.style.boxShadow=`0 0 0 3px ${i.accent}20`},onBlur:F=>{F.target.style.borderColor=b[v]?i.error:i.border,F.target.style.boxShadow="none"}}),n.jsx("button",{type:"button",onClick:()=>T(v),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:F=>{F.currentTarget.style.backgroundColor=i.border,F.currentTarget.style.color=i.textPrimary},onMouseOut:F=>{F.currentTarget.style.backgroundColor="transparent",F.currentTarget.style.color=i.textTertiary},children:j[v]?n.jsx(nt,{size:18}):n.jsx(st,{size:18})})]}),b[v]&&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:"⚠"}),b[v]]})]},v)),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:_?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{type:"button",onClick:e,disabled:S,style:{padding:"14px 24px",borderRadius:"10px",border:`1.5px solid ${i.border}`,background:"transparent",color:i.textPrimary,fontSize:"14px",fontWeight:500,cursor:S?"not-allowed":"pointer",flex:_?"none":1,minWidth:_?"100%":"120px",opacity:S?.6:1,transition:"all 0.2s ease"},onMouseOver:v=>{S||(v.currentTarget.style.backgroundColor=i.border,v.currentTarget.style.transform="translateY(-1px)")},onMouseOut:v=>{S||(v.currentTarget.style.backgroundColor="transparent",v.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),n.jsx("button",{type:"submit",disabled:S,style:{padding:"14px 24px",borderRadius:"10px",border:"none",background:`linear-gradient(135deg, ${i.accent}, ${i.accent}E6)`,color:"#fff",fontSize:"14px",fontWeight:600,cursor:S?"not-allowed":"pointer",flex:_?"none":1,minWidth:_?"100%":"140px",opacity:S?.8:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:S?"none":`0 4px 12px ${i.accent}40`},onMouseOver:v=>{S||(v.currentTarget.style.transform="translateY(-1px)",v.currentTarget.style.boxShadow=`0 6px 20px ${i.accent}60`)},onMouseOut:v=>{S||(v.currentTarget.style.transform="translateY(0)",v.currentTarget.style.boxShadow=`0 4px 12px ${i.accent}40`)},children:S?n.jsxs(n.Fragment,{children:[n.jsx(ae,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):"Update Password"})]})]}),n.jsx("style",{children:`
|
|
310
310
|
@keyframes spin {
|
|
311
311
|
from { transform: rotate(0deg); }
|
|
312
312
|
to { transform: rotate(360deg); }
|
|
@@ -344,7 +344,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
344
344
|
padding: 16px 12px;
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
`})]})})},is=({isOpen:t,onClose:e,onVerify:r,onSendOTP:s,verifyFormData:
|
|
347
|
+
`})]})})},is=({isOpen:t,onClose:e,onVerify:r,onSendOTP:s,verifyFormData:a,setVerifyFormData:i,otpSent:o,verifying:l,user:h,colors:d,darkMode:u})=>{if(!t)return null;const b=()=>{e(),i({email:h?.email||"",otp:"",appId:a.appId})};return n.jsxs("div",{className:"modal-overlay",style:{backgroundColor:u?"rgba(0, 0, 0, 0.8)":"rgba(0, 0, 0, 0.5)"},children:[n.jsxs("div",{className:"verify-email-modal",style:{backgroundColor:d.surface,border:`1px solid ${d.border}`},children:[n.jsxs("div",{className:"modal-header",children:[n.jsx("h3",{style:{color:d.textPrimary},children:"Verify Your Email"}),n.jsx("button",{onClick:b,className:"close-btn",style:{color:d.textTertiary},"aria-label":"Close verification modal",children:n.jsx(Pe,{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:d.textSecondary},children:"Email"}),n.jsxs("div",{className:"input-container",children:[n.jsx(ce,{size:18,style:{color:d.textTertiary},"aria-hidden":"true"}),n.jsx("input",{type:"email",value:a.email,onChange:y=>i(S=>({...S,email:y.target.value})),placeholder:"Enter your email",style:{backgroundColor:d.surfaceLight,color:d.textPrimary,borderColor:d.border},required:!0,"aria-required":"true","aria-label":"Email address"})]})]}),o&&n.jsxs("div",{className:"form-group",children:[n.jsx("label",{style:{color:d.textSecondary},children:"OTP"}),n.jsxs("div",{className:"input-container",children:[n.jsx(tr,{size:18,style:{color:d.textTertiary},"aria-hidden":"true"}),n.jsx("input",{type:"text",value:a.otp,onChange:y=>i(S=>({...S,otp:y.target.value})),placeholder:"Enter OTP",style:{backgroundColor:d.surfaceLight,color:d.textPrimary,borderColor:d.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, ${d.accent}, ${d.accentHover})`,opacity:l?.7:1},"aria-label":l?"Verifying email":"Verify email",children:[l?n.jsx(ae,{size:16,className:"spinner","aria-hidden":"true"}):n.jsx(de,{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, ${d.accent}, ${d.accentHover})`,opacity:l?.7:1},"aria-label":l?"Sending OTP":"Send OTP",children:[l?n.jsx(ae,{size:16,className:"spinner","aria-hidden":"true"}):n.jsx(it,{size:16,"aria-hidden":"true"}),l?"Sending...":"Send OTP"]})})]})]}),n.jsx("style",{children:`
|
|
348
348
|
.modal-overlay {
|
|
349
349
|
position: fixed;
|
|
350
350
|
top: 0;
|
|
@@ -491,7 +491,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
491
491
|
animation: none;
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
|
-
`})]})},ls=({token:t,user:e=null,darkMode:r=!0,homeUrl:s,onLogout:o,onVerify:i,primaryColor:a="#00C212"})=>{const{baseUrl:l,apiKey:h,appId:d}=ue(),[u,b]=w.useState(null),[y,S]=w.useState(e),[c,j]=w.useState(!0),[m,_]=w.useState(!1),[P,z]=w.useState(!1),[T,q]=w.useState(!1),[g,O]=w.useState(!1),[v,U]=w.useState(!1),[B,F]=w.useState(!1),[V,Z]=w.useState(!1),[I,J]=w.useState(!1),[A,R]=w.useState(null),[K,te]=w.useState(!1),[G,f]=w.useState({email:"",otp:"",appId:d}),[E,x]=w.useState(!1),[k,$]=w.useState(!1);w.useEffect(()=>{if(typeof window<"u"){const C=()=>b(window.innerWidth);return C(),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)}},[]);const N=(C,H)=>{R({type:C,message:H}),setTimeout(()=>R(null),3e3)},Y=()=>{J(!0);const C=setTimeout(()=>{Z(!1),J(!1)},150);return()=>clearTimeout(C)};w.useEffect(()=>{const C=H=>{const X=document.querySelector(".dropdown-container");X&&!X.contains(H.target)&&Y()};return V&&document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)}},[V]);const ae=async()=>{if(!G.email||!/\S+@\S+\.\S+/.test(G.email)){N("error","Please enter a valid email");return}try{$(!0);const C=await M.post(`${l}/users/send-verify-otp/${y?.id}`,{email:G.email},{headers:{"x-api-key":h,"x-app-id":d}});C.data.success?(N("success",C.data.message||"OTP sent to email!"),x(!0)):N("error",C.data.message||"Failed to send OTP")}catch(C){N("error",C.response?.data?.message||"Server error")}finally{$(!1)}},he=async C=>{if(C.preventDefault(),!G.email||!G.otp){N("error","Please fill in all fields");return}try{$(!0);const H=await M.post(`${l}/users/verify-email`,G);if(H.data.success){if(N("success",H.data.message||"Email verified!"),y){const X={...y,isVerified:!0};S(X),localStorage.setItem("userInfo",JSON.stringify({...X,token:t})),typeof i=="function"&&i(X)}f({email:"",otp:"",appId:d}),x(!1),F(!1)}else N("error",H.data.message||"Verification failed")}catch(H){N("error",H.response?.data?.message||"Something went wrong")}finally{$(!1)}},Oe=async C=>{if(!y)return!1;try{const H={...y,avatarUrl:C},{data:X}=await M.put(`${l}/users/update/${y.id}`,H,{headers:{"x-api-key":h}});return X.success?(S(H),localStorage.setItem("userInfo",JSON.stringify({...H,token:t})),N("success","Avatar updated successfully!"),!0):(N("error",X.message||"Failed to update avatar"),!1)}catch(H){return console.error("Avatar update error:",H),N("error","Failed to update avatar"),!1}},us=async()=>{if(y){z(!0);try{const{data:C}=await M.put(`${l}/users/update/${y.id}`,y,{headers:{"x-api-key":h}});C.success?(S(C.user),_(!1),localStorage.setItem("userInfo",JSON.stringify({...C.user,token:t})),N("success","Profile updated successfully")):N("error",C.message)}catch(C){console.error(C),N("error","Update failed")}finally{z(!1)}}},sr=async C=>{try{const{data:H}=await M.get(`${l}/users/check-user/${C}?appId=${d}`,{headers:{"x-api-key":h}});H?.success===!0&&H?.exists===!1&&(console.warn("❌ User does not exist on server. Clearing session..."),localStorage.removeItem("userInfo"),S(null))}catch(H){console.error("⚠️ User validation request failed:",H)}};w.useEffect(()=>{(()=>{if(e)S(e),j(!1),sr(e.id);else{const H=localStorage.getItem("userInfo");if(H){const X=JSON.parse(H);S(X),j(!1),sr(X.id)}else j(!1)}})()},[e]),w.useEffect(()=>{y?.email&&f(C=>({...C,email:y.email}))},[y?.email]);const or=(C,H)=>{let X=parseInt(C.replace("#",""),16),ge=(X>>16)+H,lt=(X>>8&255)+H,dt=(X&255)+H;return ge=Math.min(255,Math.max(0,ge)),lt=Math.min(255,Math.max(0,lt)),dt=Math.min(255,Math.max(0,dt)),`#${(dt|lt<<8|ge<<16).toString(16).padStart(6,"0")}`},L=r?{background:"#000000",surface:"#09090b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:a,accentHover:or(a,-15),success:"#10b981",error:"#ef4444",border:"#27272a",warning:"#f59e0b"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:a,accentHover:or(a,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7",warning:"#d97706"};if(c)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:L.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(oe,{size:40,color:L.accent,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}),n.jsx("p",{style:{color:L.textTertiary,margin:0},children:"Loading your profile..."})]})});if(!y)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:L.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",textAlign:"center"},children:[n.jsx(le,{size:40,color:L.error,"aria-hidden":"true"}),n.jsx("p",{style:{color:L.textTertiary,margin:0},children:"No profile found. Please log in again."})]})});const ps=[{label:"Full Name",value:y.name,name:"name",type:"text",icon:Se},{label:"Email Address",value:y.email,name:"email",type:"email",icon:ce},{label:"Phone Number",value:y.phone||"Not set",name:"phone",type:"tel",icon:Kn},{label:"Address",value:y.address||"Not provided",name:"address",type:"text",icon:Vn}];return n.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:L.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",lineHeight:1.5,minHeight:"80vh"},children:[A&&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",...A.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:[A.type==="success"?n.jsx(de,{size:20,"aria-hidden":"true"}):n.jsx(le,{size:20,"aria-hidden":"true"}),A.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",...u&&window.innerWidth>=1024&&{gridTemplateColumns:"1fr 2fr",gap:"10px"},...u&&window.innerWidth>=768&&u&&window.innerWidth<1024&&{gap:"10px"},...u&&window.innerWidth>=600&&u&&window.innerWidth<768&&{gap:"28px"}},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",height:"100%"},children:[n.jsxs("section",{style:{backgroundColor:L.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(Bn,{size:20,style:{color:r?"#ffffff":"#000000"}})}),n.jsxs("div",{style:{position:"relative",display:"inline-block",marginBottom:"16px"},children:[n.jsx("img",{src:y.avatarUrl||`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(y.name)}`,alt:`Profile avatar of ${y.name}`,style:{width:"128px",height:"128px",borderRadius:"50%",objectFit:"cover",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.3)",border:`3px solid ${L.border}`},width:128,height:128,loading:"eager"}),n.jsx("button",{onClick:()=>q(!0),style:{position:"absolute",bottom:"8px",right:"8px",backgroundColor:L.accent,color:"white",padding:"8px",borderRadius:"50%",border:"none",cursor:"pointer",transition:"all 0.2s ease",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px"},"aria-label":"Change profile picture",children:n.jsx(tt,{size:16,"aria-hidden":"true"})})]}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:600,margin:"0 0 4px 0",color:L.textPrimary},children:y.name}),n.jsx("p",{style:{color:L.textTertiary,margin:"0 0 8px 0"},children:y.email}),n.jsxs("div",{style:{backgroundColor:y.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:y.isVerified?L.success:L.warning,border:`1px solid ${y.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:[y.isVerified?n.jsx(de,{size:16,"aria-hidden":"true"}):n.jsx(le,{size:16,"aria-hidden":"true"}),y.isVerified?"Email Verified":"Not Verified"]})]}),n.jsx("nav",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:m?n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>_(!1),style:{backgroundColor:L.surfaceLight,border:`1px solid ${L.border}`,color:L.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:u&&window.innerWidth<1024?"1":"auto"},children:[n.jsx(Pe,{size:16,"aria-hidden":"true"}),"Cancel"]}),n.jsxs("button",{onClick:us,disabled:P,style:{background:`linear-gradient(to right, ${L.accent}, ${L.accentHover})`,opacity:P?.7:1,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:P?"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:u&&window.innerWidth<1024?"1":"auto"},children:[P?n.jsx(oe,{size:16,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(Jn,{size:16,"aria-hidden":"true"}),P?"Saving...":"Save Changes"]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>_(!0),style:{background:`linear-gradient(to right, ${L.accent}, ${L.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:u&&window.innerWidth<1024?"1":"auto"},children:[n.jsx(Yn,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),!y.isVerified&&n.jsxs("button",{onClick:()=>F(!0),disabled:K,style:{background:"linear-gradient(to right, #fbbf24, #f59e0b)",color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:K?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",minHeight:"36px",opacity:K?.7:1,flex:u&&window.innerWidth<1024?"1":"auto"},children:[K?n.jsx(oe,{size:14,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(it,{size:14,"aria-hidden":"true"}),K?"Sending...":"Verify Email"]}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("button",{style:{backgroundColor:L.surfaceLight,color:L.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:()=>Z(!V),children:[n.jsx(Mn,{size:16,"aria-hidden":"true"}),"More Actions"]}),V&&n.jsxs("div",{className:`dropdown-container ${I?"closing":""}`,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:L.surface,border:`1px solid ${L.border}`,borderRadius:"12px 12px 0 0",boxShadow:"0 -8px 24px rgba(0, 0, 0, 0.25)",zIndex:200,marginBottom:"6px",overflow:"hidden",animation:`${I?"drawerSlideDown":"drawerSlideUp"} 0.25s ease-out forwards`},children:[n.jsxs("button",{onClick:()=>{O(!0),Y()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:L.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=L.surfaceLight,onMouseLeave:C=>C.currentTarget.style.backgroundColor="transparent",children:[n.jsx(ot,{size:14,"aria-hidden":"true"}),"Change Password"]}),o&&n.jsxs("button",{onClick:()=>{o(),Y()},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(at,{size:14,"aria-hidden":"true"}),"Logout"]}),n.jsxs("button",{onClick:()=>{U(!0),Y()},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(Me,{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:L.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:L.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(Se,{size:20,"aria-hidden":"true"}),"Personal Information"]}),n.jsx("div",{style:{display:"grid",gap:"20px",gridTemplateColumns:"1fr",...u&&window.innerWidth>=600&&{gridTemplateColumns:"1fr 1fr",gap:"20px"}},children:ps.map(C=>{const H=C.icon;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[n.jsxs("label",{style:{color:L.textTertiary,fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(H,{size:16,"aria-hidden":"true"}),C.label]}),m?n.jsx("input",{type:C.type,name:C.name,value:y[C.name],onChange:X=>S(ge=>ge&&{...ge,[X.target.name]:X.target.value}),style:{padding:"12px",borderRadius:"8px",border:`1px solid ${a}`,backgroundColor:"transparent",color:L.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:L.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:L.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:L.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(rr,{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:L.textSecondary},children:[n.jsx(ce,{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",...y.isVerified?{backgroundColor:r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",color:L.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:L.warning,border:`1px solid ${r?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`}},children:y.isVerified?n.jsxs(n.Fragment,{children:[n.jsx(de,{size:16,"aria-hidden":"true"}),"Verified"]}):n.jsxs(n.Fragment,{children:[n.jsx(le,{size:16,"aria-hidden":"true"}),"Not Verified"]})})]}),!y.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:L.textTertiary,fontSize:"12px",margin:0},children:"Verify your email to unlock all features and enhance your account security."})})]})]})]})]})}),n.jsx(os,{isOpen:T,onClose:()=>{q(!1)},onUpdate:Oe,colors:L}),n.jsx(as,{baseUrl:l,apiKey:h,appId:d,userId:y.id,isOpen:g,onClose:()=>O(!1),onSuccess:C=>N("success",C),onError:C=>N("error",C),colors:L}),n.jsx(ss,{baseUrl:l,apiKey:h,appId:d,userId:y.id,token:t,isOpen:v,onClose:()=>U(!1),onSuccess:C=>N("success",C),onError:C=>N("error",C),colors:L}),n.jsx(is,{isOpen:B,onClose:()=>{F(!1),x(!1),f({email:y?.email||"",otp:"",appId:d})},onVerify:he,onSendOTP:ae,verifyFormData:G,setVerifyFormData:f,otpSent:E,verifying:k,user:y,colors:L,darkMode:r}),n.jsx("style",{children:`
|
|
494
|
+
`})]})},ls=({token:t,user:e=null,darkMode:r=!0,homeUrl:s,onLogout:a,onVerify:i,primaryColor:o="#00C212"})=>{const{baseUrl:l,apiKey:h,appId:d}=ue(),[u,b]=w.useState(null),[y,S]=w.useState(e),[c,j]=w.useState(!0),[m,_]=w.useState(!1),[P,z]=w.useState(!1),[T,q]=w.useState(!1),[g,O]=w.useState(!1),[v,U]=w.useState(!1),[B,F]=w.useState(!1),[V,Z]=w.useState(!1),[I,J]=w.useState(!1),[A,R]=w.useState(null),[K,te]=w.useState(!1),[G,f]=w.useState({email:"",otp:"",appId:d}),[E,x]=w.useState(!1),[k,$]=w.useState(!1);w.useEffect(()=>{if(typeof window<"u"){const C=()=>b(window.innerWidth);return C(),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)}},[]);const N=(C,H)=>{R({type:C,message:H}),setTimeout(()=>R(null),3e3)},Y=()=>{J(!0);const C=setTimeout(()=>{Z(!1),J(!1)},150);return()=>clearTimeout(C)};w.useEffect(()=>{const C=H=>{const X=document.querySelector(".dropdown-container");X&&!X.contains(H.target)&&Y()};return V&&document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)}},[V]);const oe=async()=>{if(!G.email||!/\S+@\S+\.\S+/.test(G.email)){N("error","Please enter a valid email");return}try{$(!0);const C=await M.post(`${l}/users/send-verify-otp/${y?.id}`,{email:G.email},{headers:{"x-api-key":h,"x-app-id":d}});C.data.success?(N("success",C.data.message||"OTP sent to email!"),x(!0)):N("error",C.data.message||"Failed to send OTP")}catch(C){N("error",C.response?.data?.message||"Server error")}finally{$(!1)}},he=async C=>{if(C.preventDefault(),!G.email||!G.otp){N("error","Please fill in all fields");return}try{$(!0);const H=await M.post(`${l}/users/verify-email`,G);if(H.data.success){if(N("success",H.data.message||"Email verified!"),y){const X={...y,isVerified:!0};S(X),localStorage.setItem("userInfo",JSON.stringify({...X,token:t})),typeof i=="function"&&i(X)}f({email:"",otp:"",appId:d}),x(!1),F(!1)}else N("error",H.data.message||"Verification failed")}catch(H){N("error",H.response?.data?.message||"Something went wrong")}finally{$(!1)}},Oe=async C=>{if(!y)return!1;try{const H={...y,avatarUrl:C},{data:X}=await M.put(`${l}/users/update/${y.id}`,H,{headers:{"x-api-key":h}});return X.success?(S(H),localStorage.setItem("userInfo",JSON.stringify({...H,token:t})),N("success","Avatar updated successfully!"),!0):(N("error",X.message||"Failed to update avatar"),!1)}catch(H){return console.error("Avatar update error:",H),N("error","Failed to update avatar"),!1}},us=async()=>{if(y){z(!0);try{const{data:C}=await M.put(`${l}/users/update/${y.id}`,y,{headers:{"x-api-key":h}});C.success?(S(C.user),_(!1),localStorage.setItem("userInfo",JSON.stringify({...C.user,token:t})),N("success","Profile updated successfully")):N("error",C.message)}catch(C){console.error(C),N("error","Update failed")}finally{z(!1)}}},sr=async C=>{try{const{data:H}=await M.get(`${l}/users/check-user/${C}?appId=${d}`,{headers:{"x-api-key":h}});H?.success===!0&&H?.exists===!1&&(console.warn("❌ User does not exist on server. Clearing session..."),localStorage.removeItem("userInfo"),S(null))}catch(H){console.error("⚠️ User validation request failed:",H)}};w.useEffect(()=>{(()=>{if(e)S(e),j(!1),sr(e.id);else{const H=localStorage.getItem("userInfo");if(H){const X=JSON.parse(H);S(X),j(!1),sr(X.id)}else j(!1)}})()},[e]),w.useEffect(()=>{y?.email&&f(C=>({...C,email:y.email}))},[y?.email]);const ar=(C,H)=>{let X=parseInt(C.replace("#",""),16),ge=(X>>16)+H,lt=(X>>8&255)+H,dt=(X&255)+H;return ge=Math.min(255,Math.max(0,ge)),lt=Math.min(255,Math.max(0,lt)),dt=Math.min(255,Math.max(0,dt)),`#${(dt|lt<<8|ge<<16).toString(16).padStart(6,"0")}`},L=r?{background:"#000000",surface:"#09090b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:o,accentHover:ar(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:ar(o,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7",warning:"#d97706"};if(c)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:L.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(ae,{size:40,color:L.accent,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}),n.jsx("p",{style:{color:L.textTertiary,margin:0},children:"Loading your profile..."})]})});if(!y)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:L.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",textAlign:"center"},children:[n.jsx(le,{size:40,color:L.error,"aria-hidden":"true"}),n.jsx("p",{style:{color:L.textTertiary,margin:0},children:"No profile found. Please log in again."})]})});const ps=[{label:"Full Name",value:y.name,name:"name",type:"text",icon:Se},{label:"Email Address",value:y.email,name:"email",type:"email",icon:ce},{label:"Phone Number",value:y.phone||"Not set",name:"phone",type:"tel",icon:Kn},{label:"Address",value:y.address||"Not provided",name:"address",type:"text",icon:Vn}];return n.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:L.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",lineHeight:1.5,minHeight:"80vh"},children:[A&&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",...A.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:[A.type==="success"?n.jsx(de,{size:20,"aria-hidden":"true"}):n.jsx(le,{size:20,"aria-hidden":"true"}),A.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",...u&&window.innerWidth>=1024&&{gridTemplateColumns:"1fr 2fr",gap:"10px"},...u&&window.innerWidth>=768&&u&&window.innerWidth<1024&&{gap:"10px"},...u&&window.innerWidth>=600&&u&&window.innerWidth<768&&{gap:"28px"}},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",height:"100%"},children:[n.jsxs("section",{style:{backgroundColor:L.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(Bn,{size:20,style:{color:r?"#ffffff":"#000000"}})}),n.jsxs("div",{style:{position:"relative",display:"inline-block",marginBottom:"16px"},children:[n.jsx("img",{src:y.avatarUrl||`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(y.name)}`,alt:`Profile avatar of ${y.name}`,style:{width:"128px",height:"128px",borderRadius:"50%",objectFit:"cover",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.3)",border:`3px solid ${L.border}`},width:128,height:128,loading:"eager"}),n.jsx("button",{onClick:()=>q(!0),style:{position:"absolute",bottom:"8px",right:"8px",backgroundColor:L.accent,color:"white",padding:"8px",borderRadius:"50%",border:"none",cursor:"pointer",transition:"all 0.2s ease",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px"},"aria-label":"Change profile picture",children:n.jsx(tt,{size:16,"aria-hidden":"true"})})]}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:600,margin:"0 0 4px 0",color:L.textPrimary},children:y.name}),n.jsx("p",{style:{color:L.textTertiary,margin:"0 0 8px 0"},children:y.email}),n.jsxs("div",{style:{backgroundColor:y.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:y.isVerified?L.success:L.warning,border:`1px solid ${y.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:[y.isVerified?n.jsx(de,{size:16,"aria-hidden":"true"}):n.jsx(le,{size:16,"aria-hidden":"true"}),y.isVerified?"Email Verified":"Not Verified"]})]}),n.jsx("nav",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:m?n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>_(!1),style:{backgroundColor:L.surfaceLight,border:`1px solid ${L.border}`,color:L.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:u&&window.innerWidth<1024?"1":"auto"},children:[n.jsx(Pe,{size:16,"aria-hidden":"true"}),"Cancel"]}),n.jsxs("button",{onClick:us,disabled:P,style:{background:`linear-gradient(to right, ${L.accent}, ${L.accentHover})`,opacity:P?.7:1,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:P?"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:u&&window.innerWidth<1024?"1":"auto"},children:[P?n.jsx(ae,{size:16,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(Jn,{size:16,"aria-hidden":"true"}),P?"Saving...":"Save Changes"]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>_(!0),style:{background:`linear-gradient(to right, ${L.accent}, ${L.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:u&&window.innerWidth<1024?"1":"auto"},children:[n.jsx(Yn,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),!y.isVerified&&n.jsxs("button",{onClick:()=>F(!0),disabled:K,style:{background:"linear-gradient(to right, #fbbf24, #f59e0b)",color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:K?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",minHeight:"36px",opacity:K?.7:1,flex:u&&window.innerWidth<1024?"1":"auto"},children:[K?n.jsx(ae,{size:14,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(it,{size:14,"aria-hidden":"true"}),K?"Sending...":"Verify Email"]}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("button",{style:{backgroundColor:L.surfaceLight,color:L.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:()=>Z(!V),children:[n.jsx(Mn,{size:16,"aria-hidden":"true"}),"More Actions"]}),V&&n.jsxs("div",{className:`dropdown-container ${I?"closing":""}`,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:L.surface,border:`1px solid ${L.border}`,borderRadius:"12px 12px 0 0",boxShadow:"0 -8px 24px rgba(0, 0, 0, 0.25)",zIndex:200,marginBottom:"6px",overflow:"hidden",animation:`${I?"drawerSlideDown":"drawerSlideUp"} 0.25s ease-out forwards`},children:[n.jsxs("button",{onClick:()=>{O(!0),Y()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:L.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=L.surfaceLight,onMouseLeave:C=>C.currentTarget.style.backgroundColor="transparent",children:[n.jsx(at,{size:14,"aria-hidden":"true"}),"Change Password"]}),a&&n.jsxs("button",{onClick:()=>{a(),Y()},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(ot,{size:14,"aria-hidden":"true"}),"Logout"]}),n.jsxs("button",{onClick:()=>{U(!0),Y()},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(Me,{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:L.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:L.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(Se,{size:20,"aria-hidden":"true"}),"Personal Information"]}),n.jsx("div",{style:{display:"grid",gap:"20px",gridTemplateColumns:"1fr",...u&&window.innerWidth>=600&&{gridTemplateColumns:"1fr 1fr",gap:"20px"}},children:ps.map(C=>{const H=C.icon;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[n.jsxs("label",{style:{color:L.textTertiary,fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(H,{size:16,"aria-hidden":"true"}),C.label]}),m?n.jsx("input",{type:C.type,name:C.name,value:y[C.name],onChange:X=>S(ge=>ge&&{...ge,[X.target.name]:X.target.value}),style:{padding:"12px",borderRadius:"8px",border:`1px solid ${o}`,backgroundColor:"transparent",color:L.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:L.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:L.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:L.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(rr,{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:L.textSecondary},children:[n.jsx(ce,{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",...y.isVerified?{backgroundColor:r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",color:L.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:L.warning,border:`1px solid ${r?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`}},children:y.isVerified?n.jsxs(n.Fragment,{children:[n.jsx(de,{size:16,"aria-hidden":"true"}),"Verified"]}):n.jsxs(n.Fragment,{children:[n.jsx(le,{size:16,"aria-hidden":"true"}),"Not Verified"]})})]}),!y.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:L.textTertiary,fontSize:"12px",margin:0},children:"Verify your email to unlock all features and enhance your account security."})})]})]})]})]})}),n.jsx(as,{isOpen:T,onClose:()=>{q(!1)},onUpdate:Oe,colors:L}),n.jsx(os,{baseUrl:l,apiKey:h,appId:d,userId:y.id,isOpen:g,onClose:()=>O(!1),onSuccess:C=>N("success",C),onError:C=>N("error",C),colors:L}),n.jsx(ss,{baseUrl:l,apiKey:h,appId:d,userId:y.id,token:t,isOpen:v,onClose:()=>U(!1),onSuccess:C=>N("success",C),onError:C=>N("error",C),colors:L}),n.jsx(is,{isOpen:B,onClose:()=>{F(!1),x(!1),f({email:y?.email||"",otp:"",appId:d})},onVerify:he,onSendOTP:oe,verifyFormData:G,setVerifyFormData:f,otpSent:E,verifying:k,user:y,colors:L,darkMode:r}),n.jsx("style",{children:`
|
|
495
495
|
@keyframes slideIn {
|
|
496
496
|
from {
|
|
497
497
|
transform: translateX(100%);
|
|
@@ -579,4 +579,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
579
579
|
transition-duration: 0.01ms !important;
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
`})]})},ds=({darkMode:t=!0,primaryColor:e="#3b82f6",onLogout:r,varient:s="classic",propUser:o,className:i="",profileUrl:a,settingsUrl:l,showProfileMenuItem:h=!0,showSettingsMenuItem:d=!0,showViewProfileMenuItem:u=!0,profileLabel:b="My Profile",settingsLabel:y="Settings",viewProfileLabel:S="View Profile",logoutLabel:c="Sign Out"})=>{const{baseUrl:j,apiKey:m,appId:_}=ue(),[P,z]=w.useState(!1),[T,q]=w.useState(null),[g,O]=w.useState(!0),[v,U]=w.useState(null),B=w.useRef(null),F=w.useRef(null),[V,Z]=w.useState(!1),[I,J]=w.useState(!1);w.useEffect(()=>{if(typeof window>"u")return;const x=()=>{J(window.innerWidth<768)};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]),w.useEffect(()=>{(async()=>{try{if(O(!0),U(null),o){if(!o.id||!o.name||!o.email)throw new Error("Invalid user data provided");q(o)}else if(typeof window<"u"){const k=localStorage.getItem("userInfo");if(k)try{const $=JSON.parse(k);if(!$.id||!$.name||!$.email)throw new Error("Invalid stored user data");q($)}catch($){console.error("Failed to parse stored user data:",$),localStorage.removeItem("userInfo"),U("Invalid user data")}}}catch(k){console.error("User initialization failed:",k),U(k.message||"Failed to load user")}finally{O(!1)}})()},[o]),w.useEffect(()=>{if(typeof window>"u")return;const x=()=>{if(!P||!F.current)return;const k=F.current.getBoundingClientRect(),$=window.innerWidth,N=window.innerHeight,Y=280,ae=$-k.right,he=k.left;N-k.bottom;const Oe=ae>=Y||ae>he;Z(Oe)};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[P]),w.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const x=N=>{B.current&&!B.current.contains(N.target)&&!F.current?.contains(N.target)&&z(!1)},k=N=>{N.key==="Escape"&&z(!1)},$=()=>{P&&z(!1)};return P&&(document.addEventListener("mousedown",x),document.addEventListener("keydown",k),window.addEventListener("scroll",$)),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",k),window.removeEventListener("scroll",$)}},[P]);const A=t?{surface:"#000000",surfaceElevated:"#000000",surfaceHover:"#262626",border:"#262626",borderLight:"#404040",textPrimary:"#ffffff",textSecondary:"#a3a3a3",textTertiary:"#737373",accent:e,accentHover:`${e}e6`,error:"#ef4444"}:{surface:"#ffffff",surfaceElevated:"#fafafa",surfaceHover:"#f5f5f5",border:"#e5e5e5",borderLight:"#f0f0f0",textPrimary:"#171717",textSecondary:"#525252",textTertiary:"#a3a3a3",accent:e,accentHover:`${e}e6`,error:"#ef4444"},R={wrapper:{position:"relative",display:"inline-block"},avatarButton:{display:"flex",alignItems:"center",gap:I?"6px":"8px",padding:I?"6px 10px 6px 6px":"8px 12px 8px 8px",borderRadius:"24px",backgroundColor:A.surface,cursor:"pointer",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",minWidth:I?"auto":"140px",maxWidth:I?"200px":"none",outline:"none"},avatarImage:{width:I?"28px":"32px",height:I?"28px":"32px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${A.borderLight}`,flexShrink:0},userInfo:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,minWidth:0,overflow:"hidden"},userName:{fontSize:I?"13px":"14px",fontWeight:600,color:A.textPrimary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:I?"80px":"120px"},userEmail:{fontSize:I?"11px":"12px",color:A.textTertiary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:I?"80px":"120px"},chevron:{transition:"transform 0.2s ease",transform:P?"rotate(180deg)":"rotate(0deg)",color:A.textTertiary,flexShrink:0},dropdown:{position:"absolute",top:"100%",marginTop:"8px",[V?"left":"right"]:"0",backgroundColor:A.surfaceElevated,border:`1px solid ${A.border}`,borderRadius:"12px",boxShadow:"0 20px 40px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.1)",width:"min(280px, 90vw)",maxWidth:"calc(100vw - 20px)",padding:"6px 6px 16px 6px",zIndex:1e3,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",opacity:P?1:0,pointerEvents:P?"auto":"none",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",transform:P?"translateY(0) scale(1)":"translateY(-8px) scale(0.95)",overflow:"hidden"},dropdownSection:{padding:I?"10px 12px":"0px 16px","&:last-child":{borderBottom:"none"}},userSection:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"14px":"16px"},dropdownAvatar:{width:I?"40px":"48px",height:I?"40px":"48px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${A.borderLight}`,flexShrink:0},dropdownUserInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0},dropdownUserName:{fontSize:I?"15px":"16px",fontWeight:600,color:A.textPrimary,lineHeight:"1.2",marginBottom:"2px",overflow:"hidden",textOverflow:"ellipsis"},dropdownUserEmail:{fontSize:I?"13px":"14px",color:A.textSecondary,lineHeight:"1.2",overflow:"hidden",textOverflow:"ellipsis"},menuItem:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",color:A.textPrimary,textDecoration:"none",border:"none",background:"none",width:"100%",fontSize:I?"13px":"14px",textAlign:"left",outline:"none"},menuItemText:{flex:1},icon:{width:I?"16px":"18px",height:I?"16px":"18px",color:A.textSecondary,flexShrink:0},logoutButton:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",background:"none",border:"none",width:"100%",fontSize:I?"13px":"14px",color:A.error,textAlign:"left",outline:"none"},loadingText:{padding:I?"16px 12px":"20px 16px",textAlign:"center",color:A.textSecondary,fontSize:I?"13px":"14px"},errorState:{padding:I?"16px 12px":"20px 16px",textAlign:"center",color:A.textSecondary,fontSize:I?"13px":"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexDirection:"column"},retryButton:{marginTop:"8px",padding:"8px 16px",backgroundColor:A.accent,color:"#ffffff",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.2s ease"}},K=async()=>{U(null),O(!0);try{const x=localStorage.getItem("userInfo");if(x){const k=JSON.parse(x);q(k)}else o&&q(o)}catch(x){console.error("Retry failed:",x),U("Invalid user data"),localStorage.removeItem("userInfo"),q(null)}finally{O(!1)}},te=(x,k)=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),k())},G=()=>a||T?.profileUrl,f=()=>{const x=G();x&&window.open(x,"_self","noopener,noreferrer")},E=()=>{l&&window.open(l,"_self","noopener,noreferrer")};return n.jsxs("div",{style:R.wrapper,ref:B,className:i,role:"menu","aria-label":"User menu",children:[s==="classic"?n.jsx("div",{ref:F,onClick:()=>z(x=>!x),onKeyDown:x=>te(x,()=>z(k=>!k)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":P,"aria-label":"Toggle user menu",children:T?.avatarUrl?n.jsx("img",{src:T.avatarUrl,alt:`${T?.name||"User"}'s avatar`,style:{width:I?"34px":"36px",height:I?"34px":"36px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${A.borderLight}`,flexShrink:0},loading:"lazy",onError:x=>{const k=x.target;k.onerror=null,k.src=`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(T?.name||"User")}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(T?.name||"User")}`,alt:"Default user avatar",style:{width:I?"34px":"40px",height:I?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${A.borderLight}`,flexShrink:0},loading:"lazy"})}):n.jsxs("div",{ref:F,style:R.avatarButton,onClick:()=>z(x=>!x),onKeyDown:x=>te(x,()=>z(k=>!k)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":P,"aria-label":"Toggle user menu",onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover,x.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"},onMouseOut:x=>{x.currentTarget.style.backgroundColor=A.surface,x.currentTarget.style.boxShadow="none"},onBlur:x=>{x.currentTarget.style.outline="none"},children:[T?.avatarUrl?n.jsx("img",{src:T.avatarUrl,alt:`${T.name}'s avatar`,style:R.avatarImage,loading:"lazy",onError:x=>{const k=x.target;k.src="https://api.dicebear.com/9.x/glass/svg?seed=Kingston"}}):n.jsx("img",{src:"https://api.dicebear.com/9.x/glass/svg?seed=Kingston",alt:"Default user avatar",style:R.avatarImage,loading:"lazy"}),!I&&n.jsxs("div",{style:R.userInfo,children:[n.jsx("div",{style:R.userName,title:T?.name,children:T?.name||"Guest"}),T?.email&&n.jsx("div",{style:R.userEmail,title:T.email,children:T.email})]}),n.jsx(Fn,{size:I?14:16,style:R.chevron,"aria-hidden":"true"})]}),P&&n.jsx("div",{style:R.dropdown,role:"menu","aria-label":"User options",children:g?n.jsx("div",{style:R.loadingText,role:"status","aria-live":"polite",children:"Loading user information..."}):T?n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:R.userSection,children:[T?.avatarUrl?n.jsx("img",{src:T.avatarUrl,alt:`${T.name}'s profile picture`,style:R.dropdownAvatar,loading:"lazy",onError:x=>{const k=x.target;k.src=`https://api.dicebear.com/9.x/initials/svg?seed=${T.name}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${T.name}`,alt:`${T.name}'s default avatar`,style:R.dropdownAvatar,loading:"lazy"}),n.jsxs("div",{style:R.dropdownUserInfo,children:[n.jsx("div",{style:R.dropdownUserName,title:T.name,children:T.name}),n.jsx("div",{style:R.dropdownUserEmail,title:T.email,children:T.email})]})]}),n.jsxs("div",{style:R.dropdownSection,children:[h&&G()&&n.jsxs("button",{style:R.menuItem,onClick:f,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>te(x,f),role:"menuitem",tabIndex:0,children:[n.jsx(Se,{style:R.icon,"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:b})]}),d&&l&&n.jsxs("button",{style:R.menuItem,onClick:E,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>te(x,E),role:"menuitem",tabIndex:0,children:[n.jsx(Gn,{style:R.icon,"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:y})]}),u&&T.profileUrl&&n.jsxs("a",{href:T.profileUrl,target:"_self",rel:"noopener noreferrer",style:R.menuItem,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},role:"menuitem",tabIndex:0,children:[n.jsx(ce,{style:R.icon,"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:S})]})]}),n.jsx("div",{style:R.dropdownSection,children:n.jsxs("button",{style:R.logoutButton,onClick:r,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>te(x,r),role:"menuitem",tabIndex:0,children:[n.jsx(at,{style:{...R.icon,color:A.error},"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:c})]})})]}):n.jsxs("div",{style:R.errorState,role:"alert",children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(le,{size:16,"aria-hidden":"true"}),n.jsx("span",{children:v||"Not signed in"})]}),v&&v!=="Not signed in"&&n.jsx("button",{style:R.retryButton,onClick:K,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.accentHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor=A.accent},children:"Try Again"})]})})]})},cs=({user:t,darkMode:e=!0,primaryColor:r="#00C212",onVerify:s})=>{const{appId:o,baseUrl:i,apiKey:a}=ue(),[l,h]=w.useState({email:t?.email||"",otp:"",appId:o}),[d,u]=w.useState(!1),[b,y]=w.useState(!1),[S,c]=w.useState(null),j=(g,O)=>{let v=parseInt(g.replace("#",""),16),U=(v>>16)+O,B=(v>>8&255)+O,F=(v&255)+O;return U=Math.min(255,Math.max(0,U)),B=Math.min(255,Math.max(0,B)),F=Math.min(255,Math.max(0,F)),`#${(F|B<<8|U<<16).toString(16).padStart(6,"0")}`},m=e?{surface:"#09090b",surfaceLight:"#27272a",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",border:"#27272a",accent:r,accentHover:j(r,-15),success:j(r,0),warning:"#f59e0b"}:{surface:"#fafafa",surfaceLight:"#f4f4f5",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",border:"#e4e4e7",accent:r,accentHover:j(r,-15),success:j(r,0),warning:"#d97706"};w.useEffect(()=>{t?.email&&h(g=>({...g,email:t.email}))},[t?.email]);const _=(g,O)=>{c({type:g,message:O}),setTimeout(()=>c(null),3e3)},P=async()=>{if(!l.email||!/\S+@\S+\.\S+/.test(l.email)){_("error","Please enter a valid email");return}try{y(!0);const g=await M.post(`${i}/users/send-verify-otp/${t?.id}`,{email:l.email},{headers:{"x-api-key":a,"x-app-id":o}});g.data.success?(_("success",g.data.message||"OTP sent!"),u(!0)):_("error",g.data.message||"Failed to send OTP")}catch(g){_("error",g.response?.data?.message||"Server error")}finally{y(!1)}},z=async g=>{if(g.preventDefault(),!l.email||!l.otp){_("error","Please fill in all fields");return}try{y(!0);const O=await M.post(`${i}/users/verify-email`,l);if(O.data.success&&t){const v={...t,isVerified:!0};s?.(v),_("success",O.data.message||"Email verified!"),u(!1),h({email:t.email,otp:"",appId:o})}else _("error",O.data.message||"Verification failed")}catch(O){_("error",O.response?.data?.message||"Server error")}finally{y(!1)}},T={width:"100%",padding:"12px 12px 12px 40px",borderRadius:8,border:`1px solid ${m.border}`,backgroundColor:m.surfaceLight,color:m.textPrimary,fontSize:14,outline:"none"},q=(g=!1)=>({flex:1,padding:12,borderRadius:8,color:"#fff",fontWeight:500,cursor:g?"not-allowed":"pointer",background:`linear-gradient(to right, ${m.accent}, ${m.accentHover})`,opacity:g?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:8,fontSize:14,border:"none"});return n.jsxs("form",{onSubmit:z,style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",gap:16,backgroundColor:m.surface,padding:24,borderRadius:16,border:`1px solid ${m.border}`},children:[S&&n.jsxs("div",{style:{padding:"12px 20px",borderRadius:12,fontSize:13,fontWeight:500,color:S.type==="success"?m.success:m.warning,border:`1px solid ${S.type==="success"?m.success:m.warning}`,backgroundColor:S.type==="success"?`${m.success}20`:`${m.warning}20`,display:"flex",alignItems:"center",gap:8},children:[S.type==="success"?n.jsx(de,{size:16}):n.jsx(le,{size:16}),S.message]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[n.jsx("label",{style:{color:m.textSecondary},children:"Email"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(ce,{size:18,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",color:m.textTertiary,pointerEvents:"none"}}),n.jsx("input",{type:"email",value:l.email,onChange:g=>h(O=>({...O,email:g.target.value})),placeholder:"Enter your email",style:T,required:!0})]})]}),d&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[n.jsx("label",{style:{color:m.textSecondary},children:"OTP"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(ot,{size:18,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",color:m.textTertiary,pointerEvents:"none"}}),n.jsx("input",{type:"text",value:l.otp,onChange:g=>h(O=>({...O,otp:g.target.value})),placeholder:"Enter OTP",style:T,required:!0})]})]}),n.jsx("div",{style:{display:"flex",gap:12},children:d?n.jsxs("button",{type:"submit",disabled:b,style:q(b),children:[b?n.jsx(oe,{size:16,className:"spinner"}):n.jsx(de,{size:16}),b?"Verifying...":"Verify Email"]}):n.jsxs("button",{type:"button",onClick:P,disabled:b,style:q(b),children:[b?n.jsx(oe,{size:16,className:"spinner"}):n.jsx(it,{size:16}),b?"Sending...":"Send OTP"]})})]})};Q.NeuctraAuthix=On,Q.ReactEmailVerification=cs,Q.ReactSignedIn=rs,Q.ReactSignedOut=ns,Q.ReactUserButton=ds,Q.ReactUserLogin=ts,Q.ReactUserProfile=ls,Q.ReactUserSignUp=Qn,Q.getSdkConfig=ue,Q.setSdkConfig=Zn,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));
|
|
582
|
+
`})]})},ds=({darkMode:t=!0,primaryColor:e="#3b82f6",onLogout:r,varient:s="classic",propUser:a,className:i="",profileUrl:o,settingsUrl:l,showProfileMenuItem:h=!0,showSettingsMenuItem:d=!0,showViewProfileMenuItem:u=!0,profileLabel:b="My Profile",settingsLabel:y="Settings",viewProfileLabel:S="View Profile",logoutLabel:c="Sign Out"})=>{const{baseUrl:j,apiKey:m,appId:_}=ue(),[P,z]=w.useState(!1),[T,q]=w.useState(null),[g,O]=w.useState(!0),[v,U]=w.useState(null),B=w.useRef(null),F=w.useRef(null),[V,Z]=w.useState(!1),[I,J]=w.useState(!1);w.useEffect(()=>{if(typeof window>"u")return;const x=()=>{J(window.innerWidth<768)};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]),w.useEffect(()=>{(async()=>{try{if(O(!0),U(null),a){if(!a.id||!a.name||!a.email)throw new Error("Invalid user data provided");q(a)}else if(typeof window<"u"){const k=localStorage.getItem("userInfo");if(k)try{const $=JSON.parse(k);if(!$.id||!$.name||!$.email)throw new Error("Invalid stored user data");q($)}catch($){console.error("Failed to parse stored user data:",$),localStorage.removeItem("userInfo"),U("Invalid user data")}}}catch(k){console.error("User initialization failed:",k),U(k.message||"Failed to load user")}finally{O(!1)}})()},[a]),w.useEffect(()=>{if(typeof window>"u")return;const x=()=>{if(!P||!F.current)return;const k=F.current.getBoundingClientRect(),$=window.innerWidth,N=window.innerHeight,Y=280,oe=$-k.right,he=k.left;N-k.bottom;const Oe=oe>=Y||oe>he;Z(Oe)};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[P]),w.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const x=N=>{B.current&&!B.current.contains(N.target)&&!F.current?.contains(N.target)&&z(!1)},k=N=>{N.key==="Escape"&&z(!1)},$=()=>{P&&z(!1)};return P&&(document.addEventListener("mousedown",x),document.addEventListener("keydown",k),window.addEventListener("scroll",$)),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",k),window.removeEventListener("scroll",$)}},[P]);const A=t?{surface:"#000000",surfaceElevated:"#000000",surfaceHover:"#262626",border:"#262626",borderLight:"#404040",textPrimary:"#ffffff",textSecondary:"#a3a3a3",textTertiary:"#737373",accent:e,accentHover:`${e}e6`,error:"#ef4444"}:{surface:"#ffffff",surfaceElevated:"#fafafa",surfaceHover:"#f5f5f5",border:"#e5e5e5",borderLight:"#f0f0f0",textPrimary:"#171717",textSecondary:"#525252",textTertiary:"#a3a3a3",accent:e,accentHover:`${e}e6`,error:"#ef4444"},R={wrapper:{position:"relative",display:"inline-block"},avatarButton:{display:"flex",alignItems:"center",gap:I?"6px":"8px",padding:I?"6px 10px 6px 6px":"8px 12px 8px 8px",borderRadius:"24px",backgroundColor:A.surface,cursor:"pointer",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",minWidth:I?"auto":"140px",maxWidth:I?"200px":"none",outline:"none"},avatarImage:{width:I?"28px":"32px",height:I?"28px":"32px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${A.borderLight}`,flexShrink:0},userInfo:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,minWidth:0,overflow:"hidden"},userName:{fontSize:I?"13px":"14px",fontWeight:600,color:A.textPrimary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:I?"80px":"120px"},userEmail:{fontSize:I?"11px":"12px",color:A.textTertiary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:I?"80px":"120px"},chevron:{transition:"transform 0.2s ease",transform:P?"rotate(180deg)":"rotate(0deg)",color:A.textTertiary,flexShrink:0},dropdown:{position:"absolute",top:"100%",marginTop:"8px",[V?"left":"right"]:"0",backgroundColor:A.surfaceElevated,border:`1px solid ${A.border}`,borderRadius:"12px",boxShadow:"0 20px 40px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.1)",width:"min(280px, 90vw)",maxWidth:"calc(100vw - 20px)",padding:"6px 6px 16px 6px",zIndex:1e3,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",opacity:P?1:0,pointerEvents:P?"auto":"none",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",transform:P?"translateY(0) scale(1)":"translateY(-8px) scale(0.95)",overflow:"hidden"},dropdownSection:{padding:I?"10px 12px":"0px 16px","&:last-child":{borderBottom:"none"}},userSection:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"14px":"16px"},dropdownAvatar:{width:I?"40px":"48px",height:I?"40px":"48px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${A.borderLight}`,flexShrink:0},dropdownUserInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0},dropdownUserName:{fontSize:I?"15px":"16px",fontWeight:600,color:A.textPrimary,lineHeight:"1.2",marginBottom:"2px",overflow:"hidden",textOverflow:"ellipsis"},dropdownUserEmail:{fontSize:I?"13px":"14px",color:A.textSecondary,lineHeight:"1.2",overflow:"hidden",textOverflow:"ellipsis"},menuItem:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",color:A.textPrimary,textDecoration:"none",border:"none",background:"none",width:"100%",fontSize:I?"13px":"14px",textAlign:"left",outline:"none"},menuItemText:{flex:1},icon:{width:I?"16px":"18px",height:I?"16px":"18px",color:A.textSecondary,flexShrink:0},logoutButton:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",background:"none",border:"none",width:"100%",fontSize:I?"13px":"14px",color:A.error,textAlign:"left",outline:"none"},loadingText:{padding:I?"16px 12px":"20px 16px",textAlign:"center",color:A.textSecondary,fontSize:I?"13px":"14px"},errorState:{padding:I?"16px 12px":"20px 16px",textAlign:"center",color:A.textSecondary,fontSize:I?"13px":"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexDirection:"column"},retryButton:{marginTop:"8px",padding:"8px 16px",backgroundColor:A.accent,color:"#ffffff",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.2s ease"}},K=async()=>{U(null),O(!0);try{const x=localStorage.getItem("userInfo");if(x){const k=JSON.parse(x);q(k)}else a&&q(a)}catch(x){console.error("Retry failed:",x),U("Invalid user data"),localStorage.removeItem("userInfo"),q(null)}finally{O(!1)}},te=(x,k)=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),k())},G=()=>o||T?.profileUrl,f=()=>{const x=G();x&&window.open(x,"_self","noopener,noreferrer")},E=()=>{l&&window.open(l,"_self","noopener,noreferrer")};return n.jsxs("div",{style:R.wrapper,ref:B,className:i,role:"menu","aria-label":"User menu",children:[s==="classic"?n.jsx("div",{ref:F,onClick:()=>z(x=>!x),onKeyDown:x=>te(x,()=>z(k=>!k)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":P,"aria-label":"Toggle user menu",children:T?.avatarUrl?n.jsx("img",{src:T.avatarUrl,alt:`${T?.name||"User"}'s avatar`,style:{width:I?"34px":"36px",height:I?"34px":"36px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${A.borderLight}`,flexShrink:0},loading:"lazy",onError:x=>{const k=x.target;k.onerror=null,k.src=`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(T?.name||"User")}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(T?.name||"User")}`,alt:"Default user avatar",style:{width:I?"34px":"40px",height:I?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${A.borderLight}`,flexShrink:0},loading:"lazy"})}):n.jsxs("div",{ref:F,style:R.avatarButton,onClick:()=>z(x=>!x),onKeyDown:x=>te(x,()=>z(k=>!k)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":P,"aria-label":"Toggle user menu",onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover,x.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"},onMouseOut:x=>{x.currentTarget.style.backgroundColor=A.surface,x.currentTarget.style.boxShadow="none"},onBlur:x=>{x.currentTarget.style.outline="none"},children:[T?.avatarUrl?n.jsx("img",{src:T.avatarUrl,alt:`${T.name}'s avatar`,style:R.avatarImage,loading:"lazy",onError:x=>{const k=x.target;k.src="https://api.dicebear.com/9.x/glass/svg?seed=Kingston"}}):n.jsx("img",{src:"https://api.dicebear.com/9.x/glass/svg?seed=Kingston",alt:"Default user avatar",style:R.avatarImage,loading:"lazy"}),!I&&n.jsxs("div",{style:R.userInfo,children:[n.jsx("div",{style:R.userName,title:T?.name,children:T?.name||"Guest"}),T?.email&&n.jsx("div",{style:R.userEmail,title:T.email,children:T.email})]}),n.jsx(Fn,{size:I?14:16,style:R.chevron,"aria-hidden":"true"})]}),P&&n.jsx("div",{style:R.dropdown,role:"menu","aria-label":"User options",children:g?n.jsx("div",{style:R.loadingText,role:"status","aria-live":"polite",children:"Loading user information..."}):T?n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:R.userSection,children:[T?.avatarUrl?n.jsx("img",{src:T.avatarUrl,alt:`${T.name}'s profile picture`,style:R.dropdownAvatar,loading:"lazy",onError:x=>{const k=x.target;k.src=`https://api.dicebear.com/9.x/initials/svg?seed=${T.name}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${T.name}`,alt:`${T.name}'s default avatar`,style:R.dropdownAvatar,loading:"lazy"}),n.jsxs("div",{style:R.dropdownUserInfo,children:[n.jsx("div",{style:R.dropdownUserName,title:T.name,children:T.name}),n.jsx("div",{style:R.dropdownUserEmail,title:T.email,children:T.email})]})]}),n.jsxs("div",{style:R.dropdownSection,children:[h&&G()&&n.jsxs("button",{style:R.menuItem,onClick:f,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>te(x,f),role:"menuitem",tabIndex:0,children:[n.jsx(Se,{style:R.icon,"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:b})]}),d&&l&&n.jsxs("button",{style:R.menuItem,onClick:E,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>te(x,E),role:"menuitem",tabIndex:0,children:[n.jsx(Gn,{style:R.icon,"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:y})]}),u&&T.profileUrl&&n.jsxs("a",{href:T.profileUrl,target:"_self",rel:"noopener noreferrer",style:R.menuItem,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},role:"menuitem",tabIndex:0,children:[n.jsx(ce,{style:R.icon,"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:S})]})]}),n.jsx("div",{style:R.dropdownSection,children:n.jsxs("button",{style:R.logoutButton,onClick:r,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>te(x,r),role:"menuitem",tabIndex:0,children:[n.jsx(ot,{style:{...R.icon,color:A.error},"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:c})]})})]}):n.jsxs("div",{style:R.errorState,role:"alert",children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(le,{size:16,"aria-hidden":"true"}),n.jsx("span",{children:v||"Not signed in"})]}),v&&v!=="Not signed in"&&n.jsx("button",{style:R.retryButton,onClick:K,onMouseOver:x=>{x.currentTarget.style.backgroundColor=A.accentHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor=A.accent},children:"Try Again"})]})})]})},cs=({user:t,darkMode:e=!0,primaryColor:r="#00C212",onVerify:s})=>{const{appId:a,baseUrl:i,apiKey:o}=ue(),[l,h]=w.useState({email:t?.email||"",otp:"",appId:a}),[d,u]=w.useState(!1),[b,y]=w.useState(!1),[S,c]=w.useState(null),j=(g,O)=>{let v=parseInt(g.replace("#",""),16),U=(v>>16)+O,B=(v>>8&255)+O,F=(v&255)+O;return U=Math.min(255,Math.max(0,U)),B=Math.min(255,Math.max(0,B)),F=Math.min(255,Math.max(0,F)),`#${(F|B<<8|U<<16).toString(16).padStart(6,"0")}`},m=e?{surface:"#09090b",surfaceLight:"#27272a",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",border:"#27272a",accent:r,accentHover:j(r,-15),success:j(r,0),warning:"#f59e0b"}:{surface:"#fafafa",surfaceLight:"#f4f4f5",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",border:"#e4e4e7",accent:r,accentHover:j(r,-15),success:j(r,0),warning:"#d97706"};w.useEffect(()=>{t?.email&&h(g=>({...g,email:t.email}))},[t?.email]);const _=(g,O)=>{c({type:g,message:O}),setTimeout(()=>c(null),3e3)},P=async()=>{if(!l.email||!/\S+@\S+\.\S+/.test(l.email)){_("error","Please enter a valid email");return}try{y(!0);const g=await M.post(`${i}/users/send-verify-otp/${t?.id}`,{email:l.email},{headers:{"x-api-key":o,"x-app-id":a}});g.data.success?(_("success",g.data.message||"OTP sent!"),u(!0)):_("error",g.data.message||"Failed to send OTP")}catch(g){_("error",g.response?.data?.message||"Server error")}finally{y(!1)}},z=async g=>{if(g.preventDefault(),!l.email||!l.otp){_("error","Please fill in all fields");return}try{y(!0);const O=await M.post(`${i}/users/verify-email`,l);if(O.data.success&&t){const v={...t,isVerified:!0};s?.(v),_("success",O.data.message||"Email verified!"),u(!1),h({email:t.email,otp:"",appId:a})}else _("error",O.data.message||"Verification failed")}catch(O){_("error",O.response?.data?.message||"Server error")}finally{y(!1)}},T={width:"100%",padding:"12px 12px 12px 40px",borderRadius:8,border:`1px solid ${m.border}`,backgroundColor:m.surfaceLight,color:m.textPrimary,fontSize:14,outline:"none"},q=(g=!1)=>({flex:1,padding:12,borderRadius:8,color:"#fff",fontWeight:500,cursor:g?"not-allowed":"pointer",background:`linear-gradient(to right, ${m.accent}, ${m.accentHover})`,opacity:g?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:8,fontSize:14,border:"none"});return n.jsxs("form",{onSubmit:z,style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",gap:16,backgroundColor:m.surface,padding:24,borderRadius:16,border:`1px solid ${m.border}`},children:[S&&n.jsxs("div",{style:{padding:"12px 20px",borderRadius:12,fontSize:13,fontWeight:500,color:S.type==="success"?m.success:m.warning,border:`1px solid ${S.type==="success"?m.success:m.warning}`,backgroundColor:S.type==="success"?`${m.success}20`:`${m.warning}20`,display:"flex",alignItems:"center",gap:8},children:[S.type==="success"?n.jsx(de,{size:16}):n.jsx(le,{size:16}),S.message]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[n.jsx("label",{style:{color:m.textSecondary},children:"Email"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(ce,{size:18,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",color:m.textTertiary,pointerEvents:"none"}}),n.jsx("input",{type:"email",value:l.email,onChange:g=>h(O=>({...O,email:g.target.value})),placeholder:"Enter your email",style:T,required:!0})]})]}),d&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[n.jsx("label",{style:{color:m.textSecondary},children:"OTP"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(at,{size:18,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",color:m.textTertiary,pointerEvents:"none"}}),n.jsx("input",{type:"text",value:l.otp,onChange:g=>h(O=>({...O,otp:g.target.value})),placeholder:"Enter OTP",style:T,required:!0})]})]}),n.jsx("div",{style:{display:"flex",gap:12},children:d?n.jsxs("button",{type:"submit",disabled:b,style:q(b),children:[b?n.jsx(ae,{size:16,className:"spinner"}):n.jsx(de,{size:16}),b?"Verifying...":"Verify Email"]}):n.jsxs("button",{type:"button",onClick:P,disabled:b,style:q(b),children:[b?n.jsx(ae,{size:16,className:"spinner"}):n.jsx(it,{size:16}),b?"Sending...":"Send OTP"]})})]})};Q.NeuctraAuthix=On,Q.ReactEmailVerification=cs,Q.ReactSignedIn=rs,Q.ReactSignedOut=ns,Q.ReactUserButton=ds,Q.ReactUserLogin=ts,Q.ReactUserProfile=ls,Q.ReactUserSignUp=Qn,Q.getSdkConfig=ue,Q.setSdkConfig=Zn,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -304,10 +304,10 @@ export declare class NeuctraAuthix {
|
|
|
304
304
|
* 🔍 Search app data items by dynamic keys
|
|
305
305
|
* @example
|
|
306
306
|
* sdk.searchAppDataByKeys({
|
|
307
|
-
* dataCategory: "
|
|
308
|
-
*
|
|
309
|
-
* status: "
|
|
310
|
-
*
|
|
307
|
+
* dataCategory: "order",
|
|
308
|
+
* buyerId: "user123",
|
|
309
|
+
* status: "Processing",
|
|
310
|
+
* q: "iphone"
|
|
311
311
|
* })
|
|
312
312
|
*/
|
|
313
313
|
searchAppDataByKeys(params: {
|
|
@@ -326,19 +326,13 @@ export declare class NeuctraAuthix {
|
|
|
326
326
|
updateAppData(params: {
|
|
327
327
|
dataId: string;
|
|
328
328
|
data: Record<string, any>;
|
|
329
|
-
}): Promise<
|
|
330
|
-
success: boolean;
|
|
331
|
-
message: string;
|
|
332
|
-
}>;
|
|
329
|
+
}): Promise<AppDataItem>;
|
|
333
330
|
/**
|
|
334
331
|
* Delete an item from app.appData[] by id
|
|
335
332
|
*/
|
|
336
333
|
deleteAppData(params: {
|
|
337
334
|
dataId: string;
|
|
338
|
-
}): Promise<
|
|
339
|
-
success: boolean;
|
|
340
|
-
message: string;
|
|
341
|
-
}>;
|
|
335
|
+
}): Promise<AppDataItem>;
|
|
342
336
|
}
|
|
343
337
|
export {};
|
|
344
338
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/sdk/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,UAAU,mBAAmB;IAC3B,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;GAEG;AACH,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,UAAU,oBAAoB;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,UAAU,gBAAgB;IACxB,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;CACf;AAID;;GAEG;AACH,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,UAAU,uBAAuB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED;;GAEG;AACH,UAAU,oBAAoB;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED;;GAEG;AACH,UAAU,oBAAoB;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB;AAMD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,MAAM,CAAgB;IAE9B;;;OAGG;gBACS,MAAM,EAAE,mBAAmB;IAmBvC;;;;;;OAMG;YACW,OAAO;IA8CrB;;;OAGG;IACG,MAAM,CAAC,MAAM,EAAE,YAAY;IASjC;;;OAGG;IACG,KAAK,CAAC,MAAM,EAAE,WAAW;IAa/B;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE,gBAAgB;IAUzC;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAiBjD;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE,gBAAgB;IASzC;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE,gBAAgB;IAczC;;;OAGG;IACG,aAAa,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAY7D;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAaxE;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAU9D;;;OAGG;IACG,aAAa,CAAC,MAAM,EAAE;QAC1B,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;IAgBD;;;;OAIG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAiBrD,kBAAkB,CAAC,MAAM,EAAE;QAC/B,QAAQ,EAAE,MAAM,CAAC;QACjB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,CAAC,CAAC,EAAE,MAAM,CAAC;KACZ;IAQK,cAAc,CAAC,MAAM,EAAE;QAC3B,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,CAAC,CAAC,EAAE,MAAM,CAAC;KACZ;IASD;;;;;;;;;;OAUG;IACG,oBAAoB,CAAC,MAAM,EAAE;QACjC,MAAM,EAAE,MAAM,CAAC;QACf,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB;IAsBD;;;;;;;;;;OAUG;IACG,wBAAwB,CAAC,MAAM,EAAE;QACrC,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB;IA6BD;;;OAGG;IACG,eAAe;IAOrB;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE,iBAAiB;IAO3C;;;OAGG;IACG,iBAAiB,CAAC,MAAM,EAAE,uBAAuB;IAQvD;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE,iBAAiB;IAc3C;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,oBAAoB;IASjD;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAUjD;;;OAGG;IACG,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,UAAU,mBAAmB;IAC3B,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;GAEG;AACH,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,UAAU,oBAAoB;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,UAAU,gBAAgB;IACxB,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;CACf;AAID;;GAEG;AACH,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,UAAU,uBAAuB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED;;GAEG;AACH,UAAU,oBAAoB;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED;;GAEG;AACH,UAAU,oBAAoB;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB;AAMD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,MAAM,CAAgB;IAE9B;;;OAGG;gBACS,MAAM,EAAE,mBAAmB;IAmBvC;;;;;;OAMG;YACW,OAAO;IA8CrB;;;OAGG;IACG,MAAM,CAAC,MAAM,EAAE,YAAY;IASjC;;;OAGG;IACG,KAAK,CAAC,MAAM,EAAE,WAAW;IAa/B;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE,gBAAgB;IAUzC;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAiBjD;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE,gBAAgB;IASzC;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE,gBAAgB;IAczC;;;OAGG;IACG,aAAa,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAY7D;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAaxE;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAU9D;;;OAGG;IACG,aAAa,CAAC,MAAM,EAAE;QAC1B,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;IAgBD;;;;OAIG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAiBrD,kBAAkB,CAAC,MAAM,EAAE;QAC/B,QAAQ,EAAE,MAAM,CAAC;QACjB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,CAAC,CAAC,EAAE,MAAM,CAAC;KACZ;IAQK,cAAc,CAAC,MAAM,EAAE;QAC3B,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,CAAC,CAAC,EAAE,MAAM,CAAC;KACZ;IASD;;;;;;;;;;OAUG;IACG,oBAAoB,CAAC,MAAM,EAAE;QACjC,MAAM,EAAE,MAAM,CAAC;QACf,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB;IAsBD;;;;;;;;;;OAUG;IACG,wBAAwB,CAAC,MAAM,EAAE;QACrC,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB;IA6BD;;;OAGG;IACG,eAAe;IAOrB;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE,iBAAiB;IAO3C;;;OAGG;IACG,iBAAiB,CAAC,MAAM,EAAE,uBAAuB;IAQvD;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE,iBAAiB;IAc3C;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,oBAAoB;IASjD;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAUjD;;;OAGG;IACG,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAc3D;;OAEG;IACG,gBAAgB,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAcxE;;;;;;;;;OASG;IACG,mBAAmB,CAAC,MAAM,EAAE;QAChC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IA0B1B;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC3B,GAAG,OAAO,CAAC,WAAW,CAAC;IAsBxB;;OAEG;IACG,aAAa,CAAC,MAAM,EAAE;QAC1B,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC3B,GAAG,OAAO,CAAC,WAAW,CAAC;IAexB;;OAEG;IACG,aAAa,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;CAYtE"}
|