@wacht/jsx 0.0.1-alpha.29 → 0.0.1-alpha.30
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/index.cjs.js +76 -76
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1343 -1345
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";var Xl=Object.defineProperty;var Jl=(t,r,o)=>r in t?Xl(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o;var tt=(t,r,o)=>Jl(t,typeof r!="symbol"?r+"":r,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),
|
|
2
|
+
"use strict";var Xl=Object.defineProperty;var Jl=(t,r,o)=>r in t?Xl(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o;var tt=(t,r,o)=>Jl(t,typeof r!="symbol"?r+"":r,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),Fr=require("react-dom"),Ta=require("@wacht/types"),Vi=i.createContext(void 0);function ed({children:t,publicKey:r,adapter:o,uiOverwrites:n}){const[s,a]=i.useState(!0),[h,f]=i.useState(null),c=i.useRef(!1);i.useEffect(()=>{async function d(){if(c.current)return;c.current=!0,a(!0);const[u,g,m]=r.split("_");if(!m)throw new Error("Invalid public key");let v=atob(m),y=g==="test",S=null;if(new URLSearchParams(window.location.search).has("dev_session")){S=new URLSearchParams(window.location.search).get("__dev_session__"),localStorage.setItem("__dev_session__",S??"");const w=new URL(window.location.href);w.searchParams.delete("dev_session"),window.history.replaceState({},"",w.toString())}else S=localStorage.getItem("__dev_session__");let E={};const b=new URLSearchParams;y?b.append("__dev_session__",S??""):E={credentials:"include"};const $=await fetch(`${v}/deployment${y?"?":""}${b.toString()}`,E);if(!$.ok){a(!1);return}const C=await $.json();C.data.backend_host=v,n&&(C.data.ui_settings={...C.data.ui_settings,...n}),f(C.data),y&&$.headers.get("x-development-session")&&localStorage.setItem("__dev_session__",$.headers.get("x-development-session")??""),a(!1)}d()},[r]);const p=i.useMemo(()=>({loading:s,deployment:h,adapter:o}),[s,h,o]);return e.jsx(Vi.Provider,{value:p,children:t})}function ve(){const t=i.useContext(Vi);if(t===void 0)throw new Error("useDeployment must be used within a DeploymentProvider");if(!t.loading&&!t.deployment)throw new Error("Deployment is not loaded");return t}function Ne(){const{deployment:t,loading:r}=ve();return r||!t?{client:()=>Promise.reject(new Error("Deployment is loading")),loading:r}:{client:async(n,s)=>{const a=td(t),h=new Headers(a.headers);s!=null&&s.headers&&new Headers(s.headers).forEach((d,u)=>{h.set(u,d)});const f=new URL(`${t.backend_host??""}${n}`);t.mode==="staging"&&f.searchParams.append("__dev_session__",localStorage.getItem("__dev_session__")??"");const c=await fetch(f,{...a,...s,headers:h});return t.mode==="staging"&&c.headers.get("x-development-session")&&localStorage.setItem("__dev_session__",c.headers.get("x-development-session")??""),c},loading:r}}function td(t){return t.mode==="staging"?{}:{credentials:"include"}}var Yr={exports:{}},sn={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* use-sync-external-store-shim.production.js
|
|
5
5
|
*
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var Ma;function od(){return Ma||(Ma=1,process.env.NODE_ENV!=="production"&&function(){function t(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}function r(m,v){d||s.startTransition===void 0||(d=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var y=v();if(!u){var S=v();a(y,S)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}S=h({inst:{value:y,getSnapshot:v}});var E=S[0].inst,b=S[1];return c(function(){E.value=y,E.getSnapshot=v,o(E)&&b({inst:E})},[m,y,v]),f(function(){return o(E)&&b({inst:E}),m(function(){o(E)&&b({inst:E})})},[m]),p(y),y}function o(m){var v=m.getSnapshot;m=m.value;try{var y=v();return!a(m,y)}catch{return!0}}function n(m,v){return v()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=i,a=typeof Object.is=="function"?Object.is:t,h=s.useState,f=s.useEffect,c=s.useLayoutEffect,p=s.useDebugValue,d=!1,u=!1,g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:r;cn.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:g,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),cn}var La;function nd(){return La||(La=1,process.env.NODE_ENV==="production"?Yr.exports=rd():Yr.exports=od()),Yr.exports}var ad=nd();const Gi=0,Hi=1,qi=2,Aa=3;var Da=Object.prototype.hasOwnProperty;function Yn(t,r){var o,n;if(t===r)return!0;if(t&&r&&(o=t.constructor)===r.constructor){if(o===Date)return t.getTime()===r.getTime();if(o===RegExp)return t.toString()===r.toString();if(o===Array){if((n=t.length)===r.length)for(;n--&&Yn(t[n],r[n]););return n===-1}if(!o||typeof t=="object"){n=0;for(o in t)if(Da.call(t,o)&&++n&&!Da.call(r,o)||!(o in r)||!Yn(t[o],r[o]))return!1;return Object.keys(r).length===n}}return t!==t&&r!==r}const xt=new WeakMap,$t=()=>{},Ge=$t(),Zn=Object,Ce=t=>t===Ge,ct=t=>typeof t=="function",Pt=(t,r)=>({...t,...r}),Yi=t=>ct(t.then),ln={},Zr={},xa="undefined",Br=typeof window!=xa,Qn=typeof document!=xa,sd=Br&&"Deno"in window,id=()=>Br&&typeof window.requestAnimationFrame!=xa,Zi=(t,r)=>{const o=xt.get(t);return[()=>!Ce(r)&&t.get(r)||ln,n=>{if(!Ce(r)){const s=t.get(r);r in Zr||(Zr[r]=s),o[5](r,Pt(s,n),s||ln)}},o[6],()=>!Ce(r)&&r in Zr?Zr[r]:!Ce(r)&&t.get(r)||ln]};let Kn=!0;const cd=()=>Kn,[Xn,Jn]=Br&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[$t,$t],ld=()=>{const t=Qn&&document.visibilityState;return Ce(t)||t!=="hidden"},dd=t=>(Qn&&document.addEventListener("visibilitychange",t),Xn("focus",t),()=>{Qn&&document.removeEventListener("visibilitychange",t),Jn("focus",t)}),ud=t=>{const r=()=>{Kn=!0,t()},o=()=>{Kn=!1};return Xn("online",r),Xn("offline",o),()=>{Jn("online",r),Jn("offline",o)}},pd={isOnline:cd,isVisible:ld},hd={initFocus:dd,initReconnect:ud},Fa=!i.useId,Ar=!Br||sd,fd=t=>id()?window.requestAnimationFrame(t):setTimeout(t,1),dn=Ar?i.useEffect:i.useLayoutEffect,un=typeof navigator<"u"&&navigator.connection,Na=!Ar&&un&&(["slow-2g","2g"].includes(un.effectiveType)||un.saveData),Qr=new WeakMap,gd=t=>Zn.prototype.toString.call(t),pn=(t,r)=>t===`[object ${r}]`;let md=0;const ea=t=>{const r=typeof t,o=gd(t),n=pn(o,"Date"),s=pn(o,"RegExp"),a=pn(o,"Object");let h,f;if(Zn(t)===t&&!n&&!s){if(h=Qr.get(t),h)return h;if(h=++md+"~",Qr.set(t,h),Array.isArray(t)){for(h="@",f=0;f<t.length;f++)h+=ea(t[f])+",";Qr.set(t,h)}if(a){h="#";const c=Zn.keys(t).sort();for(;!Ce(f=c.pop());)Ce(t[f])||(h+=f+":"+ea(t[f])+",");Qr.set(t,h)}}else h=n?t.toJSON():r=="symbol"?t.toString():r=="string"?JSON.stringify(t):""+t;return h},va=t=>{if(ct(t))try{t=t()}catch{t=""}const r=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?ea(t):"",[t,r]};let xd=0;const ta=()=>++xd;async function Qi(...t){const[r,o,n,s]=t,a=Pt({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let h=a.populateCache;const f=a.rollbackOnError;let c=a.optimisticData;const p=g=>typeof f=="function"?f(g):f!==!1,d=a.throwOnError;if(ct(o)){const g=o,m=[],v=r.keys();for(const y of v)!/^\$(inf|sub)\$/.test(y)&&g(r.get(y)._k)&&m.push(y);return Promise.all(m.map(u))}return u(o);async function u(g){const[m]=va(g);if(!m)return;const[v,y]=Zi(r,m),[S,E,b,$]=xt.get(r),C=()=>{const z=S[m];return(ct(a.revalidate)?a.revalidate(v().data,g):a.revalidate!==!1)&&(delete b[m],delete $[m],z&&z[0])?z[0](qi).then(()=>v().data):v().data};if(t.length<3)return C();let w=n,j,x=!1;const I=ta();E[m]=[I,0];const k=!Ce(c),R=v(),_=R.data,O=R._c,P=Ce(O)?_:O;if(k&&(c=ct(c)?c(P,_):c,y({data:c,_c:P})),ct(w))try{w=w(P)}catch(z){j=z,x=!0}if(w&&Yi(w))if(w=await w.catch(z=>{j=z,x=!0}),I!==E[m][0]){if(x)throw j;return w}else x&&k&&p(j)&&(h=!0,y({data:P,_c:Ge}));if(h&&!x)if(ct(h)){const z=h(w,P);y({data:z,error:Ge,_c:Ge})}else y({data:w,error:Ge,_c:Ge});if(E[m][1]=ta(),Promise.resolve(C()).then(()=>{y({_c:Ge})}),x){if(d)throw j;return}return w}}const Ba=(t,r)=>{for(const o in t)t[o][0]&&t[o][0](r)},vd=(t,r)=>{if(!xt.has(t)){const o=Pt(hd,r),n=Object.create(null),s=Qi.bind(Ge,t);let a=$t;const h=Object.create(null),f=(d,u)=>{const g=h[d]||[];return h[d]=g,g.push(u),()=>g.splice(g.indexOf(u),1)},c=(d,u,g)=>{t.set(d,u);const m=h[d];if(m)for(const v of m)v(u,g)},p=()=>{if(!xt.has(t)&&(xt.set(t,[n,Object.create(null),Object.create(null),Object.create(null),s,c,f]),!Ar)){const d=o.initFocus(setTimeout.bind(Ge,Ba.bind(Ge,n,Gi))),u=o.initReconnect(setTimeout.bind(Ge,Ba.bind(Ge,n,Hi)));a=()=>{d&&d(),u&&u(),xt.delete(t)}}};return p(),[t,s,p,a]}return[t,xt.get(t)[4]]},bd=(t,r,o,n,s)=>{const a=o.errorRetryCount,h=s.retryCount,f=~~((Math.random()+.5)*(1<<(h<8?h:8)))*o.errorRetryInterval;!Ce(a)&&h>a||setTimeout(n,f,s)},yd=Yn,[Ki,wd]=vd(new Map),jd=Pt({onLoadingSlow:$t,onSuccess:$t,onError:$t,onErrorRetry:bd,onDiscarded:$t,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Na?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Na?5e3:3e3,compare:yd,isPaused:()=>!1,cache:Ki,mutate:wd,fallback:{}},pd),kd=(t,r)=>{const o=Pt(t,r);if(r){const{use:n,fallback:s}=t,{use:a,fallback:h}=r;n&&a&&(o.use=n.concat(a)),s&&h&&(o.fallback=Pt(s,h))}return o},_d=i.createContext({}),Cd="$inf$",Xi=Br&&window.__SWR_DEVTOOLS_USE__,Sd=Xi?window.__SWR_DEVTOOLS_USE__:[],$d=()=>{Xi&&(window.__SWR_DEVTOOLS_REACT__=i)},zd=t=>ct(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],Ji=()=>Pt(jd,i.useContext(_d)),Ed=t=>(r,o,n)=>t(r,o&&((...a)=>{const[h]=va(r),[,,,f]=xt.get(Ki);if(h.startsWith(Cd))return o(...a);const c=f[h];return Ce(c)?o(...a):(delete f[h],c)}),n),Pd=Sd.concat(Ed),Rd=t=>function(...o){const n=Ji(),[s,a,h]=zd(o),f=kd(n,h);let c=t;const{use:p}=f,d=(p||[]).concat(Pd);for(let u=d.length;u--;)c=d[u](c);return c(s,a||f.fetcher||null,f)},Id=(t,r,o)=>{const n=r[t]||(r[t]=[]);return n.push(o),()=>{const s=n.indexOf(o);s>=0&&(n[s]=n[n.length-1],n.pop())}};$d();const hn=i.use||(t=>{switch(t.status){case"pending":throw t;case"fulfilled":return t.value;case"rejected":throw t.reason;default:throw t.status="pending",t.then(r=>{t.status="fulfilled",t.value=r},r=>{t.status="rejected",t.reason=r}),t}}),fn={dedupe:!0},Td=(t,r,o)=>{const{cache:n,compare:s,suspense:a,fallbackData:h,revalidateOnMount:f,revalidateIfStale:c,refreshInterval:p,refreshWhenHidden:d,refreshWhenOffline:u,keepPreviousData:g}=o,[m,v,y,S]=xt.get(n),[E,b]=va(t),$=i.useRef(!1),C=i.useRef(!1),w=i.useRef(E),j=i.useRef(r),x=i.useRef(o),I=()=>x.current,k=()=>I().isVisible()&&I().isOnline(),[R,_,O,P]=Zi(n,E),z=i.useRef({}).current,T=Ce(h)?Ce(o.fallback)?Ge:o.fallback[E]:h,M=(V,D)=>{for(const le in z){const H=le;if(H==="data"){if(!s(V[H],D[H])&&(!Ce(V[H])||!s(ee,D[H])))return!1}else if(D[H]!==V[H])return!1}return!0},F=i.useMemo(()=>{const V=!E||!r?!1:Ce(f)?I().isPaused()||a?!1:c!==!1:f,D=Y=>{const Z=Pt(Y);return delete Z._k,V?{isValidating:!0,isLoading:!0,...Z}:Z},le=R(),H=P(),ae=D(le),ke=le===H?ae:D(H);let ne=ae;return[()=>{const Y=D(R());return M(Y,ne)?(ne.data=Y.data,ne.isLoading=Y.isLoading,ne.isValidating=Y.isValidating,ne.error=Y.error,ne):(ne=Y,Y)},()=>ke]},[n,E]),G=ad.useSyncExternalStore(i.useCallback(V=>O(E,(D,le)=>{M(le,D)||V()}),[n,E]),F[0],F[1]),L=!$.current,A=m[E]&&m[E].length>0,se=G.data,te=Ce(se)?T&&Yi(T)?hn(T):T:se,U=G.error,K=i.useRef(te),ee=g?Ce(se)?Ce(K.current)?te:K.current:se:te,J=A&&!Ce(U)?!1:L&&!Ce(f)?f:I().isPaused()?!1:a?Ce(te)?!1:c:Ce(te)||c,ie=!!(E&&r&&L&&J),oe=Ce(G.isValidating)?ie:G.isValidating,de=Ce(G.isLoading)?ie:G.isLoading,Q=i.useCallback(async V=>{const D=j.current;if(!E||!D||C.current||I().isPaused())return!1;let le,H,ae=!0;const ke=V||{},ne=!y[E]||!ke.dedupe,Y=()=>Fa?!C.current&&E===w.current&&$.current:E===w.current,Z={isValidating:!1,isLoading:!1},N=()=>{_(Z)},W=()=>{const ye=y[E];ye&&ye[1]===H&&delete y[E]},fe={isValidating:!0};Ce(R().data)&&(fe.isLoading=!0);try{if(ne&&(_(fe),o.loadingTimeout&&Ce(R().data)&&setTimeout(()=>{ae&&Y()&&I().onLoadingSlow(E,o)},o.loadingTimeout),y[E]=[D(b),ta()]),[le,H]=y[E],le=await le,ne&&setTimeout(W,o.dedupingInterval),!y[E]||y[E][1]!==H)return ne&&Y()&&I().onDiscarded(E),!1;Z.error=Ge;const ye=v[E];if(!Ce(ye)&&(H<=ye[0]||H<=ye[1]||ye[1]===0))return N(),ne&&Y()&&I().onDiscarded(E),!1;const re=R().data;Z.data=s(re,le)?re:le,ne&&Y()&&I().onSuccess(le,E,o)}catch(ye){W();const re=I(),{shouldRetryOnError:je}=re;re.isPaused()||(Z.error=ye,ne&&Y()&&(re.onError(ye,E,re),(je===!0||ct(je)&&je(ye))&&(!I().revalidateOnFocus||!I().revalidateOnReconnect||k())&&re.onErrorRetry(ye,E,re,me=>{const Se=m[E];Se&&Se[0]&&Se[0](Aa,me)},{retryCount:(ke.retryCount||0)+1,dedupe:!0})))}return ae=!1,N(),!0},[E,n]),ce=i.useCallback((...V)=>Qi(n,w.current,...V),[]);if(dn(()=>{j.current=r,x.current=o,Ce(se)||(K.current=se)}),dn(()=>{if(!E)return;const V=Q.bind(Ge,fn);let D=0;I().revalidateOnFocus&&(D=Date.now()+I().focusThrottleInterval);const H=Id(E,m,(ae,ke={})=>{if(ae==Gi){const ne=Date.now();I().revalidateOnFocus&&ne>D&&k()&&(D=ne+I().focusThrottleInterval,V())}else if(ae==Hi)I().revalidateOnReconnect&&k()&&V();else{if(ae==qi)return Q();if(ae==Aa)return Q(ke)}});return C.current=!1,w.current=E,$.current=!0,_({_k:b}),J&&(y[E]||(Ce(te)||Ar?V():fd(V))),()=>{C.current=!0,H()}},[E]),dn(()=>{let V;function D(){const H=ct(p)?p(R().data):p;H&&V!==-1&&(V=setTimeout(le,H))}function le(){!R().error&&(d||I().isVisible())&&(u||I().isOnline())?Q(fn).then(D):D()}return D(),()=>{V&&(clearTimeout(V),V=-1)}},[p,d,u,E]),i.useDebugValue(ee),a&&Ce(te)&&E){if(!Fa&&Ar)throw new Error("Fallback data is required when using Suspense in SSR.");j.current=r,x.current=o,C.current=!1;const V=S[E];if(!Ce(V)){const D=ce(V);hn(D)}if(Ce(U)){const D=Q(fn);Ce(ee)||(D.status="fulfilled",D.value=!0),hn(D)}else throw U}return{mutate:ce,get data(){return z.data=!0,ee},get error(){return z.error=!0,U},get isValidating(){return z.isValidating=!0,oe},get isLoading(){return z.isLoading=!0,de}}},Ne=Rd(Td);async function q(t){if(!t.ok){let o=`HTTP ${t.status}: ${t.statusText}`;try{const n=await t.json();n.message?o=n.message:n.errors&&n.errors.length>0&&(o=n.errors[0].message||o)}catch{}throw new Error(o)}return{data:(await t.json()).data}}function ec(t){const{client:r}=Fe(),o=i.useCallback(async()=>{const c=await r(`/api/agent/contexts?token=${encodeURIComponent(t)}`,{method:"GET"});return(await q(c)).data},[r,t]),{data:n,error:s,mutate:a}=Ne(t?`wacht-agent-sessions:${t}`:null,o,{revalidateOnFocus:!1}),h=i.useCallback(async c=>{const p=new FormData;p.append("title",c.title),c.system_instructions&&p.append("system_instructions",c.system_instructions);const d=await r(`/api/agent/contexts?token=${encodeURIComponent(t)}`,{method:"POST",body:p}),u=await q(d);return await a(g=>g&&{...g,data:[u.data,...g.data]}),u.data},[r,t,a]),f=i.useCallback(async c=>{await r(`/api/agent/contexts/${c}/delete?token=${encodeURIComponent(t)}`,{method:"POST"}),await a(p=>p&&{...p,data:p.data.filter(d=>d.id!==c)})},[r,t,a]);return{sessions:(n==null?void 0:n.data)||[],loading:!n&&!s,error:s,createSession:h,deleteSession:f,refetch:async()=>{await a()}}}const tc=i.createContext(void 0);function Ho(){const t=i.useContext(tc);if(!t)throw new Error("useAgentConversationContext must be used within AgentConversationProvider");return t}function Od({children:t,agentName:r,token:o,platformAdapter:n,defaultSessionId:s,onSessionCreated:a,onSessionDeleted:h,onError:f}){const[c,p]=i.useState(s?{id:s,title:"Conversation",status:"idle",last_activity_at:new Date().toISOString(),created_at:new Date().toISOString()}:null),[d,u]=i.useState(!1),{sessions:g,loading:m,error:v,createSession:y,deleteSession:S,refetch:E}=ec(o);i.useEffect(()=>{if(s&&g.length>0){const j=g.find(x=>x.id===s);j&&p(j)}},[s,g]);const b=i.useCallback(j=>{p(j),u(!1)},[]),$=i.useCallback(async j=>{try{const x=j||`Chat ${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}`,I=await y({title:x});return p(I),a==null||a(I),I}catch(x){const I=x instanceof Error?x.message:"Failed to create session";throw f==null||f(I),x}},[y,a,f]),C=i.useCallback(async j=>{try{await S(j),(c==null?void 0:c.id)===j&&p(null),h==null||h(j)}catch(x){const I=x instanceof Error?x.message:"Failed to delete session";throw f==null||f(I),x}},[S,c,h,f]),w={agentName:r,token:o,platformAdapter:n,sessions:g,selectedSession:c,loadingSessions:m,sessionError:v,selectSession:b,createSession:$,deleteSession:C,refreshSessions:E,showHistory:d,setShowHistory:u,onSessionCreated:a,onSessionDeleted:h,onError:f};return e.jsx(tc.Provider,{value:w,children:t})}var rc=(t=>(t.XOauth="x_oauth",t.GithubOauth="github_oauth",t.GitlabOauth="gitlab_oauth",t.GoogleOauth="google_oauth",t.FacebookOauth="facebook_oauth",t.MicrosoftOauth="microsoft_oauth",t.LinkedinOauth="linkedin_oauth",t.DiscordOauth="discord_oauth",t.AppleOauth="apple_oauth",t))(rc||{});function Md(t,r){const o={username:Ld(t,r),email:Ad(t,r),phone:Dd(t,r),email_otp:Fd(t,r),magic_link:Nd(t,r),oauth:Bd(t),generic:Ud(t,r)};return function(s){return o[s]}}function Ld(t,r){return async({username:o,password:n})=>{var f,c;const s=new FormData;s.append("strategy","plain_username"),s.append("username",o),s.append("password",n);const a=await t("/auth/signin",{method:"POST",body:s}),h=await q(a);return"data"in h&&((c=(f=h.data)==null?void 0:f.signin_attempts)!=null&&c.length)&&r(h.data.signin_attempts.at(-1)||null),h}}function Ad(t,r){return async({email:o,password:n})=>{var f,c;const s=new FormData;s.append("strategy","plain_email"),s.append("email",o),s.append("password",n);const a=await t("/auth/signin",{method:"POST",body:s}),h=await q(a);return"data"in h&&((c=(f=h.data)==null?void 0:f.signin_attempts)!=null&&c.length)&&r(h.data.signin_attempts.at(-1)||null),h}}function Dd(t,r){return async({phone:o})=>{var h,f;const n=new FormData;n.append("strategy","phone_otp"),n.append("phone",o);const s=await t("/auth/signin",{method:"POST",body:n}),a=await q(s);return"data"in a&&((f=(h=a.data)==null?void 0:h.signin_attempts)!=null&&f.length)&&r(a.data.signin_attempts.at(-1)||null),a}}function Fd(t,r){return async({email:o})=>{var h,f;const n=new FormData;n.append("strategy","email_otp"),n.append("email",o);const s=await t("/auth/signin",{method:"POST",body:n}),a=await q(s);return"data"in a&&((f=(h=a.data)==null?void 0:h.signin_attempts)!=null&&f.length)&&r(a.data.signin_attempts.at(-1)||null),a}}function Nd(t,r){return async({email:o})=>{var h,f;const n=new FormData;n.append("strategy","magic_link"),n.append("email",o);const s=await t("/auth/signin",{method:"POST",body:n}),a=await q(s);return"data"in a&&((f=(h=a.data)==null?void 0:h.signin_attempts)!=null&&f.length)&&r(a.data.signin_attempts.at(-1)||null),a}}function Bd(t){return async({provider:r,redirectUri:o})=>{const n=new URLSearchParams({provider:r});o&&n.append("redirect_uri",o);const s=await t(`/auth/oauth2/init?${n.toString()}`,{method:"POST"}),a=await q(s);return"data"in a&&a.data.oauth_url&&(window.location.href=a.data.oauth_url),a}}function Ud(t,r){return async({email:o,username:n,password:s,phone:a,strategy:h,token:f})=>{var u,g;const c=new FormData;h&&c.append("strategy",h),o&&c.append("email",o),n&&c.append("username",n),s&&c.append("password",s),a&&c.append("phone",a),f&&c.append("token",f);const p=await t("/auth/signin",{method:"POST",body:c}),d=await q(p);return"data"in d&&((g=(u=d.data)==null?void 0:u.signin_attempts)!=null&&g.length)&&r(d.data.signin_attempts.at(-1)||null),d}}function oc(){const{client:t,loading:r}=Fe(),[o,n]=i.useState(null);return r?{loading:!0,signIn:null,signinAttempt:null,discardSignInAttempt:()=>{n(null)},setSignInAttempt:n}:{loading:!1,signinAttempt:o,signIn:{createStrategy:Md(t,n),completeVerification:async s=>{var c,p;const a=new FormData;a.append("verification_code",s);const h=await t(`/auth/attempt-verification?attempt_identifier=${o==null?void 0:o.id}&identifier_type=signin`,{method:"POST",body:a}),f=await q(h);if("data"in f&&((p=(c=f.data)==null?void 0:c.signin_attempts)!=null&&p.length)){const d=f.data.signin_attempts.at(-1);return n(d||null),f.data}else throw new Error("Verification failed")},prepareVerification:async s=>{var f;const a=new URL("/auth/prepare-verification",window.location.origin);a.searchParams.set("attempt_identifier",((f=o==null?void 0:o.id)==null?void 0:f.toString())||""),a.searchParams.set("strategy",s.strategy),a.searchParams.set("identifier_type","signin"),s.strategy==="phone_otp"&&s.lastDigits?a.searchParams.set("last_digits",s.lastDigits):(s.strategy==="email_otp"&&s.redirectUri||s.strategy==="magic_link"&&s.redirectUri)&&a.searchParams.set("redirect_uri",s.redirectUri);const h=await t(a.pathname+a.search,{method:"POST"});return q(h)},completeProfile:async s=>{var c;if(!o)throw new Error("No signin attempt found");const a=new FormData;for(const[p,d]of Object.entries(s))d&&a.append(p,d);const h=await t(`/auth/complete-profile?attempt_id=${o.id}`,{method:"POST",body:a}),f=await q(h);if("data"in f&&f.data){const p=(c=f.data.signin_attempts)==null?void 0:c.find(d=>d.id===o.id);return p&&n(p),f.data}else throw new Error("Profile completion failed")},identify:async s=>{const a=await t("/auth/identify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identifier:s})});if(!a.ok){const h=await a.json().catch(()=>({}));throw new Error(h.message||"Failed to identify user")}return a.json()},initEnterpriseSso:async(s,a)=>{const h=new URLSearchParams({connection_id:s});a&&h.append("redirect_uri",a);const f=await t(`/auth/sso/login?${h.toString()}`,{method:"POST"});if(!f.ok){const c=await f.json().catch(()=>({}));throw new Error(c.message||"Failed to initiate SSO")}return f.json()}},discardSignInAttempt:()=>{n(null)},setSignInAttempt:n}}function Dr(t){const{loading:r,signIn:o,signinAttempt:n,discardSignInAttempt:s,setSignInAttempt:a}=oc();if(r)return{loading:!0,signIn:null,signinAttempt:null,discardSignInAttempt:s,setSignInAttempt:a};const h=(()=>{switch(t){case"username":return o.createStrategy("username");case"email":return o.createStrategy("email");case"phone":return o.createStrategy("phone");case"email_otp":return o.createStrategy("email_otp");case"magic_link":return o.createStrategy("magic_link");case"oauth":return o.createStrategy("oauth");case"generic":return o.createStrategy("generic");default:throw new Error("Invalid sign-in strategy")}})();return{loading:!1,signinAttempt:n,signIn:{create:h,completeVerification:o.completeVerification,prepareVerification:o.prepareVerification,completeProfile:o.completeProfile,identify:o.identify,initEnterpriseSso:o.initEnterpriseSso},discardSignInAttempt:s,setSignInAttempt:a}}function Wd(t,r,o){return{create:async n=>{var f,c,p;const s=new FormData;for(const[d,u]of Object.entries(n))s.append(d,u);const a=await t("/auth/signup",{method:"POST",body:s}),h=await q(a);return"data"in h&&((c=(f=h.data)==null?void 0:f.signup_attempts)!=null&&c.length)&&o(((p=h.data.signup_attempts)==null?void 0:p.at(-1))||null),h},prepareVerification:async n=>{var h;const s=new URL("/auth/prepare-verification",window.location.origin);s.searchParams.set("attempt_identifier",((h=r==null?void 0:r.id)==null?void 0:h.toString())||""),s.searchParams.set("strategy",n.strategy),s.searchParams.set("identifier_type","signup"),n.strategy==="phone_otp"&&n.lastDigits?s.searchParams.set("last_digits",n.lastDigits):n.strategy==="email_otp"&&n.redirectUri&&s.searchParams.set("redirect_uri",n.redirectUri);const a=await t(s.pathname+s.search,{method:"POST"});return q(a)},completeVerification:async n=>{var f,c;const s=new FormData;s.append("verification_code",n);const a=await t(`/auth/attempt-verification?attempt_identifier=${r==null?void 0:r.id}&identifier_type=signup`,{method:"POST",body:s}),h=await q(a);return"data"in h&&((c=(f=h.data)==null?void 0:f.signup_attempts)!=null&&c.length)&&o(h.data.signup_attempts.at(-1)||null),h},validateDeploymentInvitation:async n=>{try{const s=await t(`/deployment/invitations/validate?token=${encodeURIComponent(n)}`,{method:"GET"}),a=await q(s);return"data"in a&&a.data?a.data:{valid:!1,message:"Failed to validate invitation",error_code:"VALIDATION_ERROR"}}catch(s){return{valid:!1,message:s.message||"Failed to validate invitation",error_code:"NETWORK_ERROR"}}}}}function nc(){const{client:t,loading:r}=Fe(),[o,n]=i.useState(null);return r?{loading:!0,signUp:null,signupAttempt:null,discardSignupAttempt:()=>{n(null)}}:{loading:!1,signupAttempt:o,discardSignupAttempt:()=>{n(null)},signUp:Wd(t,o,n)}}const Ve=()=>{const{adapter:t,deployment:r}=ve(),o=t.useNavigate(),n=(f,c)=>{o?o(f,c):window.location.href=f};return{navigate:n,navigateToSignIn:f=>{if(!r)return;const c=f||window.location.href,p=new URLSearchParams;p.set("redirect_uri",c),(r==null?void 0:r.mode)==="staging"&&p.set("dev_session",localStorage.getItem("__dev_session__")??""),n(`${r.ui_settings.sign_in_page_url}?${p.toString()}`,{replace:!0})},navigateToAccountSelection:f=>{if(!r)return;const c=f||window.location.href,p=new URLSearchParams;p.set("redirect_uri",c),(r==null?void 0:r.mode)==="staging"&&p.set("dev_session",localStorage.getItem("__dev_session__")??""),n(`https://${r.frontend_host}?${p.toString()}`,{replace:!0})},navigateToSignUp:f=>{if(!r)return;const c=f||window.location.href,p=new URLSearchParams;p.set("redirect_uri",c),(r==null?void 0:r.mode)==="staging"&&p.set("dev_session",localStorage.getItem("__dev_session__")??""),n(`${r.ui_settings.sign_up_page_url}?${p.toString()}`,{replace:!0})}}};async function Vd(t){const r=await t("/session",{method:"GET"});return(await q(r)).data}async function Gd(t,r){const o=await t(`/session/switch-sign-in?sign_in_id=${r}`,{method:"POST"});return q(o)}async function Hd(t,r){const o=r?`/session/sign-out?sign_in_id=${r}`:"/session/sign-out",n=await t(o,{method:"POST"});return q(n)}async function qd(t,r){const o=await t(`/session/switch-organization${r?`?organization_id=${r}`:""}`,{method:"POST"});return q(o)}async function Yd(t,r){const o=await t(`/session/switch-workspace?workspace_id=${r}`,{method:"POST"});return q(o)}const ra=new Map,Tr=new Map;function zt(){ra.clear(),Tr.clear()}async function Zd(t,r){const o=await t(`/session/token${r?`?template=${r}`:""}`);return q(o)}function Be(){const{client:t,loading:r}=Fe(),{deployment:o}=ve(),{navigate:n}=Ve(),{cache:s}=Ji(),{data:a,error:h,mutate:f,isLoading:c}=Ne(r?null:"/session",()=>Vd(t),{refreshInterval:3e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,revalidateIfStale:!1,dedupingInterval:5e3}),p=i.useCallback(async()=>{await f(void 0,{revalidate:!0})},[f]),d=i.useCallback(async(u="default")=>{if(!a)throw new Error("no session");const g=ra.get(u);if(g&&g.expires>Date.now())return(g==null?void 0:g.token)||"";Tr.get(u)||Tr.set(u,Zd(t,u));const m=await Tr.get(u);return Tr.delete(u),ra.set(u,m.data),m.data.token},[t,a==null?void 0:a.active_signin]);return r||!a||c?{loading:!0,error:h,session:null,switchSignIn:null,switchOrganization:null,switchWorkspace:null,signOut:null,getToken:null,refetch:p}:{loading:c,error:h,session:a,switchSignIn:async u=>{await Gd(t,u),await f(void 0,{revalidate:!0})},signOut:async u=>{await Hd(t,u);const g=["/session","/user","/me/signins","/me/organization-memberships","/me/workspace-memberships","wacht-notifications:channel-counts"],m=["wacht-notifications:","wacht-agent-sessions:","wacht-agent-contexts:","wacht-org-domains:","wacht-api-workspaces:","wacht-api-organizations:"];if(s instanceof Map){const v=Array.from(s.keys());for(const y of v){let S=!1;(g.includes(y)||typeof y=="string"&&m.some(E=>y.startsWith(E)))&&(S=!0),S&&s.delete(y)}}zt(),await f(void 0,{revalidate:!0}),o!=null&&o.ui_settings&&(u&&o.ui_settings.after_sign_out_one_page_url?n(o.ui_settings.after_sign_out_one_page_url):!u&&o.ui_settings.after_sign_out_all_page_url&&n(o.ui_settings.after_sign_out_all_page_url))},switchOrganization:async u=>{await qd(t,u),zt(),await f(void 0,{revalidate:!0})},switchWorkspace:async u=>{await Yd(t,u),zt(),await f(void 0,{revalidate:!0})},getToken:d,refetch:p}}const qo=()=>{const{organizationMemberships:t,refetch:r,loading:o}=bt(),{client:n}=Fe(),{refetch:s}=Be(),a=i.useCallback(async P=>(await q(await n(`/organizations/${P.id}/roles`,{method:"GET"}))).data,[n]),h=i.useCallback(async P=>(await q(await n(`/organizations/${P.id}/members`,{method:"GET"}))).data,[n]),f=i.useCallback(async P=>(await q(await n(`/organizations/${P.id}/invitations`,{method:"GET"}))).data,[n]),c=i.useCallback(async P=>(await q(await n(`/organizations/${P.id}/domains`,{method:"GET"}))).data,[n]),p=i.useCallback(async(P,z)=>{await n(`/organizations/${P.id}/members/${z.id}/remove`,{method:"POST"}),await r()},[r,n]),d=i.useCallback(async P=>{const z=new FormData;z.append("name",P.name),P.image&&z.append("image",P.image),P.description&&z.append("description",P.description);const T=await q(await n("/organizations",{method:"POST",body:z}));return zt(),await r(),await s(),T},[s,r,n]),u=i.useCallback(async(P,z)=>{const T=Object.entries(z).reduce((F,[G,L])=>(L&&F.append(G,L),F),new FormData),M=await q(await n(`/organizations/${P.id}/update`,{method:"POST",body:T}));return await r(),M},[r,n]),g=i.useCallback(async(P,z)=>{await n(`/organizations/${P.id}/roles/${z.id}/remove`,{method:"POST"})},[n]),m=i.useCallback(async(P,z)=>{const T=new FormData;return T.append("domain",z.fqdn),await q(await n(`/organizations/${P.id}/domains`,{method:"POST",body:T}))},[n]),v=i.useCallback(async(P,z)=>await q(await n(`/organizations/${P.id}/domains/${z.id}/verify`,{method:"POST"})),[n]),y=i.useCallback(async(P,z)=>await q(await n(`/organizations/${P.id}/domains/${z.id}/delete`,{method:"POST"})),[n]),S=i.useCallback(async P=>(await q(await n(`/organizations/${P.id}/enterprise-connections`,{method:"GET"}))).data,[n]),E=i.useCallback(async(P,z)=>{const T=new FormData;return T.append("protocol",z.protocol),T.append("idp_entity_id",z.idp_entity_id),T.append("idp_sso_url",z.idp_sso_url),T.append("idp_certificate",z.idp_certificate),z.domain_id&&T.append("domain_id",z.domain_id),(await q(await n(`/organizations/${P.id}/enterprise-connections`,{method:"POST",body:T}))).data},[n]),b=i.useCallback(async(P,z,T)=>{const M=new FormData;return T.idp_entity_id&&M.append("idp_entity_id",T.idp_entity_id),T.idp_sso_url&&M.append("idp_sso_url",T.idp_sso_url),T.idp_certificate&&M.append("idp_certificate",T.idp_certificate),T.domain_id&&M.append("domain_id",T.domain_id),(await q(await n(`/organizations/${P.id}/enterprise-connections/${z}/update`,{method:"POST",body:M}))).data},[n]),$=i.useCallback(async(P,z)=>{await n(`/organizations/${P.id}/enterprise-connections/${z}/delete`,{method:"POST"})},[n]),C=i.useCallback(async(P,z)=>{const T=new FormData;return T.append("name",z.name),z.permissions&&z.permissions.forEach((F,G)=>{T.append(`permissions[${G}]`,F)}),await q(await n(`/organizations/${P.id}/roles`,{method:"POST",body:T}))},[n]),w=i.useCallback(async P=>(await q(await n(`/organizations/${P.id}/leave`,{method:"POST"}))).data,[n]),j=i.useCallback(async P=>{const z=await q(await n(`/organizations/${P.id}/delete`,{method:"POST"}));return zt(),await r(),await s(),z.data},[n,r,s]),x=i.useCallback(async(P,z,T)=>(await q(await n(`/organizations/${P.id}/members/${z.id}/roles/${T.id}/add`,{method:"POST"}))).data,[n]),I=i.useCallback(async(P,z,T)=>(await q(await n(`/organizations/${P.id}/members/${z.id}/roles/${T.id}/remove`,{method:"POST"}))).data,[n]),k=i.useCallback(async(P,z)=>{var F,G;const T=new FormData;return T.append("email",z.email),T.append("role_id",z.organizationRole.id),(F=z.workspace)!=null&&F.id&&T.append("workspace_id",z.workspace.id),(G=z.workspaceRole)!=null&&G.id&&T.append("workspace_role_id",z.workspaceRole.id),(await q(await n(`/organizations/${P.id}/invitations`,{method:"POST",body:T}))).data},[n]),R=i.useCallback(async(P,z)=>(await q(await n(`/organizations/${P.id}/invitations/${z.id}/remove`,{method:"POST"}))).data,[n]),_=i.useCallback(async(P,z)=>(await q(await n(`/organizations/${P.id}/invitations/${z.id}/resend`,{method:"POST"}))).data,[n]);return{organizations:i.useMemo(()=>t==null?void 0:t.map(P=>P.organization),[t]),loading:o,error:null,refetch:r,leaveOrganization:w,getOrganizationRoles:a,getOrganizationMembers:h,removeOrganizationMember:p,createOrganization:d,getOrganizationInvitations:f,getOrganizationDomains:c,addOrganizationDomain:m,verifyOrganizationDomain:v,removeOrganizationDomain:y,addRoleToOrganizationMember:x,removeRoleFromOrganizationMember:I,inviteOrganizationMember:k,discardOrganizationInvitation:R,resendOrganizationInvitation:_,updateOrganization:u,addRole:C,removeOrganizationRoles:g,deleteOrganization:j,getEnterpriseConnections:S,createEnterpriseConnection:E,updateEnterpriseConnection:b,deleteEnterpriseConnection:$}},qe=()=>{const{loading:t,error:r,refetch:o,getOrganizationMembers:n,getOrganizationRoles:s,leaveOrganization:a,removeOrganizationMember:h,getOrganizationInvitations:f,getOrganizationDomains:c,removeOrganizationDomain:p,addOrganizationDomain:d,verifyOrganizationDomain:u,addRoleToOrganizationMember:g,removeRoleFromOrganizationMember:m,inviteOrganizationMember:v,discardOrganizationInvitation:y,resendOrganizationInvitation:S,updateOrganization:E,removeOrganizationRoles:b,getEnterpriseConnections:$,createEnterpriseConnection:C,updateEnterpriseConnection:w,deleteEnterpriseConnection:j}=qo(),{session:x,error:I,loading:k}=Be(),{organizationMemberships:R}=bt(),_=i.useMemo(()=>{var B;return((B=R==null?void 0:R.find(V=>{var D;return V.id===((D=x==null?void 0:x.active_signin)==null?void 0:D.active_organization_membership_id)}))==null?void 0:B.organization)||null},[R,x]),O=i.useCallback(async B=>_?await E(_,B):[],[_,E]),P=i.useCallback(async()=>_?await n(_):[],[_,n]),z=i.useCallback(async()=>_?await s(_):[],[_,s]),T=i.useCallback(async B=>_?await h(_,B):[],[_,h]),M=i.useCallback(async B=>_?await b(_,B):void 0,[_,b]),F=i.useCallback(async()=>_?await c(_):[],[_,c]),G=i.useCallback(async B=>_?await d(_,B):void 0,[_,d]),L=i.useCallback(async B=>_?await u(_,B):void 0,[_,u]),A=i.useCallback(async B=>_?await p(_,B):void 0,[_,p]),se=i.useCallback(async(B,V)=>_?await g(_,B,V):void 0,[_,g]),te=i.useCallback(async(B,V)=>_?await m(_,B,V):void 0,[_,m]),U=i.useCallback(async B=>_?await v(_,B):void 0,[_,v]),K=i.useCallback(async B=>_?await y(_,B):void 0,[_,y]),ee=i.useCallback(async B=>_?await S(_,B):void 0,[_,S]),J=i.useCallback(async()=>{_&&await a(_)},[_,a]),ie=i.useCallback(async()=>_?await f(_):[],[_,f]),oe=i.useCallback(async()=>_?await $(_):[],[_,$]),de=i.useCallback(async B=>{if(_)return await C(_,B)},[_,C]),Q=i.useCallback(async(B,V)=>{if(_)return await w(_,B,V)},[_,w]),ce=i.useCallback(async B=>{_&&await j(_,B)},[_,j]);return k||t?{activeOrganization:null,loading:!0,error:I||r,updateOrganization:null,getRoles:null,getMembers:null,getDomains:null,addDomain:null,verifyDomain:null,removeDomain:null,removeRole:null,getInvitations:null,removeMember:null,addMemberRole:null,removeMemberRole:null,inviteMember:null,discardInvitation:null,resendInvitation:null,leave:null,getEnterpriseConnections:null,createEnterpriseConnection:null,updateEnterpriseConnection:null,deleteEnterpriseConnection:null}:{activeOrganization:_,loading:!1,refetch:o,getRoles:z,updateOrganization:O,getMembers:P,getDomains:F,addDomain:G,verifyDomain:L,removeDomain:A,getInvitations:ie,removeMember:T,leave:J,removeRole:M,addMemberRole:se,removeMemberRole:te,inviteMember:U,discardInvitation:K,resendInvitation:ee,getEnterpriseConnections:oe,createEnterpriseConnection:de,updateEnterpriseConnection:Q,deleteEnterpriseConnection:ce,error:null}};async function Qd(t){return(await q(await t("/me/organization-memberships"))).data}const bt=()=>{const{client:t,loading:r}=Fe(),{data:o,isLoading:n,error:s,mutate:a}=Ne(r?null:"/me/organization-memberships",()=>Qd(t),{refreshInterval:3e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,revalidateIfStale:!1,dedupingInterval:5e3}),h=i.useCallback(async()=>{await a(void 0,{revalidate:!0})},[a]);return{organizationMemberships:o,loading:r||n,error:s,refetch:h}};async function Kd(t){return(await q(await t("/me/workspace-memberships"))).data}async function Xd(t,r,o){return(await q(await t(`/workspaces/${r}/members/${o}/remove`,{method:"POST"}))).data}const Yo=()=>{const{client:t,loading:r}=Fe(),{deployment:o}=ve(),{data:n,isLoading:s,error:a,mutate:h}=Ne(!r&&(o!=null&&o.b2b_settings.workspaces_enabled)?"/me/workspace-memberships":null,()=>Kd(t),{refreshInterval:3e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,revalidateIfStale:!1,dedupingInterval:5e3}),f=i.useCallback(async()=>{await h(void 0,{revalidate:!0})},[h]);return{workspaceMemberships:n,loading:r||s,error:a,refetch:f}},yt=()=>{const{workspaceMemberships:t,refetch:r,loading:o,error:n}=Yo(),{client:s}=Fe(),a=i.useMemo(()=>t==null?void 0:t.map(b=>({...b.workspace,organization:b.organization,eligibility_restriction:b.eligibility_restriction})),[t]),h=i.useCallback(async(b,$,C,w)=>{const j=new FormData;j.append("name",$),C&&j.append("image",C),w&&j.append("description",w),j.append("organization_id",b);const x=await q(await s("/workspaces",{method:"POST",body:j}));return zt(),await r(),x.data},[s,r]),f=i.useCallback(async(b,$)=>{const C=await Xd(s,b,$);return await r(),C},[s,r]),c=i.useCallback(async(b,$)=>{const C=new FormData;$.name&&C.append("name",$.name),$.description&&C.append("description",$.description),$.image&&C.append("image",$.image),$.enforce_2fa!==void 0&&C.append("enforce_2fa",String($.enforce_2fa)),$.enable_ip_restriction!==void 0&&C.append("enable_ip_restriction",String($.enable_ip_restriction)),$.whitelisted_ips&&$.whitelisted_ips.forEach(j=>C.append("whitelisted_ips",j));const w=await q(await s(`/workspaces/${b.id}/update`,{method:"POST",body:C}));return await r(),w.data},[s,r]),p=i.useCallback(async b=>{const $=await q(await s(`/workspaces/${b.id}/delete`,{method:"POST"}));return zt(),await r(),$.data},[s,r]),d=i.useCallback(async b=>(await q(await s(`/workspaces/${b.id}/members`,{method:"GET"}))).data,[s]),u=i.useCallback(async b=>(await q(await s(`/workspaces/${b.id}/roles`,{method:"GET"}))).data,[s]),g=i.useCallback(async(b,$,C)=>(await q(await s(`/workspaces/${b.id}/roles`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:$,permissions:C})}))).data,[s]),m=i.useCallback(async(b,$)=>(await q(await s(`/workspaces/${b.id}/roles/${$.id}/delete`,{method:"POST"}))).data,[s]),v=i.useCallback(async(b,$,C)=>(await q(await s(`/workspaces/${b.id}/members`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:$,role_id:C})}))).data,[s]),y=i.useCallback(async(b,$)=>{const C=await q(await s(`/workspaces/${b.id}/members/${$}/remove`,{method:"POST"}));return await r(),C.data},[s,r]),S=i.useCallback(async(b,$,C)=>(await q(await s(`/workspaces/${b.id}/members/${$}/roles/${C}/add`,{method:"POST"}))).data,[s]),E=i.useCallback(async(b,$,C)=>(await q(await s(`/workspaces/${b.id}/members/${$}/roles/${C}/remove`,{method:"POST"}))).data,[s]);return{workspaces:a||[],loading:o,error:n,refetch:r,leaveWorkspace:f,createWorkspace:h,updateWorkspace:c,deleteWorkspace:p,getWorkspaceMembers:d,getWorkspaceRoles:u,createWorkspaceRole:g,deleteWorkspaceRole:m,inviteWorkspaceMember:v,removeWorkspaceMember:y,addWorkspaceMemberRole:S,removeWorkspaceMemberRole:E}},Rt=()=>{const{refetch:t,loading:r,error:o,leaveWorkspace:n,updateWorkspace:s,deleteWorkspace:a,getWorkspaceMembers:h,getWorkspaceRoles:f,createWorkspaceRole:c,deleteWorkspaceRole:p,inviteWorkspaceMember:d,removeWorkspaceMember:u,addWorkspaceMemberRole:g,removeWorkspaceMemberRole:m}=yt(),{workspaceMemberships:v}=Yo(),{session:y,loading:S,error:E}=Be(),b=i.useMemo(()=>{var M;return((M=v==null?void 0:v.find(F=>{var G;return F.id===((G=y==null?void 0:y.active_signin)==null?void 0:G.active_workspace_membership_id)}))==null?void 0:M.workspace)||null},[v,y]),$=i.useCallback(async()=>{var M;if(!(!b||!((M=y==null?void 0:y.active_signin)!=null&&M.user_id)))return await n(b.id,y.active_signin.user_id)},[b,n,y]),C=i.useCallback(async M=>{if(b)return await s(b,M)},[b,s]),w=i.useCallback(async()=>{if(b)return await a(b)},[b,a]),j=i.useCallback(async()=>b?await h(b):[],[b,h]),x=i.useCallback(async()=>b?await f(b):[],[b,f]),I=i.useCallback(async(M,F)=>{if(b)return await c(b,M,F)},[b,c]),k=i.useCallback(async M=>{if(b)return await p(b,M)},[b,p]),R=i.useCallback(async(M,F)=>{if(b)return await d(b,M,F)},[b,d]),_=i.useCallback(async M=>{if(b)return await u(b,M)},[b,u]),O=i.useCallback(async(M,F)=>{if(b)return await g(b,M,F)},[b,g]),P=i.useCallback(async(M,F)=>{if(b)return await m(b,M,F)},[b,m]),z=r||S,T=o||E;return z?{activeWorkspace:null,loading:!0,error:T,refetch:t,leave:null,updateWorkspace:null,deleteWorkspace:null,getMembers:null,getRoles:null,createRole:null,deleteRole:null,inviteMember:null,removeMember:null,addMemberRole:null,removeMemberRole:null}:{activeWorkspace:b,loading:!1,error:T,refetch:t,leave:$,updateWorkspace:C,deleteWorkspace:w,getMembers:j,getRoles:x,createRole:I,deleteRole:k,inviteMember:R,removeMember:_,addMemberRole:O,removeMemberRole:P}},Jd=async t=>(await q(await t("/me"))).data,eu=async t=>(await q(await t("/me/signins"))).data;function rr(){const{client:t,loading:r}=Fe(),{data:o,error:n,isLoading:s,mutate:a}=Ne(r?null:"/user",()=>Jd(t)),h=async z=>{const T=new FormData;for(const[F,G]of Object.entries(z))G!=null&&G!==""&&T.append(F,String(G));const M=await q(await t("/me",{method:"POST",body:T}));return a(),M},f=async()=>await q(await t("/me/email-addresses",{method:"GET"})),c=async z=>await q(await t(`/me/email-addresses/${z}`,{method:"GET"})),p=async z=>{const T=new FormData;return T.append("email",z),await q(await t("/me/email-addresses",{method:"POST",body:T}))},d=async z=>await q(await t(`/me/email-addresses/${z}/delete`,{method:"POST"})),u=async z=>await q(await t(`/me/email-addresses/${z}/prepare-verification`,{method:"POST"})),g=async(z,T)=>await q(await t(`/me/email-addresses/${z}/attempt-verification?code=${T}`,{method:"POST"})),m=async(z,T)=>{const M=new FormData;return M.append("phone_number",z),M.append("country_code",T),await q(await t("/me/phone-numbers",{method:"POST",body:M}))},v=async z=>await q(await t(`/me/phone-numbers/${z}/delete`,{method:"POST"})),y=async z=>await q(await t(`/me/phone-numbers/${z}/prepare-verification`,{method:"POST"})),S=async(z,T)=>{const M=new FormData;return M.append("code",T),await q(await t(`/me/phone-numbers/${z}/attempt-verification`,{method:"POST",body:M}))},E=async z=>{const T=await q(await t(`/me/phone-numbers/${z}/make-primary`,{method:"POST"}));return a(),T},b=async z=>await q(await t(`/me/email-addresses/${z}/make-primary`,{method:"POST"})),$=async()=>(await q(await t("/me/authenticator",{method:"POST"}))).data,C=async(z,T)=>{const M=new FormData;return M.append("authenticator_id",z),T.forEach(G=>{M.append("codes",G)}),await q(await t("/me/authenticator/attempt-verification",{method:"POST",body:M}))},w=async z=>await q(await t(`/me/authenticator/${z}/delete`,{method:"POST"})),j=async()=>(await q(await t("/me/backup-codes",{method:"POST"}))).data,x=async z=>{const T=new FormData;return T.append("file",z),await q(await t("/me/profile-picture",{method:"POST",body:T}))},I=async()=>(await q(await t("/me/backup-codes/regenerate",{method:"POST"}))).data,k=async(z,T)=>{const M=new FormData;return M.append("current_password",z),M.append("new_password",T),await q(await t("/me/update-password",{method:"POST",body:M}))},R=async z=>{const T=new FormData;T.append("current_password",z);const M=await q(await t("/me/remove-password",{method:"POST",body:T}));return a(),M},_=async z=>{const T=new FormData;return T.append("password",z),await q(await t("/me/account/delete",{method:"POST",body:T}))},O=async z=>await q(await t(`/me/social-connections/${z}/disconnect`,{method:"POST"})),P=async({provider:z,redirectUri:T})=>{var G;const M=new URLSearchParams({provider:z});T&&M.append("redirect_uri",T);const F=await q(await t(`/me/init-sso-connection?${M.toString()}`,{method:"POST"}));return"data"in F&&((G=F.data)!=null&&G.oauth_url)&&window.open(F.data.oauth_url,"_blank"),F};return{user:{...o,refetch:a},loading:r||s,error:n||null,updateProfile:h,getEmailAddresses:f,getEmailAddress:c,createEmailAddress:p,deleteEmailAddress:d,prepareEmailVerification:u,attemptEmailVerification:g,makeEmailPrimary:b,createPhoneNumber:m,deletePhoneNumber:v,preparePhoneVerification:y,attemptPhoneVerification:S,makePhonePrimary:E,setupAuthenticator:$,verifyAuthenticator:C,deleteAuthenticator:w,generateBackupCodes:j,regenerateBackupCodes:I,updateProfilePicture:x,disconnectSocialConnection:O,connectSocialAccount:P,updatePassword:k,removePassword:R,deleteAccount:_}}function ac(){const{client:t,loading:r}=Fe(),{data:o,error:n,isLoading:s,mutate:a}=Ne(r?null:"/me/signins",()=>eu(t));return{signins:o,error:n||null,removeSignin:async f=>await q(await t(`/me/signins/${f}/signout`,{method:"POST"})),refetch:a,loading:s||r}}function tu(){const{session:t,loading:r}=Be(),{loading:o,organizationMemberships:n}=bt(),{loading:s,workspaceMemberships:a}=Yo();if(r||o||s)return{loading:!0,orgMembership:null,workspaceMembership:null};const h=i.useMemo(()=>!t||!t.signins||t.signins.length===0?null:n==null?void 0:n.find(c=>{var p;return c.id===((p=t.active_signin)==null?void 0:p.active_organization_membership_id)}),[t]),f=i.useMemo(()=>!t||!t.signins||t.signins.length===0?null:a==null?void 0:a.find(c=>{var p;return c.id===((p=t.active_signin)==null?void 0:p.active_workspace_membership_id)}),[t]);return{loading:!1,orgMembership:h,workspaceMembership:f}}function sc(){const{client:t,loading:r}=Fe(),[o,n]=i.useState(!1),s=async a=>{n(!0);try{const h=new FormData;for(const[p,d]of Object.entries(a))d&&h.append(p,d);const f=await t("/waitlist/join",{method:"POST",body:h});return await q(f)}finally{n(!1)}};return r?{loading:!0,joinWaitlist:null}:{loading:o,joinWaitlist:s}}function ic(){const{client:t,loading:r}=Fe(),[o,n]=i.useState(!1),[s,a]=i.useState(null),[h,f]=i.useState(null),[c,p]=i.useState(null),[d,u]=i.useState(!1),[g,m]=i.useState(null);i.useEffect(()=>{if(d||r)return;const y=new URLSearchParams(window.location.search),S=y.get("code"),E=y.get("state"),b=y.get("error"),$=y.get("error_description");if(!S&&!b){u(!0);const C=new Error("No OAuth callback data found.");a(C);return}if(u(!0),n(!0),b){const C=$||b,w=new Error(`OAuth Error: ${C}`);a(w),n(!1);return}if(S&&E)v(S,E);else{const C=new Error("Missing required OAuth parameters");a(C),n(!1)}},[d,r]);const v=async(y,S)=>{try{let E,b;try{const w=S.split(".");if(w.length!==2)throw new Error("Invalid OAuth state format - missing signature");const j=w[0].replace(/-/g,"+").replace(/_/g,"/"),x=j.length%4?"=".repeat(4-j.length%4):"",k=atob(j+x).split("|")[0];if(k==="sign_in")E="/auth/oauth2/callback",b="GET";else if(k==="connect_social")E="/me/sso-connection-callback",b="POST";else throw new Error(`Unknown OAuth action: ${k}`)}catch(w){const j=w instanceof Error?w:new Error("Failed to parse OAuth state");a(new Error(`Invalid OAuth callback: ${j.message}. The authorization link may be expired or malformed. Please try signing in again.`)),n(!1);return}const $=await t(`${E}?code=${encodeURIComponent(y)}&state=${encodeURIComponent(S)}`,{method:b}),C=await q($);if("data"in C){const w=C.data.session,j=C.data.redirect_uri||null;if(f(w),p(j),w.signin_attempts&&w.signin_attempts.length>0){const x=w.signin_attempts.at(-1);x&&m(x)}}else{const w=new Error("SSO callback failed");a(w)}}catch(E){const b=E instanceof Error?E:new Error("Unknown error occurred");a(b)}finally{n(!1)}};return{loading:o,error:s,session:h,redirectUri:c,processed:d,signinAttempt:g}}function cc(){const{client:t,loading:r}=Fe(),[o,n]=i.useState(!1),[s,a]=i.useState(null);return{loading:r||o,verifyMagicLink:async f=>{if(!f.token||!f.attempt)throw new Error("Invalid magic link parameters");n(!0),a(null);try{const c=new URL("/auth/verify-magic-link",window.location.origin);c.searchParams.set("token",f.token),c.searchParams.set("attempt",f.attempt),f.redirectUri&&c.searchParams.set("redirect_uri",f.redirectUri);const p=await t(c.pathname+c.search,{method:"GET"}),d=await q(p);return n(!1),a(!0),d}catch(c){throw n(!1),a(!1),c}},success:s}}function lc(){const[t,r]=i.useState({});return i.useEffect(()=>{const o=new URLSearchParams(window.location.search);r({token:o.get("token")||void 0,attempt:o.get("attempt")||void 0,redirectUri:o.get("redirect_uri")||void 0})},[]),t}function dc(){const{client:t,loading:r}=Fe();return{loading:r,forgotPassword:async a=>{const h=new FormData;h.append("email",a);const f=await t("/auth/forgot-password",{method:"POST",body:h});return await q(f)},verifyOtp:async(a,h)=>{const f=new FormData;f.append("email",a),f.append("otp",h);const c=await t("/auth/forgot-password",{method:"POST",body:f});return await q(c)},resetPassword:async(a,h)=>{const f=new FormData;f.append("token",a),f.append("password",h);const c=await t("/auth/reset-password",{method:"POST",body:f});return await q(c)}}}function uc({enabled:t=!0,channels:r,organizationIds:o,workspaceIds:n,onNotification:s,onError:a,reconnectDelay:h=1e3,maxReconnectAttempts:f=5}={}){const{session:c,loading:p}=Be(),{deployment:d,loading:u}=ve(),[g,m]=i.useState(!1),[v,y]=i.useState(null),S=i.useRef(null),E=i.useRef(null),b=i.useRef(0),$=i.useRef(null),C=i.useRef(s),w=i.useRef(a),j=i.useRef(r),x=i.useRef(o),I=i.useRef(n),k=i.useRef(h),R=i.useRef(f);C.current=s,w.current=a,j.current=r,x.current=o,I.current=n,k.current=h,R.current=f;const _=i.useCallback(()=>{E.current&&(clearTimeout(E.current),E.current=null),$.current&&(clearInterval($.current),$.current=null),S.current&&(S.current.close(),S.current=null)},[]),O=i.useCallback(async()=>{var G;if(!t||p||u||!c||!d)return;_();const T=new URL(d.backend_host),M=T.protocol==="https:"?"wss:":"ws:",F=new URL("/realtime/notifications",`${M}//${T.host}`);if(d.mode==="staging"){const L=localStorage.getItem("__dev_session__");L&&F.searchParams.set("__dev_session__",L)}j.current&&j.current.length>0&&j.current.forEach(L=>F.searchParams.append("channels",L)),x.current&&x.current.length>0&&x.current.forEach(L=>F.searchParams.append("organization_ids",L.toString())),I.current&&I.current.length>0&&I.current.forEach(L=>F.searchParams.append("workspace_ids",L.toString()));try{const L=new WebSocket(F.toString());S.current=L,L.onopen=()=>{m(!0),y(null),b.current=0,$.current=setInterval(()=>{L.readyState===WebSocket.OPEN&&L.send("ping")},3e4)},L.onmessage=A=>{var se,te;try{const U=JSON.parse(A.data);if(U.type==="notification"&&U.data)(se=C.current)==null||se.call(C,U.data);else if(U.type==="error"){const K=U.error||"Unknown error occurred";y(K),(te=w.current)==null||te.call(w,K)}else U.type}catch{}},L.onerror=()=>{var A;y("Connection error occurred"),(A=w.current)==null||A.call(w,"Connection error occurred")},L.onclose=A=>{var se;if(m(!1),$.current&&(clearInterval($.current),$.current=null),t&&A.code!==1e3&&b.current<R.current){b.current++;const te=k.current*Math.pow(2,b.current-1);E.current=setTimeout(()=>{O()},te)}else b.current>=R.current&&(y("Max reconnection attempts reached"),(se=w.current)==null||se.call(w,"Max reconnection attempts reached"))}}catch{y("Failed to connect"),(G=w.current)==null||G.call(w,"Failed to connect")}},[t,p,u,c,d,_]);i.useEffect(()=>(O(),()=>{_()}),[O,_]),i.useEffect(()=>{S.current&&S.current.readyState===WebSocket.OPEN&&O()},[r,o,n,O]);const P=i.useCallback(()=>{_(),m(!1)},[_]),z=i.useCallback(()=>{b.current=0,O()},[O]);return{isConnected:g,connectionError:v,disconnect:P,reconnect:z}}async function ru(t,r){const o=new URLSearchParams;r&&(r.limit&&o.append("limit",r.limit.toString()),r.offset&&o.append("offset",r.offset.toString()),r.channels&&r.channels.forEach(h=>o.append("channels",h)),r.organization_ids&&r.organization_ids.forEach(h=>o.append("organization_ids",h.toString())),r.workspace_ids&&r.workspace_ids.forEach(h=>o.append("workspace_ids",h.toString())),r.is_read!==void 0&&o.append("is_read",r.is_read.toString()),r.is_archived!==void 0&&o.append("is_archived",r.is_archived.toString()),r.severity&&o.append("severity",r.severity));const n=`/notifications${o.toString()?"?"+o.toString():""}`,s=await t(n,{method:"GET"});return(await q(s)).data}async function ou(t){const r=await t("/notifications/channel-counts",{method:"GET"});return(await q(r)).data}async function nu(t,r){const o=await t(`/notifications/${r}/read`,{method:"POST"});return q(o)}async function au(t){const r=await t("/notifications/mark-all-read",{method:"POST"});return q(r)}async function su(t,r){const o=await t(`/notifications/${r}/delete`,{method:"POST"});return q(o)}function pc(t){const{client:r,loading:o}=Fe(),{data:n,error:s,mutate:a,isLoading:h}=Ne(o?null:`wacht-notifications:${JSON.stringify(t)}`,()=>ru(r,t),{refreshInterval:6e4,revalidateOnFocus:!0});uc({enabled:!o&&!!n,onNotification:i.useCallback(u=>{a(async g=>!g||g.notifications.some(v=>v.id===u.id.toString())?g:{...g,notifications:[{id:u.id.toString(),user_id:u.user_id.toString(),deployment_id:u.deployment_id.toString(),title:u.title,body:u.body,severity:u.severity,action_url:u.action_url,action_label:u.action_label,is_read:!1,is_archived:!1,created_at:u.created_at,updated_at:u.created_at},...g.notifications],unread_count:g.unread_count+1,total:g.total+1},!1)},[a]),onError:i.useCallback(()=>{},[])});const f=i.useCallback(async u=>{o||(await a(async g=>g&&{...g,notifications:g.notifications.map(m=>m.id===u?{...m,is_read:!0}:m),unread_count:Math.max(0,g.unread_count-1)},!1),await nu(r,u),await a())},[r,o,a]),c=i.useCallback(async()=>{o||(await a(async u=>u&&{...u,notifications:u.notifications.map(g=>({...g,is_read:!0})),unread_count:0},!1),await au(r),await a())},[r,a]),p=i.useCallback(async u=>{o||(await a(async g=>{if(!g)return g;const m=g.notifications.find(v=>v.id===u);return{...g,notifications:g.notifications.filter(v=>v.id!==u),unread_count:m&&!m.is_read?Math.max(0,g.unread_count-1):g.unread_count,total:Math.max(0,g.total-1)}},!1),await su(r,u),await a())},[r,o,a]),d=i.useCallback(async()=>{await a()},[a]);return!n||o||h?{loading:!0,notifications:void 0,unreadCount:void 0,unreadCounts:void 0,channels:void 0,hasMore:void 0,markAsRead:void 0,markAllAsRead:void 0,deleteNotification:void 0,error:s,refetch:d}:{loading:!1,error:s,notifications:n.notifications,unreadCount:n.unread_count,unreadCounts:n.unread_counts,channels:n.channels,hasMore:n.has_more,markAsRead:f,markAllAsRead:c,deleteNotification:p,refetch:d}}async function iu(t){const r=await t("/notifications/channel-counts",{method:"GET"});return(await q(r)).data}function cu(){const{client:t,loading:r}=Fe(),{data:o,error:n,mutate:s}=Ne(r?null:"wacht-notifications:channel-counts",()=>iu(t),{refreshInterval:3e4,revalidateOnFocus:!0}),a=async()=>{await s()};return!o||r?{loading:!0,counts:void 0,error:n,refetch:a}:{loading:!1,counts:o,error:n,refetch:a}}const Ht=class Ht{constructor(){tt(this,"ws",null);tt(this,"messageHandlers",new Set);tt(this,"connectionStateHandlers",new Set);tt(this,"reconnectTimer",null);tt(this,"reconnectAttempts",0);tt(this,"url",null);tt(this,"isIntentionalDisconnect",!1);tt(this,"sessionMessages",{});tt(this,"currentSessionKey",null)}static getInstance(){return Ht.instance||(Ht.instance=new Ht),Ht.instance}connect(r){var o,n;if(this.url=r,this.isIntentionalDisconnect=!1,((o=this.ws)==null?void 0:o.readyState)===WebSocket.OPEN&&this.url===r){this.notifyConnectionState({isConnected:!0});return}((n=this.ws)==null?void 0:n.readyState)!==WebSocket.CONNECTING&&this.createConnection()}createConnection(){if(this.url)try{this.ws=new WebSocket(this.url),this.ws.onopen=()=>{this.reconnectAttempts=0,this.notifyConnectionState({isConnected:!0})},this.ws.onmessage=r=>{try{const o=JSON.parse(r.data);this.notifyMessageHandlers(o)}catch{}},this.ws.onerror=()=>{this.notifyConnectionState({isConnected:!1,error:"Connection error"})},this.ws.onclose=()=>{this.ws=null,this.notifyConnectionState({isConnected:!1}),this.isIntentionalDisconnect||this.scheduleReconnect()}}catch(r){this.notifyConnectionState({isConnected:!1,error:r instanceof Error?r.message:"Failed to connect"})}}scheduleReconnect(){this.reconnectAttempts++;const r=Math.min(1e3*Math.pow(2,this.reconnectAttempts-1),3e4),o=Math.random()*.3*r,n=Math.floor(r+o);this.reconnectTimer=setTimeout(()=>{this.createConnection()},n)}disconnect(){this.isIntentionalDisconnect=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.close(),this.ws=null)}send(r){var o;if(((o=this.ws)==null?void 0:o.readyState)===WebSocket.OPEN){const n=JSON.stringify(r);this.ws.send(n)}}onMessage(r){return this.messageHandlers.add(r),()=>{this.messageHandlers.delete(r)}}onConnectionStateChange(r){var o;return this.connectionStateHandlers.add(r),r({isConnected:((o=this.ws)==null?void 0:o.readyState)===WebSocket.OPEN}),()=>{this.connectionStateHandlers.delete(r)}}notifyMessageHandlers(r){this.messageHandlers.forEach(o=>{try{o(r)}catch{}})}notifyConnectionState(r){this.connectionStateHandlers.forEach(o=>{try{o(r)}catch{}})}isConnected(){var r;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN}setCurrentSession(r){this.currentSessionKey=r,this.sessionMessages[r]||(this.sessionMessages[r]=[])}addMessage(r){this.currentSessionKey&&(this.sessionMessages[this.currentSessionKey]||(this.sessionMessages[this.currentSessionKey]=[]),this.sessionMessages[this.currentSessionKey].push(r))}getSessionMessages(r){return this.sessionMessages[r]||[]}clearSessionMessages(r){this.sessionMessages[r]&&(this.sessionMessages[r]=[])}};tt(Ht,"instance");let oa=Ht;const Qe=oa.getInstance(),mt={DISCONNECTED:"disconnected",CONNECTING:"connecting",CONNECTED:"connected",ERROR:"error"},Ae={IDLE:"idle",STARTING:"starting",RUNNING:"running",WAITING_FOR_INPUT:"waiting_for_input",COMPLETED:"completed",FAILED:"failed"},Ot={IDLE:"Idle",STARTING:"Starting",RUNNING:"Running",WAITING_FOR_INPUT:"WaitingForInput",COMPLETED:"Completed",FAILED:"Failed",CANCELLED:"Cancelled"};function Ua(t){switch(t){case Ot.IDLE:return Ae.IDLE;case Ot.STARTING:return Ae.STARTING;case Ot.RUNNING:return Ae.RUNNING;case Ot.WAITING_FOR_INPUT:return Ae.WAITING_FOR_INPUT;case Ot.COMPLETED:return Ae.COMPLETED;case Ot.FAILED:case Ot.CANCELLED:return Ae.FAILED;default:return Ae.IDLE}}function Wa(t){return t===Ae.STARTING||t===Ae.RUNNING||t===Ae.WAITING_FOR_INPUT}function hc({contextId:t,agentName:r,token:o,platformAdapter:n,autoConnect:s=!0}){const{deployment:a}=ve(),{client:h}=Fe(),[f,c]=i.useState([]),[p,d]=i.useState(null),[u,g]=i.useState(null),[m,v]=i.useState(!1),[y,S]=i.useState(!1),[E,b]=i.useState(Ae.IDLE),[$,C]=i.useState({status:mt.DISCONNECTED}),[w,j]=i.useState(!0),[x,I]=i.useState(!1),k=i.useRef(null),R=i.useRef(null),_=i.useCallback(U=>{var K,ee;switch(U.message_type){case"session_connected":if(v(!0),C({status:mt.CONNECTED}),(K=U.data)!=null&&K.execution_status){const ie=U.data.execution_status,oe=Ua(ie);b(oe),S(Wa(oe))}break;case"conversation_message":O(U.data);break;case"user_input_request":P(U.data);break;case"platform_event":z(U.data);break;case"platform_function":T(U.data);break;case"execution_complete":S(!1),b(Ae.IDLE),R.current=null;break;case"execution_error":S(!1),b(Ae.FAILED),R.current=null;break;case"execution_cancelled":S(!1),b(Ae.IDLE),R.current=null;break;case"execution_status":const J=(ee=U.data)==null?void 0:ee.status;if(J){const ie=Ua(J);b(ie),S(Wa(ie))}break}},[p]),O=i.useCallback(U=>{var oe,de,Q,ce,B,V,D,le;const{id:K,message_type:ee,content:J}=U,ie=H=>f.some(ae=>ae.id===H);if(ee==="system_decision"||ee==="action_execution_result"||ee==="assistant_task_breakdown"||ee==="assistant_validation"||ee==="assistant_action_planning"||ee==="context_results"){d(null),g(null);let H="";if(ee==="system_decision"){const ae=J==null?void 0:J.step,ke=J==null?void 0:J.reasoning;if(ae==="gathercontext")ke&&ke.length>0?H=ke.length>60?`${ke.substring(0,60)}...`:ke:H="Gathering context...";else if(ae==="executeaction")H="Executing action";else if(ae==="deliverresponse")H="Preparing response";else if(ae==="taskplanning")H="Planning approach";else if(ae==="validateprogress")H="Validating progress";else if(ae==="acknowledge")H="Processing request";else if(ae==="finishplanning")H="Finalizing plan";else if(ae==="executetasks")H="Executing tasks";else if(ae==="requestuserinput")H="Waiting for input";else if(ae==="complete")H="Completed";else if(ae==="examinetool")H="Examining tool";else if(ae==="examineworkflow")H="Examining workflow";else{const ne=(J==null?void 0:J.confidence)||.5;ne>.8?H="Analyzing":ne>.6?H="Thinking":H="Reasoning"}}else if(ee==="action_execution_result")((oe=J.task_execution)==null?void 0:oe.status)==="completed"?H="Task execution completed":(de=J.task_execution)!=null&&de.approach?H=J.task_execution.approach:H="Executing task";else if(ee==="assistant_task_breakdown")(Q=J.task_breakdown)!=null&&Q.total_tasks?H=`Identified ${J.task_breakdown.total_tasks} tasks`:H="Planning tasks";else if(ee==="assistant_validation")H="Validated results";else if(ee==="assistant_action_planning")(ce=J.task_execution)!=null&&ce.total_tasks?H=`Planned ${J.task_execution.total_tasks} tasks`:(V=(B=J.task_execution)==null?void 0:B.tasks)!=null&&V.length?H=`Planned ${J.task_execution.tasks.length} tasks`:H="Planning actions";else if(ee==="context_results"){const ae=J.query,ke=J.result_count||0;ae&&ae!=="General context gathering"?H=`${ae}: Found ${ke} results`:H=`Found ${ke} results`}H&&!ie(K)&&c(ae=>[...ae,{id:K,role:"system",content:H,timestamp:new Date,metadata:{type:"log",messageType:ee}}]);return}if(ee==="user_message")ie(K)||(d(null),g(null),c(H=>[...H,{id:K,role:"user",content:J.message,images:J.images,timestamp:new Date}]));else if(ee==="agent_response")ie(K)||(d(null),g(null),S(!1),b(Ae.IDLE),R.current=null,c(H=>[...H,{id:K,role:"assistant",content:J.response,timestamp:new Date,isStreaming:!1}]));else if(ee==="assistant_acknowledgment")ie(K)||(d(null),g(null),c(H=>[...H,{id:K,role:"assistant",content:J.acknowledgment_message,timestamp:new Date}]));else if(ee==="assistant_ideation"||ee==="assistant_action_planning"||ee==="action_execution_result"||ee==="assistant_validation"||ee==="assistant_context_gathering"||ee==="assistant_task_breakdown"){let H="";if(J.reasoning_summary)H=J.reasoning_summary;else if((D=J.task_execution)!=null&&D.approach)H=J.task_execution.approach;else if(J.strategic_synthesis)H=J.strategic_synthesis;else if((le=J.task_breakdown)!=null&&le.total_tasks)H=`Breaking down into ${J.task_breakdown.total_tasks} tasks...`;else if(J.acknowledgment_message)H=J.acknowledgment_message;else return;c(ae=>[...ae,{id:K,role:"assistant",content:H,timestamp:new Date}])}else if(ee==="user_input_request"){const H={question:J.question,context:J.context,input_type:J.input_type,options:J.options||J.suggestions,default_value:J.default_value,placeholder:J.placeholder};b("waiting_for_input"),c(ae=>[...ae,{id:K,role:"system",content:H.question,timestamp:new Date,metadata:{type:"user_input_request",userInputRequest:H}}])}},[]),P=i.useCallback(async U=>{b("waiting_for_input");const K=`input-request-${Date.now()}`;c(ee=>[...ee,{id:K,role:"system",content:U.question,timestamp:new Date,metadata:{type:"user_input_request",userInputRequest:U}}])},[]),z=i.useCallback(U=>{const{event_label:K,event_data:ee}=U;n!=null&&n.onPlatformEvent&&n.onPlatformEvent(K,ee)},[n]),T=i.useCallback(async U=>{const{function_name:K,function_data:ee}=U,{parameters:J,execution_id:ie}=ee;if(!(n!=null&&n.onPlatformFunction)){Qe.send({message_type:{platform_function_result:[ie,{error:"No platform function handler registered"}]},data:{}});return}try{const oe=await n.onPlatformFunction(K,J,ie),de={message_type:{platform_function_result:[ie,oe]},data:{}};Qe.send(de)}catch(oe){Qe.send({message_type:{platform_function_result:[ie,{error:oe instanceof Error?oe.message:"Function execution failed",stack:oe instanceof Error?oe.stack:void 0}]},data:{}})}},[n]);i.useEffect(()=>{if(!a)return;const K=`wss://${a==null?void 0:a.backend_host.replace(/https?:\/\//,"")}/realtime/agent?token=${encodeURIComponent(o)}`;C({status:mt.CONNECTING}),Qe.connect(K)},[a,o]),i.useEffect(()=>Qe.onConnectionStateChange(K=>{C({status:K.isConnected?mt.CONNECTED:K.error?mt.ERROR:mt.DISCONNECTED}),v(K.isConnected)}),[]),i.useEffect(()=>Qe.onMessage(_),[_]),i.useEffect(()=>{m&&t&&r&&s&&Qe.send({message_type:{session_connect:[t,r]},data:{}})},[m,t,r,s]);const M=i.useCallback(async()=>(m&&t&&r&&Qe.send({message_type:{session_connect:[t,r]},data:{}}),()=>{}),[m,t,r]),F=i.useCallback((U,K)=>{m&&(d(U),g(K||null),S(!0),b(Ae.STARTING),Qe.send({message_type:{message_input:U},data:K?{images:K}:{}}))},[m]),G=i.useCallback(()=>{c([]),R.current=null},[]),L=i.useCallback(U=>{!m||E!==Ae.WAITING_FOR_INPUT||(Qe.send({message_type:{user_input_response:U},data:{}}),b(Ae.RUNNING))},[m,E]),A=i.useCallback(async U=>{var K;if(!(!o||!t))try{const ee=new URLSearchParams({token:o,limit:"50"});U&&(ee.append("before_id",U),I(!0));const ie=await(await h(`/api/agent/contexts/${t}/messages?${ee}`,{method:"GET"})).json();if(ie.status===200&&ie.data){const oe=ie.data;if(Array.isArray(oe.data)){const de=oe.data.filter(Q=>{var V;let ce=Q.content;if(typeof Q.content=="string")try{ce=JSON.parse(Q.content)}catch{ce={message:Q.content}}const B=((V=Q.metadata)==null?void 0:V.message_type)||(ce==null?void 0:ce.message_type);return B==="user_message"||B==="agent_response"||B==="assistant_acknowledgment"||B==="user_input_request"||B==="system_decision"||B==="action_execution_result"||B==="assistant_task_breakdown"||B==="assistant_validation"||B==="assistant_action_planning"||B==="context_results"}).map(Q=>{var H,ae,ke,ne,Y,Z,N;let ce="",B,V,D=Q.content;if(typeof Q.content=="string")try{D=JSON.parse(Q.content)}catch{D=Q.content}const le=((H=Q.metadata)==null?void 0:H.message_type)||(D==null?void 0:D.message_type);if(le==="user_message"?(ce=(D==null?void 0:D.message)||"",B=(D==null?void 0:D.images)||void 0):le==="agent_response"?ce=(D==null?void 0:D.response)||"":le==="assistant_acknowledgment"?ce=(D==null?void 0:D.acknowledgment_message)||"":le==="user_input_request"&&(ce=(D==null?void 0:D.question)||"",V={type:"user_input_request",userInputRequest:{question:(D==null?void 0:D.question)||"",context:(D==null?void 0:D.context)||"",input_type:(D==null?void 0:D.input_type)||"text",options:(D==null?void 0:D.options)||(D==null?void 0:D.suggestions)||[],default_value:(D==null?void 0:D.default_value)||"",placeholder:(D==null?void 0:D.placeholder)||""}}),le==="system_decision"||le==="action_execution_result"||le==="assistant_task_breakdown"||le==="assistant_validation"||le==="assistant_action_planning"||le==="context_results"){let W="";if(le==="system_decision"){const fe=D==null?void 0:D.step,ye=D==null?void 0:D.reasoning;if(fe==="gathercontext")ye&&ye.length>0?W=ye.length>60?`${ye.substring(0,60)}...`:ye:W="Gathering context...";else if(fe==="executeaction")W="Executing action";else if(fe==="deliverresponse")W="Preparing response";else if(fe==="taskplanning")W="Planning approach";else if(fe==="validateprogress")W="Validating progress";else if(fe==="acknowledge")W="Processing request";else if(fe==="finishplanning")W="Finalizing plan";else if(fe==="executetasks")W="Executing tasks";else if(fe==="requestuserinput")W="Waiting for input";else if(fe==="complete")W="Completed";else if(fe==="examinetool")W="Examining tool";else if(fe==="examineworkflow")W="Examining workflow";else{const re=(D==null?void 0:D.confidence)||.5;re>.8?W="Analyzing":re>.6?W="Thinking":W="Reasoning"}}else if(le==="action_execution_result")((ae=D==null?void 0:D.task_execution)==null?void 0:ae.status)==="completed"?W="Task execution completed":(ke=D==null?void 0:D.task_execution)!=null&&ke.approach?W=D.task_execution.approach:W="Executing task";else if(le==="assistant_task_breakdown")(ne=D==null?void 0:D.task_breakdown)!=null&&ne.total_tasks?W=`Identified ${D.task_breakdown.total_tasks} tasks`:W="Planning tasks";else if(le==="assistant_validation")W="Validated results";else if(le==="assistant_action_planning")(Y=D==null?void 0:D.task_execution)!=null&&Y.total_tasks?W=`Planned ${D.task_execution.total_tasks} tasks`:(N=(Z=D==null?void 0:D.task_execution)==null?void 0:Z.tasks)!=null&&N.length?W=`Planned ${D.task_execution.tasks.length} tasks`:W="Planning actions";else if(le==="context_results"){const fe=D==null?void 0:D.query,ye=(D==null?void 0:D.result_count)||0;fe&&fe!=="General context gathering"?W=`${fe}: Found ${ye} results`:W=`Found ${ye} results`}ce=W,V={type:"log",messageType:le}}return{id:Q.id,role:le==="user_message"?"user":le==="user_input_request"?"system":"assistant",content:ce,images:B,timestamp:new Date(Q.timestamp||Q.created_at||Date.now()),metadata:V}}).filter(Q=>Q.content||Q.metadata||Q.images).sort((Q,ce)=>{const B=BigInt(Q.id),V=BigInt(ce.id);return B<V?-1:B>V?1:0});de.length>0&&(k.current=de[0].id),U?(c(Q=>[...de,...Q]),j(de.length>=50)):(c(de),de.length>0&&((K=de[de.length-1].metadata)==null?void 0:K.type)==="user_input_request"&&b(Ae.WAITING_FOR_INPUT)),I(!1)}}}catch(ee){console.error("Failed to fetch messages:",ee),I(!1)}},[o,t,h]);i.useEffect(()=>{t&&o&&A()},[t,o]);const se=i.useCallback(async()=>{if(!(x||!w||!k.current)){I(!0);try{await A(k.current)}finally{I(!1)}}},[x,w,A]),te=i.useCallback(()=>{!m||!y||(Qe.send({message_type:{cancel_execution:null},data:{}}),S(!1),b("idle"))},[m,y]);return{messages:f,pendingMessage:p,pendingImages:u,connectionState:$,isConnected:m,isExecuting:y,executionStatus:E,isWaitingForInput:E==="waiting_for_input",hasMoreMessages:w,isLoadingMore:x,sendMessage:F,submitUserInput:L,clearMessages:G,loadMoreMessages:se,cancelExecution:te,connect:M,disconnect:()=>Qe.disconnect()}}const fc=()=>{const{client:t}=Fe(),[r,o]=i.useState(!1),[n,s]=i.useState(null),[a,h]=i.useState(null),f=i.useCallback(async p=>{o(!0),s(null),h(null);try{const d=await t("/organizations/invitations/accept",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:p})}),g=(await q(d)).data;return h(g),g.error_code&&s(g.message||"Failed to accept invitation"),g}catch(d){const u=d.message||"Failed to accept invitation";s(u);const g={error_code:"NETWORK_ERROR",message:u};return h(g),g}finally{o(!1)}},[t]),c=i.useCallback(()=>{s(null),h(null)},[]);return{acceptInvitation:f,invitationData:a,loading:r,error:n,reset:c}},lu=({children:t})=>{const{loading:r}=ve();return r?null:e.jsx(e.Fragment,{children:t})},du=({children:t})=>{const{loading:r}=ve();return r?e.jsx(e.Fragment,{children:t}):null};var He=function(){return He=Object.assign||function(r){for(var o,n=1,s=arguments.length;n<s;n++){o=arguments[n];for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(r[a]=o[a])}return r},He.apply(this,arguments)};function Xt(t,r,o){if(o||arguments.length===2)for(var n=0,s=r.length,a;n<s;n++)(a||!(n in r))&&(a||(a=Array.prototype.slice.call(r,0,n)),a[n]=r[n]);return t.concat(a||Array.prototype.slice.call(r))}function uu(t){var r=Object.create(null);return function(o){return r[o]===void 0&&(r[o]=t(o)),r[o]}}var pu=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,hu=uu(function(t){return pu.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),Pe="-ms-",Lr="-moz-",$e="-webkit-",gc="comm",Zo="rule",ba="decl",fu="@import",mc="@keyframes",gu="@layer",xc=Math.abs,ya=String.fromCharCode,na=Object.assign;function mu(t,r){return Ue(t,0)^45?(((r<<2^Ue(t,0))<<2^Ue(t,1))<<2^Ue(t,2))<<2^Ue(t,3):0}function vc(t){return t.trim()}function gt(t,r){return(t=r.exec(t))?t[0]:t}function xe(t,r,o){return t.replace(r,o)}function zo(t,r,o){return t.indexOf(r,o)}function Ue(t,r){return t.charCodeAt(r)|0}function mr(t,r,o){return t.slice(r,o)}function it(t){return t.length}function bc(t){return t.length}function Or(t,r){return r.push(t),t}function xu(t,r){return t.map(r).join("")}function Va(t,r){return t.filter(function(o){return!gt(o,r)})}var Qo=1,xr=1,yc=0,Xe=0,De=0,kr="";function Ko(t,r,o,n,s,a,h,f){return{value:t,root:r,parent:o,type:n,props:s,children:a,line:Qo,column:xr,length:h,return:"",siblings:f}}function St(t,r){return na(Ko("",null,null,"",null,null,0,t.siblings),t,{length:-t.length},r)}function sr(t){for(;t.root;)t=St(t.root,{children:[t]});Or(t,t.siblings)}function vu(){return De}function bu(){return De=Xe>0?Ue(kr,--Xe):0,xr--,De===10&&(xr=1,Qo--),De}function rt(){return De=Xe<yc?Ue(kr,Xe++):0,xr++,De===10&&(xr=1,Qo++),De}function Yt(){return Ue(kr,Xe)}function Eo(){return Xe}function Xo(t,r){return mr(kr,t,r)}function aa(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function yu(t){return Qo=xr=1,yc=it(kr=t),Xe=0,[]}function wu(t){return kr="",t}function gn(t){return vc(Xo(Xe-1,sa(t===91?t+2:t===40?t+1:t)))}function ju(t){for(;(De=Yt())&&De<33;)rt();return aa(t)>2||aa(De)>3?"":" "}function ku(t,r){for(;--r&&rt()&&!(De<48||De>102||De>57&&De<65||De>70&&De<97););return Xo(t,Eo()+(r<6&&Yt()==32&&rt()==32))}function sa(t){for(;rt();)switch(De){case t:return Xe;case 34:case 39:t!==34&&t!==39&&sa(De);break;case 40:t===41&&sa(t);break;case 92:rt();break}return Xe}function _u(t,r){for(;rt()&&t+De!==57;)if(t+De===84&&Yt()===47)break;return"/*"+Xo(r,Xe-1)+"*"+ya(t===47?t:rt())}function Cu(t){for(;!aa(Yt());)rt();return Xo(t,Xe)}function Su(t){return wu(Po("",null,null,null,[""],t=yu(t),0,[0],t))}function Po(t,r,o,n,s,a,h,f,c){for(var p=0,d=0,u=h,g=0,m=0,v=0,y=1,S=1,E=1,b=0,$="",C=s,w=a,j=n,x=$;S;)switch(v=b,b=rt()){case 40:if(v!=108&&Ue(x,u-1)==58){zo(x+=xe(gn(b),"&","&\f"),"&\f",xc(p?f[p-1]:0))!=-1&&(E=-1);break}case 34:case 39:case 91:x+=gn(b);break;case 9:case 10:case 13:case 32:x+=ju(v);break;case 92:x+=ku(Eo()-1,7);continue;case 47:switch(Yt()){case 42:case 47:Or($u(_u(rt(),Eo()),r,o,c),c);break;default:x+="/"}break;case 123*y:f[p++]=it(x)*E;case 125*y:case 59:case 0:switch(b){case 0:case 125:S=0;case 59+d:E==-1&&(x=xe(x,/\f/g,"")),m>0&&it(x)-u&&Or(m>32?Ha(x+";",n,o,u-1,c):Ha(xe(x," ","")+";",n,o,u-2,c),c);break;case 59:x+=";";default:if(Or(j=Ga(x,r,o,p,d,s,f,$,C=[],w=[],u,a),a),b===123)if(d===0)Po(x,r,j,j,C,a,u,f,w);else switch(g===99&&Ue(x,3)===110?100:g){case 100:case 108:case 109:case 115:Po(t,j,j,n&&Or(Ga(t,j,j,0,0,s,f,$,s,C=[],u,w),w),s,w,u,f,n?C:w);break;default:Po(x,j,j,j,[""],w,0,f,w)}}p=d=m=0,y=E=1,$=x="",u=h;break;case 58:u=1+it(x),m=v;default:if(y<1){if(b==123)--y;else if(b==125&&y++==0&&bu()==125)continue}switch(x+=ya(b),b*y){case 38:E=d>0?1:(x+="\f",-1);break;case 44:f[p++]=(it(x)-1)*E,E=1;break;case 64:Yt()===45&&(x+=gn(rt())),g=Yt(),d=u=it($=x+=Cu(Eo())),b++;break;case 45:v===45&&it(x)==2&&(y=0)}}return a}function Ga(t,r,o,n,s,a,h,f,c,p,d,u){for(var g=s-1,m=s===0?a:[""],v=bc(m),y=0,S=0,E=0;y<n;++y)for(var b=0,$=mr(t,g+1,g=xc(S=h[y])),C=t;b<v;++b)(C=vc(S>0?m[b]+" "+$:xe($,/&\f/g,m[b])))&&(c[E++]=C);return Ko(t,r,o,s===0?Zo:f,c,p,d,u)}function $u(t,r,o,n){return Ko(t,r,o,gc,ya(vu()),mr(t,2,-2),0,n)}function Ha(t,r,o,n,s){return Ko(t,r,o,ba,mr(t,0,n),mr(t,n+1,-1),n,s)}function wc(t,r,o){switch(mu(t,r)){case 5103:return $e+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return $e+t+t;case 4789:return Lr+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return $e+t+Lr+t+Pe+t+t;case 5936:switch(Ue(t,r+11)){case 114:return $e+t+Pe+xe(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return $e+t+Pe+xe(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return $e+t+Pe+xe(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return $e+t+Pe+t+t;case 6165:return $e+t+Pe+"flex-"+t+t;case 5187:return $e+t+xe(t,/(\w+).+(:[^]+)/,$e+"box-$1$2"+Pe+"flex-$1$2")+t;case 5443:return $e+t+Pe+"flex-item-"+xe(t,/flex-|-self/g,"")+(gt(t,/flex-|baseline/)?"":Pe+"grid-row-"+xe(t,/flex-|-self/g,""))+t;case 4675:return $e+t+Pe+"flex-line-pack"+xe(t,/align-content|flex-|-self/g,"")+t;case 5548:return $e+t+Pe+xe(t,"shrink","negative")+t;case 5292:return $e+t+Pe+xe(t,"basis","preferred-size")+t;case 6060:return $e+"box-"+xe(t,"-grow","")+$e+t+Pe+xe(t,"grow","positive")+t;case 4554:return $e+xe(t,/([^-])(transform)/g,"$1"+$e+"$2")+t;case 6187:return xe(xe(xe(t,/(zoom-|grab)/,$e+"$1"),/(image-set)/,$e+"$1"),t,"")+t;case 5495:case 3959:return xe(t,/(image-set\([^]*)/,$e+"$1$`$1");case 4968:return xe(xe(t,/(.+:)(flex-)?(.*)/,$e+"box-pack:$3"+Pe+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+$e+t+t;case 4200:if(!gt(t,/flex-|baseline/))return Pe+"grid-column-align"+mr(t,r)+t;break;case 2592:case 3360:return Pe+xe(t,"template-","")+t;case 4384:case 3616:return o&&o.some(function(n,s){return r=s,gt(n.props,/grid-\w+-end/)})?~zo(t+(o=o[r].value),"span",0)?t:Pe+xe(t,"-start","")+t+Pe+"grid-row-span:"+(~zo(o,"span",0)?gt(o,/\d+/):+gt(o,/\d+/)-+gt(t,/\d+/))+";":Pe+xe(t,"-start","")+t;case 4896:case 4128:return o&&o.some(function(n){return gt(n.props,/grid-\w+-start/)})?t:Pe+xe(xe(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return xe(t,/(.+)-inline(.+)/,$e+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(it(t)-1-r>6)switch(Ue(t,r+1)){case 109:if(Ue(t,r+4)!==45)break;case 102:return xe(t,/(.+:)(.+)-([^]+)/,"$1"+$e+"$2-$3$1"+Lr+(Ue(t,r+3)==108?"$3":"$2-$3"))+t;case 115:return~zo(t,"stretch",0)?wc(xe(t,"stretch","fill-available"),r,o)+t:t}break;case 5152:case 5920:return xe(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(n,s,a,h,f,c,p){return Pe+s+":"+a+p+(h?Pe+s+"-span:"+(f?c:+c-+a)+p:"")+t});case 4949:if(Ue(t,r+6)===121)return xe(t,":",":"+$e)+t;break;case 6444:switch(Ue(t,Ue(t,14)===45?18:11)){case 120:return xe(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+$e+(Ue(t,14)===45?"inline-":"")+"box$3$1"+$e+"$2$3$1"+Pe+"$2box$3")+t;case 100:return xe(t,":",":"+Pe)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return xe(t,"scroll-","scroll-snap-")+t}return t}function Lo(t,r){for(var o="",n=0;n<t.length;n++)o+=r(t[n],n,t,r)||"";return o}function zu(t,r,o,n){switch(t.type){case gu:if(t.children.length)break;case fu:case ba:return t.return=t.return||t.value;case gc:return"";case mc:return t.return=t.value+"{"+Lo(t.children,n)+"}";case Zo:if(!it(t.value=t.props.join(",")))return""}return it(o=Lo(t.children,n))?t.return=t.value+"{"+o+"}":""}function Eu(t){var r=bc(t);return function(o,n,s,a){for(var h="",f=0;f<r;f++)h+=t[f](o,n,s,a)||"";return h}}function Pu(t){return function(r){r.root||(r=r.return)&&t(r)}}function Ru(t,r,o,n){if(t.length>-1&&!t.return)switch(t.type){case ba:t.return=wc(t.value,t.length,o);return;case mc:return Lo([St(t,{value:xe(t.value,"@","@"+$e)})],n);case Zo:if(t.length)return xu(o=t.props,function(s){switch(gt(s,n=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":sr(St(t,{props:[xe(s,/:(read-\w+)/,":"+Lr+"$1")]})),sr(St(t,{props:[s]})),na(t,{props:Va(o,n)});break;case"::placeholder":sr(St(t,{props:[xe(s,/:(plac\w+)/,":"+$e+"input-$1")]})),sr(St(t,{props:[xe(s,/:(plac\w+)/,":"+Lr+"$1")]})),sr(St(t,{props:[xe(s,/:(plac\w+)/,Pe+"input-$1")]})),sr(St(t,{props:[s]})),na(t,{props:Va(o,n)});break}return""})}}var Iu={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Jt=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",jc="active",kc="data-styled-version",Jo="6.1.19",wa=`/*!sc*/
|
|
18
|
+
*/var Ma;function od(){return Ma||(Ma=1,process.env.NODE_ENV!=="production"&&function(){function t(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}function r(m,v){d||s.startTransition===void 0||(d=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var y=v();if(!u){var S=v();a(y,S)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}S=h({inst:{value:y,getSnapshot:v}});var E=S[0].inst,b=S[1];return c(function(){E.value=y,E.getSnapshot=v,o(E)&&b({inst:E})},[m,y,v]),f(function(){return o(E)&&b({inst:E}),m(function(){o(E)&&b({inst:E})})},[m]),p(y),y}function o(m){var v=m.getSnapshot;m=m.value;try{var y=v();return!a(m,y)}catch{return!0}}function n(m,v){return v()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=i,a=typeof Object.is=="function"?Object.is:t,h=s.useState,f=s.useEffect,c=s.useLayoutEffect,p=s.useDebugValue,d=!1,u=!1,g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:r;cn.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:g,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),cn}var La;function nd(){return La||(La=1,process.env.NODE_ENV==="production"?Yr.exports=rd():Yr.exports=od()),Yr.exports}var ad=nd();const Gi=0,Hi=1,qi=2,Aa=3;var Da=Object.prototype.hasOwnProperty;function Yn(t,r){var o,n;if(t===r)return!0;if(t&&r&&(o=t.constructor)===r.constructor){if(o===Date)return t.getTime()===r.getTime();if(o===RegExp)return t.toString()===r.toString();if(o===Array){if((n=t.length)===r.length)for(;n--&&Yn(t[n],r[n]););return n===-1}if(!o||typeof t=="object"){n=0;for(o in t)if(Da.call(t,o)&&++n&&!Da.call(r,o)||!(o in r)||!Yn(t[o],r[o]))return!1;return Object.keys(r).length===n}}return t!==t&&r!==r}const xt=new WeakMap,$t=()=>{},Ge=$t(),Zn=Object,Ce=t=>t===Ge,ct=t=>typeof t=="function",Pt=(t,r)=>({...t,...r}),Yi=t=>ct(t.then),ln={},Zr={},xa="undefined",Br=typeof window!=xa,Qn=typeof document!=xa,sd=Br&&"Deno"in window,id=()=>Br&&typeof window.requestAnimationFrame!=xa,Zi=(t,r)=>{const o=xt.get(t);return[()=>!Ce(r)&&t.get(r)||ln,n=>{if(!Ce(r)){const s=t.get(r);r in Zr||(Zr[r]=s),o[5](r,Pt(s,n),s||ln)}},o[6],()=>!Ce(r)&&r in Zr?Zr[r]:!Ce(r)&&t.get(r)||ln]};let Kn=!0;const cd=()=>Kn,[Xn,Jn]=Br&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[$t,$t],ld=()=>{const t=Qn&&document.visibilityState;return Ce(t)||t!=="hidden"},dd=t=>(Qn&&document.addEventListener("visibilitychange",t),Xn("focus",t),()=>{Qn&&document.removeEventListener("visibilitychange",t),Jn("focus",t)}),ud=t=>{const r=()=>{Kn=!0,t()},o=()=>{Kn=!1};return Xn("online",r),Xn("offline",o),()=>{Jn("online",r),Jn("offline",o)}},pd={isOnline:cd,isVisible:ld},hd={initFocus:dd,initReconnect:ud},Na=!i.useId,Ar=!Br||sd,fd=t=>id()?window.requestAnimationFrame(t):setTimeout(t,1),dn=Ar?i.useEffect:i.useLayoutEffect,un=typeof navigator<"u"&&navigator.connection,Fa=!Ar&&un&&(["slow-2g","2g"].includes(un.effectiveType)||un.saveData),Qr=new WeakMap,gd=t=>Zn.prototype.toString.call(t),pn=(t,r)=>t===`[object ${r}]`;let md=0;const ea=t=>{const r=typeof t,o=gd(t),n=pn(o,"Date"),s=pn(o,"RegExp"),a=pn(o,"Object");let h,f;if(Zn(t)===t&&!n&&!s){if(h=Qr.get(t),h)return h;if(h=++md+"~",Qr.set(t,h),Array.isArray(t)){for(h="@",f=0;f<t.length;f++)h+=ea(t[f])+",";Qr.set(t,h)}if(a){h="#";const c=Zn.keys(t).sort();for(;!Ce(f=c.pop());)Ce(t[f])||(h+=f+":"+ea(t[f])+",");Qr.set(t,h)}}else h=n?t.toJSON():r=="symbol"?t.toString():r=="string"?JSON.stringify(t):""+t;return h},va=t=>{if(ct(t))try{t=t()}catch{t=""}const r=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?ea(t):"",[t,r]};let xd=0;const ta=()=>++xd;async function Qi(...t){const[r,o,n,s]=t,a=Pt({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let h=a.populateCache;const f=a.rollbackOnError;let c=a.optimisticData;const p=g=>typeof f=="function"?f(g):f!==!1,d=a.throwOnError;if(ct(o)){const g=o,m=[],v=r.keys();for(const y of v)!/^\$(inf|sub)\$/.test(y)&&g(r.get(y)._k)&&m.push(y);return Promise.all(m.map(u))}return u(o);async function u(g){const[m]=va(g);if(!m)return;const[v,y]=Zi(r,m),[S,E,b,$]=xt.get(r),C=()=>{const z=S[m];return(ct(a.revalidate)?a.revalidate(v().data,g):a.revalidate!==!1)&&(delete b[m],delete $[m],z&&z[0])?z[0](qi).then(()=>v().data):v().data};if(t.length<3)return C();let w=n,j,x=!1;const I=ta();E[m]=[I,0];const k=!Ce(c),R=v(),_=R.data,O=R._c,P=Ce(O)?_:O;if(k&&(c=ct(c)?c(P,_):c,y({data:c,_c:P})),ct(w))try{w=w(P)}catch(z){j=z,x=!0}if(w&&Yi(w))if(w=await w.catch(z=>{j=z,x=!0}),I!==E[m][0]){if(x)throw j;return w}else x&&k&&p(j)&&(h=!0,y({data:P,_c:Ge}));if(h&&!x)if(ct(h)){const z=h(w,P);y({data:z,error:Ge,_c:Ge})}else y({data:w,error:Ge,_c:Ge});if(E[m][1]=ta(),Promise.resolve(C()).then(()=>{y({_c:Ge})}),x){if(d)throw j;return}return w}}const Ba=(t,r)=>{for(const o in t)t[o][0]&&t[o][0](r)},vd=(t,r)=>{if(!xt.has(t)){const o=Pt(hd,r),n=Object.create(null),s=Qi.bind(Ge,t);let a=$t;const h=Object.create(null),f=(d,u)=>{const g=h[d]||[];return h[d]=g,g.push(u),()=>g.splice(g.indexOf(u),1)},c=(d,u,g)=>{t.set(d,u);const m=h[d];if(m)for(const v of m)v(u,g)},p=()=>{if(!xt.has(t)&&(xt.set(t,[n,Object.create(null),Object.create(null),Object.create(null),s,c,f]),!Ar)){const d=o.initFocus(setTimeout.bind(Ge,Ba.bind(Ge,n,Gi))),u=o.initReconnect(setTimeout.bind(Ge,Ba.bind(Ge,n,Hi)));a=()=>{d&&d(),u&&u(),xt.delete(t)}}};return p(),[t,s,p,a]}return[t,xt.get(t)[4]]},bd=(t,r,o,n,s)=>{const a=o.errorRetryCount,h=s.retryCount,f=~~((Math.random()+.5)*(1<<(h<8?h:8)))*o.errorRetryInterval;!Ce(a)&&h>a||setTimeout(n,f,s)},yd=Yn,[Ki,wd]=vd(new Map),jd=Pt({onLoadingSlow:$t,onSuccess:$t,onError:$t,onErrorRetry:bd,onDiscarded:$t,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Fa?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Fa?5e3:3e3,compare:yd,isPaused:()=>!1,cache:Ki,mutate:wd,fallback:{}},pd),kd=(t,r)=>{const o=Pt(t,r);if(r){const{use:n,fallback:s}=t,{use:a,fallback:h}=r;n&&a&&(o.use=n.concat(a)),s&&h&&(o.fallback=Pt(s,h))}return o},_d=i.createContext({}),Cd="$inf$",Xi=Br&&window.__SWR_DEVTOOLS_USE__,Sd=Xi?window.__SWR_DEVTOOLS_USE__:[],$d=()=>{Xi&&(window.__SWR_DEVTOOLS_REACT__=i)},zd=t=>ct(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],Ji=()=>Pt(jd,i.useContext(_d)),Ed=t=>(r,o,n)=>t(r,o&&((...a)=>{const[h]=va(r),[,,,f]=xt.get(Ki);if(h.startsWith(Cd))return o(...a);const c=f[h];return Ce(c)?o(...a):(delete f[h],c)}),n),Pd=Sd.concat(Ed),Rd=t=>function(...o){const n=Ji(),[s,a,h]=zd(o),f=kd(n,h);let c=t;const{use:p}=f,d=(p||[]).concat(Pd);for(let u=d.length;u--;)c=d[u](c);return c(s,a||f.fetcher||null,f)},Id=(t,r,o)=>{const n=r[t]||(r[t]=[]);return n.push(o),()=>{const s=n.indexOf(o);s>=0&&(n[s]=n[n.length-1],n.pop())}};$d();const hn=i.use||(t=>{switch(t.status){case"pending":throw t;case"fulfilled":return t.value;case"rejected":throw t.reason;default:throw t.status="pending",t.then(r=>{t.status="fulfilled",t.value=r},r=>{t.status="rejected",t.reason=r}),t}}),fn={dedupe:!0},Td=(t,r,o)=>{const{cache:n,compare:s,suspense:a,fallbackData:h,revalidateOnMount:f,revalidateIfStale:c,refreshInterval:p,refreshWhenHidden:d,refreshWhenOffline:u,keepPreviousData:g}=o,[m,v,y,S]=xt.get(n),[E,b]=va(t),$=i.useRef(!1),C=i.useRef(!1),w=i.useRef(E),j=i.useRef(r),x=i.useRef(o),I=()=>x.current,k=()=>I().isVisible()&&I().isOnline(),[R,_,O,P]=Zi(n,E),z=i.useRef({}).current,T=Ce(h)?Ce(o.fallback)?Ge:o.fallback[E]:h,M=(V,D)=>{for(const le in z){const q=le;if(q==="data"){if(!s(V[q],D[q])&&(!Ce(V[q])||!s(ee,D[q])))return!1}else if(D[q]!==V[q])return!1}return!0},N=i.useMemo(()=>{const V=!E||!r?!1:Ce(f)?I().isPaused()||a?!1:c!==!1:f,D=Y=>{const Z=Pt(Y);return delete Z._k,V?{isValidating:!0,isLoading:!0,...Z}:Z},le=R(),q=P(),ae=D(le),ke=le===q?ae:D(q);let ne=ae;return[()=>{const Y=D(R());return M(Y,ne)?(ne.data=Y.data,ne.isLoading=Y.isLoading,ne.isValidating=Y.isValidating,ne.error=Y.error,ne):(ne=Y,Y)},()=>ke]},[n,E]),H=ad.useSyncExternalStore(i.useCallback(V=>O(E,(D,le)=>{M(le,D)||V()}),[n,E]),N[0],N[1]),L=!$.current,A=m[E]&&m[E].length>0,se=H.data,te=Ce(se)?T&&Yi(T)?hn(T):T:se,U=H.error,K=i.useRef(te),ee=g?Ce(se)?Ce(K.current)?te:K.current:se:te,J=A&&!Ce(U)?!1:L&&!Ce(f)?f:I().isPaused()?!1:a?Ce(te)?!1:c:Ce(te)||c,ie=!!(E&&r&&L&&J),oe=Ce(H.isValidating)?ie:H.isValidating,de=Ce(H.isLoading)?ie:H.isLoading,Q=i.useCallback(async V=>{const D=j.current;if(!E||!D||C.current||I().isPaused())return!1;let le,q,ae=!0;const ke=V||{},ne=!y[E]||!ke.dedupe,Y=()=>Na?!C.current&&E===w.current&&$.current:E===w.current,Z={isValidating:!1,isLoading:!1},F=()=>{_(Z)},W=()=>{const ye=y[E];ye&&ye[1]===q&&delete y[E]},fe={isValidating:!0};Ce(R().data)&&(fe.isLoading=!0);try{if(ne&&(_(fe),o.loadingTimeout&&Ce(R().data)&&setTimeout(()=>{ae&&Y()&&I().onLoadingSlow(E,o)},o.loadingTimeout),y[E]=[D(b),ta()]),[le,q]=y[E],le=await le,ne&&setTimeout(W,o.dedupingInterval),!y[E]||y[E][1]!==q)return ne&&Y()&&I().onDiscarded(E),!1;Z.error=Ge;const ye=v[E];if(!Ce(ye)&&(q<=ye[0]||q<=ye[1]||ye[1]===0))return F(),ne&&Y()&&I().onDiscarded(E),!1;const re=R().data;Z.data=s(re,le)?re:le,ne&&Y()&&I().onSuccess(le,E,o)}catch(ye){W();const re=I(),{shouldRetryOnError:je}=re;re.isPaused()||(Z.error=ye,ne&&Y()&&(re.onError(ye,E,re),(je===!0||ct(je)&&je(ye))&&(!I().revalidateOnFocus||!I().revalidateOnReconnect||k())&&re.onErrorRetry(ye,E,re,me=>{const Se=m[E];Se&&Se[0]&&Se[0](Aa,me)},{retryCount:(ke.retryCount||0)+1,dedupe:!0})))}return ae=!1,F(),!0},[E,n]),ce=i.useCallback((...V)=>Qi(n,w.current,...V),[]);if(dn(()=>{j.current=r,x.current=o,Ce(se)||(K.current=se)}),dn(()=>{if(!E)return;const V=Q.bind(Ge,fn);let D=0;I().revalidateOnFocus&&(D=Date.now()+I().focusThrottleInterval);const q=Id(E,m,(ae,ke={})=>{if(ae==Gi){const ne=Date.now();I().revalidateOnFocus&&ne>D&&k()&&(D=ne+I().focusThrottleInterval,V())}else if(ae==Hi)I().revalidateOnReconnect&&k()&&V();else{if(ae==qi)return Q();if(ae==Aa)return Q(ke)}});return C.current=!1,w.current=E,$.current=!0,_({_k:b}),J&&(y[E]||(Ce(te)||Ar?V():fd(V))),()=>{C.current=!0,q()}},[E]),dn(()=>{let V;function D(){const q=ct(p)?p(R().data):p;q&&V!==-1&&(V=setTimeout(le,q))}function le(){!R().error&&(d||I().isVisible())&&(u||I().isOnline())?Q(fn).then(D):D()}return D(),()=>{V&&(clearTimeout(V),V=-1)}},[p,d,u,E]),i.useDebugValue(ee),a&&Ce(te)&&E){if(!Na&&Ar)throw new Error("Fallback data is required when using Suspense in SSR.");j.current=r,x.current=o,C.current=!1;const V=S[E];if(!Ce(V)){const D=ce(V);hn(D)}if(Ce(U)){const D=Q(fn);Ce(ee)||(D.status="fulfilled",D.value=!0),hn(D)}else throw U}return{mutate:ce,get data(){return z.data=!0,ee},get error(){return z.error=!0,U},get isValidating(){return z.isValidating=!0,oe},get isLoading(){return z.isLoading=!0,de}}},Fe=Rd(Td);async function G(t){if(!t.ok){let o=`HTTP ${t.status}: ${t.statusText}`;try{const n=await t.json();n.message?o=n.message:n.errors&&n.errors.length>0&&(o=n.errors[0].message||o)}catch{}throw new Error(o)}return{data:(await t.json()).data}}function ec(t){const{client:r}=Ne(),o=i.useCallback(async()=>{const c=await r(`/api/agent/contexts?token=${encodeURIComponent(t)}`,{method:"GET"});return(await G(c)).data},[r,t]),{data:n,error:s,mutate:a}=Fe(t?`wacht-agent-sessions:${t}`:null,o,{revalidateOnFocus:!1}),h=i.useCallback(async c=>{const p=new FormData;p.append("title",c.title),c.system_instructions&&p.append("system_instructions",c.system_instructions);const d=await r(`/api/agent/contexts?token=${encodeURIComponent(t)}`,{method:"POST",body:p}),u=await G(d);return await a(g=>g&&{...g,data:[u.data,...g.data]}),u.data},[r,t,a]),f=i.useCallback(async c=>{await r(`/api/agent/contexts/${c}/delete?token=${encodeURIComponent(t)}`,{method:"POST"}),await a(p=>p&&{...p,data:p.data.filter(d=>d.id!==c)})},[r,t,a]);return{sessions:(n==null?void 0:n.data)||[],loading:!n&&!s,error:s,createSession:h,deleteSession:f,refetch:async()=>{await a()}}}const tc=i.createContext(void 0);function Ho(){const t=i.useContext(tc);if(!t)throw new Error("useAgentConversationContext must be used within AgentConversationProvider");return t}function Od({children:t,agentName:r,token:o,platformAdapter:n,defaultSessionId:s,onSessionCreated:a,onSessionDeleted:h,onError:f}){const[c,p]=i.useState(s?{id:s,title:"Conversation",status:"idle",last_activity_at:new Date().toISOString(),created_at:new Date().toISOString()}:null),[d,u]=i.useState(!1),{sessions:g,loading:m,error:v,createSession:y,deleteSession:S,refetch:E}=ec(o);i.useEffect(()=>{if(s&&g.length>0){const j=g.find(x=>x.id===s);j&&p(j)}},[s,g]);const b=i.useCallback(j=>{p(j),u(!1)},[]),$=i.useCallback(async j=>{try{const x=j||`Chat ${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}`,I=await y({title:x});return p(I),a==null||a(I),I}catch(x){const I=x instanceof Error?x.message:"Failed to create session";throw f==null||f(I),x}},[y,a,f]),C=i.useCallback(async j=>{try{await S(j),(c==null?void 0:c.id)===j&&p(null),h==null||h(j)}catch(x){const I=x instanceof Error?x.message:"Failed to delete session";throw f==null||f(I),x}},[S,c,h,f]),w={agentName:r,token:o,platformAdapter:n,sessions:g,selectedSession:c,loadingSessions:m,sessionError:v,selectSession:b,createSession:$,deleteSession:C,refreshSessions:E,showHistory:d,setShowHistory:u,onSessionCreated:a,onSessionDeleted:h,onError:f};return e.jsx(tc.Provider,{value:w,children:t})}var rc=(t=>(t.XOauth="x_oauth",t.GithubOauth="github_oauth",t.GitlabOauth="gitlab_oauth",t.GoogleOauth="google_oauth",t.FacebookOauth="facebook_oauth",t.MicrosoftOauth="microsoft_oauth",t.LinkedinOauth="linkedin_oauth",t.DiscordOauth="discord_oauth",t.AppleOauth="apple_oauth",t))(rc||{});function Md(t,r){const o={username:Ld(t,r),email:Ad(t,r),phone:Dd(t,r),email_otp:Nd(t,r),magic_link:Fd(t,r),oauth:Bd(t),generic:Ud(t,r)};return function(s){return o[s]}}function Ld(t,r){return async({username:o,password:n})=>{var f,c;const s=new FormData;s.append("strategy","plain_username"),s.append("username",o),s.append("password",n);const a=await t("/auth/signin",{method:"POST",body:s}),h=await G(a);return"data"in h&&((c=(f=h.data)==null?void 0:f.signin_attempts)!=null&&c.length)&&r(h.data.signin_attempts.at(-1)||null),h}}function Ad(t,r){return async({email:o,password:n})=>{var f,c;const s=new FormData;s.append("strategy","plain_email"),s.append("email",o),s.append("password",n);const a=await t("/auth/signin",{method:"POST",body:s}),h=await G(a);return"data"in h&&((c=(f=h.data)==null?void 0:f.signin_attempts)!=null&&c.length)&&r(h.data.signin_attempts.at(-1)||null),h}}function Dd(t,r){return async({phone:o})=>{var h,f;const n=new FormData;n.append("strategy","phone_otp"),n.append("phone",o);const s=await t("/auth/signin",{method:"POST",body:n}),a=await G(s);return"data"in a&&((f=(h=a.data)==null?void 0:h.signin_attempts)!=null&&f.length)&&r(a.data.signin_attempts.at(-1)||null),a}}function Nd(t,r){return async({email:o})=>{var h,f;const n=new FormData;n.append("strategy","email_otp"),n.append("email",o);const s=await t("/auth/signin",{method:"POST",body:n}),a=await G(s);return"data"in a&&((f=(h=a.data)==null?void 0:h.signin_attempts)!=null&&f.length)&&r(a.data.signin_attempts.at(-1)||null),a}}function Fd(t,r){return async({email:o})=>{var h,f;const n=new FormData;n.append("strategy","magic_link"),n.append("email",o);const s=await t("/auth/signin",{method:"POST",body:n}),a=await G(s);return"data"in a&&((f=(h=a.data)==null?void 0:h.signin_attempts)!=null&&f.length)&&r(a.data.signin_attempts.at(-1)||null),a}}function Bd(t){return async({provider:r,redirectUri:o})=>{const n=new URLSearchParams({provider:r});o&&n.append("redirect_uri",o);const s=await t(`/auth/oauth2/init?${n.toString()}`,{method:"POST"}),a=await G(s);return"data"in a&&a.data.oauth_url&&(window.location.href=a.data.oauth_url),a}}function Ud(t,r){return async({email:o,username:n,password:s,phone:a,strategy:h,token:f})=>{var u,g;const c=new FormData;h&&c.append("strategy",h),o&&c.append("email",o),n&&c.append("username",n),s&&c.append("password",s),a&&c.append("phone",a),f&&c.append("token",f);const p=await t("/auth/signin",{method:"POST",body:c}),d=await G(p);return"data"in d&&((g=(u=d.data)==null?void 0:u.signin_attempts)!=null&&g.length)&&r(d.data.signin_attempts.at(-1)||null),d}}function oc(){const{client:t,loading:r}=Ne(),[o,n]=i.useState(null);return r?{loading:!0,signIn:null,signinAttempt:null,discardSignInAttempt:()=>{n(null)},setSignInAttempt:n}:{loading:!1,signinAttempt:o,signIn:{createStrategy:Md(t,n),completeVerification:async s=>{var c,p;const a=new FormData;a.append("verification_code",s);const h=await t(`/auth/attempt-verification?attempt_identifier=${o==null?void 0:o.id}&identifier_type=signin`,{method:"POST",body:a}),f=await G(h);if("data"in f&&((p=(c=f.data)==null?void 0:c.signin_attempts)!=null&&p.length)){const d=f.data.signin_attempts.at(-1);return n(d||null),f.data}else throw new Error("Verification failed")},prepareVerification:async s=>{var f;const a=new URL("/auth/prepare-verification",window.location.origin);a.searchParams.set("attempt_identifier",((f=o==null?void 0:o.id)==null?void 0:f.toString())||""),a.searchParams.set("strategy",s.strategy),a.searchParams.set("identifier_type","signin"),s.strategy==="phone_otp"&&s.lastDigits?a.searchParams.set("last_digits",s.lastDigits):(s.strategy==="email_otp"&&s.redirectUri||s.strategy==="magic_link"&&s.redirectUri)&&a.searchParams.set("redirect_uri",s.redirectUri);const h=await t(a.pathname+a.search,{method:"POST"});return G(h)},completeProfile:async s=>{var c;if(!o)throw new Error("No signin attempt found");const a=new FormData;for(const[p,d]of Object.entries(s))d&&a.append(p,d);const h=await t(`/auth/complete-profile?attempt_id=${o.id}`,{method:"POST",body:a}),f=await G(h);if("data"in f&&f.data){const p=(c=f.data.signin_attempts)==null?void 0:c.find(d=>d.id===o.id);return p&&n(p),f.data}else throw new Error("Profile completion failed")},identify:async s=>{console.log("[identify] Starting with identifier:",s);const a=await t("/auth/identify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identifier:s})});console.log("[identify] Response status:",a.status);const h=await G(a);return console.log("[identify] Mapped result:",h),h.data},initEnterpriseSso:async(s,a)=>{console.log("[initEnterpriseSso] Starting with connectionId:",s,"redirectUri:",a);const h=new URLSearchParams({connection_id:s});a&&h.append("redirect_uri",a);const f=await t(`/auth/sso/login?${h.toString()}`,{method:"POST"});console.log("[initEnterpriseSso] Response status:",f.status);const c=await G(f);return console.log("[initEnterpriseSso] Mapped result:",c),c.data}},discardSignInAttempt:()=>{n(null)},setSignInAttempt:n}}function Dr(t){const{loading:r,signIn:o,signinAttempt:n,discardSignInAttempt:s,setSignInAttempt:a}=oc();if(r)return{loading:!0,signIn:null,signinAttempt:null,discardSignInAttempt:s,setSignInAttempt:a};const h=(()=>{switch(t){case"username":return o.createStrategy("username");case"email":return o.createStrategy("email");case"phone":return o.createStrategy("phone");case"email_otp":return o.createStrategy("email_otp");case"magic_link":return o.createStrategy("magic_link");case"oauth":return o.createStrategy("oauth");case"generic":return o.createStrategy("generic");default:throw new Error("Invalid sign-in strategy")}})();return{loading:!1,signinAttempt:n,signIn:{create:h,completeVerification:o.completeVerification,prepareVerification:o.prepareVerification,completeProfile:o.completeProfile,identify:o.identify,initEnterpriseSso:o.initEnterpriseSso},discardSignInAttempt:s,setSignInAttempt:a}}function Wd(t,r,o){return{create:async n=>{var f,c,p;const s=new FormData;for(const[d,u]of Object.entries(n))s.append(d,u);const a=await t("/auth/signup",{method:"POST",body:s}),h=await G(a);return"data"in h&&((c=(f=h.data)==null?void 0:f.signup_attempts)!=null&&c.length)&&o(((p=h.data.signup_attempts)==null?void 0:p.at(-1))||null),h},prepareVerification:async n=>{var h;const s=new URL("/auth/prepare-verification",window.location.origin);s.searchParams.set("attempt_identifier",((h=r==null?void 0:r.id)==null?void 0:h.toString())||""),s.searchParams.set("strategy",n.strategy),s.searchParams.set("identifier_type","signup"),n.strategy==="phone_otp"&&n.lastDigits?s.searchParams.set("last_digits",n.lastDigits):n.strategy==="email_otp"&&n.redirectUri&&s.searchParams.set("redirect_uri",n.redirectUri);const a=await t(s.pathname+s.search,{method:"POST"});return G(a)},completeVerification:async n=>{var f,c;const s=new FormData;s.append("verification_code",n);const a=await t(`/auth/attempt-verification?attempt_identifier=${r==null?void 0:r.id}&identifier_type=signup`,{method:"POST",body:s}),h=await G(a);return"data"in h&&((c=(f=h.data)==null?void 0:f.signup_attempts)!=null&&c.length)&&o(h.data.signup_attempts.at(-1)||null),h},validateDeploymentInvitation:async n=>{try{const s=await t(`/deployment/invitations/validate?token=${encodeURIComponent(n)}`,{method:"GET"}),a=await G(s);return"data"in a&&a.data?a.data:{valid:!1,message:"Failed to validate invitation",error_code:"VALIDATION_ERROR"}}catch(s){return{valid:!1,message:s.message||"Failed to validate invitation",error_code:"NETWORK_ERROR"}}}}}function nc(){const{client:t,loading:r}=Ne(),[o,n]=i.useState(null);return r?{loading:!0,signUp:null,signupAttempt:null,discardSignupAttempt:()=>{n(null)}}:{loading:!1,signupAttempt:o,discardSignupAttempt:()=>{n(null)},signUp:Wd(t,o,n)}}const Ve=()=>{const{adapter:t,deployment:r}=ve(),o=t.useNavigate(),n=(f,c)=>{o?o(f,c):window.location.href=f};return{navigate:n,navigateToSignIn:f=>{if(!r)return;const c=f||window.location.href,p=new URLSearchParams;p.set("redirect_uri",c),(r==null?void 0:r.mode)==="staging"&&p.set("dev_session",localStorage.getItem("__dev_session__")??""),n(`${r.ui_settings.sign_in_page_url}?${p.toString()}`,{replace:!0})},navigateToAccountSelection:f=>{if(!r)return;const c=f||window.location.href,p=new URLSearchParams;p.set("redirect_uri",c),(r==null?void 0:r.mode)==="staging"&&p.set("dev_session",localStorage.getItem("__dev_session__")??""),n(`https://${r.frontend_host}?${p.toString()}`,{replace:!0})},navigateToSignUp:f=>{if(!r)return;const c=f||window.location.href,p=new URLSearchParams;p.set("redirect_uri",c),(r==null?void 0:r.mode)==="staging"&&p.set("dev_session",localStorage.getItem("__dev_session__")??""),n(`${r.ui_settings.sign_up_page_url}?${p.toString()}`,{replace:!0})}}};async function Vd(t){const r=await t("/session",{method:"GET"});return(await G(r)).data}async function Gd(t,r){const o=await t(`/session/switch-sign-in?sign_in_id=${r}`,{method:"POST"});return G(o)}async function Hd(t,r){const o=r?`/session/sign-out?sign_in_id=${r}`:"/session/sign-out",n=await t(o,{method:"POST"});return G(n)}async function qd(t,r){const o=await t(`/session/switch-organization${r?`?organization_id=${r}`:""}`,{method:"POST"});return G(o)}async function Yd(t,r){const o=await t(`/session/switch-workspace?workspace_id=${r}`,{method:"POST"});return G(o)}const ra=new Map,Tr=new Map;function zt(){ra.clear(),Tr.clear()}async function Zd(t,r){const o=await t(`/session/token${r?`?template=${r}`:""}`);return G(o)}function Be(){const{client:t,loading:r}=Ne(),{deployment:o}=ve(),{navigate:n}=Ve(),{cache:s}=Ji(),{data:a,error:h,mutate:f,isLoading:c}=Fe(r?null:"/session",()=>Vd(t),{refreshInterval:3e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,revalidateIfStale:!1,dedupingInterval:5e3}),p=i.useCallback(async()=>{await f(void 0,{revalidate:!0})},[f]),d=i.useCallback(async(u="default")=>{if(!a)throw new Error("no session");const g=ra.get(u);if(g&&g.expires>Date.now())return(g==null?void 0:g.token)||"";Tr.get(u)||Tr.set(u,Zd(t,u));const m=await Tr.get(u);return Tr.delete(u),ra.set(u,m.data),m.data.token},[t,a==null?void 0:a.active_signin]);return r||!a||c?{loading:!0,error:h,session:null,switchSignIn:null,switchOrganization:null,switchWorkspace:null,signOut:null,getToken:null,refetch:p}:{loading:c,error:h,session:a,switchSignIn:async u=>{await Gd(t,u),await f(void 0,{revalidate:!0})},signOut:async u=>{await Hd(t,u);const g=["/session","/user","/me/signins","/me/organization-memberships","/me/workspace-memberships","wacht-notifications:channel-counts"],m=["wacht-notifications:","wacht-agent-sessions:","wacht-agent-contexts:","wacht-org-domains:","wacht-api-workspaces:","wacht-api-organizations:"];if(s instanceof Map){const v=Array.from(s.keys());for(const y of v){let S=!1;(g.includes(y)||typeof y=="string"&&m.some(E=>y.startsWith(E)))&&(S=!0),S&&s.delete(y)}}zt(),await f(void 0,{revalidate:!0}),o!=null&&o.ui_settings&&(u&&o.ui_settings.after_sign_out_one_page_url?n(o.ui_settings.after_sign_out_one_page_url):!u&&o.ui_settings.after_sign_out_all_page_url&&n(o.ui_settings.after_sign_out_all_page_url))},switchOrganization:async u=>{await qd(t,u),zt(),await f(void 0,{revalidate:!0})},switchWorkspace:async u=>{await Yd(t,u),zt(),await f(void 0,{revalidate:!0})},getToken:d,refetch:p}}const qo=()=>{const{organizationMemberships:t,refetch:r,loading:o}=bt(),{client:n}=Ne(),{refetch:s}=Be(),a=i.useCallback(async P=>(await G(await n(`/organizations/${P.id}/roles`,{method:"GET"}))).data,[n]),h=i.useCallback(async P=>(await G(await n(`/organizations/${P.id}/members`,{method:"GET"}))).data,[n]),f=i.useCallback(async P=>(await G(await n(`/organizations/${P.id}/invitations`,{method:"GET"}))).data,[n]),c=i.useCallback(async P=>(await G(await n(`/organizations/${P.id}/domains`,{method:"GET"}))).data,[n]),p=i.useCallback(async(P,z)=>{await n(`/organizations/${P.id}/members/${z.id}/remove`,{method:"POST"}),await r()},[r,n]),d=i.useCallback(async P=>{const z=new FormData;z.append("name",P.name),P.image&&z.append("image",P.image),P.description&&z.append("description",P.description);const T=await G(await n("/organizations",{method:"POST",body:z}));return zt(),await r(),await s(),T},[s,r,n]),u=i.useCallback(async(P,z)=>{const T=Object.entries(z).reduce((N,[H,L])=>(L&&N.append(H,L),N),new FormData),M=await G(await n(`/organizations/${P.id}/update`,{method:"POST",body:T}));return await r(),M},[r,n]),g=i.useCallback(async(P,z)=>{await n(`/organizations/${P.id}/roles/${z.id}/remove`,{method:"POST"})},[n]),m=i.useCallback(async(P,z)=>{const T=new FormData;return T.append("domain",z.fqdn),await G(await n(`/organizations/${P.id}/domains`,{method:"POST",body:T}))},[n]),v=i.useCallback(async(P,z)=>await G(await n(`/organizations/${P.id}/domains/${z.id}/verify`,{method:"POST"})),[n]),y=i.useCallback(async(P,z)=>await G(await n(`/organizations/${P.id}/domains/${z.id}/delete`,{method:"POST"})),[n]),S=i.useCallback(async P=>(await G(await n(`/organizations/${P.id}/enterprise-connections`,{method:"GET"}))).data,[n]),E=i.useCallback(async(P,z)=>{const T=new FormData;return T.append("protocol",z.protocol),T.append("idp_entity_id",z.idp_entity_id),T.append("idp_sso_url",z.idp_sso_url),T.append("idp_certificate",z.idp_certificate),z.domain_id&&T.append("domain_id",z.domain_id),(await G(await n(`/organizations/${P.id}/enterprise-connections`,{method:"POST",body:T}))).data},[n]),b=i.useCallback(async(P,z,T)=>{const M=new FormData;return T.idp_entity_id&&M.append("idp_entity_id",T.idp_entity_id),T.idp_sso_url&&M.append("idp_sso_url",T.idp_sso_url),T.idp_certificate&&M.append("idp_certificate",T.idp_certificate),T.domain_id&&M.append("domain_id",T.domain_id),(await G(await n(`/organizations/${P.id}/enterprise-connections/${z}/update`,{method:"POST",body:M}))).data},[n]),$=i.useCallback(async(P,z)=>{await n(`/organizations/${P.id}/enterprise-connections/${z}/delete`,{method:"POST"})},[n]),C=i.useCallback(async(P,z)=>{const T=new FormData;return T.append("name",z.name),z.permissions&&z.permissions.forEach((N,H)=>{T.append(`permissions[${H}]`,N)}),await G(await n(`/organizations/${P.id}/roles`,{method:"POST",body:T}))},[n]),w=i.useCallback(async P=>(await G(await n(`/organizations/${P.id}/leave`,{method:"POST"}))).data,[n]),j=i.useCallback(async P=>{const z=await G(await n(`/organizations/${P.id}/delete`,{method:"POST"}));return zt(),await r(),await s(),z.data},[n,r,s]),x=i.useCallback(async(P,z,T)=>(await G(await n(`/organizations/${P.id}/members/${z.id}/roles/${T.id}/add`,{method:"POST"}))).data,[n]),I=i.useCallback(async(P,z,T)=>(await G(await n(`/organizations/${P.id}/members/${z.id}/roles/${T.id}/remove`,{method:"POST"}))).data,[n]),k=i.useCallback(async(P,z)=>{var N,H;const T=new FormData;return T.append("email",z.email),T.append("role_id",z.organizationRole.id),(N=z.workspace)!=null&&N.id&&T.append("workspace_id",z.workspace.id),(H=z.workspaceRole)!=null&&H.id&&T.append("workspace_role_id",z.workspaceRole.id),(await G(await n(`/organizations/${P.id}/invitations`,{method:"POST",body:T}))).data},[n]),R=i.useCallback(async(P,z)=>(await G(await n(`/organizations/${P.id}/invitations/${z.id}/remove`,{method:"POST"}))).data,[n]),_=i.useCallback(async(P,z)=>(await G(await n(`/organizations/${P.id}/invitations/${z.id}/resend`,{method:"POST"}))).data,[n]);return{organizations:i.useMemo(()=>t==null?void 0:t.map(P=>P.organization),[t]),loading:o,error:null,refetch:r,leaveOrganization:w,getOrganizationRoles:a,getOrganizationMembers:h,removeOrganizationMember:p,createOrganization:d,getOrganizationInvitations:f,getOrganizationDomains:c,addOrganizationDomain:m,verifyOrganizationDomain:v,removeOrganizationDomain:y,addRoleToOrganizationMember:x,removeRoleFromOrganizationMember:I,inviteOrganizationMember:k,discardOrganizationInvitation:R,resendOrganizationInvitation:_,updateOrganization:u,addRole:C,removeOrganizationRoles:g,deleteOrganization:j,getEnterpriseConnections:S,createEnterpriseConnection:E,updateEnterpriseConnection:b,deleteEnterpriseConnection:$}},qe=()=>{const{loading:t,error:r,refetch:o,getOrganizationMembers:n,getOrganizationRoles:s,leaveOrganization:a,removeOrganizationMember:h,getOrganizationInvitations:f,getOrganizationDomains:c,removeOrganizationDomain:p,addOrganizationDomain:d,verifyOrganizationDomain:u,addRoleToOrganizationMember:g,removeRoleFromOrganizationMember:m,inviteOrganizationMember:v,discardOrganizationInvitation:y,resendOrganizationInvitation:S,updateOrganization:E,removeOrganizationRoles:b,getEnterpriseConnections:$,createEnterpriseConnection:C,updateEnterpriseConnection:w,deleteEnterpriseConnection:j}=qo(),{session:x,error:I,loading:k}=Be(),{organizationMemberships:R}=bt(),_=i.useMemo(()=>{var B;return((B=R==null?void 0:R.find(V=>{var D;return V.id===((D=x==null?void 0:x.active_signin)==null?void 0:D.active_organization_membership_id)}))==null?void 0:B.organization)||null},[R,x]),O=i.useCallback(async B=>_?await E(_,B):[],[_,E]),P=i.useCallback(async()=>_?await n(_):[],[_,n]),z=i.useCallback(async()=>_?await s(_):[],[_,s]),T=i.useCallback(async B=>_?await h(_,B):[],[_,h]),M=i.useCallback(async B=>_?await b(_,B):void 0,[_,b]),N=i.useCallback(async()=>_?await c(_):[],[_,c]),H=i.useCallback(async B=>_?await d(_,B):void 0,[_,d]),L=i.useCallback(async B=>_?await u(_,B):void 0,[_,u]),A=i.useCallback(async B=>_?await p(_,B):void 0,[_,p]),se=i.useCallback(async(B,V)=>_?await g(_,B,V):void 0,[_,g]),te=i.useCallback(async(B,V)=>_?await m(_,B,V):void 0,[_,m]),U=i.useCallback(async B=>_?await v(_,B):void 0,[_,v]),K=i.useCallback(async B=>_?await y(_,B):void 0,[_,y]),ee=i.useCallback(async B=>_?await S(_,B):void 0,[_,S]),J=i.useCallback(async()=>{_&&await a(_)},[_,a]),ie=i.useCallback(async()=>_?await f(_):[],[_,f]),oe=i.useCallback(async()=>_?await $(_):[],[_,$]),de=i.useCallback(async B=>{if(_)return await C(_,B)},[_,C]),Q=i.useCallback(async(B,V)=>{if(_)return await w(_,B,V)},[_,w]),ce=i.useCallback(async B=>{_&&await j(_,B)},[_,j]);return k||t?{activeOrganization:null,loading:!0,error:I||r,updateOrganization:null,getRoles:null,getMembers:null,getDomains:null,addDomain:null,verifyDomain:null,removeDomain:null,removeRole:null,getInvitations:null,removeMember:null,addMemberRole:null,removeMemberRole:null,inviteMember:null,discardInvitation:null,resendInvitation:null,leave:null,getEnterpriseConnections:null,createEnterpriseConnection:null,updateEnterpriseConnection:null,deleteEnterpriseConnection:null}:{activeOrganization:_,loading:!1,refetch:o,getRoles:z,updateOrganization:O,getMembers:P,getDomains:N,addDomain:H,verifyDomain:L,removeDomain:A,getInvitations:ie,removeMember:T,leave:J,removeRole:M,addMemberRole:se,removeMemberRole:te,inviteMember:U,discardInvitation:K,resendInvitation:ee,getEnterpriseConnections:oe,createEnterpriseConnection:de,updateEnterpriseConnection:Q,deleteEnterpriseConnection:ce,error:null}};async function Qd(t){return(await G(await t("/me/organization-memberships"))).data}const bt=()=>{const{client:t,loading:r}=Ne(),{data:o,isLoading:n,error:s,mutate:a}=Fe(r?null:"/me/organization-memberships",()=>Qd(t),{refreshInterval:3e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,revalidateIfStale:!1,dedupingInterval:5e3}),h=i.useCallback(async()=>{await a(void 0,{revalidate:!0})},[a]);return{organizationMemberships:o,loading:r||n,error:s,refetch:h}};async function Kd(t){return(await G(await t("/me/workspace-memberships"))).data}async function Xd(t,r,o){return(await G(await t(`/workspaces/${r}/members/${o}/remove`,{method:"POST"}))).data}const Yo=()=>{const{client:t,loading:r}=Ne(),{deployment:o}=ve(),{data:n,isLoading:s,error:a,mutate:h}=Fe(!r&&(o!=null&&o.b2b_settings.workspaces_enabled)?"/me/workspace-memberships":null,()=>Kd(t),{refreshInterval:3e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,revalidateIfStale:!1,dedupingInterval:5e3}),f=i.useCallback(async()=>{await h(void 0,{revalidate:!0})},[h]);return{workspaceMemberships:n,loading:r||s,error:a,refetch:f}},yt=()=>{const{workspaceMemberships:t,refetch:r,loading:o,error:n}=Yo(),{client:s}=Ne(),a=i.useMemo(()=>t==null?void 0:t.map(b=>({...b.workspace,organization:b.organization,eligibility_restriction:b.eligibility_restriction})),[t]),h=i.useCallback(async(b,$,C,w)=>{const j=new FormData;j.append("name",$),C&&j.append("image",C),w&&j.append("description",w),j.append("organization_id",b);const x=await G(await s("/workspaces",{method:"POST",body:j}));return zt(),await r(),x.data},[s,r]),f=i.useCallback(async(b,$)=>{const C=await Xd(s,b,$);return await r(),C},[s,r]),c=i.useCallback(async(b,$)=>{const C=new FormData;$.name&&C.append("name",$.name),$.description&&C.append("description",$.description),$.image&&C.append("image",$.image),$.enforce_2fa!==void 0&&C.append("enforce_2fa",String($.enforce_2fa)),$.enable_ip_restriction!==void 0&&C.append("enable_ip_restriction",String($.enable_ip_restriction)),$.whitelisted_ips&&$.whitelisted_ips.forEach(j=>C.append("whitelisted_ips",j));const w=await G(await s(`/workspaces/${b.id}/update`,{method:"POST",body:C}));return await r(),w.data},[s,r]),p=i.useCallback(async b=>{const $=await G(await s(`/workspaces/${b.id}/delete`,{method:"POST"}));return zt(),await r(),$.data},[s,r]),d=i.useCallback(async b=>(await G(await s(`/workspaces/${b.id}/members`,{method:"GET"}))).data,[s]),u=i.useCallback(async b=>(await G(await s(`/workspaces/${b.id}/roles`,{method:"GET"}))).data,[s]),g=i.useCallback(async(b,$,C)=>(await G(await s(`/workspaces/${b.id}/roles`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:$,permissions:C})}))).data,[s]),m=i.useCallback(async(b,$)=>(await G(await s(`/workspaces/${b.id}/roles/${$.id}/delete`,{method:"POST"}))).data,[s]),v=i.useCallback(async(b,$,C)=>(await G(await s(`/workspaces/${b.id}/members`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:$,role_id:C})}))).data,[s]),y=i.useCallback(async(b,$)=>{const C=await G(await s(`/workspaces/${b.id}/members/${$}/remove`,{method:"POST"}));return await r(),C.data},[s,r]),S=i.useCallback(async(b,$,C)=>(await G(await s(`/workspaces/${b.id}/members/${$}/roles/${C}/add`,{method:"POST"}))).data,[s]),E=i.useCallback(async(b,$,C)=>(await G(await s(`/workspaces/${b.id}/members/${$}/roles/${C}/remove`,{method:"POST"}))).data,[s]);return{workspaces:a||[],loading:o,error:n,refetch:r,leaveWorkspace:f,createWorkspace:h,updateWorkspace:c,deleteWorkspace:p,getWorkspaceMembers:d,getWorkspaceRoles:u,createWorkspaceRole:g,deleteWorkspaceRole:m,inviteWorkspaceMember:v,removeWorkspaceMember:y,addWorkspaceMemberRole:S,removeWorkspaceMemberRole:E}},Rt=()=>{const{refetch:t,loading:r,error:o,leaveWorkspace:n,updateWorkspace:s,deleteWorkspace:a,getWorkspaceMembers:h,getWorkspaceRoles:f,createWorkspaceRole:c,deleteWorkspaceRole:p,inviteWorkspaceMember:d,removeWorkspaceMember:u,addWorkspaceMemberRole:g,removeWorkspaceMemberRole:m}=yt(),{workspaceMemberships:v}=Yo(),{session:y,loading:S,error:E}=Be(),b=i.useMemo(()=>{var M;return((M=v==null?void 0:v.find(N=>{var H;return N.id===((H=y==null?void 0:y.active_signin)==null?void 0:H.active_workspace_membership_id)}))==null?void 0:M.workspace)||null},[v,y]),$=i.useCallback(async()=>{var M;if(!(!b||!((M=y==null?void 0:y.active_signin)!=null&&M.user_id)))return await n(b.id,y.active_signin.user_id)},[b,n,y]),C=i.useCallback(async M=>{if(b)return await s(b,M)},[b,s]),w=i.useCallback(async()=>{if(b)return await a(b)},[b,a]),j=i.useCallback(async()=>b?await h(b):[],[b,h]),x=i.useCallback(async()=>b?await f(b):[],[b,f]),I=i.useCallback(async(M,N)=>{if(b)return await c(b,M,N)},[b,c]),k=i.useCallback(async M=>{if(b)return await p(b,M)},[b,p]),R=i.useCallback(async(M,N)=>{if(b)return await d(b,M,N)},[b,d]),_=i.useCallback(async M=>{if(b)return await u(b,M)},[b,u]),O=i.useCallback(async(M,N)=>{if(b)return await g(b,M,N)},[b,g]),P=i.useCallback(async(M,N)=>{if(b)return await m(b,M,N)},[b,m]),z=r||S,T=o||E;return z?{activeWorkspace:null,loading:!0,error:T,refetch:t,leave:null,updateWorkspace:null,deleteWorkspace:null,getMembers:null,getRoles:null,createRole:null,deleteRole:null,inviteMember:null,removeMember:null,addMemberRole:null,removeMemberRole:null}:{activeWorkspace:b,loading:!1,error:T,refetch:t,leave:$,updateWorkspace:C,deleteWorkspace:w,getMembers:j,getRoles:x,createRole:I,deleteRole:k,inviteMember:R,removeMember:_,addMemberRole:O,removeMemberRole:P}},Jd=async t=>(await G(await t("/me"))).data,eu=async t=>(await G(await t("/me/signins"))).data;function rr(){const{client:t,loading:r}=Ne(),{data:o,error:n,isLoading:s,mutate:a}=Fe(r?null:"/user",()=>Jd(t)),h=async z=>{const T=new FormData;for(const[N,H]of Object.entries(z))H!=null&&H!==""&&T.append(N,String(H));const M=await G(await t("/me",{method:"POST",body:T}));return a(),M},f=async()=>await G(await t("/me/email-addresses",{method:"GET"})),c=async z=>await G(await t(`/me/email-addresses/${z}`,{method:"GET"})),p=async z=>{const T=new FormData;return T.append("email",z),await G(await t("/me/email-addresses",{method:"POST",body:T}))},d=async z=>await G(await t(`/me/email-addresses/${z}/delete`,{method:"POST"})),u=async z=>await G(await t(`/me/email-addresses/${z}/prepare-verification`,{method:"POST"})),g=async(z,T)=>await G(await t(`/me/email-addresses/${z}/attempt-verification?code=${T}`,{method:"POST"})),m=async(z,T)=>{const M=new FormData;return M.append("phone_number",z),M.append("country_code",T),await G(await t("/me/phone-numbers",{method:"POST",body:M}))},v=async z=>await G(await t(`/me/phone-numbers/${z}/delete`,{method:"POST"})),y=async z=>await G(await t(`/me/phone-numbers/${z}/prepare-verification`,{method:"POST"})),S=async(z,T)=>{const M=new FormData;return M.append("code",T),await G(await t(`/me/phone-numbers/${z}/attempt-verification`,{method:"POST",body:M}))},E=async z=>{const T=await G(await t(`/me/phone-numbers/${z}/make-primary`,{method:"POST"}));return a(),T},b=async z=>await G(await t(`/me/email-addresses/${z}/make-primary`,{method:"POST"})),$=async()=>(await G(await t("/me/authenticator",{method:"POST"}))).data,C=async(z,T)=>{const M=new FormData;return M.append("authenticator_id",z),T.forEach(H=>{M.append("codes",H)}),await G(await t("/me/authenticator/attempt-verification",{method:"POST",body:M}))},w=async z=>await G(await t(`/me/authenticator/${z}/delete`,{method:"POST"})),j=async()=>(await G(await t("/me/backup-codes",{method:"POST"}))).data,x=async z=>{const T=new FormData;return T.append("file",z),await G(await t("/me/profile-picture",{method:"POST",body:T}))},I=async()=>(await G(await t("/me/backup-codes/regenerate",{method:"POST"}))).data,k=async(z,T)=>{const M=new FormData;return M.append("current_password",z),M.append("new_password",T),await G(await t("/me/update-password",{method:"POST",body:M}))},R=async z=>{const T=new FormData;T.append("current_password",z);const M=await G(await t("/me/remove-password",{method:"POST",body:T}));return a(),M},_=async z=>{const T=new FormData;return T.append("password",z),await G(await t("/me/account/delete",{method:"POST",body:T}))},O=async z=>await G(await t(`/me/social-connections/${z}/disconnect`,{method:"POST"})),P=async({provider:z,redirectUri:T})=>{var H;const M=new URLSearchParams({provider:z});T&&M.append("redirect_uri",T);const N=await G(await t(`/me/init-sso-connection?${M.toString()}`,{method:"POST"}));return"data"in N&&((H=N.data)!=null&&H.oauth_url)&&window.open(N.data.oauth_url,"_blank"),N};return{user:{...o,refetch:a},loading:r||s,error:n||null,updateProfile:h,getEmailAddresses:f,getEmailAddress:c,createEmailAddress:p,deleteEmailAddress:d,prepareEmailVerification:u,attemptEmailVerification:g,makeEmailPrimary:b,createPhoneNumber:m,deletePhoneNumber:v,preparePhoneVerification:y,attemptPhoneVerification:S,makePhonePrimary:E,setupAuthenticator:$,verifyAuthenticator:C,deleteAuthenticator:w,generateBackupCodes:j,regenerateBackupCodes:I,updateProfilePicture:x,disconnectSocialConnection:O,connectSocialAccount:P,updatePassword:k,removePassword:R,deleteAccount:_}}function ac(){const{client:t,loading:r}=Ne(),{data:o,error:n,isLoading:s,mutate:a}=Fe(r?null:"/me/signins",()=>eu(t));return{signins:o,error:n||null,removeSignin:async f=>await G(await t(`/me/signins/${f}/signout`,{method:"POST"})),refetch:a,loading:s||r}}function tu(){const{session:t,loading:r}=Be(),{loading:o,organizationMemberships:n}=bt(),{loading:s,workspaceMemberships:a}=Yo();if(r||o||s)return{loading:!0,orgMembership:null,workspaceMembership:null};const h=i.useMemo(()=>!t||!t.signins||t.signins.length===0?null:n==null?void 0:n.find(c=>{var p;return c.id===((p=t.active_signin)==null?void 0:p.active_organization_membership_id)}),[t]),f=i.useMemo(()=>!t||!t.signins||t.signins.length===0?null:a==null?void 0:a.find(c=>{var p;return c.id===((p=t.active_signin)==null?void 0:p.active_workspace_membership_id)}),[t]);return{loading:!1,orgMembership:h,workspaceMembership:f}}function sc(){const{client:t,loading:r}=Ne(),[o,n]=i.useState(!1),s=async a=>{n(!0);try{const h=new FormData;for(const[p,d]of Object.entries(a))d&&h.append(p,d);const f=await t("/waitlist/join",{method:"POST",body:h});return await G(f)}finally{n(!1)}};return r?{loading:!0,joinWaitlist:null}:{loading:o,joinWaitlist:s}}function ic(){const{client:t,loading:r}=Ne(),[o,n]=i.useState(!1),[s,a]=i.useState(null),[h,f]=i.useState(null),[c,p]=i.useState(null),[d,u]=i.useState(!1),[g,m]=i.useState(null);i.useEffect(()=>{if(d||r)return;const y=new URLSearchParams(window.location.search),S=y.get("code"),E=y.get("state"),b=y.get("error"),$=y.get("error_description");if(!S&&!b){u(!0);const C=new Error("No OAuth callback data found.");a(C);return}if(u(!0),n(!0),b){const C=$||b,w=new Error(`OAuth Error: ${C}`);a(w),n(!1);return}if(S&&E)v(S,E);else{const C=new Error("Missing required OAuth parameters");a(C),n(!1)}},[d,r]);const v=async(y,S)=>{try{let E,b;try{const w=S.split(".");if(w.length!==2)throw new Error("Invalid OAuth state format - missing signature");const j=w[0].replace(/-/g,"+").replace(/_/g,"/"),x=j.length%4?"=".repeat(4-j.length%4):"",k=atob(j+x).split("|")[0];if(k==="sign_in")E="/auth/oauth2/callback",b="GET";else if(k==="connect_social")E="/me/sso-connection-callback",b="POST";else throw new Error(`Unknown OAuth action: ${k}`)}catch(w){const j=w instanceof Error?w:new Error("Failed to parse OAuth state");a(new Error(`Invalid OAuth callback: ${j.message}. The authorization link may be expired or malformed. Please try signing in again.`)),n(!1);return}const $=await t(`${E}?code=${encodeURIComponent(y)}&state=${encodeURIComponent(S)}`,{method:b}),C=await G($);if("data"in C){const w=C.data.session,j=C.data.redirect_uri||null;if(f(w),p(j),w.signin_attempts&&w.signin_attempts.length>0){const x=w.signin_attempts.at(-1);x&&m(x)}}else{const w=new Error("SSO callback failed");a(w)}}catch(E){const b=E instanceof Error?E:new Error("Unknown error occurred");a(b)}finally{n(!1)}};return{loading:o,error:s,session:h,redirectUri:c,processed:d,signinAttempt:g}}function cc(){const{client:t,loading:r}=Ne(),[o,n]=i.useState(!1),[s,a]=i.useState(null);return{loading:r||o,verifyMagicLink:async f=>{if(!f.token||!f.attempt)throw new Error("Invalid magic link parameters");n(!0),a(null);try{const c=new URL("/auth/verify-magic-link",window.location.origin);c.searchParams.set("token",f.token),c.searchParams.set("attempt",f.attempt),f.redirectUri&&c.searchParams.set("redirect_uri",f.redirectUri);const p=await t(c.pathname+c.search,{method:"GET"}),d=await G(p);return n(!1),a(!0),d}catch(c){throw n(!1),a(!1),c}},success:s}}function lc(){const[t,r]=i.useState({});return i.useEffect(()=>{const o=new URLSearchParams(window.location.search);r({token:o.get("token")||void 0,attempt:o.get("attempt")||void 0,redirectUri:o.get("redirect_uri")||void 0})},[]),t}function dc(){const{client:t,loading:r}=Ne();return{loading:r,forgotPassword:async a=>{const h=new FormData;h.append("email",a);const f=await t("/auth/forgot-password",{method:"POST",body:h});return await G(f)},verifyOtp:async(a,h)=>{const f=new FormData;f.append("email",a),f.append("otp",h);const c=await t("/auth/forgot-password",{method:"POST",body:f});return await G(c)},resetPassword:async(a,h)=>{const f=new FormData;f.append("token",a),f.append("password",h);const c=await t("/auth/reset-password",{method:"POST",body:f});return await G(c)}}}function uc({enabled:t=!0,channels:r,organizationIds:o,workspaceIds:n,onNotification:s,onError:a,reconnectDelay:h=1e3,maxReconnectAttempts:f=5}={}){const{session:c,loading:p}=Be(),{deployment:d,loading:u}=ve(),[g,m]=i.useState(!1),[v,y]=i.useState(null),S=i.useRef(null),E=i.useRef(null),b=i.useRef(0),$=i.useRef(null),C=i.useRef(s),w=i.useRef(a),j=i.useRef(r),x=i.useRef(o),I=i.useRef(n),k=i.useRef(h),R=i.useRef(f);C.current=s,w.current=a,j.current=r,x.current=o,I.current=n,k.current=h,R.current=f;const _=i.useCallback(()=>{E.current&&(clearTimeout(E.current),E.current=null),$.current&&(clearInterval($.current),$.current=null),S.current&&(S.current.close(),S.current=null)},[]),O=i.useCallback(async()=>{var H;if(!t||p||u||!c||!d)return;_();const T=new URL(d.backend_host),M=T.protocol==="https:"?"wss:":"ws:",N=new URL("/realtime/notifications",`${M}//${T.host}`);if(d.mode==="staging"){const L=localStorage.getItem("__dev_session__");L&&N.searchParams.set("__dev_session__",L)}j.current&&j.current.length>0&&j.current.forEach(L=>N.searchParams.append("channels",L)),x.current&&x.current.length>0&&x.current.forEach(L=>N.searchParams.append("organization_ids",L.toString())),I.current&&I.current.length>0&&I.current.forEach(L=>N.searchParams.append("workspace_ids",L.toString()));try{const L=new WebSocket(N.toString());S.current=L,L.onopen=()=>{m(!0),y(null),b.current=0,$.current=setInterval(()=>{L.readyState===WebSocket.OPEN&&L.send("ping")},3e4)},L.onmessage=A=>{var se,te;try{const U=JSON.parse(A.data);if(U.type==="notification"&&U.data)(se=C.current)==null||se.call(C,U.data);else if(U.type==="error"){const K=U.error||"Unknown error occurred";y(K),(te=w.current)==null||te.call(w,K)}else U.type}catch{}},L.onerror=()=>{var A;y("Connection error occurred"),(A=w.current)==null||A.call(w,"Connection error occurred")},L.onclose=A=>{var se;if(m(!1),$.current&&(clearInterval($.current),$.current=null),t&&A.code!==1e3&&b.current<R.current){b.current++;const te=k.current*Math.pow(2,b.current-1);E.current=setTimeout(()=>{O()},te)}else b.current>=R.current&&(y("Max reconnection attempts reached"),(se=w.current)==null||se.call(w,"Max reconnection attempts reached"))}}catch{y("Failed to connect"),(H=w.current)==null||H.call(w,"Failed to connect")}},[t,p,u,c,d,_]);i.useEffect(()=>(O(),()=>{_()}),[O,_]),i.useEffect(()=>{S.current&&S.current.readyState===WebSocket.OPEN&&O()},[r,o,n,O]);const P=i.useCallback(()=>{_(),m(!1)},[_]),z=i.useCallback(()=>{b.current=0,O()},[O]);return{isConnected:g,connectionError:v,disconnect:P,reconnect:z}}async function ru(t,r){const o=new URLSearchParams;r&&(r.limit&&o.append("limit",r.limit.toString()),r.offset&&o.append("offset",r.offset.toString()),r.channels&&r.channels.forEach(h=>o.append("channels",h)),r.organization_ids&&r.organization_ids.forEach(h=>o.append("organization_ids",h.toString())),r.workspace_ids&&r.workspace_ids.forEach(h=>o.append("workspace_ids",h.toString())),r.is_read!==void 0&&o.append("is_read",r.is_read.toString()),r.is_archived!==void 0&&o.append("is_archived",r.is_archived.toString()),r.severity&&o.append("severity",r.severity));const n=`/notifications${o.toString()?"?"+o.toString():""}`,s=await t(n,{method:"GET"});return(await G(s)).data}async function ou(t){const r=await t("/notifications/channel-counts",{method:"GET"});return(await G(r)).data}async function nu(t,r){const o=await t(`/notifications/${r}/read`,{method:"POST"});return G(o)}async function au(t){const r=await t("/notifications/mark-all-read",{method:"POST"});return G(r)}async function su(t,r){const o=await t(`/notifications/${r}/delete`,{method:"POST"});return G(o)}function pc(t){const{client:r,loading:o}=Ne(),{data:n,error:s,mutate:a,isLoading:h}=Fe(o?null:`wacht-notifications:${JSON.stringify(t)}`,()=>ru(r,t),{refreshInterval:6e4,revalidateOnFocus:!0});uc({enabled:!o&&!!n,onNotification:i.useCallback(u=>{a(async g=>!g||g.notifications.some(v=>v.id===u.id.toString())?g:{...g,notifications:[{id:u.id.toString(),user_id:u.user_id.toString(),deployment_id:u.deployment_id.toString(),title:u.title,body:u.body,severity:u.severity,action_url:u.action_url,action_label:u.action_label,is_read:!1,is_archived:!1,created_at:u.created_at,updated_at:u.created_at},...g.notifications],unread_count:g.unread_count+1,total:g.total+1},!1)},[a]),onError:i.useCallback(()=>{},[])});const f=i.useCallback(async u=>{o||(await a(async g=>g&&{...g,notifications:g.notifications.map(m=>m.id===u?{...m,is_read:!0}:m),unread_count:Math.max(0,g.unread_count-1)},!1),await nu(r,u),await a())},[r,o,a]),c=i.useCallback(async()=>{o||(await a(async u=>u&&{...u,notifications:u.notifications.map(g=>({...g,is_read:!0})),unread_count:0},!1),await au(r),await a())},[r,a]),p=i.useCallback(async u=>{o||(await a(async g=>{if(!g)return g;const m=g.notifications.find(v=>v.id===u);return{...g,notifications:g.notifications.filter(v=>v.id!==u),unread_count:m&&!m.is_read?Math.max(0,g.unread_count-1):g.unread_count,total:Math.max(0,g.total-1)}},!1),await su(r,u),await a())},[r,o,a]),d=i.useCallback(async()=>{await a()},[a]);return!n||o||h?{loading:!0,notifications:void 0,unreadCount:void 0,unreadCounts:void 0,channels:void 0,hasMore:void 0,markAsRead:void 0,markAllAsRead:void 0,deleteNotification:void 0,error:s,refetch:d}:{loading:!1,error:s,notifications:n.notifications,unreadCount:n.unread_count,unreadCounts:n.unread_counts,channels:n.channels,hasMore:n.has_more,markAsRead:f,markAllAsRead:c,deleteNotification:p,refetch:d}}async function iu(t){const r=await t("/notifications/channel-counts",{method:"GET"});return(await G(r)).data}function cu(){const{client:t,loading:r}=Ne(),{data:o,error:n,mutate:s}=Fe(r?null:"wacht-notifications:channel-counts",()=>iu(t),{refreshInterval:3e4,revalidateOnFocus:!0}),a=async()=>{await s()};return!o||r?{loading:!0,counts:void 0,error:n,refetch:a}:{loading:!1,counts:o,error:n,refetch:a}}const Ht=class Ht{constructor(){tt(this,"ws",null);tt(this,"messageHandlers",new Set);tt(this,"connectionStateHandlers",new Set);tt(this,"reconnectTimer",null);tt(this,"reconnectAttempts",0);tt(this,"url",null);tt(this,"isIntentionalDisconnect",!1);tt(this,"sessionMessages",{});tt(this,"currentSessionKey",null)}static getInstance(){return Ht.instance||(Ht.instance=new Ht),Ht.instance}connect(r){var o,n;if(this.url=r,this.isIntentionalDisconnect=!1,((o=this.ws)==null?void 0:o.readyState)===WebSocket.OPEN&&this.url===r){this.notifyConnectionState({isConnected:!0});return}((n=this.ws)==null?void 0:n.readyState)!==WebSocket.CONNECTING&&this.createConnection()}createConnection(){if(this.url)try{this.ws=new WebSocket(this.url),this.ws.onopen=()=>{this.reconnectAttempts=0,this.notifyConnectionState({isConnected:!0})},this.ws.onmessage=r=>{try{const o=JSON.parse(r.data);this.notifyMessageHandlers(o)}catch{}},this.ws.onerror=()=>{this.notifyConnectionState({isConnected:!1,error:"Connection error"})},this.ws.onclose=()=>{this.ws=null,this.notifyConnectionState({isConnected:!1}),this.isIntentionalDisconnect||this.scheduleReconnect()}}catch(r){this.notifyConnectionState({isConnected:!1,error:r instanceof Error?r.message:"Failed to connect"})}}scheduleReconnect(){this.reconnectAttempts++;const r=Math.min(1e3*Math.pow(2,this.reconnectAttempts-1),3e4),o=Math.random()*.3*r,n=Math.floor(r+o);this.reconnectTimer=setTimeout(()=>{this.createConnection()},n)}disconnect(){this.isIntentionalDisconnect=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.close(),this.ws=null)}send(r){var o;if(((o=this.ws)==null?void 0:o.readyState)===WebSocket.OPEN){const n=JSON.stringify(r);this.ws.send(n)}}onMessage(r){return this.messageHandlers.add(r),()=>{this.messageHandlers.delete(r)}}onConnectionStateChange(r){var o;return this.connectionStateHandlers.add(r),r({isConnected:((o=this.ws)==null?void 0:o.readyState)===WebSocket.OPEN}),()=>{this.connectionStateHandlers.delete(r)}}notifyMessageHandlers(r){this.messageHandlers.forEach(o=>{try{o(r)}catch{}})}notifyConnectionState(r){this.connectionStateHandlers.forEach(o=>{try{o(r)}catch{}})}isConnected(){var r;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN}setCurrentSession(r){this.currentSessionKey=r,this.sessionMessages[r]||(this.sessionMessages[r]=[])}addMessage(r){this.currentSessionKey&&(this.sessionMessages[this.currentSessionKey]||(this.sessionMessages[this.currentSessionKey]=[]),this.sessionMessages[this.currentSessionKey].push(r))}getSessionMessages(r){return this.sessionMessages[r]||[]}clearSessionMessages(r){this.sessionMessages[r]&&(this.sessionMessages[r]=[])}};tt(Ht,"instance");let oa=Ht;const Qe=oa.getInstance(),mt={DISCONNECTED:"disconnected",CONNECTING:"connecting",CONNECTED:"connected",ERROR:"error"},Ae={IDLE:"idle",STARTING:"starting",RUNNING:"running",WAITING_FOR_INPUT:"waiting_for_input",COMPLETED:"completed",FAILED:"failed"},Ot={IDLE:"Idle",STARTING:"Starting",RUNNING:"Running",WAITING_FOR_INPUT:"WaitingForInput",COMPLETED:"Completed",FAILED:"Failed",CANCELLED:"Cancelled"};function Ua(t){switch(t){case Ot.IDLE:return Ae.IDLE;case Ot.STARTING:return Ae.STARTING;case Ot.RUNNING:return Ae.RUNNING;case Ot.WAITING_FOR_INPUT:return Ae.WAITING_FOR_INPUT;case Ot.COMPLETED:return Ae.COMPLETED;case Ot.FAILED:case Ot.CANCELLED:return Ae.FAILED;default:return Ae.IDLE}}function Wa(t){return t===Ae.STARTING||t===Ae.RUNNING||t===Ae.WAITING_FOR_INPUT}function hc({contextId:t,agentName:r,token:o,platformAdapter:n,autoConnect:s=!0}){const{deployment:a}=ve(),{client:h}=Ne(),[f,c]=i.useState([]),[p,d]=i.useState(null),[u,g]=i.useState(null),[m,v]=i.useState(!1),[y,S]=i.useState(!1),[E,b]=i.useState(Ae.IDLE),[$,C]=i.useState({status:mt.DISCONNECTED}),[w,j]=i.useState(!0),[x,I]=i.useState(!1),k=i.useRef(null),R=i.useRef(null),_=i.useCallback(U=>{var K,ee;switch(U.message_type){case"session_connected":if(v(!0),C({status:mt.CONNECTED}),(K=U.data)!=null&&K.execution_status){const ie=U.data.execution_status,oe=Ua(ie);b(oe),S(Wa(oe))}break;case"conversation_message":O(U.data);break;case"user_input_request":P(U.data);break;case"platform_event":z(U.data);break;case"platform_function":T(U.data);break;case"execution_complete":S(!1),b(Ae.IDLE),R.current=null;break;case"execution_error":S(!1),b(Ae.FAILED),R.current=null;break;case"execution_cancelled":S(!1),b(Ae.IDLE),R.current=null;break;case"execution_status":const J=(ee=U.data)==null?void 0:ee.status;if(J){const ie=Ua(J);b(ie),S(Wa(ie))}break}},[p]),O=i.useCallback(U=>{var oe,de,Q,ce,B,V,D,le;const{id:K,message_type:ee,content:J}=U,ie=q=>f.some(ae=>ae.id===q);if(ee==="system_decision"||ee==="action_execution_result"||ee==="assistant_task_breakdown"||ee==="assistant_validation"||ee==="assistant_action_planning"||ee==="context_results"){d(null),g(null);let q="";if(ee==="system_decision"){const ae=J==null?void 0:J.step,ke=J==null?void 0:J.reasoning;if(ae==="gathercontext")ke&&ke.length>0?q=ke.length>60?`${ke.substring(0,60)}...`:ke:q="Gathering context...";else if(ae==="executeaction")q="Executing action";else if(ae==="deliverresponse")q="Preparing response";else if(ae==="taskplanning")q="Planning approach";else if(ae==="validateprogress")q="Validating progress";else if(ae==="acknowledge")q="Processing request";else if(ae==="finishplanning")q="Finalizing plan";else if(ae==="executetasks")q="Executing tasks";else if(ae==="requestuserinput")q="Waiting for input";else if(ae==="complete")q="Completed";else if(ae==="examinetool")q="Examining tool";else if(ae==="examineworkflow")q="Examining workflow";else{const ne=(J==null?void 0:J.confidence)||.5;ne>.8?q="Analyzing":ne>.6?q="Thinking":q="Reasoning"}}else if(ee==="action_execution_result")((oe=J.task_execution)==null?void 0:oe.status)==="completed"?q="Task execution completed":(de=J.task_execution)!=null&&de.approach?q=J.task_execution.approach:q="Executing task";else if(ee==="assistant_task_breakdown")(Q=J.task_breakdown)!=null&&Q.total_tasks?q=`Identified ${J.task_breakdown.total_tasks} tasks`:q="Planning tasks";else if(ee==="assistant_validation")q="Validated results";else if(ee==="assistant_action_planning")(ce=J.task_execution)!=null&&ce.total_tasks?q=`Planned ${J.task_execution.total_tasks} tasks`:(V=(B=J.task_execution)==null?void 0:B.tasks)!=null&&V.length?q=`Planned ${J.task_execution.tasks.length} tasks`:q="Planning actions";else if(ee==="context_results"){const ae=J.query,ke=J.result_count||0;ae&&ae!=="General context gathering"?q=`${ae}: Found ${ke} results`:q=`Found ${ke} results`}q&&!ie(K)&&c(ae=>[...ae,{id:K,role:"system",content:q,timestamp:new Date,metadata:{type:"log",messageType:ee}}]);return}if(ee==="user_message")ie(K)||(d(null),g(null),c(q=>[...q,{id:K,role:"user",content:J.message,images:J.images,timestamp:new Date}]));else if(ee==="agent_response")ie(K)||(d(null),g(null),S(!1),b(Ae.IDLE),R.current=null,c(q=>[...q,{id:K,role:"assistant",content:J.response,timestamp:new Date,isStreaming:!1}]));else if(ee==="assistant_acknowledgment")ie(K)||(d(null),g(null),c(q=>[...q,{id:K,role:"assistant",content:J.acknowledgment_message,timestamp:new Date}]));else if(ee==="assistant_ideation"||ee==="assistant_action_planning"||ee==="action_execution_result"||ee==="assistant_validation"||ee==="assistant_context_gathering"||ee==="assistant_task_breakdown"){let q="";if(J.reasoning_summary)q=J.reasoning_summary;else if((D=J.task_execution)!=null&&D.approach)q=J.task_execution.approach;else if(J.strategic_synthesis)q=J.strategic_synthesis;else if((le=J.task_breakdown)!=null&&le.total_tasks)q=`Breaking down into ${J.task_breakdown.total_tasks} tasks...`;else if(J.acknowledgment_message)q=J.acknowledgment_message;else return;c(ae=>[...ae,{id:K,role:"assistant",content:q,timestamp:new Date}])}else if(ee==="user_input_request"){const q={question:J.question,context:J.context,input_type:J.input_type,options:J.options||J.suggestions,default_value:J.default_value,placeholder:J.placeholder};b("waiting_for_input"),c(ae=>[...ae,{id:K,role:"system",content:q.question,timestamp:new Date,metadata:{type:"user_input_request",userInputRequest:q}}])}},[]),P=i.useCallback(async U=>{b("waiting_for_input");const K=`input-request-${Date.now()}`;c(ee=>[...ee,{id:K,role:"system",content:U.question,timestamp:new Date,metadata:{type:"user_input_request",userInputRequest:U}}])},[]),z=i.useCallback(U=>{const{event_label:K,event_data:ee}=U;n!=null&&n.onPlatformEvent&&n.onPlatformEvent(K,ee)},[n]),T=i.useCallback(async U=>{const{function_name:K,function_data:ee}=U,{parameters:J,execution_id:ie}=ee;if(!(n!=null&&n.onPlatformFunction)){Qe.send({message_type:{platform_function_result:[ie,{error:"No platform function handler registered"}]},data:{}});return}try{const oe=await n.onPlatformFunction(K,J,ie),de={message_type:{platform_function_result:[ie,oe]},data:{}};Qe.send(de)}catch(oe){Qe.send({message_type:{platform_function_result:[ie,{error:oe instanceof Error?oe.message:"Function execution failed",stack:oe instanceof Error?oe.stack:void 0}]},data:{}})}},[n]);i.useEffect(()=>{if(!a)return;const K=`wss://${a==null?void 0:a.backend_host.replace(/https?:\/\//,"")}/realtime/agent?token=${encodeURIComponent(o)}`;C({status:mt.CONNECTING}),Qe.connect(K)},[a,o]),i.useEffect(()=>Qe.onConnectionStateChange(K=>{C({status:K.isConnected?mt.CONNECTED:K.error?mt.ERROR:mt.DISCONNECTED}),v(K.isConnected)}),[]),i.useEffect(()=>Qe.onMessage(_),[_]),i.useEffect(()=>{m&&t&&r&&s&&Qe.send({message_type:{session_connect:[t,r]},data:{}})},[m,t,r,s]);const M=i.useCallback(async()=>(m&&t&&r&&Qe.send({message_type:{session_connect:[t,r]},data:{}}),()=>{}),[m,t,r]),N=i.useCallback((U,K)=>{m&&(d(U),g(K||null),S(!0),b(Ae.STARTING),Qe.send({message_type:{message_input:U},data:K?{images:K}:{}}))},[m]),H=i.useCallback(()=>{c([]),R.current=null},[]),L=i.useCallback(U=>{!m||E!==Ae.WAITING_FOR_INPUT||(Qe.send({message_type:{user_input_response:U},data:{}}),b(Ae.RUNNING))},[m,E]),A=i.useCallback(async U=>{var K;if(!(!o||!t))try{const ee=new URLSearchParams({token:o,limit:"50"});U&&(ee.append("before_id",U),I(!0));const ie=await(await h(`/api/agent/contexts/${t}/messages?${ee}`,{method:"GET"})).json();if(ie.status===200&&ie.data){const oe=ie.data;if(Array.isArray(oe.data)){const de=oe.data.filter(Q=>{var V;let ce=Q.content;if(typeof Q.content=="string")try{ce=JSON.parse(Q.content)}catch{ce={message:Q.content}}const B=((V=Q.metadata)==null?void 0:V.message_type)||(ce==null?void 0:ce.message_type);return B==="user_message"||B==="agent_response"||B==="assistant_acknowledgment"||B==="user_input_request"||B==="system_decision"||B==="action_execution_result"||B==="assistant_task_breakdown"||B==="assistant_validation"||B==="assistant_action_planning"||B==="context_results"}).map(Q=>{var q,ae,ke,ne,Y,Z,F;let ce="",B,V,D=Q.content;if(typeof Q.content=="string")try{D=JSON.parse(Q.content)}catch{D=Q.content}const le=((q=Q.metadata)==null?void 0:q.message_type)||(D==null?void 0:D.message_type);if(le==="user_message"?(ce=(D==null?void 0:D.message)||"",B=(D==null?void 0:D.images)||void 0):le==="agent_response"?ce=(D==null?void 0:D.response)||"":le==="assistant_acknowledgment"?ce=(D==null?void 0:D.acknowledgment_message)||"":le==="user_input_request"&&(ce=(D==null?void 0:D.question)||"",V={type:"user_input_request",userInputRequest:{question:(D==null?void 0:D.question)||"",context:(D==null?void 0:D.context)||"",input_type:(D==null?void 0:D.input_type)||"text",options:(D==null?void 0:D.options)||(D==null?void 0:D.suggestions)||[],default_value:(D==null?void 0:D.default_value)||"",placeholder:(D==null?void 0:D.placeholder)||""}}),le==="system_decision"||le==="action_execution_result"||le==="assistant_task_breakdown"||le==="assistant_validation"||le==="assistant_action_planning"||le==="context_results"){let W="";if(le==="system_decision"){const fe=D==null?void 0:D.step,ye=D==null?void 0:D.reasoning;if(fe==="gathercontext")ye&&ye.length>0?W=ye.length>60?`${ye.substring(0,60)}...`:ye:W="Gathering context...";else if(fe==="executeaction")W="Executing action";else if(fe==="deliverresponse")W="Preparing response";else if(fe==="taskplanning")W="Planning approach";else if(fe==="validateprogress")W="Validating progress";else if(fe==="acknowledge")W="Processing request";else if(fe==="finishplanning")W="Finalizing plan";else if(fe==="executetasks")W="Executing tasks";else if(fe==="requestuserinput")W="Waiting for input";else if(fe==="complete")W="Completed";else if(fe==="examinetool")W="Examining tool";else if(fe==="examineworkflow")W="Examining workflow";else{const re=(D==null?void 0:D.confidence)||.5;re>.8?W="Analyzing":re>.6?W="Thinking":W="Reasoning"}}else if(le==="action_execution_result")((ae=D==null?void 0:D.task_execution)==null?void 0:ae.status)==="completed"?W="Task execution completed":(ke=D==null?void 0:D.task_execution)!=null&&ke.approach?W=D.task_execution.approach:W="Executing task";else if(le==="assistant_task_breakdown")(ne=D==null?void 0:D.task_breakdown)!=null&&ne.total_tasks?W=`Identified ${D.task_breakdown.total_tasks} tasks`:W="Planning tasks";else if(le==="assistant_validation")W="Validated results";else if(le==="assistant_action_planning")(Y=D==null?void 0:D.task_execution)!=null&&Y.total_tasks?W=`Planned ${D.task_execution.total_tasks} tasks`:(F=(Z=D==null?void 0:D.task_execution)==null?void 0:Z.tasks)!=null&&F.length?W=`Planned ${D.task_execution.tasks.length} tasks`:W="Planning actions";else if(le==="context_results"){const fe=D==null?void 0:D.query,ye=(D==null?void 0:D.result_count)||0;fe&&fe!=="General context gathering"?W=`${fe}: Found ${ye} results`:W=`Found ${ye} results`}ce=W,V={type:"log",messageType:le}}return{id:Q.id,role:le==="user_message"?"user":le==="user_input_request"?"system":"assistant",content:ce,images:B,timestamp:new Date(Q.timestamp||Q.created_at||Date.now()),metadata:V}}).filter(Q=>Q.content||Q.metadata||Q.images).sort((Q,ce)=>{const B=BigInt(Q.id),V=BigInt(ce.id);return B<V?-1:B>V?1:0});de.length>0&&(k.current=de[0].id),U?(c(Q=>[...de,...Q]),j(de.length>=50)):(c(de),de.length>0&&((K=de[de.length-1].metadata)==null?void 0:K.type)==="user_input_request"&&b(Ae.WAITING_FOR_INPUT)),I(!1)}}}catch(ee){console.error("Failed to fetch messages:",ee),I(!1)}},[o,t,h]);i.useEffect(()=>{t&&o&&A()},[t,o]);const se=i.useCallback(async()=>{if(!(x||!w||!k.current)){I(!0);try{await A(k.current)}finally{I(!1)}}},[x,w,A]),te=i.useCallback(()=>{!m||!y||(Qe.send({message_type:{cancel_execution:null},data:{}}),S(!1),b("idle"))},[m,y]);return{messages:f,pendingMessage:p,pendingImages:u,connectionState:$,isConnected:m,isExecuting:y,executionStatus:E,isWaitingForInput:E==="waiting_for_input",hasMoreMessages:w,isLoadingMore:x,sendMessage:N,submitUserInput:L,clearMessages:H,loadMoreMessages:se,cancelExecution:te,connect:M,disconnect:()=>Qe.disconnect()}}const fc=()=>{const{client:t}=Ne(),[r,o]=i.useState(!1),[n,s]=i.useState(null),[a,h]=i.useState(null),f=i.useCallback(async p=>{o(!0),s(null),h(null);try{const d=await t("/organizations/invitations/accept",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:p})}),g=(await G(d)).data;return h(g),g.error_code&&s(g.message||"Failed to accept invitation"),g}catch(d){const u=d.message||"Failed to accept invitation";s(u);const g={error_code:"NETWORK_ERROR",message:u};return h(g),g}finally{o(!1)}},[t]),c=i.useCallback(()=>{s(null),h(null)},[]);return{acceptInvitation:f,invitationData:a,loading:r,error:n,reset:c}},lu=({children:t})=>{const{loading:r}=ve();return r?null:e.jsx(e.Fragment,{children:t})},du=({children:t})=>{const{loading:r}=ve();return r?e.jsx(e.Fragment,{children:t}):null};var He=function(){return He=Object.assign||function(r){for(var o,n=1,s=arguments.length;n<s;n++){o=arguments[n];for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(r[a]=o[a])}return r},He.apply(this,arguments)};function Xt(t,r,o){if(o||arguments.length===2)for(var n=0,s=r.length,a;n<s;n++)(a||!(n in r))&&(a||(a=Array.prototype.slice.call(r,0,n)),a[n]=r[n]);return t.concat(a||Array.prototype.slice.call(r))}function uu(t){var r=Object.create(null);return function(o){return r[o]===void 0&&(r[o]=t(o)),r[o]}}var pu=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,hu=uu(function(t){return pu.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),Pe="-ms-",Lr="-moz-",$e="-webkit-",gc="comm",Zo="rule",ba="decl",fu="@import",mc="@keyframes",gu="@layer",xc=Math.abs,ya=String.fromCharCode,na=Object.assign;function mu(t,r){return Ue(t,0)^45?(((r<<2^Ue(t,0))<<2^Ue(t,1))<<2^Ue(t,2))<<2^Ue(t,3):0}function vc(t){return t.trim()}function gt(t,r){return(t=r.exec(t))?t[0]:t}function xe(t,r,o){return t.replace(r,o)}function zo(t,r,o){return t.indexOf(r,o)}function Ue(t,r){return t.charCodeAt(r)|0}function mr(t,r,o){return t.slice(r,o)}function it(t){return t.length}function bc(t){return t.length}function Or(t,r){return r.push(t),t}function xu(t,r){return t.map(r).join("")}function Va(t,r){return t.filter(function(o){return!gt(o,r)})}var Qo=1,xr=1,yc=0,Xe=0,De=0,kr="";function Ko(t,r,o,n,s,a,h,f){return{value:t,root:r,parent:o,type:n,props:s,children:a,line:Qo,column:xr,length:h,return:"",siblings:f}}function St(t,r){return na(Ko("",null,null,"",null,null,0,t.siblings),t,{length:-t.length},r)}function sr(t){for(;t.root;)t=St(t.root,{children:[t]});Or(t,t.siblings)}function vu(){return De}function bu(){return De=Xe>0?Ue(kr,--Xe):0,xr--,De===10&&(xr=1,Qo--),De}function rt(){return De=Xe<yc?Ue(kr,Xe++):0,xr++,De===10&&(xr=1,Qo++),De}function Yt(){return Ue(kr,Xe)}function Eo(){return Xe}function Xo(t,r){return mr(kr,t,r)}function aa(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function yu(t){return Qo=xr=1,yc=it(kr=t),Xe=0,[]}function wu(t){return kr="",t}function gn(t){return vc(Xo(Xe-1,sa(t===91?t+2:t===40?t+1:t)))}function ju(t){for(;(De=Yt())&&De<33;)rt();return aa(t)>2||aa(De)>3?"":" "}function ku(t,r){for(;--r&&rt()&&!(De<48||De>102||De>57&&De<65||De>70&&De<97););return Xo(t,Eo()+(r<6&&Yt()==32&&rt()==32))}function sa(t){for(;rt();)switch(De){case t:return Xe;case 34:case 39:t!==34&&t!==39&&sa(De);break;case 40:t===41&&sa(t);break;case 92:rt();break}return Xe}function _u(t,r){for(;rt()&&t+De!==57;)if(t+De===84&&Yt()===47)break;return"/*"+Xo(r,Xe-1)+"*"+ya(t===47?t:rt())}function Cu(t){for(;!aa(Yt());)rt();return Xo(t,Xe)}function Su(t){return wu(Po("",null,null,null,[""],t=yu(t),0,[0],t))}function Po(t,r,o,n,s,a,h,f,c){for(var p=0,d=0,u=h,g=0,m=0,v=0,y=1,S=1,E=1,b=0,$="",C=s,w=a,j=n,x=$;S;)switch(v=b,b=rt()){case 40:if(v!=108&&Ue(x,u-1)==58){zo(x+=xe(gn(b),"&","&\f"),"&\f",xc(p?f[p-1]:0))!=-1&&(E=-1);break}case 34:case 39:case 91:x+=gn(b);break;case 9:case 10:case 13:case 32:x+=ju(v);break;case 92:x+=ku(Eo()-1,7);continue;case 47:switch(Yt()){case 42:case 47:Or($u(_u(rt(),Eo()),r,o,c),c);break;default:x+="/"}break;case 123*y:f[p++]=it(x)*E;case 125*y:case 59:case 0:switch(b){case 0:case 125:S=0;case 59+d:E==-1&&(x=xe(x,/\f/g,"")),m>0&&it(x)-u&&Or(m>32?Ha(x+";",n,o,u-1,c):Ha(xe(x," ","")+";",n,o,u-2,c),c);break;case 59:x+=";";default:if(Or(j=Ga(x,r,o,p,d,s,f,$,C=[],w=[],u,a),a),b===123)if(d===0)Po(x,r,j,j,C,a,u,f,w);else switch(g===99&&Ue(x,3)===110?100:g){case 100:case 108:case 109:case 115:Po(t,j,j,n&&Or(Ga(t,j,j,0,0,s,f,$,s,C=[],u,w),w),s,w,u,f,n?C:w);break;default:Po(x,j,j,j,[""],w,0,f,w)}}p=d=m=0,y=E=1,$=x="",u=h;break;case 58:u=1+it(x),m=v;default:if(y<1){if(b==123)--y;else if(b==125&&y++==0&&bu()==125)continue}switch(x+=ya(b),b*y){case 38:E=d>0?1:(x+="\f",-1);break;case 44:f[p++]=(it(x)-1)*E,E=1;break;case 64:Yt()===45&&(x+=gn(rt())),g=Yt(),d=u=it($=x+=Cu(Eo())),b++;break;case 45:v===45&&it(x)==2&&(y=0)}}return a}function Ga(t,r,o,n,s,a,h,f,c,p,d,u){for(var g=s-1,m=s===0?a:[""],v=bc(m),y=0,S=0,E=0;y<n;++y)for(var b=0,$=mr(t,g+1,g=xc(S=h[y])),C=t;b<v;++b)(C=vc(S>0?m[b]+" "+$:xe($,/&\f/g,m[b])))&&(c[E++]=C);return Ko(t,r,o,s===0?Zo:f,c,p,d,u)}function $u(t,r,o,n){return Ko(t,r,o,gc,ya(vu()),mr(t,2,-2),0,n)}function Ha(t,r,o,n,s){return Ko(t,r,o,ba,mr(t,0,n),mr(t,n+1,-1),n,s)}function wc(t,r,o){switch(mu(t,r)){case 5103:return $e+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return $e+t+t;case 4789:return Lr+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return $e+t+Lr+t+Pe+t+t;case 5936:switch(Ue(t,r+11)){case 114:return $e+t+Pe+xe(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return $e+t+Pe+xe(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return $e+t+Pe+xe(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return $e+t+Pe+t+t;case 6165:return $e+t+Pe+"flex-"+t+t;case 5187:return $e+t+xe(t,/(\w+).+(:[^]+)/,$e+"box-$1$2"+Pe+"flex-$1$2")+t;case 5443:return $e+t+Pe+"flex-item-"+xe(t,/flex-|-self/g,"")+(gt(t,/flex-|baseline/)?"":Pe+"grid-row-"+xe(t,/flex-|-self/g,""))+t;case 4675:return $e+t+Pe+"flex-line-pack"+xe(t,/align-content|flex-|-self/g,"")+t;case 5548:return $e+t+Pe+xe(t,"shrink","negative")+t;case 5292:return $e+t+Pe+xe(t,"basis","preferred-size")+t;case 6060:return $e+"box-"+xe(t,"-grow","")+$e+t+Pe+xe(t,"grow","positive")+t;case 4554:return $e+xe(t,/([^-])(transform)/g,"$1"+$e+"$2")+t;case 6187:return xe(xe(xe(t,/(zoom-|grab)/,$e+"$1"),/(image-set)/,$e+"$1"),t,"")+t;case 5495:case 3959:return xe(t,/(image-set\([^]*)/,$e+"$1$`$1");case 4968:return xe(xe(t,/(.+:)(flex-)?(.*)/,$e+"box-pack:$3"+Pe+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+$e+t+t;case 4200:if(!gt(t,/flex-|baseline/))return Pe+"grid-column-align"+mr(t,r)+t;break;case 2592:case 3360:return Pe+xe(t,"template-","")+t;case 4384:case 3616:return o&&o.some(function(n,s){return r=s,gt(n.props,/grid-\w+-end/)})?~zo(t+(o=o[r].value),"span",0)?t:Pe+xe(t,"-start","")+t+Pe+"grid-row-span:"+(~zo(o,"span",0)?gt(o,/\d+/):+gt(o,/\d+/)-+gt(t,/\d+/))+";":Pe+xe(t,"-start","")+t;case 4896:case 4128:return o&&o.some(function(n){return gt(n.props,/grid-\w+-start/)})?t:Pe+xe(xe(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return xe(t,/(.+)-inline(.+)/,$e+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(it(t)-1-r>6)switch(Ue(t,r+1)){case 109:if(Ue(t,r+4)!==45)break;case 102:return xe(t,/(.+:)(.+)-([^]+)/,"$1"+$e+"$2-$3$1"+Lr+(Ue(t,r+3)==108?"$3":"$2-$3"))+t;case 115:return~zo(t,"stretch",0)?wc(xe(t,"stretch","fill-available"),r,o)+t:t}break;case 5152:case 5920:return xe(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(n,s,a,h,f,c,p){return Pe+s+":"+a+p+(h?Pe+s+"-span:"+(f?c:+c-+a)+p:"")+t});case 4949:if(Ue(t,r+6)===121)return xe(t,":",":"+$e)+t;break;case 6444:switch(Ue(t,Ue(t,14)===45?18:11)){case 120:return xe(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+$e+(Ue(t,14)===45?"inline-":"")+"box$3$1"+$e+"$2$3$1"+Pe+"$2box$3")+t;case 100:return xe(t,":",":"+Pe)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return xe(t,"scroll-","scroll-snap-")+t}return t}function Lo(t,r){for(var o="",n=0;n<t.length;n++)o+=r(t[n],n,t,r)||"";return o}function zu(t,r,o,n){switch(t.type){case gu:if(t.children.length)break;case fu:case ba:return t.return=t.return||t.value;case gc:return"";case mc:return t.return=t.value+"{"+Lo(t.children,n)+"}";case Zo:if(!it(t.value=t.props.join(",")))return""}return it(o=Lo(t.children,n))?t.return=t.value+"{"+o+"}":""}function Eu(t){var r=bc(t);return function(o,n,s,a){for(var h="",f=0;f<r;f++)h+=t[f](o,n,s,a)||"";return h}}function Pu(t){return function(r){r.root||(r=r.return)&&t(r)}}function Ru(t,r,o,n){if(t.length>-1&&!t.return)switch(t.type){case ba:t.return=wc(t.value,t.length,o);return;case mc:return Lo([St(t,{value:xe(t.value,"@","@"+$e)})],n);case Zo:if(t.length)return xu(o=t.props,function(s){switch(gt(s,n=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":sr(St(t,{props:[xe(s,/:(read-\w+)/,":"+Lr+"$1")]})),sr(St(t,{props:[s]})),na(t,{props:Va(o,n)});break;case"::placeholder":sr(St(t,{props:[xe(s,/:(plac\w+)/,":"+$e+"input-$1")]})),sr(St(t,{props:[xe(s,/:(plac\w+)/,":"+Lr+"$1")]})),sr(St(t,{props:[xe(s,/:(plac\w+)/,Pe+"input-$1")]})),sr(St(t,{props:[s]})),na(t,{props:Va(o,n)});break}return""})}}var Iu={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Jt=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",jc="active",kc="data-styled-version",Jo="6.1.19",wa=`/*!sc*/
|
|
19
19
|
`,Ao=typeof window<"u"&&typeof document<"u",Tu=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==""?process.env.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&process.env.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&process.env.SC_DISABLE_SPEEDY!==void 0&&process.env.SC_DISABLE_SPEEDY!==""?process.env.SC_DISABLE_SPEEDY!=="false"&&process.env.SC_DISABLE_SPEEDY:process.env.NODE_ENV!=="production"),qa=/invalid hook call/i,Kr=new Set,Ou=function(t,r){if(process.env.NODE_ENV!=="production"){var o=r?' with the id of "'.concat(r,'"'):"",n="The component ".concat(t).concat(o,` has been created dynamically.
|
|
20
20
|
`)+`You may see this warning because you've called styled inside another component.
|
|
21
21
|
To resolve this only create new StyledComponents outside of any render method and function component.
|
|
22
22
|
See https://styled-components.com/docs/basics#define-styled-components-outside-of-the-render-method for more info.
|
|
23
|
-
`,s=console.error;try{var a=!0;console.error=function(h){for(var f=[],c=1;c<arguments.length;c++)f[c-1]=arguments[c];qa.test(h)?(a=!1,Kr.delete(n)):s.apply(void 0,Xt([h],f,!1))},i.useRef(),a&&!Kr.has(n)&&(console.warn(n),Kr.add(n))}catch(h){qa.test(h.message)&&Kr.delete(n)}finally{console.error=s}}},en=Object.freeze([]),vr=Object.freeze({});function Mu(t,r,o){return o===void 0&&(o=vr),t.theme!==o.theme&&t.theme||r||o.theme}var ia=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),Lu=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,Au=/(^-|-$)/g;function Ya(t){return t.replace(Lu,"-").replace(Au,"")}var Du=/(a)(d)/gi,Xr=52,Za=function(t){return String.fromCharCode(t+(t>25?39:97))};function ca(t){var r,o="";for(r=Math.abs(t);r>Xr;r=r/Xr|0)o=Za(r%Xr)+o;return(Za(r%Xr)+o).replace(Du,"$1-$2")}var mn,_c=5381,Gt=function(t,r){for(var o=r.length;o;)t=33*t^r.charCodeAt(--o);return t},Cc=function(t){return Gt(_c,t)};function Sc(t){return ca(Cc(t)>>>0)}function $c(t){return process.env.NODE_ENV!=="production"&&typeof t=="string"&&t||t.displayName||t.name||"Component"}function xn(t){return typeof t=="string"&&(process.env.NODE_ENV==="production"||t.charAt(0)===t.charAt(0).toLowerCase())}var zc=typeof Symbol=="function"&&Symbol.for,Ec=zc?Symbol.for("react.memo"):60115,
|
|
23
|
+
`,s=console.error;try{var a=!0;console.error=function(h){for(var f=[],c=1;c<arguments.length;c++)f[c-1]=arguments[c];qa.test(h)?(a=!1,Kr.delete(n)):s.apply(void 0,Xt([h],f,!1))},i.useRef(),a&&!Kr.has(n)&&(console.warn(n),Kr.add(n))}catch(h){qa.test(h.message)&&Kr.delete(n)}finally{console.error=s}}},en=Object.freeze([]),vr=Object.freeze({});function Mu(t,r,o){return o===void 0&&(o=vr),t.theme!==o.theme&&t.theme||r||o.theme}var ia=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),Lu=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,Au=/(^-|-$)/g;function Ya(t){return t.replace(Lu,"-").replace(Au,"")}var Du=/(a)(d)/gi,Xr=52,Za=function(t){return String.fromCharCode(t+(t>25?39:97))};function ca(t){var r,o="";for(r=Math.abs(t);r>Xr;r=r/Xr|0)o=Za(r%Xr)+o;return(Za(r%Xr)+o).replace(Du,"$1-$2")}var mn,_c=5381,Gt=function(t,r){for(var o=r.length;o;)t=33*t^r.charCodeAt(--o);return t},Cc=function(t){return Gt(_c,t)};function Sc(t){return ca(Cc(t)>>>0)}function $c(t){return process.env.NODE_ENV!=="production"&&typeof t=="string"&&t||t.displayName||t.name||"Component"}function xn(t){return typeof t=="string"&&(process.env.NODE_ENV==="production"||t.charAt(0)===t.charAt(0).toLowerCase())}var zc=typeof Symbol=="function"&&Symbol.for,Ec=zc?Symbol.for("react.memo"):60115,Nu=zc?Symbol.for("react.forward_ref"):60112,Fu={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Bu={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Pc={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Uu=((mn={})[Nu]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},mn[Ec]=Pc,mn);function Qa(t){return("type"in(r=t)&&r.type.$$typeof)===Ec?Pc:"$$typeof"in t?Uu[t.$$typeof]:Fu;var r}var Wu=Object.defineProperty,Vu=Object.getOwnPropertyNames,Ka=Object.getOwnPropertySymbols,Gu=Object.getOwnPropertyDescriptor,Hu=Object.getPrototypeOf,Xa=Object.prototype;function Rc(t,r,o){if(typeof r!="string"){if(Xa){var n=Hu(r);n&&n!==Xa&&Rc(t,n,o)}var s=Vu(r);Ka&&(s=s.concat(Ka(r)));for(var a=Qa(t),h=Qa(r),f=0;f<s.length;++f){var c=s[f];if(!(c in Bu||o&&o[c]||h&&c in h||a&&c in a)){var p=Gu(r,c);try{Wu(t,c,p)}catch{}}}}return t}function br(t){return typeof t=="function"}function ja(t){return typeof t=="object"&&"styledComponentId"in t}function qt(t,r){return t&&r?"".concat(t," ").concat(r):t||r||""}function la(t,r){if(t.length===0)return"";for(var o=t[0],n=1;n<t.length;n++)o+=t[n];return o}function yr(t){return t!==null&&typeof t=="object"&&t.constructor.name===Object.name&&!("props"in t&&t.$$typeof)}function da(t,r,o){if(o===void 0&&(o=!1),!o&&!yr(t)&&!Array.isArray(t))return r;if(Array.isArray(r))for(var n=0;n<r.length;n++)t[n]=da(t[n],r[n]);else if(yr(r))for(var n in r)t[n]=da(t[n],r[n]);return t}function ka(t,r){Object.defineProperty(t,"toString",{value:r})}var qu=process.env.NODE_ENV!=="production"?{1:`Cannot create styled-component for component: %s.
|
|
24
24
|
|
|
25
25
|
`,2:`Can't collect styles once you've consumed a \`ServerStyleSheet\`'s styles! \`ServerStyleSheet\` is a one off instance for each server-side render cycle.
|
|
26
26
|
|
|
@@ -61,7 +61,7 @@ as for instance in your render method then you may be running into this limitati
|
|
|
61
61
|
|
|
62
62
|
`,17:`CSSStyleSheet could not be found on HTMLStyleElement.
|
|
63
63
|
Has styled-components' style tag been unmounted or altered by another script?
|
|
64
|
-
`,18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function Yu(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var o=t[0],n=[],s=1,a=t.length;s<a;s+=1)n.push(t[s]);return n.forEach(function(h){o=o.replace(/%[a-z]/,h)}),o}function _r(t){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];return process.env.NODE_ENV==="production"?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t," for more information.").concat(r.length>0?" Args: ".concat(r.join(", ")):"")):new Error(Yu.apply(void 0,Xt([qu[t]],r,!1)).trim())}var Zu=function(){function t(r){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=r}return t.prototype.indexOfGroup=function(r){for(var o=0,n=0;n<r;n++)o+=this.groupSizes[n];return o},t.prototype.insertRules=function(r,o){if(r>=this.groupSizes.length){for(var n=this.groupSizes,s=n.length,a=s;r>=a;)if((a<<=1)<0)throw _r(16,"".concat(r));this.groupSizes=new Uint32Array(a),this.groupSizes.set(n),this.length=a;for(var h=s;h<a;h++)this.groupSizes[h]=0}for(var f=this.indexOfGroup(r+1),c=(h=0,o.length);h<c;h++)this.tag.insertRule(f,o[h])&&(this.groupSizes[r]++,f++)},t.prototype.clearGroup=function(r){if(r<this.length){var o=this.groupSizes[r],n=this.indexOfGroup(r),s=n+o;this.groupSizes[r]=0;for(var a=n;a<s;a++)this.tag.deleteRule(n)}},t.prototype.getGroup=function(r){var o="";if(r>=this.length||this.groupSizes[r]===0)return o;for(var n=this.groupSizes[r],s=this.indexOfGroup(r),a=s+n,h=s;h<a;h++)o+="".concat(this.tag.getRule(h)).concat(wa);return o},t}(),Qu=1<<30,Ro=new Map,Do=new Map,Io=1,Jr=function(t){if(Ro.has(t))return Ro.get(t);for(;Do.has(Io);)Io++;var r=Io++;if(process.env.NODE_ENV!=="production"&&((0|r)<0||r>Qu))throw _r(16,"".concat(r));return Ro.set(t,r),Do.set(r,t),r},Ku=function(t,r){Io=r+1,Ro.set(t,r),Do.set(r,t)},Xu="style[".concat(Jt,"][").concat(kc,'="').concat(Jo,'"]'),Ju=new RegExp("^".concat(Jt,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),ep=function(t,r,o){for(var n,s=o.split(","),a=0,h=s.length;a<h;a++)(n=s[a])&&t.registerName(r,n)},tp=function(t,r){for(var o,n=((o=r.textContent)!==null&&o!==void 0?o:"").split(wa),s=[],a=0,h=n.length;a<h;a++){var f=n[a].trim();if(f){var c=f.match(Ju);if(c){var p=0|parseInt(c[1],10),d=c[2];p!==0&&(Ku(d,p),ep(t,d,c[3]),t.getTag().insertRules(p,s)),s.length=0}else s.push(f)}}},Ja=function(t){for(var r=document.querySelectorAll(Xu),o=0,n=r.length;o<n;o++){var s=r[o];s&&s.getAttribute(Jt)!==jc&&(tp(t,s),s.parentNode&&s.parentNode.removeChild(s))}};function rp(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var Ic=function(t){var r=document.head,o=t||r,n=document.createElement("style"),s=function(f){var c=Array.from(f.querySelectorAll("style[".concat(Jt,"]")));return c[c.length-1]}(o),a=s!==void 0?s.nextSibling:null;n.setAttribute(Jt,jc),n.setAttribute(kc,Jo);var h=rp();return h&&n.setAttribute("nonce",h),o.insertBefore(n,a),n},op=function(){function t(r){this.element=Ic(r),this.element.appendChild(document.createTextNode("")),this.sheet=function(o){if(o.sheet)return o.sheet;for(var n=document.styleSheets,s=0,a=n.length;s<a;s++){var h=n[s];if(h.ownerNode===o)return h}throw _r(17)}(this.element),this.length=0}return t.prototype.insertRule=function(r,o){try{return this.sheet.insertRule(o,r),this.length++,!0}catch{return!1}},t.prototype.deleteRule=function(r){this.sheet.deleteRule(r),this.length--},t.prototype.getRule=function(r){var o=this.sheet.cssRules[r];return o&&o.cssText?o.cssText:""},t}(),np=function(){function t(r){this.element=Ic(r),this.nodes=this.element.childNodes,this.length=0}return t.prototype.insertRule=function(r,o){if(r<=this.length&&r>=0){var n=document.createTextNode(o);return this.element.insertBefore(n,this.nodes[r]||null),this.length++,!0}return!1},t.prototype.deleteRule=function(r){this.element.removeChild(this.nodes[r]),this.length--},t.prototype.getRule=function(r){return r<this.length?this.nodes[r].textContent:""},t}(),ap=function(){function t(r){this.rules=[],this.length=0}return t.prototype.insertRule=function(r,o){return r<=this.length&&(this.rules.splice(r,0,o),this.length++,!0)},t.prototype.deleteRule=function(r){this.rules.splice(r,1),this.length--},t.prototype.getRule=function(r){return r<this.length?this.rules[r]:""},t}(),es=Ao,sp={isServer:!Ao,useCSSOMInjection:!Tu},Tc=function(){function t(r,o,n){r===void 0&&(r=vr),o===void 0&&(o={});var s=this;this.options=He(He({},sp),r),this.gs=o,this.names=new Map(n),this.server=!!r.isServer,!this.server&&Ao&&es&&(es=!1,Ja(this)),ka(this,function(){return function(a){for(var h=a.getTag(),f=h.length,c="",p=function(u){var g=function(E){return Do.get(E)}(u);if(g===void 0)return"continue";var m=a.names.get(g),v=h.getGroup(u);if(m===void 0||!m.size||v.length===0)return"continue";var y="".concat(Jt,".g").concat(u,'[id="').concat(g,'"]'),S="";m!==void 0&&m.forEach(function(E){E.length>0&&(S+="".concat(E,","))}),c+="".concat(v).concat(y,'{content:"').concat(S,'"}').concat(wa)},d=0;d<f;d++)p(d);return c}(s)})}return t.registerId=function(r){return Jr(r)},t.prototype.rehydrate=function(){!this.server&&Ao&&Ja(this)},t.prototype.reconstructWithOptions=function(r,o){return o===void 0&&(o=!0),new t(He(He({},this.options),r),this.gs,o&&this.names||void 0)},t.prototype.allocateGSInstance=function(r){return this.gs[r]=(this.gs[r]||0)+1},t.prototype.getTag=function(){return this.tag||(this.tag=(r=function(o){var n=o.useCSSOMInjection,s=o.target;return o.isServer?new ap(s):n?new op(s):new np(s)}(this.options),new Zu(r)));var r},t.prototype.hasNameForId=function(r,o){return this.names.has(r)&&this.names.get(r).has(o)},t.prototype.registerName=function(r,o){if(Jr(r),this.names.has(r))this.names.get(r).add(o);else{var n=new Set;n.add(o),this.names.set(r,n)}},t.prototype.insertRules=function(r,o,n){this.registerName(r,o),this.getTag().insertRules(Jr(r),n)},t.prototype.clearNames=function(r){this.names.has(r)&&this.names.get(r).clear()},t.prototype.clearRules=function(r){this.getTag().clearGroup(Jr(r)),this.clearNames(r)},t.prototype.clearTag=function(){this.tag=void 0},t}(),ip=/&/g,cp=/^\s*\/\/.*$/gm;function Oc(t,r){return t.map(function(o){return o.type==="rule"&&(o.value="".concat(r," ").concat(o.value),o.value=o.value.replaceAll(",",",".concat(r," ")),o.props=o.props.map(function(n){return"".concat(r," ").concat(n)})),Array.isArray(o.children)&&o.type!=="@keyframes"&&(o.children=Oc(o.children,r)),o})}function lp(t){var r,o,n,s=vr,a=s.options,h=a===void 0?vr:a,f=s.plugins,c=f===void 0?en:f,p=function(g,m,v){return v.startsWith(o)&&v.endsWith(o)&&v.replaceAll(o,"").length>0?".".concat(r):g},d=c.slice();d.push(function(g){g.type===Zo&&g.value.includes("&")&&(g.props[0]=g.props[0].replace(ip,o).replace(n,p))}),h.prefix&&d.push(Ru),d.push(zu);var u=function(g,m,v,y){m===void 0&&(m=""),v===void 0&&(v=""),y===void 0&&(y="&"),r=y,o=m,n=new RegExp("\\".concat(o,"\\b"),"g");var S=g.replace(cp,""),E=Su(v||m?"".concat(v," ").concat(m," { ").concat(S," }"):S);h.namespace&&(E=Oc(E,h.namespace));var b=[];return Lo(E,Eu(d.concat(Pu(function($){return b.push($)})))),b};return u.hash=c.length?c.reduce(function(g,m){return m.name||_r(15),Gt(g,m.name)},_c).toString():"",u}var dp=new Tc,ua=lp(),Mc=i.createContext({shouldForwardProp:void 0,styleSheet:dp,stylis:ua});Mc.Consumer;i.createContext(void 0);function ts(){return i.useContext(Mc)}var pa=function(){function t(r,o){var n=this;this.inject=function(s,a){a===void 0&&(a=ua);var h=n.name+a.hash;s.hasNameForId(n.id,h)||s.insertRules(n.id,h,a(n.rules,h,"@keyframes"))},this.name=r,this.id="sc-keyframes-".concat(r),this.rules=o,ka(this,function(){throw _r(12,String(n.name))})}return t.prototype.getName=function(r){return r===void 0&&(r=ua),this.name+r.hash},t}(),up=function(t){return t>="A"&&t<="Z"};function rs(t){for(var r="",o=0;o<t.length;o++){var n=t[o];if(o===1&&n==="-"&&t[0]==="-")return t;up(n)?r+="-"+n.toLowerCase():r+=n}return r.startsWith("ms-")?"-"+r:r}var Lc=function(t){return t==null||t===!1||t===""},Ac=function(t){var r,o,n=[];for(var s in t){var a=t[s];t.hasOwnProperty(s)&&!Lc(a)&&(Array.isArray(a)&&a.isCss||br(a)?n.push("".concat(rs(s),":"),a,";"):yr(a)?n.push.apply(n,Xt(Xt(["".concat(s," {")],Ac(a),!1),["}"],!1)):n.push("".concat(rs(s),": ").concat((r=s,(o=a)==null||typeof o=="boolean"||o===""?"":typeof o!="number"||o===0||r in Iu||r.startsWith("--")?String(o).trim():"".concat(o,"px")),";")))}return n};function Zt(t,r,o,n){if(Lc(t))return[];if(ja(t))return[".".concat(t.styledComponentId)];if(br(t)){if(!br(a=t)||a.prototype&&a.prototype.isReactComponent||!r)return[t];var s=t(r);return process.env.NODE_ENV==="production"||typeof s!="object"||Array.isArray(s)||s instanceof pa||yr(s)||s===null||console.error("".concat($c(t)," is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")),Zt(s,r,o,n)}var a;return t instanceof pa?o?(t.inject(o,n),[t.getName(n)]):[t]:yr(t)?Ac(t):Array.isArray(t)?Array.prototype.concat.apply(en,t.map(function(h){return Zt(h,r,o,n)})):[t.toString()]}function pp(t){for(var r=0;r<t.length;r+=1){var o=t[r];if(br(o)&&!ja(o))return!1}return!0}var hp=Cc(Jo),fp=function(){function t(r,o,n){this.rules=r,this.staticRulesId="",this.isStatic=process.env.NODE_ENV==="production"&&(n===void 0||n.isStatic)&&pp(r),this.componentId=o,this.baseHash=Gt(hp,o),this.baseStyle=n,Tc.registerId(o)}return t.prototype.generateAndInjectStyles=function(r,o,n){var s=this.baseStyle?this.baseStyle.generateAndInjectStyles(r,o,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&o.hasNameForId(this.componentId,this.staticRulesId))s=qt(s,this.staticRulesId);else{var a=la(Zt(this.rules,r,o,n)),h=ca(Gt(this.baseHash,a)>>>0);if(!o.hasNameForId(this.componentId,h)){var f=n(a,".".concat(h),void 0,this.componentId);o.insertRules(this.componentId,h,f)}s=qt(s,h),this.staticRulesId=h}else{for(var c=Gt(this.baseHash,n.hash),p="",d=0;d<this.rules.length;d++){var u=this.rules[d];if(typeof u=="string")p+=u,process.env.NODE_ENV!=="production"&&(c=Gt(c,u));else if(u){var g=la(Zt(u,r,o,n));c=Gt(c,g+d),p+=g}}if(p){var m=ca(c>>>0);o.hasNameForId(this.componentId,m)||o.insertRules(this.componentId,m,n(p,".".concat(m),void 0,this.componentId)),s=qt(s,m)}}return s},t}(),Dc=i.createContext(void 0);Dc.Consumer;var vn={},os=new Set;function gp(t,r,o){var n=ja(t),s=t,a=!xn(t),h=r.attrs,f=h===void 0?en:h,c=r.componentId,p=c===void 0?function(C,w){var j=typeof C!="string"?"sc":Ya(C);vn[j]=(vn[j]||0)+1;var x="".concat(j,"-").concat(Sc(Jo+j+vn[j]));return w?"".concat(w,"-").concat(x):x}(r.displayName,r.parentComponentId):c,d=r.displayName,u=d===void 0?function(C){return xn(C)?"styled.".concat(C):"Styled(".concat($c(C),")")}(t):d,g=r.displayName&&r.componentId?"".concat(Ya(r.displayName),"-").concat(r.componentId):r.componentId||p,m=n&&s.attrs?s.attrs.concat(f).filter(Boolean):f,v=r.shouldForwardProp;if(n&&s.shouldForwardProp){var y=s.shouldForwardProp;if(r.shouldForwardProp){var S=r.shouldForwardProp;v=function(C,w){return y(C,w)&&S(C,w)}}else v=y}var E=new fp(o,g,n?s.componentStyle:void 0);function b(C,w){return function(j,x,I){var k=j.attrs,R=j.componentStyle,_=j.defaultProps,O=j.foldedComponentIds,P=j.styledComponentId,z=j.target,T=i.useContext(Dc),M=ts(),F=j.shouldForwardProp||M.shouldForwardProp;process.env.NODE_ENV!=="production"&&i.useDebugValue(P);var G=Mu(x,T,_)||vr,L=function(ee,J,ie){for(var oe,de=He(He({},J),{className:void 0,theme:ie}),Q=0;Q<ee.length;Q+=1){var ce=br(oe=ee[Q])?oe(de):oe;for(var B in ce)de[B]=B==="className"?qt(de[B],ce[B]):B==="style"?He(He({},de[B]),ce[B]):ce[B]}return J.className&&(de.className=qt(de.className,J.className)),de}(k,x,G),A=L.as||z,se={};for(var te in L)L[te]===void 0||te[0]==="$"||te==="as"||te==="theme"&&L.theme===G||(te==="forwardedAs"?se.as=L.forwardedAs:F&&!F(te,A)||(se[te]=L[te],F||process.env.NODE_ENV!=="development"||hu(te)||os.has(te)||!ia.has(A)||(os.add(te),console.warn('styled-components: it looks like an unknown prop "'.concat(te,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var U=function(ee,J){var ie=ts(),oe=ee.generateAndInjectStyles(J,ie.styleSheet,ie.stylis);return process.env.NODE_ENV!=="production"&&i.useDebugValue(oe),oe}(R,L);process.env.NODE_ENV!=="production"&&j.warnTooManyClasses&&j.warnTooManyClasses(U);var K=qt(O,P);return U&&(K+=" "+U),L.className&&(K+=" "+L.className),se[xn(A)&&!ia.has(A)?"class":"className"]=K,I&&(se.ref=I),i.createElement(A,se)}($,C,w)}b.displayName=u;var $=i.forwardRef(b);return $.attrs=m,$.componentStyle=E,$.displayName=u,$.shouldForwardProp=v,$.foldedComponentIds=n?qt(s.foldedComponentIds,s.styledComponentId):"",$.styledComponentId=g,$.target=n?s.target:t,Object.defineProperty($,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(C){this._foldedDefaultProps=n?function(w){for(var j=[],x=1;x<arguments.length;x++)j[x-1]=arguments[x];for(var I=0,k=j;I<k.length;I++)da(w,k[I],!0);return w}({},s.defaultProps,C):C}}),process.env.NODE_ENV!=="production"&&(Ou(u,g),$.warnTooManyClasses=function(C,w){var j={},x=!1;return function(I){if(!x&&(j[I]=!0,Object.keys(j).length>=200)){var k=w?' with the id of "'.concat(w,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(C).concat(k,`.
|
|
64
|
+
`,18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function Yu(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var o=t[0],n=[],s=1,a=t.length;s<a;s+=1)n.push(t[s]);return n.forEach(function(h){o=o.replace(/%[a-z]/,h)}),o}function _r(t){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];return process.env.NODE_ENV==="production"?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t," for more information.").concat(r.length>0?" Args: ".concat(r.join(", ")):"")):new Error(Yu.apply(void 0,Xt([qu[t]],r,!1)).trim())}var Zu=function(){function t(r){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=r}return t.prototype.indexOfGroup=function(r){for(var o=0,n=0;n<r;n++)o+=this.groupSizes[n];return o},t.prototype.insertRules=function(r,o){if(r>=this.groupSizes.length){for(var n=this.groupSizes,s=n.length,a=s;r>=a;)if((a<<=1)<0)throw _r(16,"".concat(r));this.groupSizes=new Uint32Array(a),this.groupSizes.set(n),this.length=a;for(var h=s;h<a;h++)this.groupSizes[h]=0}for(var f=this.indexOfGroup(r+1),c=(h=0,o.length);h<c;h++)this.tag.insertRule(f,o[h])&&(this.groupSizes[r]++,f++)},t.prototype.clearGroup=function(r){if(r<this.length){var o=this.groupSizes[r],n=this.indexOfGroup(r),s=n+o;this.groupSizes[r]=0;for(var a=n;a<s;a++)this.tag.deleteRule(n)}},t.prototype.getGroup=function(r){var o="";if(r>=this.length||this.groupSizes[r]===0)return o;for(var n=this.groupSizes[r],s=this.indexOfGroup(r),a=s+n,h=s;h<a;h++)o+="".concat(this.tag.getRule(h)).concat(wa);return o},t}(),Qu=1<<30,Ro=new Map,Do=new Map,Io=1,Jr=function(t){if(Ro.has(t))return Ro.get(t);for(;Do.has(Io);)Io++;var r=Io++;if(process.env.NODE_ENV!=="production"&&((0|r)<0||r>Qu))throw _r(16,"".concat(r));return Ro.set(t,r),Do.set(r,t),r},Ku=function(t,r){Io=r+1,Ro.set(t,r),Do.set(r,t)},Xu="style[".concat(Jt,"][").concat(kc,'="').concat(Jo,'"]'),Ju=new RegExp("^".concat(Jt,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),ep=function(t,r,o){for(var n,s=o.split(","),a=0,h=s.length;a<h;a++)(n=s[a])&&t.registerName(r,n)},tp=function(t,r){for(var o,n=((o=r.textContent)!==null&&o!==void 0?o:"").split(wa),s=[],a=0,h=n.length;a<h;a++){var f=n[a].trim();if(f){var c=f.match(Ju);if(c){var p=0|parseInt(c[1],10),d=c[2];p!==0&&(Ku(d,p),ep(t,d,c[3]),t.getTag().insertRules(p,s)),s.length=0}else s.push(f)}}},Ja=function(t){for(var r=document.querySelectorAll(Xu),o=0,n=r.length;o<n;o++){var s=r[o];s&&s.getAttribute(Jt)!==jc&&(tp(t,s),s.parentNode&&s.parentNode.removeChild(s))}};function rp(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var Ic=function(t){var r=document.head,o=t||r,n=document.createElement("style"),s=function(f){var c=Array.from(f.querySelectorAll("style[".concat(Jt,"]")));return c[c.length-1]}(o),a=s!==void 0?s.nextSibling:null;n.setAttribute(Jt,jc),n.setAttribute(kc,Jo);var h=rp();return h&&n.setAttribute("nonce",h),o.insertBefore(n,a),n},op=function(){function t(r){this.element=Ic(r),this.element.appendChild(document.createTextNode("")),this.sheet=function(o){if(o.sheet)return o.sheet;for(var n=document.styleSheets,s=0,a=n.length;s<a;s++){var h=n[s];if(h.ownerNode===o)return h}throw _r(17)}(this.element),this.length=0}return t.prototype.insertRule=function(r,o){try{return this.sheet.insertRule(o,r),this.length++,!0}catch{return!1}},t.prototype.deleteRule=function(r){this.sheet.deleteRule(r),this.length--},t.prototype.getRule=function(r){var o=this.sheet.cssRules[r];return o&&o.cssText?o.cssText:""},t}(),np=function(){function t(r){this.element=Ic(r),this.nodes=this.element.childNodes,this.length=0}return t.prototype.insertRule=function(r,o){if(r<=this.length&&r>=0){var n=document.createTextNode(o);return this.element.insertBefore(n,this.nodes[r]||null),this.length++,!0}return!1},t.prototype.deleteRule=function(r){this.element.removeChild(this.nodes[r]),this.length--},t.prototype.getRule=function(r){return r<this.length?this.nodes[r].textContent:""},t}(),ap=function(){function t(r){this.rules=[],this.length=0}return t.prototype.insertRule=function(r,o){return r<=this.length&&(this.rules.splice(r,0,o),this.length++,!0)},t.prototype.deleteRule=function(r){this.rules.splice(r,1),this.length--},t.prototype.getRule=function(r){return r<this.length?this.rules[r]:""},t}(),es=Ao,sp={isServer:!Ao,useCSSOMInjection:!Tu},Tc=function(){function t(r,o,n){r===void 0&&(r=vr),o===void 0&&(o={});var s=this;this.options=He(He({},sp),r),this.gs=o,this.names=new Map(n),this.server=!!r.isServer,!this.server&&Ao&&es&&(es=!1,Ja(this)),ka(this,function(){return function(a){for(var h=a.getTag(),f=h.length,c="",p=function(u){var g=function(E){return Do.get(E)}(u);if(g===void 0)return"continue";var m=a.names.get(g),v=h.getGroup(u);if(m===void 0||!m.size||v.length===0)return"continue";var y="".concat(Jt,".g").concat(u,'[id="').concat(g,'"]'),S="";m!==void 0&&m.forEach(function(E){E.length>0&&(S+="".concat(E,","))}),c+="".concat(v).concat(y,'{content:"').concat(S,'"}').concat(wa)},d=0;d<f;d++)p(d);return c}(s)})}return t.registerId=function(r){return Jr(r)},t.prototype.rehydrate=function(){!this.server&&Ao&&Ja(this)},t.prototype.reconstructWithOptions=function(r,o){return o===void 0&&(o=!0),new t(He(He({},this.options),r),this.gs,o&&this.names||void 0)},t.prototype.allocateGSInstance=function(r){return this.gs[r]=(this.gs[r]||0)+1},t.prototype.getTag=function(){return this.tag||(this.tag=(r=function(o){var n=o.useCSSOMInjection,s=o.target;return o.isServer?new ap(s):n?new op(s):new np(s)}(this.options),new Zu(r)));var r},t.prototype.hasNameForId=function(r,o){return this.names.has(r)&&this.names.get(r).has(o)},t.prototype.registerName=function(r,o){if(Jr(r),this.names.has(r))this.names.get(r).add(o);else{var n=new Set;n.add(o),this.names.set(r,n)}},t.prototype.insertRules=function(r,o,n){this.registerName(r,o),this.getTag().insertRules(Jr(r),n)},t.prototype.clearNames=function(r){this.names.has(r)&&this.names.get(r).clear()},t.prototype.clearRules=function(r){this.getTag().clearGroup(Jr(r)),this.clearNames(r)},t.prototype.clearTag=function(){this.tag=void 0},t}(),ip=/&/g,cp=/^\s*\/\/.*$/gm;function Oc(t,r){return t.map(function(o){return o.type==="rule"&&(o.value="".concat(r," ").concat(o.value),o.value=o.value.replaceAll(",",",".concat(r," ")),o.props=o.props.map(function(n){return"".concat(r," ").concat(n)})),Array.isArray(o.children)&&o.type!=="@keyframes"&&(o.children=Oc(o.children,r)),o})}function lp(t){var r,o,n,s=vr,a=s.options,h=a===void 0?vr:a,f=s.plugins,c=f===void 0?en:f,p=function(g,m,v){return v.startsWith(o)&&v.endsWith(o)&&v.replaceAll(o,"").length>0?".".concat(r):g},d=c.slice();d.push(function(g){g.type===Zo&&g.value.includes("&")&&(g.props[0]=g.props[0].replace(ip,o).replace(n,p))}),h.prefix&&d.push(Ru),d.push(zu);var u=function(g,m,v,y){m===void 0&&(m=""),v===void 0&&(v=""),y===void 0&&(y="&"),r=y,o=m,n=new RegExp("\\".concat(o,"\\b"),"g");var S=g.replace(cp,""),E=Su(v||m?"".concat(v," ").concat(m," { ").concat(S," }"):S);h.namespace&&(E=Oc(E,h.namespace));var b=[];return Lo(E,Eu(d.concat(Pu(function($){return b.push($)})))),b};return u.hash=c.length?c.reduce(function(g,m){return m.name||_r(15),Gt(g,m.name)},_c).toString():"",u}var dp=new Tc,ua=lp(),Mc=i.createContext({shouldForwardProp:void 0,styleSheet:dp,stylis:ua});Mc.Consumer;i.createContext(void 0);function ts(){return i.useContext(Mc)}var pa=function(){function t(r,o){var n=this;this.inject=function(s,a){a===void 0&&(a=ua);var h=n.name+a.hash;s.hasNameForId(n.id,h)||s.insertRules(n.id,h,a(n.rules,h,"@keyframes"))},this.name=r,this.id="sc-keyframes-".concat(r),this.rules=o,ka(this,function(){throw _r(12,String(n.name))})}return t.prototype.getName=function(r){return r===void 0&&(r=ua),this.name+r.hash},t}(),up=function(t){return t>="A"&&t<="Z"};function rs(t){for(var r="",o=0;o<t.length;o++){var n=t[o];if(o===1&&n==="-"&&t[0]==="-")return t;up(n)?r+="-"+n.toLowerCase():r+=n}return r.startsWith("ms-")?"-"+r:r}var Lc=function(t){return t==null||t===!1||t===""},Ac=function(t){var r,o,n=[];for(var s in t){var a=t[s];t.hasOwnProperty(s)&&!Lc(a)&&(Array.isArray(a)&&a.isCss||br(a)?n.push("".concat(rs(s),":"),a,";"):yr(a)?n.push.apply(n,Xt(Xt(["".concat(s," {")],Ac(a),!1),["}"],!1)):n.push("".concat(rs(s),": ").concat((r=s,(o=a)==null||typeof o=="boolean"||o===""?"":typeof o!="number"||o===0||r in Iu||r.startsWith("--")?String(o).trim():"".concat(o,"px")),";")))}return n};function Zt(t,r,o,n){if(Lc(t))return[];if(ja(t))return[".".concat(t.styledComponentId)];if(br(t)){if(!br(a=t)||a.prototype&&a.prototype.isReactComponent||!r)return[t];var s=t(r);return process.env.NODE_ENV==="production"||typeof s!="object"||Array.isArray(s)||s instanceof pa||yr(s)||s===null||console.error("".concat($c(t)," is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")),Zt(s,r,o,n)}var a;return t instanceof pa?o?(t.inject(o,n),[t.getName(n)]):[t]:yr(t)?Ac(t):Array.isArray(t)?Array.prototype.concat.apply(en,t.map(function(h){return Zt(h,r,o,n)})):[t.toString()]}function pp(t){for(var r=0;r<t.length;r+=1){var o=t[r];if(br(o)&&!ja(o))return!1}return!0}var hp=Cc(Jo),fp=function(){function t(r,o,n){this.rules=r,this.staticRulesId="",this.isStatic=process.env.NODE_ENV==="production"&&(n===void 0||n.isStatic)&&pp(r),this.componentId=o,this.baseHash=Gt(hp,o),this.baseStyle=n,Tc.registerId(o)}return t.prototype.generateAndInjectStyles=function(r,o,n){var s=this.baseStyle?this.baseStyle.generateAndInjectStyles(r,o,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&o.hasNameForId(this.componentId,this.staticRulesId))s=qt(s,this.staticRulesId);else{var a=la(Zt(this.rules,r,o,n)),h=ca(Gt(this.baseHash,a)>>>0);if(!o.hasNameForId(this.componentId,h)){var f=n(a,".".concat(h),void 0,this.componentId);o.insertRules(this.componentId,h,f)}s=qt(s,h),this.staticRulesId=h}else{for(var c=Gt(this.baseHash,n.hash),p="",d=0;d<this.rules.length;d++){var u=this.rules[d];if(typeof u=="string")p+=u,process.env.NODE_ENV!=="production"&&(c=Gt(c,u));else if(u){var g=la(Zt(u,r,o,n));c=Gt(c,g+d),p+=g}}if(p){var m=ca(c>>>0);o.hasNameForId(this.componentId,m)||o.insertRules(this.componentId,m,n(p,".".concat(m),void 0,this.componentId)),s=qt(s,m)}}return s},t}(),Dc=i.createContext(void 0);Dc.Consumer;var vn={},os=new Set;function gp(t,r,o){var n=ja(t),s=t,a=!xn(t),h=r.attrs,f=h===void 0?en:h,c=r.componentId,p=c===void 0?function(C,w){var j=typeof C!="string"?"sc":Ya(C);vn[j]=(vn[j]||0)+1;var x="".concat(j,"-").concat(Sc(Jo+j+vn[j]));return w?"".concat(w,"-").concat(x):x}(r.displayName,r.parentComponentId):c,d=r.displayName,u=d===void 0?function(C){return xn(C)?"styled.".concat(C):"Styled(".concat($c(C),")")}(t):d,g=r.displayName&&r.componentId?"".concat(Ya(r.displayName),"-").concat(r.componentId):r.componentId||p,m=n&&s.attrs?s.attrs.concat(f).filter(Boolean):f,v=r.shouldForwardProp;if(n&&s.shouldForwardProp){var y=s.shouldForwardProp;if(r.shouldForwardProp){var S=r.shouldForwardProp;v=function(C,w){return y(C,w)&&S(C,w)}}else v=y}var E=new fp(o,g,n?s.componentStyle:void 0);function b(C,w){return function(j,x,I){var k=j.attrs,R=j.componentStyle,_=j.defaultProps,O=j.foldedComponentIds,P=j.styledComponentId,z=j.target,T=i.useContext(Dc),M=ts(),N=j.shouldForwardProp||M.shouldForwardProp;process.env.NODE_ENV!=="production"&&i.useDebugValue(P);var H=Mu(x,T,_)||vr,L=function(ee,J,ie){for(var oe,de=He(He({},J),{className:void 0,theme:ie}),Q=0;Q<ee.length;Q+=1){var ce=br(oe=ee[Q])?oe(de):oe;for(var B in ce)de[B]=B==="className"?qt(de[B],ce[B]):B==="style"?He(He({},de[B]),ce[B]):ce[B]}return J.className&&(de.className=qt(de.className,J.className)),de}(k,x,H),A=L.as||z,se={};for(var te in L)L[te]===void 0||te[0]==="$"||te==="as"||te==="theme"&&L.theme===H||(te==="forwardedAs"?se.as=L.forwardedAs:N&&!N(te,A)||(se[te]=L[te],N||process.env.NODE_ENV!=="development"||hu(te)||os.has(te)||!ia.has(A)||(os.add(te),console.warn('styled-components: it looks like an unknown prop "'.concat(te,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var U=function(ee,J){var ie=ts(),oe=ee.generateAndInjectStyles(J,ie.styleSheet,ie.stylis);return process.env.NODE_ENV!=="production"&&i.useDebugValue(oe),oe}(R,L);process.env.NODE_ENV!=="production"&&j.warnTooManyClasses&&j.warnTooManyClasses(U);var K=qt(O,P);return U&&(K+=" "+U),L.className&&(K+=" "+L.className),se[xn(A)&&!ia.has(A)?"class":"className"]=K,I&&(se.ref=I),i.createElement(A,se)}($,C,w)}b.displayName=u;var $=i.forwardRef(b);return $.attrs=m,$.componentStyle=E,$.displayName=u,$.shouldForwardProp=v,$.foldedComponentIds=n?qt(s.foldedComponentIds,s.styledComponentId):"",$.styledComponentId=g,$.target=n?s.target:t,Object.defineProperty($,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(C){this._foldedDefaultProps=n?function(w){for(var j=[],x=1;x<arguments.length;x++)j[x-1]=arguments[x];for(var I=0,k=j;I<k.length;I++)da(w,k[I],!0);return w}({},s.defaultProps,C):C}}),process.env.NODE_ENV!=="production"&&(Ou(u,g),$.warnTooManyClasses=function(C,w){var j={},x=!1;return function(I){if(!x&&(j[I]=!0,Object.keys(j).length>=200)){var k=w?' with the id of "'.concat(w,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(C).concat(k,`.
|
|
65
65
|
`)+`Consider using the attrs method, together with a style object for frequently changed styles.
|
|
66
66
|
Example:
|
|
67
67
|
const Component = styled.div.attrs(props => ({
|
|
@@ -70,7 +70,7 @@ Example:
|
|
|
70
70
|
},
|
|
71
71
|
}))\`width: 100%;\`
|
|
72
72
|
|
|
73
|
-
<Component />`),x=!0,j={}}}}(u,g)),ka($,function(){return".".concat($.styledComponentId)}),a&&Rc($,t,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),$}function ns(t,r){for(var o=[t[0]],n=0,s=r.length;n<s;n+=1)o.push(r[n],t[n+1]);return o}var as=function(t){return Object.assign(t,{isCss:!0})};function Qt(t){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(br(t)||yr(t))return as(Zt(ns(en,Xt([t],r,!0))));var n=t;return r.length===0&&n.length===1&&typeof n[0]=="string"?Zt(n):as(Zt(ns(n,r)))}function ha(t,r,o){if(o===void 0&&(o=vr),!r)throw _r(1,r);var n=function(s){for(var a=[],h=1;h<arguments.length;h++)a[h-1]=arguments[h];return t(r,o,Qt.apply(void 0,Xt([s],a,!1)))};return n.attrs=function(s){return ha(t,r,He(He({},o),{attrs:Array.prototype.concat(o.attrs,s).filter(Boolean)}))},n.withConfig=function(s){return ha(t,r,He(He({},o),s))},n}var
|
|
73
|
+
<Component />`),x=!0,j={}}}}(u,g)),ka($,function(){return".".concat($.styledComponentId)}),a&&Rc($,t,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),$}function ns(t,r){for(var o=[t[0]],n=0,s=r.length;n<s;n+=1)o.push(r[n],t[n+1]);return o}var as=function(t){return Object.assign(t,{isCss:!0})};function Qt(t){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(br(t)||yr(t))return as(Zt(ns(en,Xt([t],r,!0))));var n=t;return r.length===0&&n.length===1&&typeof n[0]=="string"?Zt(n):as(Zt(ns(n,r)))}function ha(t,r,o){if(o===void 0&&(o=vr),!r)throw _r(1,r);var n=function(s){for(var a=[],h=1;h<arguments.length;h++)a[h-1]=arguments[h];return t(r,o,Qt.apply(void 0,Xt([s],a,!1)))};return n.attrs=function(s){return ha(t,r,He(He({},o),{attrs:Array.prototype.concat(o.attrs,s).filter(Boolean)}))},n.withConfig=function(s){return ha(t,r,He(He({},o),s))},n}var Nc=function(t){return ha(gp,t)},l=Nc;ia.forEach(function(t){l[t]=Nc(t)});function or(t){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];process.env.NODE_ENV!=="production"&&typeof navigator<"u"&&navigator.product==="ReactNative"&&console.warn("`keyframes` cannot be used on ReactNative, only on the web. To do animation in ReactNative please use Animated.");var n=la(Qt.apply(void 0,Xt([t],r,!1))),s=Sc(n);return new pa(s,n)}process.env.NODE_ENV!=="production"&&typeof navigator<"u"&&navigator.product==="ReactNative"&&console.warn(`It looks like you've imported 'styled-components' on React Native.
|
|
74
74
|
Perhaps you're looking to import 'styled-components/native'?
|
|
75
75
|
Read more about this at https://www.styled-components.com/docs/basics#react-native`);var eo="__sc-".concat(Jt,"__");process.env.NODE_ENV!=="production"&&process.env.NODE_ENV!=="test"&&typeof window<"u"&&(window[eo]||(window[eo]=0),window[eo]===1&&console.warn(`It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.
|
|
76
76
|
|
|
@@ -79,7 +79,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[eo]+=1);/**
|
|
|
79
79
|
*
|
|
80
80
|
* This source code is licensed under the ISC license.
|
|
81
81
|
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
-
*/const mp=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),
|
|
82
|
+
*/const mp=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Fc=(...t)=>t.filter((r,o,n)=>!!r&&r.trim()!==""&&n.indexOf(r)===o).join(" ").trim();/**
|
|
83
83
|
* @license lucide-react v0.474.0 - ISC
|
|
84
84
|
*
|
|
85
85
|
* This source code is licensed under the ISC license.
|
|
@@ -89,12 +89,12 @@ See https://s-c.sh/2BAXzed for more info.`),window[eo]+=1);/**
|
|
|
89
89
|
*
|
|
90
90
|
* This source code is licensed under the ISC license.
|
|
91
91
|
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
-
*/const vp=i.forwardRef(({color:t="currentColor",size:r=24,strokeWidth:o=2,absoluteStrokeWidth:n,className:s="",children:a,iconNode:h,...f},c)=>i.createElement("svg",{ref:c,...xp,width:r,height:r,stroke:t,strokeWidth:n?Number(o)*24/Number(r):o,className:
|
|
92
|
+
*/const vp=i.forwardRef(({color:t="currentColor",size:r=24,strokeWidth:o=2,absoluteStrokeWidth:n,className:s="",children:a,iconNode:h,...f},c)=>i.createElement("svg",{ref:c,...xp,width:r,height:r,stroke:t,strokeWidth:n?Number(o)*24/Number(r):o,className:Fc("lucide",s),...f},[...h.map(([p,d])=>i.createElement(p,d)),...Array.isArray(a)?a:[a]]));/**
|
|
93
93
|
* @license lucide-react v0.474.0 - ISC
|
|
94
94
|
*
|
|
95
95
|
* This source code is licensed under the ISC license.
|
|
96
96
|
* See the LICENSE file in the root directory of this source tree.
|
|
97
|
-
*/const be=(t,r)=>{const o=i.forwardRef(({className:n,...s},a)=>i.createElement(vp,{ref:a,iconNode:r,className:
|
|
97
|
+
*/const be=(t,r)=>{const o=i.forwardRef(({className:n,...s},a)=>i.createElement(vp,{ref:a,iconNode:r,className:Fc(`lucide-${mp(t)}`,n),...s}));return o.displayName=`${t}`,o};/**
|
|
98
98
|
* @license lucide-react v0.474.0 - ISC
|
|
99
99
|
*
|
|
100
100
|
* This source code is licensed under the ISC license.
|
|
@@ -124,7 +124,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[eo]+=1);/**
|
|
|
124
124
|
*
|
|
125
125
|
* This source code is licensed under the ISC license.
|
|
126
126
|
* See the LICENSE file in the root directory of this source tree.
|
|
127
|
-
*/const zp=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]],
|
|
127
|
+
*/const zp=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]],Nr=be("Building",zp);/**
|
|
128
128
|
* @license lucide-react v0.474.0 - ISC
|
|
129
129
|
*
|
|
130
130
|
* This source code is licensed under the ISC license.
|
|
@@ -159,7 +159,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[eo]+=1);/**
|
|
|
159
159
|
*
|
|
160
160
|
* This source code is licensed under the ISC license.
|
|
161
161
|
* See the LICENSE file in the root directory of this source tree.
|
|
162
|
-
*/const Lp=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],
|
|
162
|
+
*/const Lp=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],No=be("Copy",Lp);/**
|
|
163
163
|
* @license lucide-react v0.474.0 - ISC
|
|
164
164
|
*
|
|
165
165
|
* This source code is licensed under the ISC license.
|
|
@@ -169,12 +169,12 @@ See https://s-c.sh/2BAXzed for more info.`),window[eo]+=1);/**
|
|
|
169
169
|
*
|
|
170
170
|
* This source code is licensed under the ISC license.
|
|
171
171
|
* See the LICENSE file in the root directory of this source tree.
|
|
172
|
-
*/const Dp=[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16.2V21h-4.8",key:"1hrera"}],["path",{d:"M21 7.8V3h-4.8",key:"ul1q53"}],["path",{d:"M3 16.2V21h4.8",key:"1x04uo"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 7.8V3h4.8",key:"1ijppm"}],["path",{d:"M9 9 3 3",key:"v551iv"}]],
|
|
172
|
+
*/const Dp=[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16.2V21h-4.8",key:"1hrera"}],["path",{d:"M21 7.8V3h-4.8",key:"ul1q53"}],["path",{d:"M3 16.2V21h4.8",key:"1x04uo"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 7.8V3h4.8",key:"1ijppm"}],["path",{d:"M9 9 3 3",key:"v551iv"}]],Np=be("Expand",Dp);/**
|
|
173
173
|
* @license lucide-react v0.474.0 - ISC
|
|
174
174
|
*
|
|
175
175
|
* This source code is licensed under the ISC license.
|
|
176
176
|
* See the LICENSE file in the root directory of this source tree.
|
|
177
|
-
*/const
|
|
177
|
+
*/const Fp=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Uc=be("ExternalLink",Fp);/**
|
|
178
178
|
* @license lucide-react v0.474.0 - ISC
|
|
179
179
|
*
|
|
180
180
|
* This source code is licensed under the ISC license.
|
|
@@ -274,7 +274,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[eo]+=1);/**
|
|
|
274
274
|
*
|
|
275
275
|
* This source code is licensed under the ISC license.
|
|
276
276
|
* See the LICENSE file in the root directory of this source tree.
|
|
277
|
-
*/const ph=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],
|
|
277
|
+
*/const ph=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Fo=be("User",ph);/**
|
|
278
278
|
* @license lucide-react v0.474.0 - ISC
|
|
279
279
|
*
|
|
280
280
|
* This source code is licensed under the ISC license.
|
|
@@ -713,11 +713,11 @@ See https://s-c.sh/2BAXzed for more info.`),window[eo]+=1);/**
|
|
|
713
713
|
}
|
|
714
714
|
`,Dh=l(pe)`
|
|
715
715
|
flex: 1;
|
|
716
|
-
`,Gr=({value:t,onChange:r,error:o,countryCode:n,setCountryCode:s})=>{const[a,h]=i.useState(!1),[f,c]=i.useState(To.find(v=>v.code===n)||To[0]),p=i.useRef(null),[d,u]=i.useState(""),g=i.useRef(null);i.useEffect(()=>{function v(y){p.current&&!p.current.contains(y.target)&&h(!1)}return document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[]);const m=To.filter(v=>v.name.toLowerCase().includes(d.toLowerCase())||v.dialCode.includes(d));return i.useEffect(()=>{s(f.dialCode)},[f,s]),e.jsxs(Rh,{children:[e.jsxs(Ih,{ref:p,children:[e.jsxs(Th,{type:"button",onClick:()=>h(v=>!v),children:[e.jsx("span",{children:f.flag}),e.jsx("span",{children:f.dialCode})]}),e.jsxs(Oh,{$isOpen:a,children:[e.jsx(Mh,{type:"text",placeholder:"Search country...",value:d,onChange:v=>u(v.target.value),onClick:v=>v.stopPropagation()}),e.jsx(Lh,{children:m.map(v=>e.jsxs(Ah,{onClick:y=>{var S;y.stopPropagation(),y.preventDefault(),c(v),h(!1),(S=g.current)==null||S.focus()},children:[e.jsx("span",{children:v.flag}),e.jsx("span",{children:v.name}),e.jsx("span",{className:"country-code",children:v.dialCode})]},v.code))})]})]}),e.jsx(Dh,{style:{height:"100%"},type:"tel",id:"phone",name:"phone",required:!0,minLength:7,maxLength:15,ref:g,value:t,onChange:r,placeholder:"Phone number","aria-invalid":!!o,pattern:"^\\d{7,15}$"})]})},
|
|
716
|
+
`,Gr=({value:t,onChange:r,error:o,countryCode:n,setCountryCode:s})=>{const[a,h]=i.useState(!1),[f,c]=i.useState(To.find(v=>v.code===n)||To[0]),p=i.useRef(null),[d,u]=i.useState(""),g=i.useRef(null);i.useEffect(()=>{function v(y){p.current&&!p.current.contains(y.target)&&h(!1)}return document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[]);const m=To.filter(v=>v.name.toLowerCase().includes(d.toLowerCase())||v.dialCode.includes(d));return i.useEffect(()=>{s(f.dialCode)},[f,s]),e.jsxs(Rh,{children:[e.jsxs(Ih,{ref:p,children:[e.jsxs(Th,{type:"button",onClick:()=>h(v=>!v),children:[e.jsx("span",{children:f.flag}),e.jsx("span",{children:f.dialCode})]}),e.jsxs(Oh,{$isOpen:a,children:[e.jsx(Mh,{type:"text",placeholder:"Search country...",value:d,onChange:v=>u(v.target.value),onClick:v=>v.stopPropagation()}),e.jsx(Lh,{children:m.map(v=>e.jsxs(Ah,{onClick:y=>{var S;y.stopPropagation(),y.preventDefault(),c(v),h(!1),(S=g.current)==null||S.focus()},children:[e.jsx("span",{children:v.flag}),e.jsx("span",{children:v.name}),e.jsx("span",{className:"country-code",children:v.dialCode})]},v.code))})]})]}),e.jsx(Dh,{style:{height:"100%"},type:"tel",id:"phone",name:"phone",required:!0,minLength:7,maxLength:15,ref:g,value:t,onChange:r,placeholder:"Phone number","aria-invalid":!!o,pattern:"^\\d{7,15}$"})]})},Nh=l.div`
|
|
717
717
|
display: flex;
|
|
718
718
|
justify-content: center;
|
|
719
719
|
margin-bottom: var(--space-lg);
|
|
720
|
-
`,
|
|
720
|
+
`,Fh=l.div`
|
|
721
721
|
display: flex;
|
|
722
722
|
align-items: center;
|
|
723
723
|
justify-content: center;
|
|
@@ -736,7 +736,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[eo]+=1);/**
|
|
|
736
736
|
width: auto;
|
|
737
737
|
height: auto;
|
|
738
738
|
object-fit: contain;
|
|
739
|
-
`;function Re(){var s;const{deployment:t}=ve(),[r,o]=i.useState(!1),n=(s=t==null?void 0:t.ui_settings)==null?void 0:s.logo_image_url;return!n||r?null:e.jsx(
|
|
739
|
+
`;function Re(){var s;const{deployment:t}=ve(),[r,o]=i.useState(!1),n=(s=t==null?void 0:t.ui_settings)==null?void 0:s.logo_image_url;return!n||r?null:e.jsx(Nh,{children:e.jsx(Fh,{children:e.jsx(Bh,{src:n,alt:"Logo",onError:()=>o(!0)})})})}const Uh=or`
|
|
740
740
|
from {
|
|
741
741
|
transform: rotate(0deg);
|
|
742
742
|
}
|
|
@@ -921,7 +921,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[eo]+=1);/**
|
|
|
921
921
|
`,lr=l.span`
|
|
922
922
|
color: var(--color-danger);
|
|
923
923
|
margin-left: 2px;
|
|
924
|
-
`;function Xh(){var U,K,ee,J,ie,oe,de,Q,ce,B,V,D,le,H,ae,ke,ne;const{loading:t,signUp:r,signupAttempt:o,discardSignupAttempt:n}=nc(),{signIn:s}=Dr("oauth"),{deployment:a}=ve(),{navigate:h}=Ve(),{session:f,refetch:c,loading:p}=Be(),[d,u]=i.useState({first_name:"",last_name:"",email:"",password:"",username:"",phone_number:""}),[g,m]=i.useState({}),[v,y]=i.useState(!1),[S,E]=i.useState(void 0),[b,$]=i.useState(null),[C,w]=i.useState(null),[j,x]=i.useState(!1),I=((U=a==null?void 0:a.restrictions)==null?void 0:U.sign_up_mode)==="restricted",k=((K=a==null?void 0:a.restrictions)==null?void 0:K.sign_up_mode)==="waitlist",R=((J=(ee=a==null?void 0:a.auth_settings)==null?void 0:ee.multi_session_support)==null?void 0:J.enabled)??!1;i.useEffect(()=>{var Y;if(!p&&(f!=null&&f.active_signin)&&!R&&!j){x(!0);let Z=new URLSearchParams(window.location.search).get("redirect_uri");Z||(Z=((Y=a==null?void 0:a.ui_settings)==null?void 0:Y.after_signin_redirect_url)||null),!Z&&(a!=null&&a.frontend_host)&&(Z=`https://${a.frontend_host}`),!Z&&(a!=null&&a.frontend_host)&&(Z=`https://${a.frontend_host}`),Z&&h(Z)}},[f,p,R,a,h,j]),i.useEffect(()=>{var N;if(!a)return;const Z=new URLSearchParams(window.location.search).get("invite_token");if(k&&!Z){x(!0);const W=((N=a.ui_settings)==null?void 0:N.waitlist_page_url)||`https://${a.frontend_host}/waitlist`;h(W);return}Z&&!b&&r&&(w(Z),r.validateDeploymentInvitation(Z).then(W=>{$(W),W.valid&&u(fe=>({...fe,first_name:W.first_name||fe.first_name,last_name:W.last_name||fe.last_name,email:W.email||fe.email}))}).catch(W=>{console.error("Failed to validate invitation:",W)}))},[a,k,h,b,r]);const[_,O]=i.useState(!1),[P,z]=i.useState(""),T=Y=>{let{name:Z,value:N}=Y.target;Z==="phone_number"?N=N.replace(/[^0-9-]/g,""):Z==="email"&&(N=N.toLowerCase()),u(W=>({...W,[Z]:N})),m(W=>({...W,[Z]:""}))},M=()=>{u({first_name:"",last_name:"",email:"",password:"",username:"",phone_number:""}),m({}),O(!1),z(""),n()},F=async Y=>{if(Y.preventDefault(),console.log("Signup form - handleSubmit called"),console.log("Auth settings:",A),console.log("Form data:",d),t||v)return;const Z={},N=/^[a-zA-Z]{3,30}$/,W=/^[a-zA-Z][a-zA-Z0-9_.]{2,29}$/,fe=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,ye=/^\d{7,15}$/,re=/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,125}$/;if(A!=null&&A.first_name.enabled&&(A!=null&&A.first_name.required&&!d.first_name?Z.first_name="First name is required":d.first_name&&!N.test(d.first_name)&&(Z.first_name="Invalid name")),A!=null&&A.last_name.enabled&&(A!=null&&A.last_name.required&&!d.last_name?Z.last_name="Last name is required":d.last_name&&!N.test(d.last_name)&&(Z.last_name="Invalid last name")),A!=null&&A.username.enabled&&(A!=null&&A.username.required&&!d.username?Z.username="Username is required":d.username&&!W.test(d.username)&&(Z.username="Username must be 3-20 characters")),A!=null&&A.email_address.enabled&&(A!=null&&A.email_address.required&&!d.email?Z.email="Email address is required":d.email&&!fe.test(d.email)&&(Z.email="Invalid email address")),A!=null&&A.phone_number.enabled&&(A!=null&&A.phone_number.required&&!d.phone_number?Z.phone_number="Phone number is required":d.phone_number&&!ye.test(d.phone_number)&&(Z.phone_number="Phone number must contain 7-15 digits")),A!=null&&A.password.enabled&&(d.password?re.test(d.password)||(Z.password="Password must be 8-125 characters and include uppercase, lowercase, number, and special character"):Z.password="Password is required"),m(Z),Object.keys(Z).length>0){console.log("Signup validation failed. Errors:",Z);return}console.log("Signup validation passed"),y(!0);try{const je={...d};d.phone_number&&S&&(je.phone_country_code=S),C&&(je.invite_token=C),console.log("Submitting signup data:",je),console.log("Phone number:",je.phone_number),console.log("Phone country code:",je.phone_country_code),await r.create(je)}catch(je){m({submit:je.message})}finally{y(!1)}},G=async Y=>{if(!(t||v)){y(!0);try{const N=new URLSearchParams(window.location.search).get("redirect_uri")||void 0,{data:W}=await s.create({provider:Y.provider,redirectUri:N});W&&typeof W=="object"&&"oauth_url"in W&&(window.location.href=W.oauth_url)}catch(Z){m({submit:Z.message})}finally{y(!1)}}},L=(a==null?void 0:a.social_connections.filter(Y=>Y.enabled))||[],A=a==null?void 0:a.auth_settings,se=!!((ie=A==null?void 0:A.first_name)!=null&&ie.enabled&&((oe=A==null?void 0:A.last_name)!=null&&oe.enabled)),te=async Y=>{var N;if(Y.preventDefault(),t||v)return;y(!0);const Z={};if(!P){Z.otp="OTP code is required",m(Z),y(!1);return}m(Z);try{const W=await r.completeVerification(P);"data"in W&&((N=W.data)!=null&&N.active_signin)&&await c()}catch(W){console.error("Verification failed:",W)}finally{y(!1)}};return i.useEffect(()=>{var Y;if(o){if(o.completed){let Z=new URLSearchParams(window.location.search).get("redirect_uri");if(Z||(Z=((Y=a==null?void 0:a.ui_settings)==null?void 0:Y.after_signup_redirect_url)||null),!Z&&(a!=null&&a.frontend_host)&&(Z=`https://${a.frontend_host}`),Z){const N=new URL(Z);(a==null?void 0:a.mode)==="staging"&&N.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),h(N.toString())}return}if(!_){switch(o.current_step){case"verify_email":r.prepareVerification({strategy:"email_otp"});break;case"verify_phone":r.prepareVerification({strategy:"phone_otp"});break}O(!0)}}},[o,r,_,a,f,h]),p?e.jsx(ue,{children:e.jsxs(to,{children:[e.jsx(Re,{}),e.jsx(is,{children:e.jsx(vt,{size:32})})]})}):j?e.jsx(ue,{children:e.jsxs(to,{children:[e.jsx(Re,{}),e.jsx(is,{children:e.jsx(vt,{size:32})})]})}):I?e.jsx(ue,{children:e.jsxs(to,{children:[e.jsx(Re,{}),e.jsx(kn,{children:e.jsx(_n,{children:"Sign up Restricted!"})}),e.jsx(qh,{children:e.jsx(Yh,{children:"New account registration is currently restricted. Please check back later."})}),e.jsx(Zh,{children:e.jsxs(Qh,{children:["Need assistance?"," ",e.jsx(Kh,{href:(de=a==null?void 0:a.ui_settings)!=null&&de.sign_in_page_url?`${a.ui_settings.sign_in_page_url}?help=true`:"/contact",children:"Get help"})]})})]})}):e.jsx(ue,{children:e.jsx(to,{children:_?e.jsxs(e.Fragment,{children:[e.jsxs(kn,{children:[e.jsxs(_n,{children:["Check your"," ",(o==null?void 0:o.current_step)==="verify_email"?"email":"phone"]}),e.jsx(cs,{children:(o==null?void 0:o.current_step)==="verify_email"?`${d.email} to continue to ${(Q=a==null?void 0:a.ui_settings)==null?void 0:Q.app_name}`:`${d.phone_number} to continue to ${(ce=a==null?void 0:a.ui_settings)==null?void 0:ce.app_name}`})]}),e.jsxs(ls,{style:{gap:"15px"},onSubmit:te,noValidate:!0,children:[e.jsx(It,{onComplete:async Y=>{z(Y)},onResend:async()=>{const Y=(o==null?void 0:o.current_step)==="verify_email"?"email_otp":"phone_otp";await r.prepareVerification({strategy:Y})},error:g.otp,isSubmitting:v}),e.jsx(ds,{type:"submit",disabled:v||t||!P,children:v?"Verifying...":`Continue to ${(B=a==null?void 0:a.ui_settings)==null?void 0:B.app_name}`})]}),e.jsxs(us,{children:["Having trouble?"," ",e.jsx(Cn,{children:e.jsx(ot,{to:a.ui_settings.support_page_url,children:"Contact support"})}),e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(Cn,{onClick:()=>{M()},style:{cursor:"pointer"},children:"Use other method"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Re,{}),e.jsxs(kn,{children:[e.jsx(_n,{children:"Create your account"}),e.jsx(cs,{children:b!=null&&b.valid?"You've been invited! Complete your registration below.":"Welcome! Please fill in the details to get started."})]}),L.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(_a,{connections:L,callback:G}),e.jsx(Wh,{children:e.jsx(Vh,{children:"or"})})]}),e.jsxs(ls,{onSubmit:F,noValidate:!0,children:[(((V=A==null?void 0:A.first_name)==null?void 0:V.enabled)||((D=A==null?void 0:A.last_name)==null?void 0:D.enabled))&&e.jsxs(Gh,{$isBothEnabled:se,children:[((le=A==null?void 0:A.first_name)==null?void 0:le.enabled)&&e.jsxs(ir,{children:[e.jsxs(cr,{htmlFor:"first_name",children:["First name",((H=A==null?void 0:A.first_name)==null?void 0:H.required)&&e.jsx(lr,{children:"*"})]}),e.jsx(pe,{type:"text",id:"first_name",name:"first_name",required:!0,minLength:3,maxLength:30,value:d.first_name,onChange:T,placeholder:"First name","aria-invalid":!!g.first_name,pattern:"^[a-zA-Z]{3,30}$"}),g.first_name&&e.jsx(Mt,{children:g.first_name})]}),((ae=A==null?void 0:A.last_name)==null?void 0:ae.enabled)&&e.jsxs(ir,{children:[e.jsxs(cr,{htmlFor:"last_name",children:["Last name",((ke=A==null?void 0:A.last_name)==null?void 0:ke.required)&&e.jsx(lr,{children:"*"})]}),e.jsx(pe,{type:"text",id:"last_name",name:"last_name",required:!0,minLength:3,maxLength:30,value:d.last_name,onChange:T,placeholder:"Last name","aria-invalid":!!g.last_name,pattern:"^[a-zA-Z]{3,30}$"}),g.last_name&&e.jsx(Mt,{children:g.last_name})]})]}),(A==null?void 0:A.username.enabled)&&e.jsxs(ir,{children:[e.jsxs(cr,{htmlFor:"username",children:["Username",A.username.required&&e.jsx(lr,{children:"*"})]}),e.jsx(pe,{type:"text",id:"username",name:"username",minLength:3,maxLength:20,value:d.username,onChange:T,placeholder:"Choose a username","aria-invalid":!!g.username,required:!0,pattern:"^[a-zA-Z][a-zA-Z0-9_.]{2,29}$"}),g.username&&e.jsx(Mt,{children:g.username})]}),(A==null?void 0:A.email_address.enabled)&&e.jsxs(ir,{children:[e.jsxs(cr,{htmlFor:"email",children:["Email address",A.email_address.required&&e.jsx(lr,{children:"*"})]}),e.jsx(pe,{type:"email",id:"email",name:"email",maxLength:320,value:d.email,onChange:T,placeholder:"Enter your email address","aria-invalid":!!g.email,required:!0,readOnly:(b==null?void 0:b.valid)&&!!(b!=null&&b.email),pattern:"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"}),g.email&&e.jsx(Mt,{children:g.email})]}),(A==null?void 0:A.phone_number.enabled)&&e.jsxs(ir,{children:[e.jsxs(cr,{htmlFor:"phone_number",children:["Phone number",A.phone_number.required&&e.jsx(lr,{children:"*"})]}),e.jsx(Gr,{value:d.phone_number,onChange:T,error:g.phone_number,countryCode:S,setCountryCode:E}),g.phone_number&&e.jsx(Mt,{children:g.phone_number})]}),(A==null?void 0:A.password.enabled)&&e.jsxs(ir,{children:[e.jsxs(cr,{htmlFor:"password",children:["Password",A.password.required&&e.jsx(lr,{children:"*"})]}),e.jsx(Hh,{children:e.jsx(pe,{type:"password",id:"password",name:"password",value:d.password,onChange:T,placeholder:"Enter your password","aria-invalid":!!g.password,required:!0,minLength:8,maxLength:128,pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,125}$"})}),g.password&&e.jsx(Mt,{children:g.password})]}),g.submit&&e.jsx(Mt,{children:g.submit}),e.jsx(ds,{type:"submit",disabled:v||t,children:v?"Creating account...":"Continue"})]}),e.jsxs(us,{children:["Already have an account?"," ",e.jsx(Cn,{children:e.jsx(ot,{to:`${(ne=a.ui_settings)==null?void 0:ne.sign_in_page_url}${window.location.search}`,children:"Sign in"})})]})]})})})}const Kc=i.createContext(void 0),Xc=()=>{const t=i.useContext(Kc);if(!t)throw new Error("Dialog components must be used within a Dialog");return t},Jh=l.div`
|
|
924
|
+
`;function Xh(){var U,K,ee,J,ie,oe,de,Q,ce,B,V,D,le,q,ae,ke,ne;const{loading:t,signUp:r,signupAttempt:o,discardSignupAttempt:n}=nc(),{signIn:s}=Dr("oauth"),{deployment:a}=ve(),{navigate:h}=Ve(),{session:f,refetch:c,loading:p}=Be(),[d,u]=i.useState({first_name:"",last_name:"",email:"",password:"",username:"",phone_number:""}),[g,m]=i.useState({}),[v,y]=i.useState(!1),[S,E]=i.useState(void 0),[b,$]=i.useState(null),[C,w]=i.useState(null),[j,x]=i.useState(!1),I=((U=a==null?void 0:a.restrictions)==null?void 0:U.sign_up_mode)==="restricted",k=((K=a==null?void 0:a.restrictions)==null?void 0:K.sign_up_mode)==="waitlist",R=((J=(ee=a==null?void 0:a.auth_settings)==null?void 0:ee.multi_session_support)==null?void 0:J.enabled)??!1;i.useEffect(()=>{var Y;if(!p&&(f!=null&&f.active_signin)&&!R&&!j){x(!0);let Z=new URLSearchParams(window.location.search).get("redirect_uri");Z||(Z=((Y=a==null?void 0:a.ui_settings)==null?void 0:Y.after_signin_redirect_url)||null),!Z&&(a!=null&&a.frontend_host)&&(Z=`https://${a.frontend_host}`),!Z&&(a!=null&&a.frontend_host)&&(Z=`https://${a.frontend_host}`),Z&&h(Z)}},[f,p,R,a,h,j]),i.useEffect(()=>{var F;if(!a)return;const Z=new URLSearchParams(window.location.search).get("invite_token");if(k&&!Z){x(!0);const W=((F=a.ui_settings)==null?void 0:F.waitlist_page_url)||`https://${a.frontend_host}/waitlist`;h(W);return}Z&&!b&&r&&(w(Z),r.validateDeploymentInvitation(Z).then(W=>{$(W),W.valid&&u(fe=>({...fe,first_name:W.first_name||fe.first_name,last_name:W.last_name||fe.last_name,email:W.email||fe.email}))}).catch(W=>{console.error("Failed to validate invitation:",W)}))},[a,k,h,b,r]);const[_,O]=i.useState(!1),[P,z]=i.useState(""),T=Y=>{let{name:Z,value:F}=Y.target;Z==="phone_number"?F=F.replace(/[^0-9-]/g,""):Z==="email"&&(F=F.toLowerCase()),u(W=>({...W,[Z]:F})),m(W=>({...W,[Z]:""}))},M=()=>{u({first_name:"",last_name:"",email:"",password:"",username:"",phone_number:""}),m({}),O(!1),z(""),n()},N=async Y=>{if(Y.preventDefault(),console.log("Signup form - handleSubmit called"),console.log("Auth settings:",A),console.log("Form data:",d),t||v)return;const Z={},F=/^[a-zA-Z]{3,30}$/,W=/^[a-zA-Z][a-zA-Z0-9_.]{2,29}$/,fe=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,ye=/^\d{7,15}$/,re=/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,125}$/;if(A!=null&&A.first_name.enabled&&(A!=null&&A.first_name.required&&!d.first_name?Z.first_name="First name is required":d.first_name&&!F.test(d.first_name)&&(Z.first_name="Invalid name")),A!=null&&A.last_name.enabled&&(A!=null&&A.last_name.required&&!d.last_name?Z.last_name="Last name is required":d.last_name&&!F.test(d.last_name)&&(Z.last_name="Invalid last name")),A!=null&&A.username.enabled&&(A!=null&&A.username.required&&!d.username?Z.username="Username is required":d.username&&!W.test(d.username)&&(Z.username="Username must be 3-20 characters")),A!=null&&A.email_address.enabled&&(A!=null&&A.email_address.required&&!d.email?Z.email="Email address is required":d.email&&!fe.test(d.email)&&(Z.email="Invalid email address")),A!=null&&A.phone_number.enabled&&(A!=null&&A.phone_number.required&&!d.phone_number?Z.phone_number="Phone number is required":d.phone_number&&!ye.test(d.phone_number)&&(Z.phone_number="Phone number must contain 7-15 digits")),A!=null&&A.password.enabled&&(d.password?re.test(d.password)||(Z.password="Password must be 8-125 characters and include uppercase, lowercase, number, and special character"):Z.password="Password is required"),m(Z),Object.keys(Z).length>0){console.log("Signup validation failed. Errors:",Z);return}console.log("Signup validation passed"),y(!0);try{const je={...d};d.phone_number&&S&&(je.phone_country_code=S),C&&(je.invite_token=C),console.log("Submitting signup data:",je),console.log("Phone number:",je.phone_number),console.log("Phone country code:",je.phone_country_code),await r.create(je)}catch(je){m({submit:je.message})}finally{y(!1)}},H=async Y=>{if(!(t||v)){y(!0);try{const F=new URLSearchParams(window.location.search).get("redirect_uri")||void 0,{data:W}=await s.create({provider:Y.provider,redirectUri:F});W&&typeof W=="object"&&"oauth_url"in W&&(window.location.href=W.oauth_url)}catch(Z){m({submit:Z.message})}finally{y(!1)}}},L=(a==null?void 0:a.social_connections.filter(Y=>Y.enabled))||[],A=a==null?void 0:a.auth_settings,se=!!((ie=A==null?void 0:A.first_name)!=null&&ie.enabled&&((oe=A==null?void 0:A.last_name)!=null&&oe.enabled)),te=async Y=>{var F;if(Y.preventDefault(),t||v)return;y(!0);const Z={};if(!P){Z.otp="OTP code is required",m(Z),y(!1);return}m(Z);try{const W=await r.completeVerification(P);"data"in W&&((F=W.data)!=null&&F.active_signin)&&await c()}catch(W){console.error("Verification failed:",W)}finally{y(!1)}};return i.useEffect(()=>{var Y;if(o){if(o.completed){let Z=new URLSearchParams(window.location.search).get("redirect_uri");if(Z||(Z=((Y=a==null?void 0:a.ui_settings)==null?void 0:Y.after_signup_redirect_url)||null),!Z&&(a!=null&&a.frontend_host)&&(Z=`https://${a.frontend_host}`),Z){const F=new URL(Z);(a==null?void 0:a.mode)==="staging"&&F.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),h(F.toString())}return}if(!_){switch(o.current_step){case"verify_email":r.prepareVerification({strategy:"email_otp"});break;case"verify_phone":r.prepareVerification({strategy:"phone_otp"});break}O(!0)}}},[o,r,_,a,f,h]),p?e.jsx(ue,{children:e.jsxs(to,{children:[e.jsx(Re,{}),e.jsx(is,{children:e.jsx(vt,{size:32})})]})}):j?e.jsx(ue,{children:e.jsxs(to,{children:[e.jsx(Re,{}),e.jsx(is,{children:e.jsx(vt,{size:32})})]})}):I?e.jsx(ue,{children:e.jsxs(to,{children:[e.jsx(Re,{}),e.jsx(kn,{children:e.jsx(_n,{children:"Sign up Restricted!"})}),e.jsx(qh,{children:e.jsx(Yh,{children:"New account registration is currently restricted. Please check back later."})}),e.jsx(Zh,{children:e.jsxs(Qh,{children:["Need assistance?"," ",e.jsx(Kh,{href:(de=a==null?void 0:a.ui_settings)!=null&&de.sign_in_page_url?`${a.ui_settings.sign_in_page_url}?help=true`:"/contact",children:"Get help"})]})})]})}):e.jsx(ue,{children:e.jsx(to,{children:_?e.jsxs(e.Fragment,{children:[e.jsxs(kn,{children:[e.jsxs(_n,{children:["Check your"," ",(o==null?void 0:o.current_step)==="verify_email"?"email":"phone"]}),e.jsx(cs,{children:(o==null?void 0:o.current_step)==="verify_email"?`${d.email} to continue to ${(Q=a==null?void 0:a.ui_settings)==null?void 0:Q.app_name}`:`${d.phone_number} to continue to ${(ce=a==null?void 0:a.ui_settings)==null?void 0:ce.app_name}`})]}),e.jsxs(ls,{style:{gap:"15px"},onSubmit:te,noValidate:!0,children:[e.jsx(It,{onComplete:async Y=>{z(Y)},onResend:async()=>{const Y=(o==null?void 0:o.current_step)==="verify_email"?"email_otp":"phone_otp";await r.prepareVerification({strategy:Y})},error:g.otp,isSubmitting:v}),e.jsx(ds,{type:"submit",disabled:v||t||!P,children:v?"Verifying...":`Continue to ${(B=a==null?void 0:a.ui_settings)==null?void 0:B.app_name}`})]}),e.jsxs(us,{children:["Having trouble?"," ",e.jsx(Cn,{children:e.jsx(ot,{to:a.ui_settings.support_page_url,children:"Contact support"})}),e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(Cn,{onClick:()=>{M()},style:{cursor:"pointer"},children:"Use other method"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Re,{}),e.jsxs(kn,{children:[e.jsx(_n,{children:"Create your account"}),e.jsx(cs,{children:b!=null&&b.valid?"You've been invited! Complete your registration below.":"Welcome! Please fill in the details to get started."})]}),L.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(_a,{connections:L,callback:H}),e.jsx(Wh,{children:e.jsx(Vh,{children:"or"})})]}),e.jsxs(ls,{onSubmit:N,noValidate:!0,children:[(((V=A==null?void 0:A.first_name)==null?void 0:V.enabled)||((D=A==null?void 0:A.last_name)==null?void 0:D.enabled))&&e.jsxs(Gh,{$isBothEnabled:se,children:[((le=A==null?void 0:A.first_name)==null?void 0:le.enabled)&&e.jsxs(ir,{children:[e.jsxs(cr,{htmlFor:"first_name",children:["First name",((q=A==null?void 0:A.first_name)==null?void 0:q.required)&&e.jsx(lr,{children:"*"})]}),e.jsx(pe,{type:"text",id:"first_name",name:"first_name",required:!0,minLength:3,maxLength:30,value:d.first_name,onChange:T,placeholder:"First name","aria-invalid":!!g.first_name,pattern:"^[a-zA-Z]{3,30}$"}),g.first_name&&e.jsx(Mt,{children:g.first_name})]}),((ae=A==null?void 0:A.last_name)==null?void 0:ae.enabled)&&e.jsxs(ir,{children:[e.jsxs(cr,{htmlFor:"last_name",children:["Last name",((ke=A==null?void 0:A.last_name)==null?void 0:ke.required)&&e.jsx(lr,{children:"*"})]}),e.jsx(pe,{type:"text",id:"last_name",name:"last_name",required:!0,minLength:3,maxLength:30,value:d.last_name,onChange:T,placeholder:"Last name","aria-invalid":!!g.last_name,pattern:"^[a-zA-Z]{3,30}$"}),g.last_name&&e.jsx(Mt,{children:g.last_name})]})]}),(A==null?void 0:A.username.enabled)&&e.jsxs(ir,{children:[e.jsxs(cr,{htmlFor:"username",children:["Username",A.username.required&&e.jsx(lr,{children:"*"})]}),e.jsx(pe,{type:"text",id:"username",name:"username",minLength:3,maxLength:20,value:d.username,onChange:T,placeholder:"Choose a username","aria-invalid":!!g.username,required:!0,pattern:"^[a-zA-Z][a-zA-Z0-9_.]{2,29}$"}),g.username&&e.jsx(Mt,{children:g.username})]}),(A==null?void 0:A.email_address.enabled)&&e.jsxs(ir,{children:[e.jsxs(cr,{htmlFor:"email",children:["Email address",A.email_address.required&&e.jsx(lr,{children:"*"})]}),e.jsx(pe,{type:"email",id:"email",name:"email",maxLength:320,value:d.email,onChange:T,placeholder:"Enter your email address","aria-invalid":!!g.email,required:!0,readOnly:(b==null?void 0:b.valid)&&!!(b!=null&&b.email),pattern:"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"}),g.email&&e.jsx(Mt,{children:g.email})]}),(A==null?void 0:A.phone_number.enabled)&&e.jsxs(ir,{children:[e.jsxs(cr,{htmlFor:"phone_number",children:["Phone number",A.phone_number.required&&e.jsx(lr,{children:"*"})]}),e.jsx(Gr,{value:d.phone_number,onChange:T,error:g.phone_number,countryCode:S,setCountryCode:E}),g.phone_number&&e.jsx(Mt,{children:g.phone_number})]}),(A==null?void 0:A.password.enabled)&&e.jsxs(ir,{children:[e.jsxs(cr,{htmlFor:"password",children:["Password",A.password.required&&e.jsx(lr,{children:"*"})]}),e.jsx(Hh,{children:e.jsx(pe,{type:"password",id:"password",name:"password",value:d.password,onChange:T,placeholder:"Enter your password","aria-invalid":!!g.password,required:!0,minLength:8,maxLength:128,pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,125}$"})}),g.password&&e.jsx(Mt,{children:g.password})]}),g.submit&&e.jsx(Mt,{children:g.submit}),e.jsx(ds,{type:"submit",disabled:v||t,children:v?"Creating account...":"Continue"})]}),e.jsxs(us,{children:["Already have an account?"," ",e.jsx(Cn,{children:e.jsx(ot,{to:`${(ne=a.ui_settings)==null?void 0:ne.sign_in_page_url}${window.location.search}`,children:"Sign in"})})]})]})})})}const Kc=i.createContext(void 0),Xc=()=>{const t=i.useContext(Kc);if(!t)throw new Error("Dialog components must be used within a Dialog");return t},Jh=l.div`
|
|
925
925
|
position: fixed;
|
|
926
926
|
inset: 0;
|
|
927
927
|
background-color: var(--color-dialog-backdrop, rgba(0, 0, 0, 0.5));
|
|
@@ -971,7 +971,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[eo]+=1);/**
|
|
|
971
971
|
gap: 8px;
|
|
972
972
|
padding: 16px;
|
|
973
973
|
border-top: 1px solid var(--color-border);
|
|
974
|
-
`,sf=({isOpen:t,onClose:r,children:o})=>{const[n,s]=i.useState(!1);return i.useEffect(()=>{s(!0);const a=h=>{h.key==="Escape"&&t&&(r==null||r())};return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a)}},[t,r]),!t||!n?null:
|
|
974
|
+
`,sf=({isOpen:t,onClose:r,children:o})=>{const[n,s]=i.useState(!1);return i.useEffect(()=>{s(!0);const a=h=>{h.key==="Escape"&&t&&(r==null||r())};return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a)}},[t,r]),!t||!n?null:Fr.createPortal(e.jsx(ue,{children:e.jsx(Kc.Provider,{value:{isOpen:t,onClose:r},children:o})}),document.body)},cf=({children:t})=>{const{onClose:r}=Xc(),o=i.useRef(null),n=s=>{o.current&&!o.current.contains(s.target)&&(r==null||r())};return e.jsx(Jh,{onClick:n,children:e.jsx("div",{ref:o,children:t})})},lf=({children:t,style:r})=>e.jsx(ef,{style:r,children:t}),df=({children:t,showCloseButton:r=!0})=>{const{onClose:o}=Xc();return e.jsxs(tf,{children:[typeof t=="string"?e.jsx(rf,{children:t}):t,r&&e.jsx(of,{onClick:o,children:e.jsx(Ze,{size:18})})]})},uf=({children:t,style:r})=>e.jsx(nf,{style:r,children:t}),pf=({children:t})=>e.jsx(af,{children:t}),_e=Object.assign(sf,{Overlay:cf,Content:lf,Header:df,Body:uf,Footer:pf}),hf=({isOpen:t,onClose:r,title:o,children:n,showCloseButton:s=!0})=>e.jsx(_e,{isOpen:t,onClose:r,children:e.jsx(_e.Overlay,{children:e.jsxs(_e.Content,{children:[o&&e.jsx(_e.Header,{showCloseButton:s,children:o}),e.jsx(_e.Body,{children:n})]})})}),ff=({trigger:t,renderDialog:r})=>{const[o,n]=i.useState(!1),s=()=>n(!0),a=()=>n(!1);return e.jsxs(e.Fragment,{children:[t({onClick:s}),r({isOpen:o,onClose:a})]})},gf=l.div`
|
|
975
975
|
position: fixed;
|
|
976
976
|
background: var(--color-background);
|
|
977
977
|
border-radius: 8px;
|
|
@@ -1294,7 +1294,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[eo]+=1);/**
|
|
|
1294
1294
|
&:hover {
|
|
1295
1295
|
text-decoration: underline;
|
|
1296
1296
|
}
|
|
1297
|
-
`;function zf({onBack:t}){const{deployment:r}=ve(),{navigate:o}=Ve(),[n,s]=i.useState("start"),[a,h]=i.useState(""),[f,c]=i.useState(""),[p,d]=i.useState(""),[u,g]=i.useState(""),[m,v]=i.useState(""),{forgotPassword:y,verifyOtp:S,resetPassword:E}=dc(),[b,$]=i.useState(!1),[C,w]=i.useState(null),j=async R=>{if(R.preventDefault(),!!a){$(!0),w(null);try{await y(a),s("otp")}catch(_){w(_)}finally{$(!1)}}},x=async R=>{if(R.preventDefault(),f.length===6){$(!0),w(null);try{const _=await S(a,f);_.data&&(d(_.data.token),s("reset"))}catch(_){w(_)}finally{$(!1)}}},I=async R=>{var _,O;if(R.preventDefault(),u===m&&!(u.length<8)){$(!0),w(null);try{const P=await E(p,u);if(P.data){const z=P.data,T=z.signin_attempts&&z.signin_attempts.length>0?z.signin_attempts[z.signin_attempts.length-1]:null;if(T&&!T.completed){const M=(_=r==null?void 0:r.ui_settings)==null?void 0:_.sign_in_page_url;if(M){const
|
|
1297
|
+
`;function zf({onBack:t}){const{deployment:r}=ve(),{navigate:o}=Ve(),[n,s]=i.useState("start"),[a,h]=i.useState(""),[f,c]=i.useState(""),[p,d]=i.useState(""),[u,g]=i.useState(""),[m,v]=i.useState(""),{forgotPassword:y,verifyOtp:S,resetPassword:E}=dc(),[b,$]=i.useState(!1),[C,w]=i.useState(null),j=async R=>{if(R.preventDefault(),!!a){$(!0),w(null);try{await y(a),s("otp")}catch(_){w(_)}finally{$(!1)}}},x=async R=>{if(R.preventDefault(),f.length===6){$(!0),w(null);try{const _=await S(a,f);_.data&&(d(_.data.token),s("reset"))}catch(_){w(_)}finally{$(!1)}}},I=async R=>{var _,O;if(R.preventDefault(),u===m&&!(u.length<8)){$(!0),w(null);try{const P=await E(p,u);if(P.data){const z=P.data,T=z.signin_attempts&&z.signin_attempts.length>0?z.signin_attempts[z.signin_attempts.length-1]:null;if(T&&!T.completed){const M=(_=r==null?void 0:r.ui_settings)==null?void 0:_.sign_in_page_url;if(M){const N=new URL(M,window.location.origin);N.searchParams.set("signin_attempt_id",T.id),o(N.toString())}else t()}else{const M=((O=r==null?void 0:r.ui_settings)==null?void 0:O.after_signin_redirect_url)||"/";o(M)}}}catch(P){w(P)}finally{$(!1)}}},k=()=>e.jsxs(e.Fragment,{children:[e.jsx(Re,{}),e.jsx(ro,{children:e.jsx(oo,{children:"Forgot Password"})}),e.jsx(Cf,{onClick:()=>s("email"),disabled:b,children:"Reset your password"}),e.jsx(Sf,{children:e.jsx($f,{children:"Or, sign in with another method"})}),e.jsx(dl,{}),e.jsxs(no,{children:[e.jsxs(Er,{children:["Unable to reset password? ",e.jsx(Pr,{href:"/contact",children:"Get help"})]}),e.jsx(Er,{style:{marginTop:"var(--space-sm)"},children:e.jsx(Pr,{onClick:t,style:{cursor:"pointer"},children:"Back to login"})})]})]});return e.jsx(ue,{children:e.jsxs(_f,{children:[n==="start"&&k(),n==="email"&&e.jsxs(e.Fragment,{children:[e.jsx(Re,{}),e.jsxs(ro,{children:[e.jsx(oo,{children:"Forgot Password"}),e.jsx(Sn,{children:"Enter your email address and we'll send you a code to reset your password."})]}),e.jsxs(lt,{onSubmit:j,noValidate:!0,children:[e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"email",children:"Email Address"}),e.jsx(pe,{type:"email",id:"email",value:a,onChange:R=>h(R.target.value),placeholder:"Enter your email",required:!0})]}),C&&e.jsx($n,{children:C.message}),e.jsx(X,{type:"submit",disabled:b,style:{width:"100%",marginTop:"var(--space-md)"},children:b?"Sending...":"Send Code"})]}),e.jsx(no,{children:e.jsx(Er,{style:{marginTop:"var(--space-sm)"},children:e.jsx(Pr,{onClick:t,style:{cursor:"pointer"},children:"Back to login"})})})]}),n==="otp"&&e.jsxs(e.Fragment,{children:[e.jsx(Re,{}),e.jsxs(ro,{children:[e.jsx(oo,{children:"Enter Verification Code"}),e.jsxs(Sn,{children:["We've sent a 6-digit code to ",a,". Please enter it below."]})]}),e.jsxs(lt,{onSubmit:x,noValidate:!0,children:[e.jsx(It,{onComplete:R=>c(R),isSubmitting:b,error:C==null?void 0:C.message,onResend:async()=>{await y(a)}}),C&&e.jsx($n,{children:C.message}),e.jsx(X,{type:"submit",disabled:b||f.length!==6,style:{width:"100%",marginTop:"var(--space-md)"},children:b?"Verifying...":"Verify"})]}),e.jsx(no,{children:e.jsx(Er,{style:{marginTop:"var(--space-sm)"},children:e.jsx(Pr,{onClick:t,style:{cursor:"pointer"},children:"Back to login"})})})]}),n==="reset"&&e.jsxs(e.Fragment,{children:[e.jsx(Re,{}),e.jsxs(ro,{children:[e.jsx(oo,{children:"Reset Password"}),e.jsx(Sn,{children:"Create a new password for your account."})]}),e.jsxs(lt,{onSubmit:I,noValidate:!0,children:[e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"password",children:"New Password"}),e.jsx(pe,{type:"password",id:"password",value:u,onChange:R=>g(R.target.value),placeholder:"Enter new password",required:!0})]}),e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"confirmPassword",children:"Confirm New Password"}),e.jsx(pe,{type:"password",id:"confirmPassword",value:m,onChange:R=>v(R.target.value),placeholder:"Confirm new password",required:!0})]}),C&&e.jsx($n,{children:C.message}),e.jsx(X,{type:"submit",disabled:b,style:{width:"100%",marginTop:"var(--space-md)"},children:b?"Resetting...":"Reset Password"})]}),e.jsx(no,{children:e.jsx(Er,{style:{marginTop:"var(--space-sm)"},children:e.jsx(Pr,{onClick:t,style:{cursor:"pointer"},children:"Back to login"})})})]})]})})}const Ef=l.div`
|
|
1298
1298
|
max-width: 360px;
|
|
1299
1299
|
width: 360px;
|
|
1300
1300
|
padding: var(--space-2xl);
|
|
@@ -1344,11 +1344,11 @@ See https://s-c.sh/2BAXzed for more info.`),window[eo]+=1);/**
|
|
|
1344
1344
|
`,Df=l.p`
|
|
1345
1345
|
color: var(--color-secondary-text);
|
|
1346
1346
|
font-size: var(--font-xs);
|
|
1347
|
-
`,
|
|
1347
|
+
`,Nf=l.div`
|
|
1348
1348
|
display: flex;
|
|
1349
1349
|
flex-direction: column;
|
|
1350
1350
|
gap: 0;
|
|
1351
|
-
`,
|
|
1351
|
+
`,Ff=l.button`
|
|
1352
1352
|
display: flex;
|
|
1353
1353
|
align-items: flex-start;
|
|
1354
1354
|
gap: var(--space-md);
|
|
@@ -1411,7 +1411,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[eo]+=1);/**
|
|
|
1411
1411
|
&:hover {
|
|
1412
1412
|
color: var(--color-primary-hover);
|
|
1413
1413
|
}
|
|
1414
|
-
`;function ul({methods:t,onSelectMethod:r,onBack:o}){const n=s=>{r(s)};return e.jsx(ue,{children:e.jsxs(Mf,{children:[e.jsx(Re,{}),e.jsxs(Lf,{children:[e.jsx(Af,{children:"Two-factor authentication"}),e.jsx(Df,{children:"Choose how you'd like to verify your identity"})]}),e.jsx(
|
|
1414
|
+
`;function ul({methods:t,onSelectMethod:r,onBack:o}){const n=s=>{r(s)};return e.jsx(ue,{children:e.jsxs(Mf,{children:[e.jsx(Re,{}),e.jsxs(Lf,{children:[e.jsx(Af,{children:"Two-factor authentication"}),e.jsx(Df,{children:"Choose how you'd like to verify your identity"})]}),e.jsx(Nf,{children:t.map(s=>e.jsxs(Ff,{onClick:()=>n(s.id),disabled:!s.available,type:"button",children:[s.icon,e.jsxs(Bf,{children:[e.jsx(Uf,{children:s.name}),e.jsxs(Wf,{children:[s.description,s.phoneNumber&&` ${s.phoneNumber}`]})]})]},s.id))}),o&&e.jsx(Vf,{children:e.jsx(Gf,{onClick:o,style:{cursor:"pointer"},children:"Back to login"})})]})})}const Hf=l.div`
|
|
1415
1415
|
max-width: 380px;
|
|
1416
1416
|
width: 380px;
|
|
1417
1417
|
padding: var(--space-3xl);
|
|
@@ -1582,7 +1582,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[eo]+=1);/**
|
|
|
1582
1582
|
transform: rotate(360deg);
|
|
1583
1583
|
}
|
|
1584
1584
|
}
|
|
1585
|
-
`;function fl({attempt:t,onBack:r,completeProfile:o,completeVerification:n,prepareVerification:s}){var
|
|
1585
|
+
`;function fl({attempt:t,onBack:r,completeProfile:o,completeVerification:n,prepareVerification:s}){var H,L,A,se,te,U,K,ee,J;const{deployment:a}=ve(),{navigate:h}=Ve(),[f,c]=i.useState({}),[p,d]=i.useState({}),[u,g]=i.useState("US"),[m,v]=i.useState(!1),[y,S]=i.useState(!1),[E,b]=i.useState(null),[$,C]=i.useState(!1),w=E,j=y,x=async ie=>{var oe;S(!0),b(null);try{if(await o(ie)){C(!0);let Q=new URLSearchParams(window.location.search).get("redirect_uri");if(Q||(Q=((oe=a==null?void 0:a.ui_settings)==null?void 0:oe.after_signin_redirect_url)||null),!Q&&(a!=null&&a.frontend_host)&&(Q=`https://${a.frontend_host}`),Q){const ce=new URL(Q);(a==null?void 0:a.mode)==="staging"&&ce.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),h(ce.toString())}}}catch(de){const Q=de;throw b(Q),Q}finally{S(!1)}},I=async ie=>{var oe;S(!0),b(null);try{if(await n(ie)){C(!0);let Q=new URLSearchParams(window.location.search).get("redirect_uri");if(Q||(Q=((oe=a==null?void 0:a.ui_settings)==null?void 0:oe.after_signin_redirect_url)||null),!Q&&(a!=null&&a.frontend_host)&&(Q=`https://${a.frontend_host}`),Q){const ce=new URL(Q);(a==null?void 0:a.mode)==="staging"&&ce.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),h(ce.toString())}}return!0}catch(de){return b(de),!1}finally{S(!1)}};if($||!t)return e.jsx(ue,{children:e.jsxs(En,{children:[e.jsx(Re,{}),e.jsx(dg,{children:e.jsx(vt,{size:32})})]})});const k=t.missing_fields||[],R="Complete Your Profile",_="Please provide the following information to continue",O=a==null?void 0:a.auth_settings,P=(t==null?void 0:t.current_step)==="verify_phone_otp"||(t==null?void 0:t.current_step)==="verify_email_otp"||m,z=ie=>{const{name:oe,value:de}=ie.target;c(Q=>({...Q,[oe]:de})),p[oe]&&d(Q=>({...Q,[oe]:""}))},T=()=>{const ie={};return k.forEach(oe=>{var ce,B,V,D,le;const de=f[oe];let Q=!1;switch(oe){case"first_name":Q=((ce=O==null?void 0:O.first_name)==null?void 0:ce.enabled)||!1;break;case"last_name":Q=((B=O==null?void 0:O.last_name)==null?void 0:B.enabled)||!1;break;case"username":Q=((V=O==null?void 0:O.username)==null?void 0:V.enabled)||!1;break;case"phone_number":Q=((D=O==null?void 0:O.phone_number)==null?void 0:D.enabled)||!1;break;case"email_address":Q=((le=O==null?void 0:O.email_address)==null?void 0:le.enabled)||!1;break;default:Q=!0}if(Q&&(!de||de.trim()==="")){const q=oe.replace("_"," ").replace(/\b\w/g,ae=>ae.toUpperCase());ie[oe]=`${q} is required`}}),f.username&&k.includes("username")&&(/^[a-zA-Z0-9_-]{3,30}$/.test(f.username)||(ie.username="Username must be 3-30 characters and contain only letters, numbers, underscores, and hyphens")),f.phone_number&&k.includes("phone_number")&&(/^\d{7,15}$/.test(f.phone_number)||(ie.phone_number="Phone number must contain 7-15 digits")),f.email&&k.includes("email_address")&&(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(f.email)||(ie.email_address="Please enter a valid email address")),d(ie),Object.keys(ie).length===0},M=async ie=>{if(ie.preventDefault(),!T())return;const oe={...f};f.phone_number&&u&&(oe.phone_country_code=u),await x(oe)},N=ie=>{const oe=ie.target.value;c(de=>({...de,phone_number:oe})),p.phone_number&&d(de=>({...de,phone_number:""}))};if(P){const ie=t.current_step==="verify_phone_otp"?"Verify Your Phone Number":"Verify Your Email",oe=t.current_step==="verify_phone_otp"?"Enter the 6-digit code sent to your phone":"Enter the 6-digit code sent to your email",de=t.current_step==="verify_phone_otp"?"phone_otp":"email_otp";return e.jsx(ue,{children:e.jsxs(En,{children:[e.jsx(Re,{}),e.jsxs(bs,{children:[e.jsx(ys,{children:ie}),e.jsx(ws,{children:oe})]}),e.jsxs(lt,{onSubmit:Q=>Q.preventDefault(),noValidate:!0,children:[e.jsx(It,{onComplete:I,onResend:async()=>{await s({strategy:de})},error:w==null?void 0:w.message,isSubmitting:j}),w&&e.jsx(Lt,{style:{marginBottom:"var(--space-md)"},children:w.message})]}),e.jsxs(js,{children:[e.jsx("div",{children:e.jsx(ao,{onClick:()=>v(!1),style:{cursor:"pointer"},children:"Back to profile completion"})}),e.jsxs("div",{style:{marginTop:"var(--space-sm)"},children:["Having trouble?"," ",e.jsx(ao,{children:e.jsx(ot,{to:(a==null?void 0:a.ui_settings.support_page_url)||"#",children:"Get help"})})]})]})]})})}return e.jsx(ue,{children:e.jsxs(En,{children:[e.jsx(Re,{}),e.jsxs(bs,{children:[e.jsx(ys,{children:R}),e.jsx(ws,{children:_})]}),e.jsxs(lt,{onSubmit:M,noValidate:!0,children:[(k.includes("first_name")||k.includes("last_name"))&&(((H=O==null?void 0:O.first_name)==null?void 0:H.enabled)||((L=O==null?void 0:O.last_name)==null?void 0:L.enabled))&&e.jsxs(cg,{$isBothEnabled:!!((A=O==null?void 0:O.first_name)!=null&&A.enabled&&((se=O==null?void 0:O.last_name)!=null&&se.enabled)&&k.includes("first_name")&&k.includes("last_name")),children:[k.includes("first_name")&&((te=O==null?void 0:O.first_name)==null?void 0:te.enabled)&&e.jsxs(ge,{children:[e.jsxs(he,{htmlFor:"first_name",children:["First name ",O.first_name.required&&"*"]}),e.jsx(pe,{type:"text",id:"first_name",name:"first_name",value:f.first_name||"",onChange:z,placeholder:"Enter your first name","aria-invalid":!!p.first_name,disabled:j,autoComplete:"given-name"}),p.first_name&&e.jsx(Lt,{children:p.first_name})]}),k.includes("last_name")&&((U=O==null?void 0:O.last_name)==null?void 0:U.enabled)&&e.jsxs(ge,{children:[e.jsxs(he,{htmlFor:"last_name",children:["Last name ",O.last_name.required&&"*"]}),e.jsx(pe,{type:"text",id:"last_name",name:"last_name",value:f.last_name||"",onChange:z,placeholder:"Enter your last name","aria-invalid":!!p.last_name,disabled:j,autoComplete:"family-name"}),p.last_name&&e.jsx(Lt,{children:p.last_name})]})]}),k.includes("username")&&((K=O==null?void 0:O.username)==null?void 0:K.enabled)&&e.jsxs(ge,{children:[e.jsxs(he,{htmlFor:"username",children:["Username ",O.username.required&&"*"]}),e.jsx(pe,{type:"text",id:"username",name:"username",value:f.username||"",onChange:z,placeholder:"Choose a username","aria-invalid":!!p.username,disabled:j,autoComplete:"username"}),p.username&&e.jsx(Lt,{children:p.username})]}),k.includes("phone_number")&&((ee=O==null?void 0:O.phone_number)==null?void 0:ee.enabled)&&e.jsxs(ge,{children:[e.jsxs(he,{htmlFor:"phone_number",children:["Phone number ",O.phone_number.required&&"*"]}),e.jsx(Gr,{value:f.phone_number||"",onChange:N,error:p.phone_number,countryCode:u,setCountryCode:g}),p.phone_number&&e.jsx(Lt,{children:p.phone_number})]}),k.includes("email_address")&&((J=O==null?void 0:O.email_address)==null?void 0:J.enabled)&&e.jsxs(ge,{children:[e.jsxs(he,{htmlFor:"email",children:["Email address ",O.email_address.required&&"*"]}),e.jsx(pe,{type:"email",id:"email",name:"email",value:f.email||"",onChange:z,placeholder:"Enter your email address","aria-invalid":!!p.email_address,disabled:j,autoComplete:"email"}),p.email_address&&e.jsx(Lt,{children:p.email_address})]}),w&&e.jsx(Lt,{style:{marginBottom:"var(--space-md)"},children:w.message}),e.jsx(lg,{type:"submit",disabled:j,children:j?"Completing...":"Continue"})]}),e.jsxs(js,{children:[r&&e.jsx("div",{children:e.jsx(ao,{onClick:r,style:{cursor:"pointer"},children:"Back to login"})}),e.jsxs("div",{style:{marginTop:"var(--space-sm)"},children:["Having trouble?"," ",e.jsx(ao,{children:e.jsx(ot,{to:(a==null?void 0:a.ui_settings.support_page_url)||"#",children:"Get help"})})]})]})]})})}const ug=or`
|
|
1586
1586
|
from {
|
|
1587
1587
|
transform: rotate(0deg);
|
|
1588
1588
|
}
|
|
@@ -1666,7 +1666,7 @@ cursor: pointer;
|
|
|
1666
1666
|
&:hover {
|
|
1667
1667
|
color: var(--color-primary-hover);
|
|
1668
1668
|
}
|
|
1669
|
-
`;function gg(){return e.jsx(kf,{children:e.jsx(mg,{})})}function mg(){var ie,oe,de,Q,ce,B,V,D,le,H,ae,ke;const{deployment:t}=ve(),{navigate:r}=Ve(),{session:o,loading:n}=Be(),s=((oe=(ie=t==null?void 0:t.auth_settings)==null?void 0:ie.multi_session_support)==null?void 0:oe.enabled)??!1,{setEmail:a,otpSent:h,setOtpSent:f,showForgotPassword:c,setShowForgotPassword:p,showOtherOptions:d,setShowOtherOptions:u,enabledSocialsProviders:g,firstFactor:m,signInStep:v,setSignInStep:y}=ll(),{loading:S,signIn:E,signinAttempt:b,discardSignInAttempt:$,setSignInAttempt:C}=Dr("generic"),{signIn:w}=Dr("oauth"),[j,x]=i.useState({email:"",username:"",password:"",phone:""}),[I,k]=i.useState({}),[R,_]=i.useState(!1),[O,P]=i.useState(""),[z,T]=i.useState("US"),[M,F]=i.useState(!1);i.useEffect(()=>{var ne;if(!n&&(o!=null&&o.active_signin)&&!s&&!M){F(!0);let Y=new URLSearchParams(window.location.search).get("redirect_uri");Y||(Y=((ne=t==null?void 0:t.ui_settings)==null?void 0:ne.after_signin_redirect_url)||null),!Y&&(t!=null&&t.frontend_host)&&(Y=`https://${t.frontend_host}`),Y&&r(Y)}},[o,n,s,t,r,M]);const G=ne=>{let{name:Y,value:Z}=ne.target;Y==="phone"?Z=Z.replace(/[^0-9]/g,""):Y==="email"&&(a(Z),Z=Z.toLowerCase()),x(N=>({...N,[Y]:Z})),k(N=>({...N,[Y]:""}))},L=()=>{x({email:"",username:"",password:"",phone:""}),k({}),T("US"),y("identifier")},A=async ne=>{if(!ne){k({email:"Email address is required"});return}_(!0),k({});try{const Y=await E.identify(ne);if(Y.strategy==="sso"&&Y.connection_id){const N=new URLSearchParams(window.location.search).get("redirect_uri")||void 0,W=await E.initEnterpriseSso(Y.connection_id,N);if(W&&W.sso_url){F(!0),window.location.href=W.sso_url;return}}else if(Y.strategy==="social"&&Y.provider){const Z=g.find(N=>N.provider===Y.provider);if(Z){const W=new URLSearchParams(window.location.search).get("redirect_uri")||void 0,{data:fe}=await w.create({provider:Z.provider,redirectUri:W});if(fe&&typeof fe=="object"&&"oauth_url"in fe){F(!0),window.location.href=fe.oauth_url;return}}else y("password")}else y("password")}catch(Y){k({submit:Y.message})}finally{M||_(!1)}},se=async ne=>{if(ne.preventDefault(),S||R)return;$();const Y={};if(v==="identifier"&&m==="email_password"){if(!j.email){k({email:"Email address is required"});return}await A(j.email);return}if(m==="email_password"?(j.email||(Y.email="Email address is required"),j.password||(Y.password="Password is required")):m==="username_password"?(j.username||(Y.username="Username is required"),j.password||(Y.password="Password is required")):m==="email_otp"||m==="email_magic_link"?j.email||(Y.email="Email address is required"):m==="phone_otp"&&(j.phone?/^\d{7,15}$/.test(j.phone)||(Y.phone="Phone number must contain 7-15 digits"):Y.phone="Phone number is required"),k(Y),Object.keys(Y).length>0)return;let Z="";switch(m){case"email_password":Z="plain_email";break;case"username_password":Z="plain_username";break;case"email_otp":Z="email_otp";break;case"email_magic_link":Z="magic_link";break;case"phone_otp":Z="phone_otp";break}_(!0);try{const N={...j,strategy:Z};m==="phone_otp"&&z&&(N.phone_country_code=z),await E.create(N)}catch(N){k({submit:N.message}),_(!1)}},te=async ne=>{if(ne.preventDefault(),S||R)return;const Y={};if(!O){Y.otp="OTP code is required",k(Y);return}_(!0),k({});try{await E.completeVerification(O),f(!1),P("")}catch(Z){k({otp:Z.message||"Verification failed"})}finally{_(!1)}},U=async ne=>{if(!(S||R)){_(!0);try{const Z=new URLSearchParams(window.location.search).get("redirect_uri")||void 0,{data:N}=await w.create({provider:ne.provider,redirectUri:Z});N&&typeof N=="object"&&"oauth_url"in N&&(window.location.href=N.oauth_url)}catch(Y){k({submit:Y.message})}finally{_(!1)}}},K=i.useRef(!1);if(i.useEffect(()=>{if(n)return;const ne=new URLSearchParams(window.location.search),Y=ne.get("impersonation_token");if(Y&&!b&&!S&&!K.current){K.current=!0,ne.delete("impersonation_token");const N=ne.toString()?`${window.location.pathname}?${ne.toString()} `:window.location.pathname;window.history.replaceState({},"",N),(async()=>{try{_(!0),await E.create({strategy:"impersonation",token:Y})}catch(fe){k({submit:fe.message}),_(!1),K.current=!1}})();return}const Z=ne.get("signin_attempt_id");if(Z&&(o!=null&&o.signin_attempts)&&!b){const N=o.signin_attempts.find(W=>W.id===Z);if(N){C(N),ne.delete("signin_attempt_id");const W=ne.toString()?`${window.location.pathname}?${ne.toString()} `:window.location.pathname;window.history.replaceState({},"",W)}}},[o,n,b,C,S]),i.useEffect(()=>{var N;if(!b)return;if(b.completed){F(!0);let W=new URLSearchParams(window.location.search).get("redirect_uri");if(W||(W=((N=t==null?void 0:t.ui_settings)==null?void 0:N.after_signin_redirect_url)||null),!W&&(t!=null&&t.frontend_host)&&(W=`https://${t.frontend_host}`),W){const fe=new URL(W);(t==null?void 0:t.mode)==="staging"&&fe.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),r(fe.toString())}return}if(!E||h)return;const Y={verify_email:"email_otp",verify_email_otp:"email_otp",verify_email_link:"magic_link",verify_phone:"phone_otp",verify_phone_otp:"phone_otp"}[b.current_step];if(!Y)return;(async()=>{try{await E.prepareVerification({strategy:Y}),f(!0)}catch(W){console.error("Failed to prepare verification:",W),k({submit:"Failed to send verification. Please try again."})}finally{_(!1)}})()},[b,E,h,f,r,t]),i.useEffect(()=>{},[]),d)return e.jsx(Of,{onBack:()=>u(!1)});if(c)return e.jsx(zf,{onBack:()=>p(!1)});if((b==null?void 0:b.current_step)==="verify_second_factor")return e.jsx(hl,{attempt:b,completeVerification:E.completeVerification,prepareVerification:E.prepareVerification,onBack:()=>{$(),L(),f(!1)}});if((b==null?void 0:b.current_step)==="complete_profile")return e.jsx(fl,{attempt:b,completeProfile:E.completeProfile,completeVerification:E.completeVerification,prepareVerification:E.prepareVerification,onBack:()=>{$(),L(),f(!1)}});if(n)return e.jsx(ue,{children:e.jsxs(Pn,{children:[e.jsx(Re,{}),e.jsx(ks,{children:e.jsx(vt,{size:32})})]})});if(M)return e.jsx(ue,{children:e.jsxs(Pn,{children:[e.jsx(Re,{}),e.jsx(ks,{children:e.jsx(vt,{size:32})})]})});const J=(b==null?void 0:b.current_step)&&["verify_email","verify_email_otp","verify_email_link","verify_phone","verify_phone_otp"].includes(b.current_step)&&h;return e.jsx(ue,{children:e.jsxs(Pn,{children:[e.jsx(Re,{}),J?e.jsx(e.Fragment,{children:e.jsxs(_s,{children:[e.jsx(Cs,{children:m==="phone_otp"?"Check your phone":"Check your email"}),e.jsx(Ss,{children:m==="email_magic_link"?`If ${j.email} exists in our records, you will receive a magic link. Click the link to sign in.`:m==="phone_otp"?`If ${j.phone} exists in our records, you will receive a verification code via SMS. Enter it below to continue.`:`If ${j.email} exists in our records, you will receive a verification code. Enter it below to continue.`})]})}):e.jsxs(_s,{children:[e.jsx(Cs,{children:"Sign in to your account"}),e.jsxs(Ss,{children:["Please enter your details to continue to"," ",(t==null?void 0:t.ui_settings.app_name)||"App","!"]})]}),J?m==="email_magic_link"?e.jsxs(Rn,{children:["Having trouble?"," ",e.jsx(At,{children:e.jsx(ot,{to:t.ui_settings.support_page_url,children:"Get help"})}),e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(At,{onClick:()=>{f(!1),$(),L()},style:{cursor:"pointer"},children:"Back to login"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(lt,{style:{gap:"15px"},onSubmit:te,noValidate:!0,children:[e.jsx(It,{onComplete:async ne=>{if(P(ne),ne&&ne.length===6){_(!0),k({});try{await E.completeVerification(ne),f(!1)}catch(Y){k({otp:Y.message||"Verification failed"})}finally{_(!1)}}},onResend:async()=>{const ne=m==="email_otp"?"email_otp":"phone_otp";await E.prepareVerification({strategy:ne})},error:I.otp,isSubmitting:R}),e.jsx($s,{type:"submit",disabled:R||S||!O,style:{margin:0},children:R?"Verifying...":`Continue to ${(ke=t==null?void 0:t.ui_settings)==null?void 0:ke.app_name}`})]}),e.jsxs(Rn,{children:["Having trouble?"," ",e.jsx(At,{children:e.jsx(ot,{to:t.ui_settings.support_page_url,children:"Get help"})}),e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(At,{onClick:()=>{f(!1),$(),L()},style:{cursor:"pointer"},children:"Back to login"})})]})]}):e.jsxs(e.Fragment,{children:[g.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(_a,{connections:g,callback:U}),e.jsx(pg,{children:e.jsx(hg,{children:"or"})})]}),e.jsxs(lt,{onSubmit:se,noValidate:!0,children:[(m==="email_password"||m==="email_otp"||m==="email_magic_link")&&((Q=(de=t==null?void 0:t.auth_settings)==null?void 0:de.email_address)==null?void 0:Q.enabled)&&e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"email",children:"Email address"}),e.jsx(pe,{type:"email",id:"email",name:"email",value:j.email,onChange:G,placeholder:"Enter your email address","aria-invalid":!!I.email}),I.email&&e.jsx(Ir,{children:I.email})]}),m==="username_password"&&((B=(ce=t==null?void 0:t.auth_settings)==null?void 0:ce.username)==null?void 0:B.enabled)&&e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"username",children:"Username"}),e.jsx(pe,{type:"text",id:"username",name:"username",value:j.username,onChange:G,placeholder:"Enter your username","aria-invalid":!!I.username}),I.username&&e.jsx(Ir,{children:I.username})]}),m==="phone_otp"&&((D=(V=t==null?void 0:t.auth_settings)==null?void 0:V.phone_number)==null?void 0:D.enabled)&&e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"phone",children:"Phone number"}),e.jsx(Gr,{value:j.phone,onChange:G,error:I.phone,countryCode:z,setCountryCode:T}),I.phone&&e.jsx(Ir,{children:I.phone})]}),v==="password"&&(m==="email_password"||m==="username_password")&&((H=(le=t==null?void 0:t.auth_settings)==null?void 0:le.password)==null?void 0:H.enabled)&&e.jsxs(ge,{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[e.jsx(he,{htmlFor:"password",children:"Password"}),e.jsx(At,{style:{fontSize:"12px"},onClick:()=>p(!0),children:"Forgot password?"})]}),e.jsx(fg,{children:e.jsx(pe,{type:"password",id:"password",name:"password",value:j.password,onChange:G,placeholder:"Enter your password","aria-invalid":!!I.password})}),I.password&&e.jsx(Ir,{children:I.password})]}),e.jsxs("div",{children:[I.submit&&e.jsx(Ir,{children:I.submit}),e.jsx($s,{type:"submit",disabled:R||S,children:R?e.jsxs(e.Fragment,{children:[e.jsx(vt,{size:16,style:{animation:"spin 1s linear infinite",marginRight:"8px"}}),v==="identifier"?"Checking...":"Signing in..."]}):v==="identifier"?"Continue":"Sign in"})]}),e.jsx(At,{style:{fontSize:"12px",textAlign:"center"},onClick:()=>u(!0),children:"Use other methods"})]}),e.jsxs(Rn,{children:["Don't have an account?"," ",e.jsx(At,{children:e.jsx(ot,{to:`${(ae=t.ui_settings)==null?void 0:ae.sign_up_page_url}${window.location.search}`,children:"Sign up"})})]})]})]})})}const zs=l.div`
|
|
1669
|
+
`;function gg(){return e.jsx(kf,{children:e.jsx(mg,{})})}function mg(){var ie,oe,de,Q,ce,B,V,D,le,q,ae,ke;const{deployment:t}=ve(),{navigate:r}=Ve(),{session:o,loading:n}=Be(),s=((oe=(ie=t==null?void 0:t.auth_settings)==null?void 0:ie.multi_session_support)==null?void 0:oe.enabled)??!1,{setEmail:a,otpSent:h,setOtpSent:f,showForgotPassword:c,setShowForgotPassword:p,showOtherOptions:d,setShowOtherOptions:u,enabledSocialsProviders:g,firstFactor:m,signInStep:v,setSignInStep:y}=ll(),{loading:S,signIn:E,signinAttempt:b,discardSignInAttempt:$,setSignInAttempt:C}=Dr("generic"),{signIn:w}=Dr("oauth"),[j,x]=i.useState({email:"",username:"",password:"",phone:""}),[I,k]=i.useState({}),[R,_]=i.useState(!1),[O,P]=i.useState(""),[z,T]=i.useState("US"),[M,N]=i.useState(!1);i.useEffect(()=>{var ne;if(!n&&(o!=null&&o.active_signin)&&!s&&!M){N(!0);let Y=new URLSearchParams(window.location.search).get("redirect_uri");Y||(Y=((ne=t==null?void 0:t.ui_settings)==null?void 0:ne.after_signin_redirect_url)||null),!Y&&(t!=null&&t.frontend_host)&&(Y=`https://${t.frontend_host}`),Y&&r(Y)}},[o,n,s,t,r,M]);const H=ne=>{let{name:Y,value:Z}=ne.target;Y==="phone"?Z=Z.replace(/[^0-9]/g,""):Y==="email"&&(a(Z),Z=Z.toLowerCase()),x(F=>({...F,[Y]:Z})),k(F=>({...F,[Y]:""}))},L=()=>{x({email:"",username:"",password:"",phone:""}),k({}),T("US"),y("identifier")},A=async ne=>{if(!ne){k({email:"Email address is required"});return}_(!0),k({});try{const Y=await E.identify(ne);if(Y.strategy==="sso"&&Y.connection_id){const F=new URLSearchParams(window.location.search).get("redirect_uri")||void 0,W=await E.initEnterpriseSso(Y.connection_id,F);if(W&&W.sso_url){N(!0),window.location.href=W.sso_url;return}}else if(Y.strategy==="social"&&Y.provider){const Z=g.find(F=>F.provider===Y.provider);if(Z){const W=new URLSearchParams(window.location.search).get("redirect_uri")||void 0,{data:fe}=await w.create({provider:Z.provider,redirectUri:W});if(fe&&typeof fe=="object"&&"oauth_url"in fe){N(!0),window.location.href=fe.oauth_url;return}}else y("password")}else y("password")}catch(Y){k({submit:Y.message})}finally{M||_(!1)}},se=async ne=>{if(ne.preventDefault(),S||R)return;$();const Y={};if(v==="identifier"&&m==="email_password"){if(!j.email){k({email:"Email address is required"});return}await A(j.email);return}if(m==="email_password"?(j.email||(Y.email="Email address is required"),j.password||(Y.password="Password is required")):m==="username_password"?(j.username||(Y.username="Username is required"),j.password||(Y.password="Password is required")):m==="email_otp"||m==="email_magic_link"?j.email||(Y.email="Email address is required"):m==="phone_otp"&&(j.phone?/^\d{7,15}$/.test(j.phone)||(Y.phone="Phone number must contain 7-15 digits"):Y.phone="Phone number is required"),k(Y),Object.keys(Y).length>0)return;let Z="";switch(m){case"email_password":Z="plain_email";break;case"username_password":Z="plain_username";break;case"email_otp":Z="email_otp";break;case"email_magic_link":Z="magic_link";break;case"phone_otp":Z="phone_otp";break}_(!0);try{const F={...j,strategy:Z};m==="phone_otp"&&z&&(F.phone_country_code=z),await E.create(F)}catch(F){k({submit:F.message}),_(!1)}},te=async ne=>{if(ne.preventDefault(),S||R)return;const Y={};if(!O){Y.otp="OTP code is required",k(Y);return}_(!0),k({});try{await E.completeVerification(O),f(!1),P("")}catch(Z){k({otp:Z.message||"Verification failed"})}finally{_(!1)}},U=async ne=>{if(!(S||R)){_(!0);try{const Z=new URLSearchParams(window.location.search).get("redirect_uri")||void 0,{data:F}=await w.create({provider:ne.provider,redirectUri:Z});F&&typeof F=="object"&&"oauth_url"in F&&(window.location.href=F.oauth_url)}catch(Y){k({submit:Y.message})}finally{_(!1)}}},K=i.useRef(!1);if(i.useEffect(()=>{if(n)return;const ne=new URLSearchParams(window.location.search),Y=ne.get("impersonation_token");if(Y&&!b&&!S&&!K.current){K.current=!0,ne.delete("impersonation_token");const F=ne.toString()?`${window.location.pathname}?${ne.toString()} `:window.location.pathname;window.history.replaceState({},"",F),(async()=>{try{_(!0),await E.create({strategy:"impersonation",token:Y})}catch(fe){k({submit:fe.message}),_(!1),K.current=!1}})();return}const Z=ne.get("signin_attempt_id");if(Z&&(o!=null&&o.signin_attempts)&&!b){const F=o.signin_attempts.find(W=>W.id===Z);if(F){C(F),ne.delete("signin_attempt_id");const W=ne.toString()?`${window.location.pathname}?${ne.toString()} `:window.location.pathname;window.history.replaceState({},"",W)}}},[o,n,b,C,S]),i.useEffect(()=>{var F;if(!b)return;if(b.completed){N(!0);let W=new URLSearchParams(window.location.search).get("redirect_uri");if(W||(W=((F=t==null?void 0:t.ui_settings)==null?void 0:F.after_signin_redirect_url)||null),!W&&(t!=null&&t.frontend_host)&&(W=`https://${t.frontend_host}`),W){const fe=new URL(W);(t==null?void 0:t.mode)==="staging"&&fe.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),r(fe.toString())}return}if(!E||h)return;const Y={verify_email:"email_otp",verify_email_otp:"email_otp",verify_email_link:"magic_link",verify_phone:"phone_otp",verify_phone_otp:"phone_otp"}[b.current_step];if(!Y)return;(async()=>{try{await E.prepareVerification({strategy:Y}),f(!0)}catch(W){console.error("Failed to prepare verification:",W),k({submit:"Failed to send verification. Please try again."})}finally{_(!1)}})()},[b,E,h,f,r,t]),i.useEffect(()=>{},[]),d)return e.jsx(Of,{onBack:()=>u(!1)});if(c)return e.jsx(zf,{onBack:()=>p(!1)});if((b==null?void 0:b.current_step)==="verify_second_factor")return e.jsx(hl,{attempt:b,completeVerification:E.completeVerification,prepareVerification:E.prepareVerification,onBack:()=>{$(),L(),f(!1)}});if((b==null?void 0:b.current_step)==="complete_profile")return e.jsx(fl,{attempt:b,completeProfile:E.completeProfile,completeVerification:E.completeVerification,prepareVerification:E.prepareVerification,onBack:()=>{$(),L(),f(!1)}});if(n)return e.jsx(ue,{children:e.jsxs(Pn,{children:[e.jsx(Re,{}),e.jsx(ks,{children:e.jsx(vt,{size:32})})]})});if(M)return e.jsx(ue,{children:e.jsxs(Pn,{children:[e.jsx(Re,{}),e.jsx(ks,{children:e.jsx(vt,{size:32})})]})});const J=(b==null?void 0:b.current_step)&&["verify_email","verify_email_otp","verify_email_link","verify_phone","verify_phone_otp"].includes(b.current_step)&&h;return e.jsx(ue,{children:e.jsxs(Pn,{children:[e.jsx(Re,{}),J?e.jsx(e.Fragment,{children:e.jsxs(_s,{children:[e.jsx(Cs,{children:m==="phone_otp"?"Check your phone":"Check your email"}),e.jsx(Ss,{children:m==="email_magic_link"?`If ${j.email} exists in our records, you will receive a magic link. Click the link to sign in.`:m==="phone_otp"?`If ${j.phone} exists in our records, you will receive a verification code via SMS. Enter it below to continue.`:`If ${j.email} exists in our records, you will receive a verification code. Enter it below to continue.`})]})}):e.jsxs(_s,{children:[e.jsx(Cs,{children:"Sign in to your account"}),e.jsxs(Ss,{children:["Please enter your details to continue to"," ",(t==null?void 0:t.ui_settings.app_name)||"App","!"]})]}),J?m==="email_magic_link"?e.jsxs(Rn,{children:["Having trouble?"," ",e.jsx(At,{children:e.jsx(ot,{to:t.ui_settings.support_page_url,children:"Get help"})}),e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(At,{onClick:()=>{f(!1),$(),L()},style:{cursor:"pointer"},children:"Back to login"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(lt,{style:{gap:"15px"},onSubmit:te,noValidate:!0,children:[e.jsx(It,{onComplete:async ne=>{if(P(ne),ne&&ne.length===6){_(!0),k({});try{await E.completeVerification(ne),f(!1)}catch(Y){k({otp:Y.message||"Verification failed"})}finally{_(!1)}}},onResend:async()=>{const ne=m==="email_otp"?"email_otp":"phone_otp";await E.prepareVerification({strategy:ne})},error:I.otp,isSubmitting:R}),e.jsx($s,{type:"submit",disabled:R||S||!O,style:{margin:0},children:R?"Verifying...":`Continue to ${(ke=t==null?void 0:t.ui_settings)==null?void 0:ke.app_name}`})]}),e.jsxs(Rn,{children:["Having trouble?"," ",e.jsx(At,{children:e.jsx(ot,{to:t.ui_settings.support_page_url,children:"Get help"})}),e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(At,{onClick:()=>{f(!1),$(),L()},style:{cursor:"pointer"},children:"Back to login"})})]})]}):e.jsxs(e.Fragment,{children:[g.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(_a,{connections:g,callback:U}),e.jsx(pg,{children:e.jsx(hg,{children:"or"})})]}),e.jsxs(lt,{onSubmit:se,noValidate:!0,children:[(m==="email_password"||m==="email_otp"||m==="email_magic_link")&&((Q=(de=t==null?void 0:t.auth_settings)==null?void 0:de.email_address)==null?void 0:Q.enabled)&&e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"email",children:"Email address"}),e.jsx(pe,{type:"email",id:"email",name:"email",value:j.email,onChange:H,placeholder:"Enter your email address","aria-invalid":!!I.email}),I.email&&e.jsx(Ir,{children:I.email})]}),m==="username_password"&&((B=(ce=t==null?void 0:t.auth_settings)==null?void 0:ce.username)==null?void 0:B.enabled)&&e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"username",children:"Username"}),e.jsx(pe,{type:"text",id:"username",name:"username",value:j.username,onChange:H,placeholder:"Enter your username","aria-invalid":!!I.username}),I.username&&e.jsx(Ir,{children:I.username})]}),m==="phone_otp"&&((D=(V=t==null?void 0:t.auth_settings)==null?void 0:V.phone_number)==null?void 0:D.enabled)&&e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"phone",children:"Phone number"}),e.jsx(Gr,{value:j.phone,onChange:H,error:I.phone,countryCode:z,setCountryCode:T}),I.phone&&e.jsx(Ir,{children:I.phone})]}),v==="password"&&(m==="email_password"||m==="username_password")&&((q=(le=t==null?void 0:t.auth_settings)==null?void 0:le.password)==null?void 0:q.enabled)&&e.jsxs(ge,{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[e.jsx(he,{htmlFor:"password",children:"Password"}),e.jsx(At,{style:{fontSize:"12px"},onClick:()=>p(!0),children:"Forgot password?"})]}),e.jsx(fg,{children:e.jsx(pe,{type:"password",id:"password",name:"password",value:j.password,onChange:H,placeholder:"Enter your password","aria-invalid":!!I.password})}),I.password&&e.jsx(Ir,{children:I.password})]}),e.jsxs("div",{children:[I.submit&&e.jsx(Ir,{children:I.submit}),e.jsx($s,{type:"submit",disabled:R||S,children:R?e.jsxs(e.Fragment,{children:[e.jsx(vt,{size:16,style:{animation:"spin 1s linear infinite",marginRight:"8px"}}),v==="identifier"?"Checking...":"Signing in..."]}):v==="identifier"?"Continue":"Sign in"})]}),e.jsx(At,{style:{fontSize:"12px",textAlign:"center"},onClick:()=>u(!0),children:"Use other methods"})]}),e.jsxs(Rn,{children:["Don't have an account?"," ",e.jsx(At,{children:e.jsx(ot,{to:`${(ae=t.ui_settings)==null?void 0:ae.sign_up_page_url}${window.location.search}`,children:"Sign up"})})]})]})]})})}const zs=l.div`
|
|
1670
1670
|
max-width: 380px;
|
|
1671
1671
|
width: 380px;
|
|
1672
1672
|
padding: var(--space-3xl);
|
|
@@ -1870,11 +1870,11 @@ cursor: pointer;
|
|
|
1870
1870
|
color: var(--color-foreground);
|
|
1871
1871
|
margin-bottom: var(--space-xs);
|
|
1872
1872
|
margin-top: 0;
|
|
1873
|
-
`,
|
|
1873
|
+
`,Ng=l.p`
|
|
1874
1874
|
color: var(--color-secondary-text);
|
|
1875
1875
|
font-size: var(--font-xs);
|
|
1876
1876
|
margin: 0;
|
|
1877
|
-
`,
|
|
1877
|
+
`,Fg=l.div`
|
|
1878
1878
|
padding-top: var(--space-xl);
|
|
1879
1879
|
text-align: center;
|
|
1880
1880
|
`,Bg=l.div`
|
|
@@ -1919,18 +1919,18 @@ cursor: pointer;
|
|
|
1919
1919
|
`,Mn=l.p`
|
|
1920
1920
|
font-size: var(--font-xs);
|
|
1921
1921
|
color: var(--color-secondary-text);
|
|
1922
|
-
`;function Vg({onSuccess:t,onError:r}={}){const[o,n]=i.useState("loading"),[s,a]=i.useState(""),{token:h,attempt:f,redirectUri:c}=lc(),{verifyMagicLink:p}=cc(),{navigate:d}=Ve(),{deployment:u}=ve(),g=i.useRef(!1);i.useEffect(()=>{(async()=>{if(!g.current){if(!h||!f){n("error"),a("The magic link appears to be malformed. Please try signing in again."),r==null||r("Invalid magic link parameters");return}g.current=!0,n("loading"),a("Please wait while we verify your magic link.");try{await p({token:h,attempt:f,redirectUri:c}),n("success"),a("You will be redirected to your account shortly."),t==null||t(),setTimeout(()=>{var S;let y=c;if(y||(y=(S=u==null?void 0:u.ui_settings)==null?void 0:S.after_signin_redirect_url),!y&&(u!=null&&u.frontend_host)&&(y=`https://${u.frontend_host}`),y){const E=new URL(y);(u==null?void 0:u.mode)==="staging"&&E.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),d(E.toString())}},2e3)}catch(y){n("error"),a("The magic link may have expired or already been used. Please try signing in again."),r==null||r(y.message)}}})()},[h,f]);const m=()=>{var v;(v=u==null?void 0:u.ui_settings)!=null&&v.sign_in_page_url&&d(u.ui_settings.sign_in_page_url)};return e.jsx(ue,{children:e.jsxs(Lg,{children:[e.jsxs(Ag,{children:[e.jsx(Dg,{children:"Magic Link Verification"}),e.jsx(
|
|
1922
|
+
`;function Vg({onSuccess:t,onError:r}={}){const[o,n]=i.useState("loading"),[s,a]=i.useState(""),{token:h,attempt:f,redirectUri:c}=lc(),{verifyMagicLink:p}=cc(),{navigate:d}=Ve(),{deployment:u}=ve(),g=i.useRef(!1);i.useEffect(()=>{(async()=>{if(!g.current){if(!h||!f){n("error"),a("The magic link appears to be malformed. Please try signing in again."),r==null||r("Invalid magic link parameters");return}g.current=!0,n("loading"),a("Please wait while we verify your magic link.");try{await p({token:h,attempt:f,redirectUri:c}),n("success"),a("You will be redirected to your account shortly."),t==null||t(),setTimeout(()=>{var S;let y=c;if(y||(y=(S=u==null?void 0:u.ui_settings)==null?void 0:S.after_signin_redirect_url),!y&&(u!=null&&u.frontend_host)&&(y=`https://${u.frontend_host}`),y){const E=new URL(y);(u==null?void 0:u.mode)==="staging"&&E.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),d(E.toString())}},2e3)}catch(y){n("error"),a("The magic link may have expired or already been used. Please try signing in again."),r==null||r(y.message)}}})()},[h,f]);const m=()=>{var v;(v=u==null?void 0:u.ui_settings)!=null&&v.sign_in_page_url&&d(u.ui_settings.sign_in_page_url)};return e.jsx(ue,{children:e.jsxs(Lg,{children:[e.jsxs(Ag,{children:[e.jsx(Dg,{children:"Magic Link Verification"}),e.jsx(Ng,{children:"Verifying your magic link"})]}),e.jsxs(Fg,{children:[o==="loading"&&e.jsxs(e.Fragment,{children:[e.jsx(Wg,{}),e.jsx(Mn,{children:s})]}),o==="success"&&e.jsxs(e.Fragment,{children:[e.jsx(Bg,{children:"✓"}),e.jsx(Mn,{children:s})]}),o==="error"&&e.jsxs(e.Fragment,{children:[e.jsx(Ug,{children:"✗"}),e.jsx(Mn,{children:s}),e.jsx(X,{onClick:m,style:{marginTop:"var(--space-xl)"},children:"Try Again"})]})]})]})})}function Gg(t){var n,s;return t?((n=t.signin_attempts)==null?void 0:n.find(a=>a.requires_completion&&!a.completed))?!0:!!((s=t.signup_attempts)==null?void 0:s.find(a=>{var h,f;return((h=a.missing_fields)==null?void 0:h.length)>0||((f=a.remaining_steps)==null?void 0:f.length)>0&&!a.completed})):!1}function Hg(t){const r=t?`/profile-completion?redirect_uri=${encodeURIComponent(t)}`:"/profile-completion";window.location.href=r}const Dt=l.div`
|
|
1923
1923
|
max-width: 380px;
|
|
1924
1924
|
width: 380px;
|
|
1925
1925
|
padding: var(--space-3xl);
|
|
1926
1926
|
background: var(--color-background);
|
|
1927
1927
|
border-radius: var(--radius-lg);
|
|
1928
1928
|
box-shadow: 0 4px 12px var(--color-shadow);
|
|
1929
|
-
`,
|
|
1929
|
+
`,Nt=l.div`
|
|
1930
1930
|
text-align: center;
|
|
1931
1931
|
margin-bottom: var(--space-lg);
|
|
1932
1932
|
position: relative;
|
|
1933
|
-
`,
|
|
1933
|
+
`,Ft=l.h1`
|
|
1934
1934
|
font-size: var(--font-lg);
|
|
1935
1935
|
font-weight: 400;
|
|
1936
1936
|
color: var(--color-foreground);
|
|
@@ -2019,7 +2019,7 @@ cursor: pointer;
|
|
|
2019
2019
|
&:hover {
|
|
2020
2020
|
color: var(--color-primary-hover);
|
|
2021
2021
|
}
|
|
2022
|
-
`;function Kg({token:t,onSuccess:r,onError:o}){var y;const{acceptInvitation:n,invitationData:s,loading:a,error:h}=fc(),{navigate:f}=Ve(),{deployment:c}=ve(),p=i.useRef(!1),d=()=>{var E;const S=new URLSearchParams(window.location.search);return{token:t||S.get("invite_token")||S.get("token"),redirectUri:S.get("redirect_uri")||((E=c==null?void 0:c.ui_settings)==null?void 0:E.after_signin_redirect_url)||"/"}};i.useEffect(()=>{if(p.current)return;const{token:S}=d();S&&(p.current=!0,n(S))},[n]),i.useEffect(()=>{var S;s&&(s.organization&&!s.requires_signin&&r&&r(s.organization.id,(S=s.workspace)==null?void 0:S.id),s.error_code&&o&&o(s.message||"Failed to accept invitation"))},[s,r,o]);const u=()=>{const{redirectUri:S}=d();f(S)},g=()=>{var j,x;const{token:S,redirectUri:E}=d(),b=((j=c==null?void 0:c.ui_settings)==null?void 0:j.sign_in_page_url)||"/sign-in",$=((x=c==null?void 0:c.ui_settings)==null?void 0:x.sign_up_page_url)||"/sign-up",C=new URLSearchParams;S&&C.set("invite_token",S),s!=null&&s.invited_email&&C.set("invited_email",s.invited_email),C.set("redirect_uri",E),s!=null&&s.message&&C.set("message",s.message);const w=(s==null?void 0:s.error_code)==="INVITATION_REQUIRES_SIGNUP";f(`${w?$:b}?${C.toString()}`)},m=()=>{const{token:S}=d();S&&(p.current=!1,n(S))},{token:v}=d();if(!v&&!a)return e.jsx(ue,{children:e.jsxs(Dt,{children:[e.jsxs(
|
|
2022
|
+
`;function Kg({token:t,onSuccess:r,onError:o}){var y;const{acceptInvitation:n,invitationData:s,loading:a,error:h}=fc(),{navigate:f}=Ve(),{deployment:c}=ve(),p=i.useRef(!1),d=()=>{var E;const S=new URLSearchParams(window.location.search);return{token:t||S.get("invite_token")||S.get("token"),redirectUri:S.get("redirect_uri")||((E=c==null?void 0:c.ui_settings)==null?void 0:E.after_signin_redirect_url)||"/"}};i.useEffect(()=>{if(p.current)return;const{token:S}=d();S&&(p.current=!0,n(S))},[n]),i.useEffect(()=>{var S;s&&(s.organization&&!s.requires_signin&&r&&r(s.organization.id,(S=s.workspace)==null?void 0:S.id),s.error_code&&o&&o(s.message||"Failed to accept invitation"))},[s,r,o]);const u=()=>{const{redirectUri:S}=d();f(S)},g=()=>{var j,x;const{token:S,redirectUri:E}=d(),b=((j=c==null?void 0:c.ui_settings)==null?void 0:j.sign_in_page_url)||"/sign-in",$=((x=c==null?void 0:c.ui_settings)==null?void 0:x.sign_up_page_url)||"/sign-up",C=new URLSearchParams;S&&C.set("invite_token",S),s!=null&&s.invited_email&&C.set("invited_email",s.invited_email),C.set("redirect_uri",E),s!=null&&s.message&&C.set("message",s.message);const w=(s==null?void 0:s.error_code)==="INVITATION_REQUIRES_SIGNUP";f(`${w?$:b}?${C.toString()}`)},m=()=>{const{token:S}=d();S&&(p.current=!1,n(S))},{token:v}=d();if(!v&&!a)return e.jsx(ue,{children:e.jsxs(Dt,{children:[e.jsxs(Nt,{children:[e.jsx(Ft,{children:"Invalid Invitation"}),e.jsx(Bt,{children:"No invitation token found"})]}),e.jsxs(Ut,{children:[e.jsx(Ln,{children:"✗"}),e.jsx(Wt,{children:"Missing Invitation Token"}),e.jsx(Vt,{children:"The invitation link appears to be invalid or incomplete."}),e.jsx(X,{onClick:()=>f("/"),style:{marginTop:"var(--space-lg)"},children:"Go to Home"})]})]})});if(a)return e.jsx(ue,{children:e.jsxs(Dt,{children:[e.jsxs(Nt,{children:[e.jsx(Ft,{children:"Processing Invitation"}),e.jsx(Bt,{children:"Please wait while we verify your invitation"})]}),e.jsxs(Ut,{children:[e.jsx(Yg,{}),e.jsx(Wt,{children:"Verifying invitation..."}),e.jsx(Vt,{children:"This will only take a moment."})]})]})});if(s!=null&&s.organization&&!s.requires_signin)return e.jsx(ue,{children:e.jsxs(Dt,{children:[e.jsxs(Nt,{children:[e.jsx(Ft,{children:"Invitation Accepted!"}),e.jsx(Bt,{children:"You've successfully joined the organization"})]}),e.jsxs(Ut,{children:[e.jsx(qg,{children:"✓"}),e.jsxs(Wt,{children:["Welcome to ",s.organization.name,"!"]}),s.workspace&&e.jsxs(Vt,{children:["You've been added to the ",s.workspace.name," workspace."]}),e.jsx(X,{onClick:u,style:{marginTop:"var(--space-lg)"},children:"Continue to Application"})]})]})});if(s!=null&&s.already_member)return e.jsx(ue,{children:e.jsxs(Dt,{children:[e.jsxs(Nt,{children:[e.jsx(Ft,{children:"Already a Member"}),e.jsx(Bt,{children:"You're already part of this organization"})]}),e.jsxs(Ut,{children:[e.jsx(Ps,{children:"ℹ"}),e.jsxs(Wt,{children:["You're already a member of ",((y=s.organization)==null?void 0:y.name)||"this organization"]}),e.jsx(Vt,{children:"No action needed - you already have access."}),e.jsx(X,{onClick:u,style:{marginTop:"var(--space-lg)"},children:"Continue to Application"})]})]})});if(s!=null&&s.requires_signin){const S=s.error_code==="INVITATION_REQUIRES_SIGNUP";return e.jsx(ue,{children:e.jsxs(Dt,{children:[e.jsxs(Nt,{children:[e.jsx(Ft,{children:S?"Sign Up Required":"Sign In Required"}),e.jsx(Bt,{children:"To accept this invitation"})]}),e.jsxs(Ut,{children:[e.jsx(Ps,{children:"ℹ"}),e.jsxs(Wt,{children:["This invitation is for ",e.jsx(Rs,{children:s.invited_email})]}),e.jsx(Vt,{children:S?"You need to create an account with this email address to accept the invitation.":s.error_code==="INVITATION_EMAIL_MISMATCH"?"You're currently signed in with a different account. Please sign in with the invited email.":"Please sign in to accept this invitation."}),e.jsx(X,{onClick:g,style:{marginTop:"var(--space-lg)"},children:S?"Sign Up to Accept":"Sign In to Accept"})]})]})})}return(s==null?void 0:s.error_code)==="INVITATION_EXPIRED"?e.jsx(ue,{children:e.jsxs(Dt,{children:[e.jsxs(Nt,{children:[e.jsx(Ft,{children:"Invitation Expired"}),e.jsx(Bt,{children:"This invitation is no longer valid"})]}),e.jsxs(Ut,{children:[e.jsx(Ln,{children:"⏱"}),e.jsxs(Wt,{children:["Invitation for ",e.jsx(Rs,{children:s.invited_email})," has expired"]}),e.jsx(Vt,{children:"Invitations are valid for 10 days. Please request a new invitation from your organization administrator."})]})]})}):h||s!=null&&s.error_code?e.jsx(ue,{children:e.jsxs(Dt,{children:[e.jsxs(Nt,{children:[e.jsx(Ft,{children:"Invitation Error"}),e.jsx(Bt,{children:"Unable to process invitation"})]}),e.jsxs(Ut,{children:[e.jsx(Ln,{children:"✗"}),e.jsx(Wt,{children:"Something went wrong"}),e.jsx(Vt,{children:(s==null?void 0:s.message)||h||"Failed to accept invitation"}),e.jsx(X,{onClick:m,style:{marginTop:"var(--space-lg)"},children:"Try Again"}),e.jsx(Zg,{children:e.jsxs("div",{style:{marginTop:"var(--space-md)"},children:["Having trouble?"," ",e.jsx(Qg,{onClick:g,children:"Sign in manually"})]})})]})]})}):null}const gl=i.createContext({screen:null,setScreen:()=>{},toast:(t,r)=>{}}),Je=()=>{const t=i.useContext(gl);if(!t)throw new Error("useScreenContext must be used within a ScreenContextProvider");return t},Xg=l.div`
|
|
2023
2023
|
display: flex;
|
|
2024
2024
|
height: 100%;
|
|
2025
2025
|
min-height: 400px;
|
|
@@ -2257,7 +2257,7 @@ cursor: pointer;
|
|
|
2257
2257
|
color: var(--color-foreground);
|
|
2258
2258
|
background: var(--color-input-background);
|
|
2259
2259
|
}
|
|
2260
|
-
`,
|
|
2260
|
+
`,Ns=({onClose:t,domain:r,triggerRef:o})=>{const n=i.useRef(null),[s,a]=i.useState(),[h,f]=i.useState(""),[c,p]=i.useState(!1),[d,u]=i.useState(!1),[g,m]=i.useState({top:0,left:0}),{addDomain:v,verifyDomain:y}=qe(),{toast:S}=Je(),E=w=>/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\.[a-zA-Z]{2,}$/.test(w),b=w=>w.trim().toLowerCase().replace(/^https?:\/\//,""),$=async()=>{const w=b(h);if(!w){S("Please enter a domain name","error");return}if(!E(w)){S("Please enter a valid domain name (e.g., example.com)","error");return}if(w.length>253){S("Domain name is too long","error");return}try{const j=await v({fqdn:w});S("Domain added successfully","info"),a(j.data)}catch(j){const x=j.message||"Failed to add domain. Please try again.";S(x,"error")}},C=async()=>{if(!(!s||c)){p(!0);try{await y(s),t==null||t(),S("Domain verified successfully","info")}catch(w){const j=w.message||"Failed to verify domain. Please check DNS records and try again.";S(j,"error")}finally{p(!1)}}};return i.useEffect(()=>{u(!0);const w=setTimeout(()=>{if(!n.current)return;const I=o==null?void 0:o.current,k=360,R=250,_=8;let O=0,P=0;if(!I){const N=n.current.getBoundingClientRect(),H=N.width||k,L=N.height||R;O=Math.max(_,(window.innerHeight-L)/2),P=Math.max(_,(window.innerWidth-H)/2),m({top:O,left:P});return}const z=I.getBoundingClientRect(),T=window.innerHeight-z.bottom,M=z.top;T>=R+_?(O=z.bottom+_,P=z.right-k,P<_&&(P=z.left,P+k>window.innerWidth-_&&(P=(window.innerWidth-k)/2))):M>=R+_?(O=z.top-R-_,P=z.right-k,P<_&&(P=z.left,P+k>window.innerWidth-_&&(P=(window.innerWidth-k)/2))):(O=z.bottom+_,P=z.right-k,P<_&&(P=z.left)),m({top:O,left:P})},10),j=I=>{n.current&&!n.current.contains(I.target)&&(t==null||t())},x=I=>{I.key==="Escape"&&(t==null||t())};return document.addEventListener("mousedown",j),document.addEventListener("keydown",x),()=>{clearTimeout(w),document.removeEventListener("mousedown",j),document.removeEventListener("keydown",x)}},[t,o]),i.useEffect(()=>{r&&a(r)},[r]),d?e.jsx(vm,{ref:n,style:{top:`${g.top}px`,left:`${g.left}px`,visibility:g.top>0?"visible":"hidden"},onClick:w=>w.stopPropagation(),role:"dialog","aria-labelledby":"add-domain-title","aria-modal":"true",children:s?e.jsxs(e.Fragment,{children:[e.jsxs(Os,{children:[e.jsx(Ms,{id:"verify-domain-title",children:"Verify Domain"}),e.jsx(Ds,{onClick:t,"aria-label":"Close domain verification dialog",children:e.jsx(Ze,{size:16})})]}),e.jsxs(Ls,{children:[e.jsx("div",{style:{marginBottom:"var(--space-md)"},children:e.jsx("p",{style:{fontSize:"var(--font-xs)",color:"var(--color-muted)",margin:0,textAlign:"left"},children:"Add the following DNS record to your domain"})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:[e.jsxs(ge,{children:[e.jsx(he,{children:"Record Type"}),e.jsx(pe,{value:s==null?void 0:s.verification_dns_record_type,disabled:!0})]}),e.jsxs(ge,{children:[e.jsx(he,{children:"Record Name"}),e.jsx(pe,{value:s==null?void 0:s.verification_dns_record_name,disabled:!0})]}),e.jsxs(ge,{children:[e.jsx(he,{children:"Record Data"}),e.jsx(pe,{type:"text",value:s==null?void 0:s.verification_dns_record_data,disabled:!0})]})]})]}),e.jsxs(As,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto"},children:"Cancel"}),e.jsx(X,{onClick:C,disabled:c,style:{width:"auto"},children:c?e.jsxs(e.Fragment,{children:[e.jsx(Ee,{size:14})," Verifying..."]}):"Verify Domain"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Os,{children:[e.jsx(Ms,{id:"add-domain-title",children:"Add Domain"}),e.jsx(Ds,{onClick:t,"aria-label":"Close add domain dialog",children:e.jsx(Ze,{size:16})})]}),e.jsx(Ls,{children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:e.jsxs(ge,{children:[e.jsx(he,{children:"Enter FQDN"}),e.jsx(pe,{type:"text",placeholder:"Enter your domain",value:h,onChange:w=>f(w.target.value),autoFocus:!0,"aria-label":"Domain name (FQDN)","aria-describedby":"domain-help"})]})})}),e.jsxs(As,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto"},children:"Cancel"}),e.jsx(X,{onClick:$,disabled:!h||c,style:{width:"auto"},children:c?e.jsxs(e.Fragment,{children:[e.jsx(Ee,{size:14})," Adding..."]}):"Continue"})]})]})}):null},bm=l.div`
|
|
2261
2261
|
position: fixed;
|
|
2262
2262
|
width: 360px;
|
|
2263
2263
|
max-width: calc(100vw - 48px);
|
|
@@ -2357,7 +2357,7 @@ cursor: pointer;
|
|
|
2357
2357
|
color: var(--color-foreground);
|
|
2358
2358
|
background: var(--color-input-background);
|
|
2359
2359
|
}
|
|
2360
|
-
`,
|
|
2360
|
+
`,Fs=({onClose:t,onSuccess:r,role:o,triggerRef:n})=>{var j;const s=i.useRef(null),[a,h]=i.useState((o==null?void 0:o.name)||""),[f,c]=i.useState((o==null?void 0:o.permissions)||[]);qe();const[p,d]=i.useState(!1),[u,g]=i.useState(!1),[m,v]=i.useState({top:0,left:0}),{deployment:y}=ve(),{toast:S}=Je(),E=!!o,b=Array.isArray((j=y==null?void 0:y.b2b_settings)==null?void 0:j.organization_permissions)?y.b2b_settings.organization_permissions.map(x=>({value:x,label:x})):[];i.useEffect(()=>{g(!0);const x=setTimeout(()=>{if(!s.current)return;let _=null;if(n!=null&&n.current)_=n.current;else if(E){const O=document.querySelectorAll("[data-role-dropdown-trigger]");for(let P=0;P<O.length;P++){const z=O[P];if(z.offsetParent!==null){_=z;break}}}else{const O=document.querySelectorAll("button");for(let P=0;P<O.length;P++){const z=O[P];if(z.textContent==="Add role"&&z.offsetParent!==null){_=z;break}}}if(_){const O=_.getBoundingClientRect(),P=400;let z=O.bottom+8,T=O.right-P;T<10&&(T=O.left),z+300>window.innerHeight&&(z=O.top-300-8),v({top:z,left:T})}},10),I=_=>{s.current&&!s.current.contains(_.target)&&(t==null||t())},k=_=>{_.key==="Escape"&&(t==null||t())},R=setTimeout(()=>{document.addEventListener("mousedown",I),document.addEventListener("keydown",k)},100);return()=>{clearTimeout(x),clearTimeout(R),document.removeEventListener("mousedown",I),document.removeEventListener("keydown",k)}},[t,E,n]);const $=x=>x.trim().replace(/[<>\"'&]/g,""),C=x=>x.length>=2&&x.length<=50&&/^[a-zA-Z0-9\s_-]+$/.test(x),w=async()=>{const x=$(a);if(!x){S("Please enter a role name","error");return}if(!C(x)){S("Role name must be 2-50 characters and contain only letters, numbers, spaces, underscores, and hyphens","error");return}if(f.length===0){S("Please select at least one permission","error");return}d(!0);try{const I={id:o==null?void 0:o.id,name:x,permissions:f||[]};r==null||r(I)}catch(I){const k=I.message||`Failed to ${E?"update":"create"} role. Please try again.`;S(k,"error")}finally{d(!1)}};return u?e.jsxs(Cm,{ref:s,$isInTable:E,style:{top:`${m.top}px`,left:`${m.left}px`,visibility:m.top>0?"visible":"hidden"},onClick:x=>x.stopPropagation(),role:"dialog","aria-labelledby":"role-dialog-title","aria-modal":"true",children:[e.jsxs(Sm,{children:[e.jsx($m,{id:"role-dialog-title",children:E?"Edit Role":"Create New Role"}),e.jsx(Pm,{onClick:t,"aria-label":`Close ${E?"edit":"create"} role dialog`,children:e.jsx(Ze,{size:16})})]}),e.jsx(zm,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:[e.jsxs(ge,{children:[e.jsx(he,{children:"Role Name"}),e.jsx(pe,{type:"text",placeholder:"e.g. Admin, Editor, Viewer",value:a,onChange:x=>h(x.target.value),autoFocus:!0,"aria-label":"Role name","aria-describedby":"role-name-help"})]}),e.jsxs(ge,{children:[e.jsx(he,{children:"Permissions"}),e.jsx(il,{options:b,value:f,onChange:c,placeholder:"Select permissions","aria-label":"Select permissions for role"})]})]})}),e.jsxs(Em,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto"},children:"Cancel"}),e.jsx(X,{onClick:w,disabled:!a||p,style:{width:"auto"},children:p?e.jsxs(e.Fragment,{children:[e.jsx(Ee,{size:14})," ",E?"Updating...":"Creating..."]}):E?"Update Role":"Create Role"})]})]}):null},jt=l.table`
|
|
2361
2361
|
width: 100%;
|
|
2362
2362
|
border-collapse: separate;
|
|
2363
2363
|
border-spacing: 0;
|
|
@@ -2470,12 +2470,12 @@ cursor: pointer;
|
|
|
2470
2470
|
border-radius: 8px;
|
|
2471
2471
|
padding: 20px;
|
|
2472
2472
|
margin-bottom: 16px;
|
|
2473
|
-
`,
|
|
2473
|
+
`,Nm=l.div`
|
|
2474
2474
|
display: flex;
|
|
2475
2475
|
justify-content: space-between;
|
|
2476
2476
|
align-items: flex-start;
|
|
2477
2477
|
margin-bottom: 16px;
|
|
2478
|
-
`,
|
|
2478
|
+
`,Fm=l.h3`
|
|
2479
2479
|
font-size: 16px;
|
|
2480
2480
|
font-weight: 500;
|
|
2481
2481
|
color: var(--color-foreground);
|
|
@@ -2592,7 +2592,7 @@ cursor: pointer;
|
|
|
2592
2592
|
color: var(--color-foreground);
|
|
2593
2593
|
background: var(--color-input-background);
|
|
2594
2594
|
}
|
|
2595
|
-
`,Qm=()=>{const{activeOrganization:t,loading:r,getEnterpriseConnections:o,createEnterpriseConnection:n,deleteEnterpriseConnection:s}=qe(),{deployment:a}=ve(),{toast:h}=Je(),[f,c]=i.useState(!1),[p,d]=i.useState(null),[u,g]=i.useState(null),m=i.useRef(null),{data:v=[],isLoading:y,mutate:S}=
|
|
2595
|
+
`,Qm=()=>{const{activeOrganization:t,loading:r,getEnterpriseConnections:o,createEnterpriseConnection:n,deleteEnterpriseConnection:s}=qe(),{deployment:a}=ve(),{toast:h}=Je(),[f,c]=i.useState(!1),[p,d]=i.useState(null),[u,g]=i.useState(null),m=i.useRef(null),{data:v=[],isLoading:y,mutate:S}=Fe(t!=null&&t.id?`wacht-org-sso:${t.id}`:null,async()=>await(o==null?void 0:o())||[],{refreshInterval:3e4,revalidateOnFocus:!1}),E=async w=>{try{await(s==null?void 0:s(w)),S(),h("SSO connection deleted","info")}catch(j){h(j.message||"Failed to delete connection","error")}d(null)},b=(w,j)=>{navigator.clipboard.writeText(w),g(j),setTimeout(()=>g(null),2e3)},$=a!=null&&a.backend_host?`https://${a.backend_host}/auth/sso/metadata`:"",C=a!=null&&a.backend_host?`https://${a.backend_host}/auth/sso/callback`:"";return r||y?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ee,{})}):e.jsxs(e.Fragment,{children:[e.jsxs(Am,{children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("h3",{style:{margin:0,fontSize:"16px",color:"var(--color-foreground)"},children:"Enterprise SSO"}),e.jsx("p",{style:{margin:"4px 0 0",fontSize:"13px",color:"var(--color-muted)"},children:"Configure SAML SSO for your organization"})]}),v.length===0&&e.jsxs("div",{style:{position:"relative"},children:[e.jsxs(X,{ref:m,onClick:()=>c(!0),children:[e.jsx(Ke,{size:16})," Configure SSO"]}),f&&e.jsx(Xm,{onClose:()=>c(!1),triggerRef:m,onCreate:async w=>{try{await(n==null?void 0:n(w)),S(),c(!1),h("SSO connection created","info")}catch(j){h(j.message||"Failed to create connection","error")}}})]})]}),e.jsxs(Um,{children:[e.jsx("div",{style:{marginBottom:"12px",fontWeight:500},children:"Service Provider Details"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{minWidth:"80px"},children:"ACS URL:"}),e.jsx("code",{style:{flex:1,fontSize:"12px"},children:C}),e.jsx(Dn,{onClick:()=>b(C,"acs"),children:u==="acs"?e.jsx(Ye,{size:14}):e.jsx(No,{size:14})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{minWidth:"80px"},children:"Metadata:"}),e.jsx("code",{style:{flex:1,fontSize:"12px"},children:$}),e.jsx(Dn,{onClick:()=>b($,"metadata"),children:u==="metadata"?e.jsx(Ye,{size:14}):e.jsx(No,{size:14})})]})]})]}),v.length===0?e.jsx(et,{title:"No SSO connection configured",description:"Set up SAML SSO to allow members to sign in with your identity provider"}):v.map(w=>e.jsxs(Dm,{children:[e.jsxs(Nm,{children:[e.jsxs(Fm,{children:[e.jsx(wr,{size:18}),"SAML SSO",e.jsx(Bm,{children:w.protocol.toUpperCase()})]}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx(Dn,{onClick:()=>d(w.id),style:{color:"var(--color-error)"},children:e.jsx(Vr,{size:16})}),p===w.id&&e.jsx(Hr,{title:"Delete this SSO connection?",onConfirm:()=>E(w.id),onCancel:()=>d(null)})]})]}),e.jsxs(An,{children:[e.jsx("strong",{children:"Entity ID:"})," ",w.idp_entity_id]}),e.jsxs(An,{children:[e.jsx("strong",{children:"SSO URL:"})," ",w.idp_sso_url]}),e.jsxs(An,{children:[e.jsx("strong",{children:"Created:"})," ",new Date(w.created_at).toLocaleDateString()]})]},w.id))]})},Km=l.select`
|
|
2596
2596
|
width: 100%;
|
|
2597
2597
|
padding: 10px 12px;
|
|
2598
2598
|
border: 1px solid var(--color-border);
|
|
@@ -2606,14 +2606,14 @@ cursor: pointer;
|
|
|
2606
2606
|
outline: none;
|
|
2607
2607
|
border-color: var(--color-primary);
|
|
2608
2608
|
}
|
|
2609
|
-
`,Xm=({onClose:t,onCreate:r,triggerRef:o})=>{const{getDomains:n}=qe(),s=i.useRef(null),[a,h]=i.useState(!1),[f,c]=i.useState(!1),[p,d]=i.useState({top:0,left:0}),[u,g]=i.useState({domain_id:"",idp_entity_id:"",idp_sso_url:"",idp_certificate:""}),{data:m=[],isLoading:v}=
|
|
2609
|
+
`,Xm=({onClose:t,onCreate:r,triggerRef:o})=>{const{getDomains:n}=qe(),s=i.useRef(null),[a,h]=i.useState(!1),[f,c]=i.useState(!1),[p,d]=i.useState({top:0,left:0}),[u,g]=i.useState({domain_id:"",idp_entity_id:"",idp_sso_url:"",idp_certificate:""}),{data:m=[],isLoading:v}=Fe("wacht-org-verified-domains-for-sso",async()=>(await(n==null?void 0:n())||[]).filter(E=>E.verified),{revalidateOnFocus:!1}),y=async S=>{if(S.preventDefault(),!!u.domain_id){h(!0);try{await r({protocol:"saml",domain_id:u.domain_id,idp_entity_id:u.idp_entity_id,idp_sso_url:u.idp_sso_url,idp_certificate:u.idp_certificate})}finally{h(!1)}}};return i.useEffect(()=>{c(!0);const S=setTimeout(()=>{if(!s.current||!(o!=null&&o.current))return;const $=o.current;if($){const C=$.getBoundingClientRect(),w=480,j=450,x=8;let I=0,k=0;const R=window.innerHeight-C.bottom,_=C.top;R>=j+x?(I=C.bottom+x,k=C.right-w,k<x&&(k=C.left,k+w>window.innerWidth-x&&(k=(window.innerWidth-w)/2))):_>=j+x?(I=C.top-j-x,k=C.right-w,k<x&&(k=C.left,k+w>window.innerWidth-x&&(k=(window.innerWidth-w)/2))):(I=C.bottom+x,k=C.right-w,k<x&&(k=C.left)),d({top:I,left:k})}},10),E=$=>{s.current&&!s.current.contains($.target)&&(t==null||t())},b=$=>{$.key==="Escape"&&(t==null||t())};return document.addEventListener("mousedown",E),document.addEventListener("keydown",b),()=>{clearTimeout(S),document.removeEventListener("mousedown",E),document.removeEventListener("keydown",b)}},[t,o]),f?e.jsxs(Vm,{ref:s,style:{top:`${p.top}px`,left:`${p.left}px`,visibility:p.top>0?"visible":"hidden"},onClick:S=>S.stopPropagation(),role:"dialog","aria-labelledby":"create-sso-title","aria-modal":"true",children:[e.jsxs(Gm,{children:[e.jsx(Hm,{id:"create-sso-title",children:"Configure SAML SSO"}),e.jsx(Zm,{onClick:t,"aria-label":"Close",children:e.jsx(Ze,{size:16})})]}),e.jsxs("form",{onSubmit:y,children:[e.jsxs(qm,{children:[e.jsxs(ge,{children:[e.jsx(he,{children:"Domain *"}),v?e.jsx("div",{style:{padding:"10px",color:"var(--color-muted)"},children:"Loading domains..."}):m.length===0?e.jsx("div",{style:{padding:"12px",background:"var(--color-warning-background)",border:"1px solid var(--color-warning-border)",borderRadius:"6px",fontSize:"13px",color:"var(--color-warning)"},children:"No verified domains found. Please add and verify a domain first."}):e.jsxs(Km,{value:u.domain_id,onChange:S=>g({...u,domain_id:S.target.value}),required:!0,children:[e.jsx("option",{value:"",children:"Select a verified domain"}),m.map(S=>e.jsx("option",{value:S.id,children:S.fqdn},S.id))]})]}),e.jsxs(ge,{children:[e.jsx(he,{children:"IdP Entity ID"}),e.jsx(pe,{type:"text",value:u.idp_entity_id,onChange:S=>g({...u,idp_entity_id:S.target.value}),placeholder:"https://idp.example.com/entity",required:!0})]}),e.jsxs(ge,{children:[e.jsx(he,{children:"IdP SSO URL"}),e.jsx(pe,{type:"url",value:u.idp_sso_url,onChange:S=>g({...u,idp_sso_url:S.target.value}),placeholder:"https://idp.example.com/sso",required:!0})]}),e.jsxs(ge,{style:{marginBottom:0},children:[e.jsx(he,{children:"IdP Certificate (PEM format)"}),e.jsx(Wm,{value:u.idp_certificate,onChange:S=>g({...u,idp_certificate:S.target.value}),placeholder:`-----BEGIN CERTIFICATE-----
|
|
2610
2610
|
...
|
|
2611
2611
|
-----END CERTIFICATE-----`,required:!0})]})]}),e.jsxs(Ym,{children:[e.jsx(X,{$outline:!0,onClick:t,type:"button",style:{width:"auto"},children:"Cancel"}),e.jsx(X,{type:"submit",disabled:a,style:{width:"auto"},children:a?e.jsxs(e.Fragment,{children:[e.jsx(Ee,{size:14})," Creating..."]}):"Create Connection"})]})]})]}):null},Bs=l.div`
|
|
2612
2612
|
* {
|
|
2613
2613
|
box-sizing: border-box;
|
|
2614
2614
|
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
2615
2615
|
}
|
|
2616
|
-
`,
|
|
2616
|
+
`,Nn=l.div`
|
|
2617
2617
|
width: 100%;
|
|
2618
2618
|
height: 600px;
|
|
2619
2619
|
background: var(--color-background);
|
|
@@ -2710,9 +2710,9 @@ cursor: pointer;
|
|
|
2710
2710
|
flex-wrap: wrap;
|
|
2711
2711
|
gap: 12px;
|
|
2712
2712
|
margin-bottom: 24px;
|
|
2713
|
-
`,rx=()=>{var T,M,
|
|
2714
|
-
`))||"",ip_restrictions:t.enable_ip_restriction||!1,mfa_required:t.enforce_mfa||!1,default_workspace_id:t.auto_assigned_workspace_id||""}))},[t]);const _=i.useMemo(()=>s.filter(A=>A.organization.id===(t==null?void 0:t.id)),[s,t==null?void 0:t.id]),O=async()=>{if(!(!t||C!==t.name))try{x(!0),await o(""),await h(t),await n(),c("Organization deleted successfully","info")}catch{c("Failed to delete organization","error")}finally{x(!1),w("")}};if(i.useEffect(()=>()=>{m&&URL.revokeObjectURL(m)},[m]),r)return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ee,{})});const P=L=>{var A;if((A=L.target.files)!=null&&A[0]){const se=L.target.files[0];if(se.size>2*1024*1024){c("File size cannot exceed 2MB","error");return}if(!se.type.startsWith("image/")){c("Please select a valid image file","error");return}m&&URL.revokeObjectURL(m),v(URL.createObjectURL(se)),setTimeout(()=>R(),100)}},z=()=>{y.current&&y.current.click()};return e.jsx(e.Fragment,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-2xl)"},children:[e.jsxs("div",{style:{display:"flex",gap:"var(--space-2xl)",alignItems:"center"},children:[e.jsx("div",{style:{flexShrink:0},children:e.jsxs("div",{style:{width:"120px",height:"120px",borderRadius:"50%",border:"2px dashed var(--color-border)",background:m?"transparent":"var(--color-input-background)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"all 0.2s ease"},onClick:z,onMouseEnter:L=>{L.currentTarget.style.borderColor="var(--color-primary)",L.currentTarget.style.transform="scale(1.02)"},onMouseLeave:L=>{L.currentTarget.style.borderColor="var(--color-border)",L.currentTarget.style.transform="scale(1)"},children:[m?e.jsx("img",{src:m,alt:"Organization Logo",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}):e.jsx(
|
|
2715
|
-
10.0.0.0/24`,style:{minHeight:"80px",resize:"vertical",fontFamily:"monospace"}}),e.jsx("p",{style:{fontSize:"var(--font-2xs)",color:"var(--color-muted)",margin:"var(--space-2xs) 0 0 0"},children:"Enter one IP address or CIDR block per line"})]})]}),((
|
|
2713
|
+
`,rx=()=>{var T,M,N,H;const{activeOrganization:t,loading:r}=qe(),{switchOrganization:o,refetch:n}=Be(),{workspaces:s}=yt(),{deployment:a}=ve(),{deleteOrganization:h,updateOrganization:f}=qo(),{toast:c}=Je(),[p,d]=i.useState((t==null?void 0:t.name)||""),[u,g]=i.useState((t==null?void 0:t.description)||""),[m,v]=i.useState((t==null?void 0:t.image_url)||null),y=i.useRef(null),[S,E]=i.useState(!1),[b,$]=i.useState({mfa_required:!1,ip_restrictions:!1,allowed_ips:"",default_workspace_id:""}),[C,w]=i.useState(""),[j,x]=i.useState(!1),[I,k]=i.useState(!1),R=i.useCallback(async()=>{if(!(!t||S))try{E(!0),await f(t,{name:p,description:u}),c("Changes saved","info")}catch(L){const A=L.message||"Failed to save changes. Please try again.";c(A,"error")}finally{E(!1)}},[t,p,u,m,b,f,c]);i.useEffect(()=>{var L;t&&(d(t.name||""),g(t.description||""),v(t.image_url||null),$({allowed_ips:((L=t.whitelisted_ips)==null?void 0:L.join(`
|
|
2714
|
+
`))||"",ip_restrictions:t.enable_ip_restriction||!1,mfa_required:t.enforce_mfa||!1,default_workspace_id:t.auto_assigned_workspace_id||""}))},[t]);const _=i.useMemo(()=>s.filter(A=>A.organization.id===(t==null?void 0:t.id)),[s,t==null?void 0:t.id]),O=async()=>{if(!(!t||C!==t.name))try{x(!0),await o(""),await h(t),await n(),c("Organization deleted successfully","info")}catch{c("Failed to delete organization","error")}finally{x(!1),w("")}};if(i.useEffect(()=>()=>{m&&URL.revokeObjectURL(m)},[m]),r)return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ee,{})});const P=L=>{var A;if((A=L.target.files)!=null&&A[0]){const se=L.target.files[0];if(se.size>2*1024*1024){c("File size cannot exceed 2MB","error");return}if(!se.type.startsWith("image/")){c("Please select a valid image file","error");return}m&&URL.revokeObjectURL(m),v(URL.createObjectURL(se)),setTimeout(()=>R(),100)}},z=()=>{y.current&&y.current.click()};return e.jsx(e.Fragment,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-2xl)"},children:[e.jsxs("div",{style:{display:"flex",gap:"var(--space-2xl)",alignItems:"center"},children:[e.jsx("div",{style:{flexShrink:0},children:e.jsxs("div",{style:{width:"120px",height:"120px",borderRadius:"50%",border:"2px dashed var(--color-border)",background:m?"transparent":"var(--color-input-background)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"all 0.2s ease"},onClick:z,onMouseEnter:L=>{L.currentTarget.style.borderColor="var(--color-primary)",L.currentTarget.style.transform="scale(1.02)"},onMouseLeave:L=>{L.currentTarget.style.borderColor="var(--color-border)",L.currentTarget.style.transform="scale(1)"},children:[m?e.jsx("img",{src:m,alt:"Organization Logo",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}):e.jsx(Nr,{size:32,color:"var(--color-muted)"}),e.jsx("input",{type:"file",ref:y,style:{display:"none"},accept:"image/*",onChange:P,"aria-label":"Upload organization logo"})]})}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{marginBottom:"var(--space-lg)"},children:[e.jsx("h3",{style:{fontSize:"var(--font-sm)",color:"var(--color-foreground)",margin:"0 0 var(--space-2xs) 0"},children:"Organization Logo"}),e.jsx("p",{style:{fontSize:"var(--font-xs)",color:"var(--color-secondary-text)",margin:0},children:"Upload an image to represent your organization"})]}),e.jsxs("div",{style:{display:"flex",gap:"var(--space-sm)",marginBottom:"var(--space-sm)"},children:[e.jsxs(X,{onClick:()=>{var L;return(L=y.current)==null?void 0:L.click()},style:{padding:"var(--space-xs) var(--space-md)",fontSize:"var(--font-xs)",height:"32px",width:"100px",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx(Nr,{size:14}),m?"Change":"Upload"]}),e.jsxs(X,{onClick:()=>{v(null),y.current&&(y.current.value="")},style:{background:"transparent",color:"var(--color-muted)",border:"1px solid var(--color-border)",padding:"var(--space-xs) var(--space-md)",fontSize:"var(--font-xs)",height:"32px",width:"100px",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx(Vr,{size:14}),"Remove"]})]})]})]}),e.jsx("div",{style:{position:"relative",height:"1px",background:"var(--color-divider)",margin:"0"}}),e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:"var(--space-md)"},children:[e.jsx("h3",{style:{fontSize:"var(--font-sm)",color:"var(--color-foreground)",margin:"0 0 var(--space-2xs) 0"},children:"Organization Details"}),e.jsx("p",{style:{fontSize:"var(--font-xs)",color:"var(--color-secondary-text)",margin:0},children:"Basic information about your organization"})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-lg)"},children:[e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"name",children:"Organization Name"}),e.jsx(pe,{id:"name",type:"text",value:p,onChange:L=>d(L.target.value),onBlur:R,placeholder:"Enter organization name",required:!0})]}),e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"description",children:"Description"}),e.jsx(pe,{id:"description",as:"textarea",value:u,onChange:L=>g(L.target.value),onBlur:R,placeholder:"Enter organization description",style:{minHeight:"80px",resize:"vertical",fontFamily:"inherit"}}),e.jsx("p",{style:{fontSize:"var(--font-2xs)",color:"var(--color-muted)",margin:"var(--space-2xs) 0 0 0"},children:"Brief description of your organization"})]}),((T=a==null?void 0:a.b2b_settings)==null?void 0:T.enforce_mfa_per_org_enabled)&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx(he,{style:{fontSize:"var(--font-xs)",color:"var(--color-foreground)",display:"block",marginBottom:"var(--space-2xs)"},children:"Multi-Factor Authentication"}),e.jsx("div",{style:{fontSize:"var(--font-2xs)",color:"var(--color-muted)"},id:"mfa-description",children:"Require all members to set up MFA for added security"})]}),e.jsx(jr,{checked:b.mfa_required,onChange:()=>{$(L=>({...L,mfa_required:!L.mfa_required})),setTimeout(()=>R(),100)}})]}),((M=a==null?void 0:a.b2b_settings)==null?void 0:M.ip_allowlist_per_org_enabled)&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx(he,{style:{fontSize:"var(--font-xs)",color:"var(--color-foreground)",display:"block",marginBottom:"var(--space-2xs)"},children:"IP Restrictions"}),e.jsx("div",{style:{fontSize:"var(--font-2xs)",color:"var(--color-muted)"},id:"ip-restrictions-description",children:"Only allow access from specific IP addresses"})]}),e.jsx(jr,{checked:b.ip_restrictions,onChange:()=>{$(L=>({...L,ip_restrictions:!L.ip_restrictions})),setTimeout(()=>R(),100)},"aria-label":"Enable IP address restrictions","aria-describedby":"ip-restrictions-description"})]}),b.ip_restrictions&&e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"allowed_ips",children:"Allowed IP Addresses"}),e.jsx(pe,{id:"allowed_ips",as:"textarea",value:b.allowed_ips,onChange:L=>$(A=>({...A,allowed_ips:L.target.value})),onBlur:R,placeholder:`192.168.1.1
|
|
2715
|
+
10.0.0.0/24`,style:{minHeight:"80px",resize:"vertical",fontFamily:"monospace"}}),e.jsx("p",{style:{fontSize:"var(--font-2xs)",color:"var(--color-muted)",margin:"var(--space-2xs) 0 0 0"},children:"Enter one IP address or CIDR block per line"})]})]}),((N=a==null?void 0:a.b2b_settings)==null?void 0:N.workspaces_enabled)&&_.length>0&&e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"default_workspace",children:"Default Workspace"}),e.jsx(Ca,{options:_.map(L=>({value:L.id,label:L.name})),value:b.default_workspace_id,onChange:L=>{$(A=>({...A,default_workspace_id:L})),setTimeout(()=>R(),100)},placeholder:"Select default workspace"}),e.jsx("p",{style:{fontSize:"var(--font-2xs)",color:"var(--color-muted)",margin:"var(--space-2xs) 0 0 0"},children:"Workspace that new members will be added to automatically"})]})]})]}),((H=a==null?void 0:a.b2b_settings)==null?void 0:H.allow_org_deletion)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{position:"relative",height:"1px",background:"var(--color-divider)",margin:"0"}}),e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsx("h3",{style:{fontSize:"16px",color:"var(--color-foreground)",margin:"0 0 4px 0"},children:"Danger Zone"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--color-muted)",margin:0},children:"Irreversible and destructive actions"})]}),e.jsxs("div",{style:{padding:"20px",border:"1px solid var(--color-error)",borderRadius:"8px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:I?"20px":"0"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"14px",color:"var(--color-foreground)",marginBottom:"4px",fontWeight:"500"},children:"Delete Organization"}),e.jsx("div",{style:{fontSize:"13px",color:"var(--color-muted)"},children:"Once you delete this organization, there is no going back. Please be certain."})]}),e.jsx(X,{onClick:()=>{I?(k(!1),w("")):k(!0)},style:{background:"var(--color-error)",color:"white",border:"none",padding:"6px 12px",fontSize:"13px",height:"32px",width:"auto"},children:I?"Cancel":"Delete"})]}),I&&e.jsxs("div",{children:[e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"confirm_name",children:"Confirm by typing the organization name"}),e.jsx(pe,{id:"confirm_name",type:"text",value:C,onChange:L=>w(L.target.value),placeholder:`Type "${t==null?void 0:t.name}" to confirm`})]}),e.jsx(X,{onClick:O,disabled:C!==(t==null?void 0:t.name)||j,style:{background:C===(t==null?void 0:t.name)?"var(--color-error)":"transparent",color:C===(t==null?void 0:t.name)?"white":"var(--color-muted)",border:"1px solid var(--color-border)",padding:"8px 16px",fontSize:"14px",height:"36px",cursor:C===(t==null?void 0:t.name)?"pointer":"not-allowed",opacity:C===(t==null?void 0:t.name)?1:.6,marginTop:"12px"},children:j?e.jsx(Ee,{size:12}):"Delete Forever"})]})]})]})]})]})})},Us=l.span`
|
|
2716
2716
|
background: var(--color-primary-background);
|
|
2717
2717
|
color: var(--color-primary);
|
|
2718
2718
|
padding: 4px 8px;
|
|
@@ -2749,7 +2749,7 @@ cursor: pointer;
|
|
|
2749
2749
|
opacity: 0.5;
|
|
2750
2750
|
cursor: not-allowed;
|
|
2751
2751
|
}
|
|
2752
|
-
`,ox=()=>{const{activeOrganization:t,loading:r,getDomains:o,removeDomain:n}=qe(),s=i.useRef(null),[a,h]=i.useState(null),{data:f=[],isLoading:c,mutate:p}=
|
|
2752
|
+
`,ox=()=>{const{activeOrganization:t,loading:r,getDomains:o,removeDomain:n}=qe(),s=i.useRef(null),[a,h]=i.useState(null),{data:f=[],isLoading:c,mutate:p}=Fe(t!=null&&t.id?`wacht-org-domains:${t.id}`:null,async()=>(await(o==null?void 0:o())||[]).map((k,R)=>({...k,verified:k.verified!==void 0?k.verified:R%2===0})),{refreshInterval:3e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,dedupingInterval:5e3}),d=f,[u,g]=i.useState(!1),[m,v]=i.useState(null),[y,S]=i.useState(""),[E,b]=i.useState(null),$=i.useRef(null),C=i.useRef({}),w=i.useMemo(()=>{let I=d;if(y.trim()!==""){const k=y.toLowerCase();I=I.filter(R=>R.fqdn.toLowerCase().includes(k))}return I},[d,y]),j=async I=>{await n(I),p()},x=async I=>{v(I)};return r||c?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ee,{})}):e.jsxs(e.Fragment,{children:[e.jsxs(bl,{children:[e.jsx(wt,{value:y,onChange:S,placeholder:"Search Domain"}),e.jsxs("div",{children:[e.jsx(X,{ref:$,onClick:()=>g(!u),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"New Domain"}),u&&e.jsx(Ns,{onClose:()=>{g(!1),p()},triggerRef:$})]})]}),e.jsxs("div",{style:{padding:"12px 16px",background:"var(--color-background-alt)",borderRadius:"8px",marginBottom:"24px",border:"1px solid var(--color-border)",fontSize:"13px",color:"var(--color-secondary-text)"},children:["Users with verified domain emails automatically join this organization",(t==null?void 0:t.auto_assigned_workspace_id)&&" and its default workspace","."]}),w!=null&&w.length?e.jsxs(jt,{ref:s,children:[e.jsx(kt,{children:e.jsxs(We,{children:[e.jsx(ze,{children:"Domain"}),e.jsx(ze,{children:"Status"}),e.jsx(ze,{children:"Date Added"}),e.jsx(ze,{})]})}),e.jsx(_t,{children:w.map(I=>e.jsxs(We,{children:[e.jsx(Le,{children:I.fqdn}),e.jsx(Le,{children:I.verified?e.jsx(Us,{style:{background:"var(--color-primary-background)",color:"var(--color-primary)"},children:"✓ Verified"}):e.jsxs(Us,{style:{background:"var(--color-warning-background)",color:"var(--color-warning)",border:"1px solid var(--color-warning-border)"},children:[e.jsx(dt,{size:9})," Pending Verification"]})}),e.jsx(Le,{children:new Date(I.created_at).toLocaleDateString()}),e.jsx(Ct,{children:e.jsxs("div",{style:{position:"relative"},children:[e.jsxs(nt,{style:{marginLeft:"auto"},open:E===I.id,openChange:k=>b(k?I.id:null),children:[e.jsx(st,{children:e.jsx(Sa,{ref:k=>{C.current[I.id]=k},children:"•••"})}),e.jsxs(at,{children:[e.jsx(Te,{onClick:()=>{x(I.id),b(null)},children:e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:I.verified?"📋 View DNS Record":"✓ Verify Domain"})}),e.jsx(Te,{onClick:()=>{b(null),navigator.clipboard.writeText(I.fqdn)},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(No,{size:16,color:"var(--color-muted)"})," Copy Domain"]})}),e.jsx(Te,{onClick:()=>{window.open(`https://${I.fqdn}`,"_blank"),b(null)},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Uc,{size:16,color:"var(--color-muted)"})," ","Visit Domain"]})}),e.jsx(on,{}),e.jsx(Te,{$destructive:!0,onClick:()=>{b(null),h(I.id)},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Vr,{size:16,color:"var(--color-error)"})," ","Remove Domain"]})})]})]}),a===I.id&&e.jsx(Hr,{title:"Are you sure you want to delete this domain?",onConfirm:()=>j(I),onCancel:()=>h(null)}),m===I.id&&e.jsx(Ns,{domain:I,onClose:()=>v(null),triggerRef:{current:C.current[I.id]}})]})})]},I.id))})]}):e.jsx(et,{title:y!=="all"?"No domains match your criteria":"No domains added",description:"Add a domain to get started"})]})},nx=l.div`
|
|
2753
2753
|
width: 40px;
|
|
2754
2754
|
height: 40px;
|
|
2755
2755
|
border-radius: 50%;
|
|
@@ -2761,7 +2761,7 @@ cursor: pointer;
|
|
|
2761
2761
|
font-weight: 400;
|
|
2762
2762
|
font-size: 14px;
|
|
2763
2763
|
overflow: hidden;
|
|
2764
|
-
`,ax=()=>{const{activeOrganization:t,loading:r,getMembers:o,getRoles:n,addMemberRole:s,removeMemberRole:a,removeMember:h}=qe(),{session:f}=Be(),{toast:c}=Je(),[p,d]=i.useState(""),[u,g]=i.useState(!1),m=i.useRef(null),{data:v=[],isLoading:y,mutate:S}=Ne(t?`wacht-api-organizations:${t.id}:members`:null,()=>(o==null?void 0:o())||[]),{data:E=[],isLoading:b}=Ne(t?`wacht-api-organizations:${t.id}:roles`:null,()=>(n==null?void 0:n())||[]),$=E,C=i.useMemo(()=>p?v.filter(k=>{var T;const R=k.user;if(!R)return!1;const _=R.first_name||"",O=R.last_name||"",P=((T=R.primary_email_address)==null?void 0:T.email)||"";return`${_} ${O}`.trim().toLowerCase().includes(p.toLowerCase())||P.toLowerCase().includes(p.toLowerCase())}):v,[v,p]),w=async(k,R,_)=>{try{_?(await a(k,R),c("Role removed successfully","info")):(await s(k,R),c("Role added successfully","info")),S()}catch(O){const P=O.message||"Failed to update role. Please try again.";c(P,"error")}},j=(k="",R="")=>`${k[0]||""}${R[0]||""}`.toUpperCase(),x=(k,R)=>{var _;return((_=k.roles)==null?void 0:_.some(O=>O.id===R))||!1},I=()=>{g(!1),S(),c("Invitation sent successfully","info")};return r||y||b?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ee,{})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:"24px",display:"flex",justifyContent:"space-between",alignItems:"center",gap:"16px"},children:[e.jsx("div",{style:{flex:1},children:e.jsx(wt,{value:p,onChange:d,placeholder:"Search members..."})}),e.jsx(X,{ref:m,onClick:()=>g(!u),style:{background:"var(--color-primary)",color:"white",border:"none",padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,whiteSpace:"nowrap",height:"36px",width:"auto"},children:"Invite Members"})]}),u&&e.jsx(xl,{onClose:()=>g(!1),onSuccess:I,roles:$,triggerRef:m}),C.length===0?e.jsx(et,{title:p?"No members match your search":"No members yet",description:"Invite members to your organization to get started."}):e.jsxs(jt,{children:[e.jsx(kt,{children:e.jsxs(We,{children:[e.jsx(ze,{children:"Member"}),e.jsx(ze,{children:"Joined"}),e.jsx(ze,{children:"Roles"})]})}),e.jsx(_t,{children:C.map(k=>{var P,z;const R=k.roles||[],_=k.user,O=(_==null?void 0:_.id)===((P=f==null?void 0:f.active_signin)==null?void 0:P.user_id);return e.jsxs(We,{children:[e.jsx(vl,{children:e.jsxs("div",{children:[e.jsx(nx,{children:_!=null&&_.profile_picture_url?e.jsx("img",{src:_.profile_picture_url,alt:`${_.first_name||""} ${_.last_name||""}`,style:{width:"100%",height:"100%",objectFit:"cover"}}):j(_==null?void 0:_.first_name,_==null?void 0:_.last_name)||"?"}),e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"14px",fontWeight:500,color:"var(--color-foreground)"},children:(()=>{var M;if(!_)return"Unknown User";const T=`${_.first_name||""} ${_.last_name||""}`.trim();return T||((M=_.primary_email_address)==null?void 0:M.email)||"Unknown User"})()}),O&&e.jsx("span",{style:{fontSize:"12px",padding:"2px 8px",background:"var(--color-background-alt)",borderRadius:"4px",color:"var(--color-secondary-text)"},children:"You"})]}),e.jsx("div",{style:{fontSize:"13px",color:"var(--color-secondary-text)"},children:(z=_==null?void 0:_.primary_email_address)==null?void 0:z.email})]})]})}),e.jsx(Le,{children:new Date(k.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),e.jsx(Ct,{children:e.jsx("div",{style:{position:"relative"},children:e.jsxs(nt,{children:[e.jsx(st,{children:e.jsxs(X,{style:{background:"var(--color-background)",border:"1px solid var(--color-border)",borderRadius:"6px",padding:"6px 12px",fontSize:"14px",color:"var(--color-foreground)",display:"flex",alignItems:"center",gap:"4px",minWidth:"120px",justifyContent:"space-between"},children:[e.jsx("span",{children:R.length>0?R[0].name:"No role"}),e.jsx(er,{size:14})]})}),e.jsxs(at,{children:[$.map(T=>{const M=x(k,T.id);return e.jsx(Te,{onClick:()=>w(k,T,M),children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[e.jsx("span",{children:T.name}),M&&e.jsx(Ye,{size:16,color:"var(--color-success)"})]})},T.id)}),e.jsx(on,{}),e.jsx(Te,{$destructive:!0,onClick:()=>h(k),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Vr,{size:16,color:"var(--color-error)"}),e.jsx("span",{children:"Remove Member"})]})})]})]})})})]},k.id)})})]})]})},sx=()=>{const{activeOrganization:t,loading:r,getInvitations:o,getRoles:n,discardInvitation:s,resendInvitation:a}=qe(),{toast:h}=Je(),[f,c]=i.useState(!1),[p,d]=i.useState(""),u=i.useRef(null),{data:g=[],isLoading:m,mutate:v}=Ne(t?`wacht-api-organizations:${t.id}:invitations`:null,()=>(o==null?void 0:o())||[]),{data:y=[],isLoading:S}=Ne(t?`wacht-api-organizations:${t.id}:roles`:null,()=>(n==null?void 0:n())||[]),E=y,b=i.useMemo(()=>p?g.filter(j=>j.email.toLowerCase().includes(p.toLowerCase())):g,[g,p]),$=()=>{h("Invitation sent successfully","info"),v(),c(!1)},C=async j=>{try{await s(j),v(),h("Invitation cancelled successfully","info")}catch(x){const I=x.message||"Failed to cancel invitation. Please try again.";h(I,"error")}},w=async j=>{try{await a(j),h("Invitation resent successfully","info")}catch(x){const I=x.message||"Failed to resend invitation. Please try again.";h(I,"error")}};return r||m||S?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ee,{})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:"24px",display:"flex",justifyContent:"space-between",alignItems:"center",gap:"16px"},children:[e.jsx("div",{style:{flex:1},children:e.jsx(wt,{value:p,onChange:d,placeholder:"Search invitations..."})}),e.jsx(X,{ref:u,onClick:()=>c(!f),style:{background:"var(--color-primary)",color:"white",border:"none",padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,whiteSpace:"nowrap",height:"36px",width:"auto"},children:"Invite Members"})]}),f&&e.jsx(xl,{onClose:()=>c(!1),onSuccess:$,roles:E,triggerRef:u}),b.length===0?e.jsx(et,{title:p?"No invitations match your search":"No pending invitations",description:"Invite new members to your organization."}):e.jsxs(jt,{children:[e.jsx(kt,{children:e.jsxs(We,{children:[e.jsx(ze,{children:"Email"}),e.jsx(ze,{children:"Role"}),e.jsx(ze,{children:"Invited"}),e.jsx(ze,{})]})}),e.jsx(_t,{children:b.map(j=>{var x;return e.jsxs(We,{children:[e.jsx(Le,{children:j.email}),e.jsx(Le,{children:((x=j.initial_organization_role)==null?void 0:x.name)||"No role"}),e.jsx(Le,{children:new Date(j.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),e.jsx(Ct,{children:e.jsx("div",{style:{position:"relative"},children:e.jsxs(nt,{children:[e.jsx(st,{children:e.jsx(Sa,{children:"•••"})}),e.jsxs(at,{children:[e.jsx(Te,{onClick:()=>w(j),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Wr,{size:16,color:"var(--color-muted)"}),e.jsx("span",{children:"Resend Invitation"})]})}),e.jsx(Te,{$destructive:!0,onClick:()=>C(j),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Vr,{size:16,color:"var(--color-error)"}),e.jsx("span",{children:"Cancel Invitation"})]})})]})]})})})]},j.id)})})]})]})},ix=()=>{var j;const{activeOrganization:t,loading:r,getRoles:o,removeRole:n}=qe(),{deployment:s}=ve(),[a,h]=i.useState({isOpen:!1}),[f,c]=i.useState(null),[p,d]=i.useState(null),[u,g]=i.useState(""),[m,v]=i.useState(null),y=i.useRef(null),{data:S=[],isLoading:E,mutate:b}=Ne(t?`wacht-api-organizations:${t.id}:roles`:null,()=>(o==null?void 0:o())||[]),$=i.useMemo(()=>u?S.filter(x=>x.name.toLowerCase().includes(u.toLowerCase())):S,[S,u]),C=async x=>{try{x.id?(await new Promise(I=>setTimeout(I,1e3)),c({text:"Role updated successfully",type:"success"})):(await new Promise(I=>setTimeout(I,1e3)),c({text:"Role created successfully",type:"success"})),h({isOpen:!1}),b()}catch(I){const k=(I==null?void 0:I.message)||(x.id?"Failed to update role. Please try again.":"Failed to create role. Please try again.");x.id?c({text:k,type:"error"}):c({text:k,type:"error"})}finally{setTimeout(()=>c(null),3e3)}},w=async x=>{try{await n(x),b()}catch{}finally{setTimeout(()=>c(null),3e3)}};return r||E?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ee,{})}):e.jsxs(e.Fragment,{children:[f&&e.jsxs("div",{style:{marginBottom:"20px",padding:"8px",background:f.type==="success"?"var(--color-success-background)":"var(--color-error-background)",color:f.type==="success"?"var(--color-success)":"var(--color-error)",borderRadius:"8px",display:"flex",alignItems:"center",gap:"8px"},children:[f.type==="success"?"✓":e.jsx(dt,{size:16}),f.text]}),e.jsxs(bl,{children:[e.jsx(wt,{placeholder:"Search roles",onChange:g,value:u}),((j=s==null?void 0:s.b2b_settings)==null?void 0:j.custom_org_role_enabled)&&e.jsxs("div",{children:[e.jsx(X,{ref:y,onClick:()=>h({isOpen:!a.isOpen}),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"Add role"}),a.isOpen&&!a.role&&e.jsx(Ns,{role:a.role,onClose:()=>h({isOpen:!1}),onSuccess:C,triggerRef:y})]})]}),$.length===0?e.jsx(et,{title:u?"No roles match your search":"No roles defined yet. Create your first role to get started.",description:"Create a role to get started"}):e.jsxs(jt,{children:[e.jsx(kt,{children:e.jsxs(We,{children:[e.jsx(ze,{children:"Role"}),e.jsx(ze,{children:"Permissions"}),e.jsx(ze,{})]})}),e.jsx(_t,{children:$.map(x=>{var I;return e.jsxs(We,{children:[e.jsx(Le,{children:e.jsx("div",{style:{fontSize:"14px",fontWeight:500},children:x.name})}),e.jsx(Le,{style:{color:"var(--color-secondary-text)"},children:x.permissions.join(", ")}),e.jsx(Ct,{children:e.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center",justifyContent:"flex-end",position:"relative"},children:[e.jsxs(nt,{open:p===x.id,openChange:k=>d(k?x.id:null),children:[e.jsx(st,{children:e.jsx(Sa,{disabled:!x.organization_id,"data-role-dropdown-trigger":x.id,children:"•••"})}),e.jsxs(at,{children:[e.jsx(Te,{onClick:()=>{d(null),h({isOpen:!0,role:x})},children:"Edit Role"}),e.jsx(Te,{$destructive:!0,onClick:()=>{d(null),v(x.id)},children:"Remove Role"})]})]}),m===x.id&&e.jsx(Hr,{title:"Are you sure you want to delete this role?",onConfirm:()=>w(x),onCancel:()=>v(null)}),a.isOpen&&((I=a.role)==null?void 0:I.id)===x.id&&e.jsx(Ns,{role:a.role,onClose:()=>{h({isOpen:!1}),d(null)},onSuccess:C})]})})]},x.id)})})]})]})},yl=()=>{const{loading:t,activeOrganization:r}=qe(),[o,n]=i.useState("general"),[s,a]=i.useState(null),[h,f]=i.useState("info"),c=i.useCallback((p,d="info")=>{a(p),f(d),setTimeout(()=>a(null),3e3)},[a]);return t?e.jsx(Fn,{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(Ee,{})}):r?e.jsx(Bs,{children:e.jsx(gl.Provider,{value:{screen:null,setScreen:()=>{},toast:c},children:e.jsxs(Fn,{children:[e.jsx(Jm,{children:e.jsxs(ex,{children:[e.jsx(dr,{$isActive:o==="general",onClick:()=>n("general"),children:e.jsxs(ur,{children:[e.jsx(Kt,{size:16}),"General"]})}),e.jsx(dr,{$isActive:o==="domains",onClick:()=>n("domains"),children:e.jsxs(ur,{children:[e.jsx(Vp,{size:16}),"Domains"]})}),e.jsx(dr,{$isActive:o==="members",onClick:()=>n("members"),children:e.jsxs(ur,{children:[e.jsx(Bo,{size:16}),"Members"]})}),e.jsx(dr,{$isActive:o==="invitations",onClick:()=>n("invitations"),children:e.jsxs(ur,{children:[e.jsx(Wr,{size:16}),"Invitations"]})}),e.jsx(dr,{$isActive:o==="roles",onClick:()=>n("roles"),children:e.jsxs(ur,{children:[e.jsx(wr,{size:16}),"Roles"]})}),e.jsx(dr,{$isActive:o==="sso",onClick:()=>n("sso"),children:e.jsxs(ur,{children:[e.jsx(wr,{size:16}),"SSO"]})})]})}),e.jsxs(tx,{children:[o==="general"&&e.jsx(rx,{}),o==="domains"&&e.jsx(ox,{}),o==="members"&&e.jsx(ax,{}),o==="invitations"&&e.jsx(sx,{}),o==="roles"&&e.jsx(ix,{}),o==="sso"&&e.jsx(Qm,{})]}),s&&e.jsx("div",{style:{position:"absolute",bottom:"20px",right:"20px",maxWidth:"360px",background:"var(--color-input-background)",border:"1px solid var(--color-border)",borderRadius:"8px",padding:"12px 16px",boxShadow:"0 4px 12px var(--color-shadow)",animation:"slideUp 0.3s ease-out",wordBreak:"break-word"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[h==="error"?e.jsx(dt,{size:16,color:"var(--color-error)"}):e.jsx(Ye,{size:16,color:"var(--color-success)"}),e.jsx("span",{style:{fontSize:"14px",color:"var(--color-foreground)"},children:s})]})})]})})}):e.jsx(Bs,{children:e.jsx(Fn,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:"40px 24px",textAlign:"center"},children:[e.jsx("div",{style:{width:"80px",height:"80px",borderRadius:"50%",background:"var(--color-input-background)",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:"24px",border:"2px dashed var(--color-border)"},children:e.jsx(Fr,{size:32,color:"var(--color-muted)"})}),e.jsx("h3",{style:{fontSize:"18px",fontWeight:600,color:"var(--color-foreground)",margin:"0 0 8px 0"},children:"No Organization Selected"}),e.jsx(zl,{})]})})})},cx=({isOpen:t,onClose:r,title:o,showHeader:n,headerContent:s,footerContent:a,customContent:h,children:f,showCloseButton:c})=>e.jsx(_e,{isOpen:t,onClose:r,children:e.jsx(_e.Overlay,{children:e.jsxs(_e.Content,{style:{width:"900px",maxWidth:"100%"},children:[n&&e.jsx(_e.Header,{showCloseButton:c,children:s||o}),h||f||e.jsx(yl,{}),a&&e.jsx(_e.Footer,{children:a})]})})}),lx=l.div`
|
|
2764
|
+
`,ax=()=>{const{activeOrganization:t,loading:r,getMembers:o,getRoles:n,addMemberRole:s,removeMemberRole:a,removeMember:h}=qe(),{session:f}=Be(),{toast:c}=Je(),[p,d]=i.useState(""),[u,g]=i.useState(!1),m=i.useRef(null),{data:v=[],isLoading:y,mutate:S}=Fe(t?`wacht-api-organizations:${t.id}:members`:null,()=>(o==null?void 0:o())||[]),{data:E=[],isLoading:b}=Fe(t?`wacht-api-organizations:${t.id}:roles`:null,()=>(n==null?void 0:n())||[]),$=E,C=i.useMemo(()=>p?v.filter(k=>{var T;const R=k.user;if(!R)return!1;const _=R.first_name||"",O=R.last_name||"",P=((T=R.primary_email_address)==null?void 0:T.email)||"";return`${_} ${O}`.trim().toLowerCase().includes(p.toLowerCase())||P.toLowerCase().includes(p.toLowerCase())}):v,[v,p]),w=async(k,R,_)=>{try{_?(await a(k,R),c("Role removed successfully","info")):(await s(k,R),c("Role added successfully","info")),S()}catch(O){const P=O.message||"Failed to update role. Please try again.";c(P,"error")}},j=(k="",R="")=>`${k[0]||""}${R[0]||""}`.toUpperCase(),x=(k,R)=>{var _;return((_=k.roles)==null?void 0:_.some(O=>O.id===R))||!1},I=()=>{g(!1),S(),c("Invitation sent successfully","info")};return r||y||b?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ee,{})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:"24px",display:"flex",justifyContent:"space-between",alignItems:"center",gap:"16px"},children:[e.jsx("div",{style:{flex:1},children:e.jsx(wt,{value:p,onChange:d,placeholder:"Search members..."})}),e.jsx(X,{ref:m,onClick:()=>g(!u),style:{background:"var(--color-primary)",color:"white",border:"none",padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,whiteSpace:"nowrap",height:"36px",width:"auto"},children:"Invite Members"})]}),u&&e.jsx(xl,{onClose:()=>g(!1),onSuccess:I,roles:$,triggerRef:m}),C.length===0?e.jsx(et,{title:p?"No members match your search":"No members yet",description:"Invite members to your organization to get started."}):e.jsxs(jt,{children:[e.jsx(kt,{children:e.jsxs(We,{children:[e.jsx(ze,{children:"Member"}),e.jsx(ze,{children:"Joined"}),e.jsx(ze,{children:"Roles"})]})}),e.jsx(_t,{children:C.map(k=>{var P,z;const R=k.roles||[],_=k.user,O=(_==null?void 0:_.id)===((P=f==null?void 0:f.active_signin)==null?void 0:P.user_id);return e.jsxs(We,{children:[e.jsx(vl,{children:e.jsxs("div",{children:[e.jsx(nx,{children:_!=null&&_.profile_picture_url?e.jsx("img",{src:_.profile_picture_url,alt:`${_.first_name||""} ${_.last_name||""}`,style:{width:"100%",height:"100%",objectFit:"cover"}}):j(_==null?void 0:_.first_name,_==null?void 0:_.last_name)||"?"}),e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"14px",fontWeight:500,color:"var(--color-foreground)"},children:(()=>{var M;if(!_)return"Unknown User";const T=`${_.first_name||""} ${_.last_name||""}`.trim();return T||((M=_.primary_email_address)==null?void 0:M.email)||"Unknown User"})()}),O&&e.jsx("span",{style:{fontSize:"12px",padding:"2px 8px",background:"var(--color-background-alt)",borderRadius:"4px",color:"var(--color-secondary-text)"},children:"You"})]}),e.jsx("div",{style:{fontSize:"13px",color:"var(--color-secondary-text)"},children:(z=_==null?void 0:_.primary_email_address)==null?void 0:z.email})]})]})}),e.jsx(Le,{children:new Date(k.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),e.jsx(Ct,{children:e.jsx("div",{style:{position:"relative"},children:e.jsxs(nt,{children:[e.jsx(st,{children:e.jsxs(X,{style:{background:"var(--color-background)",border:"1px solid var(--color-border)",borderRadius:"6px",padding:"6px 12px",fontSize:"14px",color:"var(--color-foreground)",display:"flex",alignItems:"center",gap:"4px",minWidth:"120px",justifyContent:"space-between"},children:[e.jsx("span",{children:R.length>0?R[0].name:"No role"}),e.jsx(er,{size:14})]})}),e.jsxs(at,{children:[$.map(T=>{const M=x(k,T.id);return e.jsx(Te,{onClick:()=>w(k,T,M),children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[e.jsx("span",{children:T.name}),M&&e.jsx(Ye,{size:16,color:"var(--color-success)"})]})},T.id)}),e.jsx(on,{}),e.jsx(Te,{$destructive:!0,onClick:()=>h(k),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Vr,{size:16,color:"var(--color-error)"}),e.jsx("span",{children:"Remove Member"})]})})]})]})})})]},k.id)})})]})]})},sx=()=>{const{activeOrganization:t,loading:r,getInvitations:o,getRoles:n,discardInvitation:s,resendInvitation:a}=qe(),{toast:h}=Je(),[f,c]=i.useState(!1),[p,d]=i.useState(""),u=i.useRef(null),{data:g=[],isLoading:m,mutate:v}=Fe(t?`wacht-api-organizations:${t.id}:invitations`:null,()=>(o==null?void 0:o())||[]),{data:y=[],isLoading:S}=Fe(t?`wacht-api-organizations:${t.id}:roles`:null,()=>(n==null?void 0:n())||[]),E=y,b=i.useMemo(()=>p?g.filter(j=>j.email.toLowerCase().includes(p.toLowerCase())):g,[g,p]),$=()=>{h("Invitation sent successfully","info"),v(),c(!1)},C=async j=>{try{await s(j),v(),h("Invitation cancelled successfully","info")}catch(x){const I=x.message||"Failed to cancel invitation. Please try again.";h(I,"error")}},w=async j=>{try{await a(j),h("Invitation resent successfully","info")}catch(x){const I=x.message||"Failed to resend invitation. Please try again.";h(I,"error")}};return r||m||S?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ee,{})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:"24px",display:"flex",justifyContent:"space-between",alignItems:"center",gap:"16px"},children:[e.jsx("div",{style:{flex:1},children:e.jsx(wt,{value:p,onChange:d,placeholder:"Search invitations..."})}),e.jsx(X,{ref:u,onClick:()=>c(!f),style:{background:"var(--color-primary)",color:"white",border:"none",padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,whiteSpace:"nowrap",height:"36px",width:"auto"},children:"Invite Members"})]}),f&&e.jsx(xl,{onClose:()=>c(!1),onSuccess:$,roles:E,triggerRef:u}),b.length===0?e.jsx(et,{title:p?"No invitations match your search":"No pending invitations",description:"Invite new members to your organization."}):e.jsxs(jt,{children:[e.jsx(kt,{children:e.jsxs(We,{children:[e.jsx(ze,{children:"Email"}),e.jsx(ze,{children:"Role"}),e.jsx(ze,{children:"Invited"}),e.jsx(ze,{})]})}),e.jsx(_t,{children:b.map(j=>{var x;return e.jsxs(We,{children:[e.jsx(Le,{children:j.email}),e.jsx(Le,{children:((x=j.initial_organization_role)==null?void 0:x.name)||"No role"}),e.jsx(Le,{children:new Date(j.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),e.jsx(Ct,{children:e.jsx("div",{style:{position:"relative"},children:e.jsxs(nt,{children:[e.jsx(st,{children:e.jsx(Sa,{children:"•••"})}),e.jsxs(at,{children:[e.jsx(Te,{onClick:()=>w(j),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Wr,{size:16,color:"var(--color-muted)"}),e.jsx("span",{children:"Resend Invitation"})]})}),e.jsx(Te,{$destructive:!0,onClick:()=>C(j),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Vr,{size:16,color:"var(--color-error)"}),e.jsx("span",{children:"Cancel Invitation"})]})})]})]})})})]},j.id)})})]})]})},ix=()=>{var j;const{activeOrganization:t,loading:r,getRoles:o,removeRole:n}=qe(),{deployment:s}=ve(),[a,h]=i.useState({isOpen:!1}),[f,c]=i.useState(null),[p,d]=i.useState(null),[u,g]=i.useState(""),[m,v]=i.useState(null),y=i.useRef(null),{data:S=[],isLoading:E,mutate:b}=Fe(t?`wacht-api-organizations:${t.id}:roles`:null,()=>(o==null?void 0:o())||[]),$=i.useMemo(()=>u?S.filter(x=>x.name.toLowerCase().includes(u.toLowerCase())):S,[S,u]),C=async x=>{try{x.id?(await new Promise(I=>setTimeout(I,1e3)),c({text:"Role updated successfully",type:"success"})):(await new Promise(I=>setTimeout(I,1e3)),c({text:"Role created successfully",type:"success"})),h({isOpen:!1}),b()}catch(I){const k=(I==null?void 0:I.message)||(x.id?"Failed to update role. Please try again.":"Failed to create role. Please try again.");x.id?c({text:k,type:"error"}):c({text:k,type:"error"})}finally{setTimeout(()=>c(null),3e3)}},w=async x=>{try{await n(x),b()}catch{}finally{setTimeout(()=>c(null),3e3)}};return r||E?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ee,{})}):e.jsxs(e.Fragment,{children:[f&&e.jsxs("div",{style:{marginBottom:"20px",padding:"8px",background:f.type==="success"?"var(--color-success-background)":"var(--color-error-background)",color:f.type==="success"?"var(--color-success)":"var(--color-error)",borderRadius:"8px",display:"flex",alignItems:"center",gap:"8px"},children:[f.type==="success"?"✓":e.jsx(dt,{size:16}),f.text]}),e.jsxs(bl,{children:[e.jsx(wt,{placeholder:"Search roles",onChange:g,value:u}),((j=s==null?void 0:s.b2b_settings)==null?void 0:j.custom_org_role_enabled)&&e.jsxs("div",{children:[e.jsx(X,{ref:y,onClick:()=>h({isOpen:!a.isOpen}),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"Add role"}),a.isOpen&&!a.role&&e.jsx(Fs,{role:a.role,onClose:()=>h({isOpen:!1}),onSuccess:C,triggerRef:y})]})]}),$.length===0?e.jsx(et,{title:u?"No roles match your search":"No roles defined yet. Create your first role to get started.",description:"Create a role to get started"}):e.jsxs(jt,{children:[e.jsx(kt,{children:e.jsxs(We,{children:[e.jsx(ze,{children:"Role"}),e.jsx(ze,{children:"Permissions"}),e.jsx(ze,{})]})}),e.jsx(_t,{children:$.map(x=>{var I;return e.jsxs(We,{children:[e.jsx(Le,{children:e.jsx("div",{style:{fontSize:"14px",fontWeight:500},children:x.name})}),e.jsx(Le,{style:{color:"var(--color-secondary-text)"},children:x.permissions.join(", ")}),e.jsx(Ct,{children:e.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center",justifyContent:"flex-end",position:"relative"},children:[e.jsxs(nt,{open:p===x.id,openChange:k=>d(k?x.id:null),children:[e.jsx(st,{children:e.jsx(Sa,{disabled:!x.organization_id,"data-role-dropdown-trigger":x.id,children:"•••"})}),e.jsxs(at,{children:[e.jsx(Te,{onClick:()=>{d(null),h({isOpen:!0,role:x})},children:"Edit Role"}),e.jsx(Te,{$destructive:!0,onClick:()=>{d(null),v(x.id)},children:"Remove Role"})]})]}),m===x.id&&e.jsx(Hr,{title:"Are you sure you want to delete this role?",onConfirm:()=>w(x),onCancel:()=>v(null)}),a.isOpen&&((I=a.role)==null?void 0:I.id)===x.id&&e.jsx(Fs,{role:a.role,onClose:()=>{h({isOpen:!1}),d(null)},onSuccess:C})]})})]},x.id)})})]})]})},yl=()=>{const{loading:t,activeOrganization:r}=qe(),[o,n]=i.useState("general"),[s,a]=i.useState(null),[h,f]=i.useState("info"),c=i.useCallback((p,d="info")=>{a(p),f(d),setTimeout(()=>a(null),3e3)},[a]);return t?e.jsx(Nn,{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(Ee,{})}):r?e.jsx(Bs,{children:e.jsx(gl.Provider,{value:{screen:null,setScreen:()=>{},toast:c},children:e.jsxs(Nn,{children:[e.jsx(Jm,{children:e.jsxs(ex,{children:[e.jsx(dr,{$isActive:o==="general",onClick:()=>n("general"),children:e.jsxs(ur,{children:[e.jsx(Kt,{size:16}),"General"]})}),e.jsx(dr,{$isActive:o==="domains",onClick:()=>n("domains"),children:e.jsxs(ur,{children:[e.jsx(Vp,{size:16}),"Domains"]})}),e.jsx(dr,{$isActive:o==="members",onClick:()=>n("members"),children:e.jsxs(ur,{children:[e.jsx(Bo,{size:16}),"Members"]})}),e.jsx(dr,{$isActive:o==="invitations",onClick:()=>n("invitations"),children:e.jsxs(ur,{children:[e.jsx(Wr,{size:16}),"Invitations"]})}),e.jsx(dr,{$isActive:o==="roles",onClick:()=>n("roles"),children:e.jsxs(ur,{children:[e.jsx(wr,{size:16}),"Roles"]})}),e.jsx(dr,{$isActive:o==="sso",onClick:()=>n("sso"),children:e.jsxs(ur,{children:[e.jsx(wr,{size:16}),"SSO"]})})]})}),e.jsxs(tx,{children:[o==="general"&&e.jsx(rx,{}),o==="domains"&&e.jsx(ox,{}),o==="members"&&e.jsx(ax,{}),o==="invitations"&&e.jsx(sx,{}),o==="roles"&&e.jsx(ix,{}),o==="sso"&&e.jsx(Qm,{})]}),s&&e.jsx("div",{style:{position:"absolute",bottom:"20px",right:"20px",maxWidth:"360px",background:"var(--color-input-background)",border:"1px solid var(--color-border)",borderRadius:"8px",padding:"12px 16px",boxShadow:"0 4px 12px var(--color-shadow)",animation:"slideUp 0.3s ease-out",wordBreak:"break-word"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[h==="error"?e.jsx(dt,{size:16,color:"var(--color-error)"}):e.jsx(Ye,{size:16,color:"var(--color-success)"}),e.jsx("span",{style:{fontSize:"14px",color:"var(--color-foreground)"},children:s})]})})]})})}):e.jsx(Bs,{children:e.jsx(Nn,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:"40px 24px",textAlign:"center"},children:[e.jsx("div",{style:{width:"80px",height:"80px",borderRadius:"50%",background:"var(--color-input-background)",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:"24px",border:"2px dashed var(--color-border)"},children:e.jsx(Nr,{size:32,color:"var(--color-muted)"})}),e.jsx("h3",{style:{fontSize:"18px",fontWeight:600,color:"var(--color-foreground)",margin:"0 0 8px 0"},children:"No Organization Selected"}),e.jsx(zl,{})]})})})},cx=({isOpen:t,onClose:r,title:o,showHeader:n,headerContent:s,footerContent:a,customContent:h,children:f,showCloseButton:c})=>e.jsx(_e,{isOpen:t,onClose:r,children:e.jsx(_e.Overlay,{children:e.jsxs(_e.Content,{style:{width:"900px",maxWidth:"100%"},children:[n&&e.jsx(_e.Header,{showCloseButton:c,children:s||o}),h||f||e.jsx(yl,{}),a&&e.jsx(_e.Footer,{children:a})]})})}),lx=l.div`
|
|
2765
2765
|
display: flex;
|
|
2766
2766
|
height: 100%;
|
|
2767
2767
|
min-height: 400px;
|
|
@@ -2836,7 +2836,7 @@ cursor: pointer;
|
|
|
2836
2836
|
line-height: 1.4;
|
|
2837
2837
|
`,bx=l.div`
|
|
2838
2838
|
flex: 1;
|
|
2839
|
-
`,
|
|
2839
|
+
`,Fn=l.div`
|
|
2840
2840
|
margin-bottom: 20px;
|
|
2841
2841
|
`,Bn=l.label`
|
|
2842
2842
|
display: block;
|
|
@@ -3052,7 +3052,7 @@ cursor: pointer;
|
|
|
3052
3052
|
align-items: center;
|
|
3053
3053
|
justify-content: center;
|
|
3054
3054
|
color: var(--color-primary);
|
|
3055
|
-
`,$a=({organizationId:t,onSuccess:r,onCancel:o,onCreateOrganization:n})=>{var z;const[s,a]=i.useState(""),[h,f]=i.useState(""),[c,p]=i.useState(),[d,u]=i.useState(null),[g,m]=i.useState(!1),[v,y]=i.useState(!1),[S,E]=i.useState(t),b=i.useRef(null),$=i.useRef(null),{toast:C}=Je(),{createWorkspace:w}=yt(),{organizationMemberships:j}=bt(),x=(z=j==null?void 0:j.find(T=>T.organization.id===S))==null?void 0:z.organization,I=T=>{if(T.target.files&&T.target.files[0]){const M=T.target.files[0];if(M.size>2*1024*1024){C("File size cannot exceed 2MB","error");return}if(!M.type.startsWith("image/")){C("Please select a valid image file","error");return}d&&URL.revokeObjectURL(d),p(M),u(URL.createObjectURL(M))}},k=()=>{var T;(T=b.current)==null||T.click()},R=T=>T.split(" ").map(M=>M[0]).join("").toUpperCase().slice(0,2)||"W",_=T=>T.trim().replace(/[<>\"'&]/g,""),O=T=>T.length>=2&&T.length<=100&&/^[a-zA-Z0-9\s_.-]+$/.test(T),P=async()=>{const T=_(s),M=_(h);if(!T||!S){C("Please enter a workspace name","error");return}if(!O(T)){C("Workspace name must be 2-100 characters and contain only letters, numbers, spaces, dots, underscores, and hyphens","error");return}if(M.length>500){C("Description must be less than 500 characters","error");return}m(!0);try{const
|
|
3055
|
+
`,$a=({organizationId:t,onSuccess:r,onCancel:o,onCreateOrganization:n})=>{var z;const[s,a]=i.useState(""),[h,f]=i.useState(""),[c,p]=i.useState(),[d,u]=i.useState(null),[g,m]=i.useState(!1),[v,y]=i.useState(!1),[S,E]=i.useState(t),b=i.useRef(null),$=i.useRef(null),{toast:C}=Je(),{createWorkspace:w}=yt(),{organizationMemberships:j}=bt(),x=(z=j==null?void 0:j.find(T=>T.organization.id===S))==null?void 0:z.organization,I=T=>{if(T.target.files&&T.target.files[0]){const M=T.target.files[0];if(M.size>2*1024*1024){C("File size cannot exceed 2MB","error");return}if(!M.type.startsWith("image/")){C("Please select a valid image file","error");return}d&&URL.revokeObjectURL(d),p(M),u(URL.createObjectURL(M))}},k=()=>{var T;(T=b.current)==null||T.click()},R=T=>T.split(" ").map(M=>M[0]).join("").toUpperCase().slice(0,2)||"W",_=T=>T.trim().replace(/[<>\"'&]/g,""),O=T=>T.length>=2&&T.length<=100&&/^[a-zA-Z0-9\s_.-]+$/.test(T),P=async()=>{const T=_(s),M=_(h);if(!T||!S){C("Please enter a workspace name","error");return}if(!O(T)){C("Workspace name must be 2-100 characters and contain only letters, numbers, spaces, dots, underscores, and hyphens","error");return}if(M.length>500){C("Description must be less than 500 characters","error");return}m(!0);try{const N=await w(S,T,c,M);r==null||r(N)}catch(N){const H=N.message||"Failed to create workspace. Please try again.";C(H,"error")}finally{m(!1)}};return i.useEffect(()=>()=>{d&&URL.revokeObjectURL(d)},[d]),i.useEffect(()=>{const T=M=>{$.current&&!$.current.contains(M.target)&&y(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]),e.jsx(ue,{children:e.jsxs(lx,{children:[e.jsxs(dx,{children:[e.jsxs(wl,{hasImage:!!d,onClick:k,children:[d?e.jsx(px,{src:d,alt:"Workspace logo"}):e.jsx(hx,{children:R(s||"W")}),e.jsx(Sx,{children:e.jsx($x,{children:"Upload Logo"})})]}),e.jsx(Cx,{type:"file",ref:b,onChange:I,accept:"image/png, image/jpeg, image/gif",disabled:g}),e.jsx(fx,{children:"Create new workspace"}),e.jsx(gx,{children:"Workspaces are used to organize your projects and team members into logical groups."})]}),e.jsxs(ux,{children:[e.jsxs(mx,{children:[e.jsx(xx,{children:"Choose your workspace name"}),e.jsx(vx,{children:"Enter a name for your new workspace. This will be visible to all members."})]}),e.jsxs(bx,{children:[e.jsxs(Fn,{children:[e.jsx(Bn,{children:"Organization"}),e.jsxs(zx,{ref:$,children:[e.jsxs(Ex,{type:"button",onClick:()=>y(!v),disabled:g,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Ws,{children:x!=null&&x.image_url?e.jsx(Vs,{src:x.image_url,alt:x.name}):R((x==null?void 0:x.name)||"O").charAt(0)}),e.jsx("span",{children:(x==null?void 0:x.name)||"Select organization"})]}),e.jsx(er,{size:16,style:{color:"var(--color-secondary-text)"}})]}),v&&e.jsxs(Px,{children:[j==null?void 0:j.map(T=>e.jsxs(jl,{onClick:()=>{E(T.organization.id),y(!1)},children:[e.jsx(Ws,{children:T.organization.image_url?e.jsx(Vs,{src:T.organization.image_url,alt:T.organization.name}):R(T.organization.name).charAt(0)}),e.jsx("span",{children:T.organization.name})]},T.organization.id)),e.jsxs(Rx,{onClick:()=>{y(!1),n==null||n()},children:[e.jsx(Ix,{children:e.jsx(Ke,{size:12})}),e.jsx("span",{children:"Create new organization"})]})]})]})]}),e.jsxs(Fn,{children:[e.jsx(Bn,{children:"Workspace name"}),e.jsx(yx,{type:"text",value:s,onChange:T=>a(T.target.value),placeholder:"Workspace Name",disabled:g})]}),e.jsxs(Fn,{children:[e.jsx(Bn,{children:"Description (optional)"}),e.jsx(wx,{value:h,onChange:T=>f(T.target.value),placeholder:"What is this workspace for?",disabled:g})]})]}),e.jsxs(jx,{children:[o?e.jsxs(kx,{onClick:o,disabled:g,children:[e.jsx(Ur,{size:16}),"Back"]}):e.jsx("div",{}),e.jsx(_x,{onClick:P,disabled:g||!s.trim(),children:g?"Creating...":"Create"})]})]})]})})},kl=({isOpen:t,onClose:r,onCreated:o,organizationId:n})=>{const[s,a]=i.useState(!1),[h,f]=i.useState(n),{refetch:c,organizationMemberships:p}=bt(),d=()=>{o==null||o(),r==null||r()},u=()=>{a(!0)},g=async()=>{await c(),setTimeout(()=>{if(p&&p.length>0){const m=p[p.length-1];f(m.organization.id)}a(!1)},500)};return e.jsx(ue,{children:e.jsx(_e,{isOpen:t,onClose:r,children:e.jsx(_e.Overlay,{children:e.jsx(_e.Content,{style:{width:"900px",maxWidth:"90vw"},children:e.jsx(_e.Body,{style:{padding:0},children:s?e.jsx(nn,{onSuccess:g,onCancel:()=>a(!1)}):e.jsx($a,{organizationId:h||n,onSuccess:d,onCancel:r,onCreateOrganization:u})})})})})})},Tx=l.div`
|
|
3056
3056
|
position: fixed;
|
|
3057
3057
|
width: 360px;
|
|
3058
3058
|
max-width: calc(100vw - 48px);
|
|
@@ -3101,7 +3101,7 @@ cursor: pointer;
|
|
|
3101
3101
|
color: var(--color-foreground);
|
|
3102
3102
|
background: var(--color-input-background);
|
|
3103
3103
|
}
|
|
3104
|
-
`,
|
|
3104
|
+
`,Nx=({onClose:t,onSuccess:r,roles:o,createInvitation:n,triggerRef:s})=>{const a=i.useRef(null),[h,f]=i.useState(""),[c,p]=i.useState(null),[d,u]=i.useState(!1),[g,m]=i.useState(!1),[v,y]=i.useState({top:0,left:0}),{toast:S}=Je(),E=o.map(C=>({value:C.id,label:C.name}));i.useEffect(()=>{m(!0);const C=setTimeout(()=>{if(!a.current||!(s!=null&&s.current))return;const I=s.current;if(I){const k=I.getBoundingClientRect(),R=360,_=250,O=8;let P=0,z=0;const T=window.innerHeight-k.bottom,M=k.top;T>=_+O?(P=k.bottom+O,z=k.right-R,z<O&&(z=k.left,z+R>window.innerWidth-O&&(z=(window.innerWidth-R)/2))):M>=_+O?(P=k.top-_-O,z=k.right-R,z<O&&(z=k.left,z+R>window.innerWidth-O&&(z=(window.innerWidth-R)/2))):(P=k.bottom+O,z=k.right-R,z<O&&(z=k.left)),y({top:P,left:z})}},10),w=I=>{a.current&&!a.current.contains(I.target)&&(t==null||t())},j=I=>{I.key==="Escape"&&(t==null||t())},x=setTimeout(()=>{document.addEventListener("mousedown",w),document.addEventListener("keydown",j)},100);return()=>{clearTimeout(C),clearTimeout(x),document.removeEventListener("mousedown",w),document.removeEventListener("keydown",j)}},[t,s]);const b=C=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(C),$=async()=>{const C=h.trim().toLowerCase();if(!(!C||!c)){if(!b(C)){S("Please enter a valid email address","error");return}if(C.length>320){S("Email address is too long","error");return}u(!0);try{await n(C,c.id),r==null||r()}catch(w){const j=w.message||"Failed to send invitation. Please try again.";S(j,"error")}finally{u(!1)}}};return g?e.jsxs(Tx,{ref:a,style:{top:`${v.top}px`,left:`${v.left}px`,visibility:v.top>0?"visible":"hidden"},onClick:C=>C.stopPropagation(),role:"dialog","aria-labelledby":"invite-workspace-member-title","aria-modal":"true",children:[e.jsxs(Ox,{children:[e.jsx(Mx,{id:"invite-workspace-member-title",children:"Invite Member"}),e.jsx(Dx,{onClick:t,"aria-label":"Close invite member dialog",children:e.jsx(Ze,{size:16})})]}),e.jsx(Lx,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:[e.jsxs(ge,{children:[e.jsx(he,{children:"Email Address"}),e.jsx(pe,{type:"email",placeholder:"colleague@company.com",value:h,onChange:C=>f(C.target.value),autoFocus:!0,"aria-label":"Email address for workspace invitation","aria-describedby":"workspace-email-help"})]}),e.jsxs(ge,{children:[e.jsx(he,{children:"Role"}),e.jsx(Ca,{options:E,value:c==null?void 0:c.id,onChange:C=>p(o.find(w=>w.id===C)),placeholder:"Select a role","aria-label":"Select role for invited workspace member"})]})]})}),e.jsxs(Ax,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto"},children:"Cancel"}),e.jsx(X,{onClick:$,disabled:!h||!c||d,style:{width:"auto"},children:d?e.jsxs(e.Fragment,{children:[e.jsx(Ee,{size:14})," Sending..."]}):"Send Invitation"})]})]}):null},Fx=l.div`
|
|
3105
3105
|
position: fixed;
|
|
3106
3106
|
width: 360px;
|
|
3107
3107
|
max-width: calc(100vw - 48px);
|
|
@@ -3150,7 +3150,7 @@ cursor: pointer;
|
|
|
3150
3150
|
color: var(--color-foreground);
|
|
3151
3151
|
background: var(--color-input-background);
|
|
3152
3152
|
}
|
|
3153
|
-
`,Gs=({onClose:t,onSuccess:r,role:o,triggerRef:n})=>{var C;const s=i.useRef(null),[a,h]=i.useState((o==null?void 0:o.name)||""),[f,c]=i.useState((o==null?void 0:o.permissions)||[]),[p,d]=i.useState(!1),{deployment:u}=ve(),[g,m]=i.useState(!1),[v,y]=i.useState({top:0,left:0}),{toast:S}=Je(),E=!!o,b=(((C=u==null?void 0:u.b2b_settings)==null?void 0:C.workspace_permissions)||[]).map(w=>({value:w,label:w}));i.useEffect(()=>{m(!0);const w=setTimeout(()=>{if(!s.current||!(n!=null&&n.current))return;const k=n.current;if(k){const R=k.getBoundingClientRect(),_=360,O=250,P=8;let z=0,T=0;const M=window.innerHeight-R.bottom,
|
|
3153
|
+
`,Gs=({onClose:t,onSuccess:r,role:o,triggerRef:n})=>{var C;const s=i.useRef(null),[a,h]=i.useState((o==null?void 0:o.name)||""),[f,c]=i.useState((o==null?void 0:o.permissions)||[]),[p,d]=i.useState(!1),{deployment:u}=ve(),[g,m]=i.useState(!1),[v,y]=i.useState({top:0,left:0}),{toast:S}=Je(),E=!!o,b=(((C=u==null?void 0:u.b2b_settings)==null?void 0:C.workspace_permissions)||[]).map(w=>({value:w,label:w}));i.useEffect(()=>{m(!0);const w=setTimeout(()=>{if(!s.current||!(n!=null&&n.current))return;const k=n.current;if(k){const R=k.getBoundingClientRect(),_=360,O=250,P=8;let z=0,T=0;const M=window.innerHeight-R.bottom,N=R.top;M>=O+P?(z=R.bottom+P,T=R.right-_,T<P&&(T=R.left,T+_>window.innerWidth-P&&(T=(window.innerWidth-_)/2))):N>=O+P?(z=R.top-O-P,T=R.right-_,T<P&&(T=R.left,T+_>window.innerWidth-P&&(T=(window.innerWidth-_)/2))):(z=R.bottom+P,T=R.right-_,T<P&&(T=R.left)),y({top:z,left:T})}},10),j=k=>{s.current&&!s.current.contains(k.target)&&(t==null||t())},x=k=>{k.key==="Escape"&&(t==null||t())},I=setTimeout(()=>{document.addEventListener("mousedown",j),document.addEventListener("keydown",x)},100);return()=>{clearTimeout(w),clearTimeout(I),document.removeEventListener("mousedown",j),document.removeEventListener("keydown",x)}},[t,n]);const $=async()=>{if(a.trim()){d(!0);try{const w={id:o==null?void 0:o.id,name:a.trim(),permissions:f};r==null||r(w)}catch(w){const j=w.message||"Failed to save role. Please try again.";S(j,"error")}finally{d(!1)}}};return g?e.jsxs(Fx,{ref:s,style:{top:`${v.top}px`,left:`${v.left}px`,visibility:v.top>0?"visible":"hidden"},onClick:w=>w.stopPropagation(),children:[e.jsxs(Bx,{children:[e.jsx(Ux,{children:E?"Edit Role":"Add Role"}),e.jsx(Gx,{onClick:t,children:e.jsx(Ze,{size:16})})]}),e.jsx(Wx,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:[e.jsxs(ge,{children:[e.jsx(he,{children:"Role Name"}),e.jsx(pe,{type:"text",value:a,onChange:w=>h(w.target.value),placeholder:"Enter role name",autoFocus:!0})]}),e.jsxs(ge,{children:[e.jsx(he,{children:"Permissions"}),e.jsx(il,{options:b,value:f,onChange:c,placeholder:"Select permissions"})]})]})}),e.jsxs(Vx,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto"},children:"Cancel"}),e.jsx(X,{onClick:$,disabled:!a.trim()||p,style:{width:"auto"},children:p?"Saving...":E?"Update":"Create"})]})]}):null},Sr=i.createContext(void 0),Tt=()=>{const t=i.useContext(Sr);if(!t)throw new Error("useScreenContext must be used within a ScreenProvider");return t},Hx=l.div`
|
|
3154
3154
|
* {
|
|
3155
3155
|
box-sizing: border-box;
|
|
3156
3156
|
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
@@ -3316,10 +3316,10 @@ cursor: pointer;
|
|
|
3316
3316
|
opacity: 0.5;
|
|
3317
3317
|
cursor: not-allowed;
|
|
3318
3318
|
}
|
|
3319
|
-
`,o0=()=>{const{activeWorkspace:t,loading:r,getRoles:o}=Rt(),{workspaces:n}=yt(),{client:s}=
|
|
3319
|
+
`,o0=()=>{const{activeWorkspace:t,loading:r,getRoles:o}=Rt(),{workspaces:n}=yt(),{client:s}=Ne(),a=n==null?void 0:n.find(O=>O.id===(t==null?void 0:t.id)),[h,f]=i.useState(!0),[c,p]=i.useState(!0),[d,u]=i.useState(""),[g,m]=i.useState(""),[v,y]=i.useState([]),[S,E]=i.useState([]),[b,$]=i.useState(!1),C=i.useRef(null),w=i.useCallback(async()=>{if(!t||!a)return[];try{return(await G(await s(`/organizations/${a.organization.id}/invitations`,{method:"GET"}))).data.filter(z=>z.workspace_id===t.id)}catch{return[]}},[s,t,a]),j=i.useCallback(async(O,P)=>{if(!t||!a)return;const T=(await G(await s(`/organizations/${a.organization.id}/roles`,{method:"GET"}))).data,M=T.find(H=>!H.organization_id)||T[0];return(await G(await s(`/organizations/${a.organization.id}/invitations`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:O,role_id:M==null?void 0:M.id,workspace_id:t.id,workspace_role_id:P})}))).data},[s,t,a]),x=i.useCallback(async O=>!t||!a?void 0:(await G(await s(`/organizations/${a.organization.id}/invitations/${O}/remove`,{method:"POST"}))).data,[s,t,a]);i.useEffect(()=>{if(!t)return;(async()=>{f(!0),p(!0);try{const[P,z]=await Promise.all([o(),w()]);E(P),y(z)}catch{}finally{f(!1),p(!1)}})()},[t==null?void 0:t.id]);const I=async O=>{try{await x(O.id);const P=await w();y(P)}catch{}},k=async O=>{var P;try{await x(O.id),await j(O.email,O.workspace_role_id||((P=O.initial_workspace_role)==null?void 0:P.id)||O.role_id);const z=await w();y(z),m("Invitation resent successfully"),setTimeout(()=>m(""),3e3)}catch{}},R=async()=>{$(!1);const O=await w();y(O),m("Invitation sent successfully"),setTimeout(()=>m(""),3e3)},_=i.useMemo(()=>d?v.filter(O=>(O.email||"").toLowerCase().includes(d.toLowerCase())):v,[v,d]);return r||h||c?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ee,{})}):e.jsxs(e.Fragment,{children:[g&&e.jsxs("div",{style:{marginBottom:"16px",padding:"12px 16px",background:"var(--color-success-background)",color:"var(--color-success)",borderRadius:"6px",fontSize:"14px"},children:["✓ ",g]}),e.jsxs(za,{children:[e.jsx(wt,{value:d,onChange:u,placeholder:"Search Invitation"}),e.jsxs("div",{children:[e.jsx(X,{ref:C,onClick:()=>$(!b),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"Invite Members"}),b&&e.jsx(Nx,{onClose:()=>$(!1),onSuccess:R,roles:S,createInvitation:j,triggerRef:C})]})]}),e.jsx("div",{children:_.length===0?e.jsx(et,{title:d?"No invitations match your search":"No pending invitations",description:"Invite new members to your workspace."}):e.jsx("div",{style:{borderTop:"1px solid var(--color-border)"},children:_.map(O=>{var P,z,T;return e.jsxs(Qx,{children:[e.jsx(Kx,{children:e.jsxs(Jx,{children:[e.jsx(e0,{children:O.email}),e.jsx(t0,{children:((P=O.initial_workspace_role)==null?void 0:P.name)||((z=O.initial_organization_role)==null?void 0:z.name)||((T=O.role)==null?void 0:T.name)})]})}),e.jsx(r0,{children:e.jsxs(nt,{children:[e.jsx(st,{children:e.jsx(_l,{children:"•••"})}),e.jsxs(at,{children:[e.jsx(Te,{onClick:()=>k(O),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Wr,{size:16,color:"var(--color-muted)"}),e.jsx("span",{children:"Resend Invitation"})]})}),e.jsx(Te,{$destructive:!0,onClick:()=>I(O),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(rn,{size:16,color:"var(--color-error)"}),e.jsx("span",{children:"Cancel Invitation"})]})})]})]})})]},O.id)})})})]})},n0=()=>{const{activeWorkspace:t,loading:r,getMembers:o,getRoles:n,removeMember:s,addMemberRole:a,removeMemberRole:h}=Rt(),{session:f}=Be(),{toast:c}=i.useContext(Sr)||{},[p,d]=i.useState(""),{data:u=[],isLoading:g,mutate:m}=Fe(t?`wacht-api-workspaces:${t.id}:members`:null,()=>o()||[]),{data:v=[],isLoading:y}=Fe(t?`wacht-api-workspaces:${t.id}:roles`:null,()=>n()||[]),S=v,E=i.useMemo(()=>p?u.filter(j=>{var O;const x=j.public_user_data;if(!x)return!1;const I=x.first_name||"",k=x.last_name||"",R=((O=x.primary_email_address)==null?void 0:O.email)||"";return`${I} ${k}`.trim().toLowerCase().includes(p.toLowerCase())||R.toLowerCase().includes(p.toLowerCase())}):u,[u,p]),b=async j=>{try{await s(j),c==null||c("Member removed successfully","info"),m()}catch{c==null||c("Failed to remove member","error")}},$=async(j,x,I)=>{try{I?(await h(j,x),c==null||c("Role removed successfully","info")):(await a(j,x),c==null||c("Role added successfully","info")),m()}catch{c==null||c("Failed to toggle role","error"),c==null||c("Failed to update role","error")}},C=(j="",x="")=>`${j[0]||""}${x[0]||""}`.toUpperCase(),w=(j,x)=>{var I;return((I=j.roles)==null?void 0:I.some(k=>k.id===x))||!1};return r||g||y?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ee,{})}):e.jsxs(e.Fragment,{children:[e.jsx(za,{children:e.jsx(wt,{value:p,onChange:d,placeholder:"Search members..."})}),E.length===0?e.jsx(et,{title:p?"No members match your search":"No members yet",description:"Invite members to your workspace to get started."}):e.jsxs(jt,{children:[e.jsx(kt,{children:e.jsxs(We,{children:[e.jsx(ze,{children:"Member"}),e.jsx(ze,{children:"Joined"}),e.jsx(ze,{children:"Role"})]})}),e.jsx(_t,{children:E.map(j=>{var R,_;const x=j.public_user_data,I=j.roles||[],k=(x==null?void 0:x.id)===((R=f==null?void 0:f.active_signin)==null?void 0:R.user_id);return e.jsxs(We,{children:[e.jsx(vl,{children:e.jsxs("div",{children:[e.jsx(Xx,{children:x&&x.profile_picture_url?e.jsx("img",{src:x.profile_picture_url,alt:`${x.first_name||""} ${x.last_name||""}`,style:{width:"100%",height:"100%",objectFit:"cover"}}):C(x==null?void 0:x.first_name,x==null?void 0:x.last_name)||"?"}),e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"14px",fontWeight:500,color:"var(--color-foreground)"},children:(()=>{var P;if(!x)return"Unknown User";const O=`${x.first_name||""} ${x.last_name||""}`.trim();return O||((P=x.primary_email_address)==null?void 0:P.email)||"Unknown User"})()}),k&&e.jsx("span",{style:{fontSize:"12px",padding:"2px 8px",background:"var(--color-background-alt)",borderRadius:"4px",color:"var(--color-secondary-text)"},children:"You"})]}),e.jsx("div",{style:{fontSize:"13px",color:"var(--color-secondary-text)"},children:(_=x==null?void 0:x.primary_email_address)==null?void 0:_.email})]})]})}),e.jsx(Le,{children:new Date(j.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),e.jsx(Ct,{children:e.jsxs(nt,{children:[e.jsx(st,{children:e.jsxs(X,{style:{background:"var(--color-background)",border:"1px solid var(--color-border)",borderRadius:"6px",padding:"8px 12px",fontSize:"14px",color:"var(--color-foreground)",display:"flex",alignItems:"center",gap:"4px",minWidth:"120px",justifyContent:"space-between"},children:[e.jsx("span",{children:I.length>0?I[0].name:"No role"}),e.jsx(er,{size:14})]})}),e.jsxs(at,{children:[S.map(O=>{const P=w(j,O.id);return e.jsx(Te,{onClick:()=>$(j.id,O.id,P),children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[e.jsx("span",{children:O.name}),P&&e.jsx(Ye,{size:16,color:"var(--color-success)"})]})},O.id)}),e.jsx(on,{}),e.jsx(Te,{$destructive:!0,onClick:()=>b(j.id),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(rn,{size:16,color:"var(--color-error)"}),e.jsx("span",{children:"Remove Member"})]})})]})]})})]},j.id)})})]})]})},a0=()=>{var se,te;const{activeWorkspace:t,loading:r,updateWorkspace:o}=Rt(),{deleteWorkspace:n}=yt(),{deployment:s}=ve(),{toast:a}=i.useContext(Sr)||{},[h,f]=i.useState((t==null?void 0:t.name)||""),[c,p]=i.useState((t==null?void 0:t.description)||""),[d,u]=i.useState({mfa_required:!1,ip_restrictions:!1,allowed_ips:""}),[g,m]=i.useState(null),[v,y]=i.useState((t==null?void 0:t.image_url)||null),[S,E]=i.useState(!1),[b,$]=i.useState(!1),[C,w]=i.useState(""),[j,x]=i.useState(!1),[I,k]=i.useState(!1),R=i.useRef(null),_=i.useRef(null);if(i.useEffect(()=>{var U;t&&(f(t.name||""),p(t.description||""),y(t.image_url||null),u({mfa_required:t.enforce_2fa||!1,ip_restrictions:t.enable_ip_restriction||!1,allowed_ips:((U=t.whitelisted_ips)==null?void 0:U.join(`
|
|
3320
3320
|
`))||""}))},[t]),r||!t)return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ee,{})});const O=U=>{var K;if((K=U.target.files)!=null&&K[0]){const ee=U.target.files[0];m(ee),y(URL.createObjectURL(ee)),setTimeout(()=>z(),100)}},P=()=>{R.current&&R.current.click()},z=i.useCallback(async()=>{if(!(!t||b))try{$(!0);const U={};g&&(U.image=g,m(null)),h!==t.name&&(U.name=h),c!==t.description&&(U.description=c),d.mfa_required!==t.enforce_2fa&&(U.enforce_2fa=d.mfa_required),d.ip_restrictions!==t.enable_ip_restriction&&(U.enable_ip_restriction=d.ip_restrictions);const K=(t.whitelisted_ips||[]).join(`
|
|
3321
3321
|
`);d.allowed_ips!==K&&(U.whitelisted_ips=d.allowed_ips.split(`
|
|
3322
|
-
`).map(ee=>ee.trim()).filter(ee=>ee!=="")),Object.keys(U).length>0&&(await o(U),E(!0),setTimeout(()=>E(!1),3e3))}catch{a==null||a("Failed to auto-save workspace","error")}finally{$(!1)}},[t,o,h,c,g,d,b]),T=i.useCallback(()=>{_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{z()},1e3)},[z]),M=U=>{f(U.target.value),T()},
|
|
3322
|
+
`).map(ee=>ee.trim()).filter(ee=>ee!=="")),Object.keys(U).length>0&&(await o(U),E(!0),setTimeout(()=>E(!1),3e3))}catch{a==null||a("Failed to auto-save workspace","error")}finally{$(!1)}},[t,o,h,c,g,d,b]),T=i.useCallback(()=>{_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{z()},1e3)},[z]),M=U=>{f(U.target.value),T()},N=U=>{p(U.target.value),T()},H=()=>{_.current&&clearTimeout(_.current),z()},L=()=>{_.current&&clearTimeout(_.current),z()},A=async()=>{if(!(!t||C!==t.name))try{x(!0),await n(t),a==null||a("Workspace deleted successfully","info")}catch(U){a==null||a(U.message||"Failed to delete workspace","error")}finally{x(!1),w(""),k(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-2xl)"},children:[e.jsxs("div",{style:{display:"flex",gap:"var(--space-2xl)",alignItems:"center"},children:[e.jsx("div",{style:{flexShrink:0},children:e.jsxs("div",{style:{width:"120px",height:"120px",borderRadius:"50%",border:"2px dashed var(--color-border)",background:v?"transparent":"var(--color-input-background)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"all 0.2s ease"},onClick:P,onMouseEnter:U=>{U.currentTarget.style.borderColor="var(--color-primary)",U.currentTarget.style.transform="scale(1.02)"},onMouseLeave:U=>{U.currentTarget.style.borderColor="var(--color-border)",U.currentTarget.style.transform="scale(1)"},children:[v?e.jsx("img",{src:v,alt:"Workspace Logo",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}):e.jsx(Nr,{size:32,color:"var(--color-muted)"}),e.jsx("input",{type:"file",ref:R,style:{display:"none"},accept:"image/*",onChange:O})]})}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{marginBottom:"var(--space-lg)"},children:[e.jsx("h3",{style:{fontSize:"var(--font-sm)",color:"var(--color-foreground)",margin:"0 0 var(--space-2xs) 0"},children:"Workspace Logo"}),e.jsx("p",{style:{fontSize:"var(--font-xs)",color:"var(--color-secondary-text)",margin:0},children:"Upload an image to represent your workspace"})]}),e.jsxs("div",{style:{display:"flex",gap:"var(--space-sm)",marginBottom:"var(--space-sm)"},children:[e.jsxs(X,{onClick:()=>{var U;return(U=R.current)==null?void 0:U.click()},style:{padding:"var(--space-xs) var(--space-md)",fontSize:"var(--font-xs)",height:"32px",width:"100px",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx(Nr,{size:14}),v?"Change":"Upload"]}),e.jsxs(X,{onClick:()=>{y(null),m(null),R.current&&(R.current.value=""),setTimeout(()=>z(),100)},style:{background:"transparent",color:"var(--color-muted)",border:"1px solid var(--color-border)",padding:"var(--space-xs) var(--space-md)",fontSize:"var(--font-xs)",height:"32px",width:"100px",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx(rn,{size:14}),"Remove"]})]})]})]}),e.jsx("div",{style:{position:"relative",height:"1px",background:"var(--color-divider)",margin:"0"}}),e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:"var(--space-md)"},children:[e.jsx("h3",{style:{fontSize:"var(--font-sm)",color:"var(--color-foreground)",margin:"0 0 var(--space-2xs) 0"},children:"Workspace Details"}),e.jsx("p",{style:{fontSize:"var(--font-xs)",color:"var(--color-secondary-text)",margin:0},children:"Basic information about your workspace"})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-lg)"},children:[e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"name",children:"Workspace Name"}),e.jsx(pe,{id:"name",type:"text",value:h,onChange:M,onBlur:H,placeholder:"Enter workspace name",required:!0})]}),e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"description",children:"Description"}),e.jsx(pe,{id:"description",as:"textarea",value:c,onChange:N,onBlur:L,placeholder:"Tell us about your workspace",style:{minHeight:"80px",resize:"vertical",fontFamily:"inherit"}}),e.jsx("p",{style:{fontSize:"var(--font-2xs)",color:"var(--color-muted)",margin:"var(--space-2xs) 0 0 0"},children:"Brief description of your workspace and its purpose"})]}),((se=s==null?void 0:s.b2b_settings)==null?void 0:se.enforce_mfa_per_workspace_enabled)&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx(he,{style:{fontSize:"var(--font-xs)",color:"var(--color-foreground)",display:"block",marginBottom:"var(--space-2xs)"},children:"Multi-Factor Authentication"}),e.jsx("div",{style:{fontSize:"var(--font-2xs)",color:"var(--color-muted)"},id:"mfa-description",children:"Require all members to set up MFA for added security"})]}),e.jsx(jr,{checked:d.mfa_required,onChange:()=>{u(U=>({...U,mfa_required:!U.mfa_required})),setTimeout(()=>z(),100)}})]}),((te=s==null?void 0:s.b2b_settings)==null?void 0:te.ip_allowlist_per_workspace_enabled)&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx(he,{style:{fontSize:"var(--font-xs)",color:"var(--color-foreground)",display:"block",marginBottom:"var(--space-2xs)"},children:"IP Restrictions"}),e.jsx("div",{style:{fontSize:"var(--font-2xs)",color:"var(--color-muted)"},id:"ip-restrictions-description",children:"Only allow access from specific IP addresses"})]}),e.jsx(jr,{checked:d.ip_restrictions,onChange:()=>{u(U=>({...U,ip_restrictions:!U.ip_restrictions})),setTimeout(()=>z(),100)},"aria-label":"Enable IP address restrictions","aria-describedby":"ip-restrictions-description"})]}),d.ip_restrictions&&e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"allowed_ips",children:"Allowed IP Addresses"}),e.jsx(pe,{id:"allowed_ips",as:"textarea",value:d.allowed_ips,onChange:U=>u(K=>({...K,allowed_ips:U.target.value})),onBlur:z,placeholder:`192.168.1.1
|
|
3323
3323
|
10.0.0.0/24`,style:{minHeight:"80px",resize:"vertical",fontFamily:"monospace"}}),e.jsx("p",{style:{fontSize:"var(--font-2xs)",color:"var(--color-muted)",margin:"var(--space-2xs) 0 0 0"},children:"Enter one IP address or CIDR block per line"})]})]})]})]}),e.jsx("div",{style:{position:"relative",height:"1px",background:"var(--color-divider)",margin:"0"}}),e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsx("h3",{style:{fontSize:"16px",color:"var(--color-foreground)",margin:"0 0 4px 0"},children:"Danger Zone"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--color-muted)",margin:0},children:"Irreversible and destructive actions"})]}),e.jsxs("div",{style:{padding:"20px",border:"1px solid var(--color-error)",borderRadius:"8px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:I?"20px":"0"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"14px",color:"var(--color-foreground)",marginBottom:"4px",fontWeight:"500"},children:"Delete Workspace"}),e.jsx("div",{style:{fontSize:"13px",color:"var(--color-muted)"},children:"Once you delete this workspace, there is no going back. Please be certain."})]}),e.jsx(X,{onClick:()=>{I?(k(!1),w("")):k(!0)},style:{background:"var(--color-error)",color:"white",border:"none",padding:"6px 12px",fontSize:"13px",height:"32px",width:"auto"},children:I?"Cancel":"Delete"})]}),I&&e.jsxs("div",{children:[e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"confirm_workspace_name",children:"Confirm by typing the workspace name"}),e.jsx(pe,{id:"confirm_workspace_name",type:"text",value:C,onChange:U=>w(U.target.value),placeholder:`Type "${t==null?void 0:t.name}" to confirm`})]}),e.jsx(X,{onClick:A,disabled:C!==(t==null?void 0:t.name)||j,style:{background:C===(t==null?void 0:t.name)?"var(--color-error)":"transparent",color:C===(t==null?void 0:t.name)?"white":"var(--color-muted)",border:"1px solid var(--color-border)",padding:"8px 16px",fontSize:"14px",height:"36px",cursor:C===(t==null?void 0:t.name)?"pointer":"not-allowed",opacity:C===(t==null?void 0:t.name)?1:.6,marginTop:"12px"},children:j?e.jsx(Ee,{size:12}):"Delete Forever"})]})]})]})]}),S&&e.jsx("div",{style:{position:"fixed",bottom:"24px",left:"50%",transform:"translateX(-50%)",background:"var(--color-success-background)",color:"var(--color-success)",padding:"var(--space-sm) var(--space-lg)",borderRadius:"var(--radius-lg)",boxShadow:"0 4px 12px var(--color-shadow)",display:"flex",alignItems:"center",gap:"var(--space-xs)",fontSize:"var(--font-xs)",fontWeight:500,zIndex:1e3,animation:"slideUp 0.3s ease-out"},children:"✓ Changes saved automatically"}),e.jsx("style",{children:`
|
|
3324
3324
|
@keyframes slideUp {
|
|
3325
3325
|
from {
|
|
@@ -3331,7 +3331,7 @@ cursor: pointer;
|
|
|
3331
3331
|
transform: translateX(-50%) translateY(0);
|
|
3332
3332
|
}
|
|
3333
3333
|
}
|
|
3334
|
-
`})]})},s0=()=>{var x;const{activeWorkspace:t,loading:r,getRoles:o,createRole:n,deleteRole:s}=Rt(),{toast:a}=i.useContext(Sr)||{},{deployment:h}=ve(),[f,c]=i.useState(""),[p,d]=i.useState({isOpen:!1}),[u,g]=i.useState(null),[m,v]=i.useState(null),y=i.useRef(null),S=i.useRef(new Map),{data:E=[],isLoading:b,mutate:$}=
|
|
3334
|
+
`})]})},s0=()=>{var x;const{activeWorkspace:t,loading:r,getRoles:o,createRole:n,deleteRole:s}=Rt(),{toast:a}=i.useContext(Sr)||{},{deployment:h}=ve(),[f,c]=i.useState(""),[p,d]=i.useState({isOpen:!1}),[u,g]=i.useState(null),[m,v]=i.useState(null),y=i.useRef(null),S=i.useRef(new Map),{data:E=[],isLoading:b,mutate:$}=Fe(t?`wacht-api-workspaces:${t.id}:roles`:null,()=>o()||[]),C=i.useMemo(()=>f?E.filter(I=>I.name.toLowerCase().includes(f.toLowerCase())):E,[E,f]),w=async I=>{try{await n(I.name,I.permissions||[]),a==null||a("Role created successfully","info"),d({isOpen:!1}),$()}catch{a==null||a("Failed to save role","error"),a==null||a("Failed to create role","error")}},j=async I=>{try{await s(I),a==null||a("Role deleted successfully","info"),v(null),$()}catch{a==null||a("Failed to delete role","error"),a==null||a("Failed to delete role","error")}};return r||b?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ee,{})}):e.jsxs(e.Fragment,{children:[e.jsxs(za,{children:[e.jsx(wt,{placeholder:"Search roles",onChange:c,value:f}),e.jsxs("div",{style:{position:"relative"},children:[((x=h==null?void 0:h.b2b_settings)==null?void 0:x.custom_workspace_role_enabled)&&e.jsx(X,{ref:y,onClick:()=>d({isOpen:!0,triggerElement:y.current}),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"Add role"}),p.isOpen&&!p.role&&e.jsx(Gs,{role:p.role,triggerRef:{current:p.triggerElement||null},onClose:()=>d({isOpen:!1}),onSuccess:w})]})]}),C.length===0?e.jsx(et,{title:f?"No roles match your search":"No roles available",description:f?"Try adjusting your search query":"Contact your administrator to set up workspace roles."}):e.jsx("div",{style:{position:"relative",overflowX:"auto",overflowY:"visible"},children:e.jsxs(jt,{children:[e.jsx(kt,{children:e.jsxs(We,{children:[e.jsx(ze,{children:"Role"}),e.jsx(ze,{children:"Permissions"}),e.jsx(ze,{})]})}),e.jsx(_t,{children:C.map(I=>{var k;return e.jsxs(We,{children:[e.jsx(Le,{children:e.jsx("div",{style:{fontSize:"14px",fontWeight:500},children:I.name})}),e.jsx(Le,{style:{color:"var(--color-secondary-text)"},children:I.permissions&&I.permissions.length>0?I.permissions.join(", "):""}),e.jsx(Ct,{children:e.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center",justifyContent:"flex-end",position:"relative"},children:[e.jsxs(nt,{open:u===I.id,openChange:R=>g(R?I.id:null),children:[e.jsx(st,{children:e.jsx(_l,{ref:R=>{R&&S.current.set(I.id,R)},disabled:!I.workspace_id,"data-role-dropdown-trigger":I.id,children:"•••"})}),e.jsxs(at,{children:[e.jsx(Te,{onClick:()=>{g(null);const R=S.current.get(I.id);d({isOpen:!0,role:I,triggerElement:R||null})},children:"Edit Role"}),e.jsx(Te,{$destructive:!0,onClick:()=>{g(null),v(I.id)},children:"Remove Role"})]})]}),m===I.id&&e.jsx(Hr,{title:"Are you sure you want to delete this role?",onConfirm:()=>j(I),onCancel:()=>v(null)}),p.isOpen&&((k=p.role)==null?void 0:k.id)===I.id&&e.jsx(Gs,{role:p.role,triggerRef:{current:p.triggerElement||null},onClose:()=>{d({isOpen:!1}),g(null)},onSuccess:w})]})})]},I.id)})})]})})]})},Cl=()=>{const{activeWorkspace:t,loading:r}=Rt(),[o,n]=i.useState("general"),[s,a]=i.useState(null),[h,f]=i.useState("info"),c=i.useCallback((p,d="info")=>{a(p),f(d),setTimeout(()=>a(null),3e3)},[]);return r?e.jsx(Hs,{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(Ee,{})}):t?e.jsx(Sr.Provider,{value:{screen:null,setScreen:()=>{},toast:c},children:e.jsx(Hx,{children:e.jsxs(Hs,{children:[e.jsx(qx,{children:e.jsxs(Yx,{children:[e.jsx(go,{$isActive:o==="general",onClick:()=>n("general"),children:e.jsxs(mo,{children:[e.jsx(Kt,{size:16}),"General"]})}),e.jsx(go,{$isActive:o==="members",onClick:()=>n("members"),children:e.jsxs(mo,{children:[e.jsx(Bo,{size:16}),"Members"]})}),e.jsx(go,{$isActive:o==="invitations",onClick:()=>n("invitations"),children:e.jsxs(mo,{children:[e.jsx(Wc,{size:16}),"Invitations"]})}),e.jsx(go,{$isActive:o==="roles",onClick:()=>n("roles"),children:e.jsxs(mo,{children:[e.jsx(wr,{size:16}),"Roles"]})})]})}),e.jsxs(Zx,{children:[o==="general"&&e.jsx(a0,{}),o==="members"&&e.jsx(n0,{}),o==="invitations"&&e.jsx(o0,{}),o==="roles"&&e.jsx(s0,{})]}),s&&e.jsx("div",{style:{position:"absolute",bottom:"20px",right:"20px",background:"var(--color-input-background)",border:"1px solid var(--color-border)",padding:"12px 16px",borderRadius:"8px",boxShadow:"0 4px 12px var(--color-shadow)",zIndex:50,animation:"slideUp 0.3s ease-out"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[h==="error"?e.jsx(dt,{size:16,color:"var(--color-error)"}):e.jsx(Ye,{size:16,color:"var(--color-success)"}),e.jsx("span",{style:{fontSize:"14px",color:"var(--color-foreground)"},children:s})]})})]})})}):null},Sl=({isOpen:t,onClose:r,title:o,showHeader:n,headerContent:s,footerContent:a,customContent:h,children:f,showCloseButton:c})=>e.jsx(_e,{isOpen:t,onClose:r,children:e.jsx(_e.Overlay,{children:e.jsxs(_e.Content,{style:{width:"900px",maxWidth:"100%"},children:[n&&e.jsx(_e.Header,{showCloseButton:c,children:s||o}),h||f||e.jsx(Cl,{}),a&&e.jsx(_e.Footer,{children:a})]})})}),$l=({triggerRef:t,isOpen:r,minWidth:o=300,defaultMaxHeight:n=400,offset:s=8})=>{const[a,h]=i.useState();return i.useEffect(()=>{if(!r||!t.current){h(void 0);return}const f=()=>{if(!t.current)return;const c=t.current.getBoundingClientRect(),p=window.innerWidth,d=window.innerHeight,u=p-c.left,g=c.right,m=d-c.bottom,v=c.top;let y={};u>=o?y.left=c.left:g>=o?y.left=c.right-o:y.left=Math.max(s,Math.min(p-o-s,c.left)),m>=150?(y.top=c.bottom+s,y.maxHeight=Math.min(n,m-s*2)):v>=150?(y.bottom=d-c.top+s,y.maxHeight=Math.min(n,v-s*2)):(y.top=c.bottom+s,y.maxHeight=Math.max(100,m-s*2)),h(y)};return f(),window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),()=>{window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0)}},[r,o,n,s]),a},qs=l.div`
|
|
3335
3335
|
position: relative;
|
|
3336
3336
|
display: inline-block;
|
|
3337
3337
|
width: 100%;
|
|
@@ -3682,7 +3682,7 @@ cursor: pointer;
|
|
|
3682
3682
|
height: 16px;
|
|
3683
3683
|
background: var(--color-border);
|
|
3684
3684
|
border-radius: 2px;
|
|
3685
|
-
`,zl=({showPersonal:t=!0})=>{var de,Q,ce;const[r,o]=i.useState(!1),[n,s]=i.useState(!1),[a,h]=i.useState(new Set),f=i.useRef(null),c=i.useRef(null),p=$l({triggerRef:f,isOpen:r,minWidth:300}),d=Mr(!1),u=Mr(!1),g=Mr(!1),m=Mr(!1),[v,y]=i.useState(null),[S,E]=i.useState(!1),[b,$]=i.useState(null),{organizationMemberships:C,loading:w,refetch:j}=bt(),{activeOrganization:x,leave:I}=qe(),{activeWorkspace:k,leave:R}=Rt(),{workspaces:_,loading:O}=yt(),{session:P,loading:z,switchOrganization:T,switchWorkspace:M}=Be(),{deployment:
|
|
3685
|
+
`,zl=({showPersonal:t=!0})=>{var de,Q,ce;const[r,o]=i.useState(!1),[n,s]=i.useState(!1),[a,h]=i.useState(new Set),f=i.useRef(null),c=i.useRef(null),p=$l({triggerRef:f,isOpen:r,minWidth:300}),d=Mr(!1),u=Mr(!1),g=Mr(!1),m=Mr(!1),[v,y]=i.useState(null),[S,E]=i.useState(!1),[b,$]=i.useState(null),{organizationMemberships:C,loading:w,refetch:j}=bt(),{activeOrganization:x,leave:I}=qe(),{activeWorkspace:k,leave:R}=Rt(),{workspaces:_,loading:O}=yt(),{session:P,loading:z,switchOrganization:T,switchWorkspace:M}=Be(),{deployment:N}=ve(),{toast:H}=Je(),L=N==null?void 0:N.b2b_settings.organizations_enabled,A=N==null?void 0:N.b2b_settings.workspaces_enabled,se=N==null?void 0:N.b2b_settings.allow_users_to_create_orgs,te=!((de=P==null?void 0:P.active_signin)!=null&&de.active_organization_membership_id),U=i.useMemo(()=>{var V,D;if(te)return{name:"Personal account",image_url:(D=(V=P==null?void 0:P.active_signin)==null?void 0:V.user)==null?void 0:D.profile_picture_url,isPersonal:!0};let B=(x==null?void 0:x.name)||"";return A&&k&&(B=`${x==null?void 0:x.name} / ${k.name}`),{name:B,image_url:x==null?void 0:x.image_url,isPersonal:!1}},[te,x,k,P,A]);i.useEffect(()=>{if(!r)return;let B=null;const V=setTimeout(()=>{const D=le=>{var ae,ke;const q=le.target;(ae=f.current)!=null&&ae.contains(q)||(ke=c.current)!=null&&ke.contains(q)||(o(!1),$(null))};document.addEventListener("mousedown",D),B=()=>{document.removeEventListener("mousedown",D)}},50);return()=>{clearTimeout(V),B==null||B()}},[r]),i.useEffect(()=>{if(b){const B=setTimeout(()=>{$(null)},5e3);return()=>clearTimeout(B)}},[b]);const K=()=>{j()};if(!L)return null;const ee=B=>{s(!0),T(B).finally(()=>{s(!1)})},J=B=>{s(!0),M(B).finally(()=>{s(!1)})},ie=B=>{const V=new Set(a);V.has(B)?V.delete(B):V.add(B),h(V)},oe=B=>B.split(" ").map(V=>V[0]).join("").toUpperCase().slice(0,2);return w||z?e.jsx(ue,{children:e.jsx(qs,{children:e.jsxs(m0,{children:[e.jsxs(Ys,{children:[e.jsx(x0,{}),e.jsx(v0,{})]}),e.jsx(b0,{})]})})}):e.jsx(ue,{children:e.jsxs(qs,{children:[e.jsxs(i0,{ref:f,onClick:()=>{o(!r),r||$(null)},disabled:n,children:[e.jsxs(Ys,{children:[e.jsx(c0,{children:U.image_url?e.jsx(l0,{src:U.image_url,alt:U.name}):U.isPersonal?e.jsx(Fo,{size:12}):oe(U.name)}),e.jsx(d0,{children:U.name})]}),e.jsx(Mp,{size:16})]}),typeof window<"u"&&Fr.createPortal(e.jsx(ue,{children:e.jsx(u0,{ref:c,$isOpen:r,$position:p,children:w||O?e.jsxs(g0,{children:[e.jsxs(wo,{children:[e.jsx(jo,{}),e.jsxs(ko,{children:[e.jsx(_o,{width:"120px"}),e.jsx(ei,{width:"80px"})]})]}),e.jsx(pr,{}),e.jsxs(wo,{children:[e.jsx(jo,{}),e.jsx(ko,{children:e.jsx(_o,{width:"100px"})})]}),e.jsx(pr,{}),e.jsxs(wo,{children:[e.jsx(jo,{}),e.jsxs(ko,{children:[e.jsx(_o,{width:"140px"}),e.jsx(ei,{width:"60px"})]})]}),e.jsx(pr,{}),e.jsxs(wo,{children:[e.jsx(jo,{}),e.jsx(ko,{children:e.jsx(_o,{width:"110px"})})]})]}):e.jsxs("div",{children:[t&&e.jsxs(e.Fragment,{children:[e.jsxs(Oo,{as:"button",$isActive:te,onClick:B=>{B.stopPropagation(),te||ee()},disabled:n||te,children:[te&&e.jsx(bo,{}),e.jsxs(pt,{children:[e.jsx(p0,{children:(ce=(Q=P==null?void 0:P.active_signin)==null?void 0:Q.user)!=null&&ce.profile_picture_url?e.jsx(h0,{src:P.active_signin.user.profile_picture_url,alt:"Personal account"}):e.jsx(Fo,{size:12})}),e.jsx(ht,{children:e.jsx(ft,{children:"Personal account"})})]}),!te&&e.jsx(xo,{className:"hover-arrow",size:14})]}),!te&&x&&e.jsx(pr,{})]}),!te&&x&&e.jsxs(Oo,{$isActive:!0,onClick:()=>{A&&ie(x.id)},style:n?{pointerEvents:"none",opacity:.7}:void 0,children:[e.jsx(bo,{}),e.jsxs(pt,{children:[A&&e.jsx(er,{size:12,style:{marginRight:"4px",transform:a.has(x.id)?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",color:"var(--color-secondary-text)"}}),e.jsx(Zs,{children:x.image_url?e.jsx(Qs,{src:x.image_url,alt:x.name}):oe(x.name)}),e.jsx(ht,{children:e.jsx(ft,{children:x.name})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Mo,{onClick:B=>{B.stopPropagation(),u.open()},title:"Manage organization",children:e.jsx(Kt,{size:12})}),e.jsx(Un,{onClick:async B=>{B.stopPropagation(),E(!0),$(null);try{await I(),await j(),setTimeout(()=>{E(!1)},500)}catch(V){$(V instanceof Error?V.message:"Failed to leave organization"),E(!1)}},disabled:S,title:"Leave organization",children:e.jsx(Et,{size:12})})]})]}),x&&A&&a.has(x.id)&&e.jsxs(e.Fragment,{children:[_==null?void 0:_.filter(B=>B.organization.id===x.id).map(B=>{const V=(k==null?void 0:k.id)===B.id;return e.jsxs(yo,{as:V?void 0:"button",$isActive:V,onClick:V?void 0:()=>J(B.id),...V?{style:n?{pointerEvents:"none",opacity:.7}:void 0}:{disabled:n},children:[V&&e.jsx(bo,{}),e.jsxs(pt,{children:[e.jsx(Xs,{children:B.image_url?e.jsx("img",{src:B.image_url,alt:B.name,style:{width:"100%",height:"100%",objectFit:"cover"}}):oe(B.name).charAt(0)}),e.jsx(ht,{children:e.jsx(ft,{children:B.name})})]}),V?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Mo,{onClick:D=>{D.stopPropagation(),m.open()},title:"Manage workspace",children:e.jsx(Kt,{size:12})}),e.jsx(Un,{onClick:async D=>{D.stopPropagation();try{R&&await R()}catch(le){const q=le.message||"Failed to leave workspace. Please try again.";H(q,"error")}},title:"Leave workspace",children:e.jsx(Et,{size:12})})]}):e.jsx(xo,{className:"hover-arrow",size:14})]},B.id)}),e.jsx(yo,{as:"button",onClick:()=>{y(x.id),g.open()},disabled:n,children:e.jsxs(pt,{children:[e.jsx(vo,{style:{width:"14px",height:"14px"},children:e.jsx(Ke,{size:12})}),e.jsx(ht,{children:e.jsx(ft,{children:"Create workspace"})})]})})]}),(S||b)&&e.jsxs(e.Fragment,{children:[S&&e.jsxs(Js,{children:[e.jsx(f0,{}),"Leaving organization..."]}),b&&e.jsxs(Js,{$isError:!0,children:[e.jsx("span",{children:"⚠️"}),b]})]}),e.jsx(pr,{}),C&&C.length>0&&e.jsx(e.Fragment,{children:C.filter(B=>B.organization.id!==(x==null?void 0:x.id)).map(B=>{const V=B.organization,D=(_==null?void 0:_.filter(q=>q.organization.id===V.id))||[],le=a.has(V.id);return e.jsxs(i.Fragment,{children:[e.jsxs(Oo,{as:"button",$isActive:!1,onClick:()=>{A?ie(V.id):ee(V.id)},disabled:n,children:[e.jsxs(pt,{children:[A&&e.jsx(er,{size:12,style:{marginRight:"4px",transform:le?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",color:"var(--color-secondary-text)"}}),e.jsx(Zs,{children:V.image_url?e.jsx(Qs,{src:V.image_url,alt:V.name}):oe(V.name)}),e.jsx(ht,{children:e.jsx(ft,{children:V.name})})]}),e.jsx(xo,{className:"hover-arrow",size:14})]}),A&&le&&e.jsxs(e.Fragment,{children:[D.map(q=>{const ae=(k==null?void 0:k.id)===q.id;return e.jsxs(yo,{as:ae?void 0:"button",$isActive:ae,onClick:ae?void 0:()=>J(q.id),...ae?{style:n?{pointerEvents:"none",opacity:.7}:void 0}:{disabled:n},children:[ae&&e.jsx(bo,{}),e.jsxs(pt,{children:[e.jsx(Xs,{children:q.image_url?e.jsx("img",{src:q.image_url,alt:q.name,style:{width:"100%",height:"100%",objectFit:"cover"}}):oe(q.name).charAt(0)}),e.jsx(ht,{children:e.jsx(ft,{children:q.name})})]}),ae?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Mo,{onClick:ke=>{ke.stopPropagation(),m.open()},title:"Manage workspace",children:e.jsx(Kt,{size:12})}),e.jsx(Un,{onClick:async ke=>{ke.stopPropagation();try{R&&await R()}catch(ne){const Y=ne.message||"Failed to leave workspace. Please try again.";H(Y,"error")}},title:"Leave workspace",children:e.jsx(Et,{size:12})})]}):e.jsx(xo,{className:"hover-arrow",size:16})]},q.id)}),e.jsx(yo,{as:"button",onClick:()=>{y(V.id),g.open()},disabled:n,children:e.jsxs(pt,{children:[e.jsx(vo,{style:{width:"14px",height:"14px"},children:e.jsx(Ke,{size:10})}),e.jsx(ht,{children:e.jsx(ft,{children:"Create workspace"})})]})})]}),e.jsx(pr,{})]},V.id)})}),A?x&&e.jsx(Ks,{onClick:()=>{y(x.id),g.open()},disabled:n,children:e.jsxs(pt,{children:[e.jsx(vo,{children:e.jsx(Ke,{size:12})}),e.jsx(ht,{children:e.jsx(ft,{children:"Create workspace"})})]})}):se&&e.jsx(Ks,{onClick:()=>{d.open()},disabled:n,children:e.jsxs(pt,{children:[e.jsx(vo,{children:e.jsx(Ke,{size:12})}),e.jsx(ht,{children:e.jsx(ft,{children:"Create organization"})})]})})]})})}),document.body),L&&se&&e.jsx(xm,{isOpen:d.isOpen,onClose:d.close,onCreated:K}),e.jsx(cx,{isOpen:u.isOpen,onClose:u.close}),e.jsx(Sl,{isOpen:m.isOpen,onClose:m.close}),v&&e.jsx(kl,{isOpen:g.isOpen,onClose:()=>{g.close(),y(null)},organizationId:v})]})})};var y0=Object.defineProperty,Vo=Object.getOwnPropertySymbols,El=Object.prototype.hasOwnProperty,Pl=Object.prototype.propertyIsEnumerable,ti=(t,r,o)=>r in t?y0(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o,ga=(t,r)=>{for(var o in r||(r={}))El.call(r,o)&&ti(t,o,r[o]);if(Vo)for(var o of Vo(r))Pl.call(r,o)&&ti(t,o,r[o]);return t},ma=(t,r)=>{var o={};for(var n in t)El.call(t,n)&&r.indexOf(n)<0&&(o[n]=t[n]);if(t!=null&&Vo)for(var n of Vo(t))r.indexOf(n)<0&&Pl.call(t,n)&&(o[n]=t[n]);return o};/**
|
|
3686
3686
|
* @license QR Code generator library (TypeScript)
|
|
3687
3687
|
* Copyright (c) Project Nayuki.
|
|
3688
3688
|
* SPDX-License-Identifier: MIT
|
|
@@ -3690,7 +3690,7 @@ cursor: pointer;
|
|
|
3690
3690
|
* @license qrcode.react
|
|
3691
3691
|
* Copyright (c) Paul O'Shannessy
|
|
3692
3692
|
* SPDX-License-Identifier: ISC
|
|
3693
|
-
*/var w0={L:gr.QrCode.Ecc.LOW,M:gr.QrCode.Ecc.MEDIUM,Q:gr.QrCode.Ecc.QUARTILE,H:gr.QrCode.Ecc.HIGH},Rl=128,Il="L",Tl="#FFFFFF",Ol="#000000",Ml=!1,Ll=1,j0=4,k0=0,_0=.1;function Al(t,r=0){const o=[];return t.forEach(function(n,s){let a=null;n.forEach(function(h,f){if(!h&&a!==null){o.push(`M${a+r} ${s+r}h${f-a}v1H${a+r}z`),a=null;return}if(f===n.length-1){if(!h)return;a===null?o.push(`M${f+r},${s+r} h1v1H${f+r}z`):o.push(`M${a+r},${s+r} h${f+1-a}v1H${a+r}z`);return}h&&a===null&&(a=f)})}),o.join("")}function Dl(t,r){return t.slice().map((o,n)=>n<r.y||n>=r.y+r.h?o:o.map((s,a)=>a<r.x||a>=r.x+r.w?s:!1))}function C0(t,r,o,n){if(n==null)return null;const s=t.length+o*2,a=Math.floor(r*_0),h=s/r,f=(n.width||a)*h,c=(n.height||a)*h,p=n.x==null?t.length/2-f/2:n.x*h,d=n.y==null?t.length/2-c/2:n.y*h,u=n.opacity==null?1:n.opacity;let g=null;if(n.excavate){let v=Math.floor(p),y=Math.floor(d),S=Math.ceil(f+p-v),E=Math.ceil(c+d-y);g={x:v,y,w:S,h:E}}const m=n.crossOrigin;return{x:p,y:d,h:c,w:f,excavation:g,opacity:u,crossOrigin:m}}function S0(t,r){return r!=null?Math.max(Math.floor(r),0):t?j0:k0}function
|
|
3693
|
+
*/var w0={L:gr.QrCode.Ecc.LOW,M:gr.QrCode.Ecc.MEDIUM,Q:gr.QrCode.Ecc.QUARTILE,H:gr.QrCode.Ecc.HIGH},Rl=128,Il="L",Tl="#FFFFFF",Ol="#000000",Ml=!1,Ll=1,j0=4,k0=0,_0=.1;function Al(t,r=0){const o=[];return t.forEach(function(n,s){let a=null;n.forEach(function(h,f){if(!h&&a!==null){o.push(`M${a+r} ${s+r}h${f-a}v1H${a+r}z`),a=null;return}if(f===n.length-1){if(!h)return;a===null?o.push(`M${f+r},${s+r} h1v1H${f+r}z`):o.push(`M${a+r},${s+r} h${f+1-a}v1H${a+r}z`);return}h&&a===null&&(a=f)})}),o.join("")}function Dl(t,r){return t.slice().map((o,n)=>n<r.y||n>=r.y+r.h?o:o.map((s,a)=>a<r.x||a>=r.x+r.w?s:!1))}function C0(t,r,o,n){if(n==null)return null;const s=t.length+o*2,a=Math.floor(r*_0),h=s/r,f=(n.width||a)*h,c=(n.height||a)*h,p=n.x==null?t.length/2-f/2:n.x*h,d=n.y==null?t.length/2-c/2:n.y*h,u=n.opacity==null?1:n.opacity;let g=null;if(n.excavate){let v=Math.floor(p),y=Math.floor(d),S=Math.ceil(f+p-v),E=Math.ceil(c+d-y);g={x:v,y,w:S,h:E}}const m=n.crossOrigin;return{x:p,y:d,h:c,w:f,excavation:g,opacity:u,crossOrigin:m}}function S0(t,r){return r!=null?Math.max(Math.floor(r),0):t?j0:k0}function Nl({value:t,level:r,minVersion:o,includeMargin:n,marginSize:s,imageSettings:a,size:h,boostLevel:f}){let c=i.useMemo(()=>{const v=(Array.isArray(t)?t:[t]).reduce((y,S)=>(y.push(...gr.QrSegment.makeSegments(S)),y),[]);return gr.QrCode.encodeSegments(v,w0[r],o,void 0,void 0,f)},[t,r,o,f]);const{cells:p,margin:d,numCells:u,calculatedImageSettings:g}=i.useMemo(()=>{let m=c.getModules();const v=S0(n,s),y=m.length+v*2,S=C0(m,h,v,a);return{cells:m,margin:v,numCells:y,calculatedImageSettings:S}},[c,h,a,n,s]);return{qrcode:c,margin:d,cells:p,numCells:u,calculatedImageSettings:g}}var $0=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),z0=i.forwardRef(function(r,o){const n=r,{value:s,size:a=Rl,level:h=Il,bgColor:f=Tl,fgColor:c=Ol,includeMargin:p=Ml,minVersion:d=Ll,boostLevel:u,marginSize:g,imageSettings:m}=n,y=ma(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:S}=y,E=ma(y,["style"]),b=m==null?void 0:m.src,$=i.useRef(null),C=i.useRef(null),w=i.useCallback(z=>{$.current=z,typeof o=="function"?o(z):o&&(o.current=z)},[o]),[j,x]=i.useState(!1),{margin:I,cells:k,numCells:R,calculatedImageSettings:_}=Nl({value:s,level:h,minVersion:d,boostLevel:u,includeMargin:p,marginSize:g,imageSettings:m,size:a});i.useEffect(()=>{if($.current!=null){const z=$.current,T=z.getContext("2d");if(!T)return;let M=k;const N=C.current,H=_!=null&&N!==null&&N.complete&&N.naturalHeight!==0&&N.naturalWidth!==0;H&&_.excavation!=null&&(M=Dl(k,_.excavation));const L=window.devicePixelRatio||1;z.height=z.width=a*L;const A=a/R*L;T.scale(A,A),T.fillStyle=f,T.fillRect(0,0,R,R),T.fillStyle=c,$0?T.fill(new Path2D(Al(M,I))):k.forEach(function(se,te){se.forEach(function(U,K){U&&T.fillRect(K+I,te+I,1,1)})}),_&&(T.globalAlpha=_.opacity),H&&T.drawImage(N,_.x+I,_.y+I,_.w,_.h)}}),i.useEffect(()=>{x(!1)},[b]);const O=ga({height:a,width:a},S);let P=null;return b!=null&&(P=i.createElement("img",{src:b,key:b,style:{display:"none"},onLoad:()=>{x(!0)},ref:C,crossOrigin:_==null?void 0:_.crossOrigin})),i.createElement(i.Fragment,null,i.createElement("canvas",ga({style:O,height:a,width:a,ref:w,role:"img"},E)),P)});z0.displayName="QRCodeCanvas";var Ea=i.forwardRef(function(r,o){const n=r,{value:s,size:a=Rl,level:h=Il,bgColor:f=Tl,fgColor:c=Ol,includeMargin:p=Ml,minVersion:d=Ll,boostLevel:u,title:g,marginSize:m,imageSettings:v}=n,y=ma(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:S,cells:E,numCells:b,calculatedImageSettings:$}=Nl({value:s,level:h,minVersion:d,boostLevel:u,includeMargin:p,marginSize:m,imageSettings:v,size:a});let C=E,w=null;v!=null&&$!=null&&($.excavation!=null&&(C=Dl(E,$.excavation)),w=i.createElement("image",{href:v.src,height:$.h,width:$.w,x:$.x+S,y:$.y+S,preserveAspectRatio:"none",opacity:$.opacity,crossOrigin:$.crossOrigin}));const j=Al(C,S);return i.createElement("svg",ga({height:a,width:a,viewBox:`0 0 ${b} ${b}`,ref:o,role:"img"},y),!!g&&i.createElement("title",null,g),i.createElement("path",{fill:f,d:`M0,0 h${b}v${b}H0z`,shapeRendering:"crispEdges"}),i.createElement("path",{fill:c,d:j,shapeRendering:"crispEdges"}),w)});Ea.displayName="QRCodeSVG";const E0=l.div`
|
|
3694
3694
|
position: fixed;
|
|
3695
3695
|
background: var(--color-background);
|
|
3696
3696
|
border-radius: var(--radius-md);
|
|
@@ -3729,7 +3729,7 @@ cursor: pointer;
|
|
|
3729
3729
|
justify-content: center;
|
|
3730
3730
|
color: var(--color-muted);
|
|
3731
3731
|
flex-shrink: 0;
|
|
3732
|
-
`,ni=({onClose:t,onAddEmail:r,onAttemptVerification:o,onPrepareVerification:n,existingEmail:s,triggerRef:a})=>{const h=i.useRef(null),[f,c]=i.useState(!1),[p,d]=i.useState({top:0,left:0}),{toast:u}=Tt();i.useEffect(()=>{c(!0);const j=setTimeout(()=>{if(!h.current||!(a!=null&&a.current))return;const k=a.current;if(k){const R=k.getBoundingClientRect(),_=380,O=300,P=8;let z=0,T=0;const M=window.innerHeight-R.bottom,
|
|
3732
|
+
`,ni=({onClose:t,onAddEmail:r,onAttemptVerification:o,onPrepareVerification:n,existingEmail:s,triggerRef:a})=>{const h=i.useRef(null),[f,c]=i.useState(!1),[p,d]=i.useState({top:0,left:0}),{toast:u}=Tt();i.useEffect(()=>{c(!0);const j=setTimeout(()=>{if(!h.current||!(a!=null&&a.current))return;const k=a.current;if(k){const R=k.getBoundingClientRect(),_=380,O=300,P=8;let z=0,T=0;const M=window.innerHeight-R.bottom,N=R.top;M>=O+P?(z=R.bottom+P,T=R.right-_,T<P&&(T=R.left,T+_>window.innerWidth-P&&(T=(window.innerWidth-_)/2))):N>=O+P?(z=R.top-O-P,T=R.right-_,T<P&&(T=R.left,T+_>window.innerWidth-P&&(T=(window.innerWidth-_)/2))):(z=R.bottom+P,T=R.right-_,T<P&&(T=R.left)),d({top:z,left:T})}},10),x=k=>{h.current&&!h.current.contains(k.target)&&t()},I=k=>{k.key==="Escape"&&t()};return document.addEventListener("mousedown",x),document.addEventListener("keydown",I),()=>{clearTimeout(j),document.removeEventListener("mousedown",x),document.removeEventListener("keydown",I)}},[t,a]);const[g,m]=i.useState(s?"otp":"email"),[v,y]=i.useState(s||""),[S,E]=i.useState(""),[b,$]=i.useState(!1),C=async()=>{if(!(!v||b)){$(!0);try{await r(v),m("otp")}catch(j){const x=j.message||"Failed to add email address. Please try again.";u(x,"error")}finally{$(!1)}}},w=async()=>{$(!0);try{await o(S),t()}catch(j){const x=j.message||"Failed to verify email. Please check the code and try again.";u(x,"error")}finally{$(!1)}};return f?e.jsx(E0,{ref:h,style:{top:`${p.top}px`,left:`${p.left}px`,visibility:p.top>0?"visible":"hidden"},onClick:j=>j.stopPropagation(),children:g==="email"?e.jsxs(e.Fragment,{children:[e.jsx(oi,{children:"Add email address"}),e.jsx(ge,{children:e.jsxs(P0,{children:[e.jsx(R0,{children:e.jsx(Wr,{size:16})}),e.jsx(pe,{id:"email-input",type:"email",placeholder:"Email address",value:v,onChange:j=>y(j.target.value),style:{flex:1}})]})}),e.jsxs(ri,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto",padding:"0 var(--space-md)"},children:"Cancel"}),e.jsx(X,{onClick:C,disabled:!v||b,style:{width:"auto",padding:"0 var(--space-md)"},children:b?"Adding...":"Continue"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(oi,{children:"Verify your email"}),e.jsxs("div",{style:{fontSize:"14px",color:"var(--color-muted)",marginBottom:"16px"},children:["Enter the 6-digit code sent to ",v]}),e.jsx(It,{onComplete:async j=>E(j),onResend:n,isSubmitting:b}),e.jsxs(ri,{children:[e.jsx(X,{$outline:!0,onClick:()=>m("email"),style:{width:"auto",padding:"0 var(--space-md)"},children:"Back"}),e.jsx(X,{onClick:w,disabled:S.length<6||b,style:{width:"auto",padding:"0 var(--space-md)"},children:b?"Verifying...":"Verify"})]})]})}):null},I0=l.div`
|
|
3733
3733
|
position: fixed;
|
|
3734
3734
|
background: var(--color-background);
|
|
3735
3735
|
border-radius: var(--radius-md);
|
|
@@ -3753,7 +3753,7 @@ cursor: pointer;
|
|
|
3753
3753
|
font-weight: 400;
|
|
3754
3754
|
color: var(--color-foreground);
|
|
3755
3755
|
margin-bottom: 12px;
|
|
3756
|
-
`,ii=({onClose:t,onAddPhone:r,onAttemptVerification:o,existingPhone:n,onPrepareVerification:s,triggerRef:a})=>{var I;const h=i.useRef(null),[f,c]=i.useState(!1),[p,d]=i.useState({top:0,left:0}),{toast:u}=Tt();i.useEffect(()=>{c(!0);const k=setTimeout(()=>{if(!h.current||!(a!=null&&a.current))return;const O=a.current;if(O){const P=O.getBoundingClientRect(),z=380,T=300,M=8;let
|
|
3756
|
+
`,ii=({onClose:t,onAddPhone:r,onAttemptVerification:o,existingPhone:n,onPrepareVerification:s,triggerRef:a})=>{var I;const h=i.useRef(null),[f,c]=i.useState(!1),[p,d]=i.useState({top:0,left:0}),{toast:u}=Tt();i.useEffect(()=>{c(!0);const k=setTimeout(()=>{if(!h.current||!(a!=null&&a.current))return;const O=a.current;if(O){const P=O.getBoundingClientRect(),z=380,T=300,M=8;let N=0,H=0;const L=window.innerHeight-P.bottom,A=P.top;L>=T+M?(N=P.bottom+M,H=P.right-z,H<M&&(H=P.left,H+z>window.innerWidth-M&&(H=(window.innerWidth-z)/2))):A>=T+M?(N=P.top-T-M,H=P.right-z,H<M&&(H=P.left,H+z>window.innerWidth-M&&(H=(window.innerWidth-z)/2))):(N=P.bottom+M,H=P.right-z,H<M&&(H=P.left)),d({top:N,left:H})}},10),R=O=>{h.current&&!h.current.contains(O.target)&&t()},_=O=>{O.key==="Escape"&&t()};return document.addEventListener("mousedown",R),document.addEventListener("keydown",_),()=>{clearTimeout(k),document.removeEventListener("mousedown",R),document.removeEventListener("keydown",_)}},[t,a]);const[g,m]=i.useState(n?"otp":"phone"),[v,y]=i.useState((n==null?void 0:n.replace(/^\+\d+/,""))||""),[S,E]=i.useState((I=Intl.DateTimeFormat().resolvedOptions().locale.split("-"))==null?void 0:I.pop()),[b,$]=i.useState(""),[C,w]=i.useState(!1),j=async()=>{if(!(!v||C)){w(!0);try{await r(v,S||""),m("otp")}catch(k){const R=k.message||"Failed to add phone number. Please try again.";u(R,"error")}finally{w(!1)}}},x=async()=>{w(!0);try{await o(b),t()}catch(k){const R=k.message||"Failed to verify phone. Please check the code and try again.";u(R,"error")}finally{w(!1)}};return f?e.jsx(I0,{ref:h,style:{top:`${p.top}px`,left:`${p.left}px`,visibility:p.top>0?"visible":"hidden"},onClick:k=>k.stopPropagation(),children:g==="phone"?e.jsxs(e.Fragment,{children:[e.jsx(si,{children:"Add phone number"}),e.jsx(ge,{children:e.jsx(Gr,{value:v,onChange:k=>y(k.target.value),error:"",countryCode:S,setCountryCode:E})}),e.jsxs(ai,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto",padding:"0 var(--space-md)"},children:"Cancel"}),e.jsx(X,{onClick:j,disabled:!v||C,style:{width:"auto",padding:"0 var(--space-md)"},children:"Continue"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(si,{children:"Verify phone number"}),e.jsx(ge,{children:e.jsx(It,{onComplete:k=>$(k),onResend:async()=>s()})}),e.jsxs(ai,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto",padding:"0 var(--space-md)"},children:"Cancel"}),e.jsx(X,{onClick:x,disabled:b.length!==6||C,style:{width:"auto",padding:"0 var(--space-md)"},children:"Verify"})]})]})}):null},T0=l.div`
|
|
3757
3757
|
position: fixed;
|
|
3758
3758
|
background: var(--color-background);
|
|
3759
3759
|
border-radius: var(--radius-md);
|
|
@@ -3866,7 +3866,7 @@ cursor: pointer;
|
|
|
3866
3866
|
color: var(--color-error);
|
|
3867
3867
|
font-size: 12px;
|
|
3868
3868
|
margin-top: 4px;
|
|
3869
|
-
`,ui=({onClose:t,onChangePassword:r,triggerRef:o,isSetup:n=!1})=>{const s=i.useRef(null),[a,h]=i.useState(!1),[f,c]=i.useState({top:0,left:0}),[p,d]=i.useState(""),[u,g]=i.useState(""),[m,v]=i.useState(""),[y,S]=i.useState(!1),[E,b]=i.useState(!1),[$,C]=i.useState(!1),[w,j]=i.useState(!1),[x,I]=i.useState({});i.useEffect(()=>{h(!0);const R=setTimeout(()=>{if(!s.current||!(o!=null&&o.current))return;const P=o.current;if(P){const z=P.getBoundingClientRect(),T=380,M=350,
|
|
3869
|
+
`,ui=({onClose:t,onChangePassword:r,triggerRef:o,isSetup:n=!1})=>{const s=i.useRef(null),[a,h]=i.useState(!1),[f,c]=i.useState({top:0,left:0}),[p,d]=i.useState(""),[u,g]=i.useState(""),[m,v]=i.useState(""),[y,S]=i.useState(!1),[E,b]=i.useState(!1),[$,C]=i.useState(!1),[w,j]=i.useState(!1),[x,I]=i.useState({});i.useEffect(()=>{h(!0);const R=setTimeout(()=>{if(!s.current||!(o!=null&&o.current))return;const P=o.current;if(P){const z=P.getBoundingClientRect(),T=380,M=350,N=8;let H=0,L=0;const A=window.innerHeight-z.bottom,se=z.top;A>=M+N?(H=z.bottom+N,L=z.right-T,L<N&&(L=z.left,L+T>window.innerWidth-N&&(L=(window.innerWidth-T)/2))):se>=M+N?(H=z.top-M-N,L=z.right-T,L<N&&(L=z.left,L+T>window.innerWidth-N&&(L=(window.innerWidth-T)/2))):(H=z.bottom+N,L=z.right-T,L<N&&(L=z.left)),c({top:H,left:L})}},10),_=P=>{s.current&&!s.current.contains(P.target)&&t()},O=P=>{P.key==="Escape"&&t()};return document.addEventListener("mousedown",_),document.addEventListener("keydown",O),()=>{clearTimeout(R),document.removeEventListener("mousedown",_),document.removeEventListener("keydown",O)}},[t,o]);const k=async()=>{if(w)return;const R={};if(!n&&!p&&(R.currentPassword="Current password is required"),u?u.length<8&&(R.newPassword="Password must be at least 8 characters"):R.newPassword="New password is required",u!==m&&(R.confirmPassword="Passwords do not match"),Object.keys(R).length>0){I(R);return}j(!0);try{await r(n?"":p,u),t()}catch(_){I({form:_.message||"Failed to update password"})}finally{j(!1)}};return a?e.jsxs(M0,{ref:s,style:{top:`${f.top}px`,left:`${f.left}px`,visibility:f.top>0?"visible":"hidden"},onClick:R=>R.stopPropagation(),children:[e.jsx(A0,{children:n?"Set Password":"Change Password"}),e.jsx("div",{style:{fontSize:"14px",color:"var(--color-muted)",marginBottom:"16px"},children:n?"Set a password for your account to enable password authentication.":"Update your account password to keep it secure."}),!n&&e.jsxs(Vn,{children:[e.jsx(he,{children:"Current Password"}),e.jsxs(Gn,{children:[e.jsx(pe,{type:y?"text":"password",placeholder:"Enter your current password",value:p,onChange:R=>d(R.target.value),style:{paddingRight:"40px"}}),e.jsx("button",{type:"button",onClick:()=>S(!y),"aria-label":y?"Hide current password":"Show current password",children:y?e.jsx(yn,{size:16}):e.jsx(wn,{size:16})})]}),x.currentPassword&&e.jsx(Co,{children:x.currentPassword})]}),e.jsxs(Vn,{children:[e.jsx(he,{children:n?"Password":"New Password"}),e.jsxs(Gn,{children:[e.jsx(pe,{type:E?"text":"password",placeholder:n?"Enter your password":"Enter your new password",value:u,onChange:R=>g(R.target.value),style:{paddingRight:"40px"}}),e.jsx("button",{type:"button",onClick:()=>b(!E),"aria-label":E?"Hide new password":"Show new password",children:E?e.jsx(yn,{size:16}):e.jsx(wn,{size:16})})]}),x.newPassword&&e.jsx(Co,{children:x.newPassword})]}),e.jsxs(Vn,{children:[e.jsx(he,{children:"Confirm New Password"}),e.jsxs(Gn,{children:[e.jsx(pe,{type:$?"text":"password",placeholder:"Confirm your new password",value:m,onChange:R=>v(R.target.value),style:{paddingRight:"40px"}}),e.jsx("button",{type:"button",onClick:()=>C(!$),"aria-label":$?"Hide confirm password":"Show confirm password",children:$?e.jsx(yn,{size:16}):e.jsx(wn,{size:16})})]}),x.confirmPassword&&e.jsx(Co,{children:x.confirmPassword})]}),x.form&&e.jsx(Co,{children:x.form}),e.jsxs(L0,{children:[e.jsx(di,{onClick:t,children:"Cancel"}),e.jsx(di,{$primary:!0,onClick:k,disabled:w,children:w?n?"Setting...":"Updating...":n?"Set Password":"Update Password"})]})]}):null},D0=l.div`
|
|
3870
3870
|
position: fixed;
|
|
3871
3871
|
background: var(--color-background);
|
|
3872
3872
|
border-radius: var(--radius-md);
|
|
@@ -3880,12 +3880,12 @@ cursor: pointer;
|
|
|
3880
3880
|
@media (max-width: 600px) {
|
|
3881
3881
|
width: calc(100vw - 48px);
|
|
3882
3882
|
}
|
|
3883
|
-
`,
|
|
3883
|
+
`,N0=l.div`
|
|
3884
3884
|
display: flex;
|
|
3885
3885
|
gap: 8px;
|
|
3886
3886
|
justify-content: flex-end;
|
|
3887
3887
|
margin-top: 16px;
|
|
3888
|
-
`,
|
|
3888
|
+
`,F0=l.div`
|
|
3889
3889
|
font-size: 16px;
|
|
3890
3890
|
font-weight: 400;
|
|
3891
3891
|
color: var(--color-foreground);
|
|
@@ -3904,7 +3904,7 @@ cursor: pointer;
|
|
|
3904
3904
|
color: var(--color-warning-text, var(--color-foreground));
|
|
3905
3905
|
margin: 0;
|
|
3906
3906
|
line-height: 1.5;
|
|
3907
|
-
`,W0=({onClose:t,onRemovePassword:r,triggerRef:o})=>{const n=i.useRef(null),[s,a]=i.useState(!1),[h,f]=i.useState({top:0,left:0}),[c,p]=i.useState(""),[d,u]=i.useState(!1),{toast:g}=Tt();i.useEffect(()=>{a(!0);const v=setTimeout(()=>{if(!n.current||!(o!=null&&o.current))return;const E=o.current;if(E){const b=E.getBoundingClientRect(),$=400,C=300,w=8;let j=0,x=0;const I=window.innerHeight-b.bottom,k=b.top;I>=C+w?(j=b.bottom+w,x=b.right-$,x<w&&(x=b.left,x+$>window.innerWidth-w&&(x=(window.innerWidth-$)/2))):k>=C+w?(j=b.top-C-w,x=b.right-$,x<w&&(x=b.left,x+$>window.innerWidth-w&&(x=(window.innerWidth-$)/2))):(j=b.bottom+w,x=b.right-$,x<w&&(x=b.left)),f({top:j,left:x})}},10),y=E=>{n.current&&!n.current.contains(E.target)&&t()},S=E=>{E.key==="Escape"&&t()};return document.addEventListener("mousedown",y),document.addEventListener("keydown",S),()=>{clearTimeout(v),document.removeEventListener("mousedown",y),document.removeEventListener("keydown",S)}},[t,o]);const m=async()=>{if(!(!c||d)){u(!0);try{await r(c),t()}catch(v){const y=v.message||"Failed to remove password. Please try again.";g(y,"error")}finally{u(!1)}}};return s?e.jsxs(D0,{ref:n,style:{top:`${h.top}px`,left:`${h.left}px`,visibility:h.top>0?"visible":"hidden"},onClick:v=>v.stopPropagation(),children:[e.jsxs(
|
|
3907
|
+
`,W0=({onClose:t,onRemovePassword:r,triggerRef:o})=>{const n=i.useRef(null),[s,a]=i.useState(!1),[h,f]=i.useState({top:0,left:0}),[c,p]=i.useState(""),[d,u]=i.useState(!1),{toast:g}=Tt();i.useEffect(()=>{a(!0);const v=setTimeout(()=>{if(!n.current||!(o!=null&&o.current))return;const E=o.current;if(E){const b=E.getBoundingClientRect(),$=400,C=300,w=8;let j=0,x=0;const I=window.innerHeight-b.bottom,k=b.top;I>=C+w?(j=b.bottom+w,x=b.right-$,x<w&&(x=b.left,x+$>window.innerWidth-w&&(x=(window.innerWidth-$)/2))):k>=C+w?(j=b.top-C-w,x=b.right-$,x<w&&(x=b.left,x+$>window.innerWidth-w&&(x=(window.innerWidth-$)/2))):(j=b.bottom+w,x=b.right-$,x<w&&(x=b.left)),f({top:j,left:x})}},10),y=E=>{n.current&&!n.current.contains(E.target)&&t()},S=E=>{E.key==="Escape"&&t()};return document.addEventListener("mousedown",y),document.addEventListener("keydown",S),()=>{clearTimeout(v),document.removeEventListener("mousedown",y),document.removeEventListener("keydown",S)}},[t,o]);const m=async()=>{if(!(!c||d)){u(!0);try{await r(c),t()}catch(v){const y=v.message||"Failed to remove password. Please try again.";g(y,"error")}finally{u(!1)}}};return s?e.jsxs(D0,{ref:n,style:{top:`${h.top}px`,left:`${h.left}px`,visibility:h.top>0?"visible":"hidden"},onClick:v=>v.stopPropagation(),children:[e.jsxs(F0,{children:[e.jsx(dt,{size:18,color:"var(--color-warning, #fbbf24)"}),"Remove Password"]}),e.jsx(B0,{children:e.jsx(U0,{children:"You're about to remove password authentication from your account. Make sure you have another way to sign in (email, phone, social login, or passkey) before continuing."})}),e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"current-password",children:"Confirm your current password"}),e.jsx(pe,{id:"current-password",type:"password",placeholder:"Enter current password",value:c,onChange:v=>p(v.target.value),autoFocus:!0})]}),e.jsxs(N0,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto",padding:"0 var(--space-md)"},children:"Cancel"}),e.jsx(X,{onClick:m,disabled:!c||d,style:{width:"auto",padding:"0 var(--space-md)",background:"var(--color-error)",borderColor:"var(--color-error)"},children:d?"Removing...":"Remove Password"})]})]}):null},V0=l.div`
|
|
3908
3908
|
position: fixed;
|
|
3909
3909
|
background: var(--color-background);
|
|
3910
3910
|
border-radius: var(--radius-md);
|
|
@@ -3970,7 +3970,7 @@ cursor: pointer;
|
|
|
3970
3970
|
background: var(--color-input-background-hover);
|
|
3971
3971
|
border-color: var(--color-primary);
|
|
3972
3972
|
}
|
|
3973
|
-
`,Q0=({codes:t,onClose:r,onCopy:o,onDownload:n,triggerRef:s})=>{const a=i.useRef(null),[h,f]=i.useState(!1),[c,p]=i.useState({top:0,left:0});return i.useEffect(()=>{f(!0);const d=setTimeout(()=>{if(!a.current||!(s!=null&&s.current))return;const m=s.current;if(m){const v=m.getBoundingClientRect(),y=380,S=300,E=8;let b=0,$=0;const C=window.innerHeight-v.bottom,w=v.top;C>=S+E?(b=v.bottom+E,$=v.right-y,$<E&&($=v.left,$+y>window.innerWidth-E&&($=(window.innerWidth-y)/2))):w>=S+E?(b=v.top-S-E,$=v.right-y,$<E&&($=v.left,$+y>window.innerWidth-E&&($=(window.innerWidth-y)/2))):(b=v.bottom+E,$=v.right-y,$<E&&($=v.left)),p({top:b,left:$})}},10),u=m=>{a.current&&!a.current.contains(m.target)&&r()},g=m=>{m.key==="Escape"&&r()};return document.addEventListener("mousedown",u),document.addEventListener("keydown",g),()=>{clearTimeout(d),document.removeEventListener("mousedown",u),document.removeEventListener("keydown",g)}},[r,s]),h?e.jsxs(V0,{ref:a,style:{top:`${c.top}px`,left:`${c.left}px`,visibility:c.top>0?"visible":"hidden"},onClick:d=>d.stopPropagation(),children:[e.jsxs(G0,{children:[e.jsx(H0,{children:"Backup Codes"}),e.jsxs(q0,{children:[e.jsxs(pi,{onClick:o,style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx(Fo,{size:14}),"Copy"]}),e.jsxs(pi,{onClick:n,style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx(tn,{size:14}),"Download"]})]})]}),e.jsx("div",{style:{fontSize:"13px",color:"var(--color-muted)",marginBottom:"8px"},children:"Save these backup codes in a secure location. Each code can only be used once."}),e.jsx(Y0,{children:t.map((d,u)=>e.jsx(Z0,{onClick:()=>{navigator.clipboard.writeText(d)},title:"Click to copy",children:d},u))}),e.jsxs("div",{style:{fontSize:"12px",color:"var(--color-warning)",padding:"6px 10px",background:"var(--color-warning-background)",border:"1px solid var(--color-warning-border)",borderRadius:"var(--radius-sm)",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx("span",{style:{fontSize:"14px"},children:"⚠️"}),e.jsx("span",{children:"Keep these codes safe! They won't be shown again."})]})]}):null},K0=t=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:48,height:48,...t,children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"a",x1:3.217,x2:44.781,y1:15,y2:15,gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:0,stopColor:"#d93025"}),e.jsx("stop",{offset:1,stopColor:"#ea4335"})]}),e.jsxs("linearGradient",{id:"b",x1:20.722,x2:41.504,y1:47.679,y2:11.684,gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:0,stopColor:"#fcc934"}),e.jsx("stop",{offset:1,stopColor:"#fbbc04"})]}),e.jsxs("linearGradient",{id:"c",x1:26.598,x2:5.816,y1:46.502,y2:10.506,gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:0,stopColor:"#1e8e3e"}),e.jsx("stop",{offset:1,stopColor:"#34a853"})]})]}),e.jsx("circle",{cx:24,cy:23.995,r:12,style:{fill:"#fff"}}),e.jsx("path",{d:"M3.215 36A24 24 0 1 0 12 3.215 24 24 0 0 0 3.215 36Zm31.177-18A12 12 0 1 1 18 13.608 12 12 0 0 1 34.392 18Z",style:{fill:"none"}}),e.jsx("path",{d:"M24 12h20.781a23.994 23.994 0 0 0-41.564.003L13.607 30l.01-.002A11.985 11.985 0 0 1 24 12Z",style:{fill:"url(#a)"}}),e.jsx("circle",{cx:24,cy:24,r:9.5,style:{fill:"#1a73e8"}}),e.jsx("path",{d:"M34.391 30.003 24.001 48A23.994 23.994 0 0 0 44.78 12.003H23.999l-.003.01a11.985 11.985 0 0 1 10.395 17.99Z",style:{fill:"url(#b)"}}),e.jsx("path",{d:"M13.609 30.003 3.218 12.006A23.994 23.994 0 0 0 24.003 48l10.39-17.997-.007-.007a11.985 11.985 0 0 1-20.777.007Z",style:{fill:"url(#c)"}})]}),X0=t=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:512,height:512,viewBox:"0 0 512 512",...t,children:[e.jsxs("defs",{children:[e.jsxs("radialGradient",{id:"g",cx:"210%",cy:"-100%",r:"290%",children:[e.jsx("stop",{offset:.1,stopColor:"#ffe226"}),e.jsx("stop",{offset:.79,stopColor:"#ff7139"})]}),e.jsxs("radialGradient",{id:"c",cx:"49%",cy:"40%",r:"128%",gradientTransform:"matrix(.82 0 0 1 .088 0)",children:[e.jsx("stop",{offset:.3,stopColor:"#960e18"}),e.jsx("stop",{offset:.35,stopColor:"#b11927",stopOpacity:.74}),e.jsx("stop",{offset:.43,stopColor:"#db293d",stopOpacity:.34}),e.jsx("stop",{offset:.5,stopColor:"#f5334b",stopOpacity:.09}),e.jsx("stop",{offset:.53,stopColor:"#ff3750",stopOpacity:0})]}),e.jsxs("radialGradient",{id:"d",cx:"48%",cy:"-12%",r:"140%",children:[e.jsx("stop",{offset:.13,stopColor:"#fff44f"}),e.jsx("stop",{offset:.53,stopColor:"#ff980e"})]}),e.jsxs("radialGradient",{id:"e",cx:"22.76%",cy:"110.11%",r:"100%",children:[e.jsx("stop",{offset:.35,stopColor:"#3a8ee6"}),e.jsx("stop",{offset:.67,stopColor:"#9059ff"}),e.jsx("stop",{offset:1,stopColor:"#c139e6"})]}),e.jsxs("radialGradient",{id:"f",cx:"52%",cy:"33%",r:"59%",gradientTransform:"scale(.9 1)",children:[e.jsx("stop",{offset:.21,stopColor:"#9059ff",stopOpacity:0}),e.jsx("stop",{offset:.97,stopColor:"#6e008b",stopOpacity:.6})]}),e.jsxs("radialGradient",{id:"b",cx:"87.4%",cy:"-12.9%",r:"128%",gradientTransform:"matrix(.8 0 0 1 .178 .129)",children:[e.jsx("stop",{offset:.13,stopColor:"#ffbd4f"}),e.jsx("stop",{offset:.28,stopColor:"#ff980e"}),e.jsx("stop",{offset:.47,stopColor:"#ff3750"}),e.jsx("stop",{offset:.78,stopColor:"#eb0878"}),e.jsx("stop",{offset:.86,stopColor:"#e50080"})]}),e.jsxs("radialGradient",{id:"h",cx:"84%",cy:"-41%",r:"180%",children:[e.jsx("stop",{offset:.11,stopColor:"#fff44f"}),e.jsx("stop",{offset:.46,stopColor:"#ff980e"}),e.jsx("stop",{offset:.72,stopColor:"#ff3647"}),e.jsx("stop",{offset:.9,stopColor:"#e31587"})]}),e.jsxs("radialGradient",{id:"i",cx:"16.1%",cy:"-18.6%",r:"348.8%",gradientTransform:"scale(1 .47) rotate(84 .279 -.297)",children:[e.jsx("stop",{offset:0,stopColor:"#fff44f"}),e.jsx("stop",{offset:.3,stopColor:"#ff980e"}),e.jsx("stop",{offset:.57,stopColor:"#ff3647"}),e.jsx("stop",{offset:.74,stopColor:"#e31587"})]}),e.jsxs("radialGradient",{id:"j",cx:"18.9%",cy:"-42.5%",r:"238.4%",children:[e.jsx("stop",{offset:.14,stopColor:"#fff44f"}),e.jsx("stop",{offset:.48,stopColor:"#ff980e"}),e.jsx("stop",{offset:.66,stopColor:"#ff3647"}),e.jsx("stop",{offset:.9,stopColor:"#e31587"})]}),e.jsxs("radialGradient",{id:"k",cx:"159.3%",cy:"-44.72%",r:"313.1%",children:[e.jsx("stop",{offset:.09,stopColor:"#fff44f"}),e.jsx("stop",{offset:.63,stopColor:"#ff980e"})]}),e.jsxs("linearGradient",{id:"a",x1:"87.25%",x2:"9.4%",y1:"15.5%",y2:"93.1%",children:[e.jsx("stop",{offset:.05,stopColor:"#fff44f"}),e.jsx("stop",{offset:.37,stopColor:"#ff980e"}),e.jsx("stop",{offset:.53,stopColor:"#ff3647"}),e.jsx("stop",{offset:.7,stopColor:"#e31587"})]}),e.jsxs("linearGradient",{id:"l",x1:"80%",x2:"18%",y1:"14%",y2:"84%",children:[e.jsx("stop",{offset:.17,stopColor:"#fff44f",stopOpacity:.8}),e.jsx("stop",{offset:.6,stopColor:"#fff44f",stopOpacity:0})]})]}),e.jsx("path",{fill:"url(#a)",d:"M478.711 166.353c-10.445-25.124-31.6-52.248-48.212-60.821 13.52 26.505 21.345 53.093 24.335 72.936 0 .039.015.136.047.4C427.706 111.135 381.627 83.823 344 24.355c-1.9-3.007-3.805-6.022-5.661-9.2a73.716 73.716 0 0 1-2.646-4.972A43.7 43.7 0 0 1 332.1.677a.626.626 0 0 0-.546-.644.818.818 0 0 0-.451 0c-.034.012-.084.051-.12.065-.053.021-.12.069-.176.1.027-.036.083-.117.1-.136-60.37 35.356-80.85 100.761-82.732 133.484a120.249 120.249 0 0 0-66.142 25.488 71.355 71.355 0 0 0-6.225-4.7 111.338 111.338 0 0 1-.674-58.732c-24.688 11.241-43.89 29.01-57.85 44.7h-.111c-9.527-12.067-8.855-51.873-8.312-60.184-.114-.515-7.107 3.63-8.023 4.255a175.073 175.073 0 0 0-23.486 20.12 210.478 210.478 0 0 0-22.442 26.913c0 .012-.007.026-.011.038 0-.013.007-.026.011-.038a202.838 202.838 0 0 0-32.247 72.805c-.115.521-.212 1.061-.324 1.586-.452 2.116-2.08 12.7-2.365 15-.022.177-.032.347-.053.524a229.066 229.066 0 0 0-3.9 33.157c0 .41-.025.816-.025 1.227C16 388.418 123.6 496 256.324 496c118.865 0 217.56-86.288 236.882-199.63.407-3.076.733-6.168 1.092-9.271 4.777-41.21-.53-84.525-15.587-120.746zM201.716 354.447c1.124.537 2.18 1.124 3.334 1.639.048.033.114.07.163.1a126.191 126.191 0 0 1-3.497-1.739zm55.053-144.93zm198.131-30.59-.032-.233c.012.085.027.174.04.259z"}),e.jsx("path",{fill:"url(#b)",d:"M478.711 166.353c-10.445-25.124-31.6-52.248-48.212-60.821 13.52 26.505 21.345 53.093 24.335 72.936 0-.058.011.048.036.226.012.085.027.174.04.259 22.675 61.47 10.322 123.978-7.479 162.175-27.539 59.1-94.215 119.67-198.576 116.716C136.1 454.651 36.766 370.988 18.223 261.41c-3.379-17.28 0-26.054 1.7-40.084-2.071 10.816-2.86 13.94-3.9 33.157 0 .41-.025.816-.025 1.227C16 388.418 123.6 496 256.324 496c118.865 0 217.56-86.288 236.882-199.63.407-3.076.733-6.168 1.092-9.271 4.777-41.21-.53-84.525-15.587-120.746z"}),e.jsx("path",{fill:"url(#c)",d:"M478.711 166.353c-10.445-25.124-31.6-52.248-48.212-60.821 13.52 26.505 21.345 53.093 24.335 72.936 0-.058.011.048.036.226.012.085.027.174.04.259 22.675 61.47 10.322 123.978-7.479 162.175-27.539 59.1-94.215 119.67-198.576 116.716C136.1 454.651 36.766 370.988 18.223 261.41c-3.379-17.28 0-26.054 1.7-40.084-2.071 10.816-2.86 13.94-3.9 33.157 0 .41-.025.816-.025 1.227C16 388.418 123.6 496 256.324 496c118.865 0 217.56-86.288 236.882-199.63.407-3.076.733-6.168 1.092-9.271 4.777-41.21-.53-84.525-15.587-120.746z"}),e.jsx("path",{fill:"url(#d)",d:"M361.922 194.6c.524.368 1 .734 1.493 1.1a130.706 130.706 0 0 0-22.31-29.112C266.4 91.892 321.516 4.626 330.811.194c.027-.036.083-.117.1-.136-60.37 35.356-80.85 100.761-82.732 133.484 2.8-.194 5.592-.429 8.442-.429 45.051 0 84.289 24.77 105.301 61.487z"}),e.jsx("path",{fill:"url(#e)",d:"M256.772 209.514c-.393 5.978-21.514 26.593-28.9 26.593-68.339 0-79.432 41.335-79.432 41.335 3.027 34.81 27.261 63.475 56.611 78.643 1.339.692 2.694 1.317 4.05 1.935a132.768 132.768 0 0 0 7.059 2.886 106.743 106.743 0 0 0 31.271 6.031c119.78 5.618 142.986-143.194 56.545-186.408 22.137-3.85 45.115 5.053 57.947 14.067-21.012-36.714-60.25-61.484-105.3-61.484-2.85 0-5.641.235-8.442.429a120.249 120.249 0 0 0-66.142 25.488c3.664 3.1 7.8 7.244 16.514 15.828 16.302 16.067 58.13 32.705 58.219 34.657z"}),e.jsx("path",{fill:"url(#f)",d:"M256.772 209.514c-.393 5.978-21.514 26.593-28.9 26.593-68.339 0-79.432 41.335-79.432 41.335 3.027 34.81 27.261 63.475 56.611 78.643 1.339.692 2.694 1.317 4.05 1.935a132.768 132.768 0 0 0 7.059 2.886 106.743 106.743 0 0 0 31.271 6.031c119.78 5.618 142.986-143.194 56.545-186.408 22.137-3.85 45.115 5.053 57.947 14.067-21.012-36.714-60.25-61.484-105.3-61.484-2.85 0-5.641.235-8.442.429a120.249 120.249 0 0 0-66.142 25.488c3.664 3.1 7.8 7.244 16.514 15.828 16.302 16.067 58.13 32.705 58.219 34.657z"}),e.jsx("path",{fill:"url(#g)",d:"M170.829 151.036a244.042 244.042 0 0 1 4.981 3.3 111.338 111.338 0 0 1-.674-58.732c-24.688 11.241-43.89 29.01-57.85 44.7 1.155-.033 36.014-.66 53.543 10.732z"}),e.jsx("path",{fill:"url(#h)",d:"M18.223 261.41C36.766 370.988 136.1 454.651 248.855 457.844c104.361 2.954 171.037-57.62 198.576-116.716 17.8-38.2 30.154-100.7 7.479-162.175l-.008-.026-.032-.233c-.025-.178-.04-.284-.036-.226 0 .039.015.136.047.4 8.524 55.661-19.79 109.584-64.051 146.044l-.133.313c-86.245 70.223-168.774 42.368-185.484 30.966a144.108 144.108 0 0 1-3.5-1.743c-50.282-24.029-71.054-69.838-66.6-109.124-42.457 0-56.934-35.809-56.934-35.809s38.119-27.179 88.358-3.541c46.53 21.893 90.228 3.543 90.233 3.541-.089-1.952-41.917-18.59-58.223-34.656-8.713-8.584-12.85-12.723-16.514-15.828a71.355 71.355 0 0 0-6.225-4.7 282.929 282.929 0 0 0-4.981-3.3c-17.528-11.392-52.388-10.765-53.543-10.735h-.111c-9.527-12.067-8.855-51.873-8.312-60.184-.114-.515-7.107 3.63-8.023 4.255a175.073 175.073 0 0 0-23.486 20.12 210.478 210.478 0 0 0-22.442 26.919c0 .012-.007.026-.011.038 0-.013.007-.026.011-.038a202.838 202.838 0 0 0-32.247 72.805c-.115.521-8.65 37.842-4.44 57.199z"}),e.jsx("path",{fill:"url(#i)",d:"M341.105 166.587a130.706 130.706 0 0 1 22.31 29.112c1.323.994 2.559 1.985 3.608 2.952 54.482 50.2 25.936 121.2 23.807 126.26 44.261-36.46 72.575-90.383 64.051-146.044C427.706 111.135 381.627 83.823 344 24.355c-1.9-3.007-3.805-6.022-5.661-9.2a73.716 73.716 0 0 1-2.646-4.972A43.7 43.7 0 0 1 332.1.677a.626.626 0 0 0-.546-.644.818.818 0 0 0-.451 0c-.034.012-.084.051-.12.065-.053.021-.12.069-.176.1-9.291 4.428-64.407 91.694 10.298 166.389z"}),e.jsx("path",{fill:"url(#j)",d:"M367.023 198.651c-1.049-.967-2.285-1.958-3.608-2.952-.489-.368-.969-.734-1.493-1.1-12.832-9.014-35.81-17.917-57.947-14.067 86.441 43.214 63.235 192.026-56.545 186.408a106.743 106.743 0 0 1-31.271-6.031 134.51 134.51 0 0 1-7.059-2.886c-1.356-.618-2.711-1.243-4.05-1.935.048.033.114.07.163.1 16.71 11.4 99.239 39.257 185.484-30.966l.133-.313c2.129-5.054 30.675-76.057-23.807-126.258z"}),e.jsx("path",{fill:"url(#k)",d:"M148.439 277.443s11.093-41.335 79.432-41.335c7.388 0 28.509-20.615 28.9-26.593s-43.7 18.352-90.233-3.541c-50.239-23.638-88.358 3.541-88.358 3.541s14.477 35.809 56.934 35.809c-4.453 39.286 16.319 85.1 66.6 109.124 1.124.537 2.18 1.124 3.334 1.639-29.348-15.169-53.582-43.834-56.609-78.644z"}),e.jsx("path",{fill:"url(#l)",d:"M478.711 166.353c-10.445-25.124-31.6-52.248-48.212-60.821 13.52 26.505 21.345 53.093 24.335 72.936 0 .039.015.136.047.4C427.706 111.135 381.627 83.823 344 24.355c-1.9-3.007-3.805-6.022-5.661-9.2a73.716 73.716 0 0 1-2.646-4.972A43.7 43.7 0 0 1 332.1.677a.626.626 0 0 0-.546-.644.818.818 0 0 0-.451 0c-.034.012-.084.051-.12.065-.053.021-.12.069-.176.1.027-.036.083-.117.1-.136-60.37 35.356-80.85 100.761-82.732 133.484 2.8-.194 5.592-.429 8.442-.429 45.053 0 84.291 24.77 105.3 61.484-12.832-9.014-35.81-17.917-57.947-14.067 86.441 43.214 63.235 192.026-56.545 186.408a106.743 106.743 0 0 1-31.271-6.031 134.51 134.51 0 0 1-7.059-2.886c-1.356-.618-2.711-1.243-4.05-1.935.048.033.114.07.163.1a144.108 144.108 0 0 1-3.5-1.743c1.124.537 2.18 1.124 3.334 1.639-29.35-15.168-53.584-43.833-56.611-78.643 0 0 11.093-41.335 79.432-41.335 7.388 0 28.509-20.615 28.9-26.593-.089-1.952-41.917-18.59-58.223-34.656-8.713-8.584-12.85-12.723-16.514-15.828a71.355 71.355 0 0 0-6.225-4.7 111.338 111.338 0 0 1-.674-58.732c-24.688 11.241-43.89 29.01-57.85 44.7h-.111c-9.527-12.067-8.855-51.873-8.312-60.184-.114-.515-7.107 3.63-8.023 4.255a175.073 175.073 0 0 0-23.486 20.12 210.478 210.478 0 0 0-22.435 26.916c0 .012-.007.026-.011.038 0-.013.007-.026.011-.038a202.838 202.838 0 0 0-32.247 72.805c-.115.521-.212 1.061-.324 1.586-.452 2.116-2.486 12.853-2.77 15.156-.022.177.021-.176 0 0a279.565 279.565 0 0 0-3.544 33.53c0 .41-.025.816-.025 1.227C16 388.418 123.6 496 256.324 496c118.865 0 217.56-86.288 236.882-199.63.407-3.076.733-6.168 1.092-9.271 4.777-41.21-.53-84.525-15.587-120.746zm-23.841 12.341c.012.085.027.174.04.259l-.008-.026-.032-.233z"})]}),J0=t=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:250.076,height:248.707,viewBox:"0 0 66.166 65.804",...t,children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"b",children:[e.jsx("stop",{offset:0,stopColor:"#06c2e7"}),e.jsx("stop",{offset:.25,stopColor:"#0db8ec"}),e.jsx("stop",{offset:.5,stopColor:"#12aef1"}),e.jsx("stop",{offset:.75,stopColor:"#1f86f9"}),e.jsx("stop",{offset:1,stopColor:"#107ddd"})]}),e.jsxs("linearGradient",{id:"a",children:[e.jsx("stop",{offset:0,stopColor:"#bdbdbd"}),e.jsx("stop",{offset:1,stopColor:"#fff"})]}),e.jsx("linearGradient",{xlinkHref:"#a",id:"d",x1:412.975,x2:412.975,y1:237.608,y2:59.392,gradientTransform:"translate(206.79 159.773) scale(.35154)",gradientUnits:"userSpaceOnUse"}),e.jsx("filter",{id:"f",width:1.042,height:1.045,x:-.021,y:-.022,colorInterpolationFilters:"sRGB",children:e.jsx("feGaussianBlur",{stdDeviation:.958})}),e.jsx("filter",{id:"c",width:1.096,height:1.096,x:-.048,y:-.048,colorInterpolationFilters:"sRGB",children:e.jsx("feGaussianBlur",{stdDeviation:3.564})}),e.jsx("radialGradient",{xlinkHref:"#b",id:"e",cx:413.061,cy:136.818,r:82.125,fx:413.061,fy:136.818,gradientTransform:"translate(194.545 155.58) scale(.38143)",gradientUnits:"userSpaceOnUse"})]}),e.jsx("path",{d:"M502.083 148.5a89.108 89.108 0 0 1-89.108 89.108 89.108 89.108 0 0 1-89.108-89.108 89.108 89.108 0 0 1 89.108-89.108 89.108 89.108 0 0 1 89.108 89.108Z",filter:"url(#c)",opacity:.53,paintOrder:"markers stroke fill",transform:"matrix(.33865 0 0 .3261 -106.77 -14.478)"}),e.jsx("path",{fill:"url(#d)",stroke:"#cdcdcd",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:.093,d:"M383.294 211.977a31.325 31.325 0 0 1-31.325 31.325 31.325 31.325 0 0 1-31.326-31.325 31.325 31.325 0 0 1 31.326-31.325 31.325 31.325 0 0 1 31.325 31.325z",paintOrder:"markers stroke fill",transform:"translate(-318.886 -180.595)"}),e.jsx("path",{fill:"url(#e)",d:"M380.84 211.977a28.87 28.87 0 0 1-28.871 28.87 28.87 28.87 0 0 1-28.871-28.87 28.87 28.87 0 0 1 28.87-28.87 28.87 28.87 0 0 1 28.871 28.87z",paintOrder:"markers stroke fill",transform:"translate(-318.886 -180.595)"}),e.jsx("path",{fill:"#f4f2f3",d:"M33.083 4.017a.42.42 0 0 0-.421.42v4.856a.42.42 0 1 0 .842 0V4.438a.42.42 0 0 0-.421-.421zm-2.754.174a.42.42 0 0 0-.46.463l.212 2.03a.42.42 0 1 0 .837-.087l-.212-2.03a.42.42 0 0 0-.377-.376zm5.527.002a.42.42 0 0 0-.377.375l-.214 2.03a.42.42 0 1 0 .837.089l.214-2.031a.42.42 0 0 0-.46-.463zM27.5 4.6a.42.42 0 0 0-.41.508l1.005 4.75a.42.42 0 1 0 .824-.174l-1.005-4.75A.42.42 0 0 0 27.5 4.6zm11.183.004a.42.42 0 0 0-.414.333l-1.009 4.75a.42.42 0 1 0 .824.175l1.009-4.75a.42.42 0 0 0-.41-.508zm-13.883.757a.42.42 0 0 0-.437.55l.632 1.942a.42.42 0 1 0 .8-.26l-.63-1.942a.42.42 0 0 0-.365-.29zm16.568.001a.42.42 0 0 0-.364.29l-.632 1.942a.42.42 0 1 0 .8.26l.632-1.942a.42.42 0 0 0-.436-.55zM22.13 6.34a.42.42 0 0 0-.377.592l1.972 4.437a.42.42 0 1 0 .77-.342l-1.972-4.437a.42.42 0 0 0-.393-.25zm21.937.015a.42.42 0 0 0-.392.25l-1.978 4.434a.42.42 0 1 0 .769.343l1.978-4.434a.42.42 0 0 0-.377-.593zM19.654 7.65a.42.42 0 0 0-.394.63l1.02 1.77a.42.42 0 1 0 .73-.421L19.989 7.86a.42.42 0 0 0-.335-.21zm26.858 0a.419.419 0 0 0-.335.21l-1.021 1.769a.42.42 0 1 0 .73.42l1.02-1.768a.42.42 0 0 0-.394-.63zm-29.265 1.5a.422.422 0 0 0-.326.669l2.85 3.93a.42.42 0 1 0 .682-.494l-2.85-3.93a.42.42 0 0 0-.356-.174zm31.702.022a.42.42 0 0 0-.356.174l-2.856 3.926a.42.42 0 1 0 .681.495l2.856-3.926a.42.42 0 0 0-.325-.669zm-33.852 1.783a.42.42 0 0 0-.335.702l1.366 1.518a.42.42 0 1 0 .626-.563l-1.366-1.518a.42.42 0 0 0-.291-.14zm35.975.003a.421.421 0 0 0-.29.139l-1.367 1.517a.42.42 0 1 0 .625.564l1.367-1.518a.42.42 0 0 0-.335-.702zm-38.037 1.977a.42.42 0 0 0-.26.733l3.61 3.249a.42.42 0 1 0 .563-.626l-3.609-3.248a.42.42 0 0 0-.304-.108zm40.109.014a.419.419 0 0 0-.304.108l-3.61 3.245a.42.42 0 1 0 .562.626l3.61-3.245a.42.42 0 0 0-.258-.734zm-41.823 2.19a.42.42 0 0 0-.262.762l1.652 1.2a.42.42 0 1 0 .495-.681l-1.652-1.2a.42.42 0 0 0-.233-.081zm43.535.015a.421.421 0 0 0-.233.08l-1.653 1.2a.42.42 0 1 0 .495.681l1.653-1.2a.42.42 0 0 0-.262-.76zM9.72 17.49a.42.42 0 0 0-.18.785l4.204 2.427a.42.42 0 1 0 .42-.729L9.96 17.546a.42.42 0 0 0-.24-.056zm46.728 0a.417.417 0 0 0-.24.056l-4.205 2.427a.42.42 0 1 0 .42.73l4.206-2.428a.42.42 0 0 0-.181-.785zM8.508 19.996a.42.42 0 0 0-.18.806l1.866.832a.42.42 0 1 0 .343-.77l-1.866-.831a.42.42 0 0 0-.163-.037zm49.158.017a.42.42 0 0 0-.164.037l-1.865.83a.42.42 0 1 0 .342.77l1.866-.831a.42.42 0 0 0-.179-.806zM7.429 22.615a.42.42 0 0 0-.094.82l4.615 1.504a.42.42 0 1 0 .261-.8l-4.616-1.504a.421.421 0 0 0-.166-.02zm51.314.018a.408.408 0 0 0-.166.02l-4.617 1.5a.42.42 0 1 0 .26.801l4.617-1.5a.42.42 0 0 0-.094-.82zM6.756 25.365a.42.42 0 0 0-.09.833l1.998.424a.42.42 0 1 0 .175-.823l-1.998-.425a.413.413 0 0 0-.085-.009zm52.655.004a.518.518 0 0 0-.085.009l-1.998.424a.42.42 0 1 0 .175.823l1.998-.424a.42.42 0 0 0-.09-.833zM6.247 28.13a.42.42 0 0 0-.003.838l4.828.51a.42.42 0 1 0 .089-.837l-4.829-.51a.432.432 0 0 0-.085 0zm53.676.037a.386.386 0 0 0-.085 0l-4.83.504a.42.42 0 1 0 .088.837l4.83-.504a.42.42 0 0 0-.003-.837zM6.165 30.96a.42.42 0 1 0 0 .842h2.043a.42.42 0 1 0 0-.842zm51.793 0a.42.42 0 1 0 0 .842h2.043a.42.42 0 1 0 0-.842zm-46.803 2.295a.384.384 0 0 0-.085 0l-4.83.504a.42.42 0 1 0 .088.838l4.83-.504a.42.42 0 0 0-.003-.838zm43.853.03a.42.42 0 0 0-.003.838l4.828.51a.42.42 0 1 0 .089-.837l-4.828-.51a.434.434 0 0 0-.086-.001zM8.748 36.13a.43.43 0 0 0-.085.009l-1.998.424a.42.42 0 1 0 .175.823l1.998-.424a.42.42 0 0 0-.09-.833zm48.67.004a.42.42 0 0 0-.09.833l1.997.424a.42.42 0 1 0 .175-.824l-1.998-.424a.413.413 0 0 0-.085-.01zM12.111 37.79a.408.408 0 0 0-.166.02l-4.617 1.5a.42.42 0 1 0 .26.801l4.617-1.5a.42.42 0 0 0-.094-.82zm41.937.015a.42.42 0 0 0-.094.82l4.616 1.504a.42.42 0 1 0 .26-.8l-4.615-1.504a.421.421 0 0 0-.167-.02zM10.35 41.08a.42.42 0 0 0-.163.036l-1.866.831a.42.42 0 1 0 .342.769l1.866-.83a.42.42 0 0 0-.179-.806zm45.459.016a.42.42 0 0 0-.18.805l1.865.832a.42.42 0 1 0 .343-.769l-1.865-.832a.42.42 0 0 0-.163-.036zm-41.826.912a.417.417 0 0 0-.24.056L9.538 44.49a.42.42 0 1 0 .421.73l4.205-2.428a.42.42 0 0 0-.181-.785zm38.2 0a.42.42 0 0 0-.181.785l4.205 2.427a.42.42 0 1 0 .42-.729l-4.204-2.427a.42.42 0 0 0-.24-.056zm-39.249 3.562a.421.421 0 0 0-.233.08l-1.653 1.2a.42.42 0 1 0 .495.682l1.653-1.2a.42.42 0 0 0-.262-.762zm40.288.015a.42.42 0 0 0-.262.762l1.652 1.2a.42.42 0 1 0 .495-.681l-1.652-1.2a.42.42 0 0 0-.233-.081zm-36.544.145a.418.418 0 0 0-.304.108l-3.61 3.245a.42.42 0 1 0 .562.626l3.61-3.245a.42.42 0 0 0-.258-.734zm32.8.011a.421.421 0 0 0-.26.734l3.609 3.248a.42.42 0 1 0 .563-.625l-3.608-3.249a.42.42 0 0 0-.304-.107zm-29.375 3.084a.42.42 0 0 0-.355.173l-2.856 3.927a.42.42 0 1 0 .68.495l2.857-3.926a.42.42 0 0 0-.326-.669zm25.936.018a.421.421 0 0 0-.326.668l2.85 3.93a.42.42 0 1 0 .682-.494l-2.851-3.93a.42.42 0 0 0-.355-.174zm-29.623.606a.421.421 0 0 0-.29.14l-1.367 1.517a.42.42 0 1 0 .625.563l1.367-1.517a.42.42 0 0 0-.335-.703zm33.331.002a.42.42 0 0 0-.335.702l1.366 1.518a.42.42 0 1 0 .626-.563l-1.366-1.518a.42.42 0 0 0-.291-.139zm-25.655 1.684a.419.419 0 0 0-.393.25l-1.978 4.433a.42.42 0 1 0 .77.343l1.977-4.434a.42.42 0 0 0-.376-.592zm17.955.012a.42.42 0 0 0-.377.592l1.972 4.437a.42.42 0 1 0 .77-.342l-1.972-4.437a.42.42 0 0 0-.393-.25zm-21.431 1.359a.419.419 0 0 0-.335.21l-1.021 1.768a.42.42 0 1 0 .729.421l1.02-1.769a.42.42 0 0 0-.393-.63zm24.934 0a.42.42 0 0 0-.394.63l1.021 1.77a.42.42 0 1 0 .73-.422l-1.022-1.769a.42.42 0 0 0-.335-.21zm-17.054.063a.42.42 0 0 0-.415.334l-1.009 4.749a.42.42 0 1 0 .824.175l1.009-4.75a.42.42 0 0 0-.41-.508zm9.16.003a.42.42 0 0 0-.41.508l1.006 4.75a.42.42 0 1 0 .823-.175l-1.006-4.75a.42.42 0 0 0-.414-.333zm-4.573.48a.42.42 0 0 0-.421.42v4.855a.42.42 0 1 0 .842 0v-4.855a.42.42 0 0 0-.421-.42zm-7.727 1.568a.42.42 0 0 0-.364.29l-.631 1.942a.42.42 0 1 0 .8.26l.632-1.942a.42.42 0 0 0-.437-.55zm15.45 0a.42.42 0 0 0-.437.55l.632 1.943a.42.42 0 1 0 .8-.26l-.63-1.942a.42.42 0 0 0-.365-.29zm-10.365 1.083a.42.42 0 0 0-.378.375l-.213 2.03a.42.42 0 1 0 .837.088l.214-2.03a.42.42 0 0 0-.46-.463zm5.267.002a.42.42 0 0 0-.46.463l.212 2.03a.42.42 0 1 0 .837-.088l-.212-2.03a.42.42 0 0 0-.377-.375z",paintOrder:"markers stroke fill"}),e.jsx("path",{d:"m469.096 100.607-65.51 38.061-41.42 65.207 60.595-44.882z",filter:"url(#f)",opacity:.409,paintOrder:"markers stroke fill",transform:"translate(-112.095 -20.822) scale(.35154)"}),e.jsx("path",{fill:"#ff5150",d:"m36.383 34.838-6.6-6.913 23.416-15.752z",paintOrder:"markers stroke fill"}),e.jsx("path",{fill:"#f1f1f1",d:"m36.383 34.838-6.6-6.913L12.966 50.59z",paintOrder:"markers stroke fill"}),e.jsx("path",{d:"m12.967 50.59 23.416-15.752L53.2 12.173z",opacity:.243})]}),ev=t=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",...t,children:[e.jsxs("defs",{children:[e.jsxs("radialGradient",{id:"b",cx:161.8,cy:68.9,r:95.4,gradientTransform:"matrix(1 0 0 -.95 0 248.8)",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:.7,stopOpacity:0}),e.jsx("stop",{offset:.9,stopOpacity:.5}),e.jsx("stop",{offset:1})]}),e.jsxs("radialGradient",{id:"d",cx:-340.3,cy:63,r:143.2,gradientTransform:"matrix(.15 -.99 -.8 -.12 176.6 -125.4)",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:.8,stopOpacity:0}),e.jsx("stop",{offset:.9,stopOpacity:.5}),e.jsx("stop",{offset:1})]}),e.jsxs("radialGradient",{id:"e",cx:113.4,cy:570.2,r:202.4,gradientTransform:"matrix(-.04 1 2.13 .08 -1179.5 -106.7)",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:0,stopColor:"#35c1f1"}),e.jsx("stop",{offset:.1,stopColor:"#34c1ed"}),e.jsx("stop",{offset:.2,stopColor:"#2fc2df"}),e.jsx("stop",{offset:.3,stopColor:"#2bc3d2"}),e.jsx("stop",{offset:.7,stopColor:"#36c752"})]}),e.jsxs("radialGradient",{id:"f",cx:376.5,cy:568,r:97.3,gradientTransform:"matrix(.28 .96 .78 -.23 -303.8 -148.5)",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:0,stopColor:"#66eb6e"}),e.jsx("stop",{offset:1,stopColor:"#66eb6e",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"a",x1:63.3,x2:241.7,y1:84,y2:84,gradientTransform:"matrix(1 0 0 -1 0 266)",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:0,stopColor:"#0c59a4"}),e.jsx("stop",{offset:1,stopColor:"#114a8b"})]}),e.jsxs("linearGradient",{id:"c",x1:157.3,x2:46,y1:161.4,y2:40.1,gradientTransform:"matrix(1 0 0 -1 0 266)",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:0,stopColor:"#1b9de2"}),e.jsx("stop",{offset:.2,stopColor:"#1595df"}),e.jsx("stop",{offset:.7,stopColor:"#0680d7"}),e.jsx("stop",{offset:1,stopColor:"#0078d4"})]})]}),e.jsx("path",{d:"M235.7 195.5a93.7 93.7 0 0 1-10.6 4.7 101.9 101.9 0 0 1-35.9 6.4c-47.3 0-88.5-32.5-88.5-74.3a31.5 31.5 0 0 1 16.4-27.3c-42.8 1.8-53.8 46.4-53.8 72.5 0 74 68.1 81.4 82.8 81.4 7.9 0 19.8-2.3 27-4.6l1.3-.4a128.3 128.3 0 0 0 66.6-52.8 4 4 0 0 0-5.3-5.6Z",style:{fill:"url(#a)"},transform:"translate(-4.6 -5)"}),e.jsx("path",{d:"M235.7 195.5a93.7 93.7 0 0 1-10.6 4.7 101.9 101.9 0 0 1-35.9 6.4c-47.3 0-88.5-32.5-88.5-74.3a31.5 31.5 0 0 1 16.4-27.3c-42.8 1.8-53.8 46.4-53.8 72.5 0 74 68.1 81.4 82.8 81.4 7.9 0 19.8-2.3 27-4.6l1.3-.4a128.3 128.3 0 0 0 66.6-52.8 4 4 0 0 0-5.3-5.6Z",style:{isolation:"isolate",opacity:.35,fill:"url(#b)"},transform:"translate(-4.6 -5)"}),e.jsx("path",{d:"M110.3 246.3A79.2 79.2 0 0 1 87.6 225a80.7 80.7 0 0 1 29.5-120c3.2-1.5 8.5-4.1 15.6-4a32.4 32.4 0 0 1 25.7 13 31.9 31.9 0 0 1 6.3 18.7c0-.2 24.5-79.6-80-79.6-43.9 0-80 41.6-80 78.2a130.2 130.2 0 0 0 12.1 56 128 128 0 0 0 156.4 67 75.5 75.5 0 0 1-62.8-8Z",style:{fill:"url(#c)"},transform:"translate(-4.6 -5)"}),e.jsx("path",{d:"M110.3 246.3A79.2 79.2 0 0 1 87.6 225a80.7 80.7 0 0 1 29.5-120c3.2-1.5 8.5-4.1 15.6-4a32.4 32.4 0 0 1 25.7 13 31.9 31.9 0 0 1 6.3 18.7c0-.2 24.5-79.6-80-79.6-43.9 0-80 41.6-80 78.2a130.2 130.2 0 0 0 12.1 56 128 128 0 0 0 156.4 67 75.5 75.5 0 0 1-62.8-8Z",style:{opacity:.41,fill:"url(#d)",isolation:"isolate"},transform:"translate(-4.6 -5)"}),e.jsx("path",{d:"M157 153.8c-.9 1-3.4 2.5-3.4 5.6 0 2.6 1.7 5.2 4.8 7.3 14.3 10 41.4 8.6 41.5 8.6a59.6 59.6 0 0 0 30.3-8.3 61.4 61.4 0 0 0 30.4-52.9c.3-22.4-8-37.3-11.3-43.9C228 28.8 182.3 5 132.6 5a128 128 0 0 0-128 126.2c.5-36.5 36.8-66 80-66 3.5 0 23.5.3 42 10a72.6 72.6 0 0 1 30.9 29.3c6.1 10.6 7.2 24.1 7.2 29.5s-2.7 13.3-7.8 19.9Z",style:{fill:"url(#e)"},transform:"translate(-4.6 -5)"}),e.jsx("path",{d:"M157 153.8c-.9 1-3.4 2.5-3.4 5.6 0 2.6 1.7 5.2 4.8 7.3 14.3 10 41.4 8.6 41.5 8.6a59.6 59.6 0 0 0 30.3-8.3 61.4 61.4 0 0 0 30.4-52.9c.3-22.4-8-37.3-11.3-43.9C228 28.8 182.3 5 132.6 5a128 128 0 0 0-128 126.2c.5-36.5 36.8-66 80-66 3.5 0 23.5.3 42 10a72.6 72.6 0 0 1 30.9 29.3c6.1 10.6 7.2 24.1 7.2 29.5s-2.7 13.3-7.8 19.9Z",style:{fill:"url(#f)"},transform:"translate(-4.6 -5)"})]}),tv=t=>e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t,role:"img","aria-label":"Opera",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"opera-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:"#FF1B2D"}),e.jsx("stop",{offset:"50%",stopColor:"#CC0000"}),e.jsx("stop",{offset:"100%",stopColor:"#A02128"})]})}),e.jsx("circle",{cx:"12",cy:"12",r:"11",fill:"url(#opera-gradient)"}),e.jsx("ellipse",{cx:"12",cy:"12",rx:"6.5",ry:"8.5",fill:"none",stroke:"#fff",strokeWidth:"1.2",opacity:"0.9"}),e.jsx("ellipse",{cx:"12",cy:"12",rx:"3.5",ry:"5.5",fill:"#fff"}),e.jsx("path",{d:"M12 8.5c-1.4 0-2.5 1.6-2.5 3.5s1.1 3.5 2.5 3.5 2.5-1.6 2.5-3.5-1.1-3.5-2.5-3.5z",fill:"url(#opera-gradient)"})]}),rv=t=>e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t,role:"img","aria-label":"Brave",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"brave-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:"#FB542B"}),e.jsx("stop",{offset:"50%",stopColor:"#FF6B35"}),e.jsx("stop",{offset:"100%",stopColor:"#FF4500"})]})}),e.jsx("circle",{cx:"12",cy:"12",r:"11",fill:"url(#brave-gradient)"}),e.jsx("path",{d:"M12 3.5l1.5 2h2.5l-.8 3 1.3 2.5-2.5.8v2.7l-2-.7-2 .7v-2.7l-2.5-.8L8.8 8.5 8 5.5h2.5L12 3.5z",fill:"#fff"}),e.jsx("path",{d:"M12 6.5c-.8 0-1.5.7-1.5 1.5v3c0 .8.7 1.5 1.5 1.5s1.5-.7 1.5-1.5V8c0-.8-.7-1.5-1.5-1.5z",fill:"url(#brave-gradient)"}),e.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"url(#brave-gradient)"})]}),ov=or`
|
|
3973
|
+
`,Q0=({codes:t,onClose:r,onCopy:o,onDownload:n,triggerRef:s})=>{const a=i.useRef(null),[h,f]=i.useState(!1),[c,p]=i.useState({top:0,left:0});return i.useEffect(()=>{f(!0);const d=setTimeout(()=>{if(!a.current||!(s!=null&&s.current))return;const m=s.current;if(m){const v=m.getBoundingClientRect(),y=380,S=300,E=8;let b=0,$=0;const C=window.innerHeight-v.bottom,w=v.top;C>=S+E?(b=v.bottom+E,$=v.right-y,$<E&&($=v.left,$+y>window.innerWidth-E&&($=(window.innerWidth-y)/2))):w>=S+E?(b=v.top-S-E,$=v.right-y,$<E&&($=v.left,$+y>window.innerWidth-E&&($=(window.innerWidth-y)/2))):(b=v.bottom+E,$=v.right-y,$<E&&($=v.left)),p({top:b,left:$})}},10),u=m=>{a.current&&!a.current.contains(m.target)&&r()},g=m=>{m.key==="Escape"&&r()};return document.addEventListener("mousedown",u),document.addEventListener("keydown",g),()=>{clearTimeout(d),document.removeEventListener("mousedown",u),document.removeEventListener("keydown",g)}},[r,s]),h?e.jsxs(V0,{ref:a,style:{top:`${c.top}px`,left:`${c.left}px`,visibility:c.top>0?"visible":"hidden"},onClick:d=>d.stopPropagation(),children:[e.jsxs(G0,{children:[e.jsx(H0,{children:"Backup Codes"}),e.jsxs(q0,{children:[e.jsxs(pi,{onClick:o,style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx(No,{size:14}),"Copy"]}),e.jsxs(pi,{onClick:n,style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx(tn,{size:14}),"Download"]})]})]}),e.jsx("div",{style:{fontSize:"13px",color:"var(--color-muted)",marginBottom:"8px"},children:"Save these backup codes in a secure location. Each code can only be used once."}),e.jsx(Y0,{children:t.map((d,u)=>e.jsx(Z0,{onClick:()=>{navigator.clipboard.writeText(d)},title:"Click to copy",children:d},u))}),e.jsxs("div",{style:{fontSize:"12px",color:"var(--color-warning)",padding:"6px 10px",background:"var(--color-warning-background)",border:"1px solid var(--color-warning-border)",borderRadius:"var(--radius-sm)",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx("span",{style:{fontSize:"14px"},children:"⚠️"}),e.jsx("span",{children:"Keep these codes safe! They won't be shown again."})]})]}):null},K0=t=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:48,height:48,...t,children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"a",x1:3.217,x2:44.781,y1:15,y2:15,gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:0,stopColor:"#d93025"}),e.jsx("stop",{offset:1,stopColor:"#ea4335"})]}),e.jsxs("linearGradient",{id:"b",x1:20.722,x2:41.504,y1:47.679,y2:11.684,gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:0,stopColor:"#fcc934"}),e.jsx("stop",{offset:1,stopColor:"#fbbc04"})]}),e.jsxs("linearGradient",{id:"c",x1:26.598,x2:5.816,y1:46.502,y2:10.506,gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:0,stopColor:"#1e8e3e"}),e.jsx("stop",{offset:1,stopColor:"#34a853"})]})]}),e.jsx("circle",{cx:24,cy:23.995,r:12,style:{fill:"#fff"}}),e.jsx("path",{d:"M3.215 36A24 24 0 1 0 12 3.215 24 24 0 0 0 3.215 36Zm31.177-18A12 12 0 1 1 18 13.608 12 12 0 0 1 34.392 18Z",style:{fill:"none"}}),e.jsx("path",{d:"M24 12h20.781a23.994 23.994 0 0 0-41.564.003L13.607 30l.01-.002A11.985 11.985 0 0 1 24 12Z",style:{fill:"url(#a)"}}),e.jsx("circle",{cx:24,cy:24,r:9.5,style:{fill:"#1a73e8"}}),e.jsx("path",{d:"M34.391 30.003 24.001 48A23.994 23.994 0 0 0 44.78 12.003H23.999l-.003.01a11.985 11.985 0 0 1 10.395 17.99Z",style:{fill:"url(#b)"}}),e.jsx("path",{d:"M13.609 30.003 3.218 12.006A23.994 23.994 0 0 0 24.003 48l10.39-17.997-.007-.007a11.985 11.985 0 0 1-20.777.007Z",style:{fill:"url(#c)"}})]}),X0=t=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:512,height:512,viewBox:"0 0 512 512",...t,children:[e.jsxs("defs",{children:[e.jsxs("radialGradient",{id:"g",cx:"210%",cy:"-100%",r:"290%",children:[e.jsx("stop",{offset:.1,stopColor:"#ffe226"}),e.jsx("stop",{offset:.79,stopColor:"#ff7139"})]}),e.jsxs("radialGradient",{id:"c",cx:"49%",cy:"40%",r:"128%",gradientTransform:"matrix(.82 0 0 1 .088 0)",children:[e.jsx("stop",{offset:.3,stopColor:"#960e18"}),e.jsx("stop",{offset:.35,stopColor:"#b11927",stopOpacity:.74}),e.jsx("stop",{offset:.43,stopColor:"#db293d",stopOpacity:.34}),e.jsx("stop",{offset:.5,stopColor:"#f5334b",stopOpacity:.09}),e.jsx("stop",{offset:.53,stopColor:"#ff3750",stopOpacity:0})]}),e.jsxs("radialGradient",{id:"d",cx:"48%",cy:"-12%",r:"140%",children:[e.jsx("stop",{offset:.13,stopColor:"#fff44f"}),e.jsx("stop",{offset:.53,stopColor:"#ff980e"})]}),e.jsxs("radialGradient",{id:"e",cx:"22.76%",cy:"110.11%",r:"100%",children:[e.jsx("stop",{offset:.35,stopColor:"#3a8ee6"}),e.jsx("stop",{offset:.67,stopColor:"#9059ff"}),e.jsx("stop",{offset:1,stopColor:"#c139e6"})]}),e.jsxs("radialGradient",{id:"f",cx:"52%",cy:"33%",r:"59%",gradientTransform:"scale(.9 1)",children:[e.jsx("stop",{offset:.21,stopColor:"#9059ff",stopOpacity:0}),e.jsx("stop",{offset:.97,stopColor:"#6e008b",stopOpacity:.6})]}),e.jsxs("radialGradient",{id:"b",cx:"87.4%",cy:"-12.9%",r:"128%",gradientTransform:"matrix(.8 0 0 1 .178 .129)",children:[e.jsx("stop",{offset:.13,stopColor:"#ffbd4f"}),e.jsx("stop",{offset:.28,stopColor:"#ff980e"}),e.jsx("stop",{offset:.47,stopColor:"#ff3750"}),e.jsx("stop",{offset:.78,stopColor:"#eb0878"}),e.jsx("stop",{offset:.86,stopColor:"#e50080"})]}),e.jsxs("radialGradient",{id:"h",cx:"84%",cy:"-41%",r:"180%",children:[e.jsx("stop",{offset:.11,stopColor:"#fff44f"}),e.jsx("stop",{offset:.46,stopColor:"#ff980e"}),e.jsx("stop",{offset:.72,stopColor:"#ff3647"}),e.jsx("stop",{offset:.9,stopColor:"#e31587"})]}),e.jsxs("radialGradient",{id:"i",cx:"16.1%",cy:"-18.6%",r:"348.8%",gradientTransform:"scale(1 .47) rotate(84 .279 -.297)",children:[e.jsx("stop",{offset:0,stopColor:"#fff44f"}),e.jsx("stop",{offset:.3,stopColor:"#ff980e"}),e.jsx("stop",{offset:.57,stopColor:"#ff3647"}),e.jsx("stop",{offset:.74,stopColor:"#e31587"})]}),e.jsxs("radialGradient",{id:"j",cx:"18.9%",cy:"-42.5%",r:"238.4%",children:[e.jsx("stop",{offset:.14,stopColor:"#fff44f"}),e.jsx("stop",{offset:.48,stopColor:"#ff980e"}),e.jsx("stop",{offset:.66,stopColor:"#ff3647"}),e.jsx("stop",{offset:.9,stopColor:"#e31587"})]}),e.jsxs("radialGradient",{id:"k",cx:"159.3%",cy:"-44.72%",r:"313.1%",children:[e.jsx("stop",{offset:.09,stopColor:"#fff44f"}),e.jsx("stop",{offset:.63,stopColor:"#ff980e"})]}),e.jsxs("linearGradient",{id:"a",x1:"87.25%",x2:"9.4%",y1:"15.5%",y2:"93.1%",children:[e.jsx("stop",{offset:.05,stopColor:"#fff44f"}),e.jsx("stop",{offset:.37,stopColor:"#ff980e"}),e.jsx("stop",{offset:.53,stopColor:"#ff3647"}),e.jsx("stop",{offset:.7,stopColor:"#e31587"})]}),e.jsxs("linearGradient",{id:"l",x1:"80%",x2:"18%",y1:"14%",y2:"84%",children:[e.jsx("stop",{offset:.17,stopColor:"#fff44f",stopOpacity:.8}),e.jsx("stop",{offset:.6,stopColor:"#fff44f",stopOpacity:0})]})]}),e.jsx("path",{fill:"url(#a)",d:"M478.711 166.353c-10.445-25.124-31.6-52.248-48.212-60.821 13.52 26.505 21.345 53.093 24.335 72.936 0 .039.015.136.047.4C427.706 111.135 381.627 83.823 344 24.355c-1.9-3.007-3.805-6.022-5.661-9.2a73.716 73.716 0 0 1-2.646-4.972A43.7 43.7 0 0 1 332.1.677a.626.626 0 0 0-.546-.644.818.818 0 0 0-.451 0c-.034.012-.084.051-.12.065-.053.021-.12.069-.176.1.027-.036.083-.117.1-.136-60.37 35.356-80.85 100.761-82.732 133.484a120.249 120.249 0 0 0-66.142 25.488 71.355 71.355 0 0 0-6.225-4.7 111.338 111.338 0 0 1-.674-58.732c-24.688 11.241-43.89 29.01-57.85 44.7h-.111c-9.527-12.067-8.855-51.873-8.312-60.184-.114-.515-7.107 3.63-8.023 4.255a175.073 175.073 0 0 0-23.486 20.12 210.478 210.478 0 0 0-22.442 26.913c0 .012-.007.026-.011.038 0-.013.007-.026.011-.038a202.838 202.838 0 0 0-32.247 72.805c-.115.521-.212 1.061-.324 1.586-.452 2.116-2.08 12.7-2.365 15-.022.177-.032.347-.053.524a229.066 229.066 0 0 0-3.9 33.157c0 .41-.025.816-.025 1.227C16 388.418 123.6 496 256.324 496c118.865 0 217.56-86.288 236.882-199.63.407-3.076.733-6.168 1.092-9.271 4.777-41.21-.53-84.525-15.587-120.746zM201.716 354.447c1.124.537 2.18 1.124 3.334 1.639.048.033.114.07.163.1a126.191 126.191 0 0 1-3.497-1.739zm55.053-144.93zm198.131-30.59-.032-.233c.012.085.027.174.04.259z"}),e.jsx("path",{fill:"url(#b)",d:"M478.711 166.353c-10.445-25.124-31.6-52.248-48.212-60.821 13.52 26.505 21.345 53.093 24.335 72.936 0-.058.011.048.036.226.012.085.027.174.04.259 22.675 61.47 10.322 123.978-7.479 162.175-27.539 59.1-94.215 119.67-198.576 116.716C136.1 454.651 36.766 370.988 18.223 261.41c-3.379-17.28 0-26.054 1.7-40.084-2.071 10.816-2.86 13.94-3.9 33.157 0 .41-.025.816-.025 1.227C16 388.418 123.6 496 256.324 496c118.865 0 217.56-86.288 236.882-199.63.407-3.076.733-6.168 1.092-9.271 4.777-41.21-.53-84.525-15.587-120.746z"}),e.jsx("path",{fill:"url(#c)",d:"M478.711 166.353c-10.445-25.124-31.6-52.248-48.212-60.821 13.52 26.505 21.345 53.093 24.335 72.936 0-.058.011.048.036.226.012.085.027.174.04.259 22.675 61.47 10.322 123.978-7.479 162.175-27.539 59.1-94.215 119.67-198.576 116.716C136.1 454.651 36.766 370.988 18.223 261.41c-3.379-17.28 0-26.054 1.7-40.084-2.071 10.816-2.86 13.94-3.9 33.157 0 .41-.025.816-.025 1.227C16 388.418 123.6 496 256.324 496c118.865 0 217.56-86.288 236.882-199.63.407-3.076.733-6.168 1.092-9.271 4.777-41.21-.53-84.525-15.587-120.746z"}),e.jsx("path",{fill:"url(#d)",d:"M361.922 194.6c.524.368 1 .734 1.493 1.1a130.706 130.706 0 0 0-22.31-29.112C266.4 91.892 321.516 4.626 330.811.194c.027-.036.083-.117.1-.136-60.37 35.356-80.85 100.761-82.732 133.484 2.8-.194 5.592-.429 8.442-.429 45.051 0 84.289 24.77 105.301 61.487z"}),e.jsx("path",{fill:"url(#e)",d:"M256.772 209.514c-.393 5.978-21.514 26.593-28.9 26.593-68.339 0-79.432 41.335-79.432 41.335 3.027 34.81 27.261 63.475 56.611 78.643 1.339.692 2.694 1.317 4.05 1.935a132.768 132.768 0 0 0 7.059 2.886 106.743 106.743 0 0 0 31.271 6.031c119.78 5.618 142.986-143.194 56.545-186.408 22.137-3.85 45.115 5.053 57.947 14.067-21.012-36.714-60.25-61.484-105.3-61.484-2.85 0-5.641.235-8.442.429a120.249 120.249 0 0 0-66.142 25.488c3.664 3.1 7.8 7.244 16.514 15.828 16.302 16.067 58.13 32.705 58.219 34.657z"}),e.jsx("path",{fill:"url(#f)",d:"M256.772 209.514c-.393 5.978-21.514 26.593-28.9 26.593-68.339 0-79.432 41.335-79.432 41.335 3.027 34.81 27.261 63.475 56.611 78.643 1.339.692 2.694 1.317 4.05 1.935a132.768 132.768 0 0 0 7.059 2.886 106.743 106.743 0 0 0 31.271 6.031c119.78 5.618 142.986-143.194 56.545-186.408 22.137-3.85 45.115 5.053 57.947 14.067-21.012-36.714-60.25-61.484-105.3-61.484-2.85 0-5.641.235-8.442.429a120.249 120.249 0 0 0-66.142 25.488c3.664 3.1 7.8 7.244 16.514 15.828 16.302 16.067 58.13 32.705 58.219 34.657z"}),e.jsx("path",{fill:"url(#g)",d:"M170.829 151.036a244.042 244.042 0 0 1 4.981 3.3 111.338 111.338 0 0 1-.674-58.732c-24.688 11.241-43.89 29.01-57.85 44.7 1.155-.033 36.014-.66 53.543 10.732z"}),e.jsx("path",{fill:"url(#h)",d:"M18.223 261.41C36.766 370.988 136.1 454.651 248.855 457.844c104.361 2.954 171.037-57.62 198.576-116.716 17.8-38.2 30.154-100.7 7.479-162.175l-.008-.026-.032-.233c-.025-.178-.04-.284-.036-.226 0 .039.015.136.047.4 8.524 55.661-19.79 109.584-64.051 146.044l-.133.313c-86.245 70.223-168.774 42.368-185.484 30.966a144.108 144.108 0 0 1-3.5-1.743c-50.282-24.029-71.054-69.838-66.6-109.124-42.457 0-56.934-35.809-56.934-35.809s38.119-27.179 88.358-3.541c46.53 21.893 90.228 3.543 90.233 3.541-.089-1.952-41.917-18.59-58.223-34.656-8.713-8.584-12.85-12.723-16.514-15.828a71.355 71.355 0 0 0-6.225-4.7 282.929 282.929 0 0 0-4.981-3.3c-17.528-11.392-52.388-10.765-53.543-10.735h-.111c-9.527-12.067-8.855-51.873-8.312-60.184-.114-.515-7.107 3.63-8.023 4.255a175.073 175.073 0 0 0-23.486 20.12 210.478 210.478 0 0 0-22.442 26.919c0 .012-.007.026-.011.038 0-.013.007-.026.011-.038a202.838 202.838 0 0 0-32.247 72.805c-.115.521-8.65 37.842-4.44 57.199z"}),e.jsx("path",{fill:"url(#i)",d:"M341.105 166.587a130.706 130.706 0 0 1 22.31 29.112c1.323.994 2.559 1.985 3.608 2.952 54.482 50.2 25.936 121.2 23.807 126.26 44.261-36.46 72.575-90.383 64.051-146.044C427.706 111.135 381.627 83.823 344 24.355c-1.9-3.007-3.805-6.022-5.661-9.2a73.716 73.716 0 0 1-2.646-4.972A43.7 43.7 0 0 1 332.1.677a.626.626 0 0 0-.546-.644.818.818 0 0 0-.451 0c-.034.012-.084.051-.12.065-.053.021-.12.069-.176.1-9.291 4.428-64.407 91.694 10.298 166.389z"}),e.jsx("path",{fill:"url(#j)",d:"M367.023 198.651c-1.049-.967-2.285-1.958-3.608-2.952-.489-.368-.969-.734-1.493-1.1-12.832-9.014-35.81-17.917-57.947-14.067 86.441 43.214 63.235 192.026-56.545 186.408a106.743 106.743 0 0 1-31.271-6.031 134.51 134.51 0 0 1-7.059-2.886c-1.356-.618-2.711-1.243-4.05-1.935.048.033.114.07.163.1 16.71 11.4 99.239 39.257 185.484-30.966l.133-.313c2.129-5.054 30.675-76.057-23.807-126.258z"}),e.jsx("path",{fill:"url(#k)",d:"M148.439 277.443s11.093-41.335 79.432-41.335c7.388 0 28.509-20.615 28.9-26.593s-43.7 18.352-90.233-3.541c-50.239-23.638-88.358 3.541-88.358 3.541s14.477 35.809 56.934 35.809c-4.453 39.286 16.319 85.1 66.6 109.124 1.124.537 2.18 1.124 3.334 1.639-29.348-15.169-53.582-43.834-56.609-78.644z"}),e.jsx("path",{fill:"url(#l)",d:"M478.711 166.353c-10.445-25.124-31.6-52.248-48.212-60.821 13.52 26.505 21.345 53.093 24.335 72.936 0 .039.015.136.047.4C427.706 111.135 381.627 83.823 344 24.355c-1.9-3.007-3.805-6.022-5.661-9.2a73.716 73.716 0 0 1-2.646-4.972A43.7 43.7 0 0 1 332.1.677a.626.626 0 0 0-.546-.644.818.818 0 0 0-.451 0c-.034.012-.084.051-.12.065-.053.021-.12.069-.176.1.027-.036.083-.117.1-.136-60.37 35.356-80.85 100.761-82.732 133.484 2.8-.194 5.592-.429 8.442-.429 45.053 0 84.291 24.77 105.3 61.484-12.832-9.014-35.81-17.917-57.947-14.067 86.441 43.214 63.235 192.026-56.545 186.408a106.743 106.743 0 0 1-31.271-6.031 134.51 134.51 0 0 1-7.059-2.886c-1.356-.618-2.711-1.243-4.05-1.935.048.033.114.07.163.1a144.108 144.108 0 0 1-3.5-1.743c1.124.537 2.18 1.124 3.334 1.639-29.35-15.168-53.584-43.833-56.611-78.643 0 0 11.093-41.335 79.432-41.335 7.388 0 28.509-20.615 28.9-26.593-.089-1.952-41.917-18.59-58.223-34.656-8.713-8.584-12.85-12.723-16.514-15.828a71.355 71.355 0 0 0-6.225-4.7 111.338 111.338 0 0 1-.674-58.732c-24.688 11.241-43.89 29.01-57.85 44.7h-.111c-9.527-12.067-8.855-51.873-8.312-60.184-.114-.515-7.107 3.63-8.023 4.255a175.073 175.073 0 0 0-23.486 20.12 210.478 210.478 0 0 0-22.435 26.916c0 .012-.007.026-.011.038 0-.013.007-.026.011-.038a202.838 202.838 0 0 0-32.247 72.805c-.115.521-.212 1.061-.324 1.586-.452 2.116-2.486 12.853-2.77 15.156-.022.177.021-.176 0 0a279.565 279.565 0 0 0-3.544 33.53c0 .41-.025.816-.025 1.227C16 388.418 123.6 496 256.324 496c118.865 0 217.56-86.288 236.882-199.63.407-3.076.733-6.168 1.092-9.271 4.777-41.21-.53-84.525-15.587-120.746zm-23.841 12.341c.012.085.027.174.04.259l-.008-.026-.032-.233z"})]}),J0=t=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:250.076,height:248.707,viewBox:"0 0 66.166 65.804",...t,children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"b",children:[e.jsx("stop",{offset:0,stopColor:"#06c2e7"}),e.jsx("stop",{offset:.25,stopColor:"#0db8ec"}),e.jsx("stop",{offset:.5,stopColor:"#12aef1"}),e.jsx("stop",{offset:.75,stopColor:"#1f86f9"}),e.jsx("stop",{offset:1,stopColor:"#107ddd"})]}),e.jsxs("linearGradient",{id:"a",children:[e.jsx("stop",{offset:0,stopColor:"#bdbdbd"}),e.jsx("stop",{offset:1,stopColor:"#fff"})]}),e.jsx("linearGradient",{xlinkHref:"#a",id:"d",x1:412.975,x2:412.975,y1:237.608,y2:59.392,gradientTransform:"translate(206.79 159.773) scale(.35154)",gradientUnits:"userSpaceOnUse"}),e.jsx("filter",{id:"f",width:1.042,height:1.045,x:-.021,y:-.022,colorInterpolationFilters:"sRGB",children:e.jsx("feGaussianBlur",{stdDeviation:.958})}),e.jsx("filter",{id:"c",width:1.096,height:1.096,x:-.048,y:-.048,colorInterpolationFilters:"sRGB",children:e.jsx("feGaussianBlur",{stdDeviation:3.564})}),e.jsx("radialGradient",{xlinkHref:"#b",id:"e",cx:413.061,cy:136.818,r:82.125,fx:413.061,fy:136.818,gradientTransform:"translate(194.545 155.58) scale(.38143)",gradientUnits:"userSpaceOnUse"})]}),e.jsx("path",{d:"M502.083 148.5a89.108 89.108 0 0 1-89.108 89.108 89.108 89.108 0 0 1-89.108-89.108 89.108 89.108 0 0 1 89.108-89.108 89.108 89.108 0 0 1 89.108 89.108Z",filter:"url(#c)",opacity:.53,paintOrder:"markers stroke fill",transform:"matrix(.33865 0 0 .3261 -106.77 -14.478)"}),e.jsx("path",{fill:"url(#d)",stroke:"#cdcdcd",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:.093,d:"M383.294 211.977a31.325 31.325 0 0 1-31.325 31.325 31.325 31.325 0 0 1-31.326-31.325 31.325 31.325 0 0 1 31.326-31.325 31.325 31.325 0 0 1 31.325 31.325z",paintOrder:"markers stroke fill",transform:"translate(-318.886 -180.595)"}),e.jsx("path",{fill:"url(#e)",d:"M380.84 211.977a28.87 28.87 0 0 1-28.871 28.87 28.87 28.87 0 0 1-28.871-28.87 28.87 28.87 0 0 1 28.87-28.87 28.87 28.87 0 0 1 28.871 28.87z",paintOrder:"markers stroke fill",transform:"translate(-318.886 -180.595)"}),e.jsx("path",{fill:"#f4f2f3",d:"M33.083 4.017a.42.42 0 0 0-.421.42v4.856a.42.42 0 1 0 .842 0V4.438a.42.42 0 0 0-.421-.421zm-2.754.174a.42.42 0 0 0-.46.463l.212 2.03a.42.42 0 1 0 .837-.087l-.212-2.03a.42.42 0 0 0-.377-.376zm5.527.002a.42.42 0 0 0-.377.375l-.214 2.03a.42.42 0 1 0 .837.089l.214-2.031a.42.42 0 0 0-.46-.463zM27.5 4.6a.42.42 0 0 0-.41.508l1.005 4.75a.42.42 0 1 0 .824-.174l-1.005-4.75A.42.42 0 0 0 27.5 4.6zm11.183.004a.42.42 0 0 0-.414.333l-1.009 4.75a.42.42 0 1 0 .824.175l1.009-4.75a.42.42 0 0 0-.41-.508zm-13.883.757a.42.42 0 0 0-.437.55l.632 1.942a.42.42 0 1 0 .8-.26l-.63-1.942a.42.42 0 0 0-.365-.29zm16.568.001a.42.42 0 0 0-.364.29l-.632 1.942a.42.42 0 1 0 .8.26l.632-1.942a.42.42 0 0 0-.436-.55zM22.13 6.34a.42.42 0 0 0-.377.592l1.972 4.437a.42.42 0 1 0 .77-.342l-1.972-4.437a.42.42 0 0 0-.393-.25zm21.937.015a.42.42 0 0 0-.392.25l-1.978 4.434a.42.42 0 1 0 .769.343l1.978-4.434a.42.42 0 0 0-.377-.593zM19.654 7.65a.42.42 0 0 0-.394.63l1.02 1.77a.42.42 0 1 0 .73-.421L19.989 7.86a.42.42 0 0 0-.335-.21zm26.858 0a.419.419 0 0 0-.335.21l-1.021 1.769a.42.42 0 1 0 .73.42l1.02-1.768a.42.42 0 0 0-.394-.63zm-29.265 1.5a.422.422 0 0 0-.326.669l2.85 3.93a.42.42 0 1 0 .682-.494l-2.85-3.93a.42.42 0 0 0-.356-.174zm31.702.022a.42.42 0 0 0-.356.174l-2.856 3.926a.42.42 0 1 0 .681.495l2.856-3.926a.42.42 0 0 0-.325-.669zm-33.852 1.783a.42.42 0 0 0-.335.702l1.366 1.518a.42.42 0 1 0 .626-.563l-1.366-1.518a.42.42 0 0 0-.291-.14zm35.975.003a.421.421 0 0 0-.29.139l-1.367 1.517a.42.42 0 1 0 .625.564l1.367-1.518a.42.42 0 0 0-.335-.702zm-38.037 1.977a.42.42 0 0 0-.26.733l3.61 3.249a.42.42 0 1 0 .563-.626l-3.609-3.248a.42.42 0 0 0-.304-.108zm40.109.014a.419.419 0 0 0-.304.108l-3.61 3.245a.42.42 0 1 0 .562.626l3.61-3.245a.42.42 0 0 0-.258-.734zm-41.823 2.19a.42.42 0 0 0-.262.762l1.652 1.2a.42.42 0 1 0 .495-.681l-1.652-1.2a.42.42 0 0 0-.233-.081zm43.535.015a.421.421 0 0 0-.233.08l-1.653 1.2a.42.42 0 1 0 .495.681l1.653-1.2a.42.42 0 0 0-.262-.76zM9.72 17.49a.42.42 0 0 0-.18.785l4.204 2.427a.42.42 0 1 0 .42-.729L9.96 17.546a.42.42 0 0 0-.24-.056zm46.728 0a.417.417 0 0 0-.24.056l-4.205 2.427a.42.42 0 1 0 .42.73l4.206-2.428a.42.42 0 0 0-.181-.785zM8.508 19.996a.42.42 0 0 0-.18.806l1.866.832a.42.42 0 1 0 .343-.77l-1.866-.831a.42.42 0 0 0-.163-.037zm49.158.017a.42.42 0 0 0-.164.037l-1.865.83a.42.42 0 1 0 .342.77l1.866-.831a.42.42 0 0 0-.179-.806zM7.429 22.615a.42.42 0 0 0-.094.82l4.615 1.504a.42.42 0 1 0 .261-.8l-4.616-1.504a.421.421 0 0 0-.166-.02zm51.314.018a.408.408 0 0 0-.166.02l-4.617 1.5a.42.42 0 1 0 .26.801l4.617-1.5a.42.42 0 0 0-.094-.82zM6.756 25.365a.42.42 0 0 0-.09.833l1.998.424a.42.42 0 1 0 .175-.823l-1.998-.425a.413.413 0 0 0-.085-.009zm52.655.004a.518.518 0 0 0-.085.009l-1.998.424a.42.42 0 1 0 .175.823l1.998-.424a.42.42 0 0 0-.09-.833zM6.247 28.13a.42.42 0 0 0-.003.838l4.828.51a.42.42 0 1 0 .089-.837l-4.829-.51a.432.432 0 0 0-.085 0zm53.676.037a.386.386 0 0 0-.085 0l-4.83.504a.42.42 0 1 0 .088.837l4.83-.504a.42.42 0 0 0-.003-.837zM6.165 30.96a.42.42 0 1 0 0 .842h2.043a.42.42 0 1 0 0-.842zm51.793 0a.42.42 0 1 0 0 .842h2.043a.42.42 0 1 0 0-.842zm-46.803 2.295a.384.384 0 0 0-.085 0l-4.83.504a.42.42 0 1 0 .088.838l4.83-.504a.42.42 0 0 0-.003-.838zm43.853.03a.42.42 0 0 0-.003.838l4.828.51a.42.42 0 1 0 .089-.837l-4.828-.51a.434.434 0 0 0-.086-.001zM8.748 36.13a.43.43 0 0 0-.085.009l-1.998.424a.42.42 0 1 0 .175.823l1.998-.424a.42.42 0 0 0-.09-.833zm48.67.004a.42.42 0 0 0-.09.833l1.997.424a.42.42 0 1 0 .175-.824l-1.998-.424a.413.413 0 0 0-.085-.01zM12.111 37.79a.408.408 0 0 0-.166.02l-4.617 1.5a.42.42 0 1 0 .26.801l4.617-1.5a.42.42 0 0 0-.094-.82zm41.937.015a.42.42 0 0 0-.094.82l4.616 1.504a.42.42 0 1 0 .26-.8l-4.615-1.504a.421.421 0 0 0-.167-.02zM10.35 41.08a.42.42 0 0 0-.163.036l-1.866.831a.42.42 0 1 0 .342.769l1.866-.83a.42.42 0 0 0-.179-.806zm45.459.016a.42.42 0 0 0-.18.805l1.865.832a.42.42 0 1 0 .343-.769l-1.865-.832a.42.42 0 0 0-.163-.036zm-41.826.912a.417.417 0 0 0-.24.056L9.538 44.49a.42.42 0 1 0 .421.73l4.205-2.428a.42.42 0 0 0-.181-.785zm38.2 0a.42.42 0 0 0-.181.785l4.205 2.427a.42.42 0 1 0 .42-.729l-4.204-2.427a.42.42 0 0 0-.24-.056zm-39.249 3.562a.421.421 0 0 0-.233.08l-1.653 1.2a.42.42 0 1 0 .495.682l1.653-1.2a.42.42 0 0 0-.262-.762zm40.288.015a.42.42 0 0 0-.262.762l1.652 1.2a.42.42 0 1 0 .495-.681l-1.652-1.2a.42.42 0 0 0-.233-.081zm-36.544.145a.418.418 0 0 0-.304.108l-3.61 3.245a.42.42 0 1 0 .562.626l3.61-3.245a.42.42 0 0 0-.258-.734zm32.8.011a.421.421 0 0 0-.26.734l3.609 3.248a.42.42 0 1 0 .563-.625l-3.608-3.249a.42.42 0 0 0-.304-.107zm-29.375 3.084a.42.42 0 0 0-.355.173l-2.856 3.927a.42.42 0 1 0 .68.495l2.857-3.926a.42.42 0 0 0-.326-.669zm25.936.018a.421.421 0 0 0-.326.668l2.85 3.93a.42.42 0 1 0 .682-.494l-2.851-3.93a.42.42 0 0 0-.355-.174zm-29.623.606a.421.421 0 0 0-.29.14l-1.367 1.517a.42.42 0 1 0 .625.563l1.367-1.517a.42.42 0 0 0-.335-.703zm33.331.002a.42.42 0 0 0-.335.702l1.366 1.518a.42.42 0 1 0 .626-.563l-1.366-1.518a.42.42 0 0 0-.291-.139zm-25.655 1.684a.419.419 0 0 0-.393.25l-1.978 4.433a.42.42 0 1 0 .77.343l1.977-4.434a.42.42 0 0 0-.376-.592zm17.955.012a.42.42 0 0 0-.377.592l1.972 4.437a.42.42 0 1 0 .77-.342l-1.972-4.437a.42.42 0 0 0-.393-.25zm-21.431 1.359a.419.419 0 0 0-.335.21l-1.021 1.768a.42.42 0 1 0 .729.421l1.02-1.769a.42.42 0 0 0-.393-.63zm24.934 0a.42.42 0 0 0-.394.63l1.021 1.77a.42.42 0 1 0 .73-.422l-1.022-1.769a.42.42 0 0 0-.335-.21zm-17.054.063a.42.42 0 0 0-.415.334l-1.009 4.749a.42.42 0 1 0 .824.175l1.009-4.75a.42.42 0 0 0-.41-.508zm9.16.003a.42.42 0 0 0-.41.508l1.006 4.75a.42.42 0 1 0 .823-.175l-1.006-4.75a.42.42 0 0 0-.414-.333zm-4.573.48a.42.42 0 0 0-.421.42v4.855a.42.42 0 1 0 .842 0v-4.855a.42.42 0 0 0-.421-.42zm-7.727 1.568a.42.42 0 0 0-.364.29l-.631 1.942a.42.42 0 1 0 .8.26l.632-1.942a.42.42 0 0 0-.437-.55zm15.45 0a.42.42 0 0 0-.437.55l.632 1.943a.42.42 0 1 0 .8-.26l-.63-1.942a.42.42 0 0 0-.365-.29zm-10.365 1.083a.42.42 0 0 0-.378.375l-.213 2.03a.42.42 0 1 0 .837.088l.214-2.03a.42.42 0 0 0-.46-.463zm5.267.002a.42.42 0 0 0-.46.463l.212 2.03a.42.42 0 1 0 .837-.088l-.212-2.03a.42.42 0 0 0-.377-.375z",paintOrder:"markers stroke fill"}),e.jsx("path",{d:"m469.096 100.607-65.51 38.061-41.42 65.207 60.595-44.882z",filter:"url(#f)",opacity:.409,paintOrder:"markers stroke fill",transform:"translate(-112.095 -20.822) scale(.35154)"}),e.jsx("path",{fill:"#ff5150",d:"m36.383 34.838-6.6-6.913 23.416-15.752z",paintOrder:"markers stroke fill"}),e.jsx("path",{fill:"#f1f1f1",d:"m36.383 34.838-6.6-6.913L12.966 50.59z",paintOrder:"markers stroke fill"}),e.jsx("path",{d:"m12.967 50.59 23.416-15.752L53.2 12.173z",opacity:.243})]}),ev=t=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",...t,children:[e.jsxs("defs",{children:[e.jsxs("radialGradient",{id:"b",cx:161.8,cy:68.9,r:95.4,gradientTransform:"matrix(1 0 0 -.95 0 248.8)",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:.7,stopOpacity:0}),e.jsx("stop",{offset:.9,stopOpacity:.5}),e.jsx("stop",{offset:1})]}),e.jsxs("radialGradient",{id:"d",cx:-340.3,cy:63,r:143.2,gradientTransform:"matrix(.15 -.99 -.8 -.12 176.6 -125.4)",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:.8,stopOpacity:0}),e.jsx("stop",{offset:.9,stopOpacity:.5}),e.jsx("stop",{offset:1})]}),e.jsxs("radialGradient",{id:"e",cx:113.4,cy:570.2,r:202.4,gradientTransform:"matrix(-.04 1 2.13 .08 -1179.5 -106.7)",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:0,stopColor:"#35c1f1"}),e.jsx("stop",{offset:.1,stopColor:"#34c1ed"}),e.jsx("stop",{offset:.2,stopColor:"#2fc2df"}),e.jsx("stop",{offset:.3,stopColor:"#2bc3d2"}),e.jsx("stop",{offset:.7,stopColor:"#36c752"})]}),e.jsxs("radialGradient",{id:"f",cx:376.5,cy:568,r:97.3,gradientTransform:"matrix(.28 .96 .78 -.23 -303.8 -148.5)",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:0,stopColor:"#66eb6e"}),e.jsx("stop",{offset:1,stopColor:"#66eb6e",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"a",x1:63.3,x2:241.7,y1:84,y2:84,gradientTransform:"matrix(1 0 0 -1 0 266)",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:0,stopColor:"#0c59a4"}),e.jsx("stop",{offset:1,stopColor:"#114a8b"})]}),e.jsxs("linearGradient",{id:"c",x1:157.3,x2:46,y1:161.4,y2:40.1,gradientTransform:"matrix(1 0 0 -1 0 266)",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:0,stopColor:"#1b9de2"}),e.jsx("stop",{offset:.2,stopColor:"#1595df"}),e.jsx("stop",{offset:.7,stopColor:"#0680d7"}),e.jsx("stop",{offset:1,stopColor:"#0078d4"})]})]}),e.jsx("path",{d:"M235.7 195.5a93.7 93.7 0 0 1-10.6 4.7 101.9 101.9 0 0 1-35.9 6.4c-47.3 0-88.5-32.5-88.5-74.3a31.5 31.5 0 0 1 16.4-27.3c-42.8 1.8-53.8 46.4-53.8 72.5 0 74 68.1 81.4 82.8 81.4 7.9 0 19.8-2.3 27-4.6l1.3-.4a128.3 128.3 0 0 0 66.6-52.8 4 4 0 0 0-5.3-5.6Z",style:{fill:"url(#a)"},transform:"translate(-4.6 -5)"}),e.jsx("path",{d:"M235.7 195.5a93.7 93.7 0 0 1-10.6 4.7 101.9 101.9 0 0 1-35.9 6.4c-47.3 0-88.5-32.5-88.5-74.3a31.5 31.5 0 0 1 16.4-27.3c-42.8 1.8-53.8 46.4-53.8 72.5 0 74 68.1 81.4 82.8 81.4 7.9 0 19.8-2.3 27-4.6l1.3-.4a128.3 128.3 0 0 0 66.6-52.8 4 4 0 0 0-5.3-5.6Z",style:{isolation:"isolate",opacity:.35,fill:"url(#b)"},transform:"translate(-4.6 -5)"}),e.jsx("path",{d:"M110.3 246.3A79.2 79.2 0 0 1 87.6 225a80.7 80.7 0 0 1 29.5-120c3.2-1.5 8.5-4.1 15.6-4a32.4 32.4 0 0 1 25.7 13 31.9 31.9 0 0 1 6.3 18.7c0-.2 24.5-79.6-80-79.6-43.9 0-80 41.6-80 78.2a130.2 130.2 0 0 0 12.1 56 128 128 0 0 0 156.4 67 75.5 75.5 0 0 1-62.8-8Z",style:{fill:"url(#c)"},transform:"translate(-4.6 -5)"}),e.jsx("path",{d:"M110.3 246.3A79.2 79.2 0 0 1 87.6 225a80.7 80.7 0 0 1 29.5-120c3.2-1.5 8.5-4.1 15.6-4a32.4 32.4 0 0 1 25.7 13 31.9 31.9 0 0 1 6.3 18.7c0-.2 24.5-79.6-80-79.6-43.9 0-80 41.6-80 78.2a130.2 130.2 0 0 0 12.1 56 128 128 0 0 0 156.4 67 75.5 75.5 0 0 1-62.8-8Z",style:{opacity:.41,fill:"url(#d)",isolation:"isolate"},transform:"translate(-4.6 -5)"}),e.jsx("path",{d:"M157 153.8c-.9 1-3.4 2.5-3.4 5.6 0 2.6 1.7 5.2 4.8 7.3 14.3 10 41.4 8.6 41.5 8.6a59.6 59.6 0 0 0 30.3-8.3 61.4 61.4 0 0 0 30.4-52.9c.3-22.4-8-37.3-11.3-43.9C228 28.8 182.3 5 132.6 5a128 128 0 0 0-128 126.2c.5-36.5 36.8-66 80-66 3.5 0 23.5.3 42 10a72.6 72.6 0 0 1 30.9 29.3c6.1 10.6 7.2 24.1 7.2 29.5s-2.7 13.3-7.8 19.9Z",style:{fill:"url(#e)"},transform:"translate(-4.6 -5)"}),e.jsx("path",{d:"M157 153.8c-.9 1-3.4 2.5-3.4 5.6 0 2.6 1.7 5.2 4.8 7.3 14.3 10 41.4 8.6 41.5 8.6a59.6 59.6 0 0 0 30.3-8.3 61.4 61.4 0 0 0 30.4-52.9c.3-22.4-8-37.3-11.3-43.9C228 28.8 182.3 5 132.6 5a128 128 0 0 0-128 126.2c.5-36.5 36.8-66 80-66 3.5 0 23.5.3 42 10a72.6 72.6 0 0 1 30.9 29.3c6.1 10.6 7.2 24.1 7.2 29.5s-2.7 13.3-7.8 19.9Z",style:{fill:"url(#f)"},transform:"translate(-4.6 -5)"})]}),tv=t=>e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t,role:"img","aria-label":"Opera",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"opera-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:"#FF1B2D"}),e.jsx("stop",{offset:"50%",stopColor:"#CC0000"}),e.jsx("stop",{offset:"100%",stopColor:"#A02128"})]})}),e.jsx("circle",{cx:"12",cy:"12",r:"11",fill:"url(#opera-gradient)"}),e.jsx("ellipse",{cx:"12",cy:"12",rx:"6.5",ry:"8.5",fill:"none",stroke:"#fff",strokeWidth:"1.2",opacity:"0.9"}),e.jsx("ellipse",{cx:"12",cy:"12",rx:"3.5",ry:"5.5",fill:"#fff"}),e.jsx("path",{d:"M12 8.5c-1.4 0-2.5 1.6-2.5 3.5s1.1 3.5 2.5 3.5 2.5-1.6 2.5-3.5-1.1-3.5-2.5-3.5z",fill:"url(#opera-gradient)"})]}),rv=t=>e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t,role:"img","aria-label":"Brave",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"brave-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:"#FB542B"}),e.jsx("stop",{offset:"50%",stopColor:"#FF6B35"}),e.jsx("stop",{offset:"100%",stopColor:"#FF4500"})]})}),e.jsx("circle",{cx:"12",cy:"12",r:"11",fill:"url(#brave-gradient)"}),e.jsx("path",{d:"M12 3.5l1.5 2h2.5l-.8 3 1.3 2.5-2.5.8v2.7l-2-.7-2 .7v-2.7l-2.5-.8L8.8 8.5 8 5.5h2.5L12 3.5z",fill:"#fff"}),e.jsx("path",{d:"M12 6.5c-.8 0-1.5.7-1.5 1.5v3c0 .8.7 1.5 1.5 1.5s1.5-.7 1.5-1.5V8c0-.8-.7-1.5-1.5-1.5z",fill:"url(#brave-gradient)"}),e.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"url(#brave-gradient)"})]}),ov=or`
|
|
3974
3974
|
0% { transform: rotate(0deg); }
|
|
3975
3975
|
100% { transform: rotate(360deg); }
|
|
3976
3976
|
`,nv=l.div`
|
|
@@ -4105,7 +4105,7 @@ cursor: pointer;
|
|
|
4105
4105
|
flex-wrap: wrap;
|
|
4106
4106
|
gap: 12px;
|
|
4107
4107
|
margin-bottom: 0;
|
|
4108
|
-
`,cv=()=>e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",style:{color:"var(--color-secondary-text)"},children:[e.jsx("circle",{cx:"12",cy:"12",r:"11",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.5",opacity:"0.6"}),e.jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"0.5",opacity:"0.3"}),e.jsx("path",{d:"M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z",fill:"currentColor",opacity:"0.5"}),e.jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor"}),e.jsx("text",{x:"12",y:"16.5",textAnchor:"middle",fill:"currentColor",fontSize:"6",opacity:"0.7",children:"?"})]}),lv=({browser:t})=>{const r=(t==null?void 0:t.toLowerCase())||"",o={width:20,height:20};return r.includes("chrome")?e.jsx(K0,{...o}):r.includes("firefox")?e.jsx(X0,{...o}):r.includes("safari")?e.jsx(J0,{...o}):r.includes("edge")?e.jsx(ev,{...o}):r.includes("opera")?e.jsx(tv,{...o}):r.includes("brave")?e.jsx(rv,{...o}):e.jsx(cv,{})},dv=()=>{const[t,r]=i.useState(null),{signins:o,removeSignin:n,refetch:s,loading:a}=ac(),{refetch:h}=Be(),{toast:f}=Tt(),c=o,p=async u=>{try{await n(u),await Promise.all([s(),h()]),r(null),f("Session ended successfully","info")}catch(g){f(g.message||"Failed to end session. Please try again.","error")}},d=u=>{if(!u||u.trim()==="")return"Unknown";const g=new Date(u);if(isNaN(g.getTime()))return"Unknown";const v=Math.floor((new Date().getTime()-g.getTime())/(1e3*60));return v<1?"Just now":v<60?`${v}m ago`:v<1440?`${Math.floor(v/60)}h ago`:g.toLocaleDateString()};return a?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"20px"},children:e.jsx(Ee,{})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsx("h3",{style:{fontSize:"16px",color:"var(--color-foreground)",margin:0},children:"Active Sessions"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--color-muted)",margin:0},children:"Manage your active browser sessions and sign-ins"})]}),e.jsx("div",{children:c&&c.length>0?e.jsxs(jt,{children:[e.jsx(kt,{children:e.jsxs(We,{children:[e.jsx(ze,{children:"Browser & Device"}),e.jsx(ze,{children:"Location"}),e.jsx(ze,{children:"Last Active"}),e.jsx(ze,{})]})}),e.jsx(_t,{children:c.map(u=>e.jsxs(We,{children:[e.jsx(Le,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(
|
|
4108
|
+
`,cv=()=>e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",style:{color:"var(--color-secondary-text)"},children:[e.jsx("circle",{cx:"12",cy:"12",r:"11",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.5",opacity:"0.6"}),e.jsx("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"0.5",opacity:"0.3"}),e.jsx("path",{d:"M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z",fill:"currentColor",opacity:"0.5"}),e.jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor"}),e.jsx("text",{x:"12",y:"16.5",textAnchor:"middle",fill:"currentColor",fontSize:"6",opacity:"0.7",children:"?"})]}),lv=({browser:t})=>{const r=(t==null?void 0:t.toLowerCase())||"",o={width:20,height:20};return r.includes("chrome")?e.jsx(K0,{...o}):r.includes("firefox")?e.jsx(X0,{...o}):r.includes("safari")?e.jsx(J0,{...o}):r.includes("edge")?e.jsx(ev,{...o}):r.includes("opera")?e.jsx(tv,{...o}):r.includes("brave")?e.jsx(rv,{...o}):e.jsx(cv,{})},dv=()=>{const[t,r]=i.useState(null),{signins:o,removeSignin:n,refetch:s,loading:a}=ac(),{refetch:h}=Be(),{toast:f}=Tt(),c=o,p=async u=>{try{await n(u),await Promise.all([s(),h()]),r(null),f("Session ended successfully","info")}catch(g){f(g.message||"Failed to end session. Please try again.","error")}},d=u=>{if(!u||u.trim()==="")return"Unknown";const g=new Date(u);if(isNaN(g.getTime()))return"Unknown";const v=Math.floor((new Date().getTime()-g.getTime())/(1e3*60));return v<1?"Just now":v<60?`${v}m ago`:v<1440?`${Math.floor(v/60)}h ago`:g.toLocaleDateString()};return a?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"20px"},children:e.jsx(Ee,{})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsx("h3",{style:{fontSize:"16px",color:"var(--color-foreground)",margin:0},children:"Active Sessions"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--color-muted)",margin:0},children:"Manage your active browser sessions and sign-ins"})]}),e.jsx("div",{children:c&&c.length>0?e.jsxs(jt,{children:[e.jsx(kt,{children:e.jsxs(We,{children:[e.jsx(ze,{children:"Browser & Device"}),e.jsx(ze,{children:"Location"}),e.jsx(ze,{children:"Last Active"}),e.jsx(ze,{})]})}),e.jsx(_t,{children:c.map(u=>e.jsxs(We,{children:[e.jsx(Le,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Fl,{children:e.jsx(lv,{browser:u.browser||"Unknown"})}),e.jsxs("div",{children:[e.jsx("div",{children:u.browser||"Unknown Browser"}),u.device&&e.jsx("div",{style:{fontSize:"12px",color:"var(--color-muted)"},children:u.device})]})]})}),e.jsx(Le,{children:e.jsxs("div",{children:[e.jsx("div",{children:u.city&&u.country?`${u.city}, ${u.country}`:"Unknown location"}),u.ip_address&&e.jsx("div",{style:{fontSize:"12px",color:"var(--color-muted)"},children:u.ip_address})]})}),e.jsx(Le,{children:d(u.last_active_at)}),e.jsx(Ct,{children:e.jsxs(nt,{open:t===u.id,openChange:g=>r(g?u.id:null),children:[e.jsx(st,{children:e.jsx(an,{children:"•••"})}),e.jsx(at,{children:e.jsx(Te,{onClick:()=>p(u.id),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Et,{size:14}),"End Session"]})})})]})})]},u.id))})]}):e.jsx(et,{title:"No active sessions",description:"You don't have any active sessions at the moment."})})]})},uv=()=>{var j,x,I,k;const{deployment:t}=ve(),{toast:r}=Tt(),[o,n]=i.useState(null),[s,a]=i.useState(""),[h,f]=i.useState(!1),[c,p]=i.useState(null),[d,u]=i.useState(""),g=i.useRef(null),m=i.useRef({}),{user:v,createEmailAddress:y,deleteEmailAddress:S,prepareEmailVerification:E,attemptEmailVerification:b,makeEmailPrimary:$}=rr();if(!((x=(j=t==null?void 0:t.auth_settings)==null?void 0:j.email_address)!=null&&x.enabled))return null;const C=async R=>{try{if(R===(v==null?void 0:v.primary_email_address_id)){r("Cannot delete primary email address. Please set another email as primary first.","error");return}await S(R),v.refetch(),r("Email address deleted successfully","info")}catch(_){r(_.message||"Failed to delete email address. Please try again.","error")}},w=i.useMemo(()=>v!=null&&v.user_email_addresses?d.trim()?v.user_email_addresses.filter(R=>R.email.toLowerCase().includes(d.toLowerCase())):v.user_email_addresses:[],[v==null?void 0:v.user_email_addresses,d]);return e.jsxs(e.Fragment,{children:[e.jsxs(Go,{style:{marginBottom:"20px"},children:[e.jsx(wt,{value:d,onChange:u,placeholder:"Search Email"}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:g,onClick:()=>f(!0),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"Add Email"}),h&&e.jsx(ni,{triggerRef:g,onClose:()=>f(!1),onAddEmail:async R=>{const _=await y(R);a(_.data.id),await E(_.data.id),v.refetch()},onPrepareVerification:async()=>{await E(s),v.refetch()},onAttemptVerification:async R=>{await b(s,R),v.refetch(),f(!1),a(""),r("Email added and verified successfully!","info")}})]})]}),w!=null&&w.length?e.jsxs(jt,{children:[e.jsx(kt,{children:e.jsxs(We,{children:[e.jsx(ze,{children:"Email Address"}),e.jsx(ze,{children:"Status"}),e.jsx(ze,{})]})}),e.jsx(_t,{children:w.map(R=>e.jsxs(We,{children:[e.jsx(Le,{children:R.email}),e.jsx(Le,{children:R.id===(v==null?void 0:v.primary_email_address_id)?"Primary":R.verified?"Verified":"Not Verified"}),e.jsx(Ct,{children:R.id!==(v==null?void 0:v.primary_email_address_id)||!R.verified?e.jsxs(nt,{open:o===R.id,openChange:_=>n(_?R.id:null),children:[e.jsx(st,{children:e.jsx(an,{ref:_=>{_&&(m.current[R.id]=_)},children:"•••"})}),e.jsxs(at,{children:[R.id!==(v==null?void 0:v.primary_email_address_id)&&R.verified&&e.jsx(Te,{onClick:async()=>{try{await $(R.id),v.refetch(),n(null),r("Primary email updated successfully","info")}catch(_){r(_.message||"Failed to update primary email","error")}},children:"Make primary"}),!R.verified&&e.jsx(Te,{onClick:async()=>{n(null),await E(R.id),p(R.id)},children:"Verify email"}),R.id!==(v==null?void 0:v.primary_email_address_id)&&e.jsx(Te,{$destructive:!0,onClick:()=>{C(R.id),n(null)},children:"Remove"})]})]}):null})]},R.id))})]}):e.jsx(et,{title:d?"No emails match your search":"No email addresses",description:"Add an email address to get started."}),c&&e.jsx(ni,{existingEmail:(k=(I=v==null?void 0:v.user_email_addresses)==null?void 0:I.find(R=>R.id===c))==null?void 0:k.email,triggerRef:{current:m.current[c]},onClose:()=>p(null),onAddEmail:async()=>{},onPrepareVerification:async()=>{await E(c),v.refetch()},onAttemptVerification:async R=>{await b(c,R),v.refetch(),p(null),r("Email verified successfully!","info")}})]})},pv=()=>{var w,j,x,I;const{deployment:t}=ve(),[r,o]=i.useState(null),[n,s]=i.useState(""),[a,h]=i.useState(!1),[f,c]=i.useState(null),[p,d]=i.useState(""),u=i.useRef(null),g=i.useRef({}),{user:m,createPhoneNumber:v,deletePhoneNumber:y,preparePhoneVerification:S,attemptPhoneVerification:E,makePhonePrimary:b}=rr();if(!((j=(w=t==null?void 0:t.auth_settings)==null?void 0:w.phone_number)!=null&&j.enabled))return null;const $=k=>{const R=To.find(_=>_.dialCode===k);return(R==null?void 0:R.flag)||"🌍"},C=i.useMemo(()=>m!=null&&m.user_phone_numbers?p.trim()?m.user_phone_numbers.filter(k=>k.phone_number.toLowerCase().includes(p.toLowerCase())):m.user_phone_numbers:[],[m==null?void 0:m.user_phone_numbers,p]);return e.jsxs(e.Fragment,{children:[e.jsxs(Go,{style:{marginBottom:"20px"},children:[e.jsx(wt,{value:p,onChange:d,placeholder:"Search Phone"}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:u,onClick:()=>h(!0),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"Add Phone"}),a&&e.jsx(ii,{triggerRef:u,onClose:()=>h(!1),onAddPhone:async(k,R)=>{const _=await v(k,R);s(_.data.id),await S(_.data.id)},onPrepareVerification:async()=>{await S(n),m.refetch()},onAttemptVerification:async k=>{await E(n,k),m.refetch(),h(!1)}}),f&&e.jsx(ii,{existingPhone:(I=(x=m==null?void 0:m.user_phone_numbers)==null?void 0:x.find(k=>k.id===f))==null?void 0:I.phone_number,triggerRef:{current:g.current[f]},onClose:()=>c(null),onAddPhone:async()=>{},onPrepareVerification:async()=>{await S(f),m.refetch()},onAttemptVerification:async k=>{await E(f,k),m.refetch(),c(null)}})]})]}),C!=null&&C.length?e.jsxs(jt,{children:[e.jsx(kt,{children:e.jsxs(We,{children:[e.jsx(ze,{children:"Phone Number"}),e.jsx(ze,{children:"Status"}),e.jsx(ze,{})]})}),e.jsx(_t,{children:C.map(k=>e.jsxs(We,{children:[e.jsx(Le,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"18px"},children:$(k.country_code)}),e.jsx("span",{children:k.country_code}),e.jsx("span",{children:k.phone_number})]})}),e.jsx(Le,{children:k.id===(m==null?void 0:m.primary_phone_number_id)?"Primary":k.verified?"Verified":"Not Verified"}),e.jsx(Ct,{children:e.jsxs(nt,{open:r===k.id,openChange:R=>o(R?k.id:null),children:[e.jsx(st,{children:e.jsx(an,{ref:R=>{R&&(g.current[k.id]=R)},children:"•••"})}),e.jsxs(at,{children:[k.id!==(m==null?void 0:m.primary_phone_number_id)&&k.verified&&e.jsx(Te,{onClick:async()=>{await b(k.id),o(null),m.refetch()},children:"Make primary"}),!k.verified&&e.jsx(Te,{onClick:async()=>{await S(k.id),c(k.id),o(null)},children:"Verify phone"}),e.jsx(Te,{$destructive:!0,onClick:async()=>{await y(k.id),o(null),m.refetch()},children:"Remove"})]})]})})]},k.id))})]}):e.jsx(et,{title:p?"No phones match your search":"No phone numbers",description:"Add a phone number to get started."})]})},Fl=l.div`
|
|
4109
4109
|
width: 20px;
|
|
4110
4110
|
height: 20px;
|
|
4111
4111
|
flex-shrink: 0;
|
|
@@ -4120,9 +4120,9 @@ cursor: pointer;
|
|
|
4120
4120
|
flex-shrink: 0;
|
|
4121
4121
|
display: block;
|
|
4122
4122
|
}
|
|
4123
|
-
`,hv=()=>{const{user:t,disconnectSocialConnection:r,connectSocialAccount:o}=rr(),{deployment:n}=ve(),s={google_oauth:{icon:e.jsx(Hc,{}),label:"Google"},microsoft_oauth:{icon:e.jsx(Gc,{}),label:"Microsoft"},github_oauth:{icon:e.jsx(Vc,{}),label:"GitHub"},gitlab_oauth:{icon:e.jsx(Zc,{}),label:"GitLab"},linkedin_oauth:{icon:e.jsx(Yc,{}),label:"LinkedIn"},discord_oauth:{icon:e.jsx(Qc,{}),label:"Discord"},x_oauth:{icon:e.jsx(qc,{}),label:"X"}},a=(n==null?void 0:n.social_connections.filter(h=>h.enabled))||[];return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx("h3",{style:{fontSize:"16px",margin:"0 0 6px 0",letterSpacing:"-0.01em",color:"var(--color-foreground)"},children:"Connected Accounts"}),e.jsx("p",{style:{fontSize:"13px",margin:0,lineHeight:"1.5",color:"var(--color-muted)"},children:"Connect social accounts for easy sign-in and profile sync"})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column"},children:a.map((h,f)=>{var d;const c=((d=t==null?void 0:t.social_connections)==null?void 0:d.filter(u=>u.provider===h.provider))||[],p=s[h.provider];return p?e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0",minHeight:"58px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",color:"var(--color-foreground)"},children:[e.jsx(
|
|
4123
|
+
`,hv=()=>{const{user:t,disconnectSocialConnection:r,connectSocialAccount:o}=rr(),{deployment:n}=ve(),s={google_oauth:{icon:e.jsx(Hc,{}),label:"Google"},microsoft_oauth:{icon:e.jsx(Gc,{}),label:"Microsoft"},github_oauth:{icon:e.jsx(Vc,{}),label:"GitHub"},gitlab_oauth:{icon:e.jsx(Zc,{}),label:"GitLab"},linkedin_oauth:{icon:e.jsx(Yc,{}),label:"LinkedIn"},discord_oauth:{icon:e.jsx(Qc,{}),label:"Discord"},x_oauth:{icon:e.jsx(qc,{}),label:"X"}},a=(n==null?void 0:n.social_connections.filter(h=>h.enabled))||[];return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx("h3",{style:{fontSize:"16px",margin:"0 0 6px 0",letterSpacing:"-0.01em",color:"var(--color-foreground)"},children:"Connected Accounts"}),e.jsx("p",{style:{fontSize:"13px",margin:0,lineHeight:"1.5",color:"var(--color-muted)"},children:"Connect social accounts for easy sign-in and profile sync"})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column"},children:a.map((h,f)=>{var d;const c=((d=t==null?void 0:t.social_connections)==null?void 0:d.filter(u=>u.provider===h.provider))||[],p=s[h.provider];return p?e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0",minHeight:"58px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",color:"var(--color-foreground)"},children:[e.jsx(Fl,{children:p.icon}),e.jsx("div",{style:{fontSize:"14px",fontWeight:500},children:p.label})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[c.map(u=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",background:"var(--color-input-background)",border:"1px solid var(--color-border)",borderRadius:"6px",padding:"4px 8px",fontSize:"13px",color:"var(--color-muted)"},children:[e.jsx("span",{children:u.email_address}),e.jsx(an,{onClick:async()=>{await r(u.id.toString()),t.refetch()},style:{padding:"2px"},children:e.jsx(Ze,{size:14})})]},u.id)),c.length>0?e.jsx(X,{onClick:()=>{o({provider:h.provider,redirectUri:window.location.href})},style:{padding:"6px 24px",fontSize:"13px"},children:"Add"}):e.jsx(X,{onClick:()=>{o({provider:h.provider,redirectUri:window.location.href})},style:{padding:"6px 14px",fontSize:"13px"},children:"Connect"})]})]}),f<a.length-1&&e.jsx("div",{style:{height:"1px",background:"var(--color-border)"}})]},h.provider):null})})]})},Bl=()=>{var v,y,S,E,b,$,C;const{loading:t}=rr(),{deployment:r}=ve(),[o,n]=i.useState("profile"),[s,a]=i.useState(null),[h,f]=i.useState("info"),c=i.useCallback((w,j="info")=>{a(w),f(j),setTimeout(()=>a(null),3e3)},[a]);if(t)return e.jsx(ue,{children:e.jsx(hi,{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(Ee,{})})});const p=r==null?void 0:r.auth_settings,d=(v=p==null?void 0:p.email_address)==null?void 0:v.enabled,u=(y=p==null?void 0:p.phone_number)==null?void 0:y.enabled,g=((S=r==null?void 0:r.social_connections)==null?void 0:S.some(w=>w.enabled))||!1,m=((E=p==null?void 0:p.password)==null?void 0:E.enabled)||((b=p==null?void 0:p.auth_factors_enabled)==null?void 0:b.authenticator)||(($=p==null?void 0:p.auth_factors_enabled)==null?void 0:$.phone_otp)||((C=p==null?void 0:p.auth_factors_enabled)==null?void 0:C.backup_code);return e.jsx(ue,{children:e.jsx(nv,{children:e.jsx(Sr.Provider,{value:{screen:null,setScreen:()=>{},toast:c},children:e.jsxs(hi,{children:[e.jsx(av,{children:e.jsxs(sv,{children:[e.jsx(hr,{$isActive:o==="profile",onClick:()=>n("profile"),children:e.jsxs(fr,{children:[e.jsx(Fo,{size:16}),"Profile"]})}),d&&e.jsx(hr,{$isActive:o==="email",onClick:()=>n("email"),children:e.jsxs(fr,{children:[e.jsx(Wr,{size:16}),"Email"]})}),u&&e.jsx(hr,{$isActive:o==="phone",onClick:()=>n("phone"),children:e.jsxs(fr,{children:[e.jsx(rh,{size:16}),"Phone"]})}),g&&e.jsx(hr,{$isActive:o==="social",onClick:()=>n("social"),children:e.jsxs(fr,{children:[e.jsx(Hp,{size:16}),"Connections"]})}),m&&e.jsx(hr,{$isActive:o==="security",onClick:()=>n("security"),children:e.jsxs(fr,{children:[e.jsx(wr,{size:16}),"Security"]})}),e.jsx(hr,{$isActive:o==="sessions",onClick:()=>n("sessions"),children:e.jsxs(fr,{children:[e.jsx(yp,{size:16}),"Sessions"]})})]})}),e.jsxs(iv,{children:[o==="profile"&&e.jsx(gv,{}),o==="email"&&d&&e.jsx(uv,{}),o==="phone"&&u&&e.jsx(pv,{}),o==="social"&&g&&e.jsx(hv,{}),o==="security"&&m&&e.jsx(fv,{}),o==="sessions"&&e.jsx(dv,{})]}),s&&e.jsx("div",{style:{position:"absolute",bottom:"20px",right:"20px",background:"var(--color-input-background)",border:"1px solid var(--color-border)",borderRadius:"8px",padding:"12px 16px",boxShadow:"0 4px 12px var(--color-shadow)",animation:"slideUp 0.3s ease-out"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[h==="error"?e.jsx(dt,{size:16,color:"var(--color-error)"}):e.jsx(Ye,{size:16,color:"var(--color-success)"}),e.jsx("span",{style:{fontSize:"14px",color:"var(--color-foreground)"},children:s})]})})]})})})})},fv=()=>{var W,fe,ye;const{deployment:t}=ve(),{user:r,updatePassword:o,removePassword:n,setupAuthenticator:s,verifyAuthenticator:a,deleteAuthenticator:h,generateBackupCodes:f,regenerateBackupCodes:c,updateProfile:p}=rr(),{toast:d}=Tt(),[u,g]=i.useState((r==null?void 0:r.second_factor_policy)||"none"),[m,v]=i.useState(!1),y=async re=>{try{await p({second_factor_policy:re}),g(re),d("Second factor policy updated successfully","info")}catch(je){d(je.message||"Failed to update second factor policy","error")}},[S,E]=i.useState(!1),[b,$]=i.useState(!1),[C,w]=i.useState(!1),[j,x]=i.useState(!1),I=i.useRef(null),k=i.useRef(null),R=i.useRef(null),_=i.useRef(null),[O,P]=i.useState("table"),[z,T]=i.useState(""),[M,N]=i.useState(""),[H,L]=i.useState(""),[A,se]=i.useState(["",""]),[te,U]=i.useState([]),[K,ee]=i.useState(!1),[J,ie]=i.useState(!1),[oe]=i.useState(!1),[de,Q]=i.useState(!1),ce=(W=t==null?void 0:t.auth_settings)==null?void 0:W.auth_factors_enabled,B=(ye=(fe=t==null?void 0:t.auth_settings)==null?void 0:fe.password)==null?void 0:ye.enabled;if(!(ce!=null&&ce.authenticator)&&!(ce!=null&&ce.backup_code)&&!B)return null;const V=async(re,je)=>{await o(re,je),await r.refetch(),d("Password updated successfully","info")},D=async re=>{await n(re),await r.refetch(),d("Password removed successfully","info")},le=()=>{var Ie,nr,ar,qr,Ra,Ia;if(!r)return!1;const re=(Ie=r.user_email_addresses)==null?void 0:Ie.some($r=>$r.verified),je=(nr=r.user_phone_numbers)==null?void 0:nr.some($r=>$r.verified),me=r.social_connections&&r.social_connections.length>0,Se=t==null?void 0:t.auth_settings;return(Se==null?void 0:Se.first_factor)==="email_otp"&&re||((ar=Se==null?void 0:Se.magic_link)==null?void 0:ar.enabled)&&re||((qr=Se==null?void 0:Se.passkey)==null?void 0:qr.enabled)||((Ra=Se==null?void 0:Se.auth_factors_enabled)==null?void 0:Ra.phone_otp)&&je||me&&((Ia=t==null?void 0:t.social_connections)==null?void 0:Ia.some($r=>$r.enabled))},q=async()=>{if(A.some(re=>re.length!==6)){d("Please enter both 6-digit verification codes","error");return}try{if(ie(!0),await a(H,A),await r.refetch(),ce!=null&&ce.backup_code){const re=await f();U(re),await r.refetch(),P("backup")}else P("success")}catch(re){d(re.message||"Invalid verification codes","error")}finally{ie(!1)}},ae=()=>{P("table"),T(""),N(""),L(""),se(["",""]),U([]),d("Two-factor authentication setup completed successfully!","info")},ke=async()=>{var re;if((re=r==null?void 0:r.user_authenticator)!=null&&re.id)try{Q(!0),await h(r.user_authenticator.id),await r.refetch(),v(!1),d("Two-factor authentication removed successfully","info")}catch(je){d(je.message||"Failed to remove authenticator","error")}finally{Q(!1)}},ne=async()=>{if(!K)try{ee(!0);const re=await c();U(re),await r.refetch(),x(!0),d("New backup codes generated","info")}catch(re){d(re.message||"Failed to generate backup codes","error")}finally{ee(!1)}},Y=()=>{const re=te.join(`
|
|
4124
4124
|
`);navigator.clipboard.writeText(re).then(()=>{d("Backup codes copied to clipboard","info")}).catch(()=>{d("Failed to copy backup codes","error")})},Z=()=>{const re=te.join(`
|
|
4125
|
-
`),je=new Blob([re],{type:"text/plain"}),me=URL.createObjectURL(je),Se=document.createElement("a");Se.href=me,Se.download="wacht-backup-codes.txt",Se.click(),URL.revokeObjectURL(me),d("Backup codes downloaded","info")},N=[];return B&&N.push({id:"password",name:"Password",description:"Secure your account with a strong password",status:r!=null&&r.has_password?"Enabled":"Disabled",actions:r!=null&&r.has_password?["change"]:["setup"]}),ce!=null&&ce.authenticator&&N.push({id:"authenticator",name:"Two-Factor Authentication",description:"Use an authenticator app for extra security",status:r!=null&&r.user_authenticator?"Enabled":"Disabled",actions:r!=null&&r.user_authenticator?["remove"]:["setup"]}),r!=null&&r.user_authenticator&&N.push({id:"backup_codes",name:"Backup Codes",description:"Recovery codes if you lose your authenticator",status:r!=null&&r.backup_codes_generated?"Generated":"Not Generated",actions:["generate"]}),(r!=null&&r.user_authenticator||r!=null&&r.backup_codes_generated||r.second_factor_policy==="enforced"||r.primary_phone_number_id)&&N.push({id:"second_factor_policy",name:"Second Factor Policy",description:"Require a second factor for all sign-ins",status:u==="enforced"?"Enforced":"Optional",actions:["toggle"]}),O!=="table"?e.jsxs(e.Fragment,{children:[e.jsxs(Go,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(wr,{size:16}),e.jsxs("span",{style:{fontSize:"14px",fontWeight:500,color:"var(--color-foreground)"},children:[O==="qr"&&"Setup Two-Factor Authentication",O==="verify"&&"Verify Your Authenticator",O==="backup"&&"Save Your Backup Codes",O==="success"&&"Setup Complete!"]})]}),e.jsx(X,{onClick:()=>P("table"),style:{padding:"8px 16px",fontSize:"14px",background:"var(--color-background)",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",color:"var(--color-foreground)",fontWeight:"500",cursor:"pointer",transition:"all 0.2s ease"},children:"← Back"})]}),e.jsxs("div",{style:{maxWidth:"500px",margin:"0 auto",textAlign:"center",padding:"24px"},children:[O==="qr"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{color:"var(--color-secondary-text)",marginBottom:"24px"},children:"Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.)"}),e.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"24px"},children:oe?e.jsx("div",{style:{width:"200px",height:"200px",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--color-input-background)"},children:e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("div",{style:{width:"24px",height:"24px",border:"2px solid var(--color-border)",borderTop:"2px solid var(--color-primary)",borderRadius:"50%",animation:`${ov} 1s linear infinite`,margin:"0 auto 8px"}}),e.jsx("div",{style:{fontSize:"12px",color:"var(--color-secondary-text)"},children:"Loading QR Code..."})]})}):z?e.jsx("div",{style:{border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",padding:"16px",background:"white"},children:e.jsx(Ea,{value:z,size:200,level:"M",marginSize:0})}):e.jsx("div",{style:{width:"200px",height:"200px",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--color-input-background)",color:"var(--color-error)",fontSize:"14px",textAlign:"center"},children:"QR Code Not Available"})}),e.jsxs("div",{style:{background:"var(--color-input-background)",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",padding:"12px",marginBottom:"24px"},children:[e.jsx("p",{style:{fontSize:"14px",color:"var(--color-secondary-text)",margin:"0 0 8px 0"},children:"Or enter this code manually:"}),e.jsx("code",{style:{fontFamily:"monospace",fontSize:"14px",wordBreak:"break-all"},children:M||"Loading..."})]}),e.jsx(X,{onClick:()=>P("verify"),disabled:!z||!M,style:{padding:"10px 20px",background:!z||!M?"var(--color-border)":"var(--color-primary)",color:!z||!M?"var(--color-secondary-text)":"white",border:`1px solid ${!z||!M?"var(--color-border)":"var(--color-primary)"}`,cursor:!z||!M?"not-allowed":"pointer"},children:"I've Scanned the Code"})]}),O==="verify"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{color:"var(--color-secondary-text)",marginBottom:"24px"},children:"Enter two consecutive codes from your authenticator app to verify setup"}),e.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"center",marginBottom:"24px"},children:[e.jsx(pe,{type:"text",placeholder:"000000",value:A[0],onChange:re=>{const je=re.target.value.replace(/[^0-9]/g,"").substring(0,6);se([je,A[1]])},maxLength:6,style:{width:"100px",textAlign:"center",fontFamily:"monospace"}}),e.jsx(pe,{type:"text",placeholder:"000000",value:A[1],onChange:re=>{const je=re.target.value.replace(/[^0-9]/g,"").substring(0,6);se([A[0],je])},maxLength:6,style:{width:"100px",textAlign:"center",fontFamily:"monospace"}})]}),e.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"center"},children:[e.jsx(X,{onClick:()=>P("qr"),style:{padding:"8px 16px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:"Back"}),e.jsx(X,{onClick:H,disabled:J||A.some(re=>re.length!==6),style:{padding:"8px 16px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)"},children:J?"Verifying...":"Verify & Continue"})]})]}),O==="backup"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{background:"var(--color-warning-background)",border:"1px solid var(--color-warning-border)",borderRadius:"var(--radius-md)",padding:"16px",marginBottom:"24px",display:"flex",alignItems:"flex-start",gap:"12px",textAlign:"left"},children:[e.jsx(dt,{size:16,style:{color:"var(--color-warning)",marginTop:"2px"}}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,marginBottom:"4px"},children:"Important!"}),e.jsx("div",{style:{fontSize:"14px",color:"var(--color-secondary-text)"},children:"Store these codes safely. Each code can only be used once if you lose access to your authenticator device."})]})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"8px",marginBottom:"24px",maxWidth:"300px",margin:"0 auto 24px auto"},children:te.map((re,je)=>e.jsx("div",{style:{background:"var(--color-input-background)",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",padding:"8px",fontFamily:"monospace",fontSize:"12px",textAlign:"center",cursor:"pointer"},onClick:()=>navigator.clipboard.writeText(re),children:re},je))}),e.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"center",marginBottom:"24px"},children:[e.jsx(X,{onClick:Y,style:{padding:"8px 16px",fontSize:"14px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:"Copy All"}),e.jsxs(X,{onClick:Z,style:{padding:"8px 16px",fontSize:"14px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:[e.jsx(tn,{size:16,style:{marginRight:"4px"}}),"Download"]})]}),e.jsx(X,{onClick:ae,style:{padding:"10px 20px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)"},children:"Complete Setup"})]}),O==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx(Ye,{size:48,style:{color:"var(--color-success)",marginBottom:"16px"}}),e.jsx("h3",{style:{fontSize:"18px",fontWeight:600,margin:"0 0 8px 0"},children:"All Set!"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--color-secondary-text)",margin:0},children:"Your account is now protected with two-factor authentication."})]}),e.jsx(X,{onClick:ae,style:{padding:"10px 20px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)"},children:"Continue to Security"})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Go,{children:e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:e.jsx("span",{style:{fontSize:"14px",fontWeight:400,color:"var(--color-foreground)"},children:"Security Settings"})})}),N.length?e.jsx("div",{children:N.map((re,je)=>e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 0"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:400,color:"var(--color-foreground)"},children:re.name}),e.jsx("div",{style:{fontSize:"13px",color:"var(--color-secondary-text)"},children:re.description})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[e.jsx("span",{style:{padding:"4px 12px",borderRadius:"16px",fontSize:"12px",fontWeight:400,background:re.status==="Enabled"||re.status==="Generated"?"var(--color-success-background)":"var(--color-background-hover)",color:re.status==="Enabled"||re.status==="Generated"?"var(--color-success)":"var(--color-secondary-text)"},children:re.status}),e.jsxs("div",{style:{position:"relative"},children:[re.id==="password"&&e.jsx(e.Fragment,{children:r!=null&&r.has_password?e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:k,onClick:()=>$(!0),style:{padding:"6px 12px",fontSize:"12px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:"Change"}),b&&e.jsx(ui,{triggerRef:k,onClose:()=>$(!1),onChangePassword:V})]}),le()&&e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:R,onClick:()=>w(!0),style:{padding:"6px 12px",fontSize:"12px",background:"transparent",color:"var(--color-error)",border:"1px solid var(--color-error)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:"Remove"}),C&&e.jsx(W0,{triggerRef:R,onClose:()=>w(!1),onRemovePassword:D})]})]}):e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:k,onClick:()=>$(!0),style:{padding:"6px 12px",fontSize:"12px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:"Setup"}),b&&e.jsx(ui,{triggerRef:k,onClose:()=>$(!1),onChangePassword:V,isSetup:!0})]})}),re.id==="authenticator"&&!(r!=null&&r.user_authenticator)&&e.jsx(e.Fragment,{children:e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:I,onClick:()=>E(!0),disabled:oe,style:{padding:"6px 12px",fontSize:"12px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:oe?"Setting up...":"Setup"}),S&&e.jsx(O0,{triggerRef:I,onClose:()=>E(!1),onSetupTOTP:async()=>{const me=await s();return L(me.id),me},onVerifyTOTP:async me=>{await a(G,me),await r.refetch(),d("Two-factor authentication enabled successfully!","info")}})]})}),re.id==="authenticator"&&(r==null?void 0:r.user_authenticator)&&e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{onClick:()=>v(!0),disabled:de,style:{padding:"6px 16px",fontSize:"13px",background:"var(--color-error)",border:"1px solid var(--color-error)",color:"white",cursor:de?"not-allowed":"pointer",opacity:de?.6:1},children:de?"Removing...":"Remove"}),m&&e.jsx(Hr,{title:"Remove MFA and reset policy to default?",onConfirm:ke,onCancel:()=>v(!1)})]}),re.id==="backup_codes"&&e.jsx(e.Fragment,{children:e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:_,onClick:ne,disabled:K,style:{padding:"6px 12px",fontSize:"12px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:K?"Generating...":r!=null&&r.backup_codes_generated?"Regenerate":"Generate"}),j&&e.jsx(Q0,{triggerRef:_,codes:te,onClose:()=>x(!1),onCopy:Y,onDownload:Z})]})}),re.id==="second_factor_policy"&&e.jsx(jr,{checked:u==="enforced",onChange:me=>{y(me?"enforced":"none")}})]})]})]}),je<N.length-1&&e.jsx("div",{style:{height:"1px",background:"var(--color-border)",margin:"0"}})]},re.id))}):e.jsx(et,{title:"No security features available",description:"Contact your administrator to enable security features."})]})},gv=()=>{var F,G;const{deployment:t}=ve(),{user:r,updateProfile:o,updateProfilePicture:n,deleteAccount:s}=rr(),{toast:a}=Tt(),[h,f]=i.useState(""),[c,p]=i.useState(""),[d,u]=i.useState(""),[g,m]=i.useState(!1),[v,y]=i.useState(!1),[S,E]=i.useState(!1),[b,$]=i.useState(""),[C,w]=i.useState((r==null?void 0:r.profile_picture_url)||null),j=i.useRef(null);i.useEffect(()=>{r&&!g&&(f(r.first_name||""),p(r.last_name||""),u(r.username||""),w(r.profile_picture_url||null),m(!0))},[r,g]);const x=i.useCallback(async()=>{if(r)try{const L={};h!==r.first_name&&(L.first_name=h),c!==r.last_name&&(L.last_name=c),d!==r.username&&(L.username=d),Object.keys(L).length>0&&await o(L)}catch(L){a(L.message||"Failed to save profile changes","error")}},[r,o,h,c,d,a]),I=L=>{f(L.target.value)},k=L=>{p(L.target.value)},R=L=>{u(L.target.value)},_=()=>{x()},O=()=>{x()},P=()=>{x()},z=L=>{var A;if((A=L.target.files)!=null&&A[0]){const se=L.target.files[0];w(URL.createObjectURL(se)),setTimeout(async()=>{try{await n(se),r.refetch(),a("Profile picture updated successfully","info")}catch(te){a(te.message||"Failed to update profile picture","error"),w((r==null?void 0:r.profile_picture_url)||null)}},100)}},T=()=>{j.current&&j.current.click()};if(!r)return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ee,{})});const M=async()=>{if(!(!r||b!==r.username)){E(!0);try{await s(""),a("Account deleted successfully","info")}catch(L){a(L.message||"Failed to delete account","error")}finally{E(!1),$(""),y(!1)}}};return e.jsx(e.Fragment,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-2xl)"},children:[e.jsxs("div",{style:{display:"flex",gap:"var(--space-2xl)",alignItems:"center"},children:[e.jsx("div",{style:{flexShrink:0},children:e.jsxs("div",{style:{width:"120px",height:"120px",borderRadius:"50%",border:"2px dashed var(--color-border)",background:C?"transparent":"var(--color-input-background)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"all 0.2s ease"},onClick:T,onMouseEnter:L=>{L.currentTarget.style.borderColor="var(--color-primary)",L.currentTarget.style.transform="scale(1.02)"},onMouseLeave:L=>{L.currentTarget.style.borderColor="var(--color-border)",L.currentTarget.style.transform="scale(1)"},children:[C?e.jsx("img",{src:C,alt:"Profile Picture",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}):e.jsx(No,{size:32,color:"var(--color-muted)"}),e.jsx("input",{type:"file",ref:j,style:{display:"none"},accept:"image/*",onChange:z})]})}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{marginBottom:"var(--space-lg)"},children:[e.jsx("h3",{style:{fontSize:"var(--font-sm)",color:"var(--color-foreground)",margin:"0 0 var(--space-2xs) 0"},children:"Profile Picture"}),e.jsx("p",{style:{fontSize:"var(--font-xs)",color:"var(--color-secondary-text)",margin:0},children:"Upload an image to represent your profile"})]}),e.jsxs("div",{style:{display:"flex",gap:"var(--space-sm)",marginBottom:"var(--space-sm)"},children:[e.jsxs(X,{onClick:()=>{var L;return(L=j.current)==null?void 0:L.click()},style:{padding:"var(--space-xs) var(--space-md)",fontSize:"var(--font-xs)",height:"32px",width:"100px",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx(tn,{size:14}),C?"Change":"Upload"]}),e.jsxs(X,{onClick:async()=>{w(null),j.current&&(j.current.value="");try{await o({remove_profile_picture:!0}),await r.refetch(),a("Profile picture removed successfully","info")}catch(L){a(L.message||"Failed to remove profile picture","error"),w((r==null?void 0:r.profile_picture_url)||null)}},style:{background:"transparent",color:"var(--color-muted)",border:"1px solid var(--color-border)",padding:"var(--space-xs) var(--space-md)",fontSize:"var(--font-xs)",height:"32px",width:"100px",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx(dt,{size:14}),"Remove"]})]})]})]}),e.jsx("div",{style:{position:"relative",height:"1px",background:"var(--color-divider)",margin:"0"}}),e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:"var(--space-md)"},children:[e.jsx("h3",{style:{fontSize:"var(--font-sm)",color:"var(--color-foreground)",margin:"0 0 var(--space-2xs) 0"},children:"Profile Details"}),e.jsx("p",{style:{fontSize:"var(--font-xs)",color:"var(--color-secondary-text)",margin:0},children:"Basic information about your profile"})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-lg)"},children:[e.jsxs("div",{style:{display:"flex",gap:"var(--space-md)"},children:[e.jsxs(ge,{style:{flex:1},children:[e.jsx(he,{htmlFor:"firstName",children:"First Name"}),e.jsx(pe,{id:"firstName",type:"text",value:h,onChange:I,onBlur:_,placeholder:"Enter your first name",required:!0})]}),e.jsxs(ge,{style:{flex:1},children:[e.jsx(he,{htmlFor:"lastName",children:"Last Name"}),e.jsx(pe,{id:"lastName",type:"text",value:c,onChange:k,onBlur:O,placeholder:"Enter your last name",required:!0})]})]}),((G=(F=t==null?void 0:t.auth_settings)==null?void 0:F.username)==null?void 0:G.enabled)&&e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"username",children:"Username"}),e.jsx(pe,{id:"username",type:"text",value:d,onChange:R,onBlur:P,placeholder:"Enter your username",required:!0})]})]})]}),e.jsx("div",{style:{position:"relative",height:"1px",background:"var(--color-divider)",margin:"0"}}),e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsx("h3",{style:{fontSize:"16px",color:"var(--color-foreground)",margin:"0 0 4px 0"},children:"Danger Zone"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--color-muted)",margin:0},children:"Irreversible and destructive actions"})]}),e.jsxs("div",{style:{padding:"20px",border:"1px solid var(--color-error)",borderRadius:"8px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:v?"20px":"0"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"14px",color:"var(--color-foreground)",marginBottom:"4px",fontWeight:"500"},children:"Delete Account"}),e.jsx("div",{style:{fontSize:"13px",color:"var(--color-muted)"},children:"Once you delete your account, there is no going back. Please be certain."})]}),e.jsx(X,{onClick:()=>{v?(y(!1),$("")):y(!0)},style:{background:"var(--color-error)",color:"white",border:"none",padding:"6px 12px",fontSize:"13px",height:"32px",width:"auto"},children:v?"Cancel":"Delete"})]}),v&&e.jsxs("div",{style:{maxWidth:"400px"},children:[e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"confirm_username",children:"Confirm by typing your username"}),e.jsx(pe,{id:"confirm_username",type:"text",value:b,onChange:L=>$(L.target.value),placeholder:`Type "${r==null?void 0:r.username}" to confirm`})]}),e.jsx(X,{onClick:M,disabled:b!==(r==null?void 0:r.username)||S,style:{background:b===(r==null?void 0:r.username)?"var(--color-error)":"transparent",color:b===(r==null?void 0:r.username)?"white":"var(--color-muted)",border:"1px solid var(--color-border)",padding:"8px 16px",fontSize:"14px",height:"36px",cursor:b===(r==null?void 0:r.username)?"pointer":"not-allowed",opacity:b===(r==null?void 0:r.username)?1:.6,marginTop:"12px"},children:S?e.jsx(Ee,{size:12}):"Delete Forever"})]})]})]})]})})},Ul=({isOpen:t,onClose:r,title:o,showHeader:n,headerContent:s,footerContent:a,customContent:h,children:f,showCloseButton:c})=>e.jsx(_e,{isOpen:t,onClose:r,children:e.jsx(_e.Overlay,{children:e.jsxs(_e.Content,{style:{width:"900px",maxWidth:"100%"},children:[n&&e.jsx(_e.Header,{showCloseButton:c,children:s||o}),h||f||e.jsx(Bl,{}),a&&e.jsx(_e.Footer,{children:a})]})})}),mv=l.div`
|
|
4125
|
+
`),je=new Blob([re],{type:"text/plain"}),me=URL.createObjectURL(je),Se=document.createElement("a");Se.href=me,Se.download="wacht-backup-codes.txt",Se.click(),URL.revokeObjectURL(me),d("Backup codes downloaded","info")},F=[];return B&&F.push({id:"password",name:"Password",description:"Secure your account with a strong password",status:r!=null&&r.has_password?"Enabled":"Disabled",actions:r!=null&&r.has_password?["change"]:["setup"]}),ce!=null&&ce.authenticator&&F.push({id:"authenticator",name:"Two-Factor Authentication",description:"Use an authenticator app for extra security",status:r!=null&&r.user_authenticator?"Enabled":"Disabled",actions:r!=null&&r.user_authenticator?["remove"]:["setup"]}),r!=null&&r.user_authenticator&&F.push({id:"backup_codes",name:"Backup Codes",description:"Recovery codes if you lose your authenticator",status:r!=null&&r.backup_codes_generated?"Generated":"Not Generated",actions:["generate"]}),(r!=null&&r.user_authenticator||r!=null&&r.backup_codes_generated||r.second_factor_policy==="enforced"||r.primary_phone_number_id)&&F.push({id:"second_factor_policy",name:"Second Factor Policy",description:"Require a second factor for all sign-ins",status:u==="enforced"?"Enforced":"Optional",actions:["toggle"]}),O!=="table"?e.jsxs(e.Fragment,{children:[e.jsxs(Go,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(wr,{size:16}),e.jsxs("span",{style:{fontSize:"14px",fontWeight:500,color:"var(--color-foreground)"},children:[O==="qr"&&"Setup Two-Factor Authentication",O==="verify"&&"Verify Your Authenticator",O==="backup"&&"Save Your Backup Codes",O==="success"&&"Setup Complete!"]})]}),e.jsx(X,{onClick:()=>P("table"),style:{padding:"8px 16px",fontSize:"14px",background:"var(--color-background)",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",color:"var(--color-foreground)",fontWeight:"500",cursor:"pointer",transition:"all 0.2s ease"},children:"← Back"})]}),e.jsxs("div",{style:{maxWidth:"500px",margin:"0 auto",textAlign:"center",padding:"24px"},children:[O==="qr"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{color:"var(--color-secondary-text)",marginBottom:"24px"},children:"Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.)"}),e.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"24px"},children:oe?e.jsx("div",{style:{width:"200px",height:"200px",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--color-input-background)"},children:e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("div",{style:{width:"24px",height:"24px",border:"2px solid var(--color-border)",borderTop:"2px solid var(--color-primary)",borderRadius:"50%",animation:`${ov} 1s linear infinite`,margin:"0 auto 8px"}}),e.jsx("div",{style:{fontSize:"12px",color:"var(--color-secondary-text)"},children:"Loading QR Code..."})]})}):z?e.jsx("div",{style:{border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",padding:"16px",background:"white"},children:e.jsx(Ea,{value:z,size:200,level:"M",marginSize:0})}):e.jsx("div",{style:{width:"200px",height:"200px",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--color-input-background)",color:"var(--color-error)",fontSize:"14px",textAlign:"center"},children:"QR Code Not Available"})}),e.jsxs("div",{style:{background:"var(--color-input-background)",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",padding:"12px",marginBottom:"24px"},children:[e.jsx("p",{style:{fontSize:"14px",color:"var(--color-secondary-text)",margin:"0 0 8px 0"},children:"Or enter this code manually:"}),e.jsx("code",{style:{fontFamily:"monospace",fontSize:"14px",wordBreak:"break-all"},children:M||"Loading..."})]}),e.jsx(X,{onClick:()=>P("verify"),disabled:!z||!M,style:{padding:"10px 20px",background:!z||!M?"var(--color-border)":"var(--color-primary)",color:!z||!M?"var(--color-secondary-text)":"white",border:`1px solid ${!z||!M?"var(--color-border)":"var(--color-primary)"}`,cursor:!z||!M?"not-allowed":"pointer"},children:"I've Scanned the Code"})]}),O==="verify"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{color:"var(--color-secondary-text)",marginBottom:"24px"},children:"Enter two consecutive codes from your authenticator app to verify setup"}),e.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"center",marginBottom:"24px"},children:[e.jsx(pe,{type:"text",placeholder:"000000",value:A[0],onChange:re=>{const je=re.target.value.replace(/[^0-9]/g,"").substring(0,6);se([je,A[1]])},maxLength:6,style:{width:"100px",textAlign:"center",fontFamily:"monospace"}}),e.jsx(pe,{type:"text",placeholder:"000000",value:A[1],onChange:re=>{const je=re.target.value.replace(/[^0-9]/g,"").substring(0,6);se([A[0],je])},maxLength:6,style:{width:"100px",textAlign:"center",fontFamily:"monospace"}})]}),e.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"center"},children:[e.jsx(X,{onClick:()=>P("qr"),style:{padding:"8px 16px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:"Back"}),e.jsx(X,{onClick:q,disabled:J||A.some(re=>re.length!==6),style:{padding:"8px 16px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)"},children:J?"Verifying...":"Verify & Continue"})]})]}),O==="backup"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{background:"var(--color-warning-background)",border:"1px solid var(--color-warning-border)",borderRadius:"var(--radius-md)",padding:"16px",marginBottom:"24px",display:"flex",alignItems:"flex-start",gap:"12px",textAlign:"left"},children:[e.jsx(dt,{size:16,style:{color:"var(--color-warning)",marginTop:"2px"}}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,marginBottom:"4px"},children:"Important!"}),e.jsx("div",{style:{fontSize:"14px",color:"var(--color-secondary-text)"},children:"Store these codes safely. Each code can only be used once if you lose access to your authenticator device."})]})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"8px",marginBottom:"24px",maxWidth:"300px",margin:"0 auto 24px auto"},children:te.map((re,je)=>e.jsx("div",{style:{background:"var(--color-input-background)",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",padding:"8px",fontFamily:"monospace",fontSize:"12px",textAlign:"center",cursor:"pointer"},onClick:()=>navigator.clipboard.writeText(re),children:re},je))}),e.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"center",marginBottom:"24px"},children:[e.jsx(X,{onClick:Y,style:{padding:"8px 16px",fontSize:"14px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:"Copy All"}),e.jsxs(X,{onClick:Z,style:{padding:"8px 16px",fontSize:"14px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:[e.jsx(tn,{size:16,style:{marginRight:"4px"}}),"Download"]})]}),e.jsx(X,{onClick:ae,style:{padding:"10px 20px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)"},children:"Complete Setup"})]}),O==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx(Ye,{size:48,style:{color:"var(--color-success)",marginBottom:"16px"}}),e.jsx("h3",{style:{fontSize:"18px",fontWeight:600,margin:"0 0 8px 0"},children:"All Set!"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--color-secondary-text)",margin:0},children:"Your account is now protected with two-factor authentication."})]}),e.jsx(X,{onClick:ae,style:{padding:"10px 20px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)"},children:"Continue to Security"})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Go,{children:e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:e.jsx("span",{style:{fontSize:"14px",fontWeight:400,color:"var(--color-foreground)"},children:"Security Settings"})})}),F.length?e.jsx("div",{children:F.map((re,je)=>e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 0"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:400,color:"var(--color-foreground)"},children:re.name}),e.jsx("div",{style:{fontSize:"13px",color:"var(--color-secondary-text)"},children:re.description})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[e.jsx("span",{style:{padding:"4px 12px",borderRadius:"16px",fontSize:"12px",fontWeight:400,background:re.status==="Enabled"||re.status==="Generated"?"var(--color-success-background)":"var(--color-background-hover)",color:re.status==="Enabled"||re.status==="Generated"?"var(--color-success)":"var(--color-secondary-text)"},children:re.status}),e.jsxs("div",{style:{position:"relative"},children:[re.id==="password"&&e.jsx(e.Fragment,{children:r!=null&&r.has_password?e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:k,onClick:()=>$(!0),style:{padding:"6px 12px",fontSize:"12px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:"Change"}),b&&e.jsx(ui,{triggerRef:k,onClose:()=>$(!1),onChangePassword:V})]}),le()&&e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:R,onClick:()=>w(!0),style:{padding:"6px 12px",fontSize:"12px",background:"transparent",color:"var(--color-error)",border:"1px solid var(--color-error)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:"Remove"}),C&&e.jsx(W0,{triggerRef:R,onClose:()=>w(!1),onRemovePassword:D})]})]}):e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:k,onClick:()=>$(!0),style:{padding:"6px 12px",fontSize:"12px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:"Setup"}),b&&e.jsx(ui,{triggerRef:k,onClose:()=>$(!1),onChangePassword:V,isSetup:!0})]})}),re.id==="authenticator"&&!(r!=null&&r.user_authenticator)&&e.jsx(e.Fragment,{children:e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:I,onClick:()=>E(!0),disabled:oe,style:{padding:"6px 12px",fontSize:"12px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:oe?"Setting up...":"Setup"}),S&&e.jsx(O0,{triggerRef:I,onClose:()=>E(!1),onSetupTOTP:async()=>{const me=await s();return L(me.id),me},onVerifyTOTP:async me=>{await a(H,me),await r.refetch(),d("Two-factor authentication enabled successfully!","info")}})]})}),re.id==="authenticator"&&(r==null?void 0:r.user_authenticator)&&e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{onClick:()=>v(!0),disabled:de,style:{padding:"6px 16px",fontSize:"13px",background:"var(--color-error)",border:"1px solid var(--color-error)",color:"white",cursor:de?"not-allowed":"pointer",opacity:de?.6:1},children:de?"Removing...":"Remove"}),m&&e.jsx(Hr,{title:"Remove MFA and reset policy to default?",onConfirm:ke,onCancel:()=>v(!1)})]}),re.id==="backup_codes"&&e.jsx(e.Fragment,{children:e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:_,onClick:ne,disabled:K,style:{padding:"6px 12px",fontSize:"12px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:K?"Generating...":r!=null&&r.backup_codes_generated?"Regenerate":"Generate"}),j&&e.jsx(Q0,{triggerRef:_,codes:te,onClose:()=>x(!1),onCopy:Y,onDownload:Z})]})}),re.id==="second_factor_policy"&&e.jsx(jr,{checked:u==="enforced",onChange:me=>{y(me?"enforced":"none")}})]})]})]}),je<F.length-1&&e.jsx("div",{style:{height:"1px",background:"var(--color-border)",margin:"0"}})]},re.id))}):e.jsx(et,{title:"No security features available",description:"Contact your administrator to enable security features."})]})},gv=()=>{var N,H;const{deployment:t}=ve(),{user:r,updateProfile:o,updateProfilePicture:n,deleteAccount:s}=rr(),{toast:a}=Tt(),[h,f]=i.useState(""),[c,p]=i.useState(""),[d,u]=i.useState(""),[g,m]=i.useState(!1),[v,y]=i.useState(!1),[S,E]=i.useState(!1),[b,$]=i.useState(""),[C,w]=i.useState((r==null?void 0:r.profile_picture_url)||null),j=i.useRef(null);i.useEffect(()=>{r&&!g&&(f(r.first_name||""),p(r.last_name||""),u(r.username||""),w(r.profile_picture_url||null),m(!0))},[r,g]);const x=i.useCallback(async()=>{if(r)try{const L={};h!==r.first_name&&(L.first_name=h),c!==r.last_name&&(L.last_name=c),d!==r.username&&(L.username=d),Object.keys(L).length>0&&await o(L)}catch(L){a(L.message||"Failed to save profile changes","error")}},[r,o,h,c,d,a]),I=L=>{f(L.target.value)},k=L=>{p(L.target.value)},R=L=>{u(L.target.value)},_=()=>{x()},O=()=>{x()},P=()=>{x()},z=L=>{var A;if((A=L.target.files)!=null&&A[0]){const se=L.target.files[0];w(URL.createObjectURL(se)),setTimeout(async()=>{try{await n(se),r.refetch(),a("Profile picture updated successfully","info")}catch(te){a(te.message||"Failed to update profile picture","error"),w((r==null?void 0:r.profile_picture_url)||null)}},100)}},T=()=>{j.current&&j.current.click()};if(!r)return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ee,{})});const M=async()=>{if(!(!r||b!==r.username)){E(!0);try{await s(""),a("Account deleted successfully","info")}catch(L){a(L.message||"Failed to delete account","error")}finally{E(!1),$(""),y(!1)}}};return e.jsx(e.Fragment,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-2xl)"},children:[e.jsxs("div",{style:{display:"flex",gap:"var(--space-2xl)",alignItems:"center"},children:[e.jsx("div",{style:{flexShrink:0},children:e.jsxs("div",{style:{width:"120px",height:"120px",borderRadius:"50%",border:"2px dashed var(--color-border)",background:C?"transparent":"var(--color-input-background)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"all 0.2s ease"},onClick:T,onMouseEnter:L=>{L.currentTarget.style.borderColor="var(--color-primary)",L.currentTarget.style.transform="scale(1.02)"},onMouseLeave:L=>{L.currentTarget.style.borderColor="var(--color-border)",L.currentTarget.style.transform="scale(1)"},children:[C?e.jsx("img",{src:C,alt:"Profile Picture",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}):e.jsx(Fo,{size:32,color:"var(--color-muted)"}),e.jsx("input",{type:"file",ref:j,style:{display:"none"},accept:"image/*",onChange:z})]})}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{marginBottom:"var(--space-lg)"},children:[e.jsx("h3",{style:{fontSize:"var(--font-sm)",color:"var(--color-foreground)",margin:"0 0 var(--space-2xs) 0"},children:"Profile Picture"}),e.jsx("p",{style:{fontSize:"var(--font-xs)",color:"var(--color-secondary-text)",margin:0},children:"Upload an image to represent your profile"})]}),e.jsxs("div",{style:{display:"flex",gap:"var(--space-sm)",marginBottom:"var(--space-sm)"},children:[e.jsxs(X,{onClick:()=>{var L;return(L=j.current)==null?void 0:L.click()},style:{padding:"var(--space-xs) var(--space-md)",fontSize:"var(--font-xs)",height:"32px",width:"100px",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx(tn,{size:14}),C?"Change":"Upload"]}),e.jsxs(X,{onClick:async()=>{w(null),j.current&&(j.current.value="");try{await o({remove_profile_picture:!0}),await r.refetch(),a("Profile picture removed successfully","info")}catch(L){a(L.message||"Failed to remove profile picture","error"),w((r==null?void 0:r.profile_picture_url)||null)}},style:{background:"transparent",color:"var(--color-muted)",border:"1px solid var(--color-border)",padding:"var(--space-xs) var(--space-md)",fontSize:"var(--font-xs)",height:"32px",width:"100px",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx(dt,{size:14}),"Remove"]})]})]})]}),e.jsx("div",{style:{position:"relative",height:"1px",background:"var(--color-divider)",margin:"0"}}),e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:"var(--space-md)"},children:[e.jsx("h3",{style:{fontSize:"var(--font-sm)",color:"var(--color-foreground)",margin:"0 0 var(--space-2xs) 0"},children:"Profile Details"}),e.jsx("p",{style:{fontSize:"var(--font-xs)",color:"var(--color-secondary-text)",margin:0},children:"Basic information about your profile"})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-lg)"},children:[e.jsxs("div",{style:{display:"flex",gap:"var(--space-md)"},children:[e.jsxs(ge,{style:{flex:1},children:[e.jsx(he,{htmlFor:"firstName",children:"First Name"}),e.jsx(pe,{id:"firstName",type:"text",value:h,onChange:I,onBlur:_,placeholder:"Enter your first name",required:!0})]}),e.jsxs(ge,{style:{flex:1},children:[e.jsx(he,{htmlFor:"lastName",children:"Last Name"}),e.jsx(pe,{id:"lastName",type:"text",value:c,onChange:k,onBlur:O,placeholder:"Enter your last name",required:!0})]})]}),((H=(N=t==null?void 0:t.auth_settings)==null?void 0:N.username)==null?void 0:H.enabled)&&e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"username",children:"Username"}),e.jsx(pe,{id:"username",type:"text",value:d,onChange:R,onBlur:P,placeholder:"Enter your username",required:!0})]})]})]}),e.jsx("div",{style:{position:"relative",height:"1px",background:"var(--color-divider)",margin:"0"}}),e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsx("h3",{style:{fontSize:"16px",color:"var(--color-foreground)",margin:"0 0 4px 0"},children:"Danger Zone"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--color-muted)",margin:0},children:"Irreversible and destructive actions"})]}),e.jsxs("div",{style:{padding:"20px",border:"1px solid var(--color-error)",borderRadius:"8px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:v?"20px":"0"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"14px",color:"var(--color-foreground)",marginBottom:"4px",fontWeight:"500"},children:"Delete Account"}),e.jsx("div",{style:{fontSize:"13px",color:"var(--color-muted)"},children:"Once you delete your account, there is no going back. Please be certain."})]}),e.jsx(X,{onClick:()=>{v?(y(!1),$("")):y(!0)},style:{background:"var(--color-error)",color:"white",border:"none",padding:"6px 12px",fontSize:"13px",height:"32px",width:"auto"},children:v?"Cancel":"Delete"})]}),v&&e.jsxs("div",{style:{maxWidth:"400px"},children:[e.jsxs(ge,{children:[e.jsx(he,{htmlFor:"confirm_username",children:"Confirm by typing your username"}),e.jsx(pe,{id:"confirm_username",type:"text",value:b,onChange:L=>$(L.target.value),placeholder:`Type "${r==null?void 0:r.username}" to confirm`})]}),e.jsx(X,{onClick:M,disabled:b!==(r==null?void 0:r.username)||S,style:{background:b===(r==null?void 0:r.username)?"var(--color-error)":"transparent",color:b===(r==null?void 0:r.username)?"white":"var(--color-muted)",border:"1px solid var(--color-border)",padding:"8px 16px",fontSize:"14px",height:"36px",cursor:b===(r==null?void 0:r.username)?"pointer":"not-allowed",opacity:b===(r==null?void 0:r.username)?1:.6,marginTop:"12px"},children:S?e.jsx(Ee,{size:12}):"Delete Forever"})]})]})]})]})})},Ul=({isOpen:t,onClose:r,title:o,showHeader:n,headerContent:s,footerContent:a,customContent:h,children:f,showCloseButton:c})=>e.jsx(_e,{isOpen:t,onClose:r,children:e.jsx(_e.Overlay,{children:e.jsxs(_e.Content,{style:{width:"900px",maxWidth:"100%"},children:[n&&e.jsx(_e.Header,{showCloseButton:c,children:s||o}),h||f||e.jsx(Bl,{}),a&&e.jsx(_e.Footer,{children:a})]})})}),mv=l.div`
|
|
4126
4126
|
position: relative;
|
|
4127
4127
|
`,xv=l.button`
|
|
4128
4128
|
display: flex;
|
|
@@ -4261,7 +4261,7 @@ cursor: pointer;
|
|
|
4261
4261
|
width: 14px;
|
|
4262
4262
|
height: 14px;
|
|
4263
4263
|
}
|
|
4264
|
-
`,Pa=({showName:t=!0})=>{var j,x,I,k;const[r,o]=i.useState(!1),n=i.useRef(null),s=i.useRef(null),a=$l({triggerRef:n,isOpen:r,minWidth:380}),h=Mr(!1),{session:f,signOut:c,switchSignIn:p,refetch:d}=Be(),{navigateToSignIn:u}=Ve(),{deployment:g}=ve(),m=(j=f==null?void 0:f.active_signin)==null?void 0:j.user,v=((I=(x=g==null?void 0:g.auth_settings)==null?void 0:x.multi_session_support)==null?void 0:I.enabled)??!1,y=(((k=f==null?void 0:f.signins)==null?void 0:k.length)??0)>1;i.useEffect(()=>{if(!r)return;const R=setTimeout(()=>{const _=O=>{var z,T;const P=O.target;(z=n.current)!=null&&z.contains(P)||(T=s.current)!=null&&T.contains(P)||o(!1)};return document.addEventListener("mousedown",_),()=>{document.removeEventListener("mousedown",_)}},50);return()=>{clearTimeout(R)}},[r]);const S=()=>{o(!r)},E=R=>R.split(" ").map(_=>_[0]).join("").toUpperCase(),b=async R=>{try{await c(R),await d(),o(!1)}catch{}},$=async()=>{try{await c(),await d(),o(!1)}catch{}},C=async R=>{try{await p(R),await d(),o(!1)}catch{}},w=()=>{h.open(),o(!1)};return e.jsx(ue,{children:e.jsxs(mv,{children:[e.jsxs(xv,{ref:n,onClick:S,children:[e.jsx(Hn,{children:e.jsx(Wl,{children:m!=null&&m.has_profile_picture?e.jsx("img",{src:m.profile_picture_url,alt:m.first_name}):E(`${(m==null?void 0:m.first_name)||""} ${(m==null?void 0:m.last_name)||""}`)})}),t&&e.jsx(vv,{children:`${(m==null?void 0:m.first_name)||""} ${(m==null?void 0:m.last_name)||""}`})]}),typeof window<"u"&&r&&
|
|
4264
|
+
`,Pa=({showName:t=!0})=>{var j,x,I,k;const[r,o]=i.useState(!1),n=i.useRef(null),s=i.useRef(null),a=$l({triggerRef:n,isOpen:r,minWidth:380}),h=Mr(!1),{session:f,signOut:c,switchSignIn:p,refetch:d}=Be(),{navigateToSignIn:u}=Ve(),{deployment:g}=ve(),m=(j=f==null?void 0:f.active_signin)==null?void 0:j.user,v=((I=(x=g==null?void 0:g.auth_settings)==null?void 0:x.multi_session_support)==null?void 0:I.enabled)??!1,y=(((k=f==null?void 0:f.signins)==null?void 0:k.length)??0)>1;i.useEffect(()=>{if(!r)return;const R=setTimeout(()=>{const _=O=>{var z,T;const P=O.target;(z=n.current)!=null&&z.contains(P)||(T=s.current)!=null&&T.contains(P)||o(!1)};return document.addEventListener("mousedown",_),()=>{document.removeEventListener("mousedown",_)}},50);return()=>{clearTimeout(R)}},[r]);const S=()=>{o(!r)},E=R=>R.split(" ").map(_=>_[0]).join("").toUpperCase(),b=async R=>{try{await c(R),await d(),o(!1)}catch{}},$=async()=>{try{await c(),await d(),o(!1)}catch{}},C=async R=>{try{await p(R),await d(),o(!1)}catch{}},w=()=>{h.open(),o(!1)};return e.jsx(ue,{children:e.jsxs(mv,{children:[e.jsxs(xv,{ref:n,onClick:S,children:[e.jsx(Hn,{children:e.jsx(Wl,{children:m!=null&&m.has_profile_picture?e.jsx("img",{src:m.profile_picture_url,alt:m.first_name}):E(`${(m==null?void 0:m.first_name)||""} ${(m==null?void 0:m.last_name)||""}`)})}),t&&e.jsx(vv,{children:`${(m==null?void 0:m.first_name)||""} ${(m==null?void 0:m.last_name)||""}`})]}),typeof window<"u"&&r&&Fr.createPortal(e.jsx(ue,{children:e.jsx(bv,{ref:s,$position:a,$isOpen:r,$maxHeight:a==null?void 0:a.maxHeight,children:e.jsxs("div",{children:[v?(()=>{const R=[...(f==null?void 0:f.signins)||[]].sort((_,O)=>{const P=_.user.id===(m==null?void 0:m.id),z=O.user.id===(m==null?void 0:m.id);return P&&!z?-1:!P&&z?1:0});return R.map(({user:_,id:O},P)=>{const z=_.id===(m==null?void 0:m.id),T=!z;return e.jsxs(i.Fragment,{children:[e.jsxs(mi,{$isClickable:T,onClick:T?()=>C(O):void 0,children:[e.jsxs(xi,{children:[e.jsx(Hn,{children:e.jsx(yi,{children:_.has_profile_picture?e.jsx("img",{src:_.profile_picture_url,alt:_.first_name}):E(`${(_==null?void 0:_.first_name)||""} ${(_==null?void 0:_.last_name)||""}`)})}),e.jsxs(vi,{children:[e.jsx(bi,{children:e.jsx(fi,{children:`${(_==null?void 0:_.first_name)||""} ${(_==null?void 0:_.last_name)||""}`})}),e.jsx(gi,{children:_.primary_email_address.email})]})]}),z&&e.jsxs(wi,{children:[e.jsxs(So,{onClick:w,children:[e.jsx(Kt,{}),"Manage account"]}),e.jsxs(So,{$destructive:!0,onClick:()=>b(O),children:[e.jsx(Et,{}),"Sign out"]})]})]}),P===0&&R.length>1&&e.jsx("div",{style:{borderBottom:"1px solid var(--color-border)",margin:"0"}})]},_.id)})})():m&&e.jsxs(mi,{$isClickable:!1,children:[e.jsxs(xi,{children:[e.jsx(Hn,{children:e.jsx(yi,{children:m.has_profile_picture?e.jsx("img",{src:m.profile_picture_url,alt:m.first_name}):E(`${(m==null?void 0:m.first_name)||""} ${(m==null?void 0:m.last_name)||""}`)})}),e.jsxs(vi,{children:[e.jsx(bi,{children:e.jsx(fi,{children:`${(m==null?void 0:m.first_name)||""} ${(m==null?void 0:m.last_name)||""}`})}),e.jsx(gi,{children:m.primary_email_address.email})]})]}),e.jsxs(wi,{children:[e.jsxs(So,{onClick:w,children:[e.jsx(Kt,{}),"Manage account"]}),e.jsxs(So,{$destructive:!0,onClick:()=>{var R;return b(((R=f==null?void 0:f.active_signin)==null?void 0:R.id)||"")},children:[e.jsx(Et,{}),"Sign out"]})]})]}),v&&e.jsxs(e.Fragment,{children:[e.jsx(ji,{style:{borderBottom:"1px solid var(--color-border)"},children:e.jsxs(ki,{onClick:()=>u(),children:[e.jsx(Ke,{}),"Add new account"]})}),y&&e.jsx(ji,{children:e.jsxs(ki,{onClick:$,children:[e.jsx(Et,{}),"Sign out of all accounts"]})})]})]})})}),document.body),e.jsx(Ul,{isOpen:h.isOpen,onClose:h.close})]})})},yv=l.div`
|
|
4265
4265
|
padding: var(--space-md) var(--space-lg);
|
|
4266
4266
|
background: ${t=>t.$unread?"var(--color-background-hover)":"transparent"};
|
|
4267
4267
|
transition: all 0.2s ease;
|
|
@@ -4455,12 +4455,12 @@ cursor: pointer;
|
|
|
4455
4455
|
color: var(--color-secondary-text);
|
|
4456
4456
|
opacity: 0.6;
|
|
4457
4457
|
}
|
|
4458
|
-
`,
|
|
4458
|
+
`,Nv=l.h3`
|
|
4459
4459
|
font-size: 14px;
|
|
4460
4460
|
font-weight: 400;
|
|
4461
4461
|
color: var(--color-foreground);
|
|
4462
4462
|
margin: 0 0 4px 0;
|
|
4463
|
-
`,
|
|
4463
|
+
`,Fv=l.p`
|
|
4464
4464
|
font-size: var(--font-xs);
|
|
4465
4465
|
color: var(--color-secondary-text);
|
|
4466
4466
|
margin: 0;
|
|
@@ -4481,7 +4481,7 @@ cursor: pointer;
|
|
|
4481
4481
|
color: var(--color-primary-hover);
|
|
4482
4482
|
text-decoration: underline;
|
|
4483
4483
|
}
|
|
4484
|
-
`,Gl=i.forwardRef(({position:t,notifications:r,loading:o,onMarkAsRead:n,onMarkAllAsRead:s,onDelete:a},h)=>{const f=!o&&r.some(c=>!c.is_read);return console.log("loadings",o),e.jsxs(Rv,{ref:h,$position:t,children:[e.jsxs(Iv,{children:[e.jsx(Tv,{children:"Notifications"}),f&&e.jsx(Ov,{onClick:s,children:"Mark all as read"})]}),e.jsx(Mv,{children:o?e.jsx(Lv,{children:e.jsx(Ee,{})}):r.length===0?e.jsxs(Av,{children:[e.jsx(Dv,{children:e.jsx(jp,{})}),e.jsx(
|
|
4484
|
+
`,Gl=i.forwardRef(({position:t,notifications:r,loading:o,onMarkAsRead:n,onMarkAllAsRead:s,onDelete:a},h)=>{const f=!o&&r.some(c=>!c.is_read);return console.log("loadings",o),e.jsxs(Rv,{ref:h,$position:t,children:[e.jsxs(Iv,{children:[e.jsx(Tv,{children:"Notifications"}),f&&e.jsx(Ov,{onClick:s,children:"Mark all as read"})]}),e.jsx(Mv,{children:o?e.jsx(Lv,{children:e.jsx(Ee,{})}):r.length===0?e.jsxs(Av,{children:[e.jsx(Dv,{children:e.jsx(jp,{})}),e.jsx(Nv,{children:"No notifications"}),e.jsx(Fv,{children:"You're all caught up!"})]}):r.map(c=>e.jsx(Vl,{notification:c,onMarkAsRead:n,onDelete:a},c.id))}),!o&&r.length>0&&e.jsx(Bv,{children:e.jsx(Uv,{href:"/notifications",children:"View all notifications"})})]})}),Wv=l.div`
|
|
4485
4485
|
position: relative;
|
|
4486
4486
|
`,Vv=l.div`
|
|
4487
4487
|
width: 40px;
|
|
@@ -4544,7 +4544,7 @@ cursor: pointer;
|
|
|
4544
4544
|
justify-content: center;
|
|
4545
4545
|
border: 2px solid var(--color-background);
|
|
4546
4546
|
box-shadow: 0 1px 3px var(--color-shadow);
|
|
4547
|
-
`;function Hl({className:t,showBadge:r=!0,channels:o=["user"],organizationIds:n,workspaceIds:s}){const[a,h]=i.useState(!1),[f,c]=i.useState(),p=i.useRef(null),d=i.useRef(null),u={channels:o,organization_ids:n,workspace_ids:s,limit:20},{unreadCount:g,notifications:m,loading:v,markAsRead:y,markAllAsRead:S,deleteNotification:E}=pc(u);return i.useEffect(()=>{if(!a)return;const b=setTimeout(()=>{const $=C=>{var j,x;const w=C.target;(j=p.current)!=null&&j.contains(w)||(x=d.current)!=null&&x.contains(w)||h(!1)};return document.addEventListener("mousedown",$),()=>{document.removeEventListener("mousedown",$)}},50);return()=>{clearTimeout(b)}},[a]),i.useEffect(()=>{if(a&&p.current){const b=p.current.getBoundingClientRect(),$=400,C=600,w=window.innerWidth,j=window.innerHeight,x=w-b.left,I=j-b.bottom,k=b.top;let R,_;x>=$?R=b.left:_=w-b.right;let O,P;I>=C+8?O=b.bottom+8:k>=C+8?P=j-b.top+8:O=b.bottom+8,c({top:O,bottom:P,left:R,right:_})}else c(void 0)},[a]),e.jsx(ue,{children:e.jsxs(Wv,{ref:p,className:t,children:[e.jsx(Vv,{children:e.jsxs(Gv,{onClick:()=>h(!a),children:[e.jsx(_p,{size:16}),r&&g>0&&e.jsx(Hv,{children:g>9?"9+":g})]})}),typeof window<"u"&&a&&
|
|
4547
|
+
`;function Hl({className:t,showBadge:r=!0,channels:o=["user"],organizationIds:n,workspaceIds:s}){const[a,h]=i.useState(!1),[f,c]=i.useState(),p=i.useRef(null),d=i.useRef(null),u={channels:o,organization_ids:n,workspace_ids:s,limit:20},{unreadCount:g,notifications:m,loading:v,markAsRead:y,markAllAsRead:S,deleteNotification:E}=pc(u);return i.useEffect(()=>{if(!a)return;const b=setTimeout(()=>{const $=C=>{var j,x;const w=C.target;(j=p.current)!=null&&j.contains(w)||(x=d.current)!=null&&x.contains(w)||h(!1)};return document.addEventListener("mousedown",$),()=>{document.removeEventListener("mousedown",$)}},50);return()=>{clearTimeout(b)}},[a]),i.useEffect(()=>{if(a&&p.current){const b=p.current.getBoundingClientRect(),$=400,C=600,w=window.innerWidth,j=window.innerHeight,x=w-b.left,I=j-b.bottom,k=b.top;let R,_;x>=$?R=b.left:_=w-b.right;let O,P;I>=C+8?O=b.bottom+8:k>=C+8?P=j-b.top+8:O=b.bottom+8,c({top:O,bottom:P,left:R,right:_})}else c(void 0)},[a]),e.jsx(ue,{children:e.jsxs(Wv,{ref:p,className:t,children:[e.jsx(Vv,{children:e.jsxs(Gv,{onClick:()=>h(!a),children:[e.jsx(_p,{size:16}),r&&g>0&&e.jsx(Hv,{children:g>9?"9+":g})]})}),typeof window<"u"&&a&&Fr.createPortal(e.jsx(ue,{children:e.jsx(Gl,{ref:d,position:f,notifications:m,loading:v,onMarkAsRead:y,onMarkAllAsRead:S,onDelete:E})}),document.body)]})})}const qv=l.div`
|
|
4548
4548
|
display: flex;
|
|
4549
4549
|
align-items: center;
|
|
4550
4550
|
gap: 8px;
|
|
@@ -4777,7 +4777,7 @@ cursor: pointer;
|
|
|
4777
4777
|
&:hover {
|
|
4778
4778
|
color: var(--color-primary-hover);
|
|
4779
4779
|
}
|
|
4780
|
-
`,d1=({onAccountSelect:t,showAddAccount:r=!0})=>{var C,w,j,x,I;const{session:o,loading:n,switchSignIn:s,signOut:a}=Be(),{deployment:h}=ve(),{navigateToSignIn:f,navigate:c}=Ve(),[p,d]=i.useState(null),[u,g]=i.useState(null),m=o==null?void 0:o.active_signin,v=(o==null?void 0:o.signins)||[],y=((w=(C=h==null?void 0:h.auth_settings)==null?void 0:C.multi_session_support)==null?void 0:w.enabled)??!1;i.useEffect(()=>{n||v.length||f()},[n,v,f]);const S=k=>k.split(" ").map(R=>R[0]).join("").toUpperCase().slice(0,2),E=async k=>{var R;if(!(k===(m==null?void 0:m.id)||u)){g(k);try{if(await s(k),t)t(k),g(null);else{let _=new URLSearchParams(window.location.search).get("redirect_uri");if(_||(_=(R=h.ui_settings)==null?void 0:R.after_signin_redirect_url),_){const O=new URL(_);(h==null?void 0:h.mode)==="staging"&&O.searchParams.set("dev_session",localStorage.getItem("__dev_session__")??""),c(O.toString())}else g(null)}}catch(_){console.error("Failed to switch account:",_),g(null)}}},b=async(k,R)=>{k.stopPropagation(),d(R);try{await a(R)}catch(_){console.error("Failed to sign out:",_)}finally{d(null)}},$=()=>{var R;let k=new URLSearchParams(window.location.search).get("redirect_uri");k||(k=(R=h.ui_settings)==null?void 0:R.after_signin_redirect_url),f(k)};return n?e.jsx(ue,{children:e.jsxs(_i,{children:[e.jsx(Re,{}),e.jsxs(Si,{children:[e.jsx($i,{children:"Choose an account"}),e.jsxs(zi,{children:["to continue to ",((j=h==null?void 0:h.ui_settings)==null?void 0:j.app_name)||"App"]})]}),e.jsx(Ci,{children:[1,2].map(k=>e.jsxs(a1,{children:[e.jsx(s1,{}),e.jsxs(i1,{children:[e.jsx(Ei,{}),e.jsx(Ei,{$width:"small"})]})]},k))})]})}):v.length?e.jsx(ue,{children:e.jsxs(_i,{children:[e.jsx(Re,{}),e.jsxs(Si,{children:[e.jsx($i,{children:"Choose an account"}),e.jsxs(zi,{children:["to continue to ",(x=h==null?void 0:h.ui_settings)==null?void 0:x.app_name]})]}),e.jsxs(Ci,{children:[v.map(({user:k,id:R})=>{var z,T,M,
|
|
4780
|
+
`,d1=({onAccountSelect:t,showAddAccount:r=!0})=>{var C,w,j,x,I;const{session:o,loading:n,switchSignIn:s,signOut:a}=Be(),{deployment:h}=ve(),{navigateToSignIn:f,navigate:c}=Ve(),[p,d]=i.useState(null),[u,g]=i.useState(null),m=o==null?void 0:o.active_signin,v=(o==null?void 0:o.signins)||[],y=((w=(C=h==null?void 0:h.auth_settings)==null?void 0:C.multi_session_support)==null?void 0:w.enabled)??!1;i.useEffect(()=>{n||v.length||f()},[n,v,f]);const S=k=>k.split(" ").map(R=>R[0]).join("").toUpperCase().slice(0,2),E=async k=>{var R;if(!(k===(m==null?void 0:m.id)||u)){g(k);try{if(await s(k),t)t(k),g(null);else{let _=new URLSearchParams(window.location.search).get("redirect_uri");if(_||(_=(R=h.ui_settings)==null?void 0:R.after_signin_redirect_url),_){const O=new URL(_);(h==null?void 0:h.mode)==="staging"&&O.searchParams.set("dev_session",localStorage.getItem("__dev_session__")??""),c(O.toString())}else g(null)}}catch(_){console.error("Failed to switch account:",_),g(null)}}},b=async(k,R)=>{k.stopPropagation(),d(R);try{await a(R)}catch(_){console.error("Failed to sign out:",_)}finally{d(null)}},$=()=>{var R;let k=new URLSearchParams(window.location.search).get("redirect_uri");k||(k=(R=h.ui_settings)==null?void 0:R.after_signin_redirect_url),f(k)};return n?e.jsx(ue,{children:e.jsxs(_i,{children:[e.jsx(Re,{}),e.jsxs(Si,{children:[e.jsx($i,{children:"Choose an account"}),e.jsxs(zi,{children:["to continue to ",((j=h==null?void 0:h.ui_settings)==null?void 0:j.app_name)||"App"]})]}),e.jsx(Ci,{children:[1,2].map(k=>e.jsxs(a1,{children:[e.jsx(s1,{}),e.jsxs(i1,{children:[e.jsx(Ei,{}),e.jsx(Ei,{$width:"small"})]})]},k))})]})}):v.length?e.jsx(ue,{children:e.jsxs(_i,{children:[e.jsx(Re,{}),e.jsxs(Si,{children:[e.jsx($i,{children:"Choose an account"}),e.jsxs(zi,{children:["to continue to ",(x=h==null?void 0:h.ui_settings)==null?void 0:x.app_name]})]}),e.jsxs(Ci,{children:[v.map(({user:k,id:R})=>{var z,T,M,N,H;if(!k)return null;const _=R===(m==null?void 0:m.id),O=u===R,P=`${k.first_name||""} ${k.last_name||""}`.trim();return e.jsxs(Xv,{$isActive:_,$isSwitching:O,onClick:()=>E(R),children:[e.jsx(Jv,{children:k.has_profile_picture?e.jsx("img",{src:k.profile_picture_url,alt:P}):S(P||((z=k.primary_email_address)==null?void 0:z.email)||((T=k.primary_phone_number)==null?void 0:T.phone_number)||k.username||"U")}),e.jsxs(e1,{children:[e.jsx(t1,{children:P||((M=k.primary_email_address)==null?void 0:M.email)||((N=k.primary_phone_number)==null?void 0:N.phone_number)||k.username||"User"}),e.jsx(r1,{children:((H=k.primary_email_address)==null?void 0:H.email)||k.username})]}),!O&&e.jsxs(o1,{onClick:L=>b(L,R),$isLoading:p===R,disabled:p===R,children:[p===R?e.jsx(vt,{size:12}):e.jsx(Et,{size:12}),p===R?"Signing out...":"Sign out"]})]},R)}),r&&y&&e.jsxs(n1,{onClick:$,children:[e.jsx(Ke,{}),"Add another account"]})]}),e.jsxs(c1,{children:["Don't have an account?"," ",e.jsx(l1,{children:e.jsx(ot,{to:`${(I=h.ui_settings)==null?void 0:I.sign_up_page_url}${window.location.search}`,children:"Sign up"})})]})]})}):null},u1=()=>{const{navigateToSignIn:t}=Ve();return i.useEffect(()=>{t()},[t]),null},p1=()=>{const{navigateToSignUp:t}=Ve();return i.useEffect(()=>{t()},[t]),null},h1=l.div`
|
|
4781
4781
|
width: 100%;
|
|
4782
4782
|
height: 500px;
|
|
4783
4783
|
background: var(--color-background);
|
|
@@ -4970,12 +4970,12 @@ cursor: pointer;
|
|
|
4970
4970
|
align-items: center;
|
|
4971
4971
|
justify-content: center;
|
|
4972
4972
|
color: var(--color-secondary-text);
|
|
4973
|
-
`,
|
|
4973
|
+
`,Ni=l.div`
|
|
4974
4974
|
font-size: 14px;
|
|
4975
4975
|
font-weight: 400;
|
|
4976
4976
|
color: var(--color-foreground);
|
|
4977
4977
|
margin-bottom: 4px;
|
|
4978
|
-
`,
|
|
4978
|
+
`,Fi=l.div`
|
|
4979
4979
|
font-size: 13px;
|
|
4980
4980
|
color: var(--color-secondary-text);
|
|
4981
4981
|
margin-bottom: 16px;
|
|
@@ -4985,7 +4985,7 @@ cursor: pointer;
|
|
|
4985
4985
|
margin: 0 auto;
|
|
4986
4986
|
padding: 6px 16px;
|
|
4987
4987
|
font-size: 13px;
|
|
4988
|
-
`,_1=()=>{var _,O;const{organizationMemberships:t,refetch:r,loading:o}=bt(),{workspaces:n}=yt(),{switchOrganization:s,switchWorkspace:a}=Be(),{deployment:h}=ve(),[f,c]=i.useState(null),[p,d]=i.useState("orgList"),[u,g]=i.useState(null),m=(h==null?void 0:h.b2b_settings.workspaces_enabled)??!1,v=(h==null?void 0:h.b2b_settings.allow_users_to_create_orgs)??!1,y=i.useRef(!1);i.useEffect(()=>{if(!(y.current||!t)){if(y.current=!0,t.length===0){d("createOrg");return}if(!m){d("orgList");return}if(!n||n.length===0){t[0]&&g(t[0].organization.id),d("createWorkspace");return}d("orgList")}},[t,n,m]),console.log("view mode",p,m);const S=P=>P.split(" ").map(z=>z[0]).join("").toUpperCase().slice(0,2),E=async P=>{if(m){g(P.id),d("workspaceList");return}c(P.id);try{await s(P.id)}finally{c(null)}},b=async P=>{c(P.id);try{await a(P.id)}finally{c(null)}},$=async P=>{await r(),m&&P&&(g(P.id),d("createWorkspace"))},C=()=>{},w=async()=>{g(null),d("orgList")},j=(_=t==null?void 0:t.find(P=>P.organization.id===u))==null?void 0:_.organization,x=u?n==null?void 0:n.filter(P=>P.organization.id===u):[];if(o)return null;if(p==="createOrg")return e.jsx(_e.Body,{style:{padding:0},children:e.jsx(nn,{onSuccess:$,onCancel:()=>d("orgList")})});if(p==="createWorkspace"&&u)return e.jsx(_e.Body,{style:{padding:0},children:e.jsx($a,{organizationId:u,onSuccess:C,onCancel:()=>d("workspaceList"),onCreateOrganization:()=>d("createOrg")})});const I=p==="workspaceList",k=I?"Select a workspace":"Select an organization",R=I?`Choose a workspace in ${(j==null?void 0:j.name)||""}`:`to continue to ${((O=h==null?void 0:h.ui_settings)==null?void 0:O.app_name)||"App"}`;return e.jsxs(h1,{children:[e.jsxs(f1,{children:[e.jsxs("div",{children:[e.jsx(Re,{}),e.jsxs(y1,{children:[e.jsx(w1,{children:k}),e.jsx(j1,{children:R})]})]}),e.jsx(Pa,{showName:!0})]}),e.jsxs(g1,{children:[e.jsxs(m1,{children:[e.jsxs(x1,{children:[e.jsx(v1,{children:I?"Workspaces":"Your organizations"}),I&&e.jsxs(b1,{onClick:w,children:[e.jsx(Ur,{}),"Go back"]})]}),e.jsx(k1,{children:I?e.jsx(e.Fragment,{children:x&&x.length>0?x.map(P=>{var T,M,
|
|
4988
|
+
`,_1=()=>{var _,O;const{organizationMemberships:t,refetch:r,loading:o}=bt(),{workspaces:n}=yt(),{switchOrganization:s,switchWorkspace:a}=Be(),{deployment:h}=ve(),[f,c]=i.useState(null),[p,d]=i.useState("orgList"),[u,g]=i.useState(null),m=(h==null?void 0:h.b2b_settings.workspaces_enabled)??!1,v=(h==null?void 0:h.b2b_settings.allow_users_to_create_orgs)??!1,y=i.useRef(!1);i.useEffect(()=>{if(!(y.current||!t)){if(y.current=!0,t.length===0){d("createOrg");return}if(!m){d("orgList");return}if(!n||n.length===0){t[0]&&g(t[0].organization.id),d("createWorkspace");return}d("orgList")}},[t,n,m]),console.log("view mode",p,m);const S=P=>P.split(" ").map(z=>z[0]).join("").toUpperCase().slice(0,2),E=async P=>{if(m){g(P.id),d("workspaceList");return}c(P.id);try{await s(P.id)}finally{c(null)}},b=async P=>{c(P.id);try{await a(P.id)}finally{c(null)}},$=async P=>{await r(),m&&P&&(g(P.id),d("createWorkspace"))},C=()=>{},w=async()=>{g(null),d("orgList")},j=(_=t==null?void 0:t.find(P=>P.organization.id===u))==null?void 0:_.organization,x=u?n==null?void 0:n.filter(P=>P.organization.id===u):[];if(o)return null;if(p==="createOrg")return e.jsx(_e.Body,{style:{padding:0},children:e.jsx(nn,{onSuccess:$,onCancel:()=>d("orgList")})});if(p==="createWorkspace"&&u)return e.jsx(_e.Body,{style:{padding:0},children:e.jsx($a,{organizationId:u,onSuccess:C,onCancel:()=>d("workspaceList"),onCreateOrganization:()=>d("createOrg")})});const I=p==="workspaceList",k=I?"Select a workspace":"Select an organization",R=I?`Choose a workspace in ${(j==null?void 0:j.name)||""}`:`to continue to ${((O=h==null?void 0:h.ui_settings)==null?void 0:O.app_name)||"App"}`;return e.jsxs(h1,{children:[e.jsxs(f1,{children:[e.jsxs("div",{children:[e.jsx(Re,{}),e.jsxs(y1,{children:[e.jsx(w1,{children:k}),e.jsx(j1,{children:R})]})]}),e.jsx(Pa,{showName:!0})]}),e.jsxs(g1,{children:[e.jsxs(m1,{children:[e.jsxs(x1,{children:[e.jsx(v1,{children:I?"Workspaces":"Your organizations"}),I&&e.jsxs(b1,{onClick:w,children:[e.jsx(Ur,{}),"Go back"]})]}),e.jsx(k1,{children:I?e.jsx(e.Fragment,{children:x&&x.length>0?x.map(P=>{var T,M,N;const z=((T=P.eligibility_restriction)==null?void 0:T.type)!=="none"&&((M=P.eligibility_restriction)==null?void 0:M.type)!==void 0;return e.jsxs(Pi,{onClick:()=>!z&&b(P),disabled:f===P.id||z,style:{opacity:z?.7:1},children:[e.jsx(Ri,{children:P.image_url?e.jsx(Ii,{src:P.image_url,alt:P.name}):S(P.name).charAt(0)}),e.jsxs(Ti,{children:[e.jsx(Oi,{children:P.name}),e.jsxs(Mi,{children:[e.jsx(Bo,{}),"Workspace"]})]}),e.jsx(Li,{children:e.jsx(fa,{})}),z&&e.jsxs(Ai,{children:[e.jsx(dt,{size:14}),(N=P.eligibility_restriction)==null?void 0:N.message]})]},P.id)}):e.jsxs(Di,{children:[e.jsx(Ni,{children:"No workspaces yet"}),e.jsxs(Fi,{children:["Create your first workspace for"," ",(j==null?void 0:j.name)||"this organization"]}),e.jsxs(Bi,{onClick:()=>d("createWorkspace"),children:[e.jsx(Ke,{}),"Create workspace"]})]})}):t&&t.length>0?t.map(P=>{var te,U,K;const z=P.organization,T=n==null?void 0:n.filter(ee=>ee.organization.id===z.id),M=(T==null?void 0:T.length)||0,N=z.member_count,H=P.roles[0].name,L=P.roles.length-1,A=L>0?`${H.charAt(0).toUpperCase()+H.slice(1)} +${L}`:H.charAt(0).toUpperCase()+H.slice(1),se=((te=P.eligibility_restriction)==null?void 0:te.type)!=="none"&&((U=P.eligibility_restriction)==null?void 0:U.type)!==void 0;return e.jsxs(Pi,{onClick:()=>!se&&E(z),disabled:f===z.id||se,style:{opacity:se?.7:1},children:[e.jsx(Ri,{children:z.image_url?e.jsx(Ii,{src:z.image_url,alt:z.name}):S(z.name)}),e.jsxs(Ti,{children:[e.jsx(Oi,{children:z.name}),e.jsx(Mi,{children:m?e.jsxs(e.Fragment,{children:[e.jsx(Bo,{}),M," workspace",M!==1?"s":""]}):e.jsxs(e.Fragment,{children:[e.jsx($p,{}),A," • ",N," member",N!==1?"s":""]})})]}),e.jsx(Li,{children:e.jsx(fa,{})}),se&&e.jsxs(Ai,{children:[e.jsx(dt,{size:14}),(K=P.eligibility_restriction)==null?void 0:K.message]})]},z.id)}):e.jsxs(Di,{children:[e.jsx(Ni,{children:"No organizations yet"}),e.jsx(Fi,{children:v?"Create your first organization to get started":"You don't have access to any organizations yet"}),v&&e.jsxs(Bi,{onClick:()=>d("createOrg"),children:[e.jsx(Ke,{}),"Create organization"]})]})})]}),I&&x&&x.length>0&&e.jsxs(X,{style:{marginTop:"var(--space-md)"},onClick:()=>d("createWorkspace"),disabled:f!==null,children:[e.jsx(Ke,{size:12}),"Create new workspace"]}),!I&&t&&t.length>0&&v&&e.jsxs(X,{style:{marginTop:"var(--space-md)"},onClick:()=>d("createOrg"),disabled:f!==null,children:[e.jsx(Ke,{size:12}),"Create new organization"]})]})]})},C1=l(_e.Content)`
|
|
4989
4989
|
padding: 0;
|
|
4990
4990
|
max-width: 90vw;
|
|
4991
4991
|
`,S1=({children:t})=>{var y,S,E,b;const{loading:r,session:o}=Be(),{activeOrganization:n}=qe(),{activeWorkspace:s,loading:a}=Rt(),{workspaces:h}=yt(),{deployment:f}=ve(),{organizationMemberships:c}=bt(),p=(f==null?void 0:f.b2b_settings.workspaces_enabled)??!1,d=c==null?void 0:c.find($=>$.organization.id===(n==null?void 0:n.id)),u=h==null?void 0:h.find($=>{var C;return $.id===((C=o==null?void 0:o.active_signin)==null?void 0:C.active_workspace_membership_id)}),g=((y=d==null?void 0:d.eligibility_restriction)==null?void 0:y.type)!=="none"&&((S=d==null?void 0:d.eligibility_restriction)==null?void 0:S.type)!==void 0,m=((E=u==null?void 0:u.eligibility_restriction)==null?void 0:E.type)!=="none"&&((b=u==null?void 0:u.eligibility_restriction)==null?void 0:b.type)!==void 0;return r||p&&a?null:(g||m||!n?!1:p?s?h==null?void 0:h.some(C=>C.id===s.id&&C.organization.id===n.id):!1:!0)?(console.log("valid"),e.jsx(e.Fragment,{children:t})):e.jsx(ue,{children:e.jsx(_e,{isOpen:!0,children:e.jsx(_e.Overlay,{children:e.jsx(C1,{style:{width:"850px"},children:e.jsx(_1,{})})})})})},$1=l.div`
|
|
@@ -5081,13 +5081,13 @@ cursor: pointer;
|
|
|
5081
5081
|
50% { opacity: 0.5; }
|
|
5082
5082
|
}
|
|
5083
5083
|
`}
|
|
5084
|
-
`,
|
|
5084
|
+
`,N1=l.h3`
|
|
5085
5085
|
margin: 0;
|
|
5086
5086
|
font-size: 14px;
|
|
5087
5087
|
font-weight: 400;
|
|
5088
5088
|
color: var(--color-foreground);
|
|
5089
5089
|
letter-spacing: -0.01em;
|
|
5090
|
-
`,
|
|
5090
|
+
`,F1=l.p`
|
|
5091
5091
|
margin: 0;
|
|
5092
5092
|
font-size: 11px;
|
|
5093
5093
|
color: ${t=>t.$status==="Connecting..."?"var(--color-warning)":t.$status==="Connection error"||t.$status==="Disconnected"?"var(--color-error)":t.$status==="Waiting for your input..."?"var(--color-info)":t.$status==="Working..."?"var(--color-primary)":t.$status==="Ready"?"var(--color-success)":"var(--color-secondary-text)"};
|
|
@@ -5670,7 +5670,7 @@ cursor: pointer;
|
|
|
5670
5670
|
&:hover .expand-icon {
|
|
5671
5671
|
opacity: 1;
|
|
5672
5672
|
}
|
|
5673
|
-
`,u2=({isOpen:t,imageUrl:r,zoomLevel:o,dragPosition:n,isDragging:s,onClose:a,onDownload:h,onZoom:f,onReset:c,onWheel:p,onMouseDown:d,onMouseMove:u,onMouseUp:g})=>{const[m,v]=i.useState(!1),y=i.useRef(null);return i.useEffect(()=>(v(!0),()=>v(!1)),[]),i.useEffect(()=>{if(t){const S=document.body.style.overflow;document.body.style.overflow="hidden";const E=C=>{(C.ctrlKey||C.metaKey)&&C.preventDefault()},b=C=>{C.preventDefault()},$=C=>{C.preventDefault()};return document.addEventListener("wheel",E,{passive:!1}),document.addEventListener("gesturestart",b,{passive:!1}),document.addEventListener("gesturechange",$,{passive:!1}),()=>{document.body.style.overflow=S,document.removeEventListener("wheel",E),document.removeEventListener("gesturestart",b),document.removeEventListener("gesturechange",$)}}},[t]),!m||!t||!r?null:Nr.createPortal(e.jsx(ue,{children:e.jsx(n2,{ref:y,$isOpen:!0,onClick:S=>{S.target===S.currentTarget&&a()},children:e.jsxs(a2,{onClick:S=>S.stopPropagation(),onWheel:S=>{S.preventDefault(),S.stopPropagation(),p(S)},onMouseMove:u,onMouseUp:g,onMouseLeave:g,children:[e.jsx(s2,{src:r,alt:"Preview",$zoom:o,$x:n.x,$y:n.y,$isDragging:s,onMouseDown:d,draggable:!1}),e.jsx($o,{$variant:"ghost",onClick:a,title:"Close",style:{position:"absolute",top:"16px",right:"16px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:e.jsx(Ze,{size:14})}),e.jsxs(i2,{children:[e.jsxs(c2,{children:[e.jsx($o,{$variant:"ghost",onClick:()=>f(-.25),title:"Zoom out",disabled:o<=.5,children:e.jsx(vh,{size:14})}),e.jsxs(l2,{children:[Math.round(o*100),"%"]}),e.jsx($o,{$variant:"ghost",onClick:()=>f(.25),title:"Zoom in",disabled:o>=3,children:e.jsx(mh,{size:14})}),e.jsx($o,{$variant:"ghost",onClick:c,title:"Reset zoom",children:e.jsx(Kp,{size:14})})]}),e.jsxs(Zl,{$variant:"primary",onClick:h,title:"Download image",children:[e.jsx(tn,{size:14}),"Download"]})]})]})})}),document.body)};function Ql({showBackButton:t=!1,onBack:r}){const{agentName:o,token:n,platformAdapter:s,selectedSession:a,selectSession:h}=Ho(),f=a==null?void 0:a.id;if(!f)return e.jsx(ue,{style:{height:"100%",width:"100%"},children:e.jsx(Ui,{children:e.jsxs(Wi,{children:[e.jsx(bn,{size:48,strokeWidth:1.5}),e.jsx("p",{children:"No conversation selected"})]})})});const c=!0,p=!0,d="Start a conversation by typing a message below",[u,g]=i.useState(""),[m,v]=i.useState(!1),[y,S]=i.useState(null),[E,b]=i.useState([]),[$,C]=i.useState([]),[w,j]=i.useState(null),[x,I]=i.useState(1),[k,R]=i.useState(!1),[_,O]=i.useState({x:0,y:0}),[P,z]=i.useState({x:0,y:0}),T=i.useRef(null),M=i.useRef(null),{messages:F,pendingMessage:G,pendingImages:L,connectionState:A,isConnected:se,isExecuting:te,executionStatus:U,isWaitingForInput:K,sendMessage:ee,submitUserInput:J,cancelExecution:ie}=hc({contextId:f,agentName:o,token:n,platformAdapter:s,autoConnect:c});i.useEffect(()=>{var N;(N=T.current)==null||N.scrollIntoView({behavior:"smooth"})},[F]),i.useEffect(()=>{var N;if(K){const W=F.slice().reverse().find(fe=>{var ye;return((ye=fe.metadata)==null?void 0:ye.type)==="user_input_request"});(N=W==null?void 0:W.metadata)!=null&&N.userInputRequest&&S(W.metadata.userInputRequest)}else S(null),b([])},[K,F]);const oe=N=>{if(N.preventDefault(),!!se)if(K&&y){let W=u.trim();y.input_type==="multiselect"&&(W=E.join(",")),W&&(J(W),g(""),b([]))}else!te&&u.trim()&&(ee(u,$.length>0?$:void 0),g(""),C([]))},de=N=>{const W=N.target.files;W&&(Array.from(W).forEach(fe=>{if(fe.type.startsWith("image/")){const ye=new FileReader;ye.onload=re=>{var je;if((je=re.target)!=null&&je.result){const Se=re.target.result.split(",")[1];C(Me=>[...Me,{mime_type:fe.type,data:Se}])}},ye.readAsDataURL(fe)}}),M.current&&(M.current.value=""))},Q=N=>{C(W=>W.filter((fe,ye)=>ye!==N))},ce=N=>{j(N),I(1),O({x:0,y:0})},B=()=>{j(null),I(1),O({x:0,y:0}),R(!1)},V=N=>{const W=document.createElement("a");W.href=N,W.download=`image-${Date.now()}.png`,document.body.appendChild(W),W.click(),document.body.removeChild(W)},D=N=>{I(W=>{const fe=W+N;return Math.min(Math.max(fe,.5),3)})},le=N=>{N.preventDefault(),N.stopPropagation();const W=N.deltaY>0?-.1:.1;D(W)},H=N=>{x>1&&(R(!0),z({x:N.clientX-_.x,y:N.clientY-_.y}))},ae=N=>{k&&x>1&&O({x:N.clientX-P.x,y:N.clientY-P.y})},ke=()=>{R(!1)},ne=()=>A.status===mt.CONNECTING?"Connecting...":A.status===mt.ERROR?"Connection error":A.status===mt.DISCONNECTED||!se?"Disconnected":K?"Waiting for your input...":te?"Working...":"Ready",Y=()=>{if(!K||!y)return"Ask anything";switch(y.input_type){case"select":case"boolean":case"date":return"Use controls above to make selection";case"multiselect":return"Select options above";default:return"Enter your response..."}},Z=()=>!K||!y?!1:["select","multiselect","boolean","date"].includes(y.input_type||"");return e.jsxs(ue,{style:{height:"100%",width:"100%"},children:[e.jsxs(Ui,{children:[e.jsxs(I1,{children:[e.jsxs(T1,{children:[t&&e.jsx(O1,{onClick:()=>{r?r():h(null)},children:e.jsx(Ur,{size:20})}),e.jsxs(M1,{children:[e.jsx(L1,{children:e.jsx(bn,{size:20})}),e.jsxs(A1,{children:[e.jsx(F1,{children:o}),e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[e.jsx(D1,{$status:ne()}),e.jsx(N1,{$status:ne(),children:ne()})]})]})]})]}),U!==Ae.IDLE&&e.jsx(B1,{$status:U,children:U.replace("_"," ")})]}),e.jsx(U1,{children:F.length===0&&p?e.jsxs(Wi,{children:[e.jsx(bn,{size:48,strokeWidth:1.5}),e.jsx("p",{children:d})]}):e.jsxs(e.Fragment,{children:[F.map((N,W)=>{var fe,ye,re,je;if(((fe=N.metadata)==null?void 0:fe.type)==="user_input_request"&&N.metadata.userInputRequest){const me=N.metadata.userInputRequest,Se=!me.input_type||me.input_type==="text"||me.input_type==="number",Me=K&&(y==null?void 0:y.input_type)===me.input_type;return e.jsx(qn,{$isUser:!1,children:e.jsxs(H1,{children:[e.jsx("div",{className:"question",children:me.question}),me.context&&me.context.trim()&&e.jsx("div",{className:"context",children:me.context}),!Se&&e.jsxs("div",{className:"controls",children:[me.input_type==="select"&&me.options&&e.jsxs("select",{value:Me?u:"",onChange:Ie=>g(Ie.target.value),disabled:!Me,children:[e.jsx("option",{value:"",children:"Choose an option..."}),me.options.map(Ie=>e.jsx("option",{value:Ie,children:Ie},Ie))]}),me.input_type==="multiselect"&&me.options&&e.jsx("div",{className:"checkbox-group",children:me.options.map(Ie=>e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:Me&&E.includes(Ie),onChange:nr=>{nr.target.checked?b([...E,Ie]):b(E.filter(ar=>ar!==Ie))},disabled:!Me}),e.jsx("span",{children:Ie})]},Ie))}),me.input_type==="boolean"&&e.jsxs("div",{className:"radio-group",children:[e.jsxs("label",{className:"radio-label",children:[e.jsx("input",{type:"radio",name:"boolean",value:"true",checked:Me&&u==="true",onChange:Ie=>g(Ie.target.value),disabled:!Me}),e.jsx("span",{children:"Yes"})]}),e.jsxs("label",{className:"radio-label",children:[e.jsx("input",{type:"radio",name:"boolean",value:"false",checked:Me&&u==="false",onChange:Ie=>g(Ie.target.value),disabled:!Me}),e.jsx("span",{children:"No"})]})]}),me.input_type==="date"&&e.jsx("input",{type:"date",value:Me?u:"",onChange:Ie=>g(Ie.target.value),disabled:!Me})]}),e.jsx("div",{className:"instruction",children:Me?Se?"Type your response below":me.input_type==="multiselect"?"Select options above and click send":"Make your selection above and click send":""})]})},N.id)}if(((ye=N.metadata)==null?void 0:ye.type)==="log"){const me=F[W-1],Se=F[W+1],Me=((re=me==null?void 0:me.metadata)==null?void 0:re.type)==="log",Ie=((je=Se==null?void 0:Se.metadata)==null?void 0:je.type)==="log",nr=Me||Ie,ar=!Me&&Ie,qr=Me&&!Ie;return e.jsx(G1,{$isGrouped:nr,$isFirstInGroup:ar,$isLastInGroup:qr,children:e.jsx("div",{className:"log-content",children:N.content})},N.id)}return!N.content&&(!N.images||N.images.length===0)?null:e.jsx(qn,{$isUser:N.role==="user",children:e.jsxs(Yl,{$isUser:N.role==="user",children:[e.jsx("div",{children:N.content}),N.images&&N.images.length>0&&e.jsx("div",{style:{display:"flex",gap:"8px",marginTop:"8px",flexWrap:"wrap"},children:N.images.map((me,Se)=>{const Me=me.url||`data:${me.mime_type};base64,${me.data}`;return e.jsxs(d2,{onClick:()=>ce(Me),title:"Click to preview",children:[e.jsx("img",{src:Me,alt:`Image ${Se+1}`,loading:"lazy"}),e.jsx("div",{className:"expand-icon",children:e.jsx(Fp,{size:14})})]},Se)})}),N.isStreaming&&e.jsx(W1,{})]})},N.id)}),G&&e.jsx(qn,{$isUser:!0,children:e.jsxs(V1,{$isUser:!0,children:[e.jsx("div",{children:G}),L&&L.length>0&&e.jsx("div",{style:{display:"flex",gap:"8px",marginTop:"8px",flexWrap:"wrap"},children:L.map((N,W)=>e.jsx("div",{style:{width:"200px",height:"200px",borderRadius:"8px",border:"1px solid var(--color-border)",overflow:"hidden",backgroundColor:"var(--color-background-subtle)",position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("img",{src:N.data?`data:${N.mime_type};base64,${N.data}`:"#",alt:`Image ${W+1}`,style:{maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",objectFit:"contain"},loading:"lazy"})},W))})]})}),e.jsx("div",{ref:T})]})}),$.length>0&&e.jsx(X1,{children:$.map((N,W)=>e.jsxs(J1,{children:[e.jsx("img",{src:N.data?`data:${N.mime_type};base64,${N.data}`:"#",alt:`Upload ${W+1}`}),e.jsx(e2,{type:"button",onClick:()=>Q(W),children:e.jsx(Ze,{size:12})})]},W))}),e.jsx(q1,{onSubmit:oe,children:e.jsxs(Y1,{children:[e.jsxs(Z1,{children:[e.jsx(Q1,{value:u,onChange:N=>g(N.target.value),onKeyDown:N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),oe(N))},placeholder:Y(),disabled:!se||te&&!K||Z(),rows:1}),e.jsx(K1,{children:e.jsxs(r2,{type:"button",disabled:!se||te,onClick:()=>{var N;return(N=M.current)==null?void 0:N.click()},children:[e.jsx(eh,{size:16}),"Attach"]})}),e.jsx(t2,{ref:M,type:"file",accept:"image/*",multiple:!0,onChange:de})]}),e.jsx(o2,{type:te?"button":"submit",disabled:!se||!K&&!te&&!u.trim(),onClick:te?ie:void 0,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),style:{background:te&&m?"var(--color-error)":void 0},children:te?m?e.jsx(Ze,{size:14}):e.jsx(vt,{size:14,className:"animate-spin"}):e.jsx(Wc,{size:14})})]})})]}),e.jsx(u2,{isOpen:!!w,imageUrl:w,zoomLevel:x,dragPosition:_,isDragging:k,onClose:B,onDownload:()=>w&&V(w),onZoom:D,onReset:()=>{I(1),O({x:0,y:0})},onWheel:le,onMouseDown:H,onMouseMove:ae,onMouseUp:ke})]})}const p2=l.div`
|
|
5673
|
+
`,u2=({isOpen:t,imageUrl:r,zoomLevel:o,dragPosition:n,isDragging:s,onClose:a,onDownload:h,onZoom:f,onReset:c,onWheel:p,onMouseDown:d,onMouseMove:u,onMouseUp:g})=>{const[m,v]=i.useState(!1),y=i.useRef(null);return i.useEffect(()=>(v(!0),()=>v(!1)),[]),i.useEffect(()=>{if(t){const S=document.body.style.overflow;document.body.style.overflow="hidden";const E=C=>{(C.ctrlKey||C.metaKey)&&C.preventDefault()},b=C=>{C.preventDefault()},$=C=>{C.preventDefault()};return document.addEventListener("wheel",E,{passive:!1}),document.addEventListener("gesturestart",b,{passive:!1}),document.addEventListener("gesturechange",$,{passive:!1}),()=>{document.body.style.overflow=S,document.removeEventListener("wheel",E),document.removeEventListener("gesturestart",b),document.removeEventListener("gesturechange",$)}}},[t]),!m||!t||!r?null:Fr.createPortal(e.jsx(ue,{children:e.jsx(n2,{ref:y,$isOpen:!0,onClick:S=>{S.target===S.currentTarget&&a()},children:e.jsxs(a2,{onClick:S=>S.stopPropagation(),onWheel:S=>{S.preventDefault(),S.stopPropagation(),p(S)},onMouseMove:u,onMouseUp:g,onMouseLeave:g,children:[e.jsx(s2,{src:r,alt:"Preview",$zoom:o,$x:n.x,$y:n.y,$isDragging:s,onMouseDown:d,draggable:!1}),e.jsx($o,{$variant:"ghost",onClick:a,title:"Close",style:{position:"absolute",top:"16px",right:"16px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:e.jsx(Ze,{size:14})}),e.jsxs(i2,{children:[e.jsxs(c2,{children:[e.jsx($o,{$variant:"ghost",onClick:()=>f(-.25),title:"Zoom out",disabled:o<=.5,children:e.jsx(vh,{size:14})}),e.jsxs(l2,{children:[Math.round(o*100),"%"]}),e.jsx($o,{$variant:"ghost",onClick:()=>f(.25),title:"Zoom in",disabled:o>=3,children:e.jsx(mh,{size:14})}),e.jsx($o,{$variant:"ghost",onClick:c,title:"Reset zoom",children:e.jsx(Kp,{size:14})})]}),e.jsxs(Zl,{$variant:"primary",onClick:h,title:"Download image",children:[e.jsx(tn,{size:14}),"Download"]})]})]})})}),document.body)};function Ql({showBackButton:t=!1,onBack:r}){const{agentName:o,token:n,platformAdapter:s,selectedSession:a,selectSession:h}=Ho(),f=a==null?void 0:a.id;if(!f)return e.jsx(ue,{style:{height:"100%",width:"100%"},children:e.jsx(Ui,{children:e.jsxs(Wi,{children:[e.jsx(bn,{size:48,strokeWidth:1.5}),e.jsx("p",{children:"No conversation selected"})]})})});const c=!0,p=!0,d="Start a conversation by typing a message below",[u,g]=i.useState(""),[m,v]=i.useState(!1),[y,S]=i.useState(null),[E,b]=i.useState([]),[$,C]=i.useState([]),[w,j]=i.useState(null),[x,I]=i.useState(1),[k,R]=i.useState(!1),[_,O]=i.useState({x:0,y:0}),[P,z]=i.useState({x:0,y:0}),T=i.useRef(null),M=i.useRef(null),{messages:N,pendingMessage:H,pendingImages:L,connectionState:A,isConnected:se,isExecuting:te,executionStatus:U,isWaitingForInput:K,sendMessage:ee,submitUserInput:J,cancelExecution:ie}=hc({contextId:f,agentName:o,token:n,platformAdapter:s,autoConnect:c});i.useEffect(()=>{var F;(F=T.current)==null||F.scrollIntoView({behavior:"smooth"})},[N]),i.useEffect(()=>{var F;if(K){const W=N.slice().reverse().find(fe=>{var ye;return((ye=fe.metadata)==null?void 0:ye.type)==="user_input_request"});(F=W==null?void 0:W.metadata)!=null&&F.userInputRequest&&S(W.metadata.userInputRequest)}else S(null),b([])},[K,N]);const oe=F=>{if(F.preventDefault(),!!se)if(K&&y){let W=u.trim();y.input_type==="multiselect"&&(W=E.join(",")),W&&(J(W),g(""),b([]))}else!te&&u.trim()&&(ee(u,$.length>0?$:void 0),g(""),C([]))},de=F=>{const W=F.target.files;W&&(Array.from(W).forEach(fe=>{if(fe.type.startsWith("image/")){const ye=new FileReader;ye.onload=re=>{var je;if((je=re.target)!=null&&je.result){const Se=re.target.result.split(",")[1];C(Me=>[...Me,{mime_type:fe.type,data:Se}])}},ye.readAsDataURL(fe)}}),M.current&&(M.current.value=""))},Q=F=>{C(W=>W.filter((fe,ye)=>ye!==F))},ce=F=>{j(F),I(1),O({x:0,y:0})},B=()=>{j(null),I(1),O({x:0,y:0}),R(!1)},V=F=>{const W=document.createElement("a");W.href=F,W.download=`image-${Date.now()}.png`,document.body.appendChild(W),W.click(),document.body.removeChild(W)},D=F=>{I(W=>{const fe=W+F;return Math.min(Math.max(fe,.5),3)})},le=F=>{F.preventDefault(),F.stopPropagation();const W=F.deltaY>0?-.1:.1;D(W)},q=F=>{x>1&&(R(!0),z({x:F.clientX-_.x,y:F.clientY-_.y}))},ae=F=>{k&&x>1&&O({x:F.clientX-P.x,y:F.clientY-P.y})},ke=()=>{R(!1)},ne=()=>A.status===mt.CONNECTING?"Connecting...":A.status===mt.ERROR?"Connection error":A.status===mt.DISCONNECTED||!se?"Disconnected":K?"Waiting for your input...":te?"Working...":"Ready",Y=()=>{if(!K||!y)return"Ask anything";switch(y.input_type){case"select":case"boolean":case"date":return"Use controls above to make selection";case"multiselect":return"Select options above";default:return"Enter your response..."}},Z=()=>!K||!y?!1:["select","multiselect","boolean","date"].includes(y.input_type||"");return e.jsxs(ue,{style:{height:"100%",width:"100%"},children:[e.jsxs(Ui,{children:[e.jsxs(I1,{children:[e.jsxs(T1,{children:[t&&e.jsx(O1,{onClick:()=>{r?r():h(null)},children:e.jsx(Ur,{size:20})}),e.jsxs(M1,{children:[e.jsx(L1,{children:e.jsx(bn,{size:20})}),e.jsxs(A1,{children:[e.jsx(N1,{children:o}),e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[e.jsx(D1,{$status:ne()}),e.jsx(F1,{$status:ne(),children:ne()})]})]})]})]}),U!==Ae.IDLE&&e.jsx(B1,{$status:U,children:U.replace("_"," ")})]}),e.jsx(U1,{children:N.length===0&&p?e.jsxs(Wi,{children:[e.jsx(bn,{size:48,strokeWidth:1.5}),e.jsx("p",{children:d})]}):e.jsxs(e.Fragment,{children:[N.map((F,W)=>{var fe,ye,re,je;if(((fe=F.metadata)==null?void 0:fe.type)==="user_input_request"&&F.metadata.userInputRequest){const me=F.metadata.userInputRequest,Se=!me.input_type||me.input_type==="text"||me.input_type==="number",Me=K&&(y==null?void 0:y.input_type)===me.input_type;return e.jsx(qn,{$isUser:!1,children:e.jsxs(H1,{children:[e.jsx("div",{className:"question",children:me.question}),me.context&&me.context.trim()&&e.jsx("div",{className:"context",children:me.context}),!Se&&e.jsxs("div",{className:"controls",children:[me.input_type==="select"&&me.options&&e.jsxs("select",{value:Me?u:"",onChange:Ie=>g(Ie.target.value),disabled:!Me,children:[e.jsx("option",{value:"",children:"Choose an option..."}),me.options.map(Ie=>e.jsx("option",{value:Ie,children:Ie},Ie))]}),me.input_type==="multiselect"&&me.options&&e.jsx("div",{className:"checkbox-group",children:me.options.map(Ie=>e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:Me&&E.includes(Ie),onChange:nr=>{nr.target.checked?b([...E,Ie]):b(E.filter(ar=>ar!==Ie))},disabled:!Me}),e.jsx("span",{children:Ie})]},Ie))}),me.input_type==="boolean"&&e.jsxs("div",{className:"radio-group",children:[e.jsxs("label",{className:"radio-label",children:[e.jsx("input",{type:"radio",name:"boolean",value:"true",checked:Me&&u==="true",onChange:Ie=>g(Ie.target.value),disabled:!Me}),e.jsx("span",{children:"Yes"})]}),e.jsxs("label",{className:"radio-label",children:[e.jsx("input",{type:"radio",name:"boolean",value:"false",checked:Me&&u==="false",onChange:Ie=>g(Ie.target.value),disabled:!Me}),e.jsx("span",{children:"No"})]})]}),me.input_type==="date"&&e.jsx("input",{type:"date",value:Me?u:"",onChange:Ie=>g(Ie.target.value),disabled:!Me})]}),e.jsx("div",{className:"instruction",children:Me?Se?"Type your response below":me.input_type==="multiselect"?"Select options above and click send":"Make your selection above and click send":""})]})},F.id)}if(((ye=F.metadata)==null?void 0:ye.type)==="log"){const me=N[W-1],Se=N[W+1],Me=((re=me==null?void 0:me.metadata)==null?void 0:re.type)==="log",Ie=((je=Se==null?void 0:Se.metadata)==null?void 0:je.type)==="log",nr=Me||Ie,ar=!Me&&Ie,qr=Me&&!Ie;return e.jsx(G1,{$isGrouped:nr,$isFirstInGroup:ar,$isLastInGroup:qr,children:e.jsx("div",{className:"log-content",children:F.content})},F.id)}return!F.content&&(!F.images||F.images.length===0)?null:e.jsx(qn,{$isUser:F.role==="user",children:e.jsxs(Yl,{$isUser:F.role==="user",children:[e.jsx("div",{children:F.content}),F.images&&F.images.length>0&&e.jsx("div",{style:{display:"flex",gap:"8px",marginTop:"8px",flexWrap:"wrap"},children:F.images.map((me,Se)=>{const Me=me.url||`data:${me.mime_type};base64,${me.data}`;return e.jsxs(d2,{onClick:()=>ce(Me),title:"Click to preview",children:[e.jsx("img",{src:Me,alt:`Image ${Se+1}`,loading:"lazy"}),e.jsx("div",{className:"expand-icon",children:e.jsx(Np,{size:14})})]},Se)})}),F.isStreaming&&e.jsx(W1,{})]})},F.id)}),H&&e.jsx(qn,{$isUser:!0,children:e.jsxs(V1,{$isUser:!0,children:[e.jsx("div",{children:H}),L&&L.length>0&&e.jsx("div",{style:{display:"flex",gap:"8px",marginTop:"8px",flexWrap:"wrap"},children:L.map((F,W)=>e.jsx("div",{style:{width:"200px",height:"200px",borderRadius:"8px",border:"1px solid var(--color-border)",overflow:"hidden",backgroundColor:"var(--color-background-subtle)",position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("img",{src:F.data?`data:${F.mime_type};base64,${F.data}`:"#",alt:`Image ${W+1}`,style:{maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",objectFit:"contain"},loading:"lazy"})},W))})]})}),e.jsx("div",{ref:T})]})}),$.length>0&&e.jsx(X1,{children:$.map((F,W)=>e.jsxs(J1,{children:[e.jsx("img",{src:F.data?`data:${F.mime_type};base64,${F.data}`:"#",alt:`Upload ${W+1}`}),e.jsx(e2,{type:"button",onClick:()=>Q(W),children:e.jsx(Ze,{size:12})})]},W))}),e.jsx(q1,{onSubmit:oe,children:e.jsxs(Y1,{children:[e.jsxs(Z1,{children:[e.jsx(Q1,{value:u,onChange:F=>g(F.target.value),onKeyDown:F=>{F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),oe(F))},placeholder:Y(),disabled:!se||te&&!K||Z(),rows:1}),e.jsx(K1,{children:e.jsxs(r2,{type:"button",disabled:!se||te,onClick:()=>{var F;return(F=M.current)==null?void 0:F.click()},children:[e.jsx(eh,{size:16}),"Attach"]})}),e.jsx(t2,{ref:M,type:"file",accept:"image/*",multiple:!0,onChange:de})]}),e.jsx(o2,{type:te?"button":"submit",disabled:!se||!K&&!te&&!u.trim(),onClick:te?ie:void 0,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),style:{background:te&&m?"var(--color-error)":void 0},children:te?m?e.jsx(Ze,{size:14}):e.jsx(vt,{size:14,className:"animate-spin"}):e.jsx(Wc,{size:14})})]})})]}),e.jsx(u2,{isOpen:!!w,imageUrl:w,zoomLevel:x,dragPosition:_,isDragging:k,onClose:B,onDownload:()=>w&&V(w),onZoom:D,onReset:()=>{I(1),O({x:0,y:0})},onWheel:le,onMouseDown:q,onMouseMove:ae,onMouseUp:ke})]})}const p2=l.div`
|
|
5674
5674
|
height: 100%;
|
|
5675
5675
|
display: flex;
|
|
5676
5676
|
flex-direction: column;
|
|
@@ -5895,12 +5895,12 @@ cursor: pointer;
|
|
|
5895
5895
|
color: var(--color-foreground);
|
|
5896
5896
|
margin: 0 0 var(--space-sm) 0;
|
|
5897
5897
|
text-align: center;
|
|
5898
|
-
`,
|
|
5898
|
+
`,N2=l.p`
|
|
5899
5899
|
font-size: var(--font-sm);
|
|
5900
5900
|
color: var(--color-secondary-text);
|
|
5901
5901
|
margin: 0 0 var(--space-xl) 0;
|
|
5902
5902
|
text-align: center;
|
|
5903
|
-
`,
|
|
5903
|
+
`,F2=l.button`
|
|
5904
5904
|
background: var(--color-primary);
|
|
5905
5905
|
color: white;
|
|
5906
5906
|
border: none;
|
|
@@ -6023,5 +6023,5 @@ cursor: pointer;
|
|
|
6023
6023
|
display: flex;
|
|
6024
6024
|
flex-direction: column;
|
|
6025
6025
|
gap: var(--space-xs);
|
|
6026
|
-
`;function K2(){const[t,r]=i.useState(!1),{sessions:o,selectedSession:n,showHistory:s,selectSession:a,createSession:h,setShowHistory:f}=Ho(),c=async()=>{try{r(!0),await h()}finally{r(!1)}},p=d=>{try{const u=new Date(d),m=new Date().getTime()-u.getTime(),v=Math.floor(m/6e4),y=Math.floor(v/60),S=Math.floor(y/24);return S>0?`${S}d ago`:y>0?`${y}h ago`:v>0?`${v}m ago`:"Just now"}catch{return""}};return s?e.jsx(Kl,{showBackButton:!0}):n?e.jsx(Ql,{showBackButton:!0}):e.jsx(ue,{style:{height:"100%",width:"100%"},children:e.jsx(M2,{children:e.jsxs(L2,{children:[e.jsx(A2,{children:e.jsx("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})}),e.jsx(D2,{children:"Hi there! 👋"}),e.jsx(
|
|
6026
|
+
`;function K2(){const[t,r]=i.useState(!1),{sessions:o,selectedSession:n,showHistory:s,selectSession:a,createSession:h,setShowHistory:f}=Ho(),c=async()=>{try{r(!0),await h()}finally{r(!1)}},p=d=>{try{const u=new Date(d),m=new Date().getTime()-u.getTime(),v=Math.floor(m/6e4),y=Math.floor(v/60),S=Math.floor(y/24);return S>0?`${S}d ago`:y>0?`${y}h ago`:v>0?`${v}m ago`:"Just now"}catch{return""}};return s?e.jsx(Kl,{showBackButton:!0}):n?e.jsx(Ql,{showBackButton:!0}):e.jsx(ue,{style:{height:"100%",width:"100%"},children:e.jsx(M2,{children:e.jsxs(L2,{children:[e.jsx(A2,{children:e.jsx("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})}),e.jsx(D2,{children:"Hi there! 👋"}),e.jsx(N2,{children:"How can I help you today?"}),e.jsx(F2,{onClick:c,disabled:t,children:t?e.jsxs(e.Fragment,{children:["Starting",e.jsx(B2,{})]}):"Start a conversation"}),o.length>0&&e.jsxs(H2,{children:[e.jsxs(q2,{children:[e.jsx(Y2,{children:"Recent Chats"}),e.jsx(Z2,{onClick:()=>f(!0),children:"View All →"})]}),e.jsx(Q2,{children:o.slice(0,2).map(d=>e.jsx(U2,{onClick:()=>a(d),children:e.jsxs(G2,{children:[e.jsx(W2,{children:d.title}),e.jsxs(V2,{children:[e.jsx("span",{children:p(d.last_activity_at)}),d.status==="running"&&e.jsx("span",{children:"• Active"})]})]})},d.id))})]})]})})})}const X2=t=>{const r=t.toLowerCase().trim();return["javascript:","data:","vbscript:"].some(s=>r.startsWith(s))?!0:["http://","https://","//","ftp://","ftps://","mailto:","tel:","sms:","file:","blob:"].some(s=>r.startsWith(s))},J2=t=>{const r=t.toLowerCase().trim();return!["javascript:","data:","vbscript:"].some(n=>r.startsWith(n))};exports.AcceptInvite=Kg;exports.AgentConversation=Ql;exports.AgentConversationHistory=Kl;exports.AgentConversationHub=K2;exports.AgentConversationProvider=Od;exports.AuthFormImage=Re;exports.ChannelSelector=R1;exports.CreateOrganizationForm=nn;exports.CreateWorkspaceDialog=kl;exports.CreateWorkspaceForm=$a;exports.DeploymentInitialized=lu;exports.DeploymentInitializing=du;exports.DeploymentProvider=ed;exports.Dialog=_e;exports.DialogTrigger=ff;exports.Dropdown=nt;exports.DropdownDivider=on;exports.DropdownItem=Te;exports.DropdownItems=at;exports.DropdownTrigger=st;exports.Form=lt;exports.FormGroup=ge;exports.Input=pe;exports.Label=he;exports.MagicLinkVerification=Vg;exports.ManageAccount=Bl;exports.ManageAccountDialog=Ul;exports.ManageOrganization=yl;exports.ManageWorkspace=Cl;exports.ManageWorkspaceDialog=Sl;exports.NavigateToSignIn=u1;exports.NavigateToSignUp=p1;exports.NavigationLink=ot;exports.NotificationBell=Hl;exports.NotificationItem=Vl;exports.NotificationPopover=Gl;exports.OAuthProvider=rc;exports.OTPInput=It;exports.OrganizationSwitcher=zl;exports.PhoneNumberInput=Gr;exports.PhoneVerification=pl;exports.ProfileCompletion=fl;exports.RequireActiveTenancy=S1;exports.SSOCallback=Mg;exports.SignInForm=gg;exports.SignUpForm=Xh;exports.SignedIn=Zv;exports.SignedInAccounts=d1;exports.SignedOut=Qv;exports.SimpleDialog=hf;exports.Spinner=Ee;exports.Switch=jr;exports.TwoFactorMethodSelector=ul;exports.TwoFactorVerification=hl;exports.UserButton=Pa;exports.UserControls=Yv;exports.WaitlistForm=Pg;exports.clearTokenCache=zt;exports.fetchChannelCounts=ou;exports.hasIncompleteProfile=Gg;exports.isExternalUrl=X2;exports.isSafeUrl=J2;exports.redirectToProfileCompletion=Hg;exports.useActiveOrganization=qe;exports.useActiveTenancy=tu;exports.useActiveWorkspace=Rt;exports.useAgentConversation=hc;exports.useAgentConversationContext=Ho;exports.useChannelCounts=cu;exports.useClient=Ne;exports.useConversationSessions=ec;exports.useDeployment=ve;exports.useForgotPassword=dc;exports.useInvitation=fc;exports.useMagicLinkParams=lc;exports.useMagicLinkVerification=cc;exports.useNavigation=Ve;exports.useNotificationStream=uc;exports.useNotifications=pc;exports.useOrganizationList=qo;exports.useOrganizationMemberships=bt;exports.useSSOCallback=ic;exports.useSession=Be;exports.useSignIn=oc;exports.useSignInWithStrategy=Dr;exports.useSignUp=nc;exports.useUser=rr;exports.useUserSignins=ac;exports.useWaitlist=sc;exports.useWorkspaceList=yt;exports.useWorkspaceMemberships=Yo;Object.keys(Ta).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Ta[t]})});
|
|
6027
6027
|
//# sourceMappingURL=index.cjs.js.map
|