@wacht/jsx 0.0.1-alpha.2 → 0.0.1-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +349 -349
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1182 -1178
- package/dist/index.es.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";var Bl=Object.defineProperty;var Ul=(t,r,o)=>r in t?Bl(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o;var Je=(t,r,o)=>Ul(t,typeof r!="symbol"?r+"":r,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),Nr=require("react-dom"),Ri=i.createContext(void 0);function Wl({children:t,publicKey:r,adapter:o}){const[n,a]=i.useState(!0),[s,p]=i.useState(null),f=i.useRef(!1);i.useEffect(()=>{async function h(){if(f.current)return;f.current=!0,a(!0);const[d,u,m]=r.split("_");if(!m)throw new Error("Invalid public key");let v=atob(m),x=u==="test",w=null;if(new URLSearchParams(window.location.search).has("__dev_session__")){w=new URLSearchParams(window.location.search).get("__dev_session__"),localStorage.setItem("__dev_session__",w??"");const C=new URL(window.location.href);C.searchParams.delete("__dev_session__"),window.history.replaceState({},"",C.toString())}else w=localStorage.getItem("__dev_session__");let _={};const z=new URLSearchParams;x?z.append("__dev_session__",w??""):_={credentials:"include"};const y=await fetch(`${v}/deployment${x?"?":""}${z.toString()}`,_);if(!y.ok){a(!1);return}const
|
|
2
|
+
"use strict";var Bl=Object.defineProperty;var Ul=(t,r,o)=>r in t?Bl(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o;var Je=(t,r,o)=>Ul(t,typeof r!="symbol"?r+"":r,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),Ve=require("@wacht/types"),Nr=require("react-dom"),Ri=i.createContext(void 0);function Wl({children:t,publicKey:r,adapter:o}){const[n,a]=i.useState(!0),[s,p]=i.useState(null),f=i.useRef(!1);i.useEffect(()=>{async function h(){if(f.current)return;f.current=!0,a(!0);const[d,u,m]=r.split("_");if(!m)throw new Error("Invalid public key");let v=atob(m),x=u==="test",w=null;if(new URLSearchParams(window.location.search).has("__dev_session__")){w=new URLSearchParams(window.location.search).get("__dev_session__"),localStorage.setItem("__dev_session__",w??"");const C=new URL(window.location.href);C.searchParams.delete("__dev_session__"),window.history.replaceState({},"",C.toString())}else w=localStorage.getItem("__dev_session__");let _={};const z=new URLSearchParams;x?z.append("__dev_session__",w??""):_={credentials:"include"};const y=await fetch(`${v}/deployment${x?"?":""}${z.toString()}`,_);if(!y.ok){a(!1);return}const P=await y.json();P.data.backend_host=v,p(P.data),x&&y.headers.get("x-development-session")&&localStorage.setItem("__dev_session__",y.headers.get("x-development-session")??""),a(!1)}h()},[r]);const c=i.useMemo(()=>({loading:n,deployment:s,adapter:o}),[n,s,o]);return e.jsx(Ri.Provider,{value:c,children:t})}function ve(){const t=i.useContext(Ri);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 Me(){const{deployment:t,loading:r}=ve();return r||!t?{client:()=>Promise.reject(new Error("Deployment is loading")),loading:r}:{client:async(n,a)=>{const s=Vl(t),p=new Headers(s.headers);a!=null&&a.headers&&new Headers(a.headers).forEach((d,u)=>{p.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,{...s,...a,headers:p});return t.mode==="staging"&&c.headers.get("x-development-session")&&localStorage.setItem("__dev_session__",c.headers.get("x-development-session")??""),c},loading:r}}function Vl(t){return t.mode==="staging"?{}:{credentials:"include"}}var Vr={exports:{}},rn={};/**
|
|
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 Sa;function Hl(){return Sa||(Sa=1,process.env.NODE_ENV!=="production"&&function(){function t(v,x){return v===x&&(v!==0||1/v===1/x)||v!==v&&x!==x}function r(v,x){d||a.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 w=x();if(!u){var _=x();s(w,_)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}_=p({inst:{value:w,getSnapshot:x}});var z=_[0].inst,y=_[1];return c(function(){z.value=w,z.getSnapshot=x,o(z)&&y({inst:z})},[v,w,x]),f(function(){return o(z)&&y({inst:z}),v(function(){o(z)&&y({inst:z})})},[v]),h(w),w}function o(v){var x=v.getSnapshot;v=v.value;try{var w=x();return!s(v,w)}catch{return!0}}function n(v,x){return x()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var a=i,s=typeof Object.is=="function"?Object.is:t,p=a.useState,f=a.useEffect,c=a.useLayoutEffect,h=a.useDebugValue,d=!1,u=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:r;on.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),on}var $a;function ql(){return $a||($a=1,process.env.NODE_ENV==="production"?Vr.exports=Gl():Vr.exports=Hl()),Vr.exports}var Yl=ql();const Pi=0,Ti=1,Oi=2,za=3;var Ea=Object.prototype.hasOwnProperty;function Wn(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--&&Wn(t[n],r[n]););return n===-1}if(!o||typeof t=="object"){n=0;for(o in t)if(Ea.call(t,o)&&++n&&!Ea.call(r,o)||!(o in r)||!Wn(t[o],r[o]))return!1;return Object.keys(r).length===n}}return t!==t&&r!==r}const xt=new WeakMap,Ct=()=>{},Ge=Ct(),Vn=Object,be=t=>t===Ge,ct=t=>typeof t=="function",$t=(t,r)=>({...t,...r}),Mi=t=>ct(t.then),nn={},Gr={},da="undefined",Fr=typeof window!=da,Gn=typeof document!=da,Zl=Fr&&"Deno"in window,Kl=()=>Fr&&typeof window.requestAnimationFrame!=da,Ai=(t,r)=>{const o=xt.get(t);return[()=>!be(r)&&t.get(r)||nn,n=>{if(!be(r)){const a=t.get(r);r in Gr||(Gr[r]=a),o[5](r,$t(a,n),a||nn)}},o[6],()=>!be(r)&&r in Gr?Gr[r]:!be(r)&&t.get(r)||nn]};let Hn=!0;const Ql=()=>Hn,[qn,Yn]=Fr&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Ct,Ct],Xl=()=>{const t=Gn&&document.visibilityState;return be(t)||t!=="hidden"},Jl=t=>(Gn&&document.addEventListener("visibilitychange",t),qn("focus",t),()=>{Gn&&document.removeEventListener("visibilitychange",t),Yn("focus",t)}),ed=t=>{const r=()=>{Hn=!0,t()},o=()=>{Hn=!1};return qn("online",r),qn("offline",o),()=>{Yn("online",r),Yn("offline",o)}},td={isOnline:Ql,isVisible:Xl},rd={initFocus:Jl,initReconnect:ed},Ia=!i.useId,Ar=!Fr||Zl,od=t=>Kl()?window.requestAnimationFrame(t):setTimeout(t,1),an=Ar?i.useEffect:i.useLayoutEffect,sn=typeof navigator<"u"&&navigator.connection,Ra=!Ar&&sn&&(["slow-2g","2g"].includes(sn.effectiveType)||sn.saveData),Hr=new WeakMap,nd=t=>Vn.prototype.toString.call(t),cn=(t,r)=>t===`[object ${r}]`;let ad=0;const Zn=t=>{const r=typeof t,o=nd(t),n=cn(o,"Date"),a=cn(o,"RegExp"),s=cn(o,"Object");let p,f;if(Vn(t)===t&&!n&&!a){if(p=Hr.get(t),p)return p;if(p=++ad+"~",Hr.set(t,p),Array.isArray(t)){for(p="@",f=0;f<t.length;f++)p+=Zn(t[f])+",";Hr.set(t,p)}if(s){p="#";const c=Vn.keys(t).sort();for(;!be(f=c.pop());)be(t[f])||(p+=f+":"+Zn(t[f])+",");Hr.set(t,p)}}else p=n?t.toJSON():r=="symbol"?t.toString():r=="string"?JSON.stringify(t):""+t;return p},ua=t=>{if(ct(t))try{t=t()}catch{t=""}const r=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?Zn(t):"",[t,r]};let sd=0;const Kn=()=>++sd;async function Li(...t){const[r,o,n,a]=t,s=$t({populateCache:!0,throwOnError:!0},typeof a=="boolean"?{revalidate:a}:a||{});let p=s.populateCache;const f=s.rollbackOnError;let c=s.optimisticData;const h=m=>typeof f=="function"?f(m):f!==!1,d=s.throwOnError;if(ct(o)){const m=o,v=[],x=r.keys();for(const w of x)!/^\$(inf|sub)\$/.test(w)&&m(r.get(w)._k)&&v.push(w);return Promise.all(v.map(u))}return u(o);async function u(m){const[v]=ua(m);if(!v)return;const[x,w]=Ai(r,v),[_,z,y,I]=xt.get(r),C=()=>{const P=_[v];return(ct(s.revalidate)?s.revalidate(x().data,m):s.revalidate!==!1)&&(delete y[v],delete I[v],P&&P[0])?P[0](Oi).then(()=>x().data):x().data};if(t.length<3)return C();let j=n,b,g=!1;const S=Kn();z[v]=[S,0];const k=!be(c),E=x(),R=E.data,$=E._c,O=be($)?R:$;if(k&&(c=ct(c)?c(O,R):c,w({data:c,_c:O})),ct(j))try{j=j(O)}catch(P){b=P,g=!0}if(j&&Mi(j))if(j=await j.catch(P=>{b=P,g=!0}),S!==z[v][0]){if(g)throw b;return j}else g&&k&&h(b)&&(p=!0,w({data:O,_c:Ge}));if(p&&!g)if(ct(p)){const P=p(j,O);w({data:P,error:Ge,_c:Ge})}else w({data:j,error:Ge,_c:Ge});if(z[v][1]=Kn(),Promise.resolve(C()).then(()=>{w({_c:Ge})}),g){if(d)throw b;return}return j}}const Pa=(t,r)=>{for(const o in t)t[o][0]&&t[o][0](r)},id=(t,r)=>{if(!xt.has(t)){const o=$t(rd,r),n=Object.create(null),a=Li.bind(Ge,t);let s=Ct;const p=Object.create(null),f=(d,u)=>{const m=p[d]||[];return p[d]=m,m.push(u),()=>m.splice(m.indexOf(u),1)},c=(d,u,m)=>{t.set(d,u);const v=p[d];if(v)for(const x of v)x(u,m)},h=()=>{if(!xt.has(t)&&(xt.set(t,[n,Object.create(null),Object.create(null),Object.create(null),a,c,f]),!Ar)){const d=o.initFocus(setTimeout.bind(Ge,Pa.bind(Ge,n,Pi))),u=o.initReconnect(setTimeout.bind(Ge,Pa.bind(Ge,n,Ti)));s=()=>{d&&d(),u&&u(),xt.delete(t)}}};return h(),[t,a,h,s]}return[t,xt.get(t)[4]]},cd=(t,r,o,n,a)=>{const s=o.errorRetryCount,p=a.retryCount,f=~~((Math.random()+.5)*(1<<(p<8?p:8)))*o.errorRetryInterval;!be(s)&&p>s||setTimeout(n,f,a)},ld=Wn,[Di,dd]=id(new Map),ud=$t({onLoadingSlow:Ct,onSuccess:Ct,onError:Ct,onErrorRetry:cd,onDiscarded:Ct,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Ra?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Ra?5e3:3e3,compare:ld,isPaused:()=>!1,cache:Di,mutate:dd,fallback:{}},td),pd=(t,r)=>{const o=$t(t,r);if(r){const{use:n,fallback:a}=t,{use:s,fallback:p}=r;n&&s&&(o.use=n.concat(s)),a&&p&&(o.fallback=$t(a,p))}return o},hd=i.createContext({}),fd="$inf$",Ni=Fr&&window.__SWR_DEVTOOLS_USE__,gd=Ni?window.__SWR_DEVTOOLS_USE__:[],md=()=>{Ni&&(window.__SWR_DEVTOOLS_REACT__=i)},xd=t=>ct(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],vd=()=>$t(ud,i.useContext(hd)),bd=t=>(r,o,n)=>t(r,o&&((...s)=>{const[p]=ua(r),[,,,f]=xt.get(Di);if(p.startsWith(fd))return o(...s);const c=f[p];return be(c)?o(...s):(delete f[p],c)}),n),yd=gd.concat(bd),wd=t=>function(...o){const n=vd(),[a,s,p]=xd(o),f=pd(n,p);let c=t;const{use:h}=f,d=(h||[]).concat(yd);for(let u=d.length;u--;)c=d[u](c);return c(a,s||f.fetcher||null,f)},jd=(t,r,o)=>{const n=r[t]||(r[t]=[]);return n.push(o),()=>{const a=n.indexOf(o);a>=0&&(n[a]=n[n.length-1],n.pop())}};md();const ln=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}}),dn={dedupe:!0},kd=(t,r,o)=>{const{cache:n,compare:a,suspense:s,fallbackData:p,revalidateOnMount:f,revalidateIfStale:c,refreshInterval:h,refreshWhenHidden:d,refreshWhenOffline:u,keepPreviousData:m}=o,[v,x,w,_]=xt.get(n),[z,y]=ua(t),I=i.useRef(!1),C=i.useRef(!1),j=i.useRef(z),b=i.useRef(r),g=i.useRef(o),S=()=>g.current,k=()=>S().isVisible()&&S().isOnline(),[E,R,$,O]=Ai(n,z),P=i.useRef({}).current,T=be(p)?be(o.fallback)?Ge:o.fallback[z]:p,N=(F,M)=>{for(const W in P){const L=W;if(L==="data"){if(!a(F[L],M[L])&&(!be(F[L])||!a(H,M[L])))return!1}else if(M[L]!==F[L])return!1}return!0},A=i.useMemo(()=>{const F=!z||!r?!1:be(f)?S().isPaused()||s?!1:c!==!1:f,M=we=>{const Te=$t(we);return delete Te._k,F?{isValidating:!0,isLoading:!0,...Te}:Te},W=E(),L=O(),G=M(W),re=W===L?G:M(L);let pe=G;return[()=>{const we=M(E());return N(we,pe)?(pe.data=we.data,pe.isLoading=we.isLoading,pe.isValidating=we.isValidating,pe.error=we.error,pe):(pe=we,we)},()=>re]},[n,z]),D=Yl.useSyncExternalStore(i.useCallback(F=>$(z,(M,W)=>{N(W,M)||F()}),[n,z]),A[0],A[1]),B=!I.current,oe=v[z]&&v[z].length>0,se=D.data,ne=be(se)?T&&Mi(T)?ln(T):T:se,K=D.error,U=i.useRef(ne),H=m?be(se)?be(U.current)?ne:U.current:se:ne,Q=oe&&!be(K)?!1:B&&!be(f)?f:S().isPaused()?!1:s?be(ne)?!1:c:be(ne)||c,ae=!!(z&&r&&B&&Q),te=be(D.isValidating)?ae:D.isValidating,ee=be(D.isLoading)?ae:D.isLoading,Y=i.useCallback(async F=>{const M=b.current;if(!z||!M||C.current||S().isPaused())return!1;let W,L,G=!0;const re=F||{},pe=!w[z]||!re.dedupe,we=()=>Ia?!C.current&&z===j.current&&I.current:z===j.current,Te={isValidating:!1,isLoading:!1},q=()=>{R(Te)},J=()=>{const ce=w[z];ce&&ce[1]===L&&delete w[z]},Z={isValidating:!0};be(E().data)&&(Z.isLoading=!0);try{if(pe&&(R(Z),o.loadingTimeout&&be(E().data)&&setTimeout(()=>{G&&we()&&S().onLoadingSlow(z,o)},o.loadingTimeout),w[z]=[M(y),Kn()]),[W,L]=w[z],W=await W,pe&&setTimeout(J,o.dedupingInterval),!w[z]||w[z][1]!==L)return pe&&we()&&S().onDiscarded(z),!1;Te.error=Ge;const ce=x[z];if(!be(ce)&&(L<=ce[0]||L<=ce[1]||ce[1]===0))return q(),pe&&we()&&S().onDiscarded(z),!1;const je=E().data;Te.data=a(je,W)?je:W,pe&&we()&&S().onSuccess(W,z,o)}catch(ce){J();const je=S(),{shouldRetryOnError:Se}=je;je.isPaused()||(Te.error=ce,pe&&we()&&(je.onError(ce,z,je),(Se===!0||ct(Se)&&Se(ce))&&(!S().revalidateOnFocus||!S().revalidateOnReconnect||k())&&je.onErrorRetry(ce,z,je,Ce=>{const Ne=v[z];Ne&&Ne[0]&&Ne[0](za,Ce)},{retryCount:(re.retryCount||0)+1,dedupe:!0})))}return G=!1,q(),!0},[z,n]),de=i.useCallback((...F)=>Li(n,j.current,...F),[]);if(an(()=>{b.current=r,g.current=o,be(se)||(U.current=se)}),an(()=>{if(!z)return;const F=Y.bind(Ge,dn);let M=0;S().revalidateOnFocus&&(M=Date.now()+S().focusThrottleInterval);const L=jd(z,v,(G,re={})=>{if(G==Pi){const pe=Date.now();S().revalidateOnFocus&&pe>M&&k()&&(M=pe+S().focusThrottleInterval,F())}else if(G==Ti)S().revalidateOnReconnect&&k()&&F();else{if(G==Oi)return Y();if(G==za)return Y(re)}});return C.current=!1,j.current=z,I.current=!0,R({_k:y}),Q&&(w[z]||(be(ne)||Ar?F():od(F))),()=>{C.current=!0,L()}},[z]),an(()=>{let F;function M(){const L=ct(h)?h(E().data):h;L&&F!==-1&&(F=setTimeout(W,L))}function W(){!E().error&&(d||S().isVisible())&&(u||S().isOnline())?Y(dn).then(M):M()}return M(),()=>{F&&(clearTimeout(F),F=-1)}},[h,d,u,z]),i.useDebugValue(H),s&&be(ne)&&z){if(!Ia&&Ar)throw new Error("Fallback data is required when using Suspense in SSR.");b.current=r,g.current=o,C.current=!1;const F=_[z];if(!be(F)){const M=de(F);ln(M)}if(be(K)){const M=Y(dn);be(H)||(M.status="fulfilled",M.value=!0),ln(M)}else throw K}return{mutate:de,get data(){return P.data=!0,H},get error(){return P.error=!0,K},get isValidating(){return P.isValidating=!0,te},get isLoading(){return P.isLoading=!0,ee}}},We=wd(kd);async function V(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)}const r=await t.json();return{data:r.data,errors:r.errors}}function Fi(t){const{client:r}=Me(),o=i.useCallback(async()=>{const c=await r(`/api/agent/contexts?token=${encodeURIComponent(t)}`,{method:"GET"});return(await V(c)).data},[r,t]),{data:n,error:a,mutate:s}=We(t?`sessions-${t}`:null,o,{revalidateOnFocus:!1}),p=i.useCallback(async c=>{const h=new FormData;h.append("title",c.title),c.system_instructions&&h.append("system_instructions",c.system_instructions);const d=await r(`/api/agent/contexts?token=${encodeURIComponent(t)}`,{method:"POST",body:h}),u=await V(d);return await s(m=>m&&{...m,data:[u.data,...m.data]}),u.data},[r,t,s]),f=i.useCallback(async c=>{await r(`/api/agent/contexts/${c}/delete?token=${encodeURIComponent(t)}`,{method:"POST"}),await s(h=>h&&{...h,data:h.data.filter(d=>d.id!==c)})},[r,t,s]);return{sessions:(n==null?void 0:n.data)||[],loading:!n&&!a,error:a,createSession:p,deleteSession:f,refetch:async()=>{await s()}}}const Bi=i.createContext(void 0);function Bo(){const t=i.useContext(Bi);if(!t)throw new Error("useAgentConversationContext must be used within AgentConversationProvider");return t}function _d({children:t,agentName:r,token:o,platformAdapter:n,defaultSessionId:a,onSessionCreated:s,onSessionDeleted:p,onError:f}){const[c,h]=i.useState(a?{id:a,title:"Conversation",status:"idle",last_activity_at:new Date().toISOString(),created_at:new Date().toISOString()}:null),[d,u]=i.useState(!1),{sessions:m,loading:v,error:x,createSession:w,deleteSession:_,refetch:z}=Fi(o);i.useEffect(()=>{if(a&&m.length>0){const b=m.find(g=>g.id===a);b&&h(b)}},[a,m]);const y=i.useCallback(b=>{h(b),u(!1)},[]),I=i.useCallback(async b=>{try{const g=b||`Chat ${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}`,S=await w({title:g});return h(S),s==null||s(S),S}catch(g){const S=g instanceof Error?g.message:"Failed to create session";throw f==null||f(S),g}},[w,s,f]),C=i.useCallback(async b=>{try{await _(b),(c==null?void 0:c.id)===b&&h(null),p==null||p(b)}catch(g){const S=g instanceof Error?g.message:"Failed to delete session";throw f==null||f(S),g}},[_,c,p,f]),j={agentName:r,token:o,platformAdapter:n,sessions:m,selectedSession:c,loadingSessions:v,sessionError:x,selectSession:y,createSession:I,deleteSession:C,refreshSessions:z,showHistory:d,setShowHistory:u,onSessionCreated:s,onSessionDeleted:p,onError:f};return e.jsx(Bi.Provider,{value:j,children:t})}var Ui=(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))(Ui||{}),pr=(t=>(t.Username="username",t.Email="email",t.Phone="phone",t.EmailOTP="email_otp",t.MagicLink="magic_link",t.Oauth="oauth",t.Generic="generic",t))(pr||{});function Cd(t,r,o){const n={username:Sd(t,r,o),email:$d(t,r,o),phone:zd(t,r,o),email_otp:Ed(t,r,o),magic_link:Id(t,r,o),oauth:Rd(t,o),generic:Pd(t,r,o)};return function(s){return n[s]}}function Sd(t,r,o){return async({username:n,password:a})=>{var c,h;const s=new FormData;s.append("strategy","plain_username"),s.append("username",n),s.append("password",a);const p=await t("/auth/signin",{method:"POST",body:s}),f=await V(p);return"data"in f&&((h=(c=f.data)==null?void 0:c.signin_attempts)!=null&&h.length)?(r(f.data.signin_attempts.at(-1)||null),o(null)):o(f),f}}function $d(t,r,o){return async({email:n,password:a})=>{var c,h;const s=new FormData;s.append("strategy","plain_email"),s.append("email",n),s.append("password",a);const p=await t("/auth/signin",{method:"POST",body:s}),f=await V(p);return"data"in f&&((h=(c=f.data)==null?void 0:c.signin_attempts)!=null&&h.length)?(r(f.data.signin_attempts.at(-1)||null),o(null)):o(f),f}}function zd(t,r,o){return async({phone:n})=>{var f,c;const a=new FormData;a.append("strategy","phone_otp"),a.append("phone",n);const s=await t("/auth/signin",{method:"POST",body:a}),p=await V(s);return"data"in p&&((c=(f=p.data)==null?void 0:f.signin_attempts)!=null&&c.length)?(r(p.data.signin_attempts.at(-1)||null),o(null)):o(p),p}}function Ed(t,r,o){return async({email:n})=>{var f,c;const a=new FormData;a.append("strategy","email_otp"),a.append("email",n);const s=await t("/auth/signin",{method:"POST",body:a}),p=await V(s);return"data"in p&&((c=(f=p.data)==null?void 0:f.signin_attempts)!=null&&c.length)?(r(p.data.signin_attempts.at(-1)||null),o(null)):o(p),p}}function Id(t,r,o){return async({email:n})=>{var f,c;const a=new FormData;a.append("strategy","magic_link"),a.append("email",n);const s=await t("/auth/signin",{method:"POST",body:a}),p=await V(s);return"data"in p&&((c=(f=p.data)==null?void 0:f.signin_attempts)!=null&&c.length)?(r(p.data.signin_attempts.at(-1)||null),o(null)):o(p),p}}function Rd(t,r){return async({provider:o,redirectUri:n})=>{const a=new URLSearchParams({provider:o});n&&a.append("redirect_uri",n);const s=await t(`/auth/oauth2/init?${a.toString()}`,{method:"POST"}),p=await V(s);return"data"in p?(r(null),p.data.oauth_url&&(window.location.href=p.data.oauth_url)):r(p),p}}function Pd(t,r,o){return async({email:n,username:a,password:s,phone:p,strategy:f})=>{var u,m;const c=new FormData;f&&c.append("strategy",f),n&&c.append("email",n),a&&c.append("username",a),s&&c.append("password",s),p&&c.append("phone",p);const h=await t("/auth/signin",{method:"POST",body:c}),d=await V(h);return"data"in d&&((m=(u=d.data)==null?void 0:u.signin_attempts)!=null&&m.length)?(r(d.data.signin_attempts.at(-1)||null),o(null)):o(d),d}}function Wi(){const{client:t,loading:r}=Me(),[o,n]=i.useState(null),[a,s]=i.useState(null);return r?{loading:!0,signIn:null,signinAttempt:null,discardSignInAttempt:()=>{n(null),s(null)},setSignInAttempt:n,error:null}:{loading:!1,signinAttempt:o,signIn:{createStrategy:Cd(t,n,s),completeVerification:async p=>{var d,u,m,v;const f=new FormData;f.append("verification_code",p);const c=await t(`/auth/attempt-verification?attempt_identifier=${o==null?void 0:o.id}&identifier_type=signin`,{method:"POST",body:f}),h=await V(c);if("data"in h&&((u=(d=h.data)==null?void 0:d.signin_attempts)!=null&&u.length)){const x=h.data.signin_attempts.at(-1);return n(x||null),s(null),h.data}else throw"errors"in h?(s(h),new Error(((v=(m=h.errors)==null?void 0:m[0])==null?void 0:v.message)||"Verification failed")):new Error("Verification failed")},prepareVerification:async p=>{var h;const f=new URL("/auth/prepare-verification",window.location.origin);f.searchParams.set("attempt_identifier",((h=o==null?void 0:o.id)==null?void 0:h.toString())||""),f.searchParams.set("strategy",p.strategy),f.searchParams.set("identifier_type","signin"),p.strategy==="phone_otp"&&p.lastDigits?f.searchParams.set("last_digits",p.lastDigits):(p.strategy==="email_otp"&&p.redirectUri||p.strategy==="magic_link"&&p.redirectUri)&&f.searchParams.set("redirect_uri",p.redirectUri);const c=await t(f.pathname+f.search,{method:"POST"});return V(c)},completeProfile:async p=>{var d;if(!o)throw new Error("No signin attempt found");const f=new FormData;for(const[u,m]of Object.entries(p))m&&f.append(u,m);const c=await t(`/auth/complete-profile?attempt_id=${o.id}`,{method:"POST",body:f}),h=await V(c);if("data"in h&&h.data){const u=(d=h.data.signin_attempts)==null?void 0:d.find(m=>m.id===o.id);return u&&n(u),s(null),h.data}else throw new Error("Profile completion failed")}},discardSignInAttempt:()=>{n(null),s(null)},setSignInAttempt:n,error:a}}function Lr(t){const{loading:r,signIn:o,signinAttempt:n,discardSignInAttempt:a,setSignInAttempt:s,error:p}=Wi();if(r)return{loading:!0,signIn:null,signinAttempt:null,discardSignInAttempt:a,setSignInAttempt:s,error:null};const f=(()=>{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:f,completeVerification:o.completeVerification,prepareVerification:o.prepareVerification,completeProfile:o.completeProfile},discardSignInAttempt:a,setSignInAttempt:s,error:p}}function Td(t,r,o,n){return{create:async a=>{var c,h,d;const s=new FormData;for(const[u,m]of Object.entries(a))s.append(u,m);const p=await t("/auth/signup",{method:"POST",body:s}),f=await V(p);return"data"in f&&((h=(c=f.data)==null?void 0:c.signup_attempts)!=null&&h.length)?(o(((d=f.data.signup_attempts)==null?void 0:d.at(-1))||null),n(null)):n(f),f},prepareVerification:async a=>{var f;const s=new URL("/auth/prepare-verification",window.location.origin);s.searchParams.set("attempt_identifier",((f=r==null?void 0:r.id)==null?void 0:f.toString())||""),s.searchParams.set("strategy",a.strategy),s.searchParams.set("identifier_type","signup"),a.strategy==="phone_otp"&&a.lastDigits?s.searchParams.set("last_digits",a.lastDigits):a.strategy==="email_otp"&&a.redirectUri&&s.searchParams.set("redirect_uri",a.redirectUri);const p=await t(s.pathname+s.search,{method:"POST"});return V(p)},completeVerification:async a=>{var c,h,d,u;const s=new FormData;s.append("verification_code",a);const p=await t(`/auth/attempt-verification?attempt_identifier=${r==null?void 0:r.id}&identifier_type=signup`,{method:"POST",body:s}),f=await V(p);if("data"in f&&((h=(c=f.data)==null?void 0:c.signup_attempts)!=null&&h.length))o(f.data.signup_attempts.at(-1)||null),n(null);else if("errors"in f)throw n(f),new Error(((u=(d=f.errors)==null?void 0:d[0])==null?void 0:u.message)||"Verification failed");return f},validateDeploymentInvitation:async a=>{try{const s=await t(`/deployment/invitations/validate?token=${encodeURIComponent(a)}`,{method:"GET"}),p=await V(s);return"data"in p&&p.data?p.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 Vi(){const{client:t,loading:r}=Me(),[o,n]=i.useState(null),[a,s]=i.useState(null);return r?{loading:!0,signUp:null,signupAttempt:null,discardSignupAttempt:()=>{n(null),s(null)},errors:null}:{loading:!1,signupAttempt:o,discardSignupAttempt:()=>{n(null),s(null)},signUp:Td(t,o,n,s),errors:a}}const qe=()=>{const{adapter:t,deployment:r}=ve(),o=t.useNavigate(),n=(p,f)=>{o?o(p,f):window.location.href=p};return{navigate:n,navigateToSignIn:p=>{if(!r)return;const f=p||window.location.href,c=new URLSearchParams;c.set("redirect_uri",f),(r==null?void 0:r.mode)==="staging"&&c.set("dev_session",localStorage.getItem("__dev_session__")??""),n(`${r.ui_settings.sign_in_page_url}?${c.toString()}`,{replace:!0})},navigateToSignUp:p=>{if(!r)return;const f=p||window.location.href,c=new URLSearchParams;c.set("redirect_uri",f),(r==null?void 0:r.mode)==="staging"&&c.set("dev_session",localStorage.getItem("__dev_session__")??""),n(`${r.ui_settings.sign_up_page_url}?${c.toString()}`,{replace:!0})}}};async function Od(t){const r=await t("/session",{method:"GET"});return(await V(r)).data}async function Md(t,r){const o=await t(`/session/switch-sign-in?sign_in_id=${r}`,{method:"POST"});return V(o)}async function Ad(t,r){const o=r?`/session/sign-out?sign_in_id=${r}`:"/session/sign-out",n=await t(o,{method:"POST"});return V(n)}async function Ld(t,r){const o=await t(`/session/switch-organization${r?`?organization_id=${r}`:""}`,{method:"POST"});return V(o)}async function Dd(t,r){const o=await t(`/session/switch-workspace?workspace_id=${r}`,{method:"POST"});return V(o)}const Ta=new Map,qr=new Map;async function Nd(t,r){const o=await t("/session/token");return V(o)}function Ue(){const{client:t,loading:r}=Me(),{deployment:o}=ve(),{navigate:n}=qe(),{data:a,error:s,mutate:p,isLoading:f}=We(r?null:"/session",()=>Od(t),{refreshInterval:3e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,revalidateIfStale:!1,dedupingInterval:5e3}),c=i.useCallback(async()=>{await p()},[p]),h=i.useCallback(async(u="default")=>{var x;if(!a)throw new Error("no session");const m=Ta.get(u);if(m&&m.expires>Date.now())return(m==null?void 0:m.token)||"";qr.get(u)||qr.set(u,Nd(t));const v=await qr.get(u);if(qr.delete(u),(x=v.errors)!=null&&x.length)throw new Error(v.errors[0].message);return Ta.set(u,v.data),v.data.token},[t,a==null?void 0:a.active_signin]),d=i.useCallback(()=>{if(!o)return;const u=o.ui_settings.sign_in_page_url,m=window.location.href,v=new URL(u);if(v.searchParams.set("redirect_uri",m),o.mode==="staging"){const x=localStorage.getItem("__dev_session__");x&&v.searchParams.set("dev_session",x)}n(v.toString())},[o,n]);return r||!a||f?{loading:!0,error:s,session:null,switchSignIn:null,switchOrganization:null,switchWorkspace:null,signOut:null,getToken:null,addNewAccount:null,refetch:c}:{loading:f,error:s,session:a,switchSignIn:async u=>{await Md(t,u),await p()},signOut:async u=>{await Ad(t,u),await p(),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 Ld(t,u),await p()},switchWorkspace:async u=>{await Dd(t,u),await p()},getToken:h,addNewAccount:d,refetch:c}}const Fd=async t=>(await V(await t("/me"))).data,Bd=async t=>(await V(await t("/me/signins"))).data;function er(){const{client:t,loading:r}=Me(),{data:o,error:n,isLoading:a,mutate:s}=We(r?null:"/user",()=>Fd(t)),p=async P=>{const T=new FormData;for(const[A,D]of Object.entries(P))D!=null&&D!==""&&T.append(A,String(D));const N=await V(await t("/me",{method:"POST",body:T}));return s(),N},f=async()=>await V(await t("/me/email-addresses",{method:"GET"})),c=async P=>await V(await t(`/me/email-addresses/${P}`,{method:"GET"})),h=async P=>{const T=new FormData;return T.append("email",P),await V(await t("/me/email-addresses",{method:"POST",body:T}))},d=async P=>await V(await t(`/me/email-addresses/${P}/delete`,{method:"POST"})),u=async P=>await V(await t(`/me/email-addresses/${P}/prepare-verification`,{method:"POST"})),m=async(P,T)=>await V(await t(`/me/email-addresses/${P}/attempt-verification?code=${T}`,{method:"POST"})),v=async(P,T)=>{const N=new FormData;return N.append("phone_number",P),N.append("country_code",T),await V(await t("/me/phone-numbers",{method:"POST",body:N}))},x=async P=>await V(await t(`/me/phone-numbers/${P}/delete`,{method:"POST"})),w=async P=>await V(await t(`/me/phone-numbers/${P}/prepare-verification`,{method:"POST"})),_=async(P,T)=>{const N=new FormData;return N.append("code",T),await V(await t(`/me/phone-numbers/${P}/attempt-verification`,{method:"POST",body:N}))},z=async P=>{const T=await V(await t(`/me/phone-numbers/${P}/make-primary`,{method:"POST"}));return s(),T},y=async P=>await V(await t(`/me/email-addresses/${P}/make-primary`,{method:"POST"})),I=async()=>(await V(await t("/me/authenticator",{method:"POST"}))).data,C=async(P,T)=>{const N=new FormData;return N.append("authenticator_id",P),T.forEach(D=>{N.append("codes",D)}),await V(await t("/me/authenticator/attempt-verification",{method:"POST",body:N}))},j=async P=>await V(await t(`/me/authenticator/${P}/delete`,{method:"POST"})),b=async()=>(await V(await t("/me/backup-codes",{method:"POST"}))).data,g=async P=>{const T=new FormData;return T.append("file",P),await V(await t("/me/profile-picture",{method:"POST",body:T}))},S=async()=>(await V(await t("/me/backup-codes/regenerate",{method:"POST"}))).data,k=async(P,T)=>{const N=new FormData;return N.append("current_password",P),N.append("new_password",T),await V(await t("/me/update-password",{method:"POST",body:N}))},E=async P=>{const T=new FormData;T.append("current_password",P);const N=await V(await t("/me/remove-password",{method:"POST",body:T}));return s(),N},R=async P=>{const T=new FormData;return T.append("password",P),await V(await t("/me/account/delete",{method:"POST",body:T}))},$=async P=>await V(await t(`/me/social-connections/${P}/disconnect`,{method:"POST"})),O=async({provider:P,redirectUri:T})=>{var D;const N=new URLSearchParams({provider:P});T&&N.append("redirect_uri",T);const A=await V(await t(`/me/init-sso-connection?${N.toString()}`,{method:"POST"}));return"data"in A&&((D=A.data)!=null&&D.oauth_url)&&window.open(A.data.oauth_url,"_blank"),A};return{user:{...o,refetch:s},loading:r||a,error:n||null,updateProfile:p,getEmailAddresses:f,getEmailAddress:c,createEmailAddress:h,deleteEmailAddress:d,prepareEmailVerification:u,attemptEmailVerification:m,makeEmailPrimary:y,createPhoneNumber:v,deletePhoneNumber:x,preparePhoneVerification:w,attemptPhoneVerification:_,makePhonePrimary:z,setupAuthenticator:I,verifyAuthenticator:C,deleteAuthenticator:j,generateBackupCodes:b,regenerateBackupCodes:S,updateProfilePicture:g,disconnectSocialConnection:$,connectSocialAccount:O,updatePassword:k,removePassword:E,deleteAccount:R}}function Gi(){const{client:t,loading:r}=Me(),{data:o,error:n,isLoading:a,mutate:s}=We(r?null:"/me/signins",()=>Bd(t));return{signins:o,error:n||null,removeSignin:async f=>await V(await t(`/me/signins/${f}/signout`,{method:"POST"})),refetch:s,loading:a||r}}var Ve=(t=>(t.Unknown="unknown",t.UserNotFound="USER_NOT_FOUND",t.UserDisabled="USER_DISABLED",t.MissingVerificationCode="missing_verification_code",t.VerificationCodeExpired="verification_code_expired",t.UsernameExists="USERNAME_EXISTS",t.EmailExists="EMAIL_EXISTS",t.InvalidCredentials="INVALID_CREDENTIALS",t.UserAlreadySignedIn="USER_ALREADY_SIGNED_IN",t.PhoneNumberExists="PHONE_NUMBER_EXISTS",t.OauthCompletionFailed="OAUTH_COMPLETION_FAILED",t.ProviderRequired="PROVIDER_REQUIRED",t.CodeRequired="CODE_REQUIRED",t.VerificationStrategyRequired="VERIFICATION_STRATEGY_REQUIRED",t.InvalidState="INVALID_STATE",t.InvalidCode="INVALID_CODE",t.RequiredField="REQUIRED_FIELD",t.BadRequestBody="BAD_REQUEST_BODY",t.ProviderNotConfigured="PROVIDER_NOT_CONFIGURED",t.SignupRestricted="SIGNUP_RESTRICTED",t.SignupWaitlistOnly="SIGNUP_WAITLIST_ONLY",t.EmailNotAllowed="EMAIL_NOT_ALLOWED",t.EmailBlocked="EMAIL_BLOCKED",t.DisposableEmailBlocked="DISPOSABLE_EMAIL_BLOCKED",t.CountryRestricted="COUNTRY_RESTRICTED",t.VoipNumberBlocked="VOIP_NUMBER_BLOCKED",t.BannedKeyword="BANNED_KEYWORD",t.NoAlternativeAuthMethod="NO_ALTERNATIVE_AUTH_METHOD",t.Internal="INTERNAL",t.BadSignInAttempt="BAD_SIGN_IN_ATTEMPT",t))(Ve||{});function Hi(){const{client:t,loading:r}=Me(),[o,n]=i.useState(!1),[a,s]=i.useState(null),p=async f=>{n(!0),s(null);try{const c=new FormData;for(const[u,m]of Object.entries(f))m&&c.append(u,m);const h=await t("/waitlist/join",{method:"POST",body:c}),d=await V(h);return s(d.errors?d:null),d}catch(c){const h={data:null,errors:[{message:c instanceof Error?c.message:"Failed to join waitlist",code:Ve.Unknown}]};return s(h),h}finally{n(!1)}};return r?{loading:!0,error:null,joinWaitlist:null}:{loading:o,error:a,joinWaitlist:p}}const br=()=>{const{organizationMemberships:t,refetch:r,loading:o}=tr(),{client:n}=Me(),{refetch:a}=Ue(),s=i.useCallback(async k=>(await V(await n(`/organizations/${k.id}/roles`,{method:"GET"}))).data,[n]),p=i.useCallback(async k=>(await V(await n(`/organizations/${k.id}/members`,{method:"GET"}))).data,[n]),f=i.useCallback(async k=>(await V(await n(`/organizations/${k.id}/invitations`,{method:"GET"}))).data,[n]),c=i.useCallback(async k=>(await V(await n(`/organizations/${k.id}/domains`,{method:"GET"}))).data,[n]),h=i.useCallback(async(k,E)=>{await n(`/organizations/${k.id}/members/${E.id}/remove`,{method:"POST"}),await r()},[r,n]),d=i.useCallback(async k=>{const E=new FormData;E.append("name",k.name),k.image&&E.append("image",k.image),k.description&&E.append("description",k.description);const R=await V(await n("/organizations",{method:"POST",body:E}));return await r(),await a(),R},[a,r,n]),u=i.useCallback(async(k,E)=>{const R=Object.entries(E).reduce((O,[P,T])=>(T&&O.append(P,T),O),new FormData),$=await V(await n(`/organizations/${k.id}/update`,{method:"POST",body:R}));return await r(),$},[r,n]),m=i.useCallback(async(k,E)=>{await n(`/organizations/${k.id}/roles/${E.id}/remove`,{method:"POST"})},[n]),v=i.useCallback(async(k,E)=>{const R=new FormData;return R.append("domain",E.fqdn),await V(await n(`/organizations/${k.id}/domains`,{method:"POST",body:R}))},[n]),x=i.useCallback(async(k,E)=>await V(await n(`/organizations/${k.id}/domains/${E.id}/verify`,{method:"POST"})),[n]),w=i.useCallback(async(k,E)=>await V(await n(`/organizations/${k.id}/domains/${E.id}/remove`,{method:"POST"})),[n]),_=i.useCallback(async(k,E)=>{const R=new FormData;return R.append("name",E.name),E.permissions&&E.permissions.forEach((O,P)=>{R.append(`permissions[${P}]`,O)}),await V(await n(`/organizations/${k.id}/roles`,{method:"POST",body:R}))},[n]),z=i.useCallback(async k=>(await V(await n(`/organizations/${k.id}/leave`,{method:"POST"}))).data,[n]),y=i.useCallback(async k=>{const E=await V(await n(`/organizations/${k.id}/delete`,{method:"POST"}));return await r(),await a(),E.data},[n,r,a]),I=i.useCallback(async(k,E,R)=>(await V(await n(`/organizations/${k.id}/members/${E.id}/roles/${R.id}/add`,{method:"POST"}))).data,[n]),C=i.useCallback(async(k,E,R)=>(await V(await n(`/organizations/${k.id}/members/${E.id}/roles/${R.id}/remove`,{method:"POST"}))).data,[n]),j=i.useCallback(async(k,E)=>{var O,P;const R=new FormData;return R.append("email",E.email),R.append("role_id",E.organizationRole.id),(O=E.workspace)!=null&&O.id&&R.append("workspace_id",E.workspace.id),(P=E.workspaceRole)!=null&&P.id&&R.append("workspace_role_id",E.workspaceRole.id),(await V(await n(`/organizations/${k.id}/invitations`,{method:"POST",body:R}))).data},[n]),b=i.useCallback(async(k,E)=>(await V(await n(`/organizations/${k.id}/invitations/${E.id}/remove`,{method:"POST"}))).data,[n]),g=i.useCallback(async(k,E)=>(await V(await n(`/organizations/${k.id}/invitations/${E.id}/resend`,{method:"POST"}))).data,[n]);return{organizations:i.useMemo(()=>t==null?void 0:t.map(k=>k.organization),[t]),loading:o,error:null,refetch:r,leaveOrganization:z,getOrganizationRoles:s,getOrganizationMembers:p,removeOrganizationMember:h,createOrganization:d,getOrganizationInvitations:f,getOrganizationDomains:c,addOrganizationDomain:v,verifyOrganizationDomain:x,removeOrganizationDomain:w,addRoleToOrganizationMember:I,removeRoleFromOrganizationMember:C,inviteOrganizationMember:j,discardOrganizationInvitation:b,resendOrganizationInvitation:g,updateOrganization:u,addRole:_,removeOrganizationRoles:m,deleteOrganization:y}},Xe=()=>{const{loading:t,error:r,refetch:o,getOrganizationMembers:n,getOrganizationRoles:a,leaveOrganization:s,removeOrganizationMember:p,getOrganizationInvitations:f,getOrganizationDomains:c,removeOrganizationDomain:h,addOrganizationDomain:d,verifyOrganizationDomain:u,addRoleToOrganizationMember:m,removeRoleFromOrganizationMember:v,inviteOrganizationMember:x,discardOrganizationInvitation:w,resendOrganizationInvitation:_,updateOrganization:z,removeOrganizationRoles:y}=br(),{session:I,error:C,loading:j}=Ue(),{organizationMemberships:b}=tr(),g=i.useMemo(()=>{var U;return((U=b==null?void 0:b.find(H=>{var Q;return H.id===((Q=I==null?void 0:I.active_signin)==null?void 0:Q.active_organization_membership_id)}))==null?void 0:U.organization)||null},[b,I]),S=i.useCallback(async U=>g?await z(g,U):[],[g,z]),k=i.useCallback(async()=>g?await n(g):[],[g,n]),E=i.useCallback(async()=>g?await a(g):[],[g,a]),R=i.useCallback(async U=>g?await p(g,U):[],[g,p]),$=i.useCallback(async U=>g?await y(g,U):void 0,[g,y]),O=i.useCallback(async()=>g?await c(g):[],[g,c]),P=i.useCallback(async U=>g?await d(g,U):void 0,[g,d]),T=i.useCallback(async U=>g?await u(g,U):void 0,[g,u]),N=i.useCallback(async U=>g?await h(g,U):void 0,[g,h]),A=i.useCallback(async(U,H)=>g?await m(g,U,H):void 0,[g,m]),D=i.useCallback(async(U,H)=>g?await v(g,U,H):void 0,[g,v]),B=i.useCallback(async U=>g?await x(g,U):void 0,[g,x]),oe=i.useCallback(async U=>g?await w(g,U):void 0,[g,w]),se=i.useCallback(async U=>g?await _(g,U):void 0,[g,_]),ne=i.useCallback(async()=>{g&&await s(g)},[g,s]),K=i.useCallback(async()=>g?await f(g):[],[g,f]);return j||t?{activeOrganization:null,loading:!0,error:C||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}:{activeOrganization:g,loading:!1,refetch:o,getRoles:E,updateOrganization:S,getMembers:k,getDomains:O,addDomain:P,verifyDomain:T,removeDomain:N,getInvitations:K,removeMember:R,leave:ne,removeRole:$,addMemberRole:A,removeMemberRole:D,inviteMember:B,discardInvitation:oe,resendInvitation:se,error:null}};async function Ud(t){return(await V(await t("/me/organization-memberships"))).data}const tr=()=>{const{client:t,loading:r}=Me(),{data:o,isLoading:n,error:a,mutate:s}=We(r?null:"/me/organization-memberships",()=>Ud(t),{refreshInterval:3e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,revalidateIfStale:!1,dedupingInterval:5e3});return{organizationMemberships:o,loading:r||n,error:a,refetch:s}};async function Wd(t){return(await V(await t("/me/workspace-memberships"))).data}async function Vd(t,r,o){return(await V(await t(`/workspaces/${r}/members/${o}/remove`,{method:"POST"}))).data}const pa=()=>{const{client:t,loading:r}=Me(),{data:o,isLoading:n,error:a,mutate:s}=We(r?null:"/me/workspace-memberships",()=>Wd(t),{refreshInterval:3e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,revalidateIfStale:!1,dedupingInterval:5e3});return{workspaceMemberships:o,loading:r||n,error:a,refetch:s}},vt=()=>{const{workspaceMemberships:t,refetch:r,loading:o,error:n}=pa(),{client:a}=Me(),s=i.useMemo(()=>t==null?void 0:t.map(y=>({...y.workspace,organization:y.organization})),[t]),p=i.useCallback(async(y,I,C,j)=>{const b=new FormData;b.append("name",I),C&&b.append("image",C),j&&b.append("description",j),b.append("organization_id",y);const g=await a("/workspaces",{method:"POST",body:b});return await r(),g},[a,r]),f=i.useCallback(async(y,I)=>{const C=await Vd(a,y,I);return await r(),C},[a,r]),c=i.useCallback(async(y,I)=>{const C=new FormData;I.name&&C.append("name",I.name),I.description&&C.append("description",I.description),I.image&&C.append("image",I.image);const j=await V(await a(`/workspaces/${y.id}/update`,{method:"POST",body:C}));return await r(),j.data},[a,r]),h=i.useCallback(async y=>{const I=await V(await a(`/workspaces/${y.id}/delete`,{method:"POST"}));return await r(),I.data},[a,r]),d=i.useCallback(async y=>(await V(await a(`/workspaces/${y.id}/members`,{method:"GET"}))).data,[a]),u=i.useCallback(async y=>(await V(await a(`/workspaces/${y.id}/roles`,{method:"GET"}))).data,[a]),m=i.useCallback(async(y,I,C)=>(await V(await a(`/workspaces/${y.id}/roles`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:I,permissions:C})}))).data,[a]),v=i.useCallback(async(y,I)=>(await V(await a(`/workspaces/${y.id}/roles/${I.id}/delete`,{method:"POST"}))).data,[a]),x=i.useCallback(async(y,I,C)=>(await V(await a(`/workspaces/${y.id}/members`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:I,role_id:C})}))).data,[a]),w=i.useCallback(async(y,I)=>{const C=await V(await a(`/workspaces/${y.id}/members/${I}/remove`,{method:"POST"}));return await r(),C.data},[a,r]),_=i.useCallback(async(y,I,C)=>(await V(await a(`/workspaces/${y.id}/members/${I}/roles/${C}`,{method:"POST"}))).data,[a]),z=i.useCallback(async(y,I,C)=>(await V(await a(`/workspaces/${y.id}/members/${I}/roles/${C}/remove`,{method:"POST"}))).data,[a]);return{workspaces:s||[],loading:o,error:n,refetch:r,leaveWorkspace:f,createWorkspace:p,updateWorkspace:c,deleteWorkspace:h,getWorkspaceMembers:d,getWorkspaceRoles:u,createWorkspaceRole:m,deleteWorkspaceRole:v,inviteWorkspaceMember:x,removeWorkspaceMember:w,addWorkspaceMemberRole:_,removeWorkspaceMemberRole:z}},zt=()=>{const{refetch:t,loading:r,error:o,leaveWorkspace:n,updateWorkspace:a,deleteWorkspace:s,getWorkspaceMembers:p,getWorkspaceRoles:f,createWorkspaceRole:c,deleteWorkspaceRole:h,inviteWorkspaceMember:d,removeWorkspaceMember:u,addWorkspaceMemberRole:m,removeWorkspaceMemberRole:v}=vt(),{workspaceMemberships:x}=pa(),{session:w,loading:_,error:z}=Ue(),y=i.useMemo(()=>{var N;return((N=x==null?void 0:x.find(A=>{var D;return A.id===((D=w==null?void 0:w.active_signin)==null?void 0:D.active_workspace_membership_id)}))==null?void 0:N.workspace)||null},[x,w]),I=i.useCallback(async()=>{var N;if(!(!y||!((N=w==null?void 0:w.active_signin)!=null&&N.user_id)))return await n(y.id,w.active_signin.user_id)},[y,n,w]),C=i.useCallback(async N=>{if(y)return await a(y,N)},[y,a]),j=i.useCallback(async()=>{if(y)return await s(y)},[y,s]),b=i.useCallback(async()=>y?await p(y):[],[y,p]),g=i.useCallback(async()=>y?await f(y):[],[y,f]),S=i.useCallback(async(N,A)=>{if(y)return await c(y,N,A)},[y,c]),k=i.useCallback(async N=>{if(y)return await h(y,N)},[y,h]),E=i.useCallback(async(N,A)=>{if(y)return await d(y,N,A)},[y,d]),R=i.useCallback(async N=>{if(y)return await u(y,N)},[y,u]),$=i.useCallback(async(N,A)=>{if(y)return await m(y,N,A)},[y,m]),O=i.useCallback(async(N,A)=>{if(y)return await v(y,N,A)},[y,v]),P=r||_,T=o||z;return P?{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:y,loading:!1,error:T,refetch:t,leave:I,updateWorkspace:C,deleteWorkspace:j,getMembers:b,getRoles:g,createRole:S,deleteRole:k,inviteMember:E,removeMember:R,addMemberRole:$,removeMemberRole:O}};function qi(){const{client:t,loading:r}=Me(),[o,n]=i.useState(!1),[a,s]=i.useState(null),[p,f]=i.useState(null),[c,h]=i.useState(null),[d,u]=i.useState(!1),[m,v]=i.useState(null);i.useEffect(()=>{if(d||r)return;const w=new URLSearchParams(window.location.search),_=w.get("code"),z=w.get("state"),y=w.get("error"),I=w.get("error_description");if(!_&&!y){u(!0);const C=new Error("No OAuth callback data found.");s(C);return}if(u(!0),n(!0),y){const C=I||y,j=new Error(`OAuth Error: ${C}`);s(j),n(!1);return}if(_&&z)x(_,z);else{const C=new Error("Missing required OAuth parameters");s(C),n(!1)}},[d,r]);const x=async(w,_)=>{try{let z,y;try{const j=_.split(".");if(j.length!==2)throw new Error("Invalid OAuth state format - missing signature");const b=j[0].replace(/-/g,"+").replace(/_/g,"/"),g=b.length%4?"=".repeat(4-b.length%4):"",k=atob(b+g).split("|")[0];if(k==="sign_in")z="/auth/oauth2/callback",y="GET";else if(k==="connect_social")z="/me/sso-connection-callback",y="POST";else throw new Error(`Unknown OAuth action: ${k}`)}catch(j){const b=j instanceof Error?j:new Error("Failed to parse OAuth state");s(new Error(`Invalid OAuth callback: ${b.message}. The authorization link may be expired or malformed. Please try signing in again.`)),n(!1);return}const I=await t(`${z}?code=${encodeURIComponent(w)}&state=${encodeURIComponent(_)}`,{method:y}),C=await V(I);if("data"in C){const j=C.data.session,b=C.data.redirect_uri||null;if(f(j),h(b),j.signin_attempts&&j.signin_attempts.length>0){const g=j.signin_attempts.at(-1);g&&v(g)}}else{const j=new Error("SSO callback failed");s(j)}}catch(z){const y=z instanceof Error?z:new Error("Unknown error occurred");s(y)}finally{n(!1)}};return{loading:o,error:a,session:p,redirectUri:c,processed:d,signinAttempt:m}}function Yi(){const{client:t,loading:r}=Me(),[o,n]=i.useState(!1),[a,s]=i.useState(null),[p,f]=i.useState(null);return{loading:r||o,verifyMagicLink:async h=>{if(!h.token||!h.attempt){const d=new Error("Invalid magic link parameters");return s(d),{data:void 0,errors:[{message:d.message,code:Ve.BadRequestBody}]}}n(!0),s(null),f(null);try{const d=new URL("/auth/verify-magic-link",window.location.origin);d.searchParams.set("token",h.token),d.searchParams.set("attempt",h.attempt),h.redirectUri&&d.searchParams.set("redirect_uri",h.redirectUri);const u=await t(d.pathname+d.search,{method:"GET"}),m=await V(u);if(n(!1),"errors"in m&&m.errors){const v=new Error(m.errors[0].message);s(v),f(!1)}else f(!0);return m}catch(d){n(!1);const u=d instanceof Error?d:new Error("Magic link verification failed");return s(u),f(!1),{data:void 0,errors:[{message:u.message,code:Ve.Internal}]}}},error:a,success:p}}function Zi(){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 Ki(){const{client:t,loading:r}=Me(),[o,n]=i.useState(!1),[a,s]=i.useState(null);return{loading:r||o,forgotPassword:async f=>{n(!0),s(null);const c=new FormData;c.append("email",f);const h=await t("/auth/forgot-password",{method:"POST",body:c}),d=await V(h);return n(!1),"errors"in d&&d.errors&&s(new Error(d.errors[0].message)),d},error:a}}function Qi(){const{client:t,loading:r}=Me(),[o,n]=i.useState(!1),[a,s]=i.useState(null);return{loading:r||o,resetPassword:async(f,c,h)=>{n(!0),s(null);const d=new FormData;d.append("email",f),d.append("otp",c),d.append("password",h);const u=await t("/auth/reset-password",{method:"POST",body:d}),m=await V(u);return n(!1),"errors"in m&&m.errors&&s(new Error(m.errors[0].message)),m},error:a}}function Xi({enabled:t=!0,channels:r,organizationIds:o,workspaceIds:n,onNotification:a,onError:s,reconnectDelay:p=1e3,maxReconnectAttempts:f=5}={}){const{session:c,loading:h}=Ue(),{deployment:d,loading:u}=ve(),[m,v]=i.useState(!1),[x,w]=i.useState(null),_=i.useRef(null),z=i.useRef(null),y=i.useRef(0),I=i.useRef(null),C=i.useRef(a),j=i.useRef(s),b=i.useRef(r),g=i.useRef(o),S=i.useRef(n),k=i.useRef(p),E=i.useRef(f);C.current=a,j.current=s,b.current=r,g.current=o,S.current=n,k.current=p,E.current=f;const R=i.useCallback(()=>{z.current&&(clearTimeout(z.current),z.current=null),I.current&&(clearInterval(I.current),I.current=null),_.current&&(_.current.close(),_.current=null)},[]),$=i.useCallback(async()=>{var D;if(!t||h||u||!c||!d)return;R();const T=new URL(d.backend_host),N=T.protocol==="https:"?"wss:":"ws:",A=new URL("/realtime/notifications",`${N}//${T.host}`);if(d.mode==="staging"){const B=localStorage.getItem("__dev_session__");B&&A.searchParams.set("__dev_session__",B)}b.current&&b.current.length>0&&b.current.forEach(B=>A.searchParams.append("channels",B)),g.current&&g.current.length>0&&g.current.forEach(B=>A.searchParams.append("organization_ids",B.toString())),S.current&&S.current.length>0&&S.current.forEach(B=>A.searchParams.append("workspace_ids",B.toString()));try{const B=new WebSocket(A.toString());_.current=B,B.onopen=()=>{v(!0),w(null),y.current=0,I.current=setInterval(()=>{B.readyState===WebSocket.OPEN&&B.send("ping")},3e4)},B.onmessage=oe=>{var se,ne;try{const K=JSON.parse(oe.data);if(K.type==="notification"&&K.data)(se=C.current)==null||se.call(C,K.data);else if(K.type==="error"){const U=K.error||"Unknown error occurred";w(U),(ne=j.current)==null||ne.call(j,U)}else K.type}catch{}},B.onerror=()=>{var oe;w("Connection error occurred"),(oe=j.current)==null||oe.call(j,"Connection error occurred")},B.onclose=oe=>{var se;if(v(!1),I.current&&(clearInterval(I.current),I.current=null),t&&oe.code!==1e3&&y.current<E.current){y.current++;const ne=k.current*Math.pow(2,y.current-1);z.current=setTimeout(()=>{$()},ne)}else y.current>=E.current&&(w("Max reconnection attempts reached"),(se=j.current)==null||se.call(j,"Max reconnection attempts reached"))}}catch{w("Failed to connect"),(D=j.current)==null||D.call(j,"Failed to connect")}},[t,h,u,c,d,R]);i.useEffect(()=>($(),()=>{R()}),[$,R]),i.useEffect(()=>{_.current&&_.current.readyState===WebSocket.OPEN&&$()},[r,o,n,$]);const O=i.useCallback(()=>{R(),v(!1)},[R]),P=i.useCallback(()=>{y.current=0,$()},[$]);return{isConnected:m,connectionError:x,disconnect:O,reconnect:P}}async function Gd(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(p=>o.append("channels",p)),r.organization_ids&&r.organization_ids.forEach(p=>o.append("organization_ids",p.toString())),r.workspace_ids&&r.workspace_ids.forEach(p=>o.append("workspace_ids",p.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():""}`,a=await t(n,{method:"GET"});return(await V(a)).data}async function Hd(t){const r=await t("/notifications/channel-counts",{method:"GET"});return(await V(r)).data}async function qd(t,r){const o=await t(`/notifications/${r}/read`,{method:"POST"});return V(o)}async function Yd(t){const r=await t("/notifications/mark-all-read",{method:"POST"});return V(r)}async function Zd(t,r){const o=await t(`/notifications/${r}/delete`,{method:"POST"});return V(o)}function Ji(t){const{client:r,loading:o}=Me(),{data:n,error:a,mutate:s,isLoading:p}=We(o?null:["notifications",JSON.stringify(t)],()=>Gd(r,t),{refreshInterval:6e4,revalidateOnFocus:!0});Xi({enabled:!o&&!!n,onNotification:i.useCallback(u=>{s(async m=>!m||m.notifications.some(x=>x.id===u.id.toString())?m:{...m,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},...m.notifications],unread_count:m.unread_count+1,total:m.total+1},!1)},[s]),onError:i.useCallback(()=>{},[])});const f=i.useCallback(async u=>{o||(await s(async m=>m&&{...m,notifications:m.notifications.map(v=>v.id===u?{...v,is_read:!0}:v),unread_count:Math.max(0,m.unread_count-1)},!1),await qd(r,u),await s())},[r,o,s]),c=i.useCallback(async()=>{o||(await s(async u=>u&&{...u,notifications:u.notifications.map(m=>({...m,is_read:!0})),unread_count:0},!1),await Yd(r),await s())},[r,s]),h=i.useCallback(async u=>{o||(await s(async m=>{if(!m)return m;const v=m.notifications.find(x=>x.id===u);return{...m,notifications:m.notifications.filter(x=>x.id!==u),unread_count:v&&!v.is_read?Math.max(0,m.unread_count-1):m.unread_count,total:Math.max(0,m.total-1)}},!1),await Zd(r,u),await s())},[r,o,s]),d=i.useCallback(async()=>{await s()},[s]);return!n||o||p?{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:a,refetch:d}:{loading:!1,error:a,notifications:n.notifications,unreadCount:n.unread_count,unreadCounts:n.unread_counts,channels:n.channels,hasMore:n.has_more,markAsRead:f,markAllAsRead:c,deleteNotification:h,refetch:d}}async function Kd(t){const r=await t("/notifications/channel-counts",{method:"GET"});return(await V(r)).data}function Qd(){const{client:t,loading:r}=Me(),{data:o,error:n,mutate:a}=We(r?null:["notifications","channel-counts"],()=>Kd(t),{refreshInterval:3e4,revalidateOnFocus:!0}),s=async()=>{await a()};return!o||r?{loading:!0,counts:void 0,error:n,refetch:s}:{loading:!1,counts:o,error:n,refetch:s}}const Vt=class Vt{constructor(){Je(this,"ws",null);Je(this,"messageHandlers",new Set);Je(this,"connectionStateHandlers",new Set);Je(this,"reconnectTimer",null);Je(this,"reconnectAttempts",0);Je(this,"url",null);Je(this,"isIntentionalDisconnect",!1);Je(this,"sessionMessages",{});Je(this,"currentSessionKey",null)}static getInstance(){return Vt.instance||(Vt.instance=new Vt),Vt.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]=[])}};Je(Vt,"instance");let Qn=Vt;const Ye=Qn.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"},Pt={IDLE:"Idle",STARTING:"Starting",RUNNING:"Running",WAITING_FOR_INPUT:"WaitingForInput",COMPLETED:"Completed",FAILED:"Failed",CANCELLED:"Cancelled"};function Oa(t){switch(t){case Pt.IDLE:return Ae.IDLE;case Pt.STARTING:return Ae.STARTING;case Pt.RUNNING:return Ae.RUNNING;case Pt.WAITING_FOR_INPUT:return Ae.WAITING_FOR_INPUT;case Pt.COMPLETED:return Ae.COMPLETED;case Pt.FAILED:case Pt.CANCELLED:return Ae.FAILED;default:return Ae.IDLE}}function Ma(t){return t===Ae.STARTING||t===Ae.RUNNING||t===Ae.WAITING_FOR_INPUT}function ec({contextId:t,agentName:r,token:o,platformAdapter:n,autoConnect:a=!0}){const{deployment:s}=ve(),{client:p}=Me(),[f,c]=i.useState([]),[h,d]=i.useState(null),[u,m]=i.useState(null),[v,x]=i.useState(!1),[w,_]=i.useState(!1),[z,y]=i.useState(Ae.IDLE),[I,C]=i.useState({status:mt.DISCONNECTED}),[j,b]=i.useState(!0),[g,S]=i.useState(!1),k=i.useRef(null),E=i.useRef(null),R=i.useCallback(K=>{var U,H;switch(K.message_type){case"session_connected":if(x(!0),C({status:mt.CONNECTED}),(U=K.data)!=null&&U.execution_status){const ae=K.data.execution_status,te=Oa(ae);y(te),_(Ma(te))}break;case"conversation_message":$(K.data);break;case"user_input_request":O(K.data);break;case"platform_event":P(K.data);break;case"platform_function":T(K.data);break;case"execution_complete":_(!1),y(Ae.IDLE),E.current=null;break;case"execution_error":_(!1),y(Ae.FAILED),E.current=null;break;case"execution_cancelled":_(!1),y(Ae.IDLE),E.current=null;break;case"execution_status":const Q=(H=K.data)==null?void 0:H.status;if(Q){const ae=Oa(Q);y(ae),_(Ma(ae))}break}},[h]),$=i.useCallback(K=>{var te,ee,Y,de,ue,F,M,W;const{id:U,message_type:H,content:Q}=K,ae=L=>f.some(G=>G.id===L);if(H==="system_decision"||H==="action_execution_result"||H==="assistant_task_breakdown"||H==="assistant_validation"||H==="assistant_action_planning"||H==="context_results"){d(null),m(null);let L="";if(H==="system_decision"){const G=Q==null?void 0:Q.step,re=Q==null?void 0:Q.reasoning;if(G==="gathercontext")re&&re.length>0?L=re.length>60?`${re.substring(0,60)}...`:re:L="Gathering context...";else if(G==="executeaction")L="Executing action";else if(G==="deliverresponse")L="Preparing response";else if(G==="taskplanning")L="Planning approach";else if(G==="validateprogress")L="Validating progress";else if(G==="acknowledge")L="Processing request";else if(G==="finishplanning")L="Finalizing plan";else if(G==="executetasks")L="Executing tasks";else if(G==="requestuserinput")L="Waiting for input";else if(G==="complete")L="Completed";else if(G==="examinetool")L="Examining tool";else if(G==="examineworkflow")L="Examining workflow";else{const pe=(Q==null?void 0:Q.confidence)||.5;pe>.8?L="Analyzing":pe>.6?L="Thinking":L="Reasoning"}}else if(H==="action_execution_result")((te=Q.task_execution)==null?void 0:te.status)==="completed"?L="Task execution completed":(ee=Q.task_execution)!=null&&ee.approach?L=Q.task_execution.approach:L="Executing task";else if(H==="assistant_task_breakdown")(Y=Q.task_breakdown)!=null&&Y.total_tasks?L=`Identified ${Q.task_breakdown.total_tasks} tasks`:L="Planning tasks";else if(H==="assistant_validation")L="Validated results";else if(H==="assistant_action_planning")(de=Q.task_execution)!=null&&de.total_tasks?L=`Planned ${Q.task_execution.total_tasks} tasks`:(F=(ue=Q.task_execution)==null?void 0:ue.tasks)!=null&&F.length?L=`Planned ${Q.task_execution.tasks.length} tasks`:L="Planning actions";else if(H==="context_results"){const G=Q.query,re=Q.result_count||0;G&&G!=="General context gathering"?L=`${G}: Found ${re} results`:L=`Found ${re} results`}L&&!ae(U)&&c(G=>[...G,{id:U,role:"system",content:L,timestamp:new Date,metadata:{type:"log",messageType:H}}]);return}if(H==="user_message")ae(U)||(d(null),m(null),c(L=>[...L,{id:U,role:"user",content:Q.message,images:Q.images,timestamp:new Date}]));else if(H==="agent_response")ae(U)||(d(null),m(null),_(!1),y(Ae.IDLE),E.current=null,c(L=>[...L,{id:U,role:"assistant",content:Q.response,timestamp:new Date,isStreaming:!1}]));else if(H==="assistant_acknowledgment")ae(U)||(d(null),m(null),c(L=>[...L,{id:U,role:"assistant",content:Q.acknowledgment_message,timestamp:new Date}]));else if(H==="assistant_ideation"||H==="assistant_action_planning"||H==="action_execution_result"||H==="assistant_validation"||H==="assistant_context_gathering"||H==="assistant_task_breakdown"){let L="";if(Q.reasoning_summary)L=Q.reasoning_summary;else if((M=Q.task_execution)!=null&&M.approach)L=Q.task_execution.approach;else if(Q.strategic_synthesis)L=Q.strategic_synthesis;else if((W=Q.task_breakdown)!=null&&W.total_tasks)L=`Breaking down into ${Q.task_breakdown.total_tasks} tasks...`;else if(Q.acknowledgment_message)L=Q.acknowledgment_message;else return;c(G=>[...G,{id:U,role:"assistant",content:L,timestamp:new Date}])}else if(H==="user_input_request"){const L={question:Q.question,context:Q.context,input_type:Q.input_type,options:Q.options||Q.suggestions,default_value:Q.default_value,placeholder:Q.placeholder};y("waiting_for_input"),c(G=>[...G,{id:U,role:"system",content:L.question,timestamp:new Date,metadata:{type:"user_input_request",userInputRequest:L}}])}},[]),O=i.useCallback(async K=>{y("waiting_for_input");const U=`input-request-${Date.now()}`;c(H=>[...H,{id:U,role:"system",content:K.question,timestamp:new Date,metadata:{type:"user_input_request",userInputRequest:K}}])},[]),P=i.useCallback(K=>{const{event_label:U,event_data:H}=K;n!=null&&n.onPlatformEvent&&n.onPlatformEvent(U,H)},[n]),T=i.useCallback(async K=>{const{function_name:U,function_data:H}=K,{parameters:Q,execution_id:ae}=H;if(!(n!=null&&n.onPlatformFunction)){Ye.send({message_type:{platform_function_result:[ae,{error:"No platform function handler registered"}]},data:{}});return}try{const te=await n.onPlatformFunction(U,Q,ae),ee={message_type:{platform_function_result:[ae,te]},data:{}};Ye.send(ee)}catch(te){Ye.send({message_type:{platform_function_result:[ae,{error:te instanceof Error?te.message:"Function execution failed",stack:te instanceof Error?te.stack:void 0}]},data:{}})}},[n]);i.useEffect(()=>{if(!s)return;const U=`wss://${s==null?void 0:s.backend_host.replace(/https?:\/\//,"")}/realtime/agent?token=${encodeURIComponent(o)}`;C({status:mt.CONNECTING}),Ye.connect(U)},[s,o]),i.useEffect(()=>Ye.onConnectionStateChange(U=>{C({status:U.isConnected?mt.CONNECTED:U.error?mt.ERROR:mt.DISCONNECTED}),x(U.isConnected)}),[]),i.useEffect(()=>Ye.onMessage(R),[R]),i.useEffect(()=>{v&&t&&r&&a&&Ye.send({message_type:{session_connect:[t,r]},data:{}})},[v,t,r,a]);const N=i.useCallback(async()=>(v&&t&&r&&Ye.send({message_type:{session_connect:[t,r]},data:{}}),()=>{}),[v,t,r]),A=i.useCallback((K,U)=>{v&&(d(K),m(U||null),_(!0),y(Ae.STARTING),Ye.send({message_type:{message_input:K},data:U?{images:U}:{}}))},[v]),D=i.useCallback(()=>{c([]),E.current=null},[]),B=i.useCallback(K=>{!v||z!==Ae.WAITING_FOR_INPUT||(Ye.send({message_type:{user_input_response:K},data:{}}),y(Ae.RUNNING))},[v,z]),oe=i.useCallback(async K=>{var U;if(!(!o||!t))try{const H=new URLSearchParams({token:o,limit:"50"});K&&(H.append("before_id",K),S(!0));const ae=await(await p(`/api/agent/contexts/${t}/messages?${H}`,{method:"GET"})).json();if(ae.status===200&&ae.data){const te=ae.data;if(Array.isArray(te.data)){const ee=te.data.filter(Y=>{var F;let de=Y.content;if(typeof Y.content=="string")try{de=JSON.parse(Y.content)}catch{de={message:Y.content}}const ue=((F=Y.metadata)==null?void 0:F.message_type)||(de==null?void 0:de.message_type);return ue==="user_message"||ue==="agent_response"||ue==="assistant_acknowledgment"||ue==="user_input_request"||ue==="system_decision"||ue==="action_execution_result"||ue==="assistant_task_breakdown"||ue==="assistant_validation"||ue==="assistant_action_planning"||ue==="context_results"}).map(Y=>{var L,G,re,pe,we,Te,q;let de="",ue,F,M=Y.content;if(typeof Y.content=="string")try{M=JSON.parse(Y.content)}catch{M=Y.content}const W=((L=Y.metadata)==null?void 0:L.message_type)||(M==null?void 0:M.message_type);if(W==="user_message"?(de=(M==null?void 0:M.message)||"",ue=(M==null?void 0:M.images)||void 0):W==="agent_response"?de=(M==null?void 0:M.response)||"":W==="assistant_acknowledgment"?de=(M==null?void 0:M.acknowledgment_message)||"":W==="user_input_request"&&(de=(M==null?void 0:M.question)||"",F={type:"user_input_request",userInputRequest:{question:(M==null?void 0:M.question)||"",context:(M==null?void 0:M.context)||"",input_type:(M==null?void 0:M.input_type)||"text",options:(M==null?void 0:M.options)||(M==null?void 0:M.suggestions)||[],default_value:(M==null?void 0:M.default_value)||"",placeholder:(M==null?void 0:M.placeholder)||""}}),W==="system_decision"||W==="action_execution_result"||W==="assistant_task_breakdown"||W==="assistant_validation"||W==="assistant_action_planning"||W==="context_results"){let J="";if(W==="system_decision"){const Z=M==null?void 0:M.step,ce=M==null?void 0:M.reasoning;if(Z==="gathercontext")ce&&ce.length>0?J=ce.length>60?`${ce.substring(0,60)}...`:ce:J="Gathering context...";else if(Z==="executeaction")J="Executing action";else if(Z==="deliverresponse")J="Preparing response";else if(Z==="taskplanning")J="Planning approach";else if(Z==="validateprogress")J="Validating progress";else if(Z==="acknowledge")J="Processing request";else if(Z==="finishplanning")J="Finalizing plan";else if(Z==="executetasks")J="Executing tasks";else if(Z==="requestuserinput")J="Waiting for input";else if(Z==="complete")J="Completed";else if(Z==="examinetool")J="Examining tool";else if(Z==="examineworkflow")J="Examining workflow";else{const je=(M==null?void 0:M.confidence)||.5;je>.8?J="Analyzing":je>.6?J="Thinking":J="Reasoning"}}else if(W==="action_execution_result")((G=M==null?void 0:M.task_execution)==null?void 0:G.status)==="completed"?J="Task execution completed":(re=M==null?void 0:M.task_execution)!=null&&re.approach?J=M.task_execution.approach:J="Executing task";else if(W==="assistant_task_breakdown")(pe=M==null?void 0:M.task_breakdown)!=null&&pe.total_tasks?J=`Identified ${M.task_breakdown.total_tasks} tasks`:J="Planning tasks";else if(W==="assistant_validation")J="Validated results";else if(W==="assistant_action_planning")(we=M==null?void 0:M.task_execution)!=null&&we.total_tasks?J=`Planned ${M.task_execution.total_tasks} tasks`:(q=(Te=M==null?void 0:M.task_execution)==null?void 0:Te.tasks)!=null&&q.length?J=`Planned ${M.task_execution.tasks.length} tasks`:J="Planning actions";else if(W==="context_results"){const Z=M==null?void 0:M.query,ce=(M==null?void 0:M.result_count)||0;Z&&Z!=="General context gathering"?J=`${Z}: Found ${ce} results`:J=`Found ${ce} results`}de=J,F={type:"log",messageType:W}}return{id:Y.id,role:W==="user_message"?"user":W==="user_input_request"?"system":"assistant",content:de,images:ue,timestamp:new Date(Y.timestamp||Y.created_at||Date.now()),metadata:F}}).filter(Y=>Y.content||Y.metadata||Y.images).sort((Y,de)=>{const ue=BigInt(Y.id),F=BigInt(de.id);return ue<F?-1:ue>F?1:0});ee.length>0&&(k.current=ee[0].id),K?(c(Y=>[...ee,...Y]),b(ee.length>=50)):(c(ee),ee.length>0&&((U=ee[ee.length-1].metadata)==null?void 0:U.type)==="user_input_request"&&y(Ae.WAITING_FOR_INPUT)),S(!1)}}}catch(H){console.error("Failed to fetch messages:",H),S(!1)}},[o,t,p]);i.useEffect(()=>{t&&o&&oe()},[t,o]);const se=i.useCallback(async()=>{if(!(g||!j||!k.current)){S(!0);try{await oe(k.current)}finally{S(!1)}}},[g,j,oe]),ne=i.useCallback(()=>{!v||!w||(Ye.send({message_type:{cancel_execution:null},data:{}}),_(!1),y("idle"))},[v,w]);return{messages:f,pendingMessage:h,pendingImages:u,connectionState:I,isConnected:v,isExecuting:w,executionStatus:z,isWaitingForInput:z==="waiting_for_input",hasMoreMessages:j,isLoadingMore:g,sendMessage:A,submitUserInput:B,clearMessages:D,loadMoreMessages:se,cancelExecution:ne,connect:N,disconnect:()=>Ye.disconnect()}}const tc=()=>{const{client:t}=Me(),[r,o]=i.useState(!1),[n,a]=i.useState(null),[s,p]=i.useState(null),f=i.useCallback(async h=>{o(!0),a(null),p(null);try{const d=await t("/organizations/invitations/accept",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:h})}),m=(await V(d)).data;return p(m),m.error_code&&a(m.message||"Failed to accept invitation"),m}catch(d){const u=d.message||"Failed to accept invitation";a(u);const m={error_code:"NETWORK_ERROR",message:u};return p(m),m}finally{o(!1)}},[t]),c=i.useCallback(()=>{a(null),p(null)},[]);return{acceptInvitation:f,invitationData:s,loading:r,error:n,reset:c}},Xd=({children:t})=>{const{loading:r}=ve();return r?null:e.jsx(e.Fragment,{children:t})},Jd=({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,a=arguments.length;n<a;n++){o=arguments[n];for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])}return r},He.apply(this,arguments)};function Kt(t,r,o){if(o||arguments.length===2)for(var n=0,a=r.length,s;n<a;n++)(s||!(n in r))&&(s||(s=Array.prototype.slice.call(r,0,n)),s[n]=r[n]);return t.concat(s||Array.prototype.slice.call(r))}function eu(t){var r=Object.create(null);return function(o){return r[o]===void 0&&(r[o]=t(o)),r[o]}}var tu=/^((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)-.*))$/,ru=eu(function(t){return tu.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),$e="-ms-",Mr="-moz-",ke="-webkit-",rc="comm",Uo="rule",ha="decl",ou="@import",oc="@keyframes",nu="@layer",nc=Math.abs,fa=String.fromCharCode,Xn=Object.assign;function au(t,r){return Fe(t,0)^45?(((r<<2^Fe(t,0))<<2^Fe(t,1))<<2^Fe(t,2))<<2^Fe(t,3):0}function ac(t){return t.trim()}function gt(t,r){return(t=r.exec(t))?t[0]:t}function ge(t,r,o){return t.replace(r,o)}function _o(t,r,o){return t.indexOf(r,o)}function Fe(t,r){return t.charCodeAt(r)|0}function hr(t,r,o){return t.slice(r,o)}function it(t){return t.length}function sc(t){return t.length}function Tr(t,r){return r.push(t),t}function su(t,r){return t.map(r).join("")}function Aa(t,r){return t.filter(function(o){return!gt(o,r)})}var Wo=1,fr=1,ic=0,Ke=0,Le=0,yr="";function Vo(t,r,o,n,a,s,p,f){return{value:t,root:r,parent:o,type:n,props:a,children:s,line:Wo,column:fr,length:p,return:"",siblings:f}}function _t(t,r){return Xn(Vo("",null,null,"",null,null,0,t.siblings),t,{length:-t.length},r)}function nr(t){for(;t.root;)t=_t(t.root,{children:[t]});Tr(t,t.siblings)}function iu(){return Le}function cu(){return Le=Ke>0?Fe(yr,--Ke):0,fr--,Le===10&&(fr=1,Wo--),Le}function et(){return Le=Ke<ic?Fe(yr,Ke++):0,fr++,Le===10&&(fr=1,Wo++),Le}function Ht(){return Fe(yr,Ke)}function Co(){return Ke}function Go(t,r){return hr(yr,t,r)}function Jn(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 lu(t){return Wo=fr=1,ic=it(yr=t),Ke=0,[]}function du(t){return yr="",t}function un(t){return ac(Go(Ke-1,ea(t===91?t+2:t===40?t+1:t)))}function uu(t){for(;(Le=Ht())&&Le<33;)et();return Jn(t)>2||Jn(Le)>3?"":" "}function pu(t,r){for(;--r&&et()&&!(Le<48||Le>102||Le>57&&Le<65||Le>70&&Le<97););return Go(t,Co()+(r<6&&Ht()==32&&et()==32))}function ea(t){for(;et();)switch(Le){case t:return Ke;case 34:case 39:t!==34&&t!==39&&ea(Le);break;case 40:t===41&&ea(t);break;case 92:et();break}return Ke}function hu(t,r){for(;et()&&t+Le!==57;)if(t+Le===84&&Ht()===47)break;return"/*"+Go(r,Ke-1)+"*"+fa(t===47?t:et())}function fu(t){for(;!Jn(Ht());)et();return Go(t,Ke)}function gu(t){return du(So("",null,null,null,[""],t=lu(t),0,[0],t))}function So(t,r,o,n,a,s,p,f,c){for(var h=0,d=0,u=p,m=0,v=0,x=0,w=1,_=1,z=1,y=0,I="",C=a,j=s,b=n,g=I;_;)switch(x=y,y=et()){case 40:if(x!=108&&Fe(g,u-1)==58){_o(g+=ge(un(y),"&","&\f"),"&\f",nc(h?f[h-1]:0))!=-1&&(z=-1);break}case 34:case 39:case 91:g+=un(y);break;case 9:case 10:case 13:case 32:g+=uu(x);break;case 92:g+=pu(Co()-1,7);continue;case 47:switch(Ht()){case 42:case 47:Tr(mu(hu(et(),Co()),r,o,c),c);break;default:g+="/"}break;case 123*w:f[h++]=it(g)*z;case 125*w:case 59:case 0:switch(y){case 0:case 125:_=0;case 59+d:z==-1&&(g=ge(g,/\f/g,"")),v>0&&it(g)-u&&Tr(v>32?Da(g+";",n,o,u-1,c):Da(ge(g," ","")+";",n,o,u-2,c),c);break;case 59:g+=";";default:if(Tr(b=La(g,r,o,h,d,a,f,I,C=[],j=[],u,s),s),y===123)if(d===0)So(g,r,b,b,C,s,u,f,j);else switch(m===99&&Fe(g,3)===110?100:m){case 100:case 108:case 109:case 115:So(t,b,b,n&&Tr(La(t,b,b,0,0,a,f,I,a,C=[],u,j),j),a,j,u,f,n?C:j);break;default:So(g,b,b,b,[""],j,0,f,j)}}h=d=v=0,w=z=1,I=g="",u=p;break;case 58:u=1+it(g),v=x;default:if(w<1){if(y==123)--w;else if(y==125&&w++==0&&cu()==125)continue}switch(g+=fa(y),y*w){case 38:z=d>0?1:(g+="\f",-1);break;case 44:f[h++]=(it(g)-1)*z,z=1;break;case 64:Ht()===45&&(g+=un(et())),m=Ht(),d=u=it(I=g+=fu(Co())),y++;break;case 45:x===45&&it(g)==2&&(w=0)}}return s}function La(t,r,o,n,a,s,p,f,c,h,d,u){for(var m=a-1,v=a===0?s:[""],x=sc(v),w=0,_=0,z=0;w<n;++w)for(var y=0,I=hr(t,m+1,m=nc(_=p[w])),C=t;y<x;++y)(C=ac(_>0?v[y]+" "+I:ge(I,/&\f/g,v[y])))&&(c[z++]=C);return Vo(t,r,o,a===0?Uo:f,c,h,d,u)}function mu(t,r,o,n){return Vo(t,r,o,rc,fa(iu()),hr(t,2,-2),0,n)}function Da(t,r,o,n,a){return Vo(t,r,o,ha,hr(t,0,n),hr(t,n+1,-1),n,a)}function cc(t,r,o){switch(au(t,r)){case 5103:return ke+"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 ke+t+t;case 4789:return Mr+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return ke+t+Mr+t+$e+t+t;case 5936:switch(Fe(t,r+11)){case 114:return ke+t+$e+ge(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return ke+t+$e+ge(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return ke+t+$e+ge(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return ke+t+$e+t+t;case 6165:return ke+t+$e+"flex-"+t+t;case 5187:return ke+t+ge(t,/(\w+).+(:[^]+)/,ke+"box-$1$2"+$e+"flex-$1$2")+t;case 5443:return ke+t+$e+"flex-item-"+ge(t,/flex-|-self/g,"")+(gt(t,/flex-|baseline/)?"":$e+"grid-row-"+ge(t,/flex-|-self/g,""))+t;case 4675:return ke+t+$e+"flex-line-pack"+ge(t,/align-content|flex-|-self/g,"")+t;case 5548:return ke+t+$e+ge(t,"shrink","negative")+t;case 5292:return ke+t+$e+ge(t,"basis","preferred-size")+t;case 6060:return ke+"box-"+ge(t,"-grow","")+ke+t+$e+ge(t,"grow","positive")+t;case 4554:return ke+ge(t,/([^-])(transform)/g,"$1"+ke+"$2")+t;case 6187:return ge(ge(ge(t,/(zoom-|grab)/,ke+"$1"),/(image-set)/,ke+"$1"),t,"")+t;case 5495:case 3959:return ge(t,/(image-set\([^]*)/,ke+"$1$`$1");case 4968:return ge(ge(t,/(.+:)(flex-)?(.*)/,ke+"box-pack:$3"+$e+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+ke+t+t;case 4200:if(!gt(t,/flex-|baseline/))return $e+"grid-column-align"+hr(t,r)+t;break;case 2592:case 3360:return $e+ge(t,"template-","")+t;case 4384:case 3616:return o&&o.some(function(n,a){return r=a,gt(n.props,/grid-\w+-end/)})?~_o(t+(o=o[r].value),"span",0)?t:$e+ge(t,"-start","")+t+$e+"grid-row-span:"+(~_o(o,"span",0)?gt(o,/\d+/):+gt(o,/\d+/)-+gt(t,/\d+/))+";":$e+ge(t,"-start","")+t;case 4896:case 4128:return o&&o.some(function(n){return gt(n.props,/grid-\w+-start/)})?t:$e+ge(ge(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return ge(t,/(.+)-inline(.+)/,ke+"$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(Fe(t,r+1)){case 109:if(Fe(t,r+4)!==45)break;case 102:return ge(t,/(.+:)(.+)-([^]+)/,"$1"+ke+"$2-$3$1"+Mr+(Fe(t,r+3)==108?"$3":"$2-$3"))+t;case 115:return~_o(t,"stretch",0)?cc(ge(t,"stretch","fill-available"),r,o)+t:t}break;case 5152:case 5920:return ge(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(n,a,s,p,f,c,h){return $e+a+":"+s+h+(p?$e+a+"-span:"+(f?c:+c-+s)+h:"")+t});case 4949:if(Fe(t,r+6)===121)return ge(t,":",":"+ke)+t;break;case 6444:switch(Fe(t,Fe(t,14)===45?18:11)){case 120:return ge(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+ke+(Fe(t,14)===45?"inline-":"")+"box$3$1"+ke+"$2$3$1"+$e+"$2box$3")+t;case 100:return ge(t,":",":"+$e)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return ge(t,"scroll-","scroll-snap-")+t}return t}function Po(t,r){for(var o="",n=0;n<t.length;n++)o+=r(t[n],n,t,r)||"";return o}function xu(t,r,o,n){switch(t.type){case nu:if(t.children.length)break;case ou:case ha:return t.return=t.return||t.value;case rc:return"";case oc:return t.return=t.value+"{"+Po(t.children,n)+"}";case Uo:if(!it(t.value=t.props.join(",")))return""}return it(o=Po(t.children,n))?t.return=t.value+"{"+o+"}":""}function vu(t){var r=sc(t);return function(o,n,a,s){for(var p="",f=0;f<r;f++)p+=t[f](o,n,a,s)||"";return p}}function bu(t){return function(r){r.root||(r=r.return)&&t(r)}}function yu(t,r,o,n){if(t.length>-1&&!t.return)switch(t.type){case ha:t.return=cc(t.value,t.length,o);return;case oc:return Po([_t(t,{value:ge(t.value,"@","@"+ke)})],n);case Uo:if(t.length)return su(o=t.props,function(a){switch(gt(a,n=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":nr(_t(t,{props:[ge(a,/:(read-\w+)/,":"+Mr+"$1")]})),nr(_t(t,{props:[a]})),Xn(t,{props:Aa(o,n)});break;case"::placeholder":nr(_t(t,{props:[ge(a,/:(plac\w+)/,":"+ke+"input-$1")]})),nr(_t(t,{props:[ge(a,/:(plac\w+)/,":"+Mr+"$1")]})),nr(_t(t,{props:[ge(a,/:(plac\w+)/,$e+"input-$1")]})),nr(_t(t,{props:[a]})),Xn(t,{props:Aa(o,n)});break}return""})}}var wu={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},Qt=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",lc="active",dc="data-styled-version",Ho="6.1.19",ga=`/*!sc*/
|
|
18
|
+
*/var Sa;function Hl(){return Sa||(Sa=1,process.env.NODE_ENV!=="production"&&function(){function t(v,x){return v===x&&(v!==0||1/v===1/x)||v!==v&&x!==x}function r(v,x){d||a.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 w=x();if(!u){var _=x();s(w,_)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}_=p({inst:{value:w,getSnapshot:x}});var z=_[0].inst,y=_[1];return c(function(){z.value=w,z.getSnapshot=x,o(z)&&y({inst:z})},[v,w,x]),f(function(){return o(z)&&y({inst:z}),v(function(){o(z)&&y({inst:z})})},[v]),h(w),w}function o(v){var x=v.getSnapshot;v=v.value;try{var w=x();return!s(v,w)}catch{return!0}}function n(v,x){return x()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var a=i,s=typeof Object.is=="function"?Object.is:t,p=a.useState,f=a.useEffect,c=a.useLayoutEffect,h=a.useDebugValue,d=!1,u=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:r;on.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),on}var $a;function ql(){return $a||($a=1,process.env.NODE_ENV==="production"?Vr.exports=Gl():Vr.exports=Hl()),Vr.exports}var Yl=ql();const Ii=0,Ti=1,Oi=2,za=3;var Ea=Object.prototype.hasOwnProperty;function Wn(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--&&Wn(t[n],r[n]););return n===-1}if(!o||typeof t=="object"){n=0;for(o in t)if(Ea.call(t,o)&&++n&&!Ea.call(r,o)||!(o in r)||!Wn(t[o],r[o]))return!1;return Object.keys(r).length===n}}return t!==t&&r!==r}const xt=new WeakMap,Ct=()=>{},Ge=Ct(),Vn=Object,be=t=>t===Ge,ct=t=>typeof t=="function",$t=(t,r)=>({...t,...r}),Mi=t=>ct(t.then),nn={},Gr={},da="undefined",Fr=typeof window!=da,Gn=typeof document!=da,Zl=Fr&&"Deno"in window,Kl=()=>Fr&&typeof window.requestAnimationFrame!=da,Li=(t,r)=>{const o=xt.get(t);return[()=>!be(r)&&t.get(r)||nn,n=>{if(!be(r)){const a=t.get(r);r in Gr||(Gr[r]=a),o[5](r,$t(a,n),a||nn)}},o[6],()=>!be(r)&&r in Gr?Gr[r]:!be(r)&&t.get(r)||nn]};let Hn=!0;const Ql=()=>Hn,[qn,Yn]=Fr&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Ct,Ct],Xl=()=>{const t=Gn&&document.visibilityState;return be(t)||t!=="hidden"},Jl=t=>(Gn&&document.addEventListener("visibilitychange",t),qn("focus",t),()=>{Gn&&document.removeEventListener("visibilitychange",t),Yn("focus",t)}),ed=t=>{const r=()=>{Hn=!0,t()},o=()=>{Hn=!1};return qn("online",r),qn("offline",o),()=>{Yn("online",r),Yn("offline",o)}},td={isOnline:Ql,isVisible:Xl},rd={initFocus:Jl,initReconnect:ed},Pa=!i.useId,Lr=!Fr||Zl,od=t=>Kl()?window.requestAnimationFrame(t):setTimeout(t,1),an=Lr?i.useEffect:i.useLayoutEffect,sn=typeof navigator<"u"&&navigator.connection,Ra=!Lr&&sn&&(["slow-2g","2g"].includes(sn.effectiveType)||sn.saveData),Hr=new WeakMap,nd=t=>Vn.prototype.toString.call(t),cn=(t,r)=>t===`[object ${r}]`;let ad=0;const Zn=t=>{const r=typeof t,o=nd(t),n=cn(o,"Date"),a=cn(o,"RegExp"),s=cn(o,"Object");let p,f;if(Vn(t)===t&&!n&&!a){if(p=Hr.get(t),p)return p;if(p=++ad+"~",Hr.set(t,p),Array.isArray(t)){for(p="@",f=0;f<t.length;f++)p+=Zn(t[f])+",";Hr.set(t,p)}if(s){p="#";const c=Vn.keys(t).sort();for(;!be(f=c.pop());)be(t[f])||(p+=f+":"+Zn(t[f])+",");Hr.set(t,p)}}else p=n?t.toJSON():r=="symbol"?t.toString():r=="string"?JSON.stringify(t):""+t;return p},ua=t=>{if(ct(t))try{t=t()}catch{t=""}const r=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?Zn(t):"",[t,r]};let sd=0;const Kn=()=>++sd;async function Ai(...t){const[r,o,n,a]=t,s=$t({populateCache:!0,throwOnError:!0},typeof a=="boolean"?{revalidate:a}:a||{});let p=s.populateCache;const f=s.rollbackOnError;let c=s.optimisticData;const h=m=>typeof f=="function"?f(m):f!==!1,d=s.throwOnError;if(ct(o)){const m=o,v=[],x=r.keys();for(const w of x)!/^\$(inf|sub)\$/.test(w)&&m(r.get(w)._k)&&v.push(w);return Promise.all(v.map(u))}return u(o);async function u(m){const[v]=ua(m);if(!v)return;const[x,w]=Li(r,v),[_,z,y,P]=xt.get(r),C=()=>{const I=_[v];return(ct(s.revalidate)?s.revalidate(x().data,m):s.revalidate!==!1)&&(delete y[v],delete P[v],I&&I[0])?I[0](Oi).then(()=>x().data):x().data};if(t.length<3)return C();let j=n,b,g=!1;const S=Kn();z[v]=[S,0];const k=!be(c),E=x(),R=E.data,$=E._c,O=be($)?R:$;if(k&&(c=ct(c)?c(O,R):c,w({data:c,_c:O})),ct(j))try{j=j(O)}catch(I){b=I,g=!0}if(j&&Mi(j))if(j=await j.catch(I=>{b=I,g=!0}),S!==z[v][0]){if(g)throw b;return j}else g&&k&&h(b)&&(p=!0,w({data:O,_c:Ge}));if(p&&!g)if(ct(p)){const I=p(j,O);w({data:I,error:Ge,_c:Ge})}else w({data:j,error:Ge,_c:Ge});if(z[v][1]=Kn(),Promise.resolve(C()).then(()=>{w({_c:Ge})}),g){if(d)throw b;return}return j}}const Ia=(t,r)=>{for(const o in t)t[o][0]&&t[o][0](r)},id=(t,r)=>{if(!xt.has(t)){const o=$t(rd,r),n=Object.create(null),a=Ai.bind(Ge,t);let s=Ct;const p=Object.create(null),f=(d,u)=>{const m=p[d]||[];return p[d]=m,m.push(u),()=>m.splice(m.indexOf(u),1)},c=(d,u,m)=>{t.set(d,u);const v=p[d];if(v)for(const x of v)x(u,m)},h=()=>{if(!xt.has(t)&&(xt.set(t,[n,Object.create(null),Object.create(null),Object.create(null),a,c,f]),!Lr)){const d=o.initFocus(setTimeout.bind(Ge,Ia.bind(Ge,n,Ii))),u=o.initReconnect(setTimeout.bind(Ge,Ia.bind(Ge,n,Ti)));s=()=>{d&&d(),u&&u(),xt.delete(t)}}};return h(),[t,a,h,s]}return[t,xt.get(t)[4]]},cd=(t,r,o,n,a)=>{const s=o.errorRetryCount,p=a.retryCount,f=~~((Math.random()+.5)*(1<<(p<8?p:8)))*o.errorRetryInterval;!be(s)&&p>s||setTimeout(n,f,a)},ld=Wn,[Di,dd]=id(new Map),ud=$t({onLoadingSlow:Ct,onSuccess:Ct,onError:Ct,onErrorRetry:cd,onDiscarded:Ct,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Ra?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Ra?5e3:3e3,compare:ld,isPaused:()=>!1,cache:Di,mutate:dd,fallback:{}},td),pd=(t,r)=>{const o=$t(t,r);if(r){const{use:n,fallback:a}=t,{use:s,fallback:p}=r;n&&s&&(o.use=n.concat(s)),a&&p&&(o.fallback=$t(a,p))}return o},hd=i.createContext({}),fd="$inf$",Ni=Fr&&window.__SWR_DEVTOOLS_USE__,gd=Ni?window.__SWR_DEVTOOLS_USE__:[],md=()=>{Ni&&(window.__SWR_DEVTOOLS_REACT__=i)},xd=t=>ct(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],vd=()=>$t(ud,i.useContext(hd)),bd=t=>(r,o,n)=>t(r,o&&((...s)=>{const[p]=ua(r),[,,,f]=xt.get(Di);if(p.startsWith(fd))return o(...s);const c=f[p];return be(c)?o(...s):(delete f[p],c)}),n),yd=gd.concat(bd),wd=t=>function(...o){const n=vd(),[a,s,p]=xd(o),f=pd(n,p);let c=t;const{use:h}=f,d=(h||[]).concat(yd);for(let u=d.length;u--;)c=d[u](c);return c(a,s||f.fetcher||null,f)},jd=(t,r,o)=>{const n=r[t]||(r[t]=[]);return n.push(o),()=>{const a=n.indexOf(o);a>=0&&(n[a]=n[n.length-1],n.pop())}};md();const ln=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}}),dn={dedupe:!0},kd=(t,r,o)=>{const{cache:n,compare:a,suspense:s,fallbackData:p,revalidateOnMount:f,revalidateIfStale:c,refreshInterval:h,refreshWhenHidden:d,refreshWhenOffline:u,keepPreviousData:m}=o,[v,x,w,_]=xt.get(n),[z,y]=ua(t),P=i.useRef(!1),C=i.useRef(!1),j=i.useRef(z),b=i.useRef(r),g=i.useRef(o),S=()=>g.current,k=()=>S().isVisible()&&S().isOnline(),[E,R,$,O]=Li(n,z),I=i.useRef({}).current,T=be(p)?be(o.fallback)?Ge:o.fallback[z]:p,N=(F,M)=>{for(const W in I){const A=W;if(A==="data"){if(!a(F[A],M[A])&&(!be(F[A])||!a(H,M[A])))return!1}else if(M[A]!==F[A])return!1}return!0},L=i.useMemo(()=>{const F=!z||!r?!1:be(f)?S().isPaused()||s?!1:c!==!1:f,M=we=>{const Te=$t(we);return delete Te._k,F?{isValidating:!0,isLoading:!0,...Te}:Te},W=E(),A=O(),G=M(W),re=W===A?G:M(A);let pe=G;return[()=>{const we=M(E());return N(we,pe)?(pe.data=we.data,pe.isLoading=we.isLoading,pe.isValidating=we.isValidating,pe.error=we.error,pe):(pe=we,we)},()=>re]},[n,z]),D=Yl.useSyncExternalStore(i.useCallback(F=>$(z,(M,W)=>{N(W,M)||F()}),[n,z]),L[0],L[1]),B=!P.current,oe=v[z]&&v[z].length>0,se=D.data,ne=be(se)?T&&Mi(T)?ln(T):T:se,K=D.error,U=i.useRef(ne),H=m?be(se)?be(U.current)?ne:U.current:se:ne,Q=oe&&!be(K)?!1:B&&!be(f)?f:S().isPaused()?!1:s?be(ne)?!1:c:be(ne)||c,ae=!!(z&&r&&B&&Q),te=be(D.isValidating)?ae:D.isValidating,ee=be(D.isLoading)?ae:D.isLoading,Y=i.useCallback(async F=>{const M=b.current;if(!z||!M||C.current||S().isPaused())return!1;let W,A,G=!0;const re=F||{},pe=!w[z]||!re.dedupe,we=()=>Pa?!C.current&&z===j.current&&P.current:z===j.current,Te={isValidating:!1,isLoading:!1},q=()=>{R(Te)},J=()=>{const ce=w[z];ce&&ce[1]===A&&delete w[z]},Z={isValidating:!0};be(E().data)&&(Z.isLoading=!0);try{if(pe&&(R(Z),o.loadingTimeout&&be(E().data)&&setTimeout(()=>{G&&we()&&S().onLoadingSlow(z,o)},o.loadingTimeout),w[z]=[M(y),Kn()]),[W,A]=w[z],W=await W,pe&&setTimeout(J,o.dedupingInterval),!w[z]||w[z][1]!==A)return pe&&we()&&S().onDiscarded(z),!1;Te.error=Ge;const ce=x[z];if(!be(ce)&&(A<=ce[0]||A<=ce[1]||ce[1]===0))return q(),pe&&we()&&S().onDiscarded(z),!1;const je=E().data;Te.data=a(je,W)?je:W,pe&&we()&&S().onSuccess(W,z,o)}catch(ce){J();const je=S(),{shouldRetryOnError:Se}=je;je.isPaused()||(Te.error=ce,pe&&we()&&(je.onError(ce,z,je),(Se===!0||ct(Se)&&Se(ce))&&(!S().revalidateOnFocus||!S().revalidateOnReconnect||k())&&je.onErrorRetry(ce,z,je,Ce=>{const Ne=v[z];Ne&&Ne[0]&&Ne[0](za,Ce)},{retryCount:(re.retryCount||0)+1,dedupe:!0})))}return G=!1,q(),!0},[z,n]),de=i.useCallback((...F)=>Ai(n,j.current,...F),[]);if(an(()=>{b.current=r,g.current=o,be(se)||(U.current=se)}),an(()=>{if(!z)return;const F=Y.bind(Ge,dn);let M=0;S().revalidateOnFocus&&(M=Date.now()+S().focusThrottleInterval);const A=jd(z,v,(G,re={})=>{if(G==Ii){const pe=Date.now();S().revalidateOnFocus&&pe>M&&k()&&(M=pe+S().focusThrottleInterval,F())}else if(G==Ti)S().revalidateOnReconnect&&k()&&F();else{if(G==Oi)return Y();if(G==za)return Y(re)}});return C.current=!1,j.current=z,P.current=!0,R({_k:y}),Q&&(w[z]||(be(ne)||Lr?F():od(F))),()=>{C.current=!0,A()}},[z]),an(()=>{let F;function M(){const A=ct(h)?h(E().data):h;A&&F!==-1&&(F=setTimeout(W,A))}function W(){!E().error&&(d||S().isVisible())&&(u||S().isOnline())?Y(dn).then(M):M()}return M(),()=>{F&&(clearTimeout(F),F=-1)}},[h,d,u,z]),i.useDebugValue(H),s&&be(ne)&&z){if(!Pa&&Lr)throw new Error("Fallback data is required when using Suspense in SSR.");b.current=r,g.current=o,C.current=!1;const F=_[z];if(!be(F)){const M=de(F);ln(M)}if(be(K)){const M=Y(dn);be(H)||(M.status="fulfilled",M.value=!0),ln(M)}else throw K}return{mutate:de,get data(){return I.data=!0,H},get error(){return I.error=!0,K},get isValidating(){return I.isValidating=!0,te},get isLoading(){return I.isLoading=!0,ee}}},We=wd(kd);async function V(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)}const r=await t.json();return{data:r.data,errors:r.errors}}function Fi(t){const{client:r}=Me(),o=i.useCallback(async()=>{const c=await r(`/api/agent/contexts?token=${encodeURIComponent(t)}`,{method:"GET"});return(await V(c)).data},[r,t]),{data:n,error:a,mutate:s}=We(t?`sessions-${t}`:null,o,{revalidateOnFocus:!1}),p=i.useCallback(async c=>{const h=new FormData;h.append("title",c.title),c.system_instructions&&h.append("system_instructions",c.system_instructions);const d=await r(`/api/agent/contexts?token=${encodeURIComponent(t)}`,{method:"POST",body:h}),u=await V(d);return await s(m=>m&&{...m,data:[u.data,...m.data]}),u.data},[r,t,s]),f=i.useCallback(async c=>{await r(`/api/agent/contexts/${c}/delete?token=${encodeURIComponent(t)}`,{method:"POST"}),await s(h=>h&&{...h,data:h.data.filter(d=>d.id!==c)})},[r,t,s]);return{sessions:(n==null?void 0:n.data)||[],loading:!n&&!a,error:a,createSession:p,deleteSession:f,refetch:async()=>{await s()}}}const Bi=i.createContext(void 0);function Bo(){const t=i.useContext(Bi);if(!t)throw new Error("useAgentConversationContext must be used within AgentConversationProvider");return t}function _d({children:t,agentName:r,token:o,platformAdapter:n,defaultSessionId:a,onSessionCreated:s,onSessionDeleted:p,onError:f}){const[c,h]=i.useState(a?{id:a,title:"Conversation",status:"idle",last_activity_at:new Date().toISOString(),created_at:new Date().toISOString()}:null),[d,u]=i.useState(!1),{sessions:m,loading:v,error:x,createSession:w,deleteSession:_,refetch:z}=Fi(o);i.useEffect(()=>{if(a&&m.length>0){const b=m.find(g=>g.id===a);b&&h(b)}},[a,m]);const y=i.useCallback(b=>{h(b),u(!1)},[]),P=i.useCallback(async b=>{try{const g=b||`Chat ${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}`,S=await w({title:g});return h(S),s==null||s(S),S}catch(g){const S=g instanceof Error?g.message:"Failed to create session";throw f==null||f(S),g}},[w,s,f]),C=i.useCallback(async b=>{try{await _(b),(c==null?void 0:c.id)===b&&h(null),p==null||p(b)}catch(g){const S=g instanceof Error?g.message:"Failed to delete session";throw f==null||f(S),g}},[_,c,p,f]),j={agentName:r,token:o,platformAdapter:n,sessions:m,selectedSession:c,loadingSessions:v,sessionError:x,selectSession:y,createSession:P,deleteSession:C,refreshSessions:z,showHistory:d,setShowHistory:u,onSessionCreated:s,onSessionDeleted:p,onError:f};return e.jsx(Bi.Provider,{value:j,children:t})}var Ui=(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))(Ui||{}),pr=(t=>(t.Username="username",t.Email="email",t.Phone="phone",t.EmailOTP="email_otp",t.MagicLink="magic_link",t.Oauth="oauth",t.Generic="generic",t))(pr||{});function Cd(t,r,o){const n={username:Sd(t,r,o),email:$d(t,r,o),phone:zd(t,r,o),email_otp:Ed(t,r,o),magic_link:Pd(t,r,o),oauth:Rd(t,o),generic:Id(t,r,o)};return function(s){return n[s]}}function Sd(t,r,o){return async({username:n,password:a})=>{var c,h;const s=new FormData;s.append("strategy","plain_username"),s.append("username",n),s.append("password",a);const p=await t("/auth/signin",{method:"POST",body:s}),f=await V(p);return"data"in f&&((h=(c=f.data)==null?void 0:c.signin_attempts)!=null&&h.length)?(r(f.data.signin_attempts.at(-1)||null),o(null)):o(f),f}}function $d(t,r,o){return async({email:n,password:a})=>{var c,h;const s=new FormData;s.append("strategy","plain_email"),s.append("email",n),s.append("password",a);const p=await t("/auth/signin",{method:"POST",body:s}),f=await V(p);return"data"in f&&((h=(c=f.data)==null?void 0:c.signin_attempts)!=null&&h.length)?(r(f.data.signin_attempts.at(-1)||null),o(null)):o(f),f}}function zd(t,r,o){return async({phone:n})=>{var f,c;const a=new FormData;a.append("strategy","phone_otp"),a.append("phone",n);const s=await t("/auth/signin",{method:"POST",body:a}),p=await V(s);return"data"in p&&((c=(f=p.data)==null?void 0:f.signin_attempts)!=null&&c.length)?(r(p.data.signin_attempts.at(-1)||null),o(null)):o(p),p}}function Ed(t,r,o){return async({email:n})=>{var f,c;const a=new FormData;a.append("strategy","email_otp"),a.append("email",n);const s=await t("/auth/signin",{method:"POST",body:a}),p=await V(s);return"data"in p&&((c=(f=p.data)==null?void 0:f.signin_attempts)!=null&&c.length)?(r(p.data.signin_attempts.at(-1)||null),o(null)):o(p),p}}function Pd(t,r,o){return async({email:n})=>{var f,c;const a=new FormData;a.append("strategy","magic_link"),a.append("email",n);const s=await t("/auth/signin",{method:"POST",body:a}),p=await V(s);return"data"in p&&((c=(f=p.data)==null?void 0:f.signin_attempts)!=null&&c.length)?(r(p.data.signin_attempts.at(-1)||null),o(null)):o(p),p}}function Rd(t,r){return async({provider:o,redirectUri:n})=>{const a=new URLSearchParams({provider:o});n&&a.append("redirect_uri",n);const s=await t(`/auth/oauth2/init?${a.toString()}`,{method:"POST"}),p=await V(s);return"data"in p?(r(null),p.data.oauth_url&&(window.location.href=p.data.oauth_url)):r(p),p}}function Id(t,r,o){return async({email:n,username:a,password:s,phone:p,strategy:f})=>{var u,m;const c=new FormData;f&&c.append("strategy",f),n&&c.append("email",n),a&&c.append("username",a),s&&c.append("password",s),p&&c.append("phone",p);const h=await t("/auth/signin",{method:"POST",body:c}),d=await V(h);return"data"in d&&((m=(u=d.data)==null?void 0:u.signin_attempts)!=null&&m.length)?(r(d.data.signin_attempts.at(-1)||null),o(null)):o(d),d}}function Wi(){const{client:t,loading:r}=Me(),[o,n]=i.useState(null),[a,s]=i.useState(null);return r?{loading:!0,signIn:null,signinAttempt:null,discardSignInAttempt:()=>{n(null),s(null)},setSignInAttempt:n,error:null}:{loading:!1,signinAttempt:o,signIn:{createStrategy:Cd(t,n,s),completeVerification:async p=>{var d,u,m,v;const f=new FormData;f.append("verification_code",p);const c=await t(`/auth/attempt-verification?attempt_identifier=${o==null?void 0:o.id}&identifier_type=signin`,{method:"POST",body:f}),h=await V(c);if("data"in h&&((u=(d=h.data)==null?void 0:d.signin_attempts)!=null&&u.length)){const x=h.data.signin_attempts.at(-1);return n(x||null),s(null),h.data}else throw"errors"in h?(s(h),new Error(((v=(m=h.errors)==null?void 0:m[0])==null?void 0:v.message)||"Verification failed")):new Error("Verification failed")},prepareVerification:async p=>{var h;const f=new URL("/auth/prepare-verification",window.location.origin);f.searchParams.set("attempt_identifier",((h=o==null?void 0:o.id)==null?void 0:h.toString())||""),f.searchParams.set("strategy",p.strategy),f.searchParams.set("identifier_type","signin"),p.strategy==="phone_otp"&&p.lastDigits?f.searchParams.set("last_digits",p.lastDigits):(p.strategy==="email_otp"&&p.redirectUri||p.strategy==="magic_link"&&p.redirectUri)&&f.searchParams.set("redirect_uri",p.redirectUri);const c=await t(f.pathname+f.search,{method:"POST"});return V(c)},completeProfile:async p=>{var d;if(!o)throw new Error("No signin attempt found");const f=new FormData;for(const[u,m]of Object.entries(p))m&&f.append(u,m);const c=await t(`/auth/complete-profile?attempt_id=${o.id}`,{method:"POST",body:f}),h=await V(c);if("data"in h&&h.data){const u=(d=h.data.signin_attempts)==null?void 0:d.find(m=>m.id===o.id);return u&&n(u),s(null),h.data}else throw new Error("Profile completion failed")}},discardSignInAttempt:()=>{n(null),s(null)},setSignInAttempt:n,error:a}}function Ar(t){const{loading:r,signIn:o,signinAttempt:n,discardSignInAttempt:a,setSignInAttempt:s,error:p}=Wi();if(r)return{loading:!0,signIn:null,signinAttempt:null,discardSignInAttempt:a,setSignInAttempt:s,error:null};const f=(()=>{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:f,completeVerification:o.completeVerification,prepareVerification:o.prepareVerification,completeProfile:o.completeProfile},discardSignInAttempt:a,setSignInAttempt:s,error:p}}function Td(t,r,o,n){return{create:async a=>{var c,h,d;const s=new FormData;for(const[u,m]of Object.entries(a))s.append(u,m);const p=await t("/auth/signup",{method:"POST",body:s}),f=await V(p);return"data"in f&&((h=(c=f.data)==null?void 0:c.signup_attempts)!=null&&h.length)?(o(((d=f.data.signup_attempts)==null?void 0:d.at(-1))||null),n(null)):n(f),f},prepareVerification:async a=>{var f;const s=new URL("/auth/prepare-verification",window.location.origin);s.searchParams.set("attempt_identifier",((f=r==null?void 0:r.id)==null?void 0:f.toString())||""),s.searchParams.set("strategy",a.strategy),s.searchParams.set("identifier_type","signup"),a.strategy==="phone_otp"&&a.lastDigits?s.searchParams.set("last_digits",a.lastDigits):a.strategy==="email_otp"&&a.redirectUri&&s.searchParams.set("redirect_uri",a.redirectUri);const p=await t(s.pathname+s.search,{method:"POST"});return V(p)},completeVerification:async a=>{var c,h,d,u;const s=new FormData;s.append("verification_code",a);const p=await t(`/auth/attempt-verification?attempt_identifier=${r==null?void 0:r.id}&identifier_type=signup`,{method:"POST",body:s}),f=await V(p);if("data"in f&&((h=(c=f.data)==null?void 0:c.signup_attempts)!=null&&h.length))o(f.data.signup_attempts.at(-1)||null),n(null);else if("errors"in f)throw n(f),new Error(((u=(d=f.errors)==null?void 0:d[0])==null?void 0:u.message)||"Verification failed");return f},validateDeploymentInvitation:async a=>{try{const s=await t(`/deployment/invitations/validate?token=${encodeURIComponent(a)}`,{method:"GET"}),p=await V(s);return"data"in p&&p.data?p.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 Vi(){const{client:t,loading:r}=Me(),[o,n]=i.useState(null),[a,s]=i.useState(null);return r?{loading:!0,signUp:null,signupAttempt:null,discardSignupAttempt:()=>{n(null),s(null)},errors:null}:{loading:!1,signupAttempt:o,discardSignupAttempt:()=>{n(null),s(null)},signUp:Td(t,o,n,s),errors:a}}const qe=()=>{const{adapter:t,deployment:r}=ve(),o=t.useNavigate(),n=(p,f)=>{o?o(p,f):window.location.href=p};return{navigate:n,navigateToSignIn:p=>{if(!r)return;const f=p||window.location.href,c=new URLSearchParams;c.set("redirect_uri",f),(r==null?void 0:r.mode)==="staging"&&c.set("dev_session",localStorage.getItem("__dev_session__")??""),n(`${r.ui_settings.sign_in_page_url}?${c.toString()}`,{replace:!0})},navigateToSignUp:p=>{if(!r)return;const f=p||window.location.href,c=new URLSearchParams;c.set("redirect_uri",f),(r==null?void 0:r.mode)==="staging"&&c.set("dev_session",localStorage.getItem("__dev_session__")??""),n(`${r.ui_settings.sign_up_page_url}?${c.toString()}`,{replace:!0})}}};async function Od(t){const r=await t("/session",{method:"GET"});return(await V(r)).data}async function Md(t,r){const o=await t(`/session/switch-sign-in?sign_in_id=${r}`,{method:"POST"});return V(o)}async function Ld(t,r){const o=r?`/session/sign-out?sign_in_id=${r}`:"/session/sign-out",n=await t(o,{method:"POST"});return V(n)}async function Ad(t,r){const o=await t(`/session/switch-organization${r?`?organization_id=${r}`:""}`,{method:"POST"});return V(o)}async function Dd(t,r){const o=await t(`/session/switch-workspace?workspace_id=${r}`,{method:"POST"});return V(o)}const Ta=new Map,qr=new Map;async function Nd(t,r){const o=await t("/session/token");return V(o)}function Ue(){const{client:t,loading:r}=Me(),{deployment:o}=ve(),{navigate:n}=qe(),{data:a,error:s,mutate:p,isLoading:f}=We(r?null:"/session",()=>Od(t),{refreshInterval:3e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,revalidateIfStale:!1,dedupingInterval:5e3}),c=i.useCallback(async()=>{await p()},[p]),h=i.useCallback(async(u="default")=>{var x;if(!a)throw new Error("no session");const m=Ta.get(u);if(m&&m.expires>Date.now())return(m==null?void 0:m.token)||"";qr.get(u)||qr.set(u,Nd(t));const v=await qr.get(u);if(qr.delete(u),(x=v.errors)!=null&&x.length)throw new Error(v.errors[0].message);return Ta.set(u,v.data),v.data.token},[t,a==null?void 0:a.active_signin]),d=i.useCallback(()=>{if(!o)return;const u=o.ui_settings.sign_in_page_url,m=window.location.href,v=new URL(u);if(v.searchParams.set("redirect_uri",m),o.mode==="staging"){const x=localStorage.getItem("__dev_session__");x&&v.searchParams.set("dev_session",x)}n(v.toString())},[o,n]);return r||!a||f?{loading:!0,error:s,session:null,switchSignIn:null,switchOrganization:null,switchWorkspace:null,signOut:null,getToken:null,addNewAccount:null,refetch:c}:{loading:f,error:s,session:a,switchSignIn:async u=>{await Md(t,u),await p()},signOut:async u=>{await Ld(t,u),await p(),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 Ad(t,u),await p()},switchWorkspace:async u=>{await Dd(t,u),await p()},getToken:h,addNewAccount:d,refetch:c}}const Fd=async t=>(await V(await t("/me"))).data,Bd=async t=>(await V(await t("/me/signins"))).data;function er(){const{client:t,loading:r}=Me(),{data:o,error:n,isLoading:a,mutate:s}=We(r?null:"/user",()=>Fd(t)),p=async I=>{const T=new FormData;for(const[L,D]of Object.entries(I))D!=null&&D!==""&&T.append(L,String(D));const N=await V(await t("/me",{method:"POST",body:T}));return s(),N},f=async()=>await V(await t("/me/email-addresses",{method:"GET"})),c=async I=>await V(await t(`/me/email-addresses/${I}`,{method:"GET"})),h=async I=>{const T=new FormData;return T.append("email",I),await V(await t("/me/email-addresses",{method:"POST",body:T}))},d=async I=>await V(await t(`/me/email-addresses/${I}/delete`,{method:"POST"})),u=async I=>await V(await t(`/me/email-addresses/${I}/prepare-verification`,{method:"POST"})),m=async(I,T)=>await V(await t(`/me/email-addresses/${I}/attempt-verification?code=${T}`,{method:"POST"})),v=async(I,T)=>{const N=new FormData;return N.append("phone_number",I),N.append("country_code",T),await V(await t("/me/phone-numbers",{method:"POST",body:N}))},x=async I=>await V(await t(`/me/phone-numbers/${I}/delete`,{method:"POST"})),w=async I=>await V(await t(`/me/phone-numbers/${I}/prepare-verification`,{method:"POST"})),_=async(I,T)=>{const N=new FormData;return N.append("code",T),await V(await t(`/me/phone-numbers/${I}/attempt-verification`,{method:"POST",body:N}))},z=async I=>{const T=await V(await t(`/me/phone-numbers/${I}/make-primary`,{method:"POST"}));return s(),T},y=async I=>await V(await t(`/me/email-addresses/${I}/make-primary`,{method:"POST"})),P=async()=>(await V(await t("/me/authenticator",{method:"POST"}))).data,C=async(I,T)=>{const N=new FormData;return N.append("authenticator_id",I),T.forEach(D=>{N.append("codes",D)}),await V(await t("/me/authenticator/attempt-verification",{method:"POST",body:N}))},j=async I=>await V(await t(`/me/authenticator/${I}/delete`,{method:"POST"})),b=async()=>(await V(await t("/me/backup-codes",{method:"POST"}))).data,g=async I=>{const T=new FormData;return T.append("file",I),await V(await t("/me/profile-picture",{method:"POST",body:T}))},S=async()=>(await V(await t("/me/backup-codes/regenerate",{method:"POST"}))).data,k=async(I,T)=>{const N=new FormData;return N.append("current_password",I),N.append("new_password",T),await V(await t("/me/update-password",{method:"POST",body:N}))},E=async I=>{const T=new FormData;T.append("current_password",I);const N=await V(await t("/me/remove-password",{method:"POST",body:T}));return s(),N},R=async I=>{const T=new FormData;return T.append("password",I),await V(await t("/me/account/delete",{method:"POST",body:T}))},$=async I=>await V(await t(`/me/social-connections/${I}/disconnect`,{method:"POST"})),O=async({provider:I,redirectUri:T})=>{var D;const N=new URLSearchParams({provider:I});T&&N.append("redirect_uri",T);const L=await V(await t(`/me/init-sso-connection?${N.toString()}`,{method:"POST"}));return"data"in L&&((D=L.data)!=null&&D.oauth_url)&&window.open(L.data.oauth_url,"_blank"),L};return{user:{...o,refetch:s},loading:r||a,error:n||null,updateProfile:p,getEmailAddresses:f,getEmailAddress:c,createEmailAddress:h,deleteEmailAddress:d,prepareEmailVerification:u,attemptEmailVerification:m,makeEmailPrimary:y,createPhoneNumber:v,deletePhoneNumber:x,preparePhoneVerification:w,attemptPhoneVerification:_,makePhonePrimary:z,setupAuthenticator:P,verifyAuthenticator:C,deleteAuthenticator:j,generateBackupCodes:b,regenerateBackupCodes:S,updateProfilePicture:g,disconnectSocialConnection:$,connectSocialAccount:O,updatePassword:k,removePassword:E,deleteAccount:R}}function Gi(){const{client:t,loading:r}=Me(),{data:o,error:n,isLoading:a,mutate:s}=We(r?null:"/me/signins",()=>Bd(t));return{signins:o,error:n||null,removeSignin:async f=>await V(await t(`/me/signins/${f}/signout`,{method:"POST"})),refetch:s,loading:a||r}}function Hi(){const{client:t,loading:r}=Me(),[o,n]=i.useState(!1),[a,s]=i.useState(null),p=async f=>{n(!0),s(null);try{const c=new FormData;for(const[u,m]of Object.entries(f))m&&c.append(u,m);const h=await t("/waitlist/join",{method:"POST",body:c}),d=await V(h);return s(d.errors?d:null),d}catch(c){const h={data:null,errors:[{message:c instanceof Error?c.message:"Failed to join waitlist",code:Ve.ErrorCode.Unknown}]};return s(h),h}finally{n(!1)}};return r?{loading:!0,error:null,joinWaitlist:null}:{loading:o,error:a,joinWaitlist:p}}const br=()=>{const{organizationMemberships:t,refetch:r,loading:o}=tr(),{client:n}=Me(),{refetch:a}=Ue(),s=i.useCallback(async k=>(await V(await n(`/organizations/${k.id}/roles`,{method:"GET"}))).data,[n]),p=i.useCallback(async k=>(await V(await n(`/organizations/${k.id}/members`,{method:"GET"}))).data,[n]),f=i.useCallback(async k=>(await V(await n(`/organizations/${k.id}/invitations`,{method:"GET"}))).data,[n]),c=i.useCallback(async k=>(await V(await n(`/organizations/${k.id}/domains`,{method:"GET"}))).data,[n]),h=i.useCallback(async(k,E)=>{await n(`/organizations/${k.id}/members/${E.id}/remove`,{method:"POST"}),await r()},[r,n]),d=i.useCallback(async k=>{const E=new FormData;E.append("name",k.name),k.image&&E.append("image",k.image),k.description&&E.append("description",k.description);const R=await V(await n("/organizations",{method:"POST",body:E}));return await r(),await a(),R},[a,r,n]),u=i.useCallback(async(k,E)=>{const R=Object.entries(E).reduce((O,[I,T])=>(T&&O.append(I,T),O),new FormData),$=await V(await n(`/organizations/${k.id}/update`,{method:"POST",body:R}));return await r(),$},[r,n]),m=i.useCallback(async(k,E)=>{await n(`/organizations/${k.id}/roles/${E.id}/remove`,{method:"POST"})},[n]),v=i.useCallback(async(k,E)=>{const R=new FormData;return R.append("domain",E.fqdn),await V(await n(`/organizations/${k.id}/domains`,{method:"POST",body:R}))},[n]),x=i.useCallback(async(k,E)=>await V(await n(`/organizations/${k.id}/domains/${E.id}/verify`,{method:"POST"})),[n]),w=i.useCallback(async(k,E)=>await V(await n(`/organizations/${k.id}/domains/${E.id}/remove`,{method:"POST"})),[n]),_=i.useCallback(async(k,E)=>{const R=new FormData;return R.append("name",E.name),E.permissions&&E.permissions.forEach((O,I)=>{R.append(`permissions[${I}]`,O)}),await V(await n(`/organizations/${k.id}/roles`,{method:"POST",body:R}))},[n]),z=i.useCallback(async k=>(await V(await n(`/organizations/${k.id}/leave`,{method:"POST"}))).data,[n]),y=i.useCallback(async k=>{const E=await V(await n(`/organizations/${k.id}/delete`,{method:"POST"}));return await r(),await a(),E.data},[n,r,a]),P=i.useCallback(async(k,E,R)=>(await V(await n(`/organizations/${k.id}/members/${E.id}/roles/${R.id}/add`,{method:"POST"}))).data,[n]),C=i.useCallback(async(k,E,R)=>(await V(await n(`/organizations/${k.id}/members/${E.id}/roles/${R.id}/remove`,{method:"POST"}))).data,[n]),j=i.useCallback(async(k,E)=>{var O,I;const R=new FormData;return R.append("email",E.email),R.append("role_id",E.organizationRole.id),(O=E.workspace)!=null&&O.id&&R.append("workspace_id",E.workspace.id),(I=E.workspaceRole)!=null&&I.id&&R.append("workspace_role_id",E.workspaceRole.id),(await V(await n(`/organizations/${k.id}/invitations`,{method:"POST",body:R}))).data},[n]),b=i.useCallback(async(k,E)=>(await V(await n(`/organizations/${k.id}/invitations/${E.id}/remove`,{method:"POST"}))).data,[n]),g=i.useCallback(async(k,E)=>(await V(await n(`/organizations/${k.id}/invitations/${E.id}/resend`,{method:"POST"}))).data,[n]);return{organizations:i.useMemo(()=>t==null?void 0:t.map(k=>k.organization),[t]),loading:o,error:null,refetch:r,leaveOrganization:z,getOrganizationRoles:s,getOrganizationMembers:p,removeOrganizationMember:h,createOrganization:d,getOrganizationInvitations:f,getOrganizationDomains:c,addOrganizationDomain:v,verifyOrganizationDomain:x,removeOrganizationDomain:w,addRoleToOrganizationMember:P,removeRoleFromOrganizationMember:C,inviteOrganizationMember:j,discardOrganizationInvitation:b,resendOrganizationInvitation:g,updateOrganization:u,addRole:_,removeOrganizationRoles:m,deleteOrganization:y}},Xe=()=>{const{loading:t,error:r,refetch:o,getOrganizationMembers:n,getOrganizationRoles:a,leaveOrganization:s,removeOrganizationMember:p,getOrganizationInvitations:f,getOrganizationDomains:c,removeOrganizationDomain:h,addOrganizationDomain:d,verifyOrganizationDomain:u,addRoleToOrganizationMember:m,removeRoleFromOrganizationMember:v,inviteOrganizationMember:x,discardOrganizationInvitation:w,resendOrganizationInvitation:_,updateOrganization:z,removeOrganizationRoles:y}=br(),{session:P,error:C,loading:j}=Ue(),{organizationMemberships:b}=tr(),g=i.useMemo(()=>{var U;return((U=b==null?void 0:b.find(H=>{var Q;return H.id===((Q=P==null?void 0:P.active_signin)==null?void 0:Q.active_organization_membership_id)}))==null?void 0:U.organization)||null},[b,P]),S=i.useCallback(async U=>g?await z(g,U):[],[g,z]),k=i.useCallback(async()=>g?await n(g):[],[g,n]),E=i.useCallback(async()=>g?await a(g):[],[g,a]),R=i.useCallback(async U=>g?await p(g,U):[],[g,p]),$=i.useCallback(async U=>g?await y(g,U):void 0,[g,y]),O=i.useCallback(async()=>g?await c(g):[],[g,c]),I=i.useCallback(async U=>g?await d(g,U):void 0,[g,d]),T=i.useCallback(async U=>g?await u(g,U):void 0,[g,u]),N=i.useCallback(async U=>g?await h(g,U):void 0,[g,h]),L=i.useCallback(async(U,H)=>g?await m(g,U,H):void 0,[g,m]),D=i.useCallback(async(U,H)=>g?await v(g,U,H):void 0,[g,v]),B=i.useCallback(async U=>g?await x(g,U):void 0,[g,x]),oe=i.useCallback(async U=>g?await w(g,U):void 0,[g,w]),se=i.useCallback(async U=>g?await _(g,U):void 0,[g,_]),ne=i.useCallback(async()=>{g&&await s(g)},[g,s]),K=i.useCallback(async()=>g?await f(g):[],[g,f]);return j||t?{activeOrganization:null,loading:!0,error:C||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}:{activeOrganization:g,loading:!1,refetch:o,getRoles:E,updateOrganization:S,getMembers:k,getDomains:O,addDomain:I,verifyDomain:T,removeDomain:N,getInvitations:K,removeMember:R,leave:ne,removeRole:$,addMemberRole:L,removeMemberRole:D,inviteMember:B,discardInvitation:oe,resendInvitation:se,error:null}};async function Ud(t){return(await V(await t("/me/organization-memberships"))).data}const tr=()=>{const{client:t,loading:r}=Me(),{data:o,isLoading:n,error:a,mutate:s}=We(r?null:"/me/organization-memberships",()=>Ud(t),{refreshInterval:3e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,revalidateIfStale:!1,dedupingInterval:5e3});return{organizationMemberships:o,loading:r||n,error:a,refetch:s}};async function Wd(t){return(await V(await t("/me/workspace-memberships"))).data}async function Vd(t,r,o){return(await V(await t(`/workspaces/${r}/members/${o}/remove`,{method:"POST"}))).data}const pa=()=>{const{client:t,loading:r}=Me(),{data:o,isLoading:n,error:a,mutate:s}=We(r?null:"/me/workspace-memberships",()=>Wd(t),{refreshInterval:3e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,revalidateIfStale:!1,dedupingInterval:5e3});return{workspaceMemberships:o,loading:r||n,error:a,refetch:s}},vt=()=>{const{workspaceMemberships:t,refetch:r,loading:o,error:n}=pa(),{client:a}=Me(),s=i.useMemo(()=>t==null?void 0:t.map(y=>({...y.workspace,organization:y.organization})),[t]),p=i.useCallback(async(y,P,C,j)=>{const b=new FormData;b.append("name",P),C&&b.append("image",C),j&&b.append("description",j),b.append("organization_id",y);const g=await a("/workspaces",{method:"POST",body:b});return await r(),g},[a,r]),f=i.useCallback(async(y,P)=>{const C=await Vd(a,y,P);return await r(),C},[a,r]),c=i.useCallback(async(y,P)=>{const C=new FormData;P.name&&C.append("name",P.name),P.description&&C.append("description",P.description),P.image&&C.append("image",P.image);const j=await V(await a(`/workspaces/${y.id}/update`,{method:"POST",body:C}));return await r(),j.data},[a,r]),h=i.useCallback(async y=>{const P=await V(await a(`/workspaces/${y.id}/delete`,{method:"POST"}));return await r(),P.data},[a,r]),d=i.useCallback(async y=>(await V(await a(`/workspaces/${y.id}/members`,{method:"GET"}))).data,[a]),u=i.useCallback(async y=>(await V(await a(`/workspaces/${y.id}/roles`,{method:"GET"}))).data,[a]),m=i.useCallback(async(y,P,C)=>(await V(await a(`/workspaces/${y.id}/roles`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:P,permissions:C})}))).data,[a]),v=i.useCallback(async(y,P)=>(await V(await a(`/workspaces/${y.id}/roles/${P.id}/delete`,{method:"POST"}))).data,[a]),x=i.useCallback(async(y,P,C)=>(await V(await a(`/workspaces/${y.id}/members`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:P,role_id:C})}))).data,[a]),w=i.useCallback(async(y,P)=>{const C=await V(await a(`/workspaces/${y.id}/members/${P}/remove`,{method:"POST"}));return await r(),C.data},[a,r]),_=i.useCallback(async(y,P,C)=>(await V(await a(`/workspaces/${y.id}/members/${P}/roles/${C}`,{method:"POST"}))).data,[a]),z=i.useCallback(async(y,P,C)=>(await V(await a(`/workspaces/${y.id}/members/${P}/roles/${C}/remove`,{method:"POST"}))).data,[a]);return{workspaces:s||[],loading:o,error:n,refetch:r,leaveWorkspace:f,createWorkspace:p,updateWorkspace:c,deleteWorkspace:h,getWorkspaceMembers:d,getWorkspaceRoles:u,createWorkspaceRole:m,deleteWorkspaceRole:v,inviteWorkspaceMember:x,removeWorkspaceMember:w,addWorkspaceMemberRole:_,removeWorkspaceMemberRole:z}},zt=()=>{const{refetch:t,loading:r,error:o,leaveWorkspace:n,updateWorkspace:a,deleteWorkspace:s,getWorkspaceMembers:p,getWorkspaceRoles:f,createWorkspaceRole:c,deleteWorkspaceRole:h,inviteWorkspaceMember:d,removeWorkspaceMember:u,addWorkspaceMemberRole:m,removeWorkspaceMemberRole:v}=vt(),{workspaceMemberships:x}=pa(),{session:w,loading:_,error:z}=Ue(),y=i.useMemo(()=>{var N;return((N=x==null?void 0:x.find(L=>{var D;return L.id===((D=w==null?void 0:w.active_signin)==null?void 0:D.active_workspace_membership_id)}))==null?void 0:N.workspace)||null},[x,w]),P=i.useCallback(async()=>{var N;if(!(!y||!((N=w==null?void 0:w.active_signin)!=null&&N.user_id)))return await n(y.id,w.active_signin.user_id)},[y,n,w]),C=i.useCallback(async N=>{if(y)return await a(y,N)},[y,a]),j=i.useCallback(async()=>{if(y)return await s(y)},[y,s]),b=i.useCallback(async()=>y?await p(y):[],[y,p]),g=i.useCallback(async()=>y?await f(y):[],[y,f]),S=i.useCallback(async(N,L)=>{if(y)return await c(y,N,L)},[y,c]),k=i.useCallback(async N=>{if(y)return await h(y,N)},[y,h]),E=i.useCallback(async(N,L)=>{if(y)return await d(y,N,L)},[y,d]),R=i.useCallback(async N=>{if(y)return await u(y,N)},[y,u]),$=i.useCallback(async(N,L)=>{if(y)return await m(y,N,L)},[y,m]),O=i.useCallback(async(N,L)=>{if(y)return await v(y,N,L)},[y,v]),I=r||_,T=o||z;return I?{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:y,loading:!1,error:T,refetch:t,leave:P,updateWorkspace:C,deleteWorkspace:j,getMembers:b,getRoles:g,createRole:S,deleteRole:k,inviteMember:E,removeMember:R,addMemberRole:$,removeMemberRole:O}};function qi(){const{client:t,loading:r}=Me(),[o,n]=i.useState(!1),[a,s]=i.useState(null),[p,f]=i.useState(null),[c,h]=i.useState(null),[d,u]=i.useState(!1),[m,v]=i.useState(null);i.useEffect(()=>{if(d||r)return;const w=new URLSearchParams(window.location.search),_=w.get("code"),z=w.get("state"),y=w.get("error"),P=w.get("error_description");if(!_&&!y){u(!0);const C=new Error("No OAuth callback data found.");s(C);return}if(u(!0),n(!0),y){const C=P||y,j=new Error(`OAuth Error: ${C}`);s(j),n(!1);return}if(_&&z)x(_,z);else{const C=new Error("Missing required OAuth parameters");s(C),n(!1)}},[d,r]);const x=async(w,_)=>{try{let z,y;try{const j=_.split(".");if(j.length!==2)throw new Error("Invalid OAuth state format - missing signature");const b=j[0].replace(/-/g,"+").replace(/_/g,"/"),g=b.length%4?"=".repeat(4-b.length%4):"",k=atob(b+g).split("|")[0];if(k==="sign_in")z="/auth/oauth2/callback",y="GET";else if(k==="connect_social")z="/me/sso-connection-callback",y="POST";else throw new Error(`Unknown OAuth action: ${k}`)}catch(j){const b=j instanceof Error?j:new Error("Failed to parse OAuth state");s(new Error(`Invalid OAuth callback: ${b.message}. The authorization link may be expired or malformed. Please try signing in again.`)),n(!1);return}const P=await t(`${z}?code=${encodeURIComponent(w)}&state=${encodeURIComponent(_)}`,{method:y}),C=await V(P);if("data"in C){const j=C.data.session,b=C.data.redirect_uri||null;if(f(j),h(b),j.signin_attempts&&j.signin_attempts.length>0){const g=j.signin_attempts.at(-1);g&&v(g)}}else{const j=new Error("SSO callback failed");s(j)}}catch(z){const y=z instanceof Error?z:new Error("Unknown error occurred");s(y)}finally{n(!1)}};return{loading:o,error:a,session:p,redirectUri:c,processed:d,signinAttempt:m}}function Yi(){const{client:t,loading:r}=Me(),[o,n]=i.useState(!1),[a,s]=i.useState(null),[p,f]=i.useState(null);return{loading:r||o,verifyMagicLink:async h=>{if(!h.token||!h.attempt){const d=new Error("Invalid magic link parameters");return s(d),{data:void 0,errors:[{message:d.message,code:Ve.ErrorCode.BadRequestBody}]}}n(!0),s(null),f(null);try{const d=new URL("/auth/verify-magic-link",window.location.origin);d.searchParams.set("token",h.token),d.searchParams.set("attempt",h.attempt),h.redirectUri&&d.searchParams.set("redirect_uri",h.redirectUri);const u=await t(d.pathname+d.search,{method:"GET"}),m=await V(u);if(n(!1),"errors"in m&&m.errors){const v=new Error(m.errors[0].message);s(v),f(!1)}else f(!0);return m}catch(d){n(!1);const u=d instanceof Error?d:new Error("Magic link verification failed");return s(u),f(!1),{data:void 0,errors:[{message:u.message,code:Ve.ErrorCode.Internal}]}}},error:a,success:p}}function Zi(){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 Ki(){const{client:t,loading:r}=Me(),[o,n]=i.useState(!1),[a,s]=i.useState(null);return{loading:r||o,forgotPassword:async f=>{n(!0),s(null);const c=new FormData;c.append("email",f);const h=await t("/auth/forgot-password",{method:"POST",body:c}),d=await V(h);return n(!1),"errors"in d&&d.errors&&s(new Error(d.errors[0].message)),d},error:a}}function Qi(){const{client:t,loading:r}=Me(),[o,n]=i.useState(!1),[a,s]=i.useState(null);return{loading:r||o,resetPassword:async(f,c,h)=>{n(!0),s(null);const d=new FormData;d.append("email",f),d.append("otp",c),d.append("password",h);const u=await t("/auth/reset-password",{method:"POST",body:d}),m=await V(u);return n(!1),"errors"in m&&m.errors&&s(new Error(m.errors[0].message)),m},error:a}}function Xi({enabled:t=!0,channels:r,organizationIds:o,workspaceIds:n,onNotification:a,onError:s,reconnectDelay:p=1e3,maxReconnectAttempts:f=5}={}){const{session:c,loading:h}=Ue(),{deployment:d,loading:u}=ve(),[m,v]=i.useState(!1),[x,w]=i.useState(null),_=i.useRef(null),z=i.useRef(null),y=i.useRef(0),P=i.useRef(null),C=i.useRef(a),j=i.useRef(s),b=i.useRef(r),g=i.useRef(o),S=i.useRef(n),k=i.useRef(p),E=i.useRef(f);C.current=a,j.current=s,b.current=r,g.current=o,S.current=n,k.current=p,E.current=f;const R=i.useCallback(()=>{z.current&&(clearTimeout(z.current),z.current=null),P.current&&(clearInterval(P.current),P.current=null),_.current&&(_.current.close(),_.current=null)},[]),$=i.useCallback(async()=>{var D;if(!t||h||u||!c||!d)return;R();const T=new URL(d.backend_host),N=T.protocol==="https:"?"wss:":"ws:",L=new URL("/realtime/notifications",`${N}//${T.host}`);if(d.mode==="staging"){const B=localStorage.getItem("__dev_session__");B&&L.searchParams.set("__dev_session__",B)}b.current&&b.current.length>0&&b.current.forEach(B=>L.searchParams.append("channels",B)),g.current&&g.current.length>0&&g.current.forEach(B=>L.searchParams.append("organization_ids",B.toString())),S.current&&S.current.length>0&&S.current.forEach(B=>L.searchParams.append("workspace_ids",B.toString()));try{const B=new WebSocket(L.toString());_.current=B,B.onopen=()=>{v(!0),w(null),y.current=0,P.current=setInterval(()=>{B.readyState===WebSocket.OPEN&&B.send("ping")},3e4)},B.onmessage=oe=>{var se,ne;try{const K=JSON.parse(oe.data);if(K.type==="notification"&&K.data)(se=C.current)==null||se.call(C,K.data);else if(K.type==="error"){const U=K.error||"Unknown error occurred";w(U),(ne=j.current)==null||ne.call(j,U)}else K.type}catch{}},B.onerror=()=>{var oe;w("Connection error occurred"),(oe=j.current)==null||oe.call(j,"Connection error occurred")},B.onclose=oe=>{var se;if(v(!1),P.current&&(clearInterval(P.current),P.current=null),t&&oe.code!==1e3&&y.current<E.current){y.current++;const ne=k.current*Math.pow(2,y.current-1);z.current=setTimeout(()=>{$()},ne)}else y.current>=E.current&&(w("Max reconnection attempts reached"),(se=j.current)==null||se.call(j,"Max reconnection attempts reached"))}}catch{w("Failed to connect"),(D=j.current)==null||D.call(j,"Failed to connect")}},[t,h,u,c,d,R]);i.useEffect(()=>($(),()=>{R()}),[$,R]),i.useEffect(()=>{_.current&&_.current.readyState===WebSocket.OPEN&&$()},[r,o,n,$]);const O=i.useCallback(()=>{R(),v(!1)},[R]),I=i.useCallback(()=>{y.current=0,$()},[$]);return{isConnected:m,connectionError:x,disconnect:O,reconnect:I}}async function Gd(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(p=>o.append("channels",p)),r.organization_ids&&r.organization_ids.forEach(p=>o.append("organization_ids",p.toString())),r.workspace_ids&&r.workspace_ids.forEach(p=>o.append("workspace_ids",p.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():""}`,a=await t(n,{method:"GET"});return(await V(a)).data}async function Hd(t){const r=await t("/notifications/channel-counts",{method:"GET"});return(await V(r)).data}async function qd(t,r){const o=await t(`/notifications/${r}/read`,{method:"POST"});return V(o)}async function Yd(t){const r=await t("/notifications/mark-all-read",{method:"POST"});return V(r)}async function Zd(t,r){const o=await t(`/notifications/${r}/delete`,{method:"POST"});return V(o)}function Ji(t){const{client:r,loading:o}=Me(),{data:n,error:a,mutate:s,isLoading:p}=We(o?null:["notifications",JSON.stringify(t)],()=>Gd(r,t),{refreshInterval:6e4,revalidateOnFocus:!0});Xi({enabled:!o&&!!n,onNotification:i.useCallback(u=>{s(async m=>!m||m.notifications.some(x=>x.id===u.id.toString())?m:{...m,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},...m.notifications],unread_count:m.unread_count+1,total:m.total+1},!1)},[s]),onError:i.useCallback(()=>{},[])});const f=i.useCallback(async u=>{o||(await s(async m=>m&&{...m,notifications:m.notifications.map(v=>v.id===u?{...v,is_read:!0}:v),unread_count:Math.max(0,m.unread_count-1)},!1),await qd(r,u),await s())},[r,o,s]),c=i.useCallback(async()=>{o||(await s(async u=>u&&{...u,notifications:u.notifications.map(m=>({...m,is_read:!0})),unread_count:0},!1),await Yd(r),await s())},[r,s]),h=i.useCallback(async u=>{o||(await s(async m=>{if(!m)return m;const v=m.notifications.find(x=>x.id===u);return{...m,notifications:m.notifications.filter(x=>x.id!==u),unread_count:v&&!v.is_read?Math.max(0,m.unread_count-1):m.unread_count,total:Math.max(0,m.total-1)}},!1),await Zd(r,u),await s())},[r,o,s]),d=i.useCallback(async()=>{await s()},[s]);return!n||o||p?{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:a,refetch:d}:{loading:!1,error:a,notifications:n.notifications,unreadCount:n.unread_count,unreadCounts:n.unread_counts,channels:n.channels,hasMore:n.has_more,markAsRead:f,markAllAsRead:c,deleteNotification:h,refetch:d}}async function Kd(t){const r=await t("/notifications/channel-counts",{method:"GET"});return(await V(r)).data}function Qd(){const{client:t,loading:r}=Me(),{data:o,error:n,mutate:a}=We(r?null:["notifications","channel-counts"],()=>Kd(t),{refreshInterval:3e4,revalidateOnFocus:!0}),s=async()=>{await a()};return!o||r?{loading:!0,counts:void 0,error:n,refetch:s}:{loading:!1,counts:o,error:n,refetch:s}}const Vt=class Vt{constructor(){Je(this,"ws",null);Je(this,"messageHandlers",new Set);Je(this,"connectionStateHandlers",new Set);Je(this,"reconnectTimer",null);Je(this,"reconnectAttempts",0);Je(this,"url",null);Je(this,"isIntentionalDisconnect",!1);Je(this,"sessionMessages",{});Je(this,"currentSessionKey",null)}static getInstance(){return Vt.instance||(Vt.instance=new Vt),Vt.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]=[])}};Je(Vt,"instance");let Qn=Vt;const Ye=Qn.getInstance(),mt={DISCONNECTED:"disconnected",CONNECTING:"connecting",CONNECTED:"connected",ERROR:"error"},Le={IDLE:"idle",STARTING:"starting",RUNNING:"running",WAITING_FOR_INPUT:"waiting_for_input",COMPLETED:"completed",FAILED:"failed"},It={IDLE:"Idle",STARTING:"Starting",RUNNING:"Running",WAITING_FOR_INPUT:"WaitingForInput",COMPLETED:"Completed",FAILED:"Failed",CANCELLED:"Cancelled"};function Oa(t){switch(t){case It.IDLE:return Le.IDLE;case It.STARTING:return Le.STARTING;case It.RUNNING:return Le.RUNNING;case It.WAITING_FOR_INPUT:return Le.WAITING_FOR_INPUT;case It.COMPLETED:return Le.COMPLETED;case It.FAILED:case It.CANCELLED:return Le.FAILED;default:return Le.IDLE}}function Ma(t){return t===Le.STARTING||t===Le.RUNNING||t===Le.WAITING_FOR_INPUT}function ec({contextId:t,agentName:r,token:o,platformAdapter:n,autoConnect:a=!0}){const{deployment:s}=ve(),{client:p}=Me(),[f,c]=i.useState([]),[h,d]=i.useState(null),[u,m]=i.useState(null),[v,x]=i.useState(!1),[w,_]=i.useState(!1),[z,y]=i.useState(Le.IDLE),[P,C]=i.useState({status:mt.DISCONNECTED}),[j,b]=i.useState(!0),[g,S]=i.useState(!1),k=i.useRef(null),E=i.useRef(null),R=i.useCallback(K=>{var U,H;switch(K.message_type){case"session_connected":if(x(!0),C({status:mt.CONNECTED}),(U=K.data)!=null&&U.execution_status){const ae=K.data.execution_status,te=Oa(ae);y(te),_(Ma(te))}break;case"conversation_message":$(K.data);break;case"user_input_request":O(K.data);break;case"platform_event":I(K.data);break;case"platform_function":T(K.data);break;case"execution_complete":_(!1),y(Le.IDLE),E.current=null;break;case"execution_error":_(!1),y(Le.FAILED),E.current=null;break;case"execution_cancelled":_(!1),y(Le.IDLE),E.current=null;break;case"execution_status":const Q=(H=K.data)==null?void 0:H.status;if(Q){const ae=Oa(Q);y(ae),_(Ma(ae))}break}},[h]),$=i.useCallback(K=>{var te,ee,Y,de,ue,F,M,W;const{id:U,message_type:H,content:Q}=K,ae=A=>f.some(G=>G.id===A);if(H==="system_decision"||H==="action_execution_result"||H==="assistant_task_breakdown"||H==="assistant_validation"||H==="assistant_action_planning"||H==="context_results"){d(null),m(null);let A="";if(H==="system_decision"){const G=Q==null?void 0:Q.step,re=Q==null?void 0:Q.reasoning;if(G==="gathercontext")re&&re.length>0?A=re.length>60?`${re.substring(0,60)}...`:re:A="Gathering context...";else if(G==="executeaction")A="Executing action";else if(G==="deliverresponse")A="Preparing response";else if(G==="taskplanning")A="Planning approach";else if(G==="validateprogress")A="Validating progress";else if(G==="acknowledge")A="Processing request";else if(G==="finishplanning")A="Finalizing plan";else if(G==="executetasks")A="Executing tasks";else if(G==="requestuserinput")A="Waiting for input";else if(G==="complete")A="Completed";else if(G==="examinetool")A="Examining tool";else if(G==="examineworkflow")A="Examining workflow";else{const pe=(Q==null?void 0:Q.confidence)||.5;pe>.8?A="Analyzing":pe>.6?A="Thinking":A="Reasoning"}}else if(H==="action_execution_result")((te=Q.task_execution)==null?void 0:te.status)==="completed"?A="Task execution completed":(ee=Q.task_execution)!=null&&ee.approach?A=Q.task_execution.approach:A="Executing task";else if(H==="assistant_task_breakdown")(Y=Q.task_breakdown)!=null&&Y.total_tasks?A=`Identified ${Q.task_breakdown.total_tasks} tasks`:A="Planning tasks";else if(H==="assistant_validation")A="Validated results";else if(H==="assistant_action_planning")(de=Q.task_execution)!=null&&de.total_tasks?A=`Planned ${Q.task_execution.total_tasks} tasks`:(F=(ue=Q.task_execution)==null?void 0:ue.tasks)!=null&&F.length?A=`Planned ${Q.task_execution.tasks.length} tasks`:A="Planning actions";else if(H==="context_results"){const G=Q.query,re=Q.result_count||0;G&&G!=="General context gathering"?A=`${G}: Found ${re} results`:A=`Found ${re} results`}A&&!ae(U)&&c(G=>[...G,{id:U,role:"system",content:A,timestamp:new Date,metadata:{type:"log",messageType:H}}]);return}if(H==="user_message")ae(U)||(d(null),m(null),c(A=>[...A,{id:U,role:"user",content:Q.message,images:Q.images,timestamp:new Date}]));else if(H==="agent_response")ae(U)||(d(null),m(null),_(!1),y(Le.IDLE),E.current=null,c(A=>[...A,{id:U,role:"assistant",content:Q.response,timestamp:new Date,isStreaming:!1}]));else if(H==="assistant_acknowledgment")ae(U)||(d(null),m(null),c(A=>[...A,{id:U,role:"assistant",content:Q.acknowledgment_message,timestamp:new Date}]));else if(H==="assistant_ideation"||H==="assistant_action_planning"||H==="action_execution_result"||H==="assistant_validation"||H==="assistant_context_gathering"||H==="assistant_task_breakdown"){let A="";if(Q.reasoning_summary)A=Q.reasoning_summary;else if((M=Q.task_execution)!=null&&M.approach)A=Q.task_execution.approach;else if(Q.strategic_synthesis)A=Q.strategic_synthesis;else if((W=Q.task_breakdown)!=null&&W.total_tasks)A=`Breaking down into ${Q.task_breakdown.total_tasks} tasks...`;else if(Q.acknowledgment_message)A=Q.acknowledgment_message;else return;c(G=>[...G,{id:U,role:"assistant",content:A,timestamp:new Date}])}else if(H==="user_input_request"){const A={question:Q.question,context:Q.context,input_type:Q.input_type,options:Q.options||Q.suggestions,default_value:Q.default_value,placeholder:Q.placeholder};y("waiting_for_input"),c(G=>[...G,{id:U,role:"system",content:A.question,timestamp:new Date,metadata:{type:"user_input_request",userInputRequest:A}}])}},[]),O=i.useCallback(async K=>{y("waiting_for_input");const U=`input-request-${Date.now()}`;c(H=>[...H,{id:U,role:"system",content:K.question,timestamp:new Date,metadata:{type:"user_input_request",userInputRequest:K}}])},[]),I=i.useCallback(K=>{const{event_label:U,event_data:H}=K;n!=null&&n.onPlatformEvent&&n.onPlatformEvent(U,H)},[n]),T=i.useCallback(async K=>{const{function_name:U,function_data:H}=K,{parameters:Q,execution_id:ae}=H;if(!(n!=null&&n.onPlatformFunction)){Ye.send({message_type:{platform_function_result:[ae,{error:"No platform function handler registered"}]},data:{}});return}try{const te=await n.onPlatformFunction(U,Q,ae),ee={message_type:{platform_function_result:[ae,te]},data:{}};Ye.send(ee)}catch(te){Ye.send({message_type:{platform_function_result:[ae,{error:te instanceof Error?te.message:"Function execution failed",stack:te instanceof Error?te.stack:void 0}]},data:{}})}},[n]);i.useEffect(()=>{if(!s)return;const U=`wss://${s==null?void 0:s.backend_host.replace(/https?:\/\//,"")}/realtime/agent?token=${encodeURIComponent(o)}`;C({status:mt.CONNECTING}),Ye.connect(U)},[s,o]),i.useEffect(()=>Ye.onConnectionStateChange(U=>{C({status:U.isConnected?mt.CONNECTED:U.error?mt.ERROR:mt.DISCONNECTED}),x(U.isConnected)}),[]),i.useEffect(()=>Ye.onMessage(R),[R]),i.useEffect(()=>{v&&t&&r&&a&&Ye.send({message_type:{session_connect:[t,r]},data:{}})},[v,t,r,a]);const N=i.useCallback(async()=>(v&&t&&r&&Ye.send({message_type:{session_connect:[t,r]},data:{}}),()=>{}),[v,t,r]),L=i.useCallback((K,U)=>{v&&(d(K),m(U||null),_(!0),y(Le.STARTING),Ye.send({message_type:{message_input:K},data:U?{images:U}:{}}))},[v]),D=i.useCallback(()=>{c([]),E.current=null},[]),B=i.useCallback(K=>{!v||z!==Le.WAITING_FOR_INPUT||(Ye.send({message_type:{user_input_response:K},data:{}}),y(Le.RUNNING))},[v,z]),oe=i.useCallback(async K=>{var U;if(!(!o||!t))try{const H=new URLSearchParams({token:o,limit:"50"});K&&(H.append("before_id",K),S(!0));const ae=await(await p(`/api/agent/contexts/${t}/messages?${H}`,{method:"GET"})).json();if(ae.status===200&&ae.data){const te=ae.data;if(Array.isArray(te.data)){const ee=te.data.filter(Y=>{var F;let de=Y.content;if(typeof Y.content=="string")try{de=JSON.parse(Y.content)}catch{de={message:Y.content}}const ue=((F=Y.metadata)==null?void 0:F.message_type)||(de==null?void 0:de.message_type);return ue==="user_message"||ue==="agent_response"||ue==="assistant_acknowledgment"||ue==="user_input_request"||ue==="system_decision"||ue==="action_execution_result"||ue==="assistant_task_breakdown"||ue==="assistant_validation"||ue==="assistant_action_planning"||ue==="context_results"}).map(Y=>{var A,G,re,pe,we,Te,q;let de="",ue,F,M=Y.content;if(typeof Y.content=="string")try{M=JSON.parse(Y.content)}catch{M=Y.content}const W=((A=Y.metadata)==null?void 0:A.message_type)||(M==null?void 0:M.message_type);if(W==="user_message"?(de=(M==null?void 0:M.message)||"",ue=(M==null?void 0:M.images)||void 0):W==="agent_response"?de=(M==null?void 0:M.response)||"":W==="assistant_acknowledgment"?de=(M==null?void 0:M.acknowledgment_message)||"":W==="user_input_request"&&(de=(M==null?void 0:M.question)||"",F={type:"user_input_request",userInputRequest:{question:(M==null?void 0:M.question)||"",context:(M==null?void 0:M.context)||"",input_type:(M==null?void 0:M.input_type)||"text",options:(M==null?void 0:M.options)||(M==null?void 0:M.suggestions)||[],default_value:(M==null?void 0:M.default_value)||"",placeholder:(M==null?void 0:M.placeholder)||""}}),W==="system_decision"||W==="action_execution_result"||W==="assistant_task_breakdown"||W==="assistant_validation"||W==="assistant_action_planning"||W==="context_results"){let J="";if(W==="system_decision"){const Z=M==null?void 0:M.step,ce=M==null?void 0:M.reasoning;if(Z==="gathercontext")ce&&ce.length>0?J=ce.length>60?`${ce.substring(0,60)}...`:ce:J="Gathering context...";else if(Z==="executeaction")J="Executing action";else if(Z==="deliverresponse")J="Preparing response";else if(Z==="taskplanning")J="Planning approach";else if(Z==="validateprogress")J="Validating progress";else if(Z==="acknowledge")J="Processing request";else if(Z==="finishplanning")J="Finalizing plan";else if(Z==="executetasks")J="Executing tasks";else if(Z==="requestuserinput")J="Waiting for input";else if(Z==="complete")J="Completed";else if(Z==="examinetool")J="Examining tool";else if(Z==="examineworkflow")J="Examining workflow";else{const je=(M==null?void 0:M.confidence)||.5;je>.8?J="Analyzing":je>.6?J="Thinking":J="Reasoning"}}else if(W==="action_execution_result")((G=M==null?void 0:M.task_execution)==null?void 0:G.status)==="completed"?J="Task execution completed":(re=M==null?void 0:M.task_execution)!=null&&re.approach?J=M.task_execution.approach:J="Executing task";else if(W==="assistant_task_breakdown")(pe=M==null?void 0:M.task_breakdown)!=null&&pe.total_tasks?J=`Identified ${M.task_breakdown.total_tasks} tasks`:J="Planning tasks";else if(W==="assistant_validation")J="Validated results";else if(W==="assistant_action_planning")(we=M==null?void 0:M.task_execution)!=null&&we.total_tasks?J=`Planned ${M.task_execution.total_tasks} tasks`:(q=(Te=M==null?void 0:M.task_execution)==null?void 0:Te.tasks)!=null&&q.length?J=`Planned ${M.task_execution.tasks.length} tasks`:J="Planning actions";else if(W==="context_results"){const Z=M==null?void 0:M.query,ce=(M==null?void 0:M.result_count)||0;Z&&Z!=="General context gathering"?J=`${Z}: Found ${ce} results`:J=`Found ${ce} results`}de=J,F={type:"log",messageType:W}}return{id:Y.id,role:W==="user_message"?"user":W==="user_input_request"?"system":"assistant",content:de,images:ue,timestamp:new Date(Y.timestamp||Y.created_at||Date.now()),metadata:F}}).filter(Y=>Y.content||Y.metadata||Y.images).sort((Y,de)=>{const ue=BigInt(Y.id),F=BigInt(de.id);return ue<F?-1:ue>F?1:0});ee.length>0&&(k.current=ee[0].id),K?(c(Y=>[...ee,...Y]),b(ee.length>=50)):(c(ee),ee.length>0&&((U=ee[ee.length-1].metadata)==null?void 0:U.type)==="user_input_request"&&y(Le.WAITING_FOR_INPUT)),S(!1)}}}catch(H){console.error("Failed to fetch messages:",H),S(!1)}},[o,t,p]);i.useEffect(()=>{t&&o&&oe()},[t,o]);const se=i.useCallback(async()=>{if(!(g||!j||!k.current)){S(!0);try{await oe(k.current)}finally{S(!1)}}},[g,j,oe]),ne=i.useCallback(()=>{!v||!w||(Ye.send({message_type:{cancel_execution:null},data:{}}),_(!1),y("idle"))},[v,w]);return{messages:f,pendingMessage:h,pendingImages:u,connectionState:P,isConnected:v,isExecuting:w,executionStatus:z,isWaitingForInput:z==="waiting_for_input",hasMoreMessages:j,isLoadingMore:g,sendMessage:L,submitUserInput:B,clearMessages:D,loadMoreMessages:se,cancelExecution:ne,connect:N,disconnect:()=>Ye.disconnect()}}const tc=()=>{const{client:t}=Me(),[r,o]=i.useState(!1),[n,a]=i.useState(null),[s,p]=i.useState(null),f=i.useCallback(async h=>{o(!0),a(null),p(null);try{const d=await t("/organizations/invitations/accept",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:h})}),m=(await V(d)).data;return p(m),m.error_code&&a(m.message||"Failed to accept invitation"),m}catch(d){const u=d.message||"Failed to accept invitation";a(u);const m={error_code:"NETWORK_ERROR",message:u};return p(m),m}finally{o(!1)}},[t]),c=i.useCallback(()=>{a(null),p(null)},[]);return{acceptInvitation:f,invitationData:s,loading:r,error:n,reset:c}},Xd=({children:t})=>{const{loading:r}=ve();return r?null:e.jsx(e.Fragment,{children:t})},Jd=({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,a=arguments.length;n<a;n++){o=arguments[n];for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])}return r},He.apply(this,arguments)};function Kt(t,r,o){if(o||arguments.length===2)for(var n=0,a=r.length,s;n<a;n++)(s||!(n in r))&&(s||(s=Array.prototype.slice.call(r,0,n)),s[n]=r[n]);return t.concat(s||Array.prototype.slice.call(r))}function eu(t){var r=Object.create(null);return function(o){return r[o]===void 0&&(r[o]=t(o)),r[o]}}var tu=/^((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)-.*))$/,ru=eu(function(t){return tu.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),$e="-ms-",Mr="-moz-",ke="-webkit-",rc="comm",Uo="rule",ha="decl",ou="@import",oc="@keyframes",nu="@layer",nc=Math.abs,fa=String.fromCharCode,Xn=Object.assign;function au(t,r){return Fe(t,0)^45?(((r<<2^Fe(t,0))<<2^Fe(t,1))<<2^Fe(t,2))<<2^Fe(t,3):0}function ac(t){return t.trim()}function gt(t,r){return(t=r.exec(t))?t[0]:t}function ge(t,r,o){return t.replace(r,o)}function _o(t,r,o){return t.indexOf(r,o)}function Fe(t,r){return t.charCodeAt(r)|0}function hr(t,r,o){return t.slice(r,o)}function it(t){return t.length}function sc(t){return t.length}function Tr(t,r){return r.push(t),t}function su(t,r){return t.map(r).join("")}function La(t,r){return t.filter(function(o){return!gt(o,r)})}var Wo=1,fr=1,ic=0,Ke=0,Ae=0,yr="";function Vo(t,r,o,n,a,s,p,f){return{value:t,root:r,parent:o,type:n,props:a,children:s,line:Wo,column:fr,length:p,return:"",siblings:f}}function _t(t,r){return Xn(Vo("",null,null,"",null,null,0,t.siblings),t,{length:-t.length},r)}function nr(t){for(;t.root;)t=_t(t.root,{children:[t]});Tr(t,t.siblings)}function iu(){return Ae}function cu(){return Ae=Ke>0?Fe(yr,--Ke):0,fr--,Ae===10&&(fr=1,Wo--),Ae}function et(){return Ae=Ke<ic?Fe(yr,Ke++):0,fr++,Ae===10&&(fr=1,Wo++),Ae}function Ht(){return Fe(yr,Ke)}function Co(){return Ke}function Go(t,r){return hr(yr,t,r)}function Jn(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 lu(t){return Wo=fr=1,ic=it(yr=t),Ke=0,[]}function du(t){return yr="",t}function un(t){return ac(Go(Ke-1,ea(t===91?t+2:t===40?t+1:t)))}function uu(t){for(;(Ae=Ht())&&Ae<33;)et();return Jn(t)>2||Jn(Ae)>3?"":" "}function pu(t,r){for(;--r&&et()&&!(Ae<48||Ae>102||Ae>57&&Ae<65||Ae>70&&Ae<97););return Go(t,Co()+(r<6&&Ht()==32&&et()==32))}function ea(t){for(;et();)switch(Ae){case t:return Ke;case 34:case 39:t!==34&&t!==39&&ea(Ae);break;case 40:t===41&&ea(t);break;case 92:et();break}return Ke}function hu(t,r){for(;et()&&t+Ae!==57;)if(t+Ae===84&&Ht()===47)break;return"/*"+Go(r,Ke-1)+"*"+fa(t===47?t:et())}function fu(t){for(;!Jn(Ht());)et();return Go(t,Ke)}function gu(t){return du(So("",null,null,null,[""],t=lu(t),0,[0],t))}function So(t,r,o,n,a,s,p,f,c){for(var h=0,d=0,u=p,m=0,v=0,x=0,w=1,_=1,z=1,y=0,P="",C=a,j=s,b=n,g=P;_;)switch(x=y,y=et()){case 40:if(x!=108&&Fe(g,u-1)==58){_o(g+=ge(un(y),"&","&\f"),"&\f",nc(h?f[h-1]:0))!=-1&&(z=-1);break}case 34:case 39:case 91:g+=un(y);break;case 9:case 10:case 13:case 32:g+=uu(x);break;case 92:g+=pu(Co()-1,7);continue;case 47:switch(Ht()){case 42:case 47:Tr(mu(hu(et(),Co()),r,o,c),c);break;default:g+="/"}break;case 123*w:f[h++]=it(g)*z;case 125*w:case 59:case 0:switch(y){case 0:case 125:_=0;case 59+d:z==-1&&(g=ge(g,/\f/g,"")),v>0&&it(g)-u&&Tr(v>32?Da(g+";",n,o,u-1,c):Da(ge(g," ","")+";",n,o,u-2,c),c);break;case 59:g+=";";default:if(Tr(b=Aa(g,r,o,h,d,a,f,P,C=[],j=[],u,s),s),y===123)if(d===0)So(g,r,b,b,C,s,u,f,j);else switch(m===99&&Fe(g,3)===110?100:m){case 100:case 108:case 109:case 115:So(t,b,b,n&&Tr(Aa(t,b,b,0,0,a,f,P,a,C=[],u,j),j),a,j,u,f,n?C:j);break;default:So(g,b,b,b,[""],j,0,f,j)}}h=d=v=0,w=z=1,P=g="",u=p;break;case 58:u=1+it(g),v=x;default:if(w<1){if(y==123)--w;else if(y==125&&w++==0&&cu()==125)continue}switch(g+=fa(y),y*w){case 38:z=d>0?1:(g+="\f",-1);break;case 44:f[h++]=(it(g)-1)*z,z=1;break;case 64:Ht()===45&&(g+=un(et())),m=Ht(),d=u=it(P=g+=fu(Co())),y++;break;case 45:x===45&&it(g)==2&&(w=0)}}return s}function Aa(t,r,o,n,a,s,p,f,c,h,d,u){for(var m=a-1,v=a===0?s:[""],x=sc(v),w=0,_=0,z=0;w<n;++w)for(var y=0,P=hr(t,m+1,m=nc(_=p[w])),C=t;y<x;++y)(C=ac(_>0?v[y]+" "+P:ge(P,/&\f/g,v[y])))&&(c[z++]=C);return Vo(t,r,o,a===0?Uo:f,c,h,d,u)}function mu(t,r,o,n){return Vo(t,r,o,rc,fa(iu()),hr(t,2,-2),0,n)}function Da(t,r,o,n,a){return Vo(t,r,o,ha,hr(t,0,n),hr(t,n+1,-1),n,a)}function cc(t,r,o){switch(au(t,r)){case 5103:return ke+"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 ke+t+t;case 4789:return Mr+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return ke+t+Mr+t+$e+t+t;case 5936:switch(Fe(t,r+11)){case 114:return ke+t+$e+ge(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return ke+t+$e+ge(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return ke+t+$e+ge(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return ke+t+$e+t+t;case 6165:return ke+t+$e+"flex-"+t+t;case 5187:return ke+t+ge(t,/(\w+).+(:[^]+)/,ke+"box-$1$2"+$e+"flex-$1$2")+t;case 5443:return ke+t+$e+"flex-item-"+ge(t,/flex-|-self/g,"")+(gt(t,/flex-|baseline/)?"":$e+"grid-row-"+ge(t,/flex-|-self/g,""))+t;case 4675:return ke+t+$e+"flex-line-pack"+ge(t,/align-content|flex-|-self/g,"")+t;case 5548:return ke+t+$e+ge(t,"shrink","negative")+t;case 5292:return ke+t+$e+ge(t,"basis","preferred-size")+t;case 6060:return ke+"box-"+ge(t,"-grow","")+ke+t+$e+ge(t,"grow","positive")+t;case 4554:return ke+ge(t,/([^-])(transform)/g,"$1"+ke+"$2")+t;case 6187:return ge(ge(ge(t,/(zoom-|grab)/,ke+"$1"),/(image-set)/,ke+"$1"),t,"")+t;case 5495:case 3959:return ge(t,/(image-set\([^]*)/,ke+"$1$`$1");case 4968:return ge(ge(t,/(.+:)(flex-)?(.*)/,ke+"box-pack:$3"+$e+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+ke+t+t;case 4200:if(!gt(t,/flex-|baseline/))return $e+"grid-column-align"+hr(t,r)+t;break;case 2592:case 3360:return $e+ge(t,"template-","")+t;case 4384:case 3616:return o&&o.some(function(n,a){return r=a,gt(n.props,/grid-\w+-end/)})?~_o(t+(o=o[r].value),"span",0)?t:$e+ge(t,"-start","")+t+$e+"grid-row-span:"+(~_o(o,"span",0)?gt(o,/\d+/):+gt(o,/\d+/)-+gt(t,/\d+/))+";":$e+ge(t,"-start","")+t;case 4896:case 4128:return o&&o.some(function(n){return gt(n.props,/grid-\w+-start/)})?t:$e+ge(ge(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return ge(t,/(.+)-inline(.+)/,ke+"$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(Fe(t,r+1)){case 109:if(Fe(t,r+4)!==45)break;case 102:return ge(t,/(.+:)(.+)-([^]+)/,"$1"+ke+"$2-$3$1"+Mr+(Fe(t,r+3)==108?"$3":"$2-$3"))+t;case 115:return~_o(t,"stretch",0)?cc(ge(t,"stretch","fill-available"),r,o)+t:t}break;case 5152:case 5920:return ge(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(n,a,s,p,f,c,h){return $e+a+":"+s+h+(p?$e+a+"-span:"+(f?c:+c-+s)+h:"")+t});case 4949:if(Fe(t,r+6)===121)return ge(t,":",":"+ke)+t;break;case 6444:switch(Fe(t,Fe(t,14)===45?18:11)){case 120:return ge(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+ke+(Fe(t,14)===45?"inline-":"")+"box$3$1"+ke+"$2$3$1"+$e+"$2box$3")+t;case 100:return ge(t,":",":"+$e)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return ge(t,"scroll-","scroll-snap-")+t}return t}function Io(t,r){for(var o="",n=0;n<t.length;n++)o+=r(t[n],n,t,r)||"";return o}function xu(t,r,o,n){switch(t.type){case nu:if(t.children.length)break;case ou:case ha:return t.return=t.return||t.value;case rc:return"";case oc:return t.return=t.value+"{"+Io(t.children,n)+"}";case Uo:if(!it(t.value=t.props.join(",")))return""}return it(o=Io(t.children,n))?t.return=t.value+"{"+o+"}":""}function vu(t){var r=sc(t);return function(o,n,a,s){for(var p="",f=0;f<r;f++)p+=t[f](o,n,a,s)||"";return p}}function bu(t){return function(r){r.root||(r=r.return)&&t(r)}}function yu(t,r,o,n){if(t.length>-1&&!t.return)switch(t.type){case ha:t.return=cc(t.value,t.length,o);return;case oc:return Io([_t(t,{value:ge(t.value,"@","@"+ke)})],n);case Uo:if(t.length)return su(o=t.props,function(a){switch(gt(a,n=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":nr(_t(t,{props:[ge(a,/:(read-\w+)/,":"+Mr+"$1")]})),nr(_t(t,{props:[a]})),Xn(t,{props:La(o,n)});break;case"::placeholder":nr(_t(t,{props:[ge(a,/:(plac\w+)/,":"+ke+"input-$1")]})),nr(_t(t,{props:[ge(a,/:(plac\w+)/,":"+Mr+"$1")]})),nr(_t(t,{props:[ge(a,/:(plac\w+)/,$e+"input-$1")]})),nr(_t(t,{props:[a]})),Xn(t,{props:La(o,n)});break}return""})}}var wu={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},Qt=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",lc="active",dc="data-styled-version",Ho="6.1.19",ga=`/*!sc*/
|
|
19
19
|
`,To=typeof window<"u"&&typeof document<"u",ju=!!(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"),Na=/invalid hook call/i,Yr=new Set,ku=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
|
-
`,a=console.error;try{var s=!0;console.error=function(p){for(var f=[],c=1;c<arguments.length;c++)f[c-1]=arguments[c];Na.test(p)?(s=!1,Yr.delete(n)):a.apply(void 0,Kt([p],f,!1))},i.useRef(),s&&!Yr.has(n)&&(console.warn(n),Yr.add(n))}catch(p){Na.test(p.message)&&Yr.delete(n)}finally{console.error=a}}},qo=Object.freeze([]),gr=Object.freeze({});function _u(t,r,o){return o===void 0&&(o=gr),t.theme!==o.theme&&t.theme||r||o.theme}var ta=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"]),Cu=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,Su=/(^-|-$)/g;function Fa(t){return t.replace(Cu,"-").replace(Su,"")}var $u=/(a)(d)/gi,Zr=52,Ba=function(t){return String.fromCharCode(t+(t>25?39:97))};function ra(t){var r,o="";for(r=Math.abs(t);r>Zr;r=r/Zr|0)o=Ba(r%Zr)+o;return(Ba(r%Zr)+o).replace($u,"$1-$2")}var pn,uc=5381,Wt=function(t,r){for(var o=r.length;o;)t=33*t^r.charCodeAt(--o);return t},pc=function(t){return Wt(uc,t)};function hc(t){return ra(pc(t)>>>0)}function fc(t){return process.env.NODE_ENV!=="production"&&typeof t=="string"&&t||t.displayName||t.name||"Component"}function hn(t){return typeof t=="string"&&(process.env.NODE_ENV==="production"||t.charAt(0)===t.charAt(0).toLowerCase())}var gc=typeof Symbol=="function"&&Symbol.for,mc=gc?Symbol.for("react.memo"):60115,zu=gc?Symbol.for("react.forward_ref"):60112,Eu={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},
|
|
23
|
+
`,a=console.error;try{var s=!0;console.error=function(p){for(var f=[],c=1;c<arguments.length;c++)f[c-1]=arguments[c];Na.test(p)?(s=!1,Yr.delete(n)):a.apply(void 0,Kt([p],f,!1))},i.useRef(),s&&!Yr.has(n)&&(console.warn(n),Yr.add(n))}catch(p){Na.test(p.message)&&Yr.delete(n)}finally{console.error=a}}},qo=Object.freeze([]),gr=Object.freeze({});function _u(t,r,o){return o===void 0&&(o=gr),t.theme!==o.theme&&t.theme||r||o.theme}var ta=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"]),Cu=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,Su=/(^-|-$)/g;function Fa(t){return t.replace(Cu,"-").replace(Su,"")}var $u=/(a)(d)/gi,Zr=52,Ba=function(t){return String.fromCharCode(t+(t>25?39:97))};function ra(t){var r,o="";for(r=Math.abs(t);r>Zr;r=r/Zr|0)o=Ba(r%Zr)+o;return(Ba(r%Zr)+o).replace($u,"$1-$2")}var pn,uc=5381,Wt=function(t,r){for(var o=r.length;o;)t=33*t^r.charCodeAt(--o);return t},pc=function(t){return Wt(uc,t)};function hc(t){return ra(pc(t)>>>0)}function fc(t){return process.env.NODE_ENV!=="production"&&typeof t=="string"&&t||t.displayName||t.name||"Component"}function hn(t){return typeof t=="string"&&(process.env.NODE_ENV==="production"||t.charAt(0)===t.charAt(0).toLowerCase())}var gc=typeof Symbol=="function"&&Symbol.for,mc=gc?Symbol.for("react.memo"):60115,zu=gc?Symbol.for("react.forward_ref"):60112,Eu={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Pu={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},xc={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Ru=((pn={})[zu]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},pn[mc]=xc,pn);function Ua(t){return("type"in(r=t)&&r.type.$$typeof)===mc?xc:"$$typeof"in t?Ru[t.$$typeof]:Eu;var r}var Iu=Object.defineProperty,Tu=Object.getOwnPropertyNames,Wa=Object.getOwnPropertySymbols,Ou=Object.getOwnPropertyDescriptor,Mu=Object.getPrototypeOf,Va=Object.prototype;function vc(t,r,o){if(typeof r!="string"){if(Va){var n=Mu(r);n&&n!==Va&&vc(t,n,o)}var a=Tu(r);Wa&&(a=a.concat(Wa(r)));for(var s=Ua(t),p=Ua(r),f=0;f<a.length;++f){var c=a[f];if(!(c in Pu||o&&o[c]||p&&c in p||s&&c in s)){var h=Ou(r,c);try{Iu(t,c,h)}catch{}}}}return t}function mr(t){return typeof t=="function"}function ma(t){return typeof t=="object"&&"styledComponentId"in t}function Gt(t,r){return t&&r?"".concat(t," ").concat(r):t||r||""}function oa(t,r){if(t.length===0)return"";for(var o=t[0],n=1;n<t.length;n++)o+=t[n];return o}function xr(t){return t!==null&&typeof t=="object"&&t.constructor.name===Object.name&&!("props"in t&&t.$$typeof)}function na(t,r,o){if(o===void 0&&(o=!1),!o&&!xr(t)&&!Array.isArray(t))return r;if(Array.isArray(r))for(var n=0;n<r.length;n++)t[n]=na(t[n],r[n]);else if(xr(r))for(var n in r)t[n]=na(t[n],r[n]);return t}function xa(t,r){Object.defineProperty(t,"toString",{value:r})}var Lu=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 Lu(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var o=t[0],n=[],a=1,s=t.length;a<s;a+=1)n.push(t[a]);return n.forEach(function(p){o=o.replace(/%[a-z]/,p)}),o}function wr(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(Lu.apply(void 0,Kt([Au[t]],r,!1)).trim())}var Du=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,a=n.length,s=a;r>=s;)if((s<<=1)<0)throw wr(16,"".concat(r));this.groupSizes=new Uint32Array(s),this.groupSizes.set(n),this.length=s;for(var p=a;p<s;p++)this.groupSizes[p]=0}for(var f=this.indexOfGroup(r+1),c=(p=0,o.length);p<c;p++)this.tag.insertRule(f,o[p])&&(this.groupSizes[r]++,f++)},t.prototype.clearGroup=function(r){if(r<this.length){var o=this.groupSizes[r],n=this.indexOfGroup(r),a=n+o;this.groupSizes[r]=0;for(var s=n;s<a;s++)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],a=this.indexOfGroup(r),s=a+n,p=a;p<s;p++)o+="".concat(this.tag.getRule(p)).concat(ga);return o},t}(),Nu=1<<30,$o=new Map,Oo=new Map,zo=1,Kr=function(t){if($o.has(t))return $o.get(t);for(;Oo.has(zo);)zo++;var r=zo++;if(process.env.NODE_ENV!=="production"&&((0|r)<0||r>Nu))throw wr(16,"".concat(r));return $o.set(t,r),Oo.set(r,t),r},Fu=function(t,r){zo=r+1,$o.set(t,r),Oo.set(r,t)},Bu="style[".concat(Qt,"][").concat(dc,'="').concat(Ho,'"]'),Uu=new RegExp("^".concat(Qt,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),Wu=function(t,r,o){for(var n,a=o.split(","),s=0,p=a.length;s<p;s++)(n=a[s])&&t.registerName(r,n)},Vu=function(t,r){for(var o,n=((o=r.textContent)!==null&&o!==void 0?o:"").split(ga),a=[],s=0,p=n.length;s<p;s++){var f=n[s].trim();if(f){var c=f.match(Uu);if(c){var h=0|parseInt(c[1],10),d=c[2];h!==0&&(Fu(d,h),Wu(t,d,c[3]),t.getTag().insertRules(h,a)),a.length=0}else a.push(f)}}},Ga=function(t){for(var r=document.querySelectorAll(Bu),o=0,n=r.length;o<n;o++){var a=r[o];a&&a.getAttribute(Qt)!==lc&&(Vu(t,a),a.parentNode&&a.parentNode.removeChild(a))}};function Gu(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var bc=function(t){var r=document.head,o=t||r,n=document.createElement("style"),a=function(f){var c=Array.from(f.querySelectorAll("style[".concat(Qt,"]")));return c[c.length-1]}(o),s=a!==void 0?a.nextSibling:null;n.setAttribute(Qt,lc),n.setAttribute(dc,Ho);var p=Gu();return p&&n.setAttribute("nonce",p),o.insertBefore(n,s),n},Hu=function(){function t(r){this.element=bc(r),this.element.appendChild(document.createTextNode("")),this.sheet=function(o){if(o.sheet)return o.sheet;for(var n=document.styleSheets,a=0,s=n.length;a<s;a++){var p=n[a];if(p.ownerNode===o)return p}throw wr(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}(),qu=function(){function t(r){this.element=bc(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}(),Yu=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}(),Ha=To,Zu={isServer:!To,useCSSOMInjection:!ju},yc=function(){function t(r,o,n){r===void 0&&(r=gr),o===void 0&&(o={});var a=this;this.options=He(He({},Zu),r),this.gs=o,this.names=new Map(n),this.server=!!r.isServer,!this.server&&To&&Ha&&(Ha=!1,Ga(this)),xa(this,function(){return function(s){for(var p=s.getTag(),f=p.length,c="",h=function(u){var m=function(z){return Oo.get(z)}(u);if(m===void 0)return"continue";var v=s.names.get(m),x=p.getGroup(u);if(v===void 0||!v.size||x.length===0)return"continue";var w="".concat(Qt,".g").concat(u,'[id="').concat(m,'"]'),_="";v!==void 0&&v.forEach(function(z){z.length>0&&(_+="".concat(z,","))}),c+="".concat(x).concat(w,'{content:"').concat(_,'"}').concat(ga)},d=0;d<f;d++)h(d);return c}(a)})}return t.registerId=function(r){return Kr(r)},t.prototype.rehydrate=function(){!this.server&&To&&Ga(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,a=o.target;return o.isServer?new Yu(a):n?new Hu(a):new qu(a)}(this.options),new Du(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(Kr(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(Kr(r),n)},t.prototype.clearNames=function(r){this.names.has(r)&&this.names.get(r).clear()},t.prototype.clearRules=function(r){this.getTag().clearGroup(Kr(r)),this.clearNames(r)},t.prototype.clearTag=function(){this.tag=void 0},t}(),Ku=/&/g,Qu=/^\s*\/\/.*$/gm;function wc(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=wc(o.children,r)),o})}function Xu(t){var r,o,n,a=gr,s=a.options,p=s===void 0?gr:s,f=a.plugins,c=f===void 0?qo:f,h=function(m,v,x){return x.startsWith(o)&&x.endsWith(o)&&x.replaceAll(o,"").length>0?".".concat(r):m},d=c.slice();d.push(function(m){m.type===Uo&&m.value.includes("&")&&(m.props[0]=m.props[0].replace(Ku,o).replace(n,h))}),p.prefix&&d.push(yu),d.push(xu);var u=function(m,v,x,w){v===void 0&&(v=""),x===void 0&&(x=""),w===void 0&&(w="&"),r=w,o=v,n=new RegExp("\\".concat(o,"\\b"),"g");var _=m.replace(Qu,""),z=gu(x||v?"".concat(x," ").concat(v," { ").concat(_," }"):_);p.namespace&&(z=wc(z,p.namespace));var y=[];return Po(z,vu(d.concat(bu(function(I){return y.push(I)})))),y};return u.hash=c.length?c.reduce(function(m,v){return v.name||wr(15),Wt(m,v.name)},uc).toString():"",u}var Ju=new yc,aa=Xu(),jc=i.createContext({shouldForwardProp:void 0,styleSheet:Ju,stylis:aa});jc.Consumer;i.createContext(void 0);function qa(){return i.useContext(jc)}var sa=function(){function t(r,o){var n=this;this.inject=function(a,s){s===void 0&&(s=aa);var p=n.name+s.hash;a.hasNameForId(n.id,p)||a.insertRules(n.id,p,s(n.rules,p,"@keyframes"))},this.name=r,this.id="sc-keyframes-".concat(r),this.rules=o,xa(this,function(){throw wr(12,String(n.name))})}return t.prototype.getName=function(r){return r===void 0&&(r=aa),this.name+r.hash},t}(),ep=function(t){return t>="A"&&t<="Z"};function Ya(t){for(var r="",o=0;o<t.length;o++){var n=t[o];if(o===1&&n==="-"&&t[0]==="-")return t;ep(n)?r+="-"+n.toLowerCase():r+=n}return r.startsWith("ms-")?"-"+r:r}var kc=function(t){return t==null||t===!1||t===""},_c=function(t){var r,o,n=[];for(var a in t){var s=t[a];t.hasOwnProperty(a)&&!kc(s)&&(Array.isArray(s)&&s.isCss||mr(s)?n.push("".concat(Ya(a),":"),s,";"):xr(s)?n.push.apply(n,Kt(Kt(["".concat(a," {")],_c(s),!1),["}"],!1)):n.push("".concat(Ya(a),": ").concat((r=a,(o=s)==null||typeof o=="boolean"||o===""?"":typeof o!="number"||o===0||r in wu||r.startsWith("--")?String(o).trim():"".concat(o,"px")),";")))}return n};function qt(t,r,o,n){if(kc(t))return[];if(ma(t))return[".".concat(t.styledComponentId)];if(mr(t)){if(!mr(s=t)||s.prototype&&s.prototype.isReactComponent||!r)return[t];var a=t(r);return process.env.NODE_ENV==="production"||typeof a!="object"||Array.isArray(a)||a instanceof sa||xr(a)||a===null||console.error("".concat(fc(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.")),qt(a,r,o,n)}var s;return t instanceof sa?o?(t.inject(o,n),[t.getName(n)]):[t]:xr(t)?_c(t):Array.isArray(t)?Array.prototype.concat.apply(qo,t.map(function(p){return qt(p,r,o,n)})):[t.toString()]}function tp(t){for(var r=0;r<t.length;r+=1){var o=t[r];if(mr(o)&&!ma(o))return!1}return!0}var rp=pc(Ho),op=function(){function t(r,o,n){this.rules=r,this.staticRulesId="",this.isStatic=process.env.NODE_ENV==="production"&&(n===void 0||n.isStatic)&&tp(r),this.componentId=o,this.baseHash=Wt(rp,o),this.baseStyle=n,yc.registerId(o)}return t.prototype.generateAndInjectStyles=function(r,o,n){var a=this.baseStyle?this.baseStyle.generateAndInjectStyles(r,o,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&o.hasNameForId(this.componentId,this.staticRulesId))a=Gt(a,this.staticRulesId);else{var s=oa(qt(this.rules,r,o,n)),p=ra(Wt(this.baseHash,s)>>>0);if(!o.hasNameForId(this.componentId,p)){var f=n(s,".".concat(p),void 0,this.componentId);o.insertRules(this.componentId,p,f)}a=Gt(a,p),this.staticRulesId=p}else{for(var c=Wt(this.baseHash,n.hash),h="",d=0;d<this.rules.length;d++){var u=this.rules[d];if(typeof u=="string")h+=u,process.env.NODE_ENV!=="production"&&(c=Wt(c,u));else if(u){var m=oa(qt(u,r,o,n));c=Wt(c,m+d),h+=m}}if(h){var v=ra(c>>>0);o.hasNameForId(this.componentId,v)||o.insertRules(this.componentId,v,n(h,".".concat(v),void 0,this.componentId)),a=Gt(a,v)}}return a},t}(),Cc=i.createContext(void 0);Cc.Consumer;var fn={},Za=new Set;function np(t,r,o){var n=ma(t),a=t,s=!hn(t),p=r.attrs,f=p===void 0?qo:p,c=r.componentId,h=c===void 0?function(C,j){var b=typeof C!="string"?"sc":Fa(C);fn[b]=(fn[b]||0)+1;var g="".concat(b,"-").concat(hc(Ho+b+fn[b]));return j?"".concat(j,"-").concat(g):g}(r.displayName,r.parentComponentId):c,d=r.displayName,u=d===void 0?function(C){return hn(C)?"styled.".concat(C):"Styled(".concat(fc(C),")")}(t):d,m=r.displayName&&r.componentId?"".concat(Fa(r.displayName),"-").concat(r.componentId):r.componentId||h,v=n&&a.attrs?a.attrs.concat(f).filter(Boolean):f,x=r.shouldForwardProp;if(n&&a.shouldForwardProp){var w=a.shouldForwardProp;if(r.shouldForwardProp){var _=r.shouldForwardProp;x=function(C,j){return w(C,j)&&_(C,j)}}else x=w}var z=new op(o,m,n?a.componentStyle:void 0);function y(C,j){return function(b,g,S){var k=b.attrs,E=b.componentStyle,R=b.defaultProps,$=b.foldedComponentIds,O=b.styledComponentId,P=b.target,T=i.useContext(Cc),N=qa(),A=b.shouldForwardProp||N.shouldForwardProp;process.env.NODE_ENV!=="production"&&i.useDebugValue(O);var D=_u(g,T,R)||gr,B=function(H,Q,ae){for(var te,ee=He(He({},Q),{className:void 0,theme:ae}),Y=0;Y<H.length;Y+=1){var de=mr(te=H[Y])?te(ee):te;for(var ue in de)ee[ue]=ue==="className"?Gt(ee[ue],de[ue]):ue==="style"?He(He({},ee[ue]),de[ue]):de[ue]}return Q.className&&(ee.className=Gt(ee.className,Q.className)),ee}(k,g,D),oe=B.as||P,se={};for(var ne in B)B[ne]===void 0||ne[0]==="$"||ne==="as"||ne==="theme"&&B.theme===D||(ne==="forwardedAs"?se.as=B.forwardedAs:A&&!A(ne,oe)||(se[ne]=B[ne],A||process.env.NODE_ENV!=="development"||ru(ne)||Za.has(ne)||!ta.has(oe)||(Za.add(ne),console.warn('styled-components: it looks like an unknown prop "'.concat(ne,'" 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 K=function(H,Q){var ae=qa(),te=H.generateAndInjectStyles(Q,ae.styleSheet,ae.stylis);return process.env.NODE_ENV!=="production"&&i.useDebugValue(te),te}(E,B);process.env.NODE_ENV!=="production"&&b.warnTooManyClasses&&b.warnTooManyClasses(K);var U=Gt($,O);return K&&(U+=" "+K),B.className&&(U+=" "+B.className),se[hn(oe)&&!ta.has(oe)?"class":"className"]=U,S&&(se.ref=S),i.createElement(oe,se)}(I,C,j)}y.displayName=u;var I=i.forwardRef(y);return I.attrs=v,I.componentStyle=z,I.displayName=u,I.shouldForwardProp=x,I.foldedComponentIds=n?Gt(a.foldedComponentIds,a.styledComponentId):"",I.styledComponentId=m,I.target=n?a.target:t,Object.defineProperty(I,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(C){this._foldedDefaultProps=n?function(j){for(var b=[],g=1;g<arguments.length;g++)b[g-1]=arguments[g];for(var S=0,k=b;S<k.length;S++)na(j,k[S],!0);return j}({},a.defaultProps,C):C}}),process.env.NODE_ENV!=="production"&&(ku(u,m),I.warnTooManyClasses=function(C,j){var b={},g=!1;return function(S){if(!g&&(b[S]=!0,Object.keys(b).length>=200)){var k=j?' with the id of "'.concat(j,'"'):"";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 Au(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var o=t[0],n=[],a=1,s=t.length;a<s;a+=1)n.push(t[a]);return n.forEach(function(p){o=o.replace(/%[a-z]/,p)}),o}function wr(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(Au.apply(void 0,Kt([Lu[t]],r,!1)).trim())}var Du=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,a=n.length,s=a;r>=s;)if((s<<=1)<0)throw wr(16,"".concat(r));this.groupSizes=new Uint32Array(s),this.groupSizes.set(n),this.length=s;for(var p=a;p<s;p++)this.groupSizes[p]=0}for(var f=this.indexOfGroup(r+1),c=(p=0,o.length);p<c;p++)this.tag.insertRule(f,o[p])&&(this.groupSizes[r]++,f++)},t.prototype.clearGroup=function(r){if(r<this.length){var o=this.groupSizes[r],n=this.indexOfGroup(r),a=n+o;this.groupSizes[r]=0;for(var s=n;s<a;s++)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],a=this.indexOfGroup(r),s=a+n,p=a;p<s;p++)o+="".concat(this.tag.getRule(p)).concat(ga);return o},t}(),Nu=1<<30,$o=new Map,Oo=new Map,zo=1,Kr=function(t){if($o.has(t))return $o.get(t);for(;Oo.has(zo);)zo++;var r=zo++;if(process.env.NODE_ENV!=="production"&&((0|r)<0||r>Nu))throw wr(16,"".concat(r));return $o.set(t,r),Oo.set(r,t),r},Fu=function(t,r){zo=r+1,$o.set(t,r),Oo.set(r,t)},Bu="style[".concat(Qt,"][").concat(dc,'="').concat(Ho,'"]'),Uu=new RegExp("^".concat(Qt,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),Wu=function(t,r,o){for(var n,a=o.split(","),s=0,p=a.length;s<p;s++)(n=a[s])&&t.registerName(r,n)},Vu=function(t,r){for(var o,n=((o=r.textContent)!==null&&o!==void 0?o:"").split(ga),a=[],s=0,p=n.length;s<p;s++){var f=n[s].trim();if(f){var c=f.match(Uu);if(c){var h=0|parseInt(c[1],10),d=c[2];h!==0&&(Fu(d,h),Wu(t,d,c[3]),t.getTag().insertRules(h,a)),a.length=0}else a.push(f)}}},Ga=function(t){for(var r=document.querySelectorAll(Bu),o=0,n=r.length;o<n;o++){var a=r[o];a&&a.getAttribute(Qt)!==lc&&(Vu(t,a),a.parentNode&&a.parentNode.removeChild(a))}};function Gu(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var bc=function(t){var r=document.head,o=t||r,n=document.createElement("style"),a=function(f){var c=Array.from(f.querySelectorAll("style[".concat(Qt,"]")));return c[c.length-1]}(o),s=a!==void 0?a.nextSibling:null;n.setAttribute(Qt,lc),n.setAttribute(dc,Ho);var p=Gu();return p&&n.setAttribute("nonce",p),o.insertBefore(n,s),n},Hu=function(){function t(r){this.element=bc(r),this.element.appendChild(document.createTextNode("")),this.sheet=function(o){if(o.sheet)return o.sheet;for(var n=document.styleSheets,a=0,s=n.length;a<s;a++){var p=n[a];if(p.ownerNode===o)return p}throw wr(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}(),qu=function(){function t(r){this.element=bc(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}(),Yu=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}(),Ha=To,Zu={isServer:!To,useCSSOMInjection:!ju},yc=function(){function t(r,o,n){r===void 0&&(r=gr),o===void 0&&(o={});var a=this;this.options=He(He({},Zu),r),this.gs=o,this.names=new Map(n),this.server=!!r.isServer,!this.server&&To&&Ha&&(Ha=!1,Ga(this)),xa(this,function(){return function(s){for(var p=s.getTag(),f=p.length,c="",h=function(u){var m=function(z){return Oo.get(z)}(u);if(m===void 0)return"continue";var v=s.names.get(m),x=p.getGroup(u);if(v===void 0||!v.size||x.length===0)return"continue";var w="".concat(Qt,".g").concat(u,'[id="').concat(m,'"]'),_="";v!==void 0&&v.forEach(function(z){z.length>0&&(_+="".concat(z,","))}),c+="".concat(x).concat(w,'{content:"').concat(_,'"}').concat(ga)},d=0;d<f;d++)h(d);return c}(a)})}return t.registerId=function(r){return Kr(r)},t.prototype.rehydrate=function(){!this.server&&To&&Ga(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,a=o.target;return o.isServer?new Yu(a):n?new Hu(a):new qu(a)}(this.options),new Du(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(Kr(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(Kr(r),n)},t.prototype.clearNames=function(r){this.names.has(r)&&this.names.get(r).clear()},t.prototype.clearRules=function(r){this.getTag().clearGroup(Kr(r)),this.clearNames(r)},t.prototype.clearTag=function(){this.tag=void 0},t}(),Ku=/&/g,Qu=/^\s*\/\/.*$/gm;function wc(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=wc(o.children,r)),o})}function Xu(t){var r,o,n,a=gr,s=a.options,p=s===void 0?gr:s,f=a.plugins,c=f===void 0?qo:f,h=function(m,v,x){return x.startsWith(o)&&x.endsWith(o)&&x.replaceAll(o,"").length>0?".".concat(r):m},d=c.slice();d.push(function(m){m.type===Uo&&m.value.includes("&")&&(m.props[0]=m.props[0].replace(Ku,o).replace(n,h))}),p.prefix&&d.push(yu),d.push(xu);var u=function(m,v,x,w){v===void 0&&(v=""),x===void 0&&(x=""),w===void 0&&(w="&"),r=w,o=v,n=new RegExp("\\".concat(o,"\\b"),"g");var _=m.replace(Qu,""),z=gu(x||v?"".concat(x," ").concat(v," { ").concat(_," }"):_);p.namespace&&(z=wc(z,p.namespace));var y=[];return Io(z,vu(d.concat(bu(function(P){return y.push(P)})))),y};return u.hash=c.length?c.reduce(function(m,v){return v.name||wr(15),Wt(m,v.name)},uc).toString():"",u}var Ju=new yc,aa=Xu(),jc=i.createContext({shouldForwardProp:void 0,styleSheet:Ju,stylis:aa});jc.Consumer;i.createContext(void 0);function qa(){return i.useContext(jc)}var sa=function(){function t(r,o){var n=this;this.inject=function(a,s){s===void 0&&(s=aa);var p=n.name+s.hash;a.hasNameForId(n.id,p)||a.insertRules(n.id,p,s(n.rules,p,"@keyframes"))},this.name=r,this.id="sc-keyframes-".concat(r),this.rules=o,xa(this,function(){throw wr(12,String(n.name))})}return t.prototype.getName=function(r){return r===void 0&&(r=aa),this.name+r.hash},t}(),ep=function(t){return t>="A"&&t<="Z"};function Ya(t){for(var r="",o=0;o<t.length;o++){var n=t[o];if(o===1&&n==="-"&&t[0]==="-")return t;ep(n)?r+="-"+n.toLowerCase():r+=n}return r.startsWith("ms-")?"-"+r:r}var kc=function(t){return t==null||t===!1||t===""},_c=function(t){var r,o,n=[];for(var a in t){var s=t[a];t.hasOwnProperty(a)&&!kc(s)&&(Array.isArray(s)&&s.isCss||mr(s)?n.push("".concat(Ya(a),":"),s,";"):xr(s)?n.push.apply(n,Kt(Kt(["".concat(a," {")],_c(s),!1),["}"],!1)):n.push("".concat(Ya(a),": ").concat((r=a,(o=s)==null||typeof o=="boolean"||o===""?"":typeof o!="number"||o===0||r in wu||r.startsWith("--")?String(o).trim():"".concat(o,"px")),";")))}return n};function qt(t,r,o,n){if(kc(t))return[];if(ma(t))return[".".concat(t.styledComponentId)];if(mr(t)){if(!mr(s=t)||s.prototype&&s.prototype.isReactComponent||!r)return[t];var a=t(r);return process.env.NODE_ENV==="production"||typeof a!="object"||Array.isArray(a)||a instanceof sa||xr(a)||a===null||console.error("".concat(fc(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.")),qt(a,r,o,n)}var s;return t instanceof sa?o?(t.inject(o,n),[t.getName(n)]):[t]:xr(t)?_c(t):Array.isArray(t)?Array.prototype.concat.apply(qo,t.map(function(p){return qt(p,r,o,n)})):[t.toString()]}function tp(t){for(var r=0;r<t.length;r+=1){var o=t[r];if(mr(o)&&!ma(o))return!1}return!0}var rp=pc(Ho),op=function(){function t(r,o,n){this.rules=r,this.staticRulesId="",this.isStatic=process.env.NODE_ENV==="production"&&(n===void 0||n.isStatic)&&tp(r),this.componentId=o,this.baseHash=Wt(rp,o),this.baseStyle=n,yc.registerId(o)}return t.prototype.generateAndInjectStyles=function(r,o,n){var a=this.baseStyle?this.baseStyle.generateAndInjectStyles(r,o,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&o.hasNameForId(this.componentId,this.staticRulesId))a=Gt(a,this.staticRulesId);else{var s=oa(qt(this.rules,r,o,n)),p=ra(Wt(this.baseHash,s)>>>0);if(!o.hasNameForId(this.componentId,p)){var f=n(s,".".concat(p),void 0,this.componentId);o.insertRules(this.componentId,p,f)}a=Gt(a,p),this.staticRulesId=p}else{for(var c=Wt(this.baseHash,n.hash),h="",d=0;d<this.rules.length;d++){var u=this.rules[d];if(typeof u=="string")h+=u,process.env.NODE_ENV!=="production"&&(c=Wt(c,u));else if(u){var m=oa(qt(u,r,o,n));c=Wt(c,m+d),h+=m}}if(h){var v=ra(c>>>0);o.hasNameForId(this.componentId,v)||o.insertRules(this.componentId,v,n(h,".".concat(v),void 0,this.componentId)),a=Gt(a,v)}}return a},t}(),Cc=i.createContext(void 0);Cc.Consumer;var fn={},Za=new Set;function np(t,r,o){var n=ma(t),a=t,s=!hn(t),p=r.attrs,f=p===void 0?qo:p,c=r.componentId,h=c===void 0?function(C,j){var b=typeof C!="string"?"sc":Fa(C);fn[b]=(fn[b]||0)+1;var g="".concat(b,"-").concat(hc(Ho+b+fn[b]));return j?"".concat(j,"-").concat(g):g}(r.displayName,r.parentComponentId):c,d=r.displayName,u=d===void 0?function(C){return hn(C)?"styled.".concat(C):"Styled(".concat(fc(C),")")}(t):d,m=r.displayName&&r.componentId?"".concat(Fa(r.displayName),"-").concat(r.componentId):r.componentId||h,v=n&&a.attrs?a.attrs.concat(f).filter(Boolean):f,x=r.shouldForwardProp;if(n&&a.shouldForwardProp){var w=a.shouldForwardProp;if(r.shouldForwardProp){var _=r.shouldForwardProp;x=function(C,j){return w(C,j)&&_(C,j)}}else x=w}var z=new op(o,m,n?a.componentStyle:void 0);function y(C,j){return function(b,g,S){var k=b.attrs,E=b.componentStyle,R=b.defaultProps,$=b.foldedComponentIds,O=b.styledComponentId,I=b.target,T=i.useContext(Cc),N=qa(),L=b.shouldForwardProp||N.shouldForwardProp;process.env.NODE_ENV!=="production"&&i.useDebugValue(O);var D=_u(g,T,R)||gr,B=function(H,Q,ae){for(var te,ee=He(He({},Q),{className:void 0,theme:ae}),Y=0;Y<H.length;Y+=1){var de=mr(te=H[Y])?te(ee):te;for(var ue in de)ee[ue]=ue==="className"?Gt(ee[ue],de[ue]):ue==="style"?He(He({},ee[ue]),de[ue]):de[ue]}return Q.className&&(ee.className=Gt(ee.className,Q.className)),ee}(k,g,D),oe=B.as||I,se={};for(var ne in B)B[ne]===void 0||ne[0]==="$"||ne==="as"||ne==="theme"&&B.theme===D||(ne==="forwardedAs"?se.as=B.forwardedAs:L&&!L(ne,oe)||(se[ne]=B[ne],L||process.env.NODE_ENV!=="development"||ru(ne)||Za.has(ne)||!ta.has(oe)||(Za.add(ne),console.warn('styled-components: it looks like an unknown prop "'.concat(ne,'" 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 K=function(H,Q){var ae=qa(),te=H.generateAndInjectStyles(Q,ae.styleSheet,ae.stylis);return process.env.NODE_ENV!=="production"&&i.useDebugValue(te),te}(E,B);process.env.NODE_ENV!=="production"&&b.warnTooManyClasses&&b.warnTooManyClasses(K);var U=Gt($,O);return K&&(U+=" "+K),B.className&&(U+=" "+B.className),se[hn(oe)&&!ta.has(oe)?"class":"className"]=U,S&&(se.ref=S),i.createElement(oe,se)}(P,C,j)}y.displayName=u;var P=i.forwardRef(y);return P.attrs=v,P.componentStyle=z,P.displayName=u,P.shouldForwardProp=x,P.foldedComponentIds=n?Gt(a.foldedComponentIds,a.styledComponentId):"",P.styledComponentId=m,P.target=n?a.target:t,Object.defineProperty(P,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(C){this._foldedDefaultProps=n?function(j){for(var b=[],g=1;g<arguments.length;g++)b[g-1]=arguments[g];for(var S=0,k=b;S<k.length;S++)na(j,k[S],!0);return j}({},a.defaultProps,C):C}}),process.env.NODE_ENV!=="production"&&(ku(u,m),P.warnTooManyClasses=function(C,j){var b={},g=!1;return function(S){if(!g&&(b[S]=!0,Object.keys(b).length>=200)){var k=j?' with the id of "'.concat(j,'"'):"";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 />`),g=!0,b={}}}}(u,m)),xa(
|
|
73
|
+
<Component />`),g=!0,b={}}}}(u,m)),xa(P,function(){return".".concat(P.styledComponentId)}),s&&vc(P,t,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),P}function Ka(t,r){for(var o=[t[0]],n=0,a=r.length;n<a;n+=1)o.push(r[n],t[n+1]);return o}var Qa=function(t){return Object.assign(t,{isCss:!0})};function Yt(t){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(mr(t)||xr(t))return Qa(qt(Ka(qo,Kt([t],r,!0))));var n=t;return r.length===0&&n.length===1&&typeof n[0]=="string"?qt(n):Qa(qt(Ka(n,r)))}function ia(t,r,o){if(o===void 0&&(o=gr),!r)throw wr(1,r);var n=function(a){for(var s=[],p=1;p<arguments.length;p++)s[p-1]=arguments[p];return t(r,o,Yt.apply(void 0,Kt([a],s,!1)))};return n.attrs=function(a){return ia(t,r,He(He({},o),{attrs:Array.prototype.concat(o.attrs,a).filter(Boolean)}))},n.withConfig=function(a){return ia(t,r,He(He({},o),a))},n}var Sc=function(t){return ia(np,t)},l=Sc;ta.forEach(function(t){l[t]=Sc(t)});function jr(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=oa(Yt.apply(void 0,Kt([t],r,!1))),a=hc(n);return new sa(a,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 Qr="__sc-".concat(Qt,"__");process.env.NODE_ENV!=="production"&&process.env.NODE_ENV!=="test"&&typeof window<"u"&&(window[Qr]||(window[Qr]=0),window[Qr]===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
|
|
|
@@ -287,7 +287,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
287
287
|
font-size: var(--font-xs);
|
|
288
288
|
display: block;
|
|
289
289
|
text-align: center;
|
|
290
|
-
`;function Et({length:t=6,onComplete:r,onResend:o,error:n,isSubmitting:a=!1}){const[s,p]=i.useState(new Array(t).fill("")),[f,c]=i.useState(60),[h,d]=i.useState(!1),u=i.useRef([]),m=i.useCallback(()=>{const z=setInterval(()=>{c(y=>y<=1?(d(!0),clearInterval(z),0):y-1)},1e3);return z},[]);i.useEffect(()=>{const z=m();return()=>clearInterval(z)},[m]);const v=async()=>{var z;!h||a||!o||(await o(),d(!1),c(60),p(new Array(t).fill("")),(z=u.current[0])==null||z.focus(),m())},x=(z,y)=>{var b;if(a)return;const
|
|
290
|
+
`;function Et({length:t=6,onComplete:r,onResend:o,error:n,isSubmitting:a=!1}){const[s,p]=i.useState(new Array(t).fill("")),[f,c]=i.useState(60),[h,d]=i.useState(!1),u=i.useRef([]),m=i.useCallback(()=>{const z=setInterval(()=>{c(y=>y<=1?(d(!0),clearInterval(z),0):y-1)},1e3);return z},[]);i.useEffect(()=>{const z=m();return()=>clearInterval(z)},[m]);const v=async()=>{var z;!h||a||!o||(await o(),d(!1),c(60),p(new Array(t).fill("")),(z=u.current[0])==null||z.focus(),m())},x=(z,y)=>{var b;if(a)return;const P=z.value,C=[...s];C[y]=P.replace(/[^0-9]/g,""),p(C);const j=C.join("");j.length===t&&r(j),P&&y<t-1&&((b=u.current[y+1])==null||b.focus())},w=(z,y)=>{var P;a||z.key==="Backspace"&&!s[y]&&y>0&&((P=u.current[y-1])==null||P.focus())},_=(z,y)=>{var g,S,k;if(a)return;z.preventDefault();const C=z.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,t);if(C.length===0)return;const j=[...s];for(let E=0;E<C.length&&y+E<t;E++)j[y+E]=C[E];if(y===0&&C.length===t)for(let E=0;E<t;E++)j[E]=C[E];p(j);const b=j.join("");if(b.length===t)r(b),(g=u.current[t-1])==null||g.focus();else{const E=j.findIndex((R,$)=>$>=y&&!R);if(E!==-1)(S=u.current[E])==null||S.focus();else{const R=j.map(($,O)=>$?O:-1).filter($=>$!==-1).pop();R!==void 0&&R<t-1&&((k=u.current[R+1])==null||k.focus())}}};return e.jsxs(ap,{children:[e.jsx(sp,{children:s.map((z,y)=>e.jsx(ip,{type:"text",maxLength:1,value:z,onChange:P=>x(P.target,y),onKeyDown:P=>w(P,y),onPaste:P=>_(P,y),ref:P=>{u.current[y]=P},disabled:a,autoFocus:y===0},y))}),n&&e.jsx(cp,{children:n}),o&&e.jsx("div",{children:h?e.jsx(lp,{type:"button",onClick:v,disabled:a,children:"Didn't receive a code? Resend"}):e.jsxs(dp,{children:["Resend code in ",f,"s"]})})]})}const $c=t=>e.jsxs("svg",{width:"800px",height:"800px",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor","aria-labelledby":"githubIconTitle",...t,children:[e.jsx("title",{id:"githubIconTitle",children:"GitHub"}),e.jsx("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.109-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.91 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"})]}),zc=t=>e.jsxs("svg",{width:"800px",height:"800px",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"none",...t,children:[e.jsx("path",{fill:"#F35325",d:"M1 1h6.5v6.5H1V1z"}),e.jsx("path",{fill:"#81BC06",d:"M8.5 1H15v6.5H8.5V1z"}),e.jsx("path",{fill:"#05A6F0",d:"M1 8.5h6.5V15H1V8.5z"}),e.jsx("path",{fill:"#FFBA08",d:"M8.5 8.5H15V15H8.5V8.5z"})]}),Ec=t=>e.jsxs("svg",{width:"800px",height:"800px",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"none",...t,children:[e.jsx("path",{fill:"#4285F4",d:"M14.9 8.161c0-.476-.039-.954-.121-1.422h-6.64v2.695h3.802a3.24 3.24 0 01-1.407 2.127v1.75h2.269c1.332-1.22 2.097-3.02 2.097-5.15z"}),e.jsx("path",{fill:"#34A853",d:"M8.14 15c1.898 0 3.499-.62 4.665-1.69l-2.268-1.749c-.631.427-1.446.669-2.395.669-1.836 0-3.393-1.232-3.952-2.888H1.85v1.803A7.044 7.044 0 008.14 15z"}),e.jsx("path",{fill:"#FBBC04",d:"M4.187 9.342a4.17 4.17 0 010-2.68V4.859H1.849a6.97 6.97 0 000 6.286l2.338-1.803z"}),e.jsx("path",{fill:"#EA4335",d:"M8.14 3.77a3.837 3.837 0 012.7 1.05l2.01-1.999a6.786 6.786 0 00-4.71-1.82 7.042 7.042 0 00-6.29 3.858L4.186 6.66c.556-1.658 2.116-2.89 3.952-2.89z"})]}),Pc=t=>e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"50",height:"50",viewBox:"0 0 50 50",...t,children:e.jsx("path",{d:"M 6.9199219 6 L 21.136719 26.726562 L 6.2285156 44 L 9.40625 44 L 22.544922 28.777344 L 32.986328 44 L 43 44 L 28.123047 22.3125 L 42.203125 6 L 39.027344 6 L 26.716797 20.261719 L 16.933594 6 L 6.9199219 6 z"})}),up=()=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"})}),Rc=()=>e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"none",children:e.jsx("path",{fill:"#0A66C2",d:"M12.225 12.225h-1.778V9.44c0-.664-.012-1.519-.925-1.519-.926 0-1.068.724-1.068 1.47v2.834H6.676V6.498h1.707v.783h.024c.348-.594.996-.95 1.684-.925 1.802 0 2.135 1.185 2.135 2.728l-.001 3.14zM4.67 5.715a1.037 1.037 0 01-1.032-1.031c0-.566.466-1.032 1.032-1.032.566 0 1.031.466 1.032 1.032 0 .566-.466 1.032-1.032 1.032zm.889 6.51h-1.78V6.498h1.78v5.727zM13.11 2H2.885A.88.88 0 002 2.866v10.268a.88.88 0 00.885.866h10.226a.882.882 0 00.889-.866V2.865a.88.88 0 00-.889-.864z"})}),Ic=()=>e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M12 21.42L15.54 10.86H8.46L12 21.42Z",fill:"#E24329"}),e.jsx("path",{d:"M12 21.42L8.46 10.86H2.28L12 21.42Z",fill:"#FC6D26"}),e.jsx("path",{d:"M2.28 10.86L0.86 15.14C0.72 15.54 0.86 15.98 1.18 16.24L12 21.42L2.28 10.86Z",fill:"#FCA326"}),e.jsx("path",{d:"M2.28 10.86H8.46L6.12 3.58C5.98 3.18 5.42 3.18 5.28 3.58L2.28 10.86Z",fill:"#E24329"}),e.jsx("path",{d:"M12 21.42L15.54 10.86H21.72L12 21.42Z",fill:"#FC6D26"}),e.jsx("path",{d:"M21.72 10.86L23.14 15.14C23.28 15.54 23.14 15.98 22.82 16.24L12 21.42L21.72 10.86Z",fill:"#FCA326"}),e.jsx("path",{d:"M21.72 10.86H15.54L17.88 3.58C18.02 3.18 18.58 3.18 18.72 3.58L21.72 10.86Z",fill:"#E24329"})]}),pp=()=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701"})}),Tc=()=>e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("circle",{cx:"512",cy:"512",r:"512",style:{fill:"#5865f2"}}),e.jsx("path",{d:"M689.43 349a422.21 422.21 0 0 0-104.22-32.32 1.58 1.58 0 0 0-1.68.79 294.11 294.11 0 0 0-13 26.66 389.78 389.78 0 0 0-117.05 0 269.75 269.75 0 0 0-13.18-26.66 1.64 1.64 0 0 0-1.68-.79A421 421 0 0 0 334.44 349a1.49 1.49 0 0 0-.69.59c-66.37 99.17-84.55 195.9-75.63 291.41a1.76 1.76 0 0 0 .67 1.2 424.58 424.58 0 0 0 127.85 64.63 1.66 1.66 0 0 0 1.8-.59 303.45 303.45 0 0 0 26.15-42.54 1.62 1.62 0 0 0-.89-2.25 279.6 279.6 0 0 1-39.94-19 1.64 1.64 0 0 1-.16-2.72c2.68-2 5.37-4.1 7.93-6.22a1.58 1.58 0 0 1 1.65-.22c83.79 38.26 174.51 38.26 257.31 0a1.58 1.58 0 0 1 1.68.2c2.56 2.11 5.25 4.23 8 6.24a1.64 1.64 0 0 1-.14 2.72 262.37 262.37 0 0 1-40 19 1.63 1.63 0 0 0-.87 2.28 340.72 340.72 0 0 0 26.13 42.52 1.62 1.62 0 0 0 1.8.61 423.17 423.17 0 0 0 128-64.63 1.64 1.64 0 0 0 .67-1.18c10.68-110.44-17.88-206.38-75.7-291.42a1.3 1.3 0 0 0-.63-.63zM427.09 582.85c-25.23 0-46-23.16-46-51.6s20.38-51.6 46-51.6c25.83 0 46.42 23.36 46 51.6.02 28.44-20.37 51.6-46 51.6zm170.13 0c-25.23 0-46-23.16-46-51.6s20.38-51.6 46-51.6c25.83 0 46.42 23.36 46 51.6.01 28.44-20.17 51.6-46 51.6z",style:{fill:"#fff"}})]}),gn={google_oauth:{shortLabel:"Google",fullLabel:"Continue with Google",icon:e.jsx(Ec,{})},microsoft_oauth:{shortLabel:"Microsoft",fullLabel:"Continue with Microsoft",icon:e.jsx(zc,{})},github_oauth:{shortLabel:"GitHub",fullLabel:"Continue with GitHub",icon:e.jsx($c,{})},x_oauth:{shortLabel:"X",fullLabel:"Continue with X",icon:e.jsx(Pc,{})},facebook_oauth:{shortLabel:"Facebook",fullLabel:"Continue with Facebook",icon:e.jsx(up,{})},linkedin_oauth:{shortLabel:"LinkedIn",fullLabel:"Continue with LinkedIn",icon:e.jsx(Rc,{})},gitlab_oauth:{shortLabel:"GitLab",fullLabel:"Continue with GitLab",icon:e.jsx(Ic,{})},apple_oauth:{shortLabel:"Apple",fullLabel:"Continue with Apple",icon:e.jsx(pp,{})},discord_oauth:{shortLabel:"Discord",fullLabel:"Continue with Discord",icon:e.jsx(Tc,{})}},hp=l.div`
|
|
291
291
|
display: flex;
|
|
292
292
|
flex-direction: column;
|
|
293
293
|
gap: var(--space-xs);
|
|
@@ -596,7 +596,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
596
596
|
@media (max-width: ${ut.sm}) {
|
|
597
597
|
font-size: 0.75rem;
|
|
598
598
|
}
|
|
599
|
-
`,
|
|
599
|
+
`,Pp=l.div`
|
|
600
600
|
position: relative;
|
|
601
601
|
`,Tt=l.p`
|
|
602
602
|
font-size: var(--font-2xs);
|
|
@@ -652,7 +652,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
652
652
|
text-align: center;
|
|
653
653
|
padding: var(--space-xl);
|
|
654
654
|
margin-bottom: var(--space-lg);
|
|
655
|
-
`,
|
|
655
|
+
`,Ip=l.p`
|
|
656
656
|
font-size: var(--font-size-md);
|
|
657
657
|
color: var(--color-text-secondary);
|
|
658
658
|
margin: 0 0 var(--space-sm) 0;
|
|
@@ -671,12 +671,12 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
671
671
|
`,ir=l.span`
|
|
672
672
|
color: var(--color-danger);
|
|
673
673
|
margin-left: 2px;
|
|
674
|
-
`;function Ap(){var oe,se,ne,K,U,H,Q,ae,te,ee,Y,de,ue,F,M;const{loading:t,signUp:r,signupAttempt:o,discardSignupAttempt:n,errors:a}=Vi(),{signIn:s}=Lr(pr.Oauth),{deployment:p}=ve(),{navigate:f}=qe(),{session:c,refetch:h}=Ue(),[d,u]=i.useState({first_name:"",last_name:"",email:"",password:"",username:"",phone_number:""}),[m,v]=i.useState({}),[x,w]=i.useState(!1),[_,z]=i.useState(void 0),[y,I]=i.useState(null),[C,j]=i.useState(null),b=((oe=p==null?void 0:p.restrictions)==null?void 0:oe.sign_up_mode)==="restricted",g=((se=p==null?void 0:p.restrictions)==null?void 0:se.sign_up_mode)==="waitlist";i.useEffect(()=>{var G;if(!p)return;if(g){const re=((G=p.ui_settings)==null?void 0:G.waitlist_page_url)||`${p.frontend_host}/waitlist`||"/waitlist";f(re);return}const L=new URLSearchParams(window.location.search).get("invite_token");L&&!y&&r&&(j(L),r.validateDeploymentInvitation(L).then(re=>{I(re),re.valid&&u(pe=>({...pe,first_name:re.first_name||pe.first_name,last_name:re.last_name||pe.last_name,email:re.email||pe.email}))}).catch(re=>{console.error("Failed to validate invitation:",re)}))},[p,g,f,y,r]);const[S,k]=i.useState(!1),[E,R]=i.useState(""),$=W=>{let{name:L,value:G}=W.target;L==="phone_number"?G=G.replace(/[^0-9-]/g,""):L==="email"&&(G=G.toLowerCase()),u(re=>({...re,[L]:G})),v(re=>({...re,[L]:""}))},O=()=>{u({first_name:"",last_name:"",email:"",password:"",username:"",phone_number:""}),v({}),k(!1),R(""),n()},P=async W=>{if(W.preventDefault(),console.log("Signup form - handleSubmit called"),console.log("Auth settings:",A),console.log("Form data:",d),t||x)return;const L={},G=/^[a-zA-Z]{3,30}$/,re=/^[a-zA-Z][a-zA-Z0-9_.]{2,29}$/,pe=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,we=/^\d{7,15}$/,Te=/^(?=.*[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?L.first_name="First name is required":d.first_name&&!G.test(d.first_name)&&(L.first_name="Invalid name")),A!=null&&A.last_name.enabled&&(A!=null&&A.last_name.required&&!d.last_name?L.last_name="Last name is required":d.last_name&&!G.test(d.last_name)&&(L.last_name="Invalid last name")),A!=null&&A.username.enabled&&(A!=null&&A.username.required&&!d.username?L.username="Username is required":d.username&&!re.test(d.username)&&(L.username="Username must be 3-20 characters")),A!=null&&A.email_address.enabled&&(A!=null&&A.email_address.required&&!d.email?L.email="Email address is required":d.email&&!pe.test(d.email)&&(L.email="Invalid email address")),A!=null&&A.phone_number.enabled&&(A!=null&&A.phone_number.required&&!d.phone_number?L.phone_number="Phone number is required":d.phone_number&&!we.test(d.phone_number)&&(L.phone_number="Phone number must contain 7-15 digits")),A!=null&&A.password.enabled&&(d.password?Te.test(d.password)||(L.password="Password must be 8-125 characters and include uppercase, lowercase, number, and special character"):L.password="Password is required"),v(L),Object.keys(L).length>0){console.log("Signup validation failed. Errors:",L);return}console.log("Signup validation passed"),w(!0);try{const q={...d};d.phone_number&&_&&(q.phone_country_code=_),C&&(q.invite_token=C),console.log("Submitting signup data:",q),console.log("Phone number:",q.phone_number),console.log("Phone country code:",q.phone_country_code),await r.create(q)}catch(q){v({submit:q.message})}finally{w(!1)}},T=async W=>{if(!(t||x)){w(!0);try{const G=new URLSearchParams(window.location.search).get("redirect_uri")||void 0,{data:re}=await s.create({provider:W.provider,redirectUri:G});re&&typeof re=="object"&&"oauth_url"in re&&(window.location.href=re.oauth_url)}catch(L){v({submit:L.message})}finally{w(!1)}}},N=(p==null?void 0:p.social_connections.filter(W=>W.enabled))||[],A=p==null?void 0:p.auth_settings,D=!!((ne=A==null?void 0:A.first_name)!=null&&ne.enabled&&((K=A==null?void 0:A.last_name)!=null&&K.enabled)),B=async W=>{var G;if(W.preventDefault(),t||x)return;w(!0);const L={};if(!E){L.otp="OTP code is required",v(L),w(!1);return}v(L);try{const re=await r.completeVerification(E);"data"in re&&((G=re.data)!=null&&G.active_signin)&&await h()}catch(re){console.error("Verification failed:",re)}finally{w(!1)}};return i.useEffect(()=>{var W;if(o){if(o.completed){let L=new URLSearchParams(window.location.search).get("redirect_uri");if(L||(L=((W=p==null?void 0:p.ui_settings)==null?void 0:W.after_signup_redirect_url)||null),!L&&(p!=null&&p.frontend_host)&&(L=`https://${p.frontend_host}`),L){const G=new URL(L);(p==null?void 0:p.mode)==="staging"&&G.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),f(G.toString())}return}if(!S){switch(o.current_step){case"verify_email":r.prepareVerification({strategy:"email_otp"});break;case"verify_phone":r.prepareVerification({strategy:"phone_otp"});break}k(!0)}}},[o,r,S,p,c,f]),i.useEffect(()=>{const W={};if(a!=null&&a.errors&&Array.isArray(a==null?void 0:a.errors))for(const L of a.errors)L.code==="USERNAME_EXISTS"&&(W.username=L.message),L.code==="EMAIL_EXISTS"&&(W.email=L.message),L.code==="PHONE_NUMBER_EXISTS"&&(W.phone_number=L.message),L.code==="INVALID_CREDENTIALS"&&(W.password=L.message),["COUNTRY_RESTRICTED","EMAIL_NOT_ALLOWED","EMAIL_BLOCKED","DISPOSABLE_EMAIL_BLOCKED","VOIP_NUMBER_BLOCKED","BANNED_KEYWORD"].includes(L.code)&&(W.submit=L.message);v(W)},[a]),b?e.jsx(ie,{children:e.jsxs(Xa,{children:[e.jsx(De,{}),e.jsx(mn,{children:e.jsx(xn,{children:"Sign up Restricted!"})}),e.jsx(Rp,{children:e.jsx(Pp,{children:"New account registration is currently restricted. Please check back later."})}),e.jsx(Tp,{children:e.jsxs(Op,{children:["Need assistance?"," ",e.jsx(Mp,{href:(U=p==null?void 0:p.ui_settings)!=null&&U.sign_in_page_url?`${p.ui_settings.sign_in_page_url}?help=true`:"/contact",children:"Get help"})]})})]})}):e.jsx(ie,{children:e.jsx(Xa,{children:S?e.jsxs(e.Fragment,{children:[e.jsxs(mn,{children:[e.jsxs(xn,{children:["Check your"," ",(o==null?void 0:o.current_step)==="verify_email"?"email":"phone"]}),e.jsx(Ja,{children:(o==null?void 0:o.current_step)==="verify_email"?`${d.email} to continue to ${(H=p==null?void 0:p.ui_settings)==null?void 0:H.app_name}`:`${d.phone_number} to continue to ${(Q=p==null?void 0:p.ui_settings)==null?void 0:Q.app_name}`})]}),e.jsxs(es,{style:{gap:"15px"},onSubmit:B,noValidate:!0,children:[e.jsx(Et,{onComplete:async W=>{R(W)},onResend:async()=>{const W=(o==null?void 0:o.current_step)==="verify_email"?"email_otp":"phone_otp";await r.prepareVerification({strategy:W})},error:m.otp,isSubmitting:x}),e.jsx(ts,{type:"submit",disabled:x||t||!E,children:x?"Verifying...":`Continue to ${(ae=p==null?void 0:p.ui_settings)==null?void 0:ae.app_name}`})]}),e.jsxs(rs,{children:["Having trouble?"," ",e.jsx(vn,{children:e.jsx(Ze,{to:p.ui_settings.support_page_url,children:"Contact support"})}),e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(vn,{onClick:()=>{O()},style:{cursor:"pointer"},children:"Use other method"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(De,{}),e.jsxs(mn,{children:[e.jsx(xn,{children:"Create your account"}),e.jsx(Ja,{children:y!=null&&y.valid?"You've been invited! Complete your registration below.":"Welcome! Please fill in the details to get started."})]}),N.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(va,{connections:N,callback:T}),e.jsx($p,{children:e.jsx(zp,{children:"or"})})]}),e.jsxs(es,{onSubmit:P,noValidate:!0,children:[(((te=A==null?void 0:A.first_name)==null?void 0:te.enabled)||((ee=A==null?void 0:A.last_name)==null?void 0:ee.enabled))&&e.jsxs(Ep,{$isBothEnabled:D,children:[((Y=A==null?void 0:A.first_name)==null?void 0:Y.enabled)&&e.jsxs(ar,{children:[e.jsxs(sr,{htmlFor:"first_name",children:["First name",((de=A==null?void 0:A.first_name)==null?void 0:de.required)&&e.jsx(ir,{children:"*"})]}),e.jsx(le,{type:"text",id:"first_name",name:"first_name",required:!0,minLength:3,maxLength:30,value:d.first_name,onChange:$,placeholder:"First name","aria-invalid":!!m.first_name,pattern:"^[a-zA-Z]{3,30}$"}),m.first_name&&e.jsx(Tt,{children:m.first_name})]}),((ue=A==null?void 0:A.last_name)==null?void 0:ue.enabled)&&e.jsxs(ar,{children:[e.jsxs(sr,{htmlFor:"last_name",children:["Last name",((F=A==null?void 0:A.last_name)==null?void 0:F.required)&&e.jsx(ir,{children:"*"})]}),e.jsx(le,{type:"text",id:"last_name",name:"last_name",required:!0,minLength:3,maxLength:30,value:d.last_name,onChange:$,placeholder:"Last name","aria-invalid":!!m.last_name,pattern:"^[a-zA-Z]{3,30}$"}),m.last_name&&e.jsx(Tt,{children:m.last_name})]})]}),(A==null?void 0:A.username.enabled)&&e.jsxs(ar,{children:[e.jsxs(sr,{htmlFor:"username",children:["Username",A.username.required&&e.jsx(ir,{children:"*"})]}),e.jsx(le,{type:"text",id:"username",name:"username",minLength:3,maxLength:20,value:d.username,onChange:$,placeholder:"Choose a username","aria-invalid":!!m.username,required:!0,pattern:"^[a-zA-Z][a-zA-Z0-9_.]{2,29}$"}),m.username&&e.jsx(Tt,{children:m.username})]}),(A==null?void 0:A.email_address.enabled)&&e.jsxs(ar,{children:[e.jsxs(sr,{htmlFor:"email",children:["Email address",A.email_address.required&&e.jsx(ir,{children:"*"})]}),e.jsx(le,{type:"email",id:"email",name:"email",maxLength:320,value:d.email,onChange:$,placeholder:"Enter your email address","aria-invalid":!!m.email,required:!0,readOnly:(y==null?void 0:y.valid)&&!!(y!=null&&y.email),pattern:"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"}),m.email&&e.jsx(Tt,{children:m.email})]}),(A==null?void 0:A.phone_number.enabled)&&e.jsxs(ar,{children:[e.jsxs(sr,{htmlFor:"phone_number",children:["Phone number",A.phone_number.required&&e.jsx(ir,{children:"*"})]}),e.jsx(Br,{value:d.phone_number,onChange:$,error:m.phone_number,countryCode:_,setCountryCode:z}),m.phone_number&&e.jsx(Tt,{children:m.phone_number})]}),(A==null?void 0:A.password.enabled)&&e.jsxs(ar,{children:[e.jsxs(sr,{htmlFor:"password",children:["Password",A.password.required&&e.jsx(ir,{children:"*"})]}),e.jsx(Ip,{children:e.jsx(le,{type:"password",id:"password",name:"password",value:d.password,onChange:$,placeholder:"Enter your password","aria-invalid":!!m.password,required:!0,minLength:8,maxLength:128,pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,125}$"})}),m.password&&e.jsx(Tt,{children:m.password})]}),m.submit&&e.jsx(Tt,{children:m.submit}),e.jsx(ts,{type:"submit",disabled:x||t,children:x?"Creating account...":"Continue"})]}),e.jsxs(rs,{children:["Already have an account?"," ",e.jsx(vn,{children:e.jsx(Ze,{to:`${(M=p.ui_settings)==null?void 0:M.sign_in_page_url}${window.location.search}`,children:"Sign in"})})]})]})})})}/**
|
|
674
|
+
`;function Lp(){var oe,se,ne,K,U,H,Q,ae,te,ee,Y,de,ue,F,M;const{loading:t,signUp:r,signupAttempt:o,discardSignupAttempt:n,errors:a}=Vi(),{signIn:s}=Ar(pr.Oauth),{deployment:p}=ve(),{navigate:f}=qe(),{session:c,refetch:h}=Ue(),[d,u]=i.useState({first_name:"",last_name:"",email:"",password:"",username:"",phone_number:""}),[m,v]=i.useState({}),[x,w]=i.useState(!1),[_,z]=i.useState(void 0),[y,P]=i.useState(null),[C,j]=i.useState(null),b=((oe=p==null?void 0:p.restrictions)==null?void 0:oe.sign_up_mode)==="restricted",g=((se=p==null?void 0:p.restrictions)==null?void 0:se.sign_up_mode)==="waitlist";i.useEffect(()=>{var G;if(!p)return;if(g){const re=((G=p.ui_settings)==null?void 0:G.waitlist_page_url)||`${p.frontend_host}/waitlist`||"/waitlist";f(re);return}const A=new URLSearchParams(window.location.search).get("invite_token");A&&!y&&r&&(j(A),r.validateDeploymentInvitation(A).then(re=>{P(re),re.valid&&u(pe=>({...pe,first_name:re.first_name||pe.first_name,last_name:re.last_name||pe.last_name,email:re.email||pe.email}))}).catch(re=>{console.error("Failed to validate invitation:",re)}))},[p,g,f,y,r]);const[S,k]=i.useState(!1),[E,R]=i.useState(""),$=W=>{let{name:A,value:G}=W.target;A==="phone_number"?G=G.replace(/[^0-9-]/g,""):A==="email"&&(G=G.toLowerCase()),u(re=>({...re,[A]:G})),v(re=>({...re,[A]:""}))},O=()=>{u({first_name:"",last_name:"",email:"",password:"",username:"",phone_number:""}),v({}),k(!1),R(""),n()},I=async W=>{if(W.preventDefault(),console.log("Signup form - handleSubmit called"),console.log("Auth settings:",L),console.log("Form data:",d),t||x)return;const A={},G=/^[a-zA-Z]{3,30}$/,re=/^[a-zA-Z][a-zA-Z0-9_.]{2,29}$/,pe=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,we=/^\d{7,15}$/,Te=/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,125}$/;if(L!=null&&L.first_name.enabled&&(L!=null&&L.first_name.required&&!d.first_name?A.first_name="First name is required":d.first_name&&!G.test(d.first_name)&&(A.first_name="Invalid name")),L!=null&&L.last_name.enabled&&(L!=null&&L.last_name.required&&!d.last_name?A.last_name="Last name is required":d.last_name&&!G.test(d.last_name)&&(A.last_name="Invalid last name")),L!=null&&L.username.enabled&&(L!=null&&L.username.required&&!d.username?A.username="Username is required":d.username&&!re.test(d.username)&&(A.username="Username must be 3-20 characters")),L!=null&&L.email_address.enabled&&(L!=null&&L.email_address.required&&!d.email?A.email="Email address is required":d.email&&!pe.test(d.email)&&(A.email="Invalid email address")),L!=null&&L.phone_number.enabled&&(L!=null&&L.phone_number.required&&!d.phone_number?A.phone_number="Phone number is required":d.phone_number&&!we.test(d.phone_number)&&(A.phone_number="Phone number must contain 7-15 digits")),L!=null&&L.password.enabled&&(d.password?Te.test(d.password)||(A.password="Password must be 8-125 characters and include uppercase, lowercase, number, and special character"):A.password="Password is required"),v(A),Object.keys(A).length>0){console.log("Signup validation failed. Errors:",A);return}console.log("Signup validation passed"),w(!0);try{const q={...d};d.phone_number&&_&&(q.phone_country_code=_),C&&(q.invite_token=C),console.log("Submitting signup data:",q),console.log("Phone number:",q.phone_number),console.log("Phone country code:",q.phone_country_code),await r.create(q)}catch(q){v({submit:q.message})}finally{w(!1)}},T=async W=>{if(!(t||x)){w(!0);try{const G=new URLSearchParams(window.location.search).get("redirect_uri")||void 0,{data:re}=await s.create({provider:W.provider,redirectUri:G});re&&typeof re=="object"&&"oauth_url"in re&&(window.location.href=re.oauth_url)}catch(A){v({submit:A.message})}finally{w(!1)}}},N=(p==null?void 0:p.social_connections.filter(W=>W.enabled))||[],L=p==null?void 0:p.auth_settings,D=!!((ne=L==null?void 0:L.first_name)!=null&&ne.enabled&&((K=L==null?void 0:L.last_name)!=null&&K.enabled)),B=async W=>{var G;if(W.preventDefault(),t||x)return;w(!0);const A={};if(!E){A.otp="OTP code is required",v(A),w(!1);return}v(A);try{const re=await r.completeVerification(E);"data"in re&&((G=re.data)!=null&&G.active_signin)&&await h()}catch(re){console.error("Verification failed:",re)}finally{w(!1)}};return i.useEffect(()=>{var W;if(o){if(o.completed){let A=new URLSearchParams(window.location.search).get("redirect_uri");if(A||(A=((W=p==null?void 0:p.ui_settings)==null?void 0:W.after_signup_redirect_url)||null),!A&&(p!=null&&p.frontend_host)&&(A=`https://${p.frontend_host}`),A){const G=new URL(A);(p==null?void 0:p.mode)==="staging"&&G.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),f(G.toString())}return}if(!S){switch(o.current_step){case"verify_email":r.prepareVerification({strategy:"email_otp"});break;case"verify_phone":r.prepareVerification({strategy:"phone_otp"});break}k(!0)}}},[o,r,S,p,c,f]),i.useEffect(()=>{const W={};if(a!=null&&a.errors&&Array.isArray(a==null?void 0:a.errors))for(const A of a.errors)A.code==="USERNAME_EXISTS"&&(W.username=A.message),A.code==="EMAIL_EXISTS"&&(W.email=A.message),A.code==="PHONE_NUMBER_EXISTS"&&(W.phone_number=A.message),A.code==="INVALID_CREDENTIALS"&&(W.password=A.message),["COUNTRY_RESTRICTED","EMAIL_NOT_ALLOWED","EMAIL_BLOCKED","DISPOSABLE_EMAIL_BLOCKED","VOIP_NUMBER_BLOCKED","BANNED_KEYWORD"].includes(A.code)&&(W.submit=A.message);v(W)},[a]),b?e.jsx(ie,{children:e.jsxs(Xa,{children:[e.jsx(De,{}),e.jsx(mn,{children:e.jsx(xn,{children:"Sign up Restricted!"})}),e.jsx(Rp,{children:e.jsx(Ip,{children:"New account registration is currently restricted. Please check back later."})}),e.jsx(Tp,{children:e.jsxs(Op,{children:["Need assistance?"," ",e.jsx(Mp,{href:(U=p==null?void 0:p.ui_settings)!=null&&U.sign_in_page_url?`${p.ui_settings.sign_in_page_url}?help=true`:"/contact",children:"Get help"})]})})]})}):e.jsx(ie,{children:e.jsx(Xa,{children:S?e.jsxs(e.Fragment,{children:[e.jsxs(mn,{children:[e.jsxs(xn,{children:["Check your"," ",(o==null?void 0:o.current_step)==="verify_email"?"email":"phone"]}),e.jsx(Ja,{children:(o==null?void 0:o.current_step)==="verify_email"?`${d.email} to continue to ${(H=p==null?void 0:p.ui_settings)==null?void 0:H.app_name}`:`${d.phone_number} to continue to ${(Q=p==null?void 0:p.ui_settings)==null?void 0:Q.app_name}`})]}),e.jsxs(es,{style:{gap:"15px"},onSubmit:B,noValidate:!0,children:[e.jsx(Et,{onComplete:async W=>{R(W)},onResend:async()=>{const W=(o==null?void 0:o.current_step)==="verify_email"?"email_otp":"phone_otp";await r.prepareVerification({strategy:W})},error:m.otp,isSubmitting:x}),e.jsx(ts,{type:"submit",disabled:x||t||!E,children:x?"Verifying...":`Continue to ${(ae=p==null?void 0:p.ui_settings)==null?void 0:ae.app_name}`})]}),e.jsxs(rs,{children:["Having trouble?"," ",e.jsx(vn,{children:e.jsx(Ze,{to:p.ui_settings.support_page_url,children:"Contact support"})}),e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(vn,{onClick:()=>{O()},style:{cursor:"pointer"},children:"Use other method"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(De,{}),e.jsxs(mn,{children:[e.jsx(xn,{children:"Create your account"}),e.jsx(Ja,{children:y!=null&&y.valid?"You've been invited! Complete your registration below.":"Welcome! Please fill in the details to get started."})]}),N.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(va,{connections:N,callback:T}),e.jsx($p,{children:e.jsx(zp,{children:"or"})})]}),e.jsxs(es,{onSubmit:I,noValidate:!0,children:[(((te=L==null?void 0:L.first_name)==null?void 0:te.enabled)||((ee=L==null?void 0:L.last_name)==null?void 0:ee.enabled))&&e.jsxs(Ep,{$isBothEnabled:D,children:[((Y=L==null?void 0:L.first_name)==null?void 0:Y.enabled)&&e.jsxs(ar,{children:[e.jsxs(sr,{htmlFor:"first_name",children:["First name",((de=L==null?void 0:L.first_name)==null?void 0:de.required)&&e.jsx(ir,{children:"*"})]}),e.jsx(le,{type:"text",id:"first_name",name:"first_name",required:!0,minLength:3,maxLength:30,value:d.first_name,onChange:$,placeholder:"First name","aria-invalid":!!m.first_name,pattern:"^[a-zA-Z]{3,30}$"}),m.first_name&&e.jsx(Tt,{children:m.first_name})]}),((ue=L==null?void 0:L.last_name)==null?void 0:ue.enabled)&&e.jsxs(ar,{children:[e.jsxs(sr,{htmlFor:"last_name",children:["Last name",((F=L==null?void 0:L.last_name)==null?void 0:F.required)&&e.jsx(ir,{children:"*"})]}),e.jsx(le,{type:"text",id:"last_name",name:"last_name",required:!0,minLength:3,maxLength:30,value:d.last_name,onChange:$,placeholder:"Last name","aria-invalid":!!m.last_name,pattern:"^[a-zA-Z]{3,30}$"}),m.last_name&&e.jsx(Tt,{children:m.last_name})]})]}),(L==null?void 0:L.username.enabled)&&e.jsxs(ar,{children:[e.jsxs(sr,{htmlFor:"username",children:["Username",L.username.required&&e.jsx(ir,{children:"*"})]}),e.jsx(le,{type:"text",id:"username",name:"username",minLength:3,maxLength:20,value:d.username,onChange:$,placeholder:"Choose a username","aria-invalid":!!m.username,required:!0,pattern:"^[a-zA-Z][a-zA-Z0-9_.]{2,29}$"}),m.username&&e.jsx(Tt,{children:m.username})]}),(L==null?void 0:L.email_address.enabled)&&e.jsxs(ar,{children:[e.jsxs(sr,{htmlFor:"email",children:["Email address",L.email_address.required&&e.jsx(ir,{children:"*"})]}),e.jsx(le,{type:"email",id:"email",name:"email",maxLength:320,value:d.email,onChange:$,placeholder:"Enter your email address","aria-invalid":!!m.email,required:!0,readOnly:(y==null?void 0:y.valid)&&!!(y!=null&&y.email),pattern:"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"}),m.email&&e.jsx(Tt,{children:m.email})]}),(L==null?void 0:L.phone_number.enabled)&&e.jsxs(ar,{children:[e.jsxs(sr,{htmlFor:"phone_number",children:["Phone number",L.phone_number.required&&e.jsx(ir,{children:"*"})]}),e.jsx(Br,{value:d.phone_number,onChange:$,error:m.phone_number,countryCode:_,setCountryCode:z}),m.phone_number&&e.jsx(Tt,{children:m.phone_number})]}),(L==null?void 0:L.password.enabled)&&e.jsxs(ar,{children:[e.jsxs(sr,{htmlFor:"password",children:["Password",L.password.required&&e.jsx(ir,{children:"*"})]}),e.jsx(Pp,{children:e.jsx(le,{type:"password",id:"password",name:"password",value:d.password,onChange:$,placeholder:"Enter your password","aria-invalid":!!m.password,required:!0,minLength:8,maxLength:128,pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,125}$"})}),m.password&&e.jsx(Tt,{children:m.password})]}),m.submit&&e.jsx(Tt,{children:m.submit}),e.jsx(ts,{type:"submit",disabled:x||t,children:x?"Creating account...":"Continue"})]}),e.jsxs(rs,{children:["Already have an account?"," ",e.jsx(vn,{children:e.jsx(Ze,{to:`${(M=p.ui_settings)==null?void 0:M.sign_in_page_url}${window.location.search}`,children:"Sign in"})})]})]})})})}/**
|
|
675
675
|
* @license lucide-react v0.474.0 - ISC
|
|
676
676
|
*
|
|
677
677
|
* This source code is licensed under the ISC license.
|
|
678
678
|
* See the LICENSE file in the root directory of this source tree.
|
|
679
|
-
*/const
|
|
679
|
+
*/const Ap=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Oc=(...t)=>t.filter((r,o,n)=>!!r&&r.trim()!==""&&n.indexOf(r)===o).join(" ").trim();/**
|
|
680
680
|
* @license lucide-react v0.474.0 - ISC
|
|
681
681
|
*
|
|
682
682
|
* This source code is licensed under the ISC license.
|
|
@@ -691,7 +691,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
691
691
|
*
|
|
692
692
|
* This source code is licensed under the ISC license.
|
|
693
693
|
* See the LICENSE file in the root directory of this source tree.
|
|
694
|
-
*/const me=(t,r)=>{const o=i.forwardRef(({className:n,...a},s)=>i.createElement(Np,{ref:s,iconNode:r,className:Oc(`lucide-${
|
|
694
|
+
*/const me=(t,r)=>{const o=i.forwardRef(({className:n,...a},s)=>i.createElement(Np,{ref:s,iconNode:r,className:Oc(`lucide-${Ap(t)}`,n),...a}));return o.displayName=`${t}`,o};/**
|
|
695
695
|
* @license lucide-react v0.474.0 - ISC
|
|
696
696
|
*
|
|
697
697
|
* This source code is licensed under the ISC license.
|
|
@@ -751,7 +751,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
751
751
|
*
|
|
752
752
|
* This source code is licensed under the ISC license.
|
|
753
753
|
* See the LICENSE file in the root directory of this source tree.
|
|
754
|
-
*/const rh=[["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"}]],
|
|
754
|
+
*/const rh=[["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"}]],Lc=me("Copy",rh);/**
|
|
755
755
|
* @license lucide-react v0.474.0 - ISC
|
|
756
756
|
*
|
|
757
757
|
* This source code is licensed under the ISC license.
|
|
@@ -766,7 +766,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
766
766
|
*
|
|
767
767
|
* This source code is licensed under the ISC license.
|
|
768
768
|
* See the LICENSE file in the root directory of this source tree.
|
|
769
|
-
*/const sh=[["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"}]],
|
|
769
|
+
*/const sh=[["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"}]],Ac=me("ExternalLink",sh);/**
|
|
770
770
|
* @license lucide-react v0.474.0 - ISC
|
|
771
771
|
*
|
|
772
772
|
* This source code is licensed under the ISC license.
|
|
@@ -856,17 +856,17 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
856
856
|
*
|
|
857
857
|
* This source code is licensed under the ISC license.
|
|
858
858
|
* See the LICENSE file in the root directory of this source tree.
|
|
859
|
-
*/const
|
|
859
|
+
*/const Ph=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]],Xo=me("Trash",Ph);/**
|
|
860
860
|
* @license lucide-react v0.474.0 - ISC
|
|
861
861
|
*
|
|
862
862
|
* This source code is licensed under the ISC license.
|
|
863
863
|
* See the LICENSE file in the root directory of this source tree.
|
|
864
|
-
*/const Rh=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],
|
|
864
|
+
*/const Rh=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Pt=me("TriangleAlert",Rh);/**
|
|
865
865
|
* @license lucide-react v0.474.0 - ISC
|
|
866
866
|
*
|
|
867
867
|
* This source code is licensed under the ISC license.
|
|
868
868
|
* See the LICENSE file in the root directory of this source tree.
|
|
869
|
-
*/const
|
|
869
|
+
*/const Ih=[["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"}]],Mo=me("User",Ih);/**
|
|
870
870
|
* @license lucide-react v0.474.0 - ISC
|
|
871
871
|
*
|
|
872
872
|
* This source code is licensed under the ISC license.
|
|
@@ -881,12 +881,12 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
881
881
|
*
|
|
882
882
|
* This source code is licensed under the ISC license.
|
|
883
883
|
* See the LICENSE file in the root directory of this source tree.
|
|
884
|
-
*/const Mh=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],
|
|
884
|
+
*/const Mh=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Lh=me("ZoomIn",Mh);/**
|
|
885
885
|
* @license lucide-react v0.474.0 - ISC
|
|
886
886
|
*
|
|
887
887
|
* This source code is licensed under the ISC license.
|
|
888
888
|
* See the LICENSE file in the root directory of this source tree.
|
|
889
|
-
*/const
|
|
889
|
+
*/const Ah=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Dh=me("ZoomOut",Ah),Fc=i.createContext(void 0),Bc=()=>{const t=i.useContext(Fc);if(!t)throw new Error("Dialog components must be used within a Dialog");return t},Nh=l.div`
|
|
890
890
|
position: fixed;
|
|
891
891
|
inset: 0;
|
|
892
892
|
background-color: var(--color-dialog-backdrop, rgba(0, 0, 0, 0.5));
|
|
@@ -999,7 +999,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
999
999
|
border-top: 3px solid var(--color-primary);
|
|
1000
1000
|
border-radius: 50%;
|
|
1001
1001
|
animation: ${rf} 1s linear infinite;
|
|
1002
|
-
`,
|
|
1002
|
+
`,Pe=({size:t,className:r})=>e.jsx(of,{className:r,$size:t,children:e.jsx(nf,{$size:t})}),af=l.label`
|
|
1003
1003
|
display: inline-flex;
|
|
1004
1004
|
align-items: center;
|
|
1005
1005
|
cursor: pointer;
|
|
@@ -1030,7 +1030,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1030
1030
|
left: ${t=>t.checked?"20px":"2px"};
|
|
1031
1031
|
transition: left 0.2s ease;
|
|
1032
1032
|
}
|
|
1033
|
-
`,
|
|
1033
|
+
`,Lo=({checked:t,onChange:r})=>{const o=n=>{r(n.target.checked)};return e.jsxs(af,{children:[e.jsx(sf,{type:"checkbox",checked:t,onChange:o}),e.jsx(cf,{checked:t})]})},Or=(t=!1)=>{const[r,o]=i.useState(t),n=i.useCallback(()=>{o(!0)},[]),a=i.useCallback(()=>{o(!1)},[]),s=i.useCallback(()=>{o(p=>!p)},[]);return{isOpen:r,open:n,close:a,toggle:s}},bt=({onChange:t,placeholder:r,value:o})=>e.jsxs("div",{style:{display:"flex",flexGrow:1,alignItems:"center",border:"1px solid var(--color-border)",borderRadius:"8px",padding:"8px 12px",backgroundColor:"var(--color-input-background)",minWidth:"250px"},children:[e.jsx(Ch,{size:16,color:"var(--color-secondary-text)",style:{marginRight:"8px"}}),e.jsx("input",{type:"text",placeholder:r,value:o,onChange:n=>t(n.target.value),style:{border:"none",outline:"none",width:"100%",fontSize:"14px",color:"var(--color-text)"}})]}),X=l.button`
|
|
1034
1034
|
width: 100%;
|
|
1035
1035
|
padding: var(--space-sm) var(--space-md);
|
|
1036
1036
|
border: 1px solid transparent;
|
|
@@ -1143,7 +1143,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1143
1143
|
&::placeholder {
|
|
1144
1144
|
color: var(--color-muted);
|
|
1145
1145
|
}
|
|
1146
|
-
`,
|
|
1146
|
+
`,Ao=l.div`
|
|
1147
1147
|
display: flex;
|
|
1148
1148
|
align-items: center;
|
|
1149
1149
|
justify-content: space-between;
|
|
@@ -1172,7 +1172,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1172
1172
|
text-transform: uppercase;
|
|
1173
1173
|
color: var(--color-muted);
|
|
1174
1174
|
background: var(--color-background-hover);
|
|
1175
|
-
`,ba=({options:t,value:r,onChange:o,placeholder:n="Select an option",disabled:a=!1,searchable:s=!1,width:p,name:f,id:c,groupsEnabled:h=!1,className:d})=>{const[u,m]=i.useState(!1),[v,x]=i.useState(""),w=i.useRef(null),_=i.useRef(null),z=h&&"options"in t[0],
|
|
1175
|
+
`,ba=({options:t,value:r,onChange:o,placeholder:n="Select an option",disabled:a=!1,searchable:s=!1,width:p,name:f,id:c,groupsEnabled:h=!1,className:d})=>{const[u,m]=i.useState(!1),[v,x]=i.useState(""),w=i.useRef(null),_=i.useRef(null),z=h&&"options"in t[0],P=(z?t.flatMap(g=>g.options):t).find(g=>g.value===r),C=v?z?t.map(g=>({...g,options:g.options.filter(S=>S.label.toLowerCase().includes(v.toLowerCase()))})).filter(g=>g.options.length>0):t.filter(g=>g.label.toLowerCase().includes(v.toLowerCase())):t,j=(g,S=!1)=>{S||(o(g),m(!1),x(""))},b=()=>{a||m(!u)};return i.useEffect(()=>{u&&s&&_.current&&setTimeout(()=>{var g;(g=_.current)==null||g.focus()},10)},[u,s]),i.useEffect(()=>{const g=S=>{w.current&&!w.current.contains(S.target)&&(m(!1),x(""))};return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[]),e.jsxs(Vc,{ref:w,style:{width:p},className:d,children:[e.jsxs(Gc,{type:"button",onClick:b,disabled:a,"aria-haspopup":"listbox","aria-expanded":u,id:c,children:[P?P.label:e.jsx(Yc,{children:n}),u?e.jsx(Mc,{size:16}):e.jsx(Xt,{size:16})]}),e.jsxs(Hc,{isOpen:u,role:"listbox",children:[s&&e.jsx(qc,{ref:_,type:"text",placeholder:"Search...",value:v,onChange:g=>x(g.target.value),onClick:g=>g.stopPropagation()}),z?C.map((g,S)=>e.jsxs(i.Fragment,{children:[e.jsx(Zc,{children:g.label}),g.options.length===0?e.jsx(Do,{children:"No options available"}):g.options.map(k=>e.jsxs(Ao,{isSelected:k.value===r,disabled:k.disabled,onClick:()=>j(k.value,k.disabled),role:"option","aria-selected":k.value===r,children:[k.label,k.value===r&&e.jsx(tt,{size:16})]},k.value))]},`group-${S}`)):e.jsx(e.Fragment,{children:C.length===0?e.jsx(Do,{children:"No options available"}):C.map(g=>e.jsxs(Ao,{isSelected:g.value===r,disabled:g.disabled,onClick:()=>j(g.value,g.disabled),role:"option","aria-selected":g.value===r,children:[g.label,g.value===r&&e.jsx(tt,{size:16})]},g.value))})]}),f&&e.jsx("input",{type:"hidden",name:f,value:r||""})]})},Kc=({options:t,value:r,onChange:o,placeholder:n="Select options",disabled:a=!1,searchable:s=!1,width:p,name:f,id:c,groupsEnabled:h=!1,className:d})=>{const[u,m]=i.useState(!1),[v,x]=i.useState(""),w=i.useRef(null),_=i.useRef(null),z=h&&"options"in t[0],P=(z?t.flatMap(g=>g.options):t).filter(g=>r.includes(g.value)),C=v?z?t.map(g=>({...g,options:g.options.filter(S=>S.label.toLowerCase().includes(v.toLowerCase()))})).filter(g=>g.options.length>0):t.filter(g=>g.label.toLowerCase().includes(v.toLowerCase())):t,j=(g,S=!1)=>{S||(r.includes(g)?o(r.filter(k=>k!==g)):o([...r,g]))},b=()=>{a||m(!u)};return i.useEffect(()=>{u&&s&&_.current&&setTimeout(()=>{var g;(g=_.current)==null||g.focus()},10)},[u,s]),i.useEffect(()=>{const g=S=>{w.current&&!w.current.contains(S.target)&&(m(!1),x(""))};return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[]),e.jsxs(Vc,{ref:w,style:{width:p},className:d,children:[e.jsxs(Gc,{type:"button",onClick:b,disabled:a,"aria-haspopup":"listbox","aria-expanded":u,id:c,children:[P.length>0?P.map(g=>g.label).join(", "):e.jsx(Yc,{children:n}),u?e.jsx(Mc,{size:16}):e.jsx(Xt,{size:16})]}),e.jsxs(Hc,{isOpen:u,role:"listbox",children:[s&&e.jsx(qc,{ref:_,type:"text",placeholder:"Search...",value:v,onChange:g=>x(g.target.value),onClick:g=>g.stopPropagation()}),z?C.map((g,S)=>e.jsxs(i.Fragment,{children:[e.jsx(Zc,{children:g.label}),g.options.length===0?e.jsx(Do,{children:"No options available"}):g.options.map(k=>e.jsxs(Ao,{isSelected:r.includes(k.value),disabled:k.disabled,onClick:()=>j(k.value,k.disabled),role:"option","aria-selected":r.includes(k.value),children:[k.label,r.includes(k.value)&&e.jsx(tt,{size:16})]},k.value))]},`group-${S}`)):e.jsx(e.Fragment,{children:C.length===0?e.jsx(Do,{children:"No options available"}):C.map(g=>e.jsxs(Ao,{isSelected:r.includes(g.value),disabled:g.disabled,onClick:()=>j(g.value,g.disabled),role:"option","aria-selected":r.includes(g.value),children:[g.label,r.includes(g.value)&&e.jsx(tt,{size:16})]},g.value))})]}),f&&e.jsx("input",{type:"hidden",name:f,value:r.join(",")})]})},Qc=i.createContext(void 0);function Xc(){const t=i.useContext(Qc);if(!t)throw new Error("useSignIn must be used within a SignInProvider");return t}function lf({children:t}){const{deployment:r}=ve(),[o,n]=i.useState((r==null?void 0:r.auth_settings.first_factor)||"email_password"),[a,s]=i.useState(""),[p,f]=i.useState(!1),[c,h]=i.useState(!1),[d,u]=i.useState(!1),m=(r==null?void 0:r.social_connections.filter(x=>x.enabled))||[],v=r==null?void 0:r.auth_settings;return e.jsx(Qc.Provider,{value:{email:a,showOtherOptions:p,showForgotPassword:c,otpSent:d,setFirstFactor:n,setEmail:s,setShowOtherOptions:f,setShowForgotPassword:h,setOtpSent:u,enabledSocialsProviders:m,authSettings:v,firstFactor:o},children:t})}const Sr=l.button`
|
|
1176
1176
|
width: 100%;
|
|
1177
1177
|
padding: var(--space-sm) var(--space-md);
|
|
1178
1178
|
background: var(--color-input-background);
|
|
@@ -1195,7 +1195,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1195
1195
|
opacity: 0.7;
|
|
1196
1196
|
cursor: not-allowed;
|
|
1197
1197
|
}
|
|
1198
|
-
`;function Jc(){const{deployment:t}=ve(),{signIn:r}=
|
|
1198
|
+
`;function Jc(){const{deployment:t}=ve(),{signIn:r}=Ar(pr.Oauth),{setFirstFactor:o,firstFactor:n,setShowOtherOptions:a,setShowForgotPassword:s}=Xc(),[p,f]=i.useState(!1),c=t==null?void 0:t.auth_settings,h=(t==null?void 0:t.social_connections.filter(m=>m.enabled))||[],d=async m=>{if(!p){f(!0);try{const{data:v}=await r.create({provider:m.provider});v&&typeof v=="object"&&"oauth_url"in v&&(window.location.href=v.oauth_url)}catch{}finally{f(!1)}}},u=()=>{s(!1),a(!1)};return e.jsxs(e.Fragment,{children:[h.length>0&&e.jsx(va,{connections:h,callback:d}),e.jsxs("div",{children:[n!=="email_magic_link"&&(c==null?void 0:c.auth_factors_enabled.email_magic_link)&&e.jsx(Sr,{onClick:()=>{o("email_magic_link"),u()},children:"Get a magic link on your email"}),n!=="email_password"&&(c==null?void 0:c.auth_factors_enabled.email_password)&&e.jsx(Sr,{onClick:()=>{o("email_password"),u()},children:"Sign in with email and password"}),n!=="email_otp"&&(c==null?void 0:c.auth_factors_enabled.email_otp)&&e.jsx(Sr,{onClick:()=>{o("email_otp"),u()},children:"Sign in with email and OTP"}),n!=="phone_otp"&&(c==null?void 0:c.auth_factors_enabled.phone_otp)&&e.jsx(Sr,{onClick:()=>{o("phone_otp"),u()},children:"Sign in with phone number"}),n!=="username_password"&&(c==null?void 0:c.auth_factors_enabled.username_password)&&e.jsx(Sr,{onClick:()=>{o("username_password"),u()},children:"Sign in with username and password"})]})]})}const df=l.div`
|
|
1199
1199
|
max-width: 380px;
|
|
1200
1200
|
width: 380px;
|
|
1201
1201
|
padding: var(--space-3xl);
|
|
@@ -1259,7 +1259,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1259
1259
|
&:hover {
|
|
1260
1260
|
text-decoration: underline;
|
|
1261
1261
|
}
|
|
1262
|
-
`;function ff({onBack:t}){const[r,o]=i.useState("start"),[n,a]=i.useState(""),[s,p]=i.useState(""),[f,c]=i.useState(""),[h,d]=i.useState(""),{forgotPassword:u,loading:m,error:v}=Ki(),{resetPassword:x,loading:w,error:_}=Qi(),z=async j=>{if(j.preventDefault(),!n)return;(await u(n)).errors||o("otp")},y=async j=>{j.preventDefault(),s.length===6&&o("reset")},
|
|
1262
|
+
`;function ff({onBack:t}){const[r,o]=i.useState("start"),[n,a]=i.useState(""),[s,p]=i.useState(""),[f,c]=i.useState(""),[h,d]=i.useState(""),{forgotPassword:u,loading:m,error:v}=Ki(),{resetPassword:x,loading:w,error:_}=Qi(),z=async j=>{if(j.preventDefault(),!n)return;(await u(n)).errors||o("otp")},y=async j=>{j.preventDefault(),s.length===6&&o("reset")},P=async j=>{if(j.preventDefault(),f!==h||f.length<8)return;(await x(n,s,f)).errors||t()},C=()=>e.jsxs(e.Fragment,{children:[e.jsx(De,{}),e.jsx(Xr,{children:e.jsx(Jr,{children:"Forgot Password"})}),e.jsx(uf,{onClick:()=>o("email"),disabled:m,children:"Reset your password"}),e.jsx(pf,{children:e.jsx(hf,{children:"Or, sign in with another method"})}),e.jsx(Jc,{}),e.jsxs(eo,{children:[e.jsxs($r,{children:["Unable to reset password? ",e.jsx(zr,{href:"/contact",children:"Get help"})]}),e.jsx($r,{style:{marginTop:"var(--space-sm)"},children:e.jsx(zr,{onClick:t,style:{cursor:"pointer"},children:"Back to login"})})]})]});return e.jsx(ie,{children:e.jsxs(df,{children:[r==="start"&&C(),r==="email"&&e.jsxs(e.Fragment,{children:[e.jsxs(Xr,{children:[e.jsx(Jr,{children:"Forgot Password"}),e.jsx(jn,{children:"Enter your email address and we'll send you a code to reset your password."})]}),e.jsxs(dt,{onSubmit:z,noValidate:!0,children:[e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"email",children:"Email Address"}),e.jsx(le,{type:"email",id:"email",value:n,onChange:j=>a(j.target.value),placeholder:"Enter your email",required:!0})]}),v&&e.jsx(kn,{children:v.message}),e.jsx(X,{type:"submit",disabled:m,style:{width:"100%",marginTop:"var(--space-md)"},children:m?"Sending...":"Send Code"})]}),e.jsx(eo,{children:e.jsx($r,{style:{marginTop:"var(--space-sm)"},children:e.jsx(zr,{onClick:t,style:{cursor:"pointer"},children:"Back to login"})})})]}),r==="otp"&&e.jsxs(e.Fragment,{children:[e.jsxs(Xr,{children:[e.jsx(Jr,{children:"Enter Verification Code"}),e.jsxs(jn,{children:["We've sent a 6-digit code to ",n,". Please enter it below."]})]}),e.jsxs(dt,{onSubmit:y,noValidate:!0,children:[e.jsx(Et,{onComplete:j=>p(j),isSubmitting:w,error:_==null?void 0:_.message,onResend:async()=>{await u(n)}}),_&&e.jsx(kn,{children:_.message}),e.jsx(X,{type:"submit",disabled:w||s.length!==6,style:{width:"100%",marginTop:"var(--space-md)"},children:w?"Verifying...":"Verify"})]}),e.jsx(eo,{children:e.jsx($r,{style:{marginTop:"var(--space-sm)"},children:e.jsx(zr,{onClick:t,style:{cursor:"pointer"},children:"Back to login"})})})]}),r==="reset"&&e.jsxs(e.Fragment,{children:[e.jsxs(Xr,{children:[e.jsx(Jr,{children:"Reset Password"}),e.jsx(jn,{children:"Create a new password for your account."})]}),e.jsxs(dt,{onSubmit:P,noValidate:!0,children:[e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"password",children:"New Password"}),e.jsx(le,{type:"password",id:"password",value:f,onChange:j=>c(j.target.value),placeholder:"Enter new password",required:!0})]}),e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"confirmPassword",children:"Confirm New Password"}),e.jsx(le,{type:"password",id:"confirmPassword",value:h,onChange:j=>d(j.target.value),placeholder:"Confirm new password",required:!0})]}),_&&e.jsx(kn,{children:_.message}),e.jsx(X,{type:"submit",disabled:w,style:{width:"100%",marginTop:"var(--space-md)"},children:w?"Resetting...":"Reset Password"})]}),e.jsx(eo,{children:e.jsx($r,{style:{marginTop:"var(--space-sm)"},children:e.jsx(zr,{onClick:t,style:{cursor:"pointer"},children:"Back to login"})})})]})]})})}const gf=l.div`
|
|
1263
1263
|
max-width: 360px;
|
|
1264
1264
|
width: 360px;
|
|
1265
1265
|
padding: var(--space-2xl);
|
|
@@ -1359,13 +1359,13 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1359
1359
|
color: var(--color-foreground);
|
|
1360
1360
|
margin-bottom: var(--space-2xs);
|
|
1361
1361
|
font-size: var(--font-sm);
|
|
1362
|
-
`,
|
|
1362
|
+
`,Pf=l.div`
|
|
1363
1363
|
font-size: var(--font-xs);
|
|
1364
1364
|
color: var(--color-secondary-text);
|
|
1365
1365
|
line-height: 1.4;
|
|
1366
1366
|
`,Rf=l(X)`
|
|
1367
1367
|
width: 100%;
|
|
1368
|
-
`,
|
|
1368
|
+
`,If=l.div`
|
|
1369
1369
|
margin-top: var(--space-lg);
|
|
1370
1370
|
text-align: center;
|
|
1371
1371
|
font-size: var(--font-xs);
|
|
@@ -1380,7 +1380,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1380
1380
|
&:hover {
|
|
1381
1381
|
color: var(--color-primary-hover);
|
|
1382
1382
|
}
|
|
1383
|
-
`;function el({methods:t,onSelectMethod:r,onBack:o}){const[n,a]=i.useState(null),s=()=>{n&&r(n)};return e.jsx(ie,{children:e.jsxs(wf,{children:[e.jsx(De,{}),e.jsxs(jf,{children:[e.jsx(kf,{children:"Two-factor authentication"}),e.jsx(_f,{children:"Choose how you'd like to verify your identity"})]}),e.jsx(Cf,{children:t.map(p=>e.jsxs(Sf,{onClick:()=>a(p.id),selected:n===p.id,disabled:!p.available,children:[e.jsx($f,{children:p.icon}),e.jsxs(zf,{children:[e.jsx(Ef,{children:p.name}),e.jsxs(
|
|
1383
|
+
`;function el({methods:t,onSelectMethod:r,onBack:o}){const[n,a]=i.useState(null),s=()=>{n&&r(n)};return e.jsx(ie,{children:e.jsxs(wf,{children:[e.jsx(De,{}),e.jsxs(jf,{children:[e.jsx(kf,{children:"Two-factor authentication"}),e.jsx(_f,{children:"Choose how you'd like to verify your identity"})]}),e.jsx(Cf,{children:t.map(p=>e.jsxs(Sf,{onClick:()=>a(p.id),selected:n===p.id,disabled:!p.available,children:[e.jsx($f,{children:p.icon}),e.jsxs(zf,{children:[e.jsx(Ef,{children:p.name}),e.jsxs(Pf,{children:[p.description,p.phoneNumber&&` to ${p.phoneNumber}`]})]})]},p.id))}),e.jsx(Rf,{onClick:s,disabled:!n,children:"Continue"}),o&&e.jsx(If,{children:e.jsx(Tf,{onClick:o,style:{cursor:"pointer"},children:"Back to login"})})]})})}const Of=l.div`
|
|
1384
1384
|
max-width: 380px;
|
|
1385
1385
|
width: 380px;
|
|
1386
1386
|
padding: var(--space-3xl);
|
|
@@ -1391,13 +1391,13 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1391
1391
|
text-align: center;
|
|
1392
1392
|
margin-bottom: var(--space-lg);
|
|
1393
1393
|
position: relative;
|
|
1394
|
-
`,
|
|
1394
|
+
`,Lf=l.h1`
|
|
1395
1395
|
font-size: var(--font-lg);
|
|
1396
1396
|
font-weight: 500;
|
|
1397
1397
|
color: var(--color-foreground);
|
|
1398
1398
|
margin-bottom: var(--space-xs);
|
|
1399
1399
|
margin-top: 0;
|
|
1400
|
-
`,
|
|
1400
|
+
`,Af=l.p`
|
|
1401
1401
|
color: var(--color-secondary-text);
|
|
1402
1402
|
font-size: var(--font-xs);
|
|
1403
1403
|
`,Df=l.p`
|
|
@@ -1430,7 +1430,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1430
1430
|
font-family: monospace;
|
|
1431
1431
|
font-weight: 600;
|
|
1432
1432
|
padding: var(--space-lg);
|
|
1433
|
-
`;function tl({onVerify:t,onBack:r,loading:o}){const[n,a]=i.useState(""),[s,p]=i.useState(""),f=h=>{if(h.preventDefault(),n.length!==4){p("Please enter the last 4 digits of your phone number");return}t(n)},c=h=>{const d=h.target.value.replace(/\D/g,"").slice(0,4);a(d),p("")};return e.jsx(ie,{children:e.jsxs(Of,{children:[e.jsx(De,{}),e.jsxs(Mf,{children:[e.jsx(
|
|
1433
|
+
`;function tl({onVerify:t,onBack:r,loading:o}){const[n,a]=i.useState(""),[s,p]=i.useState(""),f=h=>{if(h.preventDefault(),n.length!==4){p("Please enter the last 4 digits of your phone number");return}t(n)},c=h=>{const d=h.target.value.replace(/\D/g,"").slice(0,4);a(d),p("")};return e.jsx(ie,{children:e.jsxs(Of,{children:[e.jsx(De,{}),e.jsxs(Mf,{children:[e.jsx(Lf,{children:"Verify your phone number"}),e.jsx(Af,{children:"To send a verification code, please confirm the last 4 digits of your primary phone number"})]}),e.jsxs(dt,{onSubmit:f,noValidate:!0,children:[e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"lastDigits",children:"Last 4 digits"}),e.jsx(Uf,{type:"text",id:"lastDigits",name:"lastDigits",value:n,onChange:c,placeholder:"0000",maxLength:4,autoComplete:"off","aria-invalid":!!s,autoFocus:!0}),s&&e.jsx(Df,{children:s})]}),e.jsx(Nf,{type:"submit",disabled:o||n.length!==4,children:o?"Verifying...":"Send code"})]}),e.jsx(Ff,{children:e.jsx(Bf,{onClick:r,style:{cursor:"pointer"},children:"Choose a different method"})})]})})}const Wf=()=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})}),Vf=()=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2",ry:"2"}),e.jsx("path",{d:"M12 18h.01"})]}),Gf=()=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m21 2-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0 3 3L22 7l-3-3m-3.5 3.5L19 4"})}),_n=l.div`
|
|
1434
1434
|
max-width: 380px;
|
|
1435
1435
|
width: 380px;
|
|
1436
1436
|
padding: var(--space-3xl);
|
|
@@ -1494,7 +1494,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1494
1494
|
font-size: var(--font-lg);
|
|
1495
1495
|
letter-spacing: 0.5em;
|
|
1496
1496
|
font-family: monospace;
|
|
1497
|
-
`;function rl({onBack:t,attempt:r,completeVerification:o,prepareVerification:n}){const{deployment:a}=ve(),[s,p]=i.useState(""),[f,c]=i.useState({}),[h,d]=i.useState(!1),[u,m]=i.useState(null),[v,x]=i.useState(!0),[w,_]=i.useState(!1),[z,y]=i.useState(""),[
|
|
1497
|
+
`;function rl({onBack:t,attempt:r,completeVerification:o,prepareVerification:n}){const{deployment:a}=ve(),[s,p]=i.useState(""),[f,c]=i.useState({}),[h,d]=i.useState(!1),[u,m]=i.useState(null),[v,x]=i.useState(!0),[w,_]=i.useState(!1),[z,y]=i.useState(""),[P,C]=i.useState(!1),{navigate:j}=qe(),b=(r==null?void 0:r.available_2fa_methods)||[],g=[{id:"authenticator",name:"Authenticator app",description:"Use your authenticator app",icon:e.jsx(Wf,{}),available:b.includes("authenticator")},{id:"phone_otp",name:"Text message",description:"Get a code via SMS",icon:e.jsx(Vf,{}),available:b.includes("phone_otp"),phoneNumber:z},{id:"backup_code",name:"Backup code",description:"Use one of your backup codes",icon:e.jsx(Gf,{}),available:b.includes("backup_code")}].filter($=>$.available),S=async $=>{m($),x(!1),$==="phone_otp"&&_(!0)},k=async $=>{var O,I;if(r){d(!0);try{const T=await n({strategy:"phone_otp",lastDigits:$});T&&"data"in T&&((O=T.data)!=null&&O.otp_sent)?((I=T.data)!=null&&I.masked_phone&&y(T.data.masked_phone),_(!1)):c({phone:"Phone number verification failed"})}catch(T){c({phone:T.message})}finally{d(!1)}}},E=async $=>{if($.preventDefault(),h)return;const O={};if(s?u==="authenticator"&&s.length!==6?O.code="Authentication code must be 6 digits":u==="phone_otp"&&s.length!==6&&(O.code="SMS code must be 6 digits"):O.code="Verification code is required",c(O),!(Object.keys(O).length>0)){d(!0);try{await o(s)}catch(I){c({submit:I.message})}finally{d(!1)}}},R=$=>{const O=$.target.value.replace(/\D/g,"").slice(0,6);p(O),c(I=>({...I,code:""}))};return i.useEffect(()=>{var $;if(r.completed){C(!0);let O=new URLSearchParams(window.location.search).get("redirect_uri");if(O||(O=(($=a==null?void 0:a.ui_settings)==null?void 0:$.after_signin_redirect_url)||null),!O&&(a!=null&&a.frontend_host)&&(O=`https://${a.frontend_host}`),O){const I=new URL(O);(a==null?void 0:a.mode)==="staging"&&I.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),j(I.toString())}return}},[r,a]),P?e.jsx(ie,{children:e.jsxs(_n,{children:[e.jsx(De,{}),e.jsx(qf,{children:e.jsx(vr,{size:32})})]})}):v?g.length===0?e.jsx(ie,{children:e.jsxs(_n,{children:[e.jsx(De,{}),e.jsxs(ss,{children:[e.jsx(is,{children:"Set Up Two-Factor Authentication"}),e.jsx(cs,{children:"Your account requires two-factor authentication, but you haven't set up any methods yet. Please contact your administrator to set up 2FA."})]}),e.jsxs(ds,{children:[t&&e.jsx("div",{children:e.jsx(Er,{onClick:t,style:{cursor:"pointer"},children:"Back to login"})}),e.jsxs("div",{style:{marginTop:"var(--space-sm)"},children:["Having trouble?"," ",e.jsx(Er,{children:e.jsx(Ze,{to:(a==null?void 0:a.ui_settings.support_page_url)||"#",children:"Get help"})})]})]})]})}):e.jsx(el,{methods:g,onSelectMethod:S,onBack:t}):w&&u==="phone_otp"?e.jsx(tl,{onVerify:k,onBack:()=>{_(!1),x(!0),m(null)},loading:h}):e.jsx(ie,{children:e.jsxs(_n,{children:[e.jsx(De,{}),e.jsxs(ss,{children:[e.jsx(is,{children:"Two-factor authentication"}),e.jsxs(cs,{children:[u==="authenticator"&&"Enter the 6-digit code from your authenticator app",u==="phone_otp"&&`Enter the 6-digit code sent to your phone ${z}`,u==="backup_code"&&"Enter one of your backup codes"]})]}),e.jsxs(dt,{onSubmit:E,noValidate:!0,children:[u==="backup_code"?e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"code",children:"Backup code"}),e.jsx(Zf,{type:"text",id:"code",name:"code",value:s,onChange:R,placeholder:"Enter backup code",maxLength:20,autoComplete:"one-time-code","aria-invalid":!!f.code,autoFocus:!0}),f.code&&e.jsx(ls,{children:f.code})]}):e.jsx(Et,{onComplete:async $=>{if(p($),u!=="backup_code"){const O=new Event("submit",{bubbles:!0,cancelable:!0});await E(O)}},onResend:u==="phone_otp"?async()=>{try{await n({strategy:"phone_otp",lastDigits:z.slice(-4)})}catch($){c({submit:$.message})}}:void 0,error:f.code,isSubmitting:h}),e.jsxs("div",{children:[f.submit&&e.jsx(ls,{children:f.submit}),e.jsx(Yf,{type:"submit",disabled:h||!s,children:h?"Verifying...":"Verify"})]})]}),e.jsxs(ds,{children:[e.jsx(Er,{onClick:()=>{x(!0),m(null),p(""),c({})},style:{cursor:"pointer"},children:"Try another method"}),e.jsxs("div",{style:{marginTop:"var(--space-sm)"},children:["Having trouble?"," ",e.jsx(Er,{children:e.jsx(Ze,{to:(a==null?void 0:a.ui_settings.support_page_url)||"#",children:"Get help"})})]}),t&&e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(Er,{onClick:t,style:{cursor:"pointer"},children:"Back to login"})})]})]})})}const Cn=l.div`
|
|
1498
1498
|
max-width: 380px;
|
|
1499
1499
|
width: 380px;
|
|
1500
1500
|
padding: var(--space-3xl);
|
|
@@ -1559,7 +1559,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1559
1559
|
transform: rotate(360deg);
|
|
1560
1560
|
}
|
|
1561
1561
|
}
|
|
1562
|
-
`;function ol({attempt:t,onBack:r,completeProfile:o,completeVerification:n,prepareVerification:a}){var D,B,oe,se,ne,K,U,H,Q;const{deployment:s}=ve(),{navigate:p}=qe(),[f,c]=i.useState({}),[h,d]=i.useState({}),[u,m]=i.useState("US"),[v,x]=i.useState(!1),[w,_]=i.useState(!1),[z,y]=i.useState(null),[
|
|
1562
|
+
`;function ol({attempt:t,onBack:r,completeProfile:o,completeVerification:n,prepareVerification:a}){var D,B,oe,se,ne,K,U,H,Q;const{deployment:s}=ve(),{navigate:p}=qe(),[f,c]=i.useState({}),[h,d]=i.useState({}),[u,m]=i.useState("US"),[v,x]=i.useState(!1),[w,_]=i.useState(!1),[z,y]=i.useState(null),[P,C]=i.useState(!1),j=z,b=w,g=async ae=>{var te;_(!0),y(null);try{if(await o(ae)){C(!0);let Y=new URLSearchParams(window.location.search).get("redirect_uri");if(Y||(Y=((te=s==null?void 0:s.ui_settings)==null?void 0:te.after_signin_redirect_url)||null),!Y&&(s!=null&&s.frontend_host)&&(Y=`https://${s.frontend_host}`),Y){const de=new URL(Y);(s==null?void 0:s.mode)==="staging"&&de.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),p(de.toString())}}}catch(ee){const Y=ee;throw y(Y),Y}finally{_(!1)}},S=async ae=>{var te;_(!0),y(null);try{if(await n(ae)){C(!0);let Y=new URLSearchParams(window.location.search).get("redirect_uri");if(Y||(Y=((te=s==null?void 0:s.ui_settings)==null?void 0:te.after_signin_redirect_url)||null),!Y&&(s!=null&&s.frontend_host)&&(Y=`https://${s.frontend_host}`),Y){const de=new URL(Y);(s==null?void 0:s.mode)==="staging"&&de.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),p(de.toString())}}return!0}catch(ee){return y(ee),!1}finally{_(!1)}};if(P||!t)return e.jsx(ie,{children:e.jsxs(Cn,{children:[e.jsx(De,{}),e.jsx(Xf,{children:e.jsx(vr,{size:32})})]})});const k=t.missing_fields||[],E="Complete Your Profile",R="Please provide the following information to continue",$=s==null?void 0:s.auth_settings,O=(t==null?void 0:t.current_step)==="verify_phone_otp"||(t==null?void 0:t.current_step)==="verify_email_otp"||v,I=ae=>{const{name:te,value:ee}=ae.target;c(Y=>({...Y,[te]:ee})),h[te]&&d(Y=>({...Y,[te]:""}))},T=()=>{const ae={};return k.forEach(te=>{var de,ue,F,M,W;const ee=f[te];let Y=!1;switch(te){case"first_name":Y=((de=$==null?void 0:$.first_name)==null?void 0:de.enabled)||!1;break;case"last_name":Y=((ue=$==null?void 0:$.last_name)==null?void 0:ue.enabled)||!1;break;case"username":Y=((F=$==null?void 0:$.username)==null?void 0:F.enabled)||!1;break;case"phone_number":Y=((M=$==null?void 0:$.phone_number)==null?void 0:M.enabled)||!1;break;case"email_address":Y=((W=$==null?void 0:$.email_address)==null?void 0:W.enabled)||!1;break;default:Y=!0}if(Y&&(!ee||ee.trim()==="")){const A=te.replace("_"," ").replace(/\b\w/g,G=>G.toUpperCase());ae[te]=`${A} is required`}}),f.username&&k.includes("username")&&(/^[a-zA-Z0-9_-]{3,30}$/.test(f.username)||(ae.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)||(ae.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)||(ae.email_address="Please enter a valid email address")),d(ae),Object.keys(ae).length===0},N=async ae=>{if(ae.preventDefault(),!T())return;const te={...f};f.phone_number&&u&&(te.phone_country_code=u),await g(te)},L=ae=>{const te=ae.target.value;c(ee=>({...ee,phone_number:te})),h.phone_number&&d(ee=>({...ee,phone_number:""}))};if(O){const ae=t.current_step==="verify_phone_otp"?"Verify Your Phone Number":"Verify Your Email",te=t.current_step==="verify_phone_otp"?"Enter the 6-digit code sent to your phone":"Enter the 6-digit code sent to your email",ee=t.current_step==="verify_phone_otp"?"phone_otp":"email_otp";return e.jsx(ie,{children:e.jsxs(Cn,{children:[e.jsx(De,{}),e.jsxs(us,{children:[e.jsx(ps,{children:ae}),e.jsx(hs,{children:te})]}),e.jsxs(dt,{onSubmit:Y=>Y.preventDefault(),noValidate:!0,children:[e.jsx(Et,{onComplete:S,onResend:async()=>{await a({strategy:ee})},error:j==null?void 0:j.message,isSubmitting:b}),j&&e.jsx(Ot,{style:{marginBottom:"var(--space-md)"},children:j.message})]}),e.jsxs(fs,{children:[e.jsx("div",{children:e.jsx(to,{onClick:()=>x(!1),style:{cursor:"pointer"},children:"Back to profile completion"})}),e.jsxs("div",{style:{marginTop:"var(--space-sm)"},children:["Having trouble?"," ",e.jsx(to,{children:e.jsx(Ze,{to:(s==null?void 0:s.ui_settings.support_page_url)||"#",children:"Get help"})})]})]})]})})}return e.jsx(ie,{children:e.jsxs(Cn,{children:[e.jsx(De,{}),e.jsxs(us,{children:[e.jsx(ps,{children:E}),e.jsx(hs,{children:R})]}),e.jsxs(dt,{onSubmit:N,noValidate:!0,children:[(k.includes("first_name")||k.includes("last_name"))&&(((D=$==null?void 0:$.first_name)==null?void 0:D.enabled)||((B=$==null?void 0:$.last_name)==null?void 0:B.enabled))&&e.jsxs(Kf,{$isBothEnabled:!!((oe=$==null?void 0:$.first_name)!=null&&oe.enabled&&((se=$==null?void 0:$.last_name)!=null&&se.enabled)&&k.includes("first_name")&&k.includes("last_name")),children:[k.includes("first_name")&&((ne=$==null?void 0:$.first_name)==null?void 0:ne.enabled)&&e.jsxs(fe,{children:[e.jsxs(he,{htmlFor:"first_name",children:["First name ",$.first_name.required&&"*"]}),e.jsx(le,{type:"text",id:"first_name",name:"first_name",value:f.first_name||"",onChange:I,placeholder:"Enter your first name","aria-invalid":!!h.first_name,disabled:b,autoComplete:"given-name"}),h.first_name&&e.jsx(Ot,{children:h.first_name})]}),k.includes("last_name")&&((K=$==null?void 0:$.last_name)==null?void 0:K.enabled)&&e.jsxs(fe,{children:[e.jsxs(he,{htmlFor:"last_name",children:["Last name ",$.last_name.required&&"*"]}),e.jsx(le,{type:"text",id:"last_name",name:"last_name",value:f.last_name||"",onChange:I,placeholder:"Enter your last name","aria-invalid":!!h.last_name,disabled:b,autoComplete:"family-name"}),h.last_name&&e.jsx(Ot,{children:h.last_name})]})]}),k.includes("username")&&((U=$==null?void 0:$.username)==null?void 0:U.enabled)&&e.jsxs(fe,{children:[e.jsxs(he,{htmlFor:"username",children:["Username ",$.username.required&&"*"]}),e.jsx(le,{type:"text",id:"username",name:"username",value:f.username||"",onChange:I,placeholder:"Choose a username","aria-invalid":!!h.username,disabled:b,autoComplete:"username"}),h.username&&e.jsx(Ot,{children:h.username})]}),k.includes("phone_number")&&((H=$==null?void 0:$.phone_number)==null?void 0:H.enabled)&&e.jsxs(fe,{children:[e.jsxs(he,{htmlFor:"phone_number",children:["Phone number ",$.phone_number.required&&"*"]}),e.jsx(Br,{value:f.phone_number||"",onChange:L,error:h.phone_number,countryCode:u,setCountryCode:m}),h.phone_number&&e.jsx(Ot,{children:h.phone_number})]}),k.includes("email_address")&&((Q=$==null?void 0:$.email_address)==null?void 0:Q.enabled)&&e.jsxs(fe,{children:[e.jsxs(he,{htmlFor:"email",children:["Email address ",$.email_address.required&&"*"]}),e.jsx(le,{type:"email",id:"email",name:"email",value:f.email||"",onChange:I,placeholder:"Enter your email address","aria-invalid":!!h.email_address,disabled:b,autoComplete:"email"}),h.email_address&&e.jsx(Ot,{children:h.email_address})]}),j&&e.jsx(Ot,{style:{marginBottom:"var(--space-md)"},children:j.message}),e.jsx(Qf,{type:"submit",disabled:b,children:b?"Completing...":"Continue"})]}),e.jsxs(fs,{children:[r&&e.jsx("div",{children:e.jsx(to,{onClick:r,style:{cursor:"pointer"},children:"Back to login"})}),e.jsxs("div",{style:{marginTop:"var(--space-sm)"},children:["Having trouble?"," ",e.jsx(to,{children:e.jsx(Ze,{to:(s==null?void 0:s.ui_settings.support_page_url)||"#",children:"Get help"})})]})]})]})})}const Jf=new Set([Ve.ErrorCode.InvalidCredentials,Ve.ErrorCode.UserNotFound,Ve.ErrorCode.UserAlreadySignedIn,Ve.ErrorCode.Internal,Ve.ErrorCode.UserDisabled,Ve.ErrorCode.CountryRestricted,Ve.ErrorCode.EmailNotAllowed,Ve.ErrorCode.EmailBlocked,Ve.ErrorCode.DisposableEmailBlocked,Ve.ErrorCode.VoipNumberBlocked,Ve.ErrorCode.BannedKeyword]),eg=jr`
|
|
1563
1563
|
from {
|
|
1564
1564
|
transform: rotate(0deg);
|
|
1565
1565
|
}
|
|
@@ -1580,7 +1580,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1580
1580
|
min-height: 200px;
|
|
1581
1581
|
|
|
1582
1582
|
svg {
|
|
1583
|
-
animation: ${
|
|
1583
|
+
animation: ${eg} 1s linear infinite;
|
|
1584
1584
|
color: var(--color-primary);
|
|
1585
1585
|
}
|
|
1586
1586
|
`,ms=l.div`
|
|
@@ -1596,7 +1596,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1596
1596
|
`,vs=l.p`
|
|
1597
1597
|
color: var(--color-secondary-text);
|
|
1598
1598
|
font-size: var(--font-xs);
|
|
1599
|
-
`,
|
|
1599
|
+
`,tg=l.div`
|
|
1600
1600
|
position: relative;
|
|
1601
1601
|
text-align: center;
|
|
1602
1602
|
margin: var(--space-2xl) 0;
|
|
@@ -1610,7 +1610,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1610
1610
|
height: 1px;
|
|
1611
1611
|
background: var(--color-border);
|
|
1612
1612
|
}
|
|
1613
|
-
`,
|
|
1613
|
+
`,rg=l.span`
|
|
1614
1614
|
position: relative;
|
|
1615
1615
|
background: var(--color-background);
|
|
1616
1616
|
padding: 0 var(--space-md);
|
|
@@ -1619,9 +1619,9 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1619
1619
|
font-weight: 500;
|
|
1620
1620
|
text-transform: uppercase;
|
|
1621
1621
|
letter-spacing: 0.05em;
|
|
1622
|
-
`,
|
|
1622
|
+
`,og=l.div`
|
|
1623
1623
|
position: relative;
|
|
1624
|
-
`,
|
|
1624
|
+
`,Pr=l.p`
|
|
1625
1625
|
font-size: var(--font-2xs);
|
|
1626
1626
|
color: var(--color-error);
|
|
1627
1627
|
margin: 0;
|
|
@@ -1643,27 +1643,27 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1643
1643
|
&:hover {
|
|
1644
1644
|
color: var(--color-primary-hover);
|
|
1645
1645
|
}
|
|
1646
|
-
`;function
|
|
1646
|
+
`;function ng(){return e.jsx(lf,{children:e.jsx(ag,{})})}function ag(){var K,U,H,Q,ae,te,ee,Y,de,ue;const{deployment:t}=ve(),{navigate:r}=qe(),{session:o,loading:n}=Ue(),{setEmail:a,otpSent:s,setOtpSent:p,showForgotPassword:f,setShowForgotPassword:c,showOtherOptions:h,setShowOtherOptions:d,enabledSocialsProviders:u,firstFactor:m}=Xc(),{loading:v,signIn:x,signinAttempt:w,discardSignInAttempt:_,error:z,setSignInAttempt:y}=Ar(pr.Generic),{signIn:P}=Ar(pr.Oauth),[C,j]=i.useState({email:"",username:"",password:"",phone:""}),[b,g]=i.useState({}),[S,k]=i.useState(!1),[E,R]=i.useState(""),[$,O]=i.useState("US"),[I,T]=i.useState(!1),N=F=>{let{name:M,value:W}=F.target;M==="phone"?W=W.replace(/[^0-9]/g,""):M==="email"&&(a(W),W=W.toLowerCase()),j(A=>({...A,[M]:W})),g(A=>({...A,[M]:""}))},L=()=>{j({email:"",username:"",password:"",phone:""}),g({}),O("US")},D=async F=>{if(F.preventDefault(),v||S)return;_();const M={};if(m==="email_password"?(C.email||(M.email="Email address is required"),C.password||(M.password="Password is required")):m==="username_password"?(C.username||(M.username="Username is required"),C.password||(M.password="Password is required")):m==="email_otp"||m==="email_magic_link"?C.email||(M.email="Email address is required"):m==="phone_otp"&&(C.phone?/^\d{7,15}$/.test(C.phone)||(M.phone="Phone number must contain 7-15 digits"):M.phone="Phone number is required"),g(M),Object.keys(M).length>0)return;let W="";switch(m){case"email_password":W="plain_email";break;case"username_password":W="plain_username";break;case"email_otp":W="email_otp";break;case"email_magic_link":W="magic_link";break;case"phone_otp":W="phone_otp";break}k(!0);try{const A={...C,strategy:W};m==="phone_otp"&&$&&(A.phone_country_code=$),await x.create(A)}catch(A){g({submit:A.message}),k(!1)}},B=async F=>{if(F.preventDefault(),v||S)return;const M={};if(!E){M.otp="OTP code is required",g(M);return}k(!0),g({});try{await x.completeVerification(E),p(!1),R("")}catch(W){g({otp:W.message||"Verification failed"})}finally{k(!1)}},oe=async F=>{if(!(v||S)){k(!0);try{const W=new URLSearchParams(window.location.search).get("redirect_uri")||void 0,{data:A}=await P.create({provider:F.provider,redirectUri:W});A&&typeof A=="object"&&"oauth_url"in A&&(window.location.href=A.oauth_url)}catch(M){g({submit:M.message})}finally{k(!1)}}};if(i.useEffect(()=>{if(n)return;const F=new URLSearchParams(window.location.search),M=F.get("signin_attempt_id");if(M&&(o!=null&&o.signin_attempts)&&!w){const W=o.signin_attempts.find(A=>A.id===M);if(W){y(W),F.delete("signin_attempt_id");const A=F.toString()?`${window.location.pathname}?${F.toString()}`:window.location.pathname;window.history.replaceState({},"",A)}}},[o,n,w,y]),i.useEffect(()=>{var A;if(!w)return;if(w.completed){T(!0);let G=new URLSearchParams(window.location.search).get("redirect_uri");if(G||(G=((A=t==null?void 0:t.ui_settings)==null?void 0:A.after_signin_redirect_url)||null),!G&&(t!=null&&t.frontend_host)&&(G=`https://${t.frontend_host}`),G){const re=new URL(G);(t==null?void 0:t.mode)==="staging"&&re.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),r(re.toString())}return}if(!x||s)return;const M={verify_email:"email_otp",verify_email_otp:"email_otp",verify_email_link:"magic_link",verify_phone:"phone_otp",verify_phone_otp:"phone_otp"}[w.current_step];if(!M)return;(async()=>{try{await x.prepareVerification({strategy:M}),p(!0)}catch(G){console.error("Failed to prepare verification:",G),g({submit:"Failed to send verification. Please try again."})}finally{k(!1)}})()},[w,x,s,p,r,t]),i.useEffect(()=>{const F={};if(z!=null&&z.errors&&Array.isArray(z==null?void 0:z.errors))for(const M of z.errors)Jf.has(M.code)&&(F.submit=M.message);g(F)},[z]),h)return e.jsx(yf,{onBack:()=>d(!1)});if(f)return e.jsx(ff,{onBack:()=>c(!1)});if((w==null?void 0:w.current_step)==="verify_second_factor")return e.jsx(rl,{attempt:w,completeVerification:x.completeVerification,prepareVerification:x.prepareVerification,onBack:()=>{_(),L(),p(!1)}});if((w==null?void 0:w.current_step)==="complete_profile")return e.jsx(ol,{attempt:w,completeProfile:x.completeProfile,completeVerification:x.completeVerification,prepareVerification:x.prepareVerification,onBack:()=>{_(),L(),p(!1)}});if(n)return e.jsx(ie,{children:e.jsxs(Sn,{children:[e.jsx(De,{}),e.jsx(gs,{children:e.jsx(vr,{size:32})})]})});if(I)return e.jsx(ie,{children:e.jsxs(Sn,{children:[e.jsx(De,{}),e.jsx(gs,{children:e.jsx(vr,{size:32})})]})});const ne=(w==null?void 0:w.current_step)&&["verify_email","verify_email_otp","verify_email_link","verify_phone","verify_phone_otp"].includes(w.current_step)&&s;return e.jsx(ie,{children:e.jsxs(Sn,{children:[e.jsx(De,{}),ne?e.jsx(e.Fragment,{children:e.jsxs(ms,{children:[e.jsx(xs,{children:m==="phone_otp"?"Check your phone":"Check your email"}),e.jsx(vs,{children:m==="email_magic_link"?`If ${C.email} exists in our records, you will receive a magic link. Click the link to sign in.`:m==="phone_otp"?`If ${C.phone} exists in our records, you will receive a verification code via SMS. Enter it below to continue.`:`If ${C.email} exists in our records, you will receive a verification code. Enter it below to continue.`})]})}):e.jsxs(ms,{children:[e.jsx(xs,{children:"Sign in to your account"}),e.jsxs(vs,{children:["Please enter your details to continue to"," ",(t==null?void 0:t.ui_settings.app_name)||"App","!"]})]}),ne?m==="email_magic_link"?e.jsxs($n,{children:["Having trouble?"," ",e.jsx(Mt,{children:e.jsx(Ze,{to:t.ui_settings.support_page_url,children:"Get help"})}),e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(Mt,{onClick:()=>{p(!1),_(),L()},style:{cursor:"pointer"},children:"Back to login"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(dt,{style:{gap:"15px"},onSubmit:B,noValidate:!0,children:[e.jsx(Et,{onComplete:async F=>{if(R(F),F&&F.length===6){k(!0),g({});try{await x.completeVerification(F),p(!1)}catch(M){g({otp:M.message||"Verification failed"})}finally{k(!1)}}},onResend:async()=>{const F=m==="email_otp"?"email_otp":"phone_otp";await x.prepareVerification({strategy:F})},error:b.otp,isSubmitting:S}),e.jsx(bs,{type:"submit",disabled:S||v||!E,style:{margin:0},children:S?"Verifying...":`Continue to ${(ue=t==null?void 0:t.ui_settings)==null?void 0:ue.app_name}`})]}),e.jsxs($n,{children:["Having trouble?"," ",e.jsx(Mt,{children:e.jsx(Ze,{to:t.ui_settings.support_page_url,children:"Get help"})}),e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(Mt,{onClick:()=>{p(!1),_(),L()},style:{cursor:"pointer"},children:"Back to login"})})]})]}):e.jsxs(e.Fragment,{children:[u.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(va,{connections:u,callback:oe}),e.jsx(tg,{children:e.jsx(rg,{children:"or"})})]}),e.jsxs(dt,{onSubmit:D,noValidate:!0,children:[(m==="email_password"||m==="email_otp"||m==="email_magic_link")&&((U=(K=t==null?void 0:t.auth_settings)==null?void 0:K.email_address)==null?void 0:U.enabled)&&e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"email",children:"Email address"}),e.jsx(le,{type:"email",id:"email",name:"email",value:C.email,onChange:N,placeholder:"Enter your email address","aria-invalid":!!b.email}),b.email&&e.jsx(Pr,{children:b.email})]}),m==="username_password"&&((Q=(H=t==null?void 0:t.auth_settings)==null?void 0:H.username)==null?void 0:Q.enabled)&&e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"username",children:"Username"}),e.jsx(le,{type:"text",id:"username",name:"username",value:C.username,onChange:N,placeholder:"Enter your username","aria-invalid":!!b.username}),b.username&&e.jsx(Pr,{children:b.username})]}),m==="phone_otp"&&((te=(ae=t==null?void 0:t.auth_settings)==null?void 0:ae.phone_number)==null?void 0:te.enabled)&&e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"phone",children:"Phone number"}),e.jsx(Br,{value:C.phone,onChange:N,error:b.phone,countryCode:$,setCountryCode:O}),b.phone&&e.jsx(Pr,{children:b.phone})]}),(m==="email_password"||m==="username_password")&&((Y=(ee=t==null?void 0:t.auth_settings)==null?void 0:ee.password)==null?void 0:Y.enabled)&&e.jsxs(fe,{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[e.jsx(he,{htmlFor:"password",children:"Password"}),e.jsx(Mt,{style:{fontSize:"12px"},onClick:()=>c(!0),children:"Forgot password?"})]}),e.jsx(og,{children:e.jsx(le,{type:"password",id:"password",name:"password",value:C.password,onChange:N,placeholder:"Enter your password","aria-invalid":!!b.password})}),b.password&&e.jsx(Pr,{children:b.password})]}),e.jsxs("div",{children:[b.submit&&e.jsx(Pr,{children:b.submit}),e.jsx(bs,{type:"submit",disabled:S||v,children:S?"Signing in...":"Sign in"})]}),e.jsx(Mt,{style:{fontSize:"12px",textAlign:"center"},onClick:()=>d(!0),children:"Use other methods"})]}),e.jsxs($n,{children:["Don't have an account?"," ",e.jsx(Mt,{children:e.jsx(Ze,{to:`${(de=t.ui_settings)==null?void 0:de.sign_up_page_url}${window.location.search}`,children:"Sign up"})})]})]})]})})}const ys=l.div`
|
|
1647
1647
|
max-width: 380px;
|
|
1648
1648
|
width: 380px;
|
|
1649
1649
|
padding: var(--space-3xl);
|
|
1650
1650
|
background: var(--color-background);
|
|
1651
1651
|
border-radius: var(--radius-lg);
|
|
1652
1652
|
box-shadow: 0 4px 12px var(--color-shadow);
|
|
1653
|
-
`,
|
|
1653
|
+
`,sg=l.div`
|
|
1654
1654
|
text-align: center;
|
|
1655
1655
|
margin-bottom: var(--space-lg);
|
|
1656
|
-
`,
|
|
1656
|
+
`,ig=l.h1`
|
|
1657
1657
|
font-size: var(--font-lg);
|
|
1658
1658
|
font-weight: 500;
|
|
1659
1659
|
color: var(--color-foreground);
|
|
1660
1660
|
margin-bottom: var(--space-xs);
|
|
1661
1661
|
margin-top: 0;
|
|
1662
|
-
`,
|
|
1662
|
+
`,cg=l.p`
|
|
1663
1663
|
color: var(--color-secondary-text);
|
|
1664
1664
|
font-size: var(--font-xs);
|
|
1665
1665
|
margin: 0;
|
|
1666
|
-
`,
|
|
1666
|
+
`,lg=l.form`
|
|
1667
1667
|
display: flex;
|
|
1668
1668
|
flex-direction: column;
|
|
1669
1669
|
gap: var(--space-md);
|
|
@@ -1671,7 +1671,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1671
1671
|
display: flex;
|
|
1672
1672
|
flex-direction: column;
|
|
1673
1673
|
gap: var(--space-xs);
|
|
1674
|
-
`,
|
|
1674
|
+
`,dg=l.div`
|
|
1675
1675
|
display: grid;
|
|
1676
1676
|
grid-template-columns: ${t=>t.$isBothEnabled?"1fr 1fr":"1fr"};
|
|
1677
1677
|
gap: var(--space-md);
|
|
@@ -1680,10 +1680,10 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1680
1680
|
font-weight: 500;
|
|
1681
1681
|
color: var(--color-foreground);
|
|
1682
1682
|
text-align: left;
|
|
1683
|
-
`,
|
|
1683
|
+
`,Pn=l.span`
|
|
1684
1684
|
color: var(--color-error);
|
|
1685
1685
|
margin-left: var(--space-2xs);
|
|
1686
|
-
`,
|
|
1686
|
+
`,ug=l.button`
|
|
1687
1687
|
width: 100%;
|
|
1688
1688
|
padding: var(--space-sm) var(--space-md);
|
|
1689
1689
|
border: ${t=>t.$primary?"none":"1px solid var(--color-input-border)"};
|
|
@@ -1709,13 +1709,13 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1709
1709
|
color: var(--color-error);
|
|
1710
1710
|
font-size: var(--font-2xs);
|
|
1711
1711
|
margin-top: var(--space-2xs);
|
|
1712
|
-
`,
|
|
1712
|
+
`,pg=l.div`
|
|
1713
1713
|
display: flex;
|
|
1714
1714
|
flex-direction: column;
|
|
1715
1715
|
align-items: center;
|
|
1716
1716
|
gap: var(--space-md);
|
|
1717
1717
|
text-align: center;
|
|
1718
|
-
`,
|
|
1718
|
+
`,hg=l.div`
|
|
1719
1719
|
width: 48px;
|
|
1720
1720
|
height: 48px;
|
|
1721
1721
|
background: var(--color-success);
|
|
@@ -1724,27 +1724,27 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1724
1724
|
align-items: center;
|
|
1725
1725
|
justify-content: center;
|
|
1726
1726
|
color: white;
|
|
1727
|
-
`,
|
|
1727
|
+
`,fg=l.h2`
|
|
1728
1728
|
font-size: var(--font-lg);
|
|
1729
1729
|
color: var(--color-foreground);
|
|
1730
1730
|
margin: 0;
|
|
1731
|
-
`,
|
|
1731
|
+
`,gg=l.p`
|
|
1732
1732
|
font-size: var(--font-xs);
|
|
1733
1733
|
color: var(--color-secondary-text);
|
|
1734
1734
|
margin: 0;
|
|
1735
1735
|
line-height: 1.5;
|
|
1736
|
-
`,
|
|
1736
|
+
`,mg=l.div`
|
|
1737
1737
|
text-align: center;
|
|
1738
1738
|
margin-top: var(--space-lg);
|
|
1739
|
-
`,
|
|
1739
|
+
`,xg=l.p`
|
|
1740
1740
|
font-size: var(--font-xs);
|
|
1741
1741
|
color: var(--color-muted);
|
|
1742
1742
|
margin: 0;
|
|
1743
|
-
`,
|
|
1743
|
+
`,vg=l.a`
|
|
1744
1744
|
color: var(--color-primary);
|
|
1745
1745
|
text-decoration: none;
|
|
1746
1746
|
cursor: pointer;
|
|
1747
|
-
`;function
|
|
1747
|
+
`;function bg(){var w,_,z,y,P,C,j,b,g,S,k,E;const{deployment:t}=ve(),{loading:r,error:o,joinWaitlist:n}=Hi(),[a,s]=i.useState({first_name:"",last_name:"",email:""}),[p,f]=i.useState(!1),[c,h]=i.useState(!1),d=R=>{var $;if(o!=null&&o.errors)if(R){const O=o.errors.find(I=>{var T;return(T=I.code)==null?void 0:T.toLowerCase().includes(R.toLowerCase())});if(O)return O.message}else return($=o==null?void 0:o.errors[0])==null?void 0:$.message},u=t==null?void 0:t.auth_settings,m=!!((w=u==null?void 0:u.first_name)!=null&&w.enabled&&((_=u==null?void 0:u.last_name)!=null&&_.enabled)),v=R=>{const{name:$,value:O}=R.target;s(I=>({...I,[$]:O}))},x=async R=>{if(R.preventDefault(),!!u){h(!0);try{(await n(a)).data&&f(!0)}catch{}finally{h(!1)}}};return p?e.jsx(ie,{children:e.jsx(ys,{children:e.jsxs(pg,{children:[e.jsx(hg,{children:e.jsx(tt,{size:32})}),e.jsx(fg,{children:"You're on the waitlist!"}),e.jsxs(gg,{children:["Thanks for your interest! We'll notify you at ",a.email," ","when we're ready for you to join."]})]})})}):e.jsx(ie,{children:e.jsxs(ys,{children:[e.jsx(De,{}),e.jsxs(sg,{children:[e.jsx(ig,{children:"Join the waitlist"}),e.jsx(cg,{children:"Be the first to know when we launch!"})]}),e.jsxs(lg,{onSubmit:x,noValidate:!0,children:[(((z=u==null?void 0:u.first_name)==null?void 0:z.enabled)||((y=u==null?void 0:u.last_name)==null?void 0:y.enabled))&&e.jsxs(dg,{$isBothEnabled:m,children:[((P=u==null?void 0:u.first_name)==null?void 0:P.enabled)&&e.jsxs(zn,{children:[e.jsxs(En,{htmlFor:"first_name",children:["First name",((C=u==null?void 0:u.first_name)==null?void 0:C.required)&&e.jsx(Pn,{children:"*"})]}),e.jsx(le,{type:"text",id:"first_name",name:"first_name",required:(j=u==null?void 0:u.first_name)==null?void 0:j.required,minLength:2,maxLength:50,value:a.first_name,onChange:v,placeholder:"First name","aria-invalid":!!d("first_name")}),d("first_name")&&e.jsx(ro,{children:d("first_name")})]}),((b=u==null?void 0:u.last_name)==null?void 0:b.enabled)&&e.jsxs(zn,{children:[e.jsxs(En,{htmlFor:"last_name",children:["Last name",((g=u==null?void 0:u.last_name)==null?void 0:g.required)&&e.jsx(Pn,{children:"*"})]}),e.jsx(le,{type:"text",id:"last_name",name:"last_name",required:(S=u==null?void 0:u.last_name)==null?void 0:S.required,minLength:2,maxLength:50,value:a.last_name,onChange:v,placeholder:"Last name","aria-invalid":!!d("last_name")}),d("last_name")&&e.jsx(ro,{children:d("last_name")})]})]}),e.jsxs(zn,{children:[e.jsxs(En,{htmlFor:"email",children:["Email address",((k=u==null?void 0:u.email_address)==null?void 0:k.required)&&e.jsx(Pn,{children:"*"})]}),e.jsx(le,{type:"email",id:"email",name:"email",required:(E=u==null?void 0:u.email_address)==null?void 0:E.required,value:a.email,onChange:v,placeholder:"Enter your email address","aria-invalid":!!d("email")}),d("email")&&e.jsx(ro,{children:d("email")})]}),d()&&e.jsx(ro,{children:d()}),e.jsx(ug,{type:"submit",$primary:!0,disabled:c||r,children:c||r?"Joining waitlist...":"Join waitlist"})]}),e.jsx(mg,{children:e.jsxs(xg,{children:["Need assistance? ",e.jsx(vg,{href:"/contact",children:"Get help"})]})})]})})}const oo=l.div`
|
|
1748
1748
|
max-width: 380px;
|
|
1749
1749
|
width: 380px;
|
|
1750
1750
|
padding: var(--space-3xl);
|
|
@@ -1768,7 +1768,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1768
1768
|
`,io=l.div`
|
|
1769
1769
|
padding-top: var(--space-xl);
|
|
1770
1770
|
text-align: center;
|
|
1771
|
-
`,
|
|
1771
|
+
`,yg=l.div`
|
|
1772
1772
|
width: calc(var(--space-3xl) * 2);
|
|
1773
1773
|
height: calc(var(--space-3xl) * 2);
|
|
1774
1774
|
border-radius: 50%;
|
|
@@ -1796,7 +1796,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1796
1796
|
transform: rotate(360deg);
|
|
1797
1797
|
}
|
|
1798
1798
|
}
|
|
1799
|
-
`,
|
|
1799
|
+
`,wg=l.div`
|
|
1800
1800
|
width: calc(var(--space-3xl) * 2);
|
|
1801
1801
|
height: calc(var(--space-3xl) * 2);
|
|
1802
1802
|
border-radius: 50%;
|
|
@@ -1815,12 +1815,12 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1815
1815
|
font-size: var(--font-xs);
|
|
1816
1816
|
color: var(--color-secondary-text);
|
|
1817
1817
|
margin-bottom: var(--space-lg);
|
|
1818
|
-
`,
|
|
1818
|
+
`,jg=l.div`
|
|
1819
1819
|
margin-top: var(--space-xl);
|
|
1820
1820
|
text-align: center;
|
|
1821
1821
|
font-size: var(--font-xs);
|
|
1822
1822
|
color: var(--color-secondary-text);
|
|
1823
|
-
`,
|
|
1823
|
+
`,kg=l.span`
|
|
1824
1824
|
color: var(--color-primary);
|
|
1825
1825
|
text-decoration: none;
|
|
1826
1826
|
font-weight: 500;
|
|
@@ -1831,30 +1831,30 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1831
1831
|
color: var(--color-primary-hover);
|
|
1832
1832
|
text-decoration: underline;
|
|
1833
1833
|
}
|
|
1834
|
-
`;function
|
|
1834
|
+
`;function _g(){const{deployment:t}=ve(),{navigate:r}=qe(),{error:o,session:n,processed:a,signinAttempt:s,redirectUri:p,loading:f}=qi(),c=()=>{window.location.reload()},h=()=>{var u;const d=((u=t==null?void 0:t.ui_settings)==null?void 0:u.sign_in_page_url)||"/sign-in";r(d)};if(i.useEffect(()=>{var d,u;if(!(!a||f)){if(s&&!s.completed){const m=(d=t==null?void 0:t.ui_settings)==null?void 0:d.sign_in_page_url;if(m){const v=new URL(m,window.location.origin);v.searchParams.set("signin_attempt_id",s.id),p&&v.searchParams.set("redirect_uri",p),r(v.toString())}return}if(s!=null&&s.completed){const m=new URL(p||((u=t==null?void 0:t.ui_settings)==null?void 0:u.after_signin_redirect_url)||(t==null?void 0:t.frontend_host)||"");m&&((t==null?void 0:t.mode)==="staging"&&m.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),r(m.toString()))}}},[n,a,f,p,t,s,r]),i.useEffect(()=>{o&&o.message.includes("No OAuth callback data found")&&setTimeout(()=>{var u;const d=((u=t==null?void 0:t.ui_settings)==null?void 0:u.sign_in_page_url)||(t==null?void 0:t.frontend_host);d&&r(d)},2e3)},[o,t,r]),f&&!a)return e.jsx(ie,{children:e.jsxs(oo,{children:[e.jsxs(no,{children:[e.jsx(ao,{children:"Completing sign in"}),e.jsx(so,{children:"Please wait while we authenticate you"})]}),e.jsxs(io,{children:[e.jsx(ws,{}),e.jsx(co,{children:"Verifying your credentials..."}),e.jsx(lo,{children:"This will only take a moment."})]})]})});if(n&&a&&!o)return e.jsx(ie,{children:e.jsxs(oo,{children:[e.jsxs(no,{children:[e.jsx(ao,{children:"Success!"}),e.jsx(so,{children:"Authentication completed successfully"})]}),e.jsxs(io,{children:[e.jsx(wg,{children:"✓"}),e.jsx(co,{children:"Redirecting you now..."}),e.jsx(lo,{children:"You'll be redirected to your destination shortly."})]})]})});if(o){const d=o.message.includes("No OAuth callback data found");return e.jsx(ie,{children:e.jsxs(oo,{children:[e.jsxs(no,{children:[e.jsx(ao,{children:"Something went wrong"}),e.jsx(so,{children:"We couldn't complete your sign in"})]}),e.jsxs(io,{children:[e.jsx(yg,{children:"✗"}),e.jsx(co,{children:"Authentication Failed"}),e.jsx(lo,{children:o.message||"An unexpected error occurred during authentication."}),!d&&e.jsx(X,{onClick:c,style:{marginTop:"var(--space-lg)"},children:"Try Again"})]}),!d&&e.jsx(jg,{children:e.jsxs("div",{children:["Having trouble?"," ",e.jsx(kg,{onClick:h,children:"Return to sign in"})]})})]})})}return e.jsx(ie,{children:e.jsxs(oo,{children:[e.jsxs(no,{children:[e.jsx(ao,{children:"Completing sign in"}),e.jsx(so,{children:"Please wait while we authenticate you"})]}),e.jsxs(io,{children:[e.jsx(ws,{}),e.jsx(co,{children:"Verifying your credentials..."}),e.jsx(lo,{children:"This will only take a moment."})]})]})})}const Cg=l.div`
|
|
1835
1835
|
max-width: 380px;
|
|
1836
1836
|
width: 380px;
|
|
1837
1837
|
padding: var(--space-3xl);
|
|
1838
1838
|
background: var(--color-background);
|
|
1839
1839
|
border-radius: var(--radius-lg);
|
|
1840
1840
|
box-shadow: 0 4px 12px var(--color-shadow);
|
|
1841
|
-
`,
|
|
1841
|
+
`,Sg=l.div`
|
|
1842
1842
|
text-align: center;
|
|
1843
1843
|
position: relative;
|
|
1844
|
-
|
|
1844
|
+
`,$g=l.h1`
|
|
1845
1845
|
font-size: var(--font-lg);
|
|
1846
1846
|
font-weight: 500;
|
|
1847
1847
|
color: var(--color-foreground);
|
|
1848
1848
|
margin-bottom: var(--space-xs);
|
|
1849
1849
|
margin-top: 0;
|
|
1850
|
-
|
|
1850
|
+
`,zg=l.p`
|
|
1851
1851
|
color: var(--color-secondary-text);
|
|
1852
1852
|
font-size: var(--font-xs);
|
|
1853
1853
|
margin: 0;
|
|
1854
|
-
`,
|
|
1854
|
+
`,Eg=l.div`
|
|
1855
1855
|
padding-top: var(--space-xl);
|
|
1856
1856
|
text-align: center;
|
|
1857
|
-
`,
|
|
1857
|
+
`,Pg=l.div`
|
|
1858
1858
|
width: calc(var(--space-3xl) * 2);
|
|
1859
1859
|
height: calc(var(--space-3xl) * 2);
|
|
1860
1860
|
border-radius: 50%;
|
|
@@ -1865,7 +1865,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1865
1865
|
margin: 0 auto var(--space-lg) auto;
|
|
1866
1866
|
color: var(--color-success);
|
|
1867
1867
|
font-size: var(--font-xl);
|
|
1868
|
-
`,
|
|
1868
|
+
`,Rg=l.div`
|
|
1869
1869
|
width: calc(var(--space-3xl) * 2);
|
|
1870
1870
|
height: calc(var(--space-3xl) * 2);
|
|
1871
1871
|
border-radius: 50%;
|
|
@@ -1876,7 +1876,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1876
1876
|
margin: 0 auto var(--space-lg) auto;
|
|
1877
1877
|
color: var(--color-error);
|
|
1878
1878
|
font-size: var(--font-xl);
|
|
1879
|
-
`,
|
|
1879
|
+
`,Ig=l.div`
|
|
1880
1880
|
width: calc(var(--space-3xl) * 2);
|
|
1881
1881
|
height: calc(var(--space-3xl) * 2);
|
|
1882
1882
|
border: 3px solid var(--color-border);
|
|
@@ -1896,14 +1896,14 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1896
1896
|
`,Rn=l.p`
|
|
1897
1897
|
font-size: var(--font-xs);
|
|
1898
1898
|
color: var(--color-secondary-text);
|
|
1899
|
-
`;function
|
|
1899
|
+
`;function Tg({onSuccess:t,onError:r}={}){const[o,n]=i.useState("loading"),[a,s]=i.useState(""),{token:p,attempt:f,redirectUri:c}=Zi(),{verifyMagicLink:h,error:d,success:u}=Yi(),{navigate:m}=qe(),{deployment:v}=ve(),x=i.useRef(!1);i.useEffect(()=>{(async()=>{if(!x.current){if(!p||!f){n("error"),s("The magic link appears to be malformed. Please try signing in again."),r==null||r("Invalid magic link parameters");return}x.current=!0,n("loading"),s("Please wait while we verify your magic link."),await h({token:p,attempt:f,redirectUri:c})}})()},[p,f]),i.useEffect(()=>{u?(n("success"),s("You will be redirected to your account shortly."),t==null||t(),setTimeout(()=>{var z;let _=c;if(_||(_=(z=v==null?void 0:v.ui_settings)==null?void 0:z.after_signin_redirect_url),!_&&(v!=null&&v.frontend_host)&&(_=`https://${v.frontend_host}`),_){const y=new URL(_);(v==null?void 0:v.mode)==="staging"&&y.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),m(y.toString())}},2e3)):d&&(n("error"),s("The magic link may have expired or already been used. Please try signing in again."),r==null||r(d.message))},[u,d,m,v,c,t,r]);const w=()=>{var _;(_=v==null?void 0:v.ui_settings)!=null&&_.sign_in_page_url&&m(v.ui_settings.sign_in_page_url)};return e.jsx(ie,{children:e.jsxs(Cg,{children:[e.jsxs(Sg,{children:[e.jsx($g,{children:"Magic Link Verification"}),e.jsx(zg,{children:"Verifying your magic link"})]}),e.jsxs(Eg,{children:[o==="loading"&&e.jsxs(e.Fragment,{children:[e.jsx(Ig,{}),e.jsx(Rn,{children:a})]}),o==="success"&&e.jsxs(e.Fragment,{children:[e.jsx(Pg,{children:"✓"}),e.jsx(Rn,{children:a})]}),o==="error"&&e.jsxs(e.Fragment,{children:[e.jsx(Rg,{children:"✗"}),e.jsx(Rn,{children:a}),e.jsx(X,{onClick:w,style:{marginTop:"var(--space-xl)"},children:"Try Again"})]})]})]})})}function Og(t){var n,a;return t?((n=t.signin_attempts)==null?void 0:n.find(s=>s.requires_completion&&!s.completed))?!0:!!((a=t.signup_attempts)==null?void 0:a.find(s=>{var p,f;return((p=s.missing_fields)==null?void 0:p.length)>0||((f=s.remaining_steps)==null?void 0:f.length)>0&&!s.completed})):!1}function Mg(t){const r=t?`/profile-completion?redirect_uri=${encodeURIComponent(t)}`:"/profile-completion";window.location.href=r}const Lt=l.div`
|
|
1900
1900
|
max-width: 380px;
|
|
1901
1901
|
width: 380px;
|
|
1902
1902
|
padding: var(--space-3xl);
|
|
1903
1903
|
background: var(--color-background);
|
|
1904
1904
|
border-radius: var(--radius-lg);
|
|
1905
1905
|
box-shadow: 0 4px 12px var(--color-shadow);
|
|
1906
|
-
`,
|
|
1906
|
+
`,At=l.div`
|
|
1907
1907
|
text-align: center;
|
|
1908
1908
|
margin-bottom: var(--space-lg);
|
|
1909
1909
|
position: relative;
|
|
@@ -1920,7 +1920,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1920
1920
|
`,Ft=l.div`
|
|
1921
1921
|
padding-top: var(--space-xl);
|
|
1922
1922
|
text-align: center;
|
|
1923
|
-
`,
|
|
1923
|
+
`,Lg=l.div`
|
|
1924
1924
|
width: calc(var(--space-3xl) * 2);
|
|
1925
1925
|
height: calc(var(--space-3xl) * 2);
|
|
1926
1926
|
border-radius: 50%;
|
|
@@ -1931,7 +1931,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1931
1931
|
margin: 0 auto var(--space-lg) auto;
|
|
1932
1932
|
color: var(--color-success);
|
|
1933
1933
|
font-size: var(--font-xl);
|
|
1934
|
-
`,
|
|
1934
|
+
`,In=l.div`
|
|
1935
1935
|
width: calc(var(--space-3xl) * 2);
|
|
1936
1936
|
height: calc(var(--space-3xl) * 2);
|
|
1937
1937
|
border-radius: 50%;
|
|
@@ -1981,12 +1981,12 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1981
1981
|
`,ks=l.span`
|
|
1982
1982
|
color: var(--color-primary);
|
|
1983
1983
|
font-weight: 500;
|
|
1984
|
-
`,
|
|
1984
|
+
`,Dg=l.div`
|
|
1985
1985
|
margin-top: var(--space-xl);
|
|
1986
1986
|
text-align: center;
|
|
1987
1987
|
font-size: var(--font-xs);
|
|
1988
1988
|
color: var(--color-secondary-text);
|
|
1989
|
-
`,
|
|
1989
|
+
`,Ng=l.span`
|
|
1990
1990
|
color: var(--color-primary);
|
|
1991
1991
|
text-decoration: none;
|
|
1992
1992
|
font-weight: 500;
|
|
@@ -1996,11 +1996,11 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
1996
1996
|
&:hover {
|
|
1997
1997
|
color: var(--color-primary-hover);
|
|
1998
1998
|
}
|
|
1999
|
-
`;function
|
|
1999
|
+
`;function Fg({token:t,onSuccess:r,onError:o}){var w;const{acceptInvitation:n,invitationData:a,loading:s,error:p}=tc(),{navigate:f}=qe(),{deployment:c}=ve(),h=i.useRef(!1),d=()=>{var z;const _=new URLSearchParams(window.location.search);return{token:t||_.get("invite_token")||_.get("token"),redirectUri:_.get("redirect_uri")||((z=c==null?void 0:c.ui_settings)==null?void 0:z.after_signin_redirect_url)||"/"}};i.useEffect(()=>{if(h.current)return;const{token:_}=d();_&&(h.current=!0,n(_))},[n]),i.useEffect(()=>{var _;a&&(a.organization&&!a.requires_signin&&r&&r(a.organization.id,(_=a.workspace)==null?void 0:_.id),a.error_code&&o&&o(a.message||"Failed to accept invitation"))},[a,r,o]);const u=()=>{const{redirectUri:_}=d();f(_)},m=()=>{var b,g;const{token:_,redirectUri:z}=d(),y=((b=c==null?void 0:c.ui_settings)==null?void 0:b.sign_in_page_url)||"/sign-in",P=((g=c==null?void 0:c.ui_settings)==null?void 0:g.sign_up_page_url)||"/sign-up",C=new URLSearchParams;_&&C.set("invite_token",_),a!=null&&a.invited_email&&C.set("invited_email",a.invited_email),C.set("redirect_uri",z),a!=null&&a.message&&C.set("message",a.message);const j=(a==null?void 0:a.error_code)==="INVITATION_REQUIRES_SIGNUP";f(`${j?P:y}?${C.toString()}`)},v=()=>{const{token:_}=d();_&&(h.current=!1,n(_))},{token:x}=d();if(!x&&!s)return e.jsx(ie,{children:e.jsxs(Lt,{children:[e.jsxs(At,{children:[e.jsx(Dt,{children:"Invalid Invitation"}),e.jsx(Nt,{children:"No invitation token found"})]}),e.jsxs(Ft,{children:[e.jsx(In,{children:"✗"}),e.jsx(Bt,{children:"Missing Invitation Token"}),e.jsx(Ut,{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(s)return e.jsx(ie,{children:e.jsxs(Lt,{children:[e.jsxs(At,{children:[e.jsx(Dt,{children:"Processing Invitation"}),e.jsx(Nt,{children:"Please wait while we verify your invitation"})]}),e.jsxs(Ft,{children:[e.jsx(Ag,{}),e.jsx(Bt,{children:"Verifying invitation..."}),e.jsx(Ut,{children:"This will only take a moment."})]})]})});if(a!=null&&a.organization&&!a.requires_signin)return e.jsx(ie,{children:e.jsxs(Lt,{children:[e.jsxs(At,{children:[e.jsx(Dt,{children:"Invitation Accepted!"}),e.jsx(Nt,{children:"You've successfully joined the organization"})]}),e.jsxs(Ft,{children:[e.jsx(Lg,{children:"✓"}),e.jsxs(Bt,{children:["Welcome to ",a.organization.name,"!"]}),a.workspace&&e.jsxs(Ut,{children:["You've been added to the ",a.workspace.name," workspace."]}),e.jsx(X,{onClick:u,style:{marginTop:"var(--space-lg)"},children:"Continue to Application"})]})]})});if(a!=null&&a.already_member)return e.jsx(ie,{children:e.jsxs(Lt,{children:[e.jsxs(At,{children:[e.jsx(Dt,{children:"Already a Member"}),e.jsx(Nt,{children:"You're already part of this organization"})]}),e.jsxs(Ft,{children:[e.jsx(js,{children:"ℹ"}),e.jsxs(Bt,{children:["You're already a member of ",((w=a.organization)==null?void 0:w.name)||"this organization"]}),e.jsx(Ut,{children:"No action needed - you already have access."}),e.jsx(X,{onClick:u,style:{marginTop:"var(--space-lg)"},children:"Continue to Application"})]})]})});if(a!=null&&a.requires_signin){const _=a.error_code==="INVITATION_REQUIRES_SIGNUP";return e.jsx(ie,{children:e.jsxs(Lt,{children:[e.jsxs(At,{children:[e.jsx(Dt,{children:_?"Sign Up Required":"Sign In Required"}),e.jsx(Nt,{children:"To accept this invitation"})]}),e.jsxs(Ft,{children:[e.jsx(js,{children:"ℹ"}),e.jsxs(Bt,{children:["This invitation is for ",e.jsx(ks,{children:a.invited_email})]}),e.jsx(Ut,{children:_?"You need to create an account with this email address to accept the invitation.":a.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:m,style:{marginTop:"var(--space-lg)"},children:_?"Sign Up to Accept":"Sign In to Accept"})]})]})})}return(a==null?void 0:a.error_code)==="INVITATION_EXPIRED"?e.jsx(ie,{children:e.jsxs(Lt,{children:[e.jsxs(At,{children:[e.jsx(Dt,{children:"Invitation Expired"}),e.jsx(Nt,{children:"This invitation is no longer valid"})]}),e.jsxs(Ft,{children:[e.jsx(In,{children:"⏱"}),e.jsxs(Bt,{children:["Invitation for ",e.jsx(ks,{children:a.invited_email})," has expired"]}),e.jsx(Ut,{children:"Invitations are valid for 10 days. Please request a new invitation from your organization administrator."})]})]})}):p||a!=null&&a.error_code?e.jsx(ie,{children:e.jsxs(Lt,{children:[e.jsxs(At,{children:[e.jsx(Dt,{children:"Invitation Error"}),e.jsx(Nt,{children:"Unable to process invitation"})]}),e.jsxs(Ft,{children:[e.jsx(In,{children:"✗"}),e.jsx(Bt,{children:"Something went wrong"}),e.jsx(Ut,{children:(a==null?void 0:a.message)||p||"Failed to accept invitation"}),e.jsx(X,{onClick:v,style:{marginTop:"var(--space-lg)"},children:"Try Again"}),e.jsx(Dg,{children:e.jsxs("div",{style:{marginTop:"var(--space-md)"},children:["Having trouble?"," ",e.jsx(Ng,{onClick:m,children:"Sign in manually"})]})})]})]})}):null}const nl=i.createContext({screen:null,setScreen:()=>{},toast:(t,r)=>{}}),at=()=>{const t=i.useContext(nl);if(!t)throw new Error("useScreenContext must be used within a ScreenContextProvider");return t},Bg=l.div`
|
|
2000
2000
|
display: flex;
|
|
2001
2001
|
height: 100%;
|
|
2002
2002
|
min-height: 400px;
|
|
2003
|
-
`,
|
|
2003
|
+
`,Ug=l.div`
|
|
2004
2004
|
width: 35%;
|
|
2005
2005
|
background: var(--color-background-hover);
|
|
2006
2006
|
padding: 32px;
|
|
@@ -2010,7 +2010,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2010
2010
|
justify-content: center;
|
|
2011
2011
|
text-align: center;
|
|
2012
2012
|
border-right: 1px solid var(--color-border);
|
|
2013
|
-
`,
|
|
2013
|
+
`,Wg=l.div`
|
|
2014
2014
|
flex: 1;
|
|
2015
2015
|
padding: 32px;
|
|
2016
2016
|
display: flex;
|
|
@@ -2034,11 +2034,11 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2034
2034
|
border-color: var(--color-border-hover);
|
|
2035
2035
|
transform: scale(1.02);
|
|
2036
2036
|
}
|
|
2037
|
-
`,
|
|
2037
|
+
`,Vg=l.img`
|
|
2038
2038
|
width: 100%;
|
|
2039
2039
|
height: 100%;
|
|
2040
2040
|
object-fit: cover;
|
|
2041
|
-
`,
|
|
2041
|
+
`,Gg=l.div`
|
|
2042
2042
|
font-size: 32px;
|
|
2043
2043
|
font-weight: 600;
|
|
2044
2044
|
color: var(--color-muted);
|
|
@@ -2048,28 +2048,28 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2048
2048
|
display: flex;
|
|
2049
2049
|
align-items: center;
|
|
2050
2050
|
justify-content: center;
|
|
2051
|
-
`,
|
|
2051
|
+
`,Hg=l.h2`
|
|
2052
2052
|
font-size: 16px;
|
|
2053
2053
|
font-weight: 400;
|
|
2054
2054
|
color: var(--color-foreground);
|
|
2055
2055
|
margin-bottom: 8px;
|
|
2056
|
-
`,
|
|
2056
|
+
`,qg=l.p`
|
|
2057
2057
|
font-size: 13px;
|
|
2058
2058
|
color: var(--color-secondary-text);
|
|
2059
2059
|
line-height: 1.4;
|
|
2060
2060
|
max-width: 200px;
|
|
2061
|
-
`,
|
|
2061
|
+
`,Yg=l.div`
|
|
2062
2062
|
margin-bottom: 24px;
|
|
2063
|
-
`,
|
|
2063
|
+
`,Zg=l.h3`
|
|
2064
2064
|
font-size: 16px;
|
|
2065
2065
|
font-weight: 500;
|
|
2066
2066
|
color: var(--color-foreground);
|
|
2067
2067
|
margin-bottom: 6px;
|
|
2068
|
-
`,
|
|
2068
|
+
`,Kg=l.p`
|
|
2069
2069
|
font-size: 13px;
|
|
2070
2070
|
color: var(--color-secondary-text);
|
|
2071
2071
|
line-height: 1.4;
|
|
2072
|
-
`,
|
|
2072
|
+
`,Qg=l.div`
|
|
2073
2073
|
flex: 1;
|
|
2074
2074
|
`,_s=l.div`
|
|
2075
2075
|
margin-bottom: 20px;
|
|
@@ -2079,7 +2079,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2079
2079
|
font-size: 13px;
|
|
2080
2080
|
font-weight: 500;
|
|
2081
2081
|
color: var(--color-foreground);
|
|
2082
|
-
`,
|
|
2082
|
+
`,Xg=l.input`
|
|
2083
2083
|
width: 100%;
|
|
2084
2084
|
padding: 8px 12px;
|
|
2085
2085
|
border: 1px solid var(--color-border);
|
|
@@ -2099,7 +2099,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2099
2099
|
&::placeholder {
|
|
2100
2100
|
color: var(--color-muted);
|
|
2101
2101
|
}
|
|
2102
|
-
`,
|
|
2102
|
+
`,Jg=l.textarea`
|
|
2103
2103
|
width: 100%;
|
|
2104
2104
|
padding: 8px 12px;
|
|
2105
2105
|
border: 1px solid var(--color-border);
|
|
@@ -2122,13 +2122,13 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2122
2122
|
&::placeholder {
|
|
2123
2123
|
color: var(--color-muted);
|
|
2124
2124
|
}
|
|
2125
|
-
`,
|
|
2125
|
+
`,em=l.div`
|
|
2126
2126
|
display: flex;
|
|
2127
2127
|
justify-content: space-between;
|
|
2128
2128
|
align-items: center;
|
|
2129
2129
|
margin-top: auto;
|
|
2130
2130
|
padding-top: 24px;
|
|
2131
|
-
`,
|
|
2131
|
+
`,tm=l.button`
|
|
2132
2132
|
display: flex;
|
|
2133
2133
|
align-items: center;
|
|
2134
2134
|
gap: 6px;
|
|
@@ -2144,7 +2144,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2144
2144
|
&:hover {
|
|
2145
2145
|
color: var(--color-foreground);
|
|
2146
2146
|
}
|
|
2147
|
-
`,
|
|
2147
|
+
`,rm=l.button`
|
|
2148
2148
|
padding: 8px 20px;
|
|
2149
2149
|
border-radius: 6px;
|
|
2150
2150
|
font-size: 14px;
|
|
@@ -2165,9 +2165,9 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2165
2165
|
opacity: 0.5;
|
|
2166
2166
|
cursor: not-allowed;
|
|
2167
2167
|
}
|
|
2168
|
-
`,
|
|
2168
|
+
`,om=l.input`
|
|
2169
2169
|
display: none;
|
|
2170
|
-
`,
|
|
2170
|
+
`,nm=l.div`
|
|
2171
2171
|
position: absolute;
|
|
2172
2172
|
inset: 0;
|
|
2173
2173
|
background: var(--color-dialog-backdrop);
|
|
@@ -2181,11 +2181,11 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2181
2181
|
${al}:hover & {
|
|
2182
2182
|
opacity: 1;
|
|
2183
2183
|
}
|
|
2184
|
-
`,
|
|
2184
|
+
`,am=l.div`
|
|
2185
2185
|
color: white;
|
|
2186
2186
|
font-size: 12px;
|
|
2187
2187
|
font-weight: 500;
|
|
2188
|
-
`,en=({onSuccess:t,onCancel:r})=>{const[o,n]=i.useState(""),[a,s]=i.useState(""),[p,f]=i.useState(),[c,h]=i.useState(null),[d,u]=i.useState(!1),m=i.useRef(null),{createOrganization:v}=br(),{toast:x}=at(),w=b=>{n(b)},_=b=>{if(b.target.files&&b.target.files[0]){const g=b.target.files[0];if(g.size>2*1024*1024){x("File size cannot exceed 2MB","error");return}if(!g.type.startsWith("image/")){x("Please select a valid image file","error");return}c&&URL.revokeObjectURL(c),f(g),h(URL.createObjectURL(g))}},z=()=>{var b;(b=m.current)==null||b.click()},y=b=>b.split(" ").map(g=>g[0]).join("").toUpperCase().slice(0,2)||"O";i.useEffect(()=>()=>{c&&URL.revokeObjectURL(c)},[c]);const
|
|
2188
|
+
`,en=({onSuccess:t,onCancel:r})=>{const[o,n]=i.useState(""),[a,s]=i.useState(""),[p,f]=i.useState(),[c,h]=i.useState(null),[d,u]=i.useState(!1),m=i.useRef(null),{createOrganization:v}=br(),{toast:x}=at(),w=b=>{n(b)},_=b=>{if(b.target.files&&b.target.files[0]){const g=b.target.files[0];if(g.size>2*1024*1024){x("File size cannot exceed 2MB","error");return}if(!g.type.startsWith("image/")){x("Please select a valid image file","error");return}c&&URL.revokeObjectURL(c),f(g),h(URL.createObjectURL(g))}},z=()=>{var b;(b=m.current)==null||b.click()},y=b=>b.split(" ").map(g=>g[0]).join("").toUpperCase().slice(0,2)||"O";i.useEffect(()=>()=>{c&&URL.revokeObjectURL(c)},[c]);const P=b=>b.trim().replace(/[<>\"'&]/g,""),C=b=>b.length>=2&&b.length<=100&&/^[a-zA-Z0-9\s_.-]+$/.test(b),j=async()=>{const b=P(o),g=P(a);if(!b){x("Please enter an organization name","error");return}if(!C(b)){x("Organization name must be 2-100 characters and contain only letters, numbers, spaces, dots, underscores, and hyphens","error");return}if(g.length>500){x("Description must be less than 500 characters","error");return}u(!0);try{await v({name:b,description:g,image:p}),t==null||t()}catch(S){const k=S.message||"Failed to create organization. Please try again.";x(k,"error")}finally{u(!1)}};return e.jsx(ie,{children:e.jsxs(Bg,{children:[e.jsxs(Ug,{children:[e.jsxs(al,{hasImage:!!c,onClick:z,children:[c?e.jsx(Vg,{src:c,alt:"Organization logo"}):e.jsx(Gg,{children:y(o||"O")}),e.jsx(nm,{children:e.jsx(am,{children:"Upload Logo"})})]}),e.jsx(om,{type:"file",ref:m,onChange:_,accept:"image/png, image/jpeg, image/gif",disabled:d}),e.jsx(Hg,{children:"Create new organization"}),e.jsx(qg,{children:"Organizations help you manage all your team members for an org in one umbrella."})]}),e.jsxs(Wg,{children:[e.jsxs(Yg,{children:[e.jsx(Zg,{children:"Choose your organization name"}),e.jsx(Kg,{children:"This is the name of your company or team. You can always change it later."})]}),e.jsxs(Qg,{children:[e.jsxs(_s,{children:[e.jsx(Cs,{children:"Organization name"}),e.jsx(Xg,{type:"text",value:o,onChange:b=>w(b.target.value),placeholder:"Acme Inc.",disabled:d})]}),e.jsxs(_s,{children:[e.jsx(Cs,{children:"Description (optional)"}),e.jsx(Jg,{value:a,onChange:b=>s(b.target.value),placeholder:"What does your organization do?",disabled:d})]})]}),e.jsxs(em,{children:[r?e.jsxs(tm,{onClick:r,disabled:d,children:[e.jsx(Yo,{size:16}),"Back"]}):e.jsx("div",{}),e.jsx(rm,{onClick:j,disabled:d||!o.trim(),children:d?"Creating...":"Create"})]})]})]})})},sm=({isOpen:t,onClose:r,onCreated:o})=>{const n=()=>{o==null||o(),r==null||r()};return e.jsx(ie,{children:e.jsx(ye,{isOpen:t,onClose:r,children:e.jsx(ye.Overlay,{children:e.jsx(ye.Content,{style:{width:"900px",maxWidth:"90vw"},children:e.jsx(ye.Body,{style:{padding:0},children:e.jsx(en,{onSuccess:n,onCancel:r})})})})})})},im=l.div`
|
|
2189
2189
|
position: fixed;
|
|
2190
2190
|
width: 360px;
|
|
2191
2191
|
max-width: calc(100vw - 48px);
|
|
@@ -2218,7 +2218,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2218
2218
|
padding: var(--space-sm) var(--space-md);
|
|
2219
2219
|
border-top: 1px solid var(--color-border);
|
|
2220
2220
|
background: var(--color-background-alt);
|
|
2221
|
-
`,
|
|
2221
|
+
`,Ps=l.button`
|
|
2222
2222
|
background: none;
|
|
2223
2223
|
border: none;
|
|
2224
2224
|
padding: var(--space-xs);
|
|
@@ -2234,7 +2234,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2234
2234
|
color: var(--color-foreground);
|
|
2235
2235
|
background: var(--color-input-background);
|
|
2236
2236
|
}
|
|
2237
|
-
`,Rs=({onClose:t,domain:r,triggerRef:o})=>{const n=i.useRef(null),[a,s]=i.useState(),[p,f]=i.useState(""),[c,h]=i.useState(!1),[d,u]=i.useState(!1),[m,v]=i.useState({top:0,left:0}),{addDomain:x,verifyDomain:w}=Xe(),{toast:_}=at(),z=j=>/^[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(j),y=j=>j.trim().toLowerCase().replace(/^https?:\/\//,""),
|
|
2237
|
+
`,Rs=({onClose:t,domain:r,triggerRef:o})=>{const n=i.useRef(null),[a,s]=i.useState(),[p,f]=i.useState(""),[c,h]=i.useState(!1),[d,u]=i.useState(!1),[m,v]=i.useState({top:0,left:0}),{addDomain:x,verifyDomain:w}=Xe(),{toast:_}=at(),z=j=>/^[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(j),y=j=>j.trim().toLowerCase().replace(/^https?:\/\//,""),P=async()=>{var b,g;const j=y(p);if(!j){_("Please enter a domain name","error");return}if(!z(j)){_("Please enter a valid domain name (e.g., example.com)","error");return}if(j.length>253){_("Domain name is too long","error");return}try{const S=await x({fqdn:j});if((b=S==null?void 0:S.errors)!=null&&b.length){const k=((g=S.errors[0])==null?void 0:g.message)||S.errors[0]||"Failed to add domain";_(typeof k=="string"?k:"Failed to add domain","error");return}_("Domain added successfully","info"),s(S.data)}catch(S){const k=S.message||"Failed to add domain. Please try again.";_(k,"error")}},C=async()=>{if(!(!a||c)){h(!0);try{await w(a),t==null||t(),_("Domain verified successfully","info")}catch(j){const b=j.message||"Failed to verify domain. Please check DNS records and try again.";_(b,"error")}finally{h(!1)}}};return i.useEffect(()=>{u(!0);const j=setTimeout(()=>{if(!n.current||!(o!=null&&o.current))return;const S=o.current;if(S){const k=S.getBoundingClientRect(),E=360,R=250,$=8;let O=0,I=0;const T=window.innerHeight-k.bottom,N=k.top;T>=R+$?(O=k.bottom+$,I=k.right-E,I<$&&(I=k.left,I+E>window.innerWidth-$&&(I=(window.innerWidth-E)/2))):N>=R+$?(O=k.top-R-$,I=k.right-E,I<$&&(I=k.left,I+E>window.innerWidth-$&&(I=(window.innerWidth-E)/2))):(O=k.bottom+$,I=k.right-E,I<$&&(I=k.left)),v({top:O,left:I})}},10),b=S=>{n.current&&!n.current.contains(S.target)&&(t==null||t())},g=S=>{S.key==="Escape"&&(t==null||t())};return document.addEventListener("mousedown",b),document.addEventListener("keydown",g),()=>{clearTimeout(j),document.removeEventListener("mousedown",b),document.removeEventListener("keydown",g)}},[t,o]),i.useEffect(()=>{r&&s(r)},[r]),d?e.jsx(im,{ref:n,style:{top:`${m.top}px`,left:`${m.left}px`,visibility:m.top>0?"visible":"hidden"},onClick:j=>j.stopPropagation(),role:"dialog","aria-labelledby":"add-domain-title","aria-modal":"true",children:a?e.jsxs(e.Fragment,{children:[e.jsxs(Ss,{children:[e.jsx($s,{id:"verify-domain-title",children:"Verify Domain"}),e.jsx(Ps,{onClick:t,"aria-label":"Close domain verification dialog",children:e.jsx(Qe,{size:16})})]}),e.jsxs(zs,{children:[e.jsx("div",{style:{marginBottom:"var(--space-md)"},children:e.jsx("p",{style:{fontSize:"var(--font-xs)",color:"var(--color-muted)",margin:0},children:"Add the following DNS record to your domain"})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:[e.jsxs(fe,{children:[e.jsx(he,{children:"Record Type"}),e.jsx(le,{value:a==null?void 0:a.verification_dns_record_type,disabled:!0})]}),e.jsxs(fe,{children:[e.jsx(he,{children:"Record Name"}),e.jsx(le,{value:a==null?void 0:a.verification_dns_record_name,disabled:!0})]}),e.jsxs(fe,{children:[e.jsx(he,{children:"Record Data"}),e.jsx(le,{type:"text",value:a==null?void 0:a.verification_dns_record_data,disabled:!0})]})]})]}),e.jsxs(Es,{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(Pe,{size:14})," Verifying..."]}):"Verify Domain"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Ss,{children:[e.jsx($s,{id:"add-domain-title",children:"Add Domain"}),e.jsx(Ps,{onClick:t,"aria-label":"Close add domain dialog",children:e.jsx(Qe,{size:16})})]}),e.jsx(zs,{children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:e.jsxs(fe,{children:[e.jsx(he,{children:"Enter FQDN"}),e.jsx(le,{type:"text",placeholder:"Enter your domain",value:p,onChange:j=>f(j.target.value),autoFocus:!0,"aria-label":"Domain name (FQDN)","aria-describedby":"domain-help"})]})})}),e.jsxs(Es,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto"},children:"Cancel"}),e.jsx(X,{onClick:P,disabled:!p||c,style:{width:"auto"},children:c?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{size:14})," Adding..."]}):"Continue"})]})]})}):null},cm=l.div`
|
|
2238
2238
|
position: fixed;
|
|
2239
2239
|
width: 360px;
|
|
2240
2240
|
max-width: calc(100vw - 48px);
|
|
@@ -2247,27 +2247,27 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2247
2247
|
@media (max-width: 600px) {
|
|
2248
2248
|
width: calc(100vw - 48px);
|
|
2249
2249
|
}
|
|
2250
|
-
`,
|
|
2250
|
+
`,lm=l.div`
|
|
2251
2251
|
display: flex;
|
|
2252
2252
|
justify-content: space-between;
|
|
2253
2253
|
align-items: center;
|
|
2254
2254
|
padding: var(--space-sm) var(--space-md);
|
|
2255
2255
|
border-bottom: 1px solid var(--color-border);
|
|
2256
|
-
`,
|
|
2256
|
+
`,dm=l.h3`
|
|
2257
2257
|
margin: 0;
|
|
2258
2258
|
font-size: var(--font-xs);
|
|
2259
2259
|
font-weight: 500;
|
|
2260
2260
|
color: var(--color-foreground);
|
|
2261
|
-
`,dm=l.div`
|
|
2262
|
-
padding: var(--space-md);
|
|
2263
2261
|
`,um=l.div`
|
|
2262
|
+
padding: var(--space-md);
|
|
2263
|
+
`,pm=l.div`
|
|
2264
2264
|
display: flex;
|
|
2265
2265
|
gap: var(--space-xs);
|
|
2266
2266
|
justify-content: flex-end;
|
|
2267
2267
|
padding: var(--space-sm) var(--space-md);
|
|
2268
2268
|
border-top: 1px solid var(--color-border);
|
|
2269
2269
|
background: var(--color-background-alt);
|
|
2270
|
-
`,
|
|
2270
|
+
`,hm=l.button`
|
|
2271
2271
|
background: none;
|
|
2272
2272
|
border: none;
|
|
2273
2273
|
padding: var(--space-xs);
|
|
@@ -2283,7 +2283,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2283
2283
|
color: var(--color-foreground);
|
|
2284
2284
|
background: var(--color-input-background);
|
|
2285
2285
|
}
|
|
2286
|
-
`,sl=({onClose:t,onSuccess:r,roles:o,triggerRef:n})=>{const a=i.useRef(null),[s,p]=i.useState(""),[f,c]=i.useState(null),[h,d]=i.useState(!1),[u,m]=i.useState(!1),[v,x]=i.useState({top:0,left:0}),{inviteMember:w}=Xe(),{toast:_}=at(),z=o.map(C=>({value:C.id,label:C.name})),y=C=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(C),
|
|
2286
|
+
`,sl=({onClose:t,onSuccess:r,roles:o,triggerRef:n})=>{const a=i.useRef(null),[s,p]=i.useState(""),[f,c]=i.useState(null),[h,d]=i.useState(!1),[u,m]=i.useState(!1),[v,x]=i.useState({top:0,left:0}),{inviteMember:w}=Xe(),{toast:_}=at(),z=o.map(C=>({value:C.id,label:C.name})),y=C=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(C),P=async()=>{const C=s.trim().toLowerCase();if(!(!C||!f)){if(!y(C)){_("Please enter a valid email address","error");return}if(C.length>320){_("Email address is too long","error");return}d(!0);try{await w({email:C,organizationRole:f}),r==null||r()}catch(j){const b=j.message||"Failed to send invitation. Please try again.";_(b,"error")}finally{d(!1)}}};return i.useEffect(()=>{m(!0);const C=setTimeout(()=>{if(!a.current||!(n!=null&&n.current))return;const g=n.current;if(g){const S=g.getBoundingClientRect(),k=360,E=250,R=8;let $=0,O=0;const I=window.innerHeight-S.bottom,T=S.top;I>=E+R?($=S.bottom+R,O=S.right-k,O<R&&(O=S.left,O+k>window.innerWidth-R&&(O=(window.innerWidth-k)/2))):T>=E+R?($=S.top-E-R,O=S.right-k,O<R&&(O=S.left,O+k>window.innerWidth-R&&(O=(window.innerWidth-k)/2))):($=S.bottom+R,O=S.right-k,O<R&&(O=S.left)),x({top:$,left:O})}},10),j=g=>{a.current&&!a.current.contains(g.target)&&(t==null||t())},b=g=>{g.key==="Escape"&&(t==null||t())};return document.addEventListener("mousedown",j),document.addEventListener("keydown",b),()=>{clearTimeout(C),document.removeEventListener("mousedown",j),document.removeEventListener("keydown",b)}},[t,n]),u?e.jsxs(cm,{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-member-title","aria-modal":"true",children:[e.jsxs(lm,{children:[e.jsx(dm,{id:"invite-member-title",children:"Invite Member"}),e.jsx(hm,{onClick:t,"aria-label":"Close invite member dialog",children:e.jsx(Qe,{size:16})})]}),e.jsx(um,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:[e.jsxs(fe,{children:[e.jsx(he,{children:"Email Address"}),e.jsx(le,{type:"email",placeholder:"colleague@company.com",value:s,onChange:C=>p(C.target.value),autoFocus:!0,"aria-label":"Email address for invitation","aria-describedby":"email-help"})]}),e.jsxs(fe,{children:[e.jsx(he,{children:"Role"}),e.jsx(ba,{options:z,value:f==null?void 0:f.id,onChange:C=>c(o.find(j=>j.id===C)),placeholder:"Select a role","aria-label":"Select role for invited member"})]})]})}),e.jsxs(pm,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto"},children:"Cancel"}),e.jsx(X,{onClick:P,disabled:!s||!f||h,style:{width:"auto"},children:h?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{size:14})," Sending..."]}):"Send Invitation"})]})]}):null},fm=l.div`
|
|
2287
2287
|
position: fixed;
|
|
2288
2288
|
width: 400px;
|
|
2289
2289
|
max-width: calc(100vw - 48px);
|
|
@@ -2298,27 +2298,27 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2298
2298
|
@media (max-width: 600px) {
|
|
2299
2299
|
width: calc(100vw - 48px);
|
|
2300
2300
|
}
|
|
2301
|
-
`,
|
|
2301
|
+
`,gm=l.div`
|
|
2302
2302
|
display: flex;
|
|
2303
2303
|
justify-content: space-between;
|
|
2304
2304
|
align-items: center;
|
|
2305
2305
|
padding: var(--space-sm) var(--space-md);
|
|
2306
2306
|
border-bottom: 1px solid var(--color-border);
|
|
2307
|
-
`,
|
|
2307
|
+
`,mm=l.h3`
|
|
2308
2308
|
margin: 0;
|
|
2309
2309
|
font-size: var(--font-xs);
|
|
2310
2310
|
font-weight: 500;
|
|
2311
2311
|
color: var(--color-foreground);
|
|
2312
|
-
`,mm=l.div`
|
|
2313
|
-
padding: var(--space-md);
|
|
2314
2312
|
`,xm=l.div`
|
|
2313
|
+
padding: var(--space-md);
|
|
2314
|
+
`,vm=l.div`
|
|
2315
2315
|
display: flex;
|
|
2316
2316
|
gap: var(--space-xs);
|
|
2317
2317
|
justify-content: flex-end;
|
|
2318
2318
|
padding: var(--space-sm) var(--space-md);
|
|
2319
2319
|
border-top: 1px solid var(--color-border);
|
|
2320
2320
|
background: var(--color-background-alt);
|
|
2321
|
-
`,
|
|
2321
|
+
`,bm=l.button`
|
|
2322
2322
|
background: none;
|
|
2323
2323
|
border: none;
|
|
2324
2324
|
padding: var(--space-xs);
|
|
@@ -2334,7 +2334,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2334
2334
|
color: var(--color-foreground);
|
|
2335
2335
|
background: var(--color-input-background);
|
|
2336
2336
|
}
|
|
2337
|
-
`,
|
|
2337
|
+
`,Is=({onClose:t,onSuccess:r,role:o,triggerRef:n})=>{var b;const a=i.useRef(null),[s,p]=i.useState((o==null?void 0:o.name)||""),[f,c]=i.useState((o==null?void 0:o.permissions)||[]);Xe();const[h,d]=i.useState(!1),[u,m]=i.useState(!1),[v,x]=i.useState({top:0,left:0}),{deployment:w}=ve(),{toast:_}=at(),z=!!o,y=Array.isArray((b=w==null?void 0:w.b2b_settings)==null?void 0:b.organization_permissions)?w.b2b_settings.organization_permissions.map(g=>({value:g,label:g})):[];i.useEffect(()=>{m(!0);const g=setTimeout(()=>{if(!a.current)return;let R=null;if(n!=null&&n.current)R=n.current;else if(z){const $=document.querySelectorAll("[data-role-dropdown-trigger]");for(let O=0;O<$.length;O++){const I=$[O];if(I.offsetParent!==null){R=I;break}}}else{const $=document.querySelectorAll("button");for(let O=0;O<$.length;O++){const I=$[O];if(I.textContent==="Add role"&&I.offsetParent!==null){R=I;break}}}if(R){const $=R.getBoundingClientRect(),O=400;let I=$.bottom+8,T=$.right-O;T<10&&(T=$.left),I+300>window.innerHeight&&(I=$.top-300-8),x({top:I,left:T})}},10),S=R=>{a.current&&!a.current.contains(R.target)&&(t==null||t())},k=R=>{R.key==="Escape"&&(t==null||t())},E=setTimeout(()=>{document.addEventListener("mousedown",S),document.addEventListener("keydown",k)},100);return()=>{clearTimeout(g),clearTimeout(E),document.removeEventListener("mousedown",S),document.removeEventListener("keydown",k)}},[t,z,n]);const P=g=>g.trim().replace(/[<>\"'&]/g,""),C=g=>g.length>=2&&g.length<=50&&/^[a-zA-Z0-9\s_-]+$/.test(g),j=async()=>{const g=P(s);if(!g){_("Please enter a role name","error");return}if(!C(g)){_("Role name must be 2-50 characters and contain only letters, numbers, spaces, underscores, and hyphens","error");return}if(f.length===0){_("Please select at least one permission","error");return}d(!0);try{const S={id:o==null?void 0:o.id,name:g,permissions:f||[]};r==null||r(S)}catch(S){const k=S.message||`Failed to ${z?"update":"create"} role. Please try again.`;_(k,"error")}finally{d(!1)}};return u?e.jsxs(fm,{ref:a,$isInTable:z,style:{top:`${v.top}px`,left:`${v.left}px`,visibility:v.top>0?"visible":"hidden"},onClick:g=>g.stopPropagation(),role:"dialog","aria-labelledby":"role-dialog-title","aria-modal":"true",children:[e.jsxs(gm,{children:[e.jsx(mm,{id:"role-dialog-title",children:z?"Edit Role":"Create New Role"}),e.jsx(bm,{onClick:t,"aria-label":`Close ${z?"edit":"create"} role dialog`,children:e.jsx(Qe,{size:16})})]}),e.jsx(xm,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:[e.jsxs(fe,{children:[e.jsx(he,{children:"Role Name"}),e.jsx(le,{type:"text",placeholder:"e.g. Admin, Editor, Viewer",value:s,onChange:g=>p(g.target.value),autoFocus:!0,"aria-label":"Role name","aria-describedby":"role-name-help"})]}),e.jsxs(fe,{children:[e.jsx(he,{children:"Permissions"}),e.jsx(Kc,{options:y,value:f,onChange:c,placeholder:"Select permissions","aria-label":"Select permissions for role"})]})]})}),e.jsxs(vm,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto"},children:"Cancel"}),e.jsx(X,{onClick:j,disabled:!s||h,style:{width:"auto"},children:h?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{size:14})," ",z?"Updating...":"Creating..."]}):z?"Update Role":"Create Role"})]})]}):null},yt=l.table`
|
|
2338
2338
|
width: 100%;
|
|
2339
2339
|
border-collapse: separate;
|
|
2340
2340
|
border-spacing: 0;
|
|
@@ -2392,7 +2392,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2392
2392
|
white-space: nowrap;
|
|
2393
2393
|
position: relative;
|
|
2394
2394
|
overflow: visible;
|
|
2395
|
-
`,
|
|
2395
|
+
`,ym=l.div`
|
|
2396
2396
|
display: flex;
|
|
2397
2397
|
flex-direction: column;
|
|
2398
2398
|
align-items: center;
|
|
@@ -2404,18 +2404,18 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2404
2404
|
border: 1px dashed var(--color-border);
|
|
2405
2405
|
height: 100%;
|
|
2406
2406
|
width: 100%;
|
|
2407
|
-
`,
|
|
2407
|
+
`,wm=l.h3`
|
|
2408
2408
|
font-size: 16px;
|
|
2409
2409
|
font-weight: 400;
|
|
2410
2410
|
color: var(--color-foreground);
|
|
2411
2411
|
margin: 0 0 8px 0;
|
|
2412
|
-
`,
|
|
2412
|
+
`,jm=l.p`
|
|
2413
2413
|
font-size: 14px;
|
|
2414
2414
|
color: var(--color-muted);
|
|
2415
2415
|
margin: 0;
|
|
2416
2416
|
max-width: 380px;
|
|
2417
2417
|
line-height: 1.5;
|
|
2418
|
-
`,st=({title:t,description:r,action:o})=>e.jsxs(
|
|
2418
|
+
`,st=({title:t,description:r,action:o})=>e.jsxs(ym,{children:[e.jsx(wm,{children:t}),e.jsx(jm,{children:r}),o&&e.jsx("div",{style:{marginTop:"24px"},children:o})]}),km=l.div`
|
|
2419
2419
|
text-align: left;
|
|
2420
2420
|
position: fixed;
|
|
2421
2421
|
background: var(--color-background);
|
|
@@ -2425,17 +2425,17 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2425
2425
|
padding: 16px;
|
|
2426
2426
|
width: 320px;
|
|
2427
2427
|
z-index: 1000;
|
|
2428
|
-
`,
|
|
2428
|
+
`,_m=l.div`
|
|
2429
2429
|
font-size: 14px;
|
|
2430
2430
|
font-weight: 400;
|
|
2431
2431
|
color: var(--color-foreground);
|
|
2432
2432
|
margin-bottom: 16px;
|
|
2433
2433
|
line-height: 1.4;
|
|
2434
|
-
`,
|
|
2434
|
+
`,Cm=l.div`
|
|
2435
2435
|
display: flex;
|
|
2436
2436
|
gap: 8px;
|
|
2437
2437
|
justify-content: flex-end;
|
|
2438
|
-
`,ya=({title:t,onConfirm:r,onCancel:o})=>{const n=i.useRef(null),[a,s]=i.useState({top:0,left:0});return i.useEffect(()=>{var p;if(n.current){const f=(p=n.current.parentElement)==null?void 0:p.getBoundingClientRect();f&&s({top:f.bottom+8,left:f.right-320})}},[]),i.useEffect(()=>{const p=f=>{n.current&&!n.current.contains(f.target)&&o()};return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[o]),e.jsxs(
|
|
2438
|
+
`,ya=({title:t,onConfirm:r,onCancel:o})=>{const n=i.useRef(null),[a,s]=i.useState({top:0,left:0});return i.useEffect(()=>{var p;if(n.current){const f=(p=n.current.parentElement)==null?void 0:p.getBoundingClientRect();f&&s({top:f.bottom+8,left:f.right-320})}},[]),i.useEffect(()=>{const p=f=>{n.current&&!n.current.contains(f.target)&&o()};return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[o]),e.jsxs(km,{ref:n,style:{top:`${a.top}px`,left:`${a.left}px`},children:[e.jsx(_m,{children:t}),e.jsxs(Cm,{children:[e.jsx(X,{onClick:o,style:{fontSize:"14px",padding:"6px 16px",background:"transparent",border:"1px solid var(--color-border)",color:"var(--color-foreground)"},children:"Cancel"}),e.jsx(X,{onClick:r,style:{fontSize:"14px",padding:"6px 16px",background:"var(--color-error)",border:"1px solid var(--color-error)",color:"white"},children:"Confirm"})]})]})},Ts=l.div`
|
|
2439
2439
|
* {
|
|
2440
2440
|
box-sizing: border-box;
|
|
2441
2441
|
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
@@ -2474,14 +2474,14 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2474
2474
|
pointer-events: none;
|
|
2475
2475
|
z-index: 1;
|
|
2476
2476
|
}
|
|
2477
|
-
`,
|
|
2477
|
+
`,Sm=l.div`
|
|
2478
2478
|
padding: 0 24px;
|
|
2479
2479
|
border-bottom: 1px solid var(--color-border);
|
|
2480
2480
|
|
|
2481
2481
|
@media (max-width: 768px) {
|
|
2482
2482
|
padding: 0 20px;
|
|
2483
2483
|
}
|
|
2484
|
-
|
|
2484
|
+
`,$m=l.div`
|
|
2485
2485
|
display: flex;
|
|
2486
2486
|
gap: 20px;
|
|
2487
2487
|
overflow-x: auto;
|
|
@@ -2518,11 +2518,11 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2518
2518
|
opacity: ${t=>t.$isActive?1:0};
|
|
2519
2519
|
transition: opacity 0.15s ease;
|
|
2520
2520
|
}
|
|
2521
|
-
`,
|
|
2521
|
+
`,Ir=l.span`
|
|
2522
2522
|
display: inline-flex;
|
|
2523
2523
|
align-items: center;
|
|
2524
2524
|
gap: 6px;
|
|
2525
|
-
|
|
2525
|
+
`,zm=l.div`
|
|
2526
2526
|
flex: 1;
|
|
2527
2527
|
padding: 24px 24px 0 24px;
|
|
2528
2528
|
overflow-y: auto;
|
|
@@ -2537,9 +2537,9 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2537
2537
|
flex-wrap: wrap;
|
|
2538
2538
|
gap: 12px;
|
|
2539
2539
|
margin-bottom: 24px;
|
|
2540
|
-
`,
|
|
2541
|
-
`))||"",ip_restrictions:t.enable_ip_restriction||!1,mfa_required:t.enforce_mfa||!1,default_workspace_id:t.auto_assigned_workspace_id||""}))},[t]);const R=i.useMemo(()=>a.filter(B=>B.organization.id===(t==null?void 0:t.id)),[a,t==null?void 0:t.id]),$=async()=>{if(!(!t||C!==t.name))try{g(!0),await o(""),await p(t),await n(),c("Organization deleted successfully","info")}catch{c("Failed to delete organization","error")}finally{g(!1),j("")}};if(i.useEffect(()=>()=>{v&&URL.revokeObjectURL(v)},[v]),r)return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(
|
|
2542
|
-
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=s==null?void 0:s.b2b_settings)==null?void 0:N.workspaces_enabled)&&R.length>0&&e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"default_workspace",children:"Default Workspace"}),e.jsx(ba,{options:R.map(D=>({value:D.id,label:D.name})),value:y.default_workspace_id,onChange:D=>{
|
|
2540
|
+
`,Em=()=>{var T,N,L;const{activeOrganization:t,loading:r}=Xe(),{switchOrganization:o,refetch:n}=Ue(),{workspaces:a}=vt(),{deployment:s}=ve(),{deleteOrganization:p,updateOrganization:f}=br(),{toast:c}=at(),[h,d]=i.useState((t==null?void 0:t.name)||""),[u,m]=i.useState((t==null?void 0:t.description)||""),[v,x]=i.useState((t==null?void 0:t.image_url)||null),w=i.useRef(null),[_,z]=i.useState(!1),[y,P]=i.useState({mfa_required:!1,ip_restrictions:!1,allowed_ips:"",default_workspace_id:""}),[C,j]=i.useState(""),[b,g]=i.useState(!1),[S,k]=i.useState(!1),E=i.useCallback(async()=>{if(!(!t||_))try{z(!0),await f(t,{name:h,description:u}),c("Changes saved","info")}catch(D){const B=D.message||"Failed to save changes. Please try again.";c(B,"error")}finally{z(!1)}},[t,h,u,v,y,f,c]);i.useEffect(()=>{var D;t&&(d(t.name||""),m(t.description||""),x(t.image_url||null),P({allowed_ips:((D=t.whitelisted_ips)==null?void 0:D.join(`
|
|
2541
|
+
`))||"",ip_restrictions:t.enable_ip_restriction||!1,mfa_required:t.enforce_mfa||!1,default_workspace_id:t.auto_assigned_workspace_id||""}))},[t]);const R=i.useMemo(()=>a.filter(B=>B.organization.id===(t==null?void 0:t.id)),[a,t==null?void 0:t.id]),$=async()=>{if(!(!t||C!==t.name))try{g(!0),await o(""),await p(t),await n(),c("Organization deleted successfully","info")}catch{c("Failed to delete organization","error")}finally{g(!1),j("")}};if(i.useEffect(()=>()=>{v&&URL.revokeObjectURL(v)},[v]),r)return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Pe,{})});const O=D=>{var B;if((B=D.target.files)!=null&&B[0]){const oe=D.target.files[0];if(oe.size>2*1024*1024){c("File size cannot exceed 2MB","error");return}if(!oe.type.startsWith("image/")){c("Please select a valid image file","error");return}v&&URL.revokeObjectURL(v),x(URL.createObjectURL(oe)),setTimeout(()=>E(),100)}},I=()=>{w.current&&w.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:v?"transparent":"var(--color-input-background)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"all 0.2s ease"},onClick:I,onMouseEnter:D=>{D.currentTarget.style.borderColor="var(--color-primary)",D.currentTarget.style.transform="scale(1.02)"},onMouseLeave:D=>{D.currentTarget.style.borderColor="var(--color-border)",D.currentTarget.style.transform="scale(1)"},children:[v?e.jsx("img",{src:v,alt:"Organization Logo",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}):e.jsx(Dr,{size:32,color:"var(--color-muted)"}),e.jsx("input",{type:"file",ref:w,style:{display:"none"},accept:"image/*",onChange:O,"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 D;return(D=w.current)==null?void 0:D.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(Dr,{size:14}),v?"Change":"Upload"]}),e.jsxs(X,{onClick:()=>{x(null),w.current&&(w.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(Xo,{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(fe,{children:[e.jsx(he,{htmlFor:"name",children:"Organization Name"}),e.jsx(le,{id:"name",type:"text",value:h,onChange:D=>d(D.target.value),onBlur:E,placeholder:"Enter organization name",required:!0})]}),e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"description",children:"Description"}),e.jsx(le,{id:"description",as:"textarea",value:u,onChange:D=>m(D.target.value),onBlur:E,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"})]}),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(Lo,{checked:y.mfa_required,onChange:()=>{P(D=>({...D,mfa_required:!D.mfa_required})),setTimeout(()=>E(),100)}})]}),((T=s==null?void 0:s.b2b_settings)==null?void 0:T.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(Lo,{checked:y.ip_restrictions,onChange:()=>{P(D=>({...D,ip_restrictions:!D.ip_restrictions})),setTimeout(()=>E(),100)},"aria-label":"Enable IP address restrictions","aria-describedby":"ip-restrictions-description"})]}),y.ip_restrictions&&e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"allowed_ips",children:"Allowed IP Addresses"}),e.jsx(le,{id:"allowed_ips",as:"textarea",value:y.allowed_ips,onChange:D=>P(B=>({...B,allowed_ips:D.target.value})),onBlur:E,placeholder:`192.168.1.1
|
|
2542
|
+
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=s==null?void 0:s.b2b_settings)==null?void 0:N.workspaces_enabled)&&R.length>0&&e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"default_workspace",children:"Default Workspace"}),e.jsx(ba,{options:R.map(D=>({value:D.id,label:D.name})),value:y.default_workspace_id,onChange:D=>{P(B=>({...B,default_workspace_id:D})),setTimeout(()=>E(),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"})]})]})]}),((L=s==null?void 0:s.b2b_settings)==null?void 0:L.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:S?"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:()=>{S?(k(!1),j("")):k(!0)},style:{background:"var(--color-error)",color:"white",border:"none",padding:"6px 12px",fontSize:"13px",height:"32px",width:"auto"},children:S?"Cancel":"Delete"})]}),S&&e.jsxs("div",{children:[e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"confirm_name",children:"Confirm by typing the organization name"}),e.jsx(le,{id:"confirm_name",type:"text",value:C,onChange:D=>j(D.target.value),placeholder:`Type "${t==null?void 0:t.name}" to confirm`})]}),e.jsx(X,{onClick:$,disabled:C!==(t==null?void 0:t.name)||b,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:b?e.jsx(Pe,{size:12}):"Delete Forever"})]})]})]})]})]})})},Os=l.span`
|
|
2543
2543
|
background: var(--color-primary-background);
|
|
2544
2544
|
color: var(--color-primary);
|
|
2545
2545
|
padding: 4px 8px;
|
|
@@ -2576,7 +2576,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2576
2576
|
opacity: 0.5;
|
|
2577
2577
|
cursor: not-allowed;
|
|
2578
2578
|
}
|
|
2579
|
-
`,
|
|
2579
|
+
`,Pm=()=>{const{activeOrganization:t,loading:r,getDomains:o,removeDomain:n}=Xe(),a=i.useRef(null),[s,p]=i.useState(null),{data:f=[],isLoading:c,mutate:h}=We(t!=null&&t.id?`/domains/${t.id}`:null,async()=>(await(o==null?void 0:o())||[]).map((S,k)=>({...S,verified:S.verified!==void 0?S.verified:k%2===0})),{refreshInterval:3e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,dedupingInterval:5e3}),d=f,[u,m]=i.useState(!1),[v,x]=i.useState(null),[w,_]=i.useState(""),[z,y]=i.useState(null),P=i.useRef(null),C=i.useMemo(()=>{let g=d;if(w.trim()!==""){const S=w.toLowerCase();g=g.filter(k=>k.fqdn.toLowerCase().includes(S))}return g},[d,w]),j=async g=>{await n(g),h()},b=async g=>{x(g)};return r||c?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Pe,{})}):e.jsxs(e.Fragment,{children:[e.jsxs(cl,{children:[e.jsx(bt,{value:w,onChange:_,placeholder:"Search Domain"}),e.jsxs("div",{children:[e.jsx(X,{ref:P,onClick:()=>m(!u),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"New Domain"}),u&&e.jsx(Rs,{onClose:()=>{m(!1),h()},triggerRef:P})]})]}),C!=null&&C.length?e.jsxs(yt,{ref:a,children:[e.jsx(wt,{children:e.jsxs(Be,{children:[e.jsx(_e,{children:"Domain"}),e.jsx(_e,{children:"Status"}),e.jsx(_e,{children:"Date Added"}),e.jsx(_e,{})]})}),e.jsx(jt,{children:C.map(g=>e.jsxs(Be,{children:[e.jsx(Oe,{children:g.fqdn}),e.jsx(Oe,{children:g.verified?e.jsx(Os,{style:{background:"var(--color-primary-background)",color:"var(--color-primary)"},children:"✓ Verified"}):e.jsxs(Os,{style:{background:"var(--color-warning-background)",color:"var(--color-warning)",border:"1px solid var(--color-warning-border)"},children:[e.jsx(Pt,{size:9})," Pending Verification"]})}),e.jsx(Oe,{children:new Date(g.created_at).toLocaleDateString()}),e.jsx(kt,{children:e.jsxs("div",{style:{position:"relative"},children:[e.jsxs(rt,{style:{marginLeft:"auto"},open:z===g.id,openChange:S=>y(S?g.id:null),children:[e.jsx(nt,{children:e.jsx(wa,{children:"•••"})}),e.jsxs(ot,{children:[!g.verified&&e.jsx(Ee,{onClick:()=>{b(g.id),y(null)},children:e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:"✓ Verify Domain"})}),e.jsx(Ee,{onClick:()=>{y(null),navigator.clipboard.writeText(g.fqdn)},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Lc,{size:16,color:"var(--color-muted)"})," Copy Domain"]})}),e.jsx(Ee,{onClick:()=>{window.open(`https://${g.fqdn}`,"_blank"),y(null)},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Ac,{size:16,color:"var(--color-muted)"})," ","Visit Domain"]})}),e.jsx(Jo,{}),e.jsx(Ee,{$destructive:!0,onClick:()=>{y(null),p(g.id)},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Xo,{size:16,color:"var(--color-error)"})," ","Remove Domain"]})})]})]}),s===g.id&&e.jsx(ya,{title:"Are you sure you want to delete this domain?",onConfirm:()=>j(g),onCancel:()=>p(null)}),v===g.id&&e.jsx(Rs,{domain:g,onClose:()=>x(null)})]})})]},g.id))})]}):e.jsx(st,{title:w!=="all"?"No domains match your criteria":"No domains added",description:"Add a domain to get started"})]})},Rm=l.div`
|
|
2580
2580
|
width: 40px;
|
|
2581
2581
|
height: 40px;
|
|
2582
2582
|
border-radius: 50%;
|
|
@@ -2588,7 +2588,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2588
2588
|
font-weight: 500;
|
|
2589
2589
|
font-size: 14px;
|
|
2590
2590
|
overflow: hidden;
|
|
2591
|
-
`,Rm=()=>{const{activeOrganization:t,loading:r,getMembers:o,getRoles:n,addMemberRole:a,removeMemberRole:s,removeMember:p}=Xe(),{session:f}=Ue(),{toast:c}=at(),[h,d]=i.useState(""),[u,m]=i.useState(!1),v=i.useRef(null),{data:x=[],isLoading:w,mutate:_}=We(t?`/api/organizations/${t.id}/members`:null,()=>(o==null?void 0:o())||[]),{data:z=[],isLoading:y}=We(t?`/api/organizations/${t.id}/roles`:null,()=>(n==null?void 0:n())||[]),I=z,C=i.useMemo(()=>h?x.filter(k=>{var T;const E=k.user;if(!E)return!1;const R=E.first_name||"",$=E.last_name||"",O=((T=E.primary_email_address)==null?void 0:T.email)||"";return`${R} ${$}`.trim().toLowerCase().includes(h.toLowerCase())||O.toLowerCase().includes(h.toLowerCase())}):x,[x,h]),j=async(k,E,R)=>{try{R?(await s(k,E),c("Role removed successfully","info")):(await a(k,E),c("Role added successfully","info")),_()}catch($){const O=$.message||"Failed to update role. Please try again.";c(O,"error")}},b=(k="",E="")=>`${k[0]||""}${E[0]||""}`.toUpperCase(),g=(k,E)=>{var R;return((R=k.roles)==null?void 0:R.some($=>$.id===E))||!1},S=()=>{m(!1),_(),c("Invitation sent successfully","info")};return r||w||y?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ie,{})}):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(bt,{value:h,onChange:d,placeholder:"Search members..."})}),e.jsx(X,{ref:v,onClick:()=>m(!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(sl,{onClose:()=>m(!1),onSuccess:S,roles:I,triggerRef:v}),C.length===0?e.jsx(st,{title:h?"No members match your search":"No members yet",description:"Invite members to your organization to get started."}):e.jsxs(yt,{children:[e.jsx(wt,{children:e.jsxs(Be,{children:[e.jsx(_e,{children:"Member"}),e.jsx(_e,{children:"Joined"}),e.jsx(_e,{children:"Roles"})]})}),e.jsx(jt,{children:C.map(k=>{var O,P;const E=k.roles||[],R=k.user,$=(R==null?void 0:R.id)===((O=f==null?void 0:f.active_signin)==null?void 0:O.user_id);return e.jsxs(Be,{children:[e.jsx(il,{children:e.jsxs("div",{children:[e.jsx(Im,{children:R!=null&&R.profile_picture_url?e.jsx("img",{src:R.profile_picture_url,alt:`${R.first_name||""} ${R.last_name||""}`,style:{width:"100%",height:"100%",objectFit:"cover"}}):b(R==null?void 0:R.first_name,R==null?void 0:R.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 N;if(!R)return"Unknown User";const T=`${R.first_name||""} ${R.last_name||""}`.trim();return T||((N=R.primary_email_address)==null?void 0:N.email)||"Unknown User"})()}),$&&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:(P=R==null?void 0:R.primary_email_address)==null?void 0:P.email})]})]})}),e.jsx(Oe,{children:new Date(k.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),e.jsx(kt,{children:e.jsx("div",{style:{position:"relative"},children:e.jsxs(rt,{children:[e.jsx(nt,{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:E.length>0?E[0].name:"No role"}),e.jsx(Xt,{size:14})]})}),e.jsxs(ot,{children:[I.map(T=>{const N=g(k,T.id);return e.jsx(Ee,{onClick:()=>j(k,T,N),children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[e.jsx("span",{children:T.name}),N&&e.jsx(tt,{size:16,color:"var(--color-success)"})]})},T.id)}),e.jsx(Jo,{}),e.jsx(Ee,{$destructive:!0,onClick:()=>p(k),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Xo,{size:16,color:"var(--color-error)"}),e.jsx("span",{children:"Remove Member"})]})})]})]})})})]},k.id)})})]})]})},Pm=()=>{const{activeOrganization:t,loading:r,getInvitations:o,getRoles:n,discardInvitation:a,resendInvitation:s}=Xe(),{toast:p}=at(),[f,c]=i.useState(!1),[h,d]=i.useState(""),u=i.useRef(null),{data:m=[],isLoading:v,mutate:x}=We(t?`/api/organizations/${t.id}/invitations`:null,()=>(o==null?void 0:o())||[]),{data:w=[],isLoading:_}=We(t?`/api/organizations/${t.id}/roles`:null,()=>(n==null?void 0:n())||[]),z=w,y=i.useMemo(()=>h?m.filter(b=>b.email.toLowerCase().includes(h.toLowerCase())):m,[m,h]),I=()=>{p("Invitation sent successfully","info"),x(),c(!1)},C=async b=>{try{await a(b),x(),p("Invitation cancelled successfully","info")}catch(g){const S=g.message||"Failed to cancel invitation. Please try again.";p(S,"error")}},j=async b=>{try{await s(b),p("Invitation resent successfully","info")}catch(g){const S=g.message||"Failed to resend invitation. Please try again.";p(S,"error")}};return r||v||_?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ie,{})}):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(bt,{value:h,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(sl,{onClose:()=>c(!1),onSuccess:I,roles:z,triggerRef:u}),y.length===0?e.jsx(st,{title:h?"No invitations match your search":"No pending invitations",description:"Invite new members to your organization."}):e.jsxs(yt,{children:[e.jsx(wt,{children:e.jsxs(Be,{children:[e.jsx(_e,{children:"Email"}),e.jsx(_e,{children:"Role"}),e.jsx(_e,{children:"Invited"}),e.jsx(_e,{})]})}),e.jsx(jt,{children:y.map(b=>{var g;return e.jsxs(Be,{children:[e.jsx(Oe,{children:b.email}),e.jsx(Oe,{children:((g=b.initial_organization_role)==null?void 0:g.name)||"No role"}),e.jsx(Oe,{children:new Date(b.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),e.jsx(kt,{children:e.jsx("div",{style:{position:"relative"},children:e.jsxs(rt,{children:[e.jsx(nt,{children:e.jsx(wa,{children:"•••"})}),e.jsxs(ot,{children:[e.jsx(Ee,{onClick:()=>j(b),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Ur,{size:16,color:"var(--color-muted)"}),e.jsx("span",{children:"Resend Invitation"})]})}),e.jsx(Ee,{$destructive:!0,onClick:()=>C(b),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Xo,{size:16,color:"var(--color-error)"}),e.jsx("span",{children:"Cancel Invitation"})]})})]})]})})})]},b.id)})})]})]})},Tm=()=>{const{activeOrganization:t,loading:r,getRoles:o,removeRole:n}=Xe(),[a,s]=i.useState({isOpen:!1}),[p,f]=i.useState(null),[c,h]=i.useState(null),[d,u]=i.useState(""),[m,v]=i.useState(null),x=i.useRef(null),{data:w=[],isLoading:_,mutate:z}=We(t?`/api/organizations/${t.id}/roles`:null,()=>(o==null?void 0:o())||[]),y=i.useMemo(()=>d?w.filter(j=>j.name.toLowerCase().includes(d.toLowerCase())):w,[w,d]),I=async j=>{try{j.id?(await new Promise(b=>setTimeout(b,1e3)),f({text:"Role updated successfully",type:"success"})):(await new Promise(b=>setTimeout(b,1e3)),f({text:"Role created successfully",type:"success"})),s({isOpen:!1}),z()}catch(b){const g=(b==null?void 0:b.message)||(j.id?"Failed to update role. Please try again.":"Failed to create role. Please try again.");j.id?f({text:g,type:"error"}):f({text:g,type:"error"})}finally{setTimeout(()=>f(null),3e3)}},C=async j=>{try{await n(j),z()}catch{}finally{setTimeout(()=>f(null),3e3)}};return r||_?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ie,{})}):e.jsxs(e.Fragment,{children:[p&&e.jsxs("div",{style:{marginBottom:"20px",padding:"8px",background:p.type==="success"?"var(--color-success-background)":"var(--color-error-background)",color:p.type==="success"?"var(--color-success)":"var(--color-error)",borderRadius:"8px",display:"flex",alignItems:"center",gap:"8px"},children:[p.type==="success"?"✓":e.jsx(It,{size:16}),p.text]}),e.jsxs(cl,{children:[e.jsx(bt,{placeholder:"Search roles",onChange:u,value:d}),e.jsxs("div",{children:[e.jsx(X,{ref:x,onClick:()=>s({isOpen:!a.isOpen}),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"Add role"}),a.isOpen&&!a.role&&e.jsx(Ps,{role:a.role,onClose:()=>s({isOpen:!1}),onSuccess:I,triggerRef:x})]})]}),y.length===0?e.jsx(st,{title:d?"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(yt,{children:[e.jsx(wt,{children:e.jsxs(Be,{children:[e.jsx(_e,{children:"Role"}),e.jsx(_e,{children:"Permissions"}),e.jsx(_e,{})]})}),e.jsx(jt,{children:y.map(j=>{var b;return e.jsxs(Be,{children:[e.jsx(Oe,{children:e.jsx("div",{style:{fontSize:"14px",fontWeight:500},children:j.name})}),e.jsx(Oe,{style:{color:"var(--color-secondary-text)"},children:j.permissions.join(", ")}),e.jsx(kt,{children:e.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center",justifyContent:"flex-end",position:"relative"},children:[e.jsxs(rt,{open:c===j.id,openChange:g=>h(g?j.id:null),children:[e.jsx(nt,{children:e.jsx(wa,{disabled:!j.organization_id,"data-role-dropdown-trigger":j.id,children:"•••"})}),e.jsxs(ot,{children:[e.jsx(Ee,{onClick:()=>{h(null),s({isOpen:!0,role:j})},children:"Edit Role"}),e.jsx(Ee,{$destructive:!0,onClick:()=>{h(null),v(j.id)},children:"Remove Role"})]})]}),m===j.id&&e.jsx(ya,{title:"Are you sure you want to delete this role?",onConfirm:()=>C(j),onCancel:()=>v(null)}),a.isOpen&&((b=a.role)==null?void 0:b.id)===j.id&&e.jsx(Ps,{role:a.role,onClose:()=>{s({isOpen:!1}),h(null)},onSuccess:I})]})})]},j.id)})})]})]})},ll=()=>{const{loading:t,activeOrganization:r}=Xe(),[o,n]=i.useState("general"),[a,s]=i.useState(null),[p,f]=i.useState("info"),c=i.useCallback((h,d="info")=>{s(h),f(d),setTimeout(()=>s(null),3e3)},[s]);return t?e.jsx(Tn,{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(Ie,{})}):r?e.jsx(Ts,{children:e.jsx(nl.Provider,{value:{screen:null,setScreen:()=>{},toast:c},children:e.jsxs(Tn,{children:[e.jsx(Cm,{children:e.jsxs(Sm,{children:[e.jsx(Rr,{$isActive:o==="general",onClick:()=>n("general"),children:e.jsxs(Pr,{children:[e.jsx(Zt,{size:16}),"General"]})}),e.jsx(Rr,{$isActive:o==="domains",onClick:()=>n("domains"),children:e.jsxs(Pr,{children:[e.jsx(dh,{size:16}),"Domains"]})}),e.jsx(Rr,{$isActive:o==="members",onClick:()=>n("members"),children:e.jsxs(Pr,{children:[e.jsx(Nc,{size:16}),"Members"]})}),e.jsx(Rr,{$isActive:o==="invitations",onClick:()=>n("invitations"),children:e.jsxs(Pr,{children:[e.jsx(Ur,{size:16}),"Invitations"]})}),e.jsx(Rr,{$isActive:o==="roles",onClick:()=>n("roles"),children:e.jsxs(Pr,{children:[e.jsx(Ko,{size:16}),"Roles"]})})]})}),e.jsxs($m,{children:[o==="general"&&e.jsx(zm,{}),o==="domains"&&e.jsx(Em,{}),o==="members"&&e.jsx(Rm,{}),o==="invitations"&&e.jsx(Pm,{}),o==="roles"&&e.jsx(Tm,{})]}),a&&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:[p==="error"?e.jsx(It,{size:16,color:"var(--color-error)"}):e.jsx(tt,{size:16,color:"var(--color-success)"}),e.jsx("span",{style:{fontSize:"14px",color:"var(--color-foreground)"},children:a})]})})]})})}):e.jsx(Ts,{children:e.jsx(Tn,{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(Dr,{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(ml,{})]})})})},Om=({isOpen:t,onClose:r,title:o,showHeader:n,headerContent:a,footerContent:s,customContent:p,children:f,showCloseButton:c})=>e.jsx(ye,{isOpen:t,onClose:r,children:e.jsx(ye.Overlay,{children:e.jsxs(ye.Content,{style:{width:"900px",maxWidth:"100%"},children:[n&&e.jsx(ye.Header,{showCloseButton:c,children:a||o}),p||f||e.jsx(ll,{}),s&&e.jsx(ye.Footer,{children:s})]})})}),Mm=l.div`
|
|
2591
|
+
`,Im=()=>{const{activeOrganization:t,loading:r,getMembers:o,getRoles:n,addMemberRole:a,removeMemberRole:s,removeMember:p}=Xe(),{session:f}=Ue(),{toast:c}=at(),[h,d]=i.useState(""),[u,m]=i.useState(!1),v=i.useRef(null),{data:x=[],isLoading:w,mutate:_}=We(t?`/api/organizations/${t.id}/members`:null,()=>(o==null?void 0:o())||[]),{data:z=[],isLoading:y}=We(t?`/api/organizations/${t.id}/roles`:null,()=>(n==null?void 0:n())||[]),P=z,C=i.useMemo(()=>h?x.filter(k=>{var T;const E=k.user;if(!E)return!1;const R=E.first_name||"",$=E.last_name||"",O=((T=E.primary_email_address)==null?void 0:T.email)||"";return`${R} ${$}`.trim().toLowerCase().includes(h.toLowerCase())||O.toLowerCase().includes(h.toLowerCase())}):x,[x,h]),j=async(k,E,R)=>{try{R?(await s(k,E),c("Role removed successfully","info")):(await a(k,E),c("Role added successfully","info")),_()}catch($){const O=$.message||"Failed to update role. Please try again.";c(O,"error")}},b=(k="",E="")=>`${k[0]||""}${E[0]||""}`.toUpperCase(),g=(k,E)=>{var R;return((R=k.roles)==null?void 0:R.some($=>$.id===E))||!1},S=()=>{m(!1),_(),c("Invitation sent successfully","info")};return r||w||y?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Pe,{})}):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(bt,{value:h,onChange:d,placeholder:"Search members..."})}),e.jsx(X,{ref:v,onClick:()=>m(!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(sl,{onClose:()=>m(!1),onSuccess:S,roles:P,triggerRef:v}),C.length===0?e.jsx(st,{title:h?"No members match your search":"No members yet",description:"Invite members to your organization to get started."}):e.jsxs(yt,{children:[e.jsx(wt,{children:e.jsxs(Be,{children:[e.jsx(_e,{children:"Member"}),e.jsx(_e,{children:"Joined"}),e.jsx(_e,{children:"Roles"})]})}),e.jsx(jt,{children:C.map(k=>{var O,I;const E=k.roles||[],R=k.user,$=(R==null?void 0:R.id)===((O=f==null?void 0:f.active_signin)==null?void 0:O.user_id);return e.jsxs(Be,{children:[e.jsx(il,{children:e.jsxs("div",{children:[e.jsx(Rm,{children:R!=null&&R.profile_picture_url?e.jsx("img",{src:R.profile_picture_url,alt:`${R.first_name||""} ${R.last_name||""}`,style:{width:"100%",height:"100%",objectFit:"cover"}}):b(R==null?void 0:R.first_name,R==null?void 0:R.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 N;if(!R)return"Unknown User";const T=`${R.first_name||""} ${R.last_name||""}`.trim();return T||((N=R.primary_email_address)==null?void 0:N.email)||"Unknown User"})()}),$&&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:(I=R==null?void 0:R.primary_email_address)==null?void 0:I.email})]})]})}),e.jsx(Oe,{children:new Date(k.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),e.jsx(kt,{children:e.jsx("div",{style:{position:"relative"},children:e.jsxs(rt,{children:[e.jsx(nt,{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:E.length>0?E[0].name:"No role"}),e.jsx(Xt,{size:14})]})}),e.jsxs(ot,{children:[P.map(T=>{const N=g(k,T.id);return e.jsx(Ee,{onClick:()=>j(k,T,N),children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[e.jsx("span",{children:T.name}),N&&e.jsx(tt,{size:16,color:"var(--color-success)"})]})},T.id)}),e.jsx(Jo,{}),e.jsx(Ee,{$destructive:!0,onClick:()=>p(k),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Xo,{size:16,color:"var(--color-error)"}),e.jsx("span",{children:"Remove Member"})]})})]})]})})})]},k.id)})})]})]})},Tm=()=>{const{activeOrganization:t,loading:r,getInvitations:o,getRoles:n,discardInvitation:a,resendInvitation:s}=Xe(),{toast:p}=at(),[f,c]=i.useState(!1),[h,d]=i.useState(""),u=i.useRef(null),{data:m=[],isLoading:v,mutate:x}=We(t?`/api/organizations/${t.id}/invitations`:null,()=>(o==null?void 0:o())||[]),{data:w=[],isLoading:_}=We(t?`/api/organizations/${t.id}/roles`:null,()=>(n==null?void 0:n())||[]),z=w,y=i.useMemo(()=>h?m.filter(b=>b.email.toLowerCase().includes(h.toLowerCase())):m,[m,h]),P=()=>{p("Invitation sent successfully","info"),x(),c(!1)},C=async b=>{try{await a(b),x(),p("Invitation cancelled successfully","info")}catch(g){const S=g.message||"Failed to cancel invitation. Please try again.";p(S,"error")}},j=async b=>{try{await s(b),p("Invitation resent successfully","info")}catch(g){const S=g.message||"Failed to resend invitation. Please try again.";p(S,"error")}};return r||v||_?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Pe,{})}):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(bt,{value:h,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(sl,{onClose:()=>c(!1),onSuccess:P,roles:z,triggerRef:u}),y.length===0?e.jsx(st,{title:h?"No invitations match your search":"No pending invitations",description:"Invite new members to your organization."}):e.jsxs(yt,{children:[e.jsx(wt,{children:e.jsxs(Be,{children:[e.jsx(_e,{children:"Email"}),e.jsx(_e,{children:"Role"}),e.jsx(_e,{children:"Invited"}),e.jsx(_e,{})]})}),e.jsx(jt,{children:y.map(b=>{var g;return e.jsxs(Be,{children:[e.jsx(Oe,{children:b.email}),e.jsx(Oe,{children:((g=b.initial_organization_role)==null?void 0:g.name)||"No role"}),e.jsx(Oe,{children:new Date(b.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),e.jsx(kt,{children:e.jsx("div",{style:{position:"relative"},children:e.jsxs(rt,{children:[e.jsx(nt,{children:e.jsx(wa,{children:"•••"})}),e.jsxs(ot,{children:[e.jsx(Ee,{onClick:()=>j(b),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Ur,{size:16,color:"var(--color-muted)"}),e.jsx("span",{children:"Resend Invitation"})]})}),e.jsx(Ee,{$destructive:!0,onClick:()=>C(b),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Xo,{size:16,color:"var(--color-error)"}),e.jsx("span",{children:"Cancel Invitation"})]})})]})]})})})]},b.id)})})]})]})},Om=()=>{const{activeOrganization:t,loading:r,getRoles:o,removeRole:n}=Xe(),[a,s]=i.useState({isOpen:!1}),[p,f]=i.useState(null),[c,h]=i.useState(null),[d,u]=i.useState(""),[m,v]=i.useState(null),x=i.useRef(null),{data:w=[],isLoading:_,mutate:z}=We(t?`/api/organizations/${t.id}/roles`:null,()=>(o==null?void 0:o())||[]),y=i.useMemo(()=>d?w.filter(j=>j.name.toLowerCase().includes(d.toLowerCase())):w,[w,d]),P=async j=>{try{j.id?(await new Promise(b=>setTimeout(b,1e3)),f({text:"Role updated successfully",type:"success"})):(await new Promise(b=>setTimeout(b,1e3)),f({text:"Role created successfully",type:"success"})),s({isOpen:!1}),z()}catch(b){const g=(b==null?void 0:b.message)||(j.id?"Failed to update role. Please try again.":"Failed to create role. Please try again.");j.id?f({text:g,type:"error"}):f({text:g,type:"error"})}finally{setTimeout(()=>f(null),3e3)}},C=async j=>{try{await n(j),z()}catch{}finally{setTimeout(()=>f(null),3e3)}};return r||_?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Pe,{})}):e.jsxs(e.Fragment,{children:[p&&e.jsxs("div",{style:{marginBottom:"20px",padding:"8px",background:p.type==="success"?"var(--color-success-background)":"var(--color-error-background)",color:p.type==="success"?"var(--color-success)":"var(--color-error)",borderRadius:"8px",display:"flex",alignItems:"center",gap:"8px"},children:[p.type==="success"?"✓":e.jsx(Pt,{size:16}),p.text]}),e.jsxs(cl,{children:[e.jsx(bt,{placeholder:"Search roles",onChange:u,value:d}),e.jsxs("div",{children:[e.jsx(X,{ref:x,onClick:()=>s({isOpen:!a.isOpen}),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"Add role"}),a.isOpen&&!a.role&&e.jsx(Is,{role:a.role,onClose:()=>s({isOpen:!1}),onSuccess:P,triggerRef:x})]})]}),y.length===0?e.jsx(st,{title:d?"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(yt,{children:[e.jsx(wt,{children:e.jsxs(Be,{children:[e.jsx(_e,{children:"Role"}),e.jsx(_e,{children:"Permissions"}),e.jsx(_e,{})]})}),e.jsx(jt,{children:y.map(j=>{var b;return e.jsxs(Be,{children:[e.jsx(Oe,{children:e.jsx("div",{style:{fontSize:"14px",fontWeight:500},children:j.name})}),e.jsx(Oe,{style:{color:"var(--color-secondary-text)"},children:j.permissions.join(", ")}),e.jsx(kt,{children:e.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center",justifyContent:"flex-end",position:"relative"},children:[e.jsxs(rt,{open:c===j.id,openChange:g=>h(g?j.id:null),children:[e.jsx(nt,{children:e.jsx(wa,{disabled:!j.organization_id,"data-role-dropdown-trigger":j.id,children:"•••"})}),e.jsxs(ot,{children:[e.jsx(Ee,{onClick:()=>{h(null),s({isOpen:!0,role:j})},children:"Edit Role"}),e.jsx(Ee,{$destructive:!0,onClick:()=>{h(null),v(j.id)},children:"Remove Role"})]})]}),m===j.id&&e.jsx(ya,{title:"Are you sure you want to delete this role?",onConfirm:()=>C(j),onCancel:()=>v(null)}),a.isOpen&&((b=a.role)==null?void 0:b.id)===j.id&&e.jsx(Is,{role:a.role,onClose:()=>{s({isOpen:!1}),h(null)},onSuccess:P})]})})]},j.id)})})]})]})},ll=()=>{const{loading:t,activeOrganization:r}=Xe(),[o,n]=i.useState("general"),[a,s]=i.useState(null),[p,f]=i.useState("info"),c=i.useCallback((h,d="info")=>{s(h),f(d),setTimeout(()=>s(null),3e3)},[s]);return t?e.jsx(Tn,{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(Pe,{})}):r?e.jsx(Ts,{children:e.jsx(nl.Provider,{value:{screen:null,setScreen:()=>{},toast:c},children:e.jsxs(Tn,{children:[e.jsx(Sm,{children:e.jsxs($m,{children:[e.jsx(Rr,{$isActive:o==="general",onClick:()=>n("general"),children:e.jsxs(Ir,{children:[e.jsx(Zt,{size:16}),"General"]})}),e.jsx(Rr,{$isActive:o==="domains",onClick:()=>n("domains"),children:e.jsxs(Ir,{children:[e.jsx(dh,{size:16}),"Domains"]})}),e.jsx(Rr,{$isActive:o==="members",onClick:()=>n("members"),children:e.jsxs(Ir,{children:[e.jsx(Nc,{size:16}),"Members"]})}),e.jsx(Rr,{$isActive:o==="invitations",onClick:()=>n("invitations"),children:e.jsxs(Ir,{children:[e.jsx(Ur,{size:16}),"Invitations"]})}),e.jsx(Rr,{$isActive:o==="roles",onClick:()=>n("roles"),children:e.jsxs(Ir,{children:[e.jsx(Ko,{size:16}),"Roles"]})})]})}),e.jsxs(zm,{children:[o==="general"&&e.jsx(Em,{}),o==="domains"&&e.jsx(Pm,{}),o==="members"&&e.jsx(Im,{}),o==="invitations"&&e.jsx(Tm,{}),o==="roles"&&e.jsx(Om,{})]}),a&&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:[p==="error"?e.jsx(Pt,{size:16,color:"var(--color-error)"}):e.jsx(tt,{size:16,color:"var(--color-success)"}),e.jsx("span",{style:{fontSize:"14px",color:"var(--color-foreground)"},children:a})]})})]})})}):e.jsx(Ts,{children:e.jsx(Tn,{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(Dr,{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(ml,{})]})})})},Mm=({isOpen:t,onClose:r,title:o,showHeader:n,headerContent:a,footerContent:s,customContent:p,children:f,showCloseButton:c})=>e.jsx(ye,{isOpen:t,onClose:r,children:e.jsx(ye.Overlay,{children:e.jsxs(ye.Content,{style:{width:"900px",maxWidth:"100%"},children:[n&&e.jsx(ye.Header,{showCloseButton:c,children:a||o}),p||f||e.jsx(ll,{}),s&&e.jsx(ye.Footer,{children:s})]})})}),Lm=l.div`
|
|
2592
2592
|
display: flex;
|
|
2593
2593
|
height: 100%;
|
|
2594
2594
|
min-height: 400px;
|
|
@@ -2602,7 +2602,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2602
2602
|
justify-content: center;
|
|
2603
2603
|
text-align: center;
|
|
2604
2604
|
border-right: 1px solid var(--color-border);
|
|
2605
|
-
`,
|
|
2605
|
+
`,Dm=l.div`
|
|
2606
2606
|
flex: 1;
|
|
2607
2607
|
padding: 32px;
|
|
2608
2608
|
display: flex;
|
|
@@ -2626,11 +2626,11 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2626
2626
|
border-color: var(--color-border-hover);
|
|
2627
2627
|
transform: scale(1.02);
|
|
2628
2628
|
}
|
|
2629
|
-
`,
|
|
2629
|
+
`,Nm=l.img`
|
|
2630
2630
|
width: 100%;
|
|
2631
2631
|
height: 100%;
|
|
2632
2632
|
object-fit: cover;
|
|
2633
|
-
`,
|
|
2633
|
+
`,Fm=l.div`
|
|
2634
2634
|
font-size: 32px;
|
|
2635
2635
|
font-weight: 600;
|
|
2636
2636
|
color: var(--color-muted);
|
|
@@ -2640,28 +2640,28 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2640
2640
|
display: flex;
|
|
2641
2641
|
align-items: center;
|
|
2642
2642
|
justify-content: center;
|
|
2643
|
-
`,
|
|
2643
|
+
`,Bm=l.h2`
|
|
2644
2644
|
font-size: 16px;
|
|
2645
2645
|
font-weight: 400;
|
|
2646
2646
|
color: var(--color-foreground);
|
|
2647
2647
|
margin-bottom: 8px;
|
|
2648
|
-
`,
|
|
2648
|
+
`,Um=l.p`
|
|
2649
2649
|
font-size: 13px;
|
|
2650
2650
|
color: var(--color-secondary-text);
|
|
2651
2651
|
line-height: 1.4;
|
|
2652
2652
|
max-width: 200px;
|
|
2653
|
-
`,
|
|
2653
|
+
`,Wm=l.div`
|
|
2654
2654
|
margin-bottom: 24px;
|
|
2655
|
-
`,
|
|
2655
|
+
`,Vm=l.h3`
|
|
2656
2656
|
font-size: 16px;
|
|
2657
2657
|
font-weight: 400;
|
|
2658
2658
|
color: var(--color-foreground);
|
|
2659
2659
|
margin-bottom: 6px;
|
|
2660
|
-
`,
|
|
2660
|
+
`,Gm=l.p`
|
|
2661
2661
|
font-size: 13px;
|
|
2662
2662
|
color: var(--color-secondary-text);
|
|
2663
2663
|
line-height: 1.4;
|
|
2664
|
-
`,
|
|
2664
|
+
`,Hm=l.div`
|
|
2665
2665
|
flex: 1;
|
|
2666
2666
|
`,On=l.div`
|
|
2667
2667
|
margin-bottom: 20px;
|
|
@@ -2671,7 +2671,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2671
2671
|
font-size: 13px;
|
|
2672
2672
|
font-weight: 500;
|
|
2673
2673
|
color: var(--color-foreground);
|
|
2674
|
-
`,
|
|
2674
|
+
`,qm=l.input`
|
|
2675
2675
|
width: 100%;
|
|
2676
2676
|
padding: 8px 12px;
|
|
2677
2677
|
border: 1px solid var(--color-border);
|
|
@@ -2691,7 +2691,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2691
2691
|
&::placeholder {
|
|
2692
2692
|
color: var(--color-muted);
|
|
2693
2693
|
}
|
|
2694
|
-
`,
|
|
2694
|
+
`,Ym=l.textarea`
|
|
2695
2695
|
width: 100%;
|
|
2696
2696
|
padding: 8px 12px;
|
|
2697
2697
|
border: 1px solid var(--color-border);
|
|
@@ -2714,13 +2714,13 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2714
2714
|
&::placeholder {
|
|
2715
2715
|
color: var(--color-muted);
|
|
2716
2716
|
}
|
|
2717
|
-
`,
|
|
2717
|
+
`,Zm=l.div`
|
|
2718
2718
|
display: flex;
|
|
2719
2719
|
justify-content: space-between;
|
|
2720
2720
|
align-items: center;
|
|
2721
2721
|
margin-top: auto;
|
|
2722
2722
|
padding-top: 24px;
|
|
2723
|
-
`,
|
|
2723
|
+
`,Km=l.button`
|
|
2724
2724
|
display: flex;
|
|
2725
2725
|
align-items: center;
|
|
2726
2726
|
gap: 6px;
|
|
@@ -2736,7 +2736,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2736
2736
|
&:hover {
|
|
2737
2737
|
color: var(--color-foreground);
|
|
2738
2738
|
}
|
|
2739
|
-
`,
|
|
2739
|
+
`,Qm=l.button`
|
|
2740
2740
|
padding: 8px 20px;
|
|
2741
2741
|
border-radius: 6px;
|
|
2742
2742
|
font-size: 14px;
|
|
@@ -2757,9 +2757,9 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2757
2757
|
opacity: 0.5;
|
|
2758
2758
|
cursor: not-allowed;
|
|
2759
2759
|
}
|
|
2760
|
-
`,
|
|
2760
|
+
`,Xm=l.input`
|
|
2761
2761
|
display: none;
|
|
2762
|
-
`,
|
|
2762
|
+
`,Jm=l.div`
|
|
2763
2763
|
position: absolute;
|
|
2764
2764
|
inset: 0;
|
|
2765
2765
|
background: var(--color-dialog-backdrop);
|
|
@@ -2773,13 +2773,13 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2773
2773
|
${dl}:hover & {
|
|
2774
2774
|
opacity: 1;
|
|
2775
2775
|
}
|
|
2776
|
-
`,
|
|
2776
|
+
`,ex=l.div`
|
|
2777
2777
|
color: white;
|
|
2778
2778
|
font-size: 12px;
|
|
2779
2779
|
font-weight: 500;
|
|
2780
|
-
`,
|
|
2780
|
+
`,tx=l.div`
|
|
2781
2781
|
position: relative;
|
|
2782
|
-
`,
|
|
2782
|
+
`,rx=l.button`
|
|
2783
2783
|
width: 100%;
|
|
2784
2784
|
padding: 8px 12px;
|
|
2785
2785
|
border: 1px solid var(--color-border);
|
|
@@ -2808,7 +2808,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2808
2808
|
background: var(--color-background-hover);
|
|
2809
2809
|
cursor: not-allowed;
|
|
2810
2810
|
}
|
|
2811
|
-
`,
|
|
2811
|
+
`,ox=l.div`
|
|
2812
2812
|
position: absolute;
|
|
2813
2813
|
top: calc(100% + 4px);
|
|
2814
2814
|
left: 0;
|
|
@@ -2857,11 +2857,11 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2857
2857
|
font-weight: 600;
|
|
2858
2858
|
color: var(--color-secondary-text);
|
|
2859
2859
|
flex-shrink: 0;
|
|
2860
|
-
`,
|
|
2860
|
+
`,Ls=l.img`
|
|
2861
2861
|
width: 100%;
|
|
2862
2862
|
height: 100%;
|
|
2863
2863
|
object-fit: cover;
|
|
2864
|
-
`,
|
|
2864
|
+
`,nx=l(ul)`
|
|
2865
2865
|
border-top: 1px solid var(--color-border);
|
|
2866
2866
|
color: var(--color-primary);
|
|
2867
2867
|
font-weight: 500;
|
|
@@ -2870,7 +2870,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2870
2870
|
&:hover {
|
|
2871
2871
|
background: var(--color-primary-background);
|
|
2872
2872
|
}
|
|
2873
|
-
`,
|
|
2873
|
+
`,ax=l.div`
|
|
2874
2874
|
width: 20px;
|
|
2875
2875
|
height: 20px;
|
|
2876
2876
|
border-radius: 50%;
|
|
@@ -2879,7 +2879,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2879
2879
|
align-items: center;
|
|
2880
2880
|
justify-content: center;
|
|
2881
2881
|
color: var(--color-primary);
|
|
2882
|
-
`,ja=({organizationId:t,onSuccess:r,onCancel:o,onCreateOrganization:n})=>{var
|
|
2882
|
+
`,ja=({organizationId:t,onSuccess:r,onCancel:o,onCreateOrganization:n})=>{var I;const[a,s]=i.useState(""),[p,f]=i.useState(""),[c,h]=i.useState(),[d,u]=i.useState(null),[m,v]=i.useState(!1),[x,w]=i.useState(!1),[_,z]=i.useState(t),y=i.useRef(null),P=i.useRef(null),{toast:C}=at(),{createWorkspace:j}=vt(),{organizationMemberships:b}=tr(),g=(I=b==null?void 0:b.find(T=>T.organization.id===_))==null?void 0:I.organization,S=T=>{if(T.target.files&&T.target.files[0]){const N=T.target.files[0];if(N.size>2*1024*1024){C("File size cannot exceed 2MB","error");return}if(!N.type.startsWith("image/")){C("Please select a valid image file","error");return}d&&URL.revokeObjectURL(d),h(N),u(URL.createObjectURL(N))}},k=()=>{var T;(T=y.current)==null||T.click()},E=T=>T.split(" ").map(N=>N[0]).join("").toUpperCase().slice(0,2)||"W",R=T=>T.trim().replace(/[<>\"'&]/g,""),$=T=>T.length>=2&&T.length<=100&&/^[a-zA-Z0-9\s_.-]+$/.test(T),O=async()=>{const T=R(a),N=R(p);if(!T||!_){C("Please enter a workspace name","error");return}if(!$(T)){C("Workspace name must be 2-100 characters and contain only letters, numbers, spaces, dots, underscores, and hyphens","error");return}if(N.length>500){C("Description must be less than 500 characters","error");return}v(!0);try{await j(_,T,c,N),r==null||r()}catch(L){const D=L.message||"Failed to create workspace. Please try again.";C(D,"error")}finally{v(!1)}};return i.useEffect(()=>()=>{d&&URL.revokeObjectURL(d)},[d]),i.useEffect(()=>{const T=N=>{P.current&&!P.current.contains(N.target)&&w(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]),e.jsx(ie,{children:e.jsxs(Lm,{children:[e.jsxs(Am,{children:[e.jsxs(dl,{hasImage:!!d,onClick:k,children:[d?e.jsx(Nm,{src:d,alt:"Workspace logo"}):e.jsx(Fm,{children:E(a||"W")}),e.jsx(Jm,{children:e.jsx(ex,{children:"Upload Logo"})})]}),e.jsx(Xm,{type:"file",ref:y,onChange:S,accept:"image/png, image/jpeg, image/gif",disabled:m}),e.jsx(Bm,{children:"Create new workspace"}),e.jsx(Um,{children:"Workspaces are used to organize your projects and team members into logical groups."})]}),e.jsxs(Dm,{children:[e.jsxs(Wm,{children:[e.jsx(Vm,{children:"Choose your workspace name"}),e.jsx(Gm,{children:"Enter a name for your new workspace. This will be visible to all members."})]}),e.jsxs(Hm,{children:[e.jsxs(On,{children:[e.jsx(Mn,{children:"Organization"}),e.jsxs(tx,{ref:P,children:[e.jsxs(rx,{type:"button",onClick:()=>w(!x),disabled:m,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Ms,{children:g!=null&&g.image_url?e.jsx(Ls,{src:g.image_url,alt:g.name}):E((g==null?void 0:g.name)||"O").charAt(0)}),e.jsx("span",{children:(g==null?void 0:g.name)||"Select organization"})]}),e.jsx(Xt,{size:16,style:{color:"var(--color-secondary-text)"}})]}),x&&e.jsxs(ox,{children:[b==null?void 0:b.map(T=>e.jsxs(ul,{onClick:()=>{z(T.organization.id),w(!1)},children:[e.jsx(Ms,{children:T.organization.image_url?e.jsx(Ls,{src:T.organization.image_url,alt:T.organization.name}):E(T.organization.name).charAt(0)}),e.jsx("span",{children:T.organization.name})]},T.organization.id)),e.jsxs(nx,{onClick:()=>{w(!1),n==null||n()},children:[e.jsx(ax,{children:e.jsx(lt,{size:12})}),e.jsx("span",{children:"Create new organization"})]})]})]})]}),e.jsxs(On,{children:[e.jsx(Mn,{children:"Workspace name"}),e.jsx(qm,{type:"text",value:a,onChange:T=>s(T.target.value),placeholder:"Workspace Name",disabled:m})]}),e.jsxs(On,{children:[e.jsx(Mn,{children:"Description (optional)"}),e.jsx(Ym,{value:p,onChange:T=>f(T.target.value),placeholder:"What is this workspace for?",disabled:m})]})]}),e.jsxs(Zm,{children:[o?e.jsxs(Km,{onClick:o,disabled:m,children:[e.jsx(Yo,{size:16}),"Back"]}):e.jsx("div",{}),e.jsx(Qm,{onClick:O,disabled:m||!a.trim(),children:m?"Creating...":"Create"})]})]})]})})},pl=({isOpen:t,onClose:r,onCreated:o,organizationId:n})=>{const[a,s]=i.useState(!1),[p,f]=i.useState(n),{refetch:c,organizationMemberships:h}=tr(),d=()=>{o==null||o(),r==null||r()},u=()=>{s(!0)},m=async()=>{await c(),setTimeout(()=>{if(h&&h.length>0){const v=h[h.length-1];f(v.organization.id)}s(!1)},500)};return e.jsx(ie,{children:e.jsx(ye,{isOpen:t,onClose:r,children:e.jsx(ye.Overlay,{children:e.jsx(ye.Content,{style:{width:"900px",maxWidth:"90vw"},children:e.jsx(ye.Body,{style:{padding:0},children:a?e.jsx(en,{onSuccess:m,onCancel:()=>s(!1)}):e.jsx(ja,{organizationId:p||n,onSuccess:d,onCancel:r,onCreateOrganization:u})})})})})})},sx=l.div`
|
|
2883
2883
|
position: fixed;
|
|
2884
2884
|
width: 360px;
|
|
2885
2885
|
max-width: calc(100vw - 48px);
|
|
@@ -2892,27 +2892,27 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2892
2892
|
@media (max-width: 600px) {
|
|
2893
2893
|
width: calc(100vw - 48px);
|
|
2894
2894
|
}
|
|
2895
|
-
`,
|
|
2895
|
+
`,ix=l.div`
|
|
2896
2896
|
display: flex;
|
|
2897
2897
|
justify-content: space-between;
|
|
2898
2898
|
align-items: center;
|
|
2899
2899
|
padding: var(--space-sm) var(--space-md);
|
|
2900
2900
|
border-bottom: 1px solid var(--color-border);
|
|
2901
|
-
`,
|
|
2901
|
+
`,cx=l.h3`
|
|
2902
2902
|
margin: 0;
|
|
2903
2903
|
font-size: var(--font-xs);
|
|
2904
2904
|
font-weight: 500;
|
|
2905
2905
|
color: var(--color-foreground);
|
|
2906
|
-
`,cx=l.div`
|
|
2907
|
-
padding: var(--space-md);
|
|
2908
2906
|
`,lx=l.div`
|
|
2907
|
+
padding: var(--space-md);
|
|
2908
|
+
`,dx=l.div`
|
|
2909
2909
|
display: flex;
|
|
2910
2910
|
gap: var(--space-xs);
|
|
2911
2911
|
justify-content: flex-end;
|
|
2912
2912
|
padding: var(--space-sm) var(--space-md);
|
|
2913
2913
|
border-top: 1px solid var(--color-border);
|
|
2914
2914
|
background: var(--color-background-alt);
|
|
2915
|
-
`,
|
|
2915
|
+
`,ux=l.button`
|
|
2916
2916
|
background: none;
|
|
2917
2917
|
border: none;
|
|
2918
2918
|
padding: var(--space-xs);
|
|
@@ -2928,7 +2928,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2928
2928
|
color: var(--color-foreground);
|
|
2929
2929
|
background: var(--color-input-background);
|
|
2930
2930
|
}
|
|
2931
|
-
`,
|
|
2931
|
+
`,px=({onClose:t,onSuccess:r,roles:o,createInvitation:n,triggerRef:a})=>{const s=i.useRef(null),[p,f]=i.useState(""),[c,h]=i.useState(null),[d,u]=i.useState(!1),[m,v]=i.useState(!1),[x,w]=i.useState({top:0,left:0}),{toast:_}=at(),z=o.map(C=>({value:C.id,label:C.name}));i.useEffect(()=>{v(!0);const C=setTimeout(()=>{if(!s.current||!(a!=null&&a.current))return;const S=a.current;if(S){const k=S.getBoundingClientRect(),E=360,R=250,$=8;let O=0,I=0;const T=window.innerHeight-k.bottom,N=k.top;T>=R+$?(O=k.bottom+$,I=k.right-E,I<$&&(I=k.left,I+E>window.innerWidth-$&&(I=(window.innerWidth-E)/2))):N>=R+$?(O=k.top-R-$,I=k.right-E,I<$&&(I=k.left,I+E>window.innerWidth-$&&(I=(window.innerWidth-E)/2))):(O=k.bottom+$,I=k.right-E,I<$&&(I=k.left)),w({top:O,left:I})}},10),j=S=>{s.current&&!s.current.contains(S.target)&&(t==null||t())},b=S=>{S.key==="Escape"&&(t==null||t())},g=setTimeout(()=>{document.addEventListener("mousedown",j),document.addEventListener("keydown",b)},100);return()=>{clearTimeout(C),clearTimeout(g),document.removeEventListener("mousedown",j),document.removeEventListener("keydown",b)}},[t,a]);const y=C=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(C),P=async()=>{const C=p.trim().toLowerCase();if(!(!C||!c)){if(!y(C)){_("Please enter a valid email address","error");return}if(C.length>320){_("Email address is too long","error");return}u(!0);try{await n(C,c.id),r==null||r()}catch(j){const b=j.message||"Failed to send invitation. Please try again.";_(b,"error")}finally{u(!1)}}};return m?e.jsxs(sx,{ref:s,style:{top:`${x.top}px`,left:`${x.left}px`,visibility:x.top>0?"visible":"hidden"},onClick:C=>C.stopPropagation(),role:"dialog","aria-labelledby":"invite-workspace-member-title","aria-modal":"true",children:[e.jsxs(ix,{children:[e.jsx(cx,{id:"invite-workspace-member-title",children:"Invite Member"}),e.jsx(ux,{onClick:t,"aria-label":"Close invite member dialog",children:e.jsx(Qe,{size:16})})]}),e.jsx(lx,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:[e.jsxs(fe,{children:[e.jsx(he,{children:"Email Address"}),e.jsx(le,{type:"email",placeholder:"colleague@company.com",value:p,onChange:C=>f(C.target.value),autoFocus:!0,"aria-label":"Email address for workspace invitation","aria-describedby":"workspace-email-help"})]}),e.jsxs(fe,{children:[e.jsx(he,{children:"Role"}),e.jsx(ba,{options:z,value:c==null?void 0:c.id,onChange:C=>h(o.find(j=>j.id===C)),placeholder:"Select a role","aria-label":"Select role for invited workspace member"})]})]})}),e.jsxs(dx,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto"},children:"Cancel"}),e.jsx(X,{onClick:P,disabled:!p||!c||d,style:{width:"auto"},children:d?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{size:14})," Sending..."]}):"Send Invitation"})]})]}):null},hx=l.div`
|
|
2932
2932
|
position: fixed;
|
|
2933
2933
|
width: 360px;
|
|
2934
2934
|
max-width: calc(100vw - 48px);
|
|
@@ -2941,27 +2941,27 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2941
2941
|
@media (max-width: 600px) {
|
|
2942
2942
|
width: calc(100vw - 48px);
|
|
2943
2943
|
}
|
|
2944
|
-
`,
|
|
2944
|
+
`,fx=l.div`
|
|
2945
2945
|
display: flex;
|
|
2946
2946
|
justify-content: space-between;
|
|
2947
2947
|
align-items: center;
|
|
2948
2948
|
padding: var(--space-sm) var(--space-md);
|
|
2949
2949
|
border-bottom: 1px solid var(--color-border);
|
|
2950
|
-
`,
|
|
2950
|
+
`,gx=l.h3`
|
|
2951
2951
|
margin: 0;
|
|
2952
2952
|
font-size: var(--font-xs);
|
|
2953
2953
|
font-weight: 500;
|
|
2954
2954
|
color: var(--color-foreground);
|
|
2955
|
-
`,gx=l.div`
|
|
2956
|
-
padding: var(--space-md);
|
|
2957
2955
|
`,mx=l.div`
|
|
2956
|
+
padding: var(--space-md);
|
|
2957
|
+
`,xx=l.div`
|
|
2958
2958
|
display: flex;
|
|
2959
2959
|
gap: var(--space-xs);
|
|
2960
2960
|
justify-content: flex-end;
|
|
2961
2961
|
padding: var(--space-sm) var(--space-md);
|
|
2962
2962
|
border-top: 1px solid var(--color-border);
|
|
2963
2963
|
background: var(--color-background-alt);
|
|
2964
|
-
`,
|
|
2964
|
+
`,vx=l.button`
|
|
2965
2965
|
background: none;
|
|
2966
2966
|
border: none;
|
|
2967
2967
|
padding: var(--space-xs);
|
|
@@ -2977,7 +2977,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
2977
2977
|
color: var(--color-foreground);
|
|
2978
2978
|
background: var(--color-input-background);
|
|
2979
2979
|
}
|
|
2980
|
-
`,
|
|
2980
|
+
`,As=({onClose:t,onSuccess:r,role:o,triggerRef:n})=>{var C;const a=i.useRef(null),[s,p]=i.useState((o==null?void 0:o.name)||""),[f,c]=i.useState((o==null?void 0:o.permissions)||[]),[h,d]=i.useState(!1),{deployment:u}=ve(),[m,v]=i.useState(!1),[x,w]=i.useState({top:0,left:0}),{toast:_}=at(),z=!!o,y=(((C=u==null?void 0:u.b2b_settings)==null?void 0:C.workspace_permissions)||[]).map(j=>({value:j,label:j}));i.useEffect(()=>{v(!0);const j=setTimeout(()=>{if(!a.current||!(n!=null&&n.current))return;const k=n.current;if(k){const E=k.getBoundingClientRect(),R=360,$=250,O=8;let I=0,T=0;const N=window.innerHeight-E.bottom,L=E.top;N>=$+O?(I=E.bottom+O,T=E.right-R,T<O&&(T=E.left,T+R>window.innerWidth-O&&(T=(window.innerWidth-R)/2))):L>=$+O?(I=E.top-$-O,T=E.right-R,T<O&&(T=E.left,T+R>window.innerWidth-O&&(T=(window.innerWidth-R)/2))):(I=E.bottom+O,T=E.right-R,T<O&&(T=E.left)),w({top:I,left:T})}},10),b=k=>{a.current&&!a.current.contains(k.target)&&(t==null||t())},g=k=>{k.key==="Escape"&&(t==null||t())},S=setTimeout(()=>{document.addEventListener("mousedown",b),document.addEventListener("keydown",g)},100);return()=>{clearTimeout(j),clearTimeout(S),document.removeEventListener("mousedown",b),document.removeEventListener("keydown",g)}},[t,n]);const P=async()=>{if(s.trim()){d(!0);try{const j={id:o==null?void 0:o.id,name:s.trim(),permissions:f};r==null||r(j)}catch(j){const b=j.message||"Failed to save role. Please try again.";_(b,"error")}finally{d(!1)}}};return m?e.jsxs(hx,{ref:a,style:{top:`${x.top}px`,left:`${x.left}px`,visibility:x.top>0?"visible":"hidden"},onClick:j=>j.stopPropagation(),children:[e.jsxs(fx,{children:[e.jsx(gx,{children:z?"Edit Role":"Add Role"}),e.jsx(vx,{onClick:t,children:e.jsx(Qe,{size:16})})]}),e.jsx(mx,{children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:[e.jsxs(fe,{children:[e.jsx(he,{children:"Role Name"}),e.jsx(le,{type:"text",value:s,onChange:j=>p(j.target.value),placeholder:"Enter role name",autoFocus:!0})]}),e.jsxs(fe,{children:[e.jsx(he,{children:"Permissions"}),e.jsx(Kc,{options:y,value:f,onChange:c,placeholder:"Select permissions"})]})]})}),e.jsxs(xx,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto"},children:"Cancel"}),e.jsx(X,{onClick:P,disabled:!s.trim()||h,style:{width:"auto"},children:h?"Saving...":z?"Update":"Create"})]})]}):null},_r=i.createContext(void 0),Rt=()=>{const t=i.useContext(_r);if(!t)throw new Error("useScreenContext must be used within a ScreenProvider");return t},bx=l.div`
|
|
2981
2981
|
* {
|
|
2982
2982
|
box-sizing: border-box;
|
|
2983
2983
|
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
@@ -3016,14 +3016,14 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3016
3016
|
pointer-events: none;
|
|
3017
3017
|
z-index: 1;
|
|
3018
3018
|
}
|
|
3019
|
-
`,
|
|
3019
|
+
`,yx=l.div`
|
|
3020
3020
|
padding: 0 24px;
|
|
3021
3021
|
border-bottom: 1px solid var(--color-border);
|
|
3022
3022
|
|
|
3023
3023
|
@media (max-width: 768px) {
|
|
3024
3024
|
padding: 0 20px;
|
|
3025
3025
|
}
|
|
3026
|
-
`,
|
|
3026
|
+
`,wx=l.div`
|
|
3027
3027
|
display: flex;
|
|
3028
3028
|
gap: 20px;
|
|
3029
3029
|
overflow-x: auto;
|
|
@@ -3064,7 +3064,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3064
3064
|
display: inline-flex;
|
|
3065
3065
|
align-items: center;
|
|
3066
3066
|
gap: 6px;
|
|
3067
|
-
`,
|
|
3067
|
+
`,jx=l.div`
|
|
3068
3068
|
flex: 1;
|
|
3069
3069
|
padding: 24px 24px 0 24px;
|
|
3070
3070
|
overflow-y: auto;
|
|
@@ -3079,7 +3079,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3079
3079
|
flex-wrap: wrap;
|
|
3080
3080
|
gap: 8px;
|
|
3081
3081
|
margin-bottom: 20px;
|
|
3082
|
-
`,
|
|
3082
|
+
`,kx=l.div`
|
|
3083
3083
|
background: var(--color-background);
|
|
3084
3084
|
padding: 16px 4px;
|
|
3085
3085
|
display: flex;
|
|
@@ -3092,11 +3092,11 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3092
3092
|
&:hover {
|
|
3093
3093
|
background: var(--color-input-background);
|
|
3094
3094
|
}
|
|
3095
|
-
`,
|
|
3095
|
+
`,_x=l.div`
|
|
3096
3096
|
display: flex;
|
|
3097
3097
|
align-items: center;
|
|
3098
3098
|
gap: 12px;
|
|
3099
|
-
`,
|
|
3099
|
+
`,Cx=l.div`
|
|
3100
3100
|
width: 40px;
|
|
3101
3101
|
height: 40px;
|
|
3102
3102
|
border-radius: 50%;
|
|
@@ -3108,16 +3108,16 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3108
3108
|
font-weight: 500;
|
|
3109
3109
|
font-size: 14px;
|
|
3110
3110
|
overflow: hidden;
|
|
3111
|
-
`,
|
|
3111
|
+
`,Sx=l.div`
|
|
3112
3112
|
display: flex;
|
|
3113
3113
|
flex-direction: column;
|
|
3114
|
-
|
|
3114
|
+
`,$x=l.div`
|
|
3115
3115
|
font-size: 14px;
|
|
3116
3116
|
color: var(--color-foreground);
|
|
3117
|
-
|
|
3117
|
+
`,zx=l.div`
|
|
3118
3118
|
font-size: 12px;
|
|
3119
3119
|
color: var(--color-muted);
|
|
3120
|
-
`,
|
|
3120
|
+
`,Ex=l.div`
|
|
3121
3121
|
display: flex;
|
|
3122
3122
|
align-items: center;
|
|
3123
3123
|
gap: 8px;
|
|
@@ -3143,7 +3143,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3143
3143
|
opacity: 0.5;
|
|
3144
3144
|
cursor: not-allowed;
|
|
3145
3145
|
}
|
|
3146
|
-
`,Ex=()=>{const{activeWorkspace:t,loading:r,getRoles:o}=zt(),{workspaces:n}=vt(),{client:a}=Me(),s=n==null?void 0:n.find($=>$.id===(t==null?void 0:t.id)),[p,f]=i.useState(!0),[c,h]=i.useState(!0),[d,u]=i.useState(""),[m,v]=i.useState(""),[x,w]=i.useState([]),[_,z]=i.useState([]),[y,I]=i.useState(!1),C=i.useRef(null),j=i.useCallback(async()=>{if(!t||!s)return[];try{return(await V(await a(`/organizations/${s.organization.id}/invitations`,{method:"GET"}))).data.filter(P=>P.workspace_id===t.id)}catch{return[]}},[a,t,s]),b=i.useCallback(async($,O)=>{if(!t||!s)return;const T=(await V(await a(`/organizations/${s.organization.id}/roles`,{method:"GET"}))).data,N=T.find(D=>!D.organization_id)||T[0];return(await V(await a(`/organizations/${s.organization.id}/invitations`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:$,role_id:N==null?void 0:N.id,workspace_id:t.id,workspace_role_id:O})}))).data},[a,t,s]),g=i.useCallback(async $=>!t||!s?void 0:(await V(await a(`/organizations/${s.organization.id}/invitations/${$}/remove`,{method:"POST"}))).data,[a,t,s]);i.useEffect(()=>{if(!t)return;(async()=>{f(!0),h(!0);try{const[O,P]=await Promise.all([o(),j()]);z(O),w(P)}catch{}finally{f(!1),h(!1)}})()},[t==null?void 0:t.id]);const S=async $=>{try{await g($.id);const O=await j();w(O)}catch{}},k=async $=>{var O;try{await g($.id),await b($.email,$.workspace_role_id||((O=$.initial_workspace_role)==null?void 0:O.id)||$.role_id);const P=await j();w(P),v("Invitation resent successfully"),setTimeout(()=>v(""),3e3)}catch{}},E=async()=>{I(!1);const $=await j();w($),v("Invitation sent successfully"),setTimeout(()=>v(""),3e3)},R=i.useMemo(()=>d?x.filter($=>($.email||"").toLowerCase().includes(d.toLowerCase())):x,[x,d]);return r||p||c?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ie,{})}):e.jsxs(e.Fragment,{children:[m&&e.jsxs("div",{style:{marginBottom:"16px",padding:"12px 16px",background:"var(--color-success-background)",color:"var(--color-success)",borderRadius:"6px",fontSize:"14px"},children:["✓ ",m]}),e.jsxs(ka,{children:[e.jsx(bt,{value:d,onChange:u,placeholder:"Search Invitation"}),e.jsxs("div",{children:[e.jsx(X,{ref:C,onClick:()=>I(!y),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"Invite Members"}),y&&e.jsx(ux,{onClose:()=>I(!1),onSuccess:E,roles:_,createInvitation:b,triggerRef:C})]})]}),e.jsx("div",{children:R.length===0?e.jsx(st,{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:R.map($=>{var O,P,T;return e.jsxs(jx,{children:[e.jsx(kx,{children:e.jsxs(Cx,{children:[e.jsx(Sx,{children:$.email}),e.jsx($x,{children:((O=$.initial_workspace_role)==null?void 0:O.name)||((P=$.initial_organization_role)==null?void 0:P.name)||((T=$.role)==null?void 0:T.name)})]})}),e.jsx(zx,{children:e.jsxs(rt,{children:[e.jsx(nt,{children:e.jsx(hl,{children:"•••"})}),e.jsxs(ot,{children:[e.jsx(Ee,{onClick:()=>k($),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Ur,{size:16,color:"var(--color-muted)"}),e.jsx("span",{children:"Resend Invitation"})]})}),e.jsx(Ee,{$destructive:!0,onClick:()=>S($),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Qo,{size:16,color:"var(--color-error)"}),e.jsx("span",{children:"Cancel Invitation"})]})})]})]})})]},$.id)})})})]})},Ix=()=>{const{activeWorkspace:t,loading:r,getMembers:o,getRoles:n,removeMember:a,addMemberRole:s,removeMemberRole:p}=zt(),{session:f}=Ue(),{toast:c}=i.useContext(_r)||{},[h,d]=i.useState(""),{data:u=[],isLoading:m,mutate:v}=We(t?`/api/workspaces/${t.id}/members`:null,()=>o()||[]),{data:x=[],isLoading:w}=We(t?`/api/workspaces/${t.id}/roles`:null,()=>n()||[]),_=x,z=i.useMemo(()=>h?u.filter(b=>{var $;const g=b.public_user_data;if(!g)return!1;const S=g.first_name||"",k=g.last_name||"",E=(($=g.primary_email_address)==null?void 0:$.email)||"";return`${S} ${k}`.trim().toLowerCase().includes(h.toLowerCase())||E.toLowerCase().includes(h.toLowerCase())}):u,[u,h]),y=async b=>{try{await a(b),c==null||c("Member removed successfully","info"),v()}catch{c==null||c("Failed to remove member","error")}},I=async(b,g,S)=>{try{S?(await p(b,g),c==null||c("Role removed successfully","info")):(await s(b,g),c==null||c("Role added successfully","info")),v()}catch{c==null||c("Failed to toggle role","error"),c==null||c("Failed to update role","error")}},C=(b="",g="")=>`${b[0]||""}${g[0]||""}`.toUpperCase(),j=(b,g)=>{var S;return((S=b.roles)==null?void 0:S.some(k=>k.id===g))||!1};return r||m||w?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ie,{})}):e.jsxs(e.Fragment,{children:[e.jsx(ka,{children:e.jsx(bt,{value:h,onChange:d,placeholder:"Search members..."})}),z.length===0?e.jsx(st,{title:h?"No members match your search":"No members yet",description:"Invite members to your workspace to get started."}):e.jsxs(yt,{children:[e.jsx(wt,{children:e.jsxs(Be,{children:[e.jsx(_e,{children:"Member"}),e.jsx(_e,{children:"Joined"}),e.jsx(_e,{children:"Role"})]})}),e.jsx(jt,{children:z.map(b=>{var E,R;const g=b.public_user_data,S=b.roles||[],k=(g==null?void 0:g.id)===((E=f==null?void 0:f.active_signin)==null?void 0:E.user_id);return e.jsxs(Be,{children:[e.jsx(il,{children:e.jsxs("div",{children:[e.jsx(_x,{children:g&&g.profile_picture_url?e.jsx("img",{src:g.profile_picture_url,alt:`${g.first_name||""} ${g.last_name||""}`,style:{width:"100%",height:"100%",objectFit:"cover"}}):C(g==null?void 0:g.first_name,g==null?void 0:g.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 O;if(!g)return"Unknown User";const $=`${g.first_name||""} ${g.last_name||""}`.trim();return $||((O=g.primary_email_address)==null?void 0:O.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:(R=g==null?void 0:g.primary_email_address)==null?void 0:R.email})]})]})}),e.jsx(Oe,{children:new Date(b.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),e.jsx(kt,{children:e.jsxs(rt,{children:[e.jsx(nt,{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:S.length>0?S[0].name:"No role"}),e.jsx(Xt,{size:14})]})}),e.jsxs(ot,{children:[_.map($=>{const O=j(b,$.id);return e.jsx(Ee,{onClick:()=>I(b.id,$.id,O),children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[e.jsx("span",{children:$.name}),O&&e.jsx(tt,{size:16,color:"var(--color-success)"})]})},$.id)}),e.jsx(Jo,{}),e.jsx(Ee,{$destructive:!0,onClick:()=>y(b.id),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Qo,{size:16,color:"var(--color-error)"}),e.jsx("span",{children:"Remove Member"})]})})]})]})})]},b.id)})})]})]})},Rx=()=>{const{activeWorkspace:t,loading:r,updateWorkspace:o}=zt(),{deleteWorkspace:n}=vt(),{toast:a}=i.useContext(_r)||{},[s,p]=i.useState((t==null?void 0:t.name)||""),[f,c]=i.useState((t==null?void 0:t.description)||""),[h,d]=i.useState(null),[u,m]=i.useState((t==null?void 0:t.image_url)||null),[v,x]=i.useState(!1),[w,_]=i.useState(!1),[z,y]=i.useState(""),[I,C]=i.useState(!1),[j,b]=i.useState(!1),g=i.useRef(null),S=i.useRef(null);if(i.useEffect(()=>{t&&(p(t.name||""),c(t.description||""),m(t.image_url||null))},[t]),r||!t)return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ie,{})});const k=D=>{var B;if((B=D.target.files)!=null&&B[0]){const oe=D.target.files[0];d(oe),m(URL.createObjectURL(oe)),setTimeout(()=>R(),100)}},E=()=>{g.current&&g.current.click()},R=i.useCallback(async()=>{if(!(!t||w))try{_(!0);const D={};h&&(D.image=h,d(null)),s!==t.name&&(D.name=s),f!==t.description&&(D.description=f),Object.keys(D).length>0&&(await o(D),x(!0),setTimeout(()=>x(!1),3e3))}catch{a==null||a("Failed to auto-save workspace","error")}finally{_(!1)}},[t,o,s,f,h,w]),$=i.useCallback(()=>{S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{R()},1e3)},[R]),O=D=>{p(D.target.value),$()},P=D=>{c(D.target.value),$()},T=()=>{S.current&&clearTimeout(S.current),R()},N=()=>{S.current&&clearTimeout(S.current),R()},A=async()=>{if(!(!t||z!==t.name))try{C(!0),await n(t),a==null||a("Workspace deleted successfully","info")}catch(D){a==null||a(D.message||"Failed to delete workspace","error")}finally{C(!1),y(""),b(!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:u?"transparent":"var(--color-input-background)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"all 0.2s ease"},onClick:E,onMouseEnter:D=>{D.currentTarget.style.borderColor="var(--color-primary)",D.currentTarget.style.transform="scale(1.02)"},onMouseLeave:D=>{D.currentTarget.style.borderColor="var(--color-border)",D.currentTarget.style.transform="scale(1)"},children:[u?e.jsx("img",{src:u,alt:"Workspace Logo",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}):e.jsx(Dr,{size:32,color:"var(--color-muted)"}),e.jsx("input",{type:"file",ref:g,style:{display:"none"},accept:"image/*",onChange:k})]})}),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 D;return(D=g.current)==null?void 0:D.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(Dr,{size:14}),u?"Change":"Upload"]}),e.jsxs(X,{onClick:()=>{m(null),d(null),g.current&&(g.current.value=""),setTimeout(()=>R(),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(Qo,{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(fe,{children:[e.jsx(he,{htmlFor:"name",children:"Workspace Name"}),e.jsx(le,{id:"name",type:"text",value:s,onChange:O,onBlur:T,placeholder:"Enter workspace name",required:!0})]}),e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"description",children:"Description"}),e.jsx(le,{id:"description",as:"textarea",value:f,onChange:P,onBlur:N,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"})]})]})]}),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:j?"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:()=>{j?(b(!1),y("")):b(!0)},style:{background:"var(--color-error)",color:"white",border:"none",padding:"6px 12px",fontSize:"13px",height:"32px",width:"auto"},children:j?"Cancel":"Delete"})]}),j&&e.jsxs("div",{children:[e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"confirm_workspace_name",children:"Confirm by typing the workspace name"}),e.jsx(le,{id:"confirm_workspace_name",type:"text",value:z,onChange:D=>y(D.target.value),placeholder:`Type "${t==null?void 0:t.name}" to confirm`})]}),e.jsx(X,{onClick:A,disabled:z!==(t==null?void 0:t.name)||I,style:{background:z===(t==null?void 0:t.name)?"var(--color-error)":"transparent",color:z===(t==null?void 0:t.name)?"white":"var(--color-muted)",border:"1px solid var(--color-border)",padding:"8px 16px",fontSize:"14px",height:"36px",cursor:z===(t==null?void 0:t.name)?"pointer":"not-allowed",opacity:z===(t==null?void 0:t.name)?1:.6,marginTop:"12px"},children:I?e.jsx(Ie,{size:12}):"Delete Forever"})]})]})]})]}),v&&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:`
|
|
3146
|
+
`,Px=()=>{const{activeWorkspace:t,loading:r,getRoles:o}=zt(),{workspaces:n}=vt(),{client:a}=Me(),s=n==null?void 0:n.find($=>$.id===(t==null?void 0:t.id)),[p,f]=i.useState(!0),[c,h]=i.useState(!0),[d,u]=i.useState(""),[m,v]=i.useState(""),[x,w]=i.useState([]),[_,z]=i.useState([]),[y,P]=i.useState(!1),C=i.useRef(null),j=i.useCallback(async()=>{if(!t||!s)return[];try{return(await V(await a(`/organizations/${s.organization.id}/invitations`,{method:"GET"}))).data.filter(I=>I.workspace_id===t.id)}catch{return[]}},[a,t,s]),b=i.useCallback(async($,O)=>{if(!t||!s)return;const T=(await V(await a(`/organizations/${s.organization.id}/roles`,{method:"GET"}))).data,N=T.find(D=>!D.organization_id)||T[0];return(await V(await a(`/organizations/${s.organization.id}/invitations`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:$,role_id:N==null?void 0:N.id,workspace_id:t.id,workspace_role_id:O})}))).data},[a,t,s]),g=i.useCallback(async $=>!t||!s?void 0:(await V(await a(`/organizations/${s.organization.id}/invitations/${$}/remove`,{method:"POST"}))).data,[a,t,s]);i.useEffect(()=>{if(!t)return;(async()=>{f(!0),h(!0);try{const[O,I]=await Promise.all([o(),j()]);z(O),w(I)}catch{}finally{f(!1),h(!1)}})()},[t==null?void 0:t.id]);const S=async $=>{try{await g($.id);const O=await j();w(O)}catch{}},k=async $=>{var O;try{await g($.id),await b($.email,$.workspace_role_id||((O=$.initial_workspace_role)==null?void 0:O.id)||$.role_id);const I=await j();w(I),v("Invitation resent successfully"),setTimeout(()=>v(""),3e3)}catch{}},E=async()=>{P(!1);const $=await j();w($),v("Invitation sent successfully"),setTimeout(()=>v(""),3e3)},R=i.useMemo(()=>d?x.filter($=>($.email||"").toLowerCase().includes(d.toLowerCase())):x,[x,d]);return r||p||c?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Pe,{})}):e.jsxs(e.Fragment,{children:[m&&e.jsxs("div",{style:{marginBottom:"16px",padding:"12px 16px",background:"var(--color-success-background)",color:"var(--color-success)",borderRadius:"6px",fontSize:"14px"},children:["✓ ",m]}),e.jsxs(ka,{children:[e.jsx(bt,{value:d,onChange:u,placeholder:"Search Invitation"}),e.jsxs("div",{children:[e.jsx(X,{ref:C,onClick:()=>P(!y),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"Invite Members"}),y&&e.jsx(px,{onClose:()=>P(!1),onSuccess:E,roles:_,createInvitation:b,triggerRef:C})]})]}),e.jsx("div",{children:R.length===0?e.jsx(st,{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:R.map($=>{var O,I,T;return e.jsxs(kx,{children:[e.jsx(_x,{children:e.jsxs(Sx,{children:[e.jsx($x,{children:$.email}),e.jsx(zx,{children:((O=$.initial_workspace_role)==null?void 0:O.name)||((I=$.initial_organization_role)==null?void 0:I.name)||((T=$.role)==null?void 0:T.name)})]})}),e.jsx(Ex,{children:e.jsxs(rt,{children:[e.jsx(nt,{children:e.jsx(hl,{children:"•••"})}),e.jsxs(ot,{children:[e.jsx(Ee,{onClick:()=>k($),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Ur,{size:16,color:"var(--color-muted)"}),e.jsx("span",{children:"Resend Invitation"})]})}),e.jsx(Ee,{$destructive:!0,onClick:()=>S($),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Qo,{size:16,color:"var(--color-error)"}),e.jsx("span",{children:"Cancel Invitation"})]})})]})]})})]},$.id)})})})]})},Rx=()=>{const{activeWorkspace:t,loading:r,getMembers:o,getRoles:n,removeMember:a,addMemberRole:s,removeMemberRole:p}=zt(),{session:f}=Ue(),{toast:c}=i.useContext(_r)||{},[h,d]=i.useState(""),{data:u=[],isLoading:m,mutate:v}=We(t?`/api/workspaces/${t.id}/members`:null,()=>o()||[]),{data:x=[],isLoading:w}=We(t?`/api/workspaces/${t.id}/roles`:null,()=>n()||[]),_=x,z=i.useMemo(()=>h?u.filter(b=>{var $;const g=b.public_user_data;if(!g)return!1;const S=g.first_name||"",k=g.last_name||"",E=(($=g.primary_email_address)==null?void 0:$.email)||"";return`${S} ${k}`.trim().toLowerCase().includes(h.toLowerCase())||E.toLowerCase().includes(h.toLowerCase())}):u,[u,h]),y=async b=>{try{await a(b),c==null||c("Member removed successfully","info"),v()}catch{c==null||c("Failed to remove member","error")}},P=async(b,g,S)=>{try{S?(await p(b,g),c==null||c("Role removed successfully","info")):(await s(b,g),c==null||c("Role added successfully","info")),v()}catch{c==null||c("Failed to toggle role","error"),c==null||c("Failed to update role","error")}},C=(b="",g="")=>`${b[0]||""}${g[0]||""}`.toUpperCase(),j=(b,g)=>{var S;return((S=b.roles)==null?void 0:S.some(k=>k.id===g))||!1};return r||m||w?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Pe,{})}):e.jsxs(e.Fragment,{children:[e.jsx(ka,{children:e.jsx(bt,{value:h,onChange:d,placeholder:"Search members..."})}),z.length===0?e.jsx(st,{title:h?"No members match your search":"No members yet",description:"Invite members to your workspace to get started."}):e.jsxs(yt,{children:[e.jsx(wt,{children:e.jsxs(Be,{children:[e.jsx(_e,{children:"Member"}),e.jsx(_e,{children:"Joined"}),e.jsx(_e,{children:"Role"})]})}),e.jsx(jt,{children:z.map(b=>{var E,R;const g=b.public_user_data,S=b.roles||[],k=(g==null?void 0:g.id)===((E=f==null?void 0:f.active_signin)==null?void 0:E.user_id);return e.jsxs(Be,{children:[e.jsx(il,{children:e.jsxs("div",{children:[e.jsx(Cx,{children:g&&g.profile_picture_url?e.jsx("img",{src:g.profile_picture_url,alt:`${g.first_name||""} ${g.last_name||""}`,style:{width:"100%",height:"100%",objectFit:"cover"}}):C(g==null?void 0:g.first_name,g==null?void 0:g.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 O;if(!g)return"Unknown User";const $=`${g.first_name||""} ${g.last_name||""}`.trim();return $||((O=g.primary_email_address)==null?void 0:O.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:(R=g==null?void 0:g.primary_email_address)==null?void 0:R.email})]})]})}),e.jsx(Oe,{children:new Date(b.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),e.jsx(kt,{children:e.jsxs(rt,{children:[e.jsx(nt,{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:S.length>0?S[0].name:"No role"}),e.jsx(Xt,{size:14})]})}),e.jsxs(ot,{children:[_.map($=>{const O=j(b,$.id);return e.jsx(Ee,{onClick:()=>P(b.id,$.id,O),children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[e.jsx("span",{children:$.name}),O&&e.jsx(tt,{size:16,color:"var(--color-success)"})]})},$.id)}),e.jsx(Jo,{}),e.jsx(Ee,{$destructive:!0,onClick:()=>y(b.id),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Qo,{size:16,color:"var(--color-error)"}),e.jsx("span",{children:"Remove Member"})]})})]})]})})]},b.id)})})]})]})},Ix=()=>{const{activeWorkspace:t,loading:r,updateWorkspace:o}=zt(),{deleteWorkspace:n}=vt(),{toast:a}=i.useContext(_r)||{},[s,p]=i.useState((t==null?void 0:t.name)||""),[f,c]=i.useState((t==null?void 0:t.description)||""),[h,d]=i.useState(null),[u,m]=i.useState((t==null?void 0:t.image_url)||null),[v,x]=i.useState(!1),[w,_]=i.useState(!1),[z,y]=i.useState(""),[P,C]=i.useState(!1),[j,b]=i.useState(!1),g=i.useRef(null),S=i.useRef(null);if(i.useEffect(()=>{t&&(p(t.name||""),c(t.description||""),m(t.image_url||null))},[t]),r||!t)return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Pe,{})});const k=D=>{var B;if((B=D.target.files)!=null&&B[0]){const oe=D.target.files[0];d(oe),m(URL.createObjectURL(oe)),setTimeout(()=>R(),100)}},E=()=>{g.current&&g.current.click()},R=i.useCallback(async()=>{if(!(!t||w))try{_(!0);const D={};h&&(D.image=h,d(null)),s!==t.name&&(D.name=s),f!==t.description&&(D.description=f),Object.keys(D).length>0&&(await o(D),x(!0),setTimeout(()=>x(!1),3e3))}catch{a==null||a("Failed to auto-save workspace","error")}finally{_(!1)}},[t,o,s,f,h,w]),$=i.useCallback(()=>{S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{R()},1e3)},[R]),O=D=>{p(D.target.value),$()},I=D=>{c(D.target.value),$()},T=()=>{S.current&&clearTimeout(S.current),R()},N=()=>{S.current&&clearTimeout(S.current),R()},L=async()=>{if(!(!t||z!==t.name))try{C(!0),await n(t),a==null||a("Workspace deleted successfully","info")}catch(D){a==null||a(D.message||"Failed to delete workspace","error")}finally{C(!1),y(""),b(!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:u?"transparent":"var(--color-input-background)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"all 0.2s ease"},onClick:E,onMouseEnter:D=>{D.currentTarget.style.borderColor="var(--color-primary)",D.currentTarget.style.transform="scale(1.02)"},onMouseLeave:D=>{D.currentTarget.style.borderColor="var(--color-border)",D.currentTarget.style.transform="scale(1)"},children:[u?e.jsx("img",{src:u,alt:"Workspace Logo",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}):e.jsx(Dr,{size:32,color:"var(--color-muted)"}),e.jsx("input",{type:"file",ref:g,style:{display:"none"},accept:"image/*",onChange:k})]})}),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 D;return(D=g.current)==null?void 0:D.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(Dr,{size:14}),u?"Change":"Upload"]}),e.jsxs(X,{onClick:()=>{m(null),d(null),g.current&&(g.current.value=""),setTimeout(()=>R(),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(Qo,{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(fe,{children:[e.jsx(he,{htmlFor:"name",children:"Workspace Name"}),e.jsx(le,{id:"name",type:"text",value:s,onChange:O,onBlur:T,placeholder:"Enter workspace name",required:!0})]}),e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"description",children:"Description"}),e.jsx(le,{id:"description",as:"textarea",value:f,onChange:I,onBlur:N,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"})]})]})]}),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:j?"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:()=>{j?(b(!1),y("")):b(!0)},style:{background:"var(--color-error)",color:"white",border:"none",padding:"6px 12px",fontSize:"13px",height:"32px",width:"auto"},children:j?"Cancel":"Delete"})]}),j&&e.jsxs("div",{children:[e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"confirm_workspace_name",children:"Confirm by typing the workspace name"}),e.jsx(le,{id:"confirm_workspace_name",type:"text",value:z,onChange:D=>y(D.target.value),placeholder:`Type "${t==null?void 0:t.name}" to confirm`})]}),e.jsx(X,{onClick:L,disabled:z!==(t==null?void 0:t.name)||P,style:{background:z===(t==null?void 0:t.name)?"var(--color-error)":"transparent",color:z===(t==null?void 0:t.name)?"white":"var(--color-muted)",border:"1px solid var(--color-border)",padding:"8px 16px",fontSize:"14px",height:"36px",cursor:z===(t==null?void 0:t.name)?"pointer":"not-allowed",opacity:z===(t==null?void 0:t.name)?1:.6,marginTop:"12px"},children:P?e.jsx(Pe,{size:12}):"Delete Forever"})]})]})]})]}),v&&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:`
|
|
3147
3147
|
@keyframes slideUp {
|
|
3148
3148
|
from {
|
|
3149
3149
|
opacity: 0;
|
|
@@ -3154,12 +3154,12 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3154
3154
|
transform: translateX(-50%) translateY(0);
|
|
3155
3155
|
}
|
|
3156
3156
|
}
|
|
3157
|
-
`})]})},
|
|
3157
|
+
`})]})},Tx=()=>{const{activeWorkspace:t,loading:r,getRoles:o,createRole:n,deleteRole:a}=zt(),{toast:s}=i.useContext(_r)||{},[p,f]=i.useState(""),[c,h]=i.useState({isOpen:!1}),[d,u]=i.useState(null),[m,v]=i.useState(null),x=i.useRef(null),w=i.useRef(new Map),{data:_=[],isLoading:z,mutate:y}=We(t?`/api/workspaces/${t.id}/roles`:null,()=>o()||[]),P=i.useMemo(()=>p?_.filter(b=>b.name.toLowerCase().includes(p.toLowerCase())):_,[_,p]),C=async b=>{try{await n(b.name,b.permissions||[]),s==null||s("Role created successfully","info"),h({isOpen:!1}),y()}catch{s==null||s("Failed to save role","error"),s==null||s("Failed to create role","error")}},j=async b=>{try{await a(b),s==null||s("Role deleted successfully","info"),v(null),y()}catch{s==null||s("Failed to delete role","error"),s==null||s("Failed to delete role","error")}};return r||z?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Pe,{})}):e.jsxs(e.Fragment,{children:[e.jsxs(ka,{children:[e.jsx(bt,{placeholder:"Search roles",onChange:f,value:p}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:x,onClick:()=>h({isOpen:!0,triggerElement:x.current}),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"Add role"}),c.isOpen&&!c.role&&e.jsx(As,{role:c.role,triggerRef:{current:c.triggerElement||null},onClose:()=>h({isOpen:!1}),onSuccess:C})]})]}),P.length===0?e.jsx(st,{title:p?"No roles match your search":"No roles available",description:p?"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(yt,{children:[e.jsx(wt,{children:e.jsxs(Be,{children:[e.jsx(_e,{children:"Role"}),e.jsx(_e,{children:"Permissions"}),e.jsx(_e,{})]})}),e.jsx(jt,{children:P.map(b=>{var g;return e.jsxs(Be,{children:[e.jsx(Oe,{children:e.jsx("div",{style:{fontSize:"14px",fontWeight:500},children:b.name})}),e.jsx(Oe,{style:{color:"var(--color-secondary-text)"},children:b.permissions&&b.permissions.length>0?b.permissions.join(", "):""}),e.jsx(kt,{children:e.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center",justifyContent:"flex-end",position:"relative"},children:[e.jsxs(rt,{open:d===b.id,openChange:S=>u(S?b.id:null),children:[e.jsx(nt,{children:e.jsx(hl,{ref:S=>{S&&w.current.set(b.id,S)},disabled:!b.workspace_id,"data-role-dropdown-trigger":b.id,children:"•••"})}),e.jsxs(ot,{children:[e.jsx(Ee,{onClick:()=>{u(null);const S=w.current.get(b.id);h({isOpen:!0,role:b,triggerElement:S||null})},children:"Edit Role"}),e.jsx(Ee,{$destructive:!0,onClick:()=>{u(null),v(b.id)},children:"Remove Role"})]})]}),m===b.id&&e.jsx(ya,{title:"Are you sure you want to delete this role?",onConfirm:()=>j(b),onCancel:()=>v(null)}),c.isOpen&&((g=c.role)==null?void 0:g.id)===b.id&&e.jsx(As,{role:c.role,triggerRef:{current:c.triggerElement||null},onClose:()=>{h({isOpen:!1}),u(null)},onSuccess:C})]})})]},b.id)})})]})})]})},fl=()=>{const{activeWorkspace:t,loading:r}=zt(),[o,n]=i.useState("general"),[a,s]=i.useState(null),[p,f]=i.useState("info"),c=i.useCallback((h,d="info")=>{s(h),f(d),setTimeout(()=>s(null),3e3)},[]);return r?e.jsx(Ds,{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(Pe,{})}):t?e.jsx(_r.Provider,{value:{screen:null,setScreen:()=>{},toast:c},children:e.jsx(bx,{children:e.jsxs(Ds,{children:[e.jsx(yx,{children:e.jsxs(wx,{children:[e.jsx(uo,{$isActive:o==="general",onClick:()=>n("general"),children:e.jsxs(po,{children:[e.jsx(Zt,{size:16}),"General"]})}),e.jsx(uo,{$isActive:o==="members",onClick:()=>n("members"),children:e.jsxs(po,{children:[e.jsx(Nc,{size:16}),"Members"]})}),e.jsx(uo,{$isActive:o==="invitations",onClick:()=>n("invitations"),children:e.jsxs(po,{children:[e.jsx(Dc,{size:16}),"Invitations"]})}),e.jsx(uo,{$isActive:o==="roles",onClick:()=>n("roles"),children:e.jsxs(po,{children:[e.jsx(Ko,{size:16}),"Roles"]})})]})}),e.jsxs(jx,{children:[o==="general"&&e.jsx(Ix,{}),o==="members"&&e.jsx(Rx,{}),o==="invitations"&&e.jsx(Px,{}),o==="roles"&&e.jsx(Tx,{})]}),a&&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:[p==="error"?e.jsx(Pt,{size:16,color:"var(--color-error)"}):e.jsx(tt,{size:16,color:"var(--color-success)"}),e.jsx("span",{style:{fontSize:"14px",color:"var(--color-foreground)"},children:a})]})})]})})}):null},gl=({isOpen:t,onClose:r,title:o,showHeader:n,headerContent:a,footerContent:s,customContent:p,children:f,showCloseButton:c})=>e.jsx(ye,{isOpen:t,onClose:r,children:e.jsx(ye.Overlay,{children:e.jsxs(ye.Content,{style:{width:"900px",maxWidth:"100%"},children:[n&&e.jsx(ye.Header,{showCloseButton:c,children:a||o}),p||f||e.jsx(fl,{}),s&&e.jsx(ye.Footer,{children:s})]})})}),Ns=l.div`
|
|
3158
3158
|
position: relative;
|
|
3159
3159
|
display: inline-block;
|
|
3160
3160
|
width: 100%;
|
|
3161
3161
|
max-width: 300px;
|
|
3162
|
-
`,
|
|
3162
|
+
`,Ox=l.button`
|
|
3163
3163
|
display: flex;
|
|
3164
3164
|
align-items: center;
|
|
3165
3165
|
justify-content: space-between;
|
|
@@ -3181,7 +3181,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3181
3181
|
cursor: not-allowed;
|
|
3182
3182
|
opacity: 0.7;
|
|
3183
3183
|
}
|
|
3184
|
-
`,
|
|
3184
|
+
`,Mx=l.div`
|
|
3185
3185
|
width: 20px;
|
|
3186
3186
|
height: 20px;
|
|
3187
3187
|
border-radius: 50%;
|
|
@@ -3194,7 +3194,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3194
3194
|
font-size: 11px;
|
|
3195
3195
|
font-weight: 600;
|
|
3196
3196
|
flex-shrink: 0;
|
|
3197
|
-
`,
|
|
3197
|
+
`,Lx=l.img`
|
|
3198
3198
|
width: 100%;
|
|
3199
3199
|
height: 100%;
|
|
3200
3200
|
object-fit: cover;
|
|
@@ -3209,7 +3209,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3209
3209
|
text-overflow: ellipsis;
|
|
3210
3210
|
white-space: nowrap;
|
|
3211
3211
|
color: var(--color-foreground);
|
|
3212
|
-
`,
|
|
3212
|
+
`,Dx=l.div`
|
|
3213
3213
|
position: fixed;
|
|
3214
3214
|
top: ${t=>{var r;return((r=t.$position)==null?void 0:r.top)??-9999}}px;
|
|
3215
3215
|
left: ${t=>{var r;return((r=t.$position)==null?void 0:r.left)??-9999}}px;
|
|
@@ -3230,7 +3230,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3230
3230
|
opacity 0.15s ease,
|
|
3231
3231
|
transform 0.15s ease,
|
|
3232
3232
|
visibility 0s linear ${t=>t.$isOpen?"0s":"0.15s"};
|
|
3233
|
-
`,
|
|
3233
|
+
`,Po=l.div`
|
|
3234
3234
|
display: flex;
|
|
3235
3235
|
align-items: center;
|
|
3236
3236
|
justify-content: space-between;
|
|
@@ -3321,7 +3321,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3321
3321
|
background: var(--color-background-hover);
|
|
3322
3322
|
color: var(--color-foreground);
|
|
3323
3323
|
}
|
|
3324
|
-
`,
|
|
3324
|
+
`,Ln=l(Ro)`
|
|
3325
3325
|
&:hover:not(:disabled) {
|
|
3326
3326
|
background: var(--color-error-background);
|
|
3327
3327
|
color: var(--color-error);
|
|
@@ -3374,7 +3374,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3374
3374
|
left: 8px;
|
|
3375
3375
|
top: 50%;
|
|
3376
3376
|
transform: translateY(-50%);
|
|
3377
|
-
`,
|
|
3377
|
+
`,Nx=l.div`
|
|
3378
3378
|
width: 20px;
|
|
3379
3379
|
height: 20px;
|
|
3380
3380
|
border-radius: 50%;
|
|
@@ -3384,11 +3384,11 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3384
3384
|
justify-content: center;
|
|
3385
3385
|
color: var(--color-secondary-text);
|
|
3386
3386
|
overflow: hidden;
|
|
3387
|
-
`,
|
|
3387
|
+
`,Fx=l.img`
|
|
3388
3388
|
width: 100%;
|
|
3389
3389
|
height: 100%;
|
|
3390
3390
|
object-fit: cover;
|
|
3391
|
-
`,mo=l(
|
|
3391
|
+
`,mo=l(Po)`
|
|
3392
3392
|
padding-left: 40px;
|
|
3393
3393
|
font-size: 11px;
|
|
3394
3394
|
`,Gs=l.div`
|
|
@@ -3415,7 +3415,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3415
3415
|
display: flex;
|
|
3416
3416
|
align-items: center;
|
|
3417
3417
|
gap: 6px;
|
|
3418
|
-
`,
|
|
3418
|
+
`,Bx=l.div`
|
|
3419
3419
|
width: 12px;
|
|
3420
3420
|
height: 12px;
|
|
3421
3421
|
border: 2px solid transparent;
|
|
@@ -3428,7 +3428,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3428
3428
|
transform: rotate(360deg);
|
|
3429
3429
|
}
|
|
3430
3430
|
}
|
|
3431
|
-
`,
|
|
3431
|
+
`,Ux=l.div`
|
|
3432
3432
|
padding: 8px 0;
|
|
3433
3433
|
`,xo=l.div`
|
|
3434
3434
|
display: flex;
|
|
@@ -3468,7 +3468,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3468
3468
|
background: var(--color-border);
|
|
3469
3469
|
border-radius: 4px;
|
|
3470
3470
|
width: ${t=>t.width||"60%"};
|
|
3471
|
-
`,
|
|
3471
|
+
`,Wx=l.div`
|
|
3472
3472
|
display: flex;
|
|
3473
3473
|
align-items: center;
|
|
3474
3474
|
justify-content: space-between;
|
|
@@ -3491,30 +3491,30 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3491
3491
|
opacity: 0.5;
|
|
3492
3492
|
}
|
|
3493
3493
|
}
|
|
3494
|
-
`,
|
|
3494
|
+
`,Vx=l.div`
|
|
3495
3495
|
width: 20px;
|
|
3496
3496
|
height: 20px;
|
|
3497
3497
|
border-radius: 50%;
|
|
3498
3498
|
background: var(--color-border);
|
|
3499
|
-
`,
|
|
3499
|
+
`,Gx=l.div`
|
|
3500
3500
|
height: 14px;
|
|
3501
3501
|
width: 120px;
|
|
3502
3502
|
background: var(--color-border);
|
|
3503
3503
|
border-radius: 4px;
|
|
3504
|
-
`,
|
|
3504
|
+
`,Hx=l.div`
|
|
3505
3505
|
width: 16px;
|
|
3506
3506
|
height: 16px;
|
|
3507
3507
|
background: var(--color-border);
|
|
3508
3508
|
border-radius: 2px;
|
|
3509
|
-
`,ml=({showPersonal:t=!0})=>{var Y,de,ue;const[r,o]=i.useState(!1),[n,a]=i.useState(!1),[s,p]=i.useState(new Set),[f,c]=i.useState(),h=i.useRef(null),d=i.useRef(null),u=Or(!1),m=Or(!1),v=Or(!1),x=Or(!1),[w,_]=i.useState(null),[z,y]=i.useState(!1),[
|
|
3509
|
+
`,ml=({showPersonal:t=!0})=>{var Y,de,ue;const[r,o]=i.useState(!1),[n,a]=i.useState(!1),[s,p]=i.useState(new Set),[f,c]=i.useState(),h=i.useRef(null),d=i.useRef(null),u=Or(!1),m=Or(!1),v=Or(!1),x=Or(!1),[w,_]=i.useState(null),[z,y]=i.useState(!1),[P,C]=i.useState(null),{organizationMemberships:j,loading:b,refetch:g}=tr(),{activeOrganization:S,leave:k}=Xe(),{activeWorkspace:E,leave:R}=zt(),{workspaces:$,loading:O}=vt(),{session:I,loading:T,switchOrganization:N,switchWorkspace:L}=Ue(),{deployment:D}=ve(),{toast:B}=at(),oe=D==null?void 0:D.b2b_settings.organizations_enabled,se=D==null?void 0:D.b2b_settings.workspaces_enabled,ne=D==null?void 0:D.b2b_settings.allow_users_to_create_orgs,K=!((Y=I==null?void 0:I.active_signin)!=null&&Y.active_organization_membership_id),U=i.useMemo(()=>{var M,W;if(K)return{name:"Personal account",image_url:(W=(M=I==null?void 0:I.active_signin)==null?void 0:M.user)==null?void 0:W.profile_picture_url,isPersonal:!0};let F=(S==null?void 0:S.name)||"";return se&&E&&(F=`${S==null?void 0:S.name} / ${E.name}`),{name:F,image_url:S==null?void 0:S.image_url,isPersonal:!1}},[K,S,E,I,se]);i.useEffect(()=>{if(!r)return;let F=null;const M=setTimeout(()=>{const W=A=>{var re,pe;const G=A.target;(re=d.current)!=null&&re.contains(G)||(pe=h.current)!=null&&pe.contains(G)||(o(!1),C(null))};document.addEventListener("mousedown",W),F=()=>{document.removeEventListener("mousedown",W)}},50);return()=>{clearTimeout(M),F==null||F()}},[r]),i.useEffect(()=>{r&&d.current?requestAnimationFrame(()=>{if(d.current){const F=d.current.getBoundingClientRect();c({top:F.bottom+8,left:F.left})}}):c(void 0)},[r]),i.useEffect(()=>{if(P){const F=setTimeout(()=>{C(null)},5e3);return()=>clearTimeout(F)}},[P]);const H=()=>{g()};if(!oe)return null;const Q=F=>{a(!0),N(F).finally(()=>{a(!1)})},ae=F=>{a(!0),L(F).finally(()=>{a(!1)})},te=F=>{const M=new Set(s);M.has(F)?M.delete(F):M.add(F),p(M)},ee=F=>F.split(" ").map(M=>M[0]).join("").toUpperCase().slice(0,2);return b||T?e.jsx(ie,{children:e.jsx(Ns,{children:e.jsxs(Wx,{children:[e.jsxs(Fs,{children:[e.jsx(Vx,{}),e.jsx(Gx,{})]}),e.jsx(Hx,{})]})})}):e.jsx(ie,{children:e.jsxs(Ns,{children:[e.jsxs(Ox,{ref:d,onClick:()=>{o(!r),r||C(null)},disabled:n,children:[e.jsxs(Fs,{children:[e.jsx(Mx,{children:U.image_url?e.jsx(Lx,{src:U.image_url,alt:U.name}):U.isPersonal?e.jsx(Mo,{size:12}):ee(U.name)}),e.jsx(Ax,{children:U.name})]}),e.jsx(th,{size:16})]}),typeof window<"u"&&Nr.createPortal(e.jsx(ie,{children:e.jsx(Dx,{ref:h,$isOpen:r,$position:f,children:b||O?e.jsxs(Ux,{children:[e.jsxs(xo,{children:[e.jsx(vo,{}),e.jsxs(bo,{children:[e.jsx(yo,{width:"120px"}),e.jsx(qs,{width:"80px"})]})]}),e.jsx(cr,{}),e.jsxs(xo,{children:[e.jsx(vo,{}),e.jsx(bo,{children:e.jsx(yo,{width:"100px"})})]}),e.jsx(cr,{}),e.jsxs(xo,{children:[e.jsx(vo,{}),e.jsxs(bo,{children:[e.jsx(yo,{width:"140px"}),e.jsx(qs,{width:"60px"})]})]}),e.jsx(cr,{}),e.jsxs(xo,{children:[e.jsx(vo,{}),e.jsx(bo,{children:e.jsx(yo,{width:"110px"})})]})]}):e.jsxs("div",{children:[t&&e.jsxs(e.Fragment,{children:[e.jsxs(Po,{as:"button",$isActive:K,onClick:F=>{F.stopPropagation(),K||Q()},disabled:n||K,children:[K&&e.jsx(go,{}),e.jsxs(pt,{children:[e.jsx(Nx,{children:(ue=(de=I==null?void 0:I.active_signin)==null?void 0:de.user)!=null&&ue.profile_picture_url?e.jsx(Fx,{src:I.active_signin.user.profile_picture_url,alt:"Personal account"}):e.jsx(Mo,{size:12})}),e.jsx(ht,{children:e.jsx(ft,{children:"Personal account"})})]}),!K&&e.jsx(ho,{className:"hover-arrow",size:14})]}),!K&&S&&e.jsx(cr,{})]}),!K&&S&&e.jsxs(Po,{$isActive:!0,onClick:()=>{se&&te(S.id)},style:n?{pointerEvents:"none",opacity:.7}:void 0,children:[e.jsx(go,{}),e.jsxs(pt,{children:[se&&e.jsx(Xt,{size:12,style:{marginRight:"4px",transform:s.has(S.id)?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",color:"var(--color-secondary-text)"}}),e.jsx(Bs,{children:S.image_url?e.jsx(Us,{src:S.image_url,alt:S.name}):ee(S.name)}),e.jsxs(ht,{children:[e.jsx(ft,{children:S.name}),(()=>{const F=j==null?void 0:j.find(M=>M.organization.id===S.id);return F!=null&&F.role&&F.role.length>0?e.jsx(Ws,{children:F.role[0].name==="owner"?"Owner":F.role[0].name==="admin"?"Admin":"Member"}):null})()]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Ro,{onClick:F=>{F.stopPropagation(),m.open()},title:"Manage organization",children:e.jsx(Zt,{size:12})}),e.jsx(Ln,{onClick:async F=>{F.stopPropagation(),y(!0),C(null);try{await k(),await g(),setTimeout(()=>{y(!1)},500)}catch(M){C(M instanceof Error?M.message:"Failed to leave organization"),y(!1)}},disabled:z,title:"Leave organization",children:e.jsx(St,{size:12})})]})]}),S&&se&&s.has(S.id)&&e.jsxs(e.Fragment,{children:[$==null?void 0:$.filter(F=>F.organization.id===S.id).map(F=>{const M=(E==null?void 0:E.id)===F.id;return e.jsxs(mo,{as:M?void 0:"button",$isActive:M,onClick:M?void 0:()=>ae(F.id),...M?{style:n?{pointerEvents:"none",opacity:.7}:void 0}:{disabled:n},children:[M&&e.jsx(go,{}),e.jsxs(pt,{children:[e.jsx(Gs,{children:F.image_url?e.jsx("img",{src:F.image_url,alt:F.name,style:{width:"100%",height:"100%",objectFit:"cover"}}):ee(F.name).charAt(0)}),e.jsx(ht,{children:e.jsx(ft,{children:F.name})})]}),M?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Ro,{onClick:W=>{W.stopPropagation(),x.open()},title:"Manage workspace",children:e.jsx(Zt,{size:12})}),e.jsx(Ln,{onClick:async W=>{W.stopPropagation();try{R&&await R()}catch(A){const G=A.message||"Failed to leave workspace. Please try again.";B(G,"error")}},title:"Leave workspace",children:e.jsx(St,{size:12})})]}):e.jsx(ho,{className:"hover-arrow",size:14})]},F.id)}),e.jsx(mo,{as:"button",onClick:()=>{_(S.id),v.open()},disabled:n,children:e.jsxs(pt,{children:[e.jsx(fo,{style:{width:"14px",height:"14px"},children:e.jsx(lt,{size:12})}),e.jsx(ht,{children:e.jsx(ft,{children:"Create workspace"})})]})})]}),(z||P)&&e.jsxs(e.Fragment,{children:[z&&e.jsxs(Hs,{children:[e.jsx(Bx,{}),"Leaving organization..."]}),P&&e.jsxs(Hs,{$isError:!0,children:[e.jsx("span",{children:"⚠️"}),P]})]}),e.jsx(cr,{}),j&&j.length>0&&e.jsx(e.Fragment,{children:j.filter(F=>F.organization.id!==(S==null?void 0:S.id)).map(F=>{const M=F.organization,W=($==null?void 0:$.filter(G=>G.organization.id===M.id))||[],A=s.has(M.id);return e.jsxs(i.Fragment,{children:[e.jsxs(Po,{as:"button",$isActive:!1,onClick:()=>{se?te(M.id):Q(M.id)},disabled:n,children:[e.jsxs(pt,{children:[se&&e.jsx(Xt,{size:12,style:{marginRight:"4px",transform:A?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",color:"var(--color-secondary-text)"}}),e.jsx(Bs,{children:M.image_url?e.jsx(Us,{src:M.image_url,alt:M.name}):ee(M.name)}),e.jsxs(ht,{children:[e.jsx(ft,{children:M.name}),F.role&&F.role.length>0&&e.jsx(Ws,{children:F.role[0].name==="owner"?"Owner":F.role[0].name==="admin"?"Admin":"Member"})]})]}),e.jsx(ho,{className:"hover-arrow",size:14})]}),se&&A&&e.jsxs(e.Fragment,{children:[W.map(G=>{const re=(E==null?void 0:E.id)===G.id;return e.jsxs(mo,{as:re?void 0:"button",$isActive:re,onClick:re?void 0:()=>ae(G.id),...re?{style:n?{pointerEvents:"none",opacity:.7}:void 0}:{disabled:n},children:[re&&e.jsx(go,{}),e.jsxs(pt,{children:[e.jsx(Gs,{children:G.image_url?e.jsx("img",{src:G.image_url,alt:G.name,style:{width:"100%",height:"100%",objectFit:"cover"}}):ee(G.name).charAt(0)}),e.jsx(ht,{children:e.jsx(ft,{children:G.name})})]}),re?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Ro,{onClick:pe=>{pe.stopPropagation(),x.open()},title:"Manage workspace",children:e.jsx(Zt,{size:12})}),e.jsx(Ln,{onClick:async pe=>{pe.stopPropagation();try{R&&await R()}catch(we){const Te=we.message||"Failed to leave workspace. Please try again.";B(Te,"error")}},title:"Leave workspace",children:e.jsx(St,{size:12})})]}):e.jsx(ho,{className:"hover-arrow",size:16})]},G.id)}),e.jsx(mo,{as:"button",onClick:()=>{_(M.id),v.open()},disabled:n,children:e.jsxs(pt,{children:[e.jsx(fo,{style:{width:"14px",height:"14px"},children:e.jsx(lt,{size:10})}),e.jsx(ht,{children:e.jsx(ft,{children:"Create workspace"})})]})})]}),e.jsx(cr,{})]},M.id)})}),se?S&&e.jsx(Vs,{onClick:()=>{_(S.id),v.open()},disabled:n,children:e.jsxs(pt,{children:[e.jsx(fo,{children:e.jsx(lt,{size:12})}),e.jsx(ht,{children:e.jsx(ft,{children:"Create workspace"})})]})}):ne&&e.jsx(Vs,{onClick:()=>{u.open()},disabled:n,children:e.jsxs(pt,{children:[e.jsx(fo,{children:e.jsx(lt,{size:12})}),e.jsx(ht,{children:e.jsx(ft,{children:"Create organization"})})]})})]})})}),document.body),oe&&ne&&e.jsx(sm,{isOpen:u.isOpen,onClose:u.close,onCreated:H}),e.jsx(Mm,{isOpen:m.isOpen,onClose:m.close}),e.jsx(gl,{isOpen:x.isOpen,onClose:x.close}),w&&e.jsx(pl,{isOpen:v.isOpen,onClose:()=>{v.close(),_(null)},organizationId:w})]})})};var qx=Object.defineProperty,No=Object.getOwnPropertySymbols,xl=Object.prototype.hasOwnProperty,vl=Object.prototype.propertyIsEnumerable,Ys=(t,r,o)=>r in t?qx(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o,ca=(t,r)=>{for(var o in r||(r={}))xl.call(r,o)&&Ys(t,o,r[o]);if(No)for(var o of No(r))vl.call(r,o)&&Ys(t,o,r[o]);return t},la=(t,r)=>{var o={};for(var n in t)xl.call(t,n)&&r.indexOf(n)<0&&(o[n]=t[n]);if(t!=null&&No)for(var n of No(t))r.indexOf(n)<0&&vl.call(t,n)&&(o[n]=t[n]);return o};/**
|
|
3510
3510
|
* @license QR Code generator library (TypeScript)
|
|
3511
3511
|
* Copyright (c) Project Nayuki.
|
|
3512
3512
|
* SPDX-License-Identifier: MIT
|
|
3513
|
-
*/var Jt;(t=>{const r=class xe{constructor(c,h,d,u){if(this.version=c,this.errorCorrectionLevel=h,this.modules=[],this.isFunction=[],c<xe.MIN_VERSION||c>xe.MAX_VERSION)throw new RangeError("Version value out of range");if(u<-1||u>7)throw new RangeError("Mask value out of range");this.size=c*4+17;let m=[];for(let x=0;x<this.size;x++)m.push(!1);for(let x=0;x<this.size;x++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();const v=this.addEccAndInterleave(d);if(this.drawCodewords(v),u==-1){let x=1e9;for(let w=0;w<8;w++){this.applyMask(w),this.drawFormatBits(w);const _=this.getPenaltyScore();_<x&&(u=w,x=_),this.applyMask(w)}}a(0<=u&&u<=7),this.mask=u,this.applyMask(u),this.drawFormatBits(u),this.isFunction=[]}static encodeText(c,h){const d=t.QrSegment.makeSegments(c);return xe.encodeSegments(d,h)}static encodeBinary(c,h){const d=t.QrSegment.makeBytes(c);return xe.encodeSegments([d],h)}static encodeSegments(c,h,d=1,u=40,m=-1,v=!0){if(!(xe.MIN_VERSION<=d&&d<=u&&u<=xe.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let x,w;for(x=d;;x++){const I=xe.getNumDataCodewords(x,h)*8,C=p.getTotalBits(c,x);if(C<=I){w=C;break}if(x>=u)throw new RangeError("Data too long")}for(const I of[xe.Ecc.MEDIUM,xe.Ecc.QUARTILE,xe.Ecc.HIGH])v&&w<=xe.getNumDataCodewords(x,I)*8&&(h=I);let _=[];for(const I of c){o(I.mode.modeBits,4,_),o(I.numChars,I.mode.numCharCountBits(x),_);for(const C of I.getData())_.push(C)}a(_.length==w);const z=xe.getNumDataCodewords(x,h)*8;a(_.length<=z),o(0,Math.min(4,z-_.length),_),o(0,(8-_.length%8)%8,_),a(_.length%8==0);for(let I=236;_.length<z;I^=253)o(I,8,_);let y=[];for(;y.length*8<_.length;)y.push(0);return _.forEach((I,C)=>y[C>>>3]|=I<<7-(C&7)),new xe(x,h,y,m)}getModule(c,h){return 0<=c&&c<this.size&&0<=h&&h<this.size&&this.modules[h][c]}getModules(){return this.modules}drawFunctionPatterns(){for(let d=0;d<this.size;d++)this.setFunctionModule(6,d,d%2==0),this.setFunctionModule(d,6,d%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const c=this.getAlignmentPatternPositions(),h=c.length;for(let d=0;d<h;d++)for(let u=0;u<h;u++)d==0&&u==0||d==0&&u==h-1||d==h-1&&u==0||this.drawAlignmentPattern(c[d],c[u]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(c){const h=this.errorCorrectionLevel.formatBits<<3|c;let d=h;for(let m=0;m<10;m++)d=d<<1^(d>>>9)*1335;const u=(h<<10|d)^21522;a(u>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,n(u,m));this.setFunctionModule(8,7,n(u,6)),this.setFunctionModule(8,8,n(u,7)),this.setFunctionModule(7,8,n(u,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,n(u,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,n(u,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,n(u,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let c=this.version;for(let d=0;d<12;d++)c=c<<1^(c>>>11)*7973;const h=this.version<<12|c;a(h>>>18==0);for(let d=0;d<18;d++){const u=n(h,d),m=this.size-11+d%3,v=Math.floor(d/3);this.setFunctionModule(m,v,u),this.setFunctionModule(v,m,u)}}drawFinderPattern(c,h){for(let d=-4;d<=4;d++)for(let u=-4;u<=4;u++){const m=Math.max(Math.abs(u),Math.abs(d)),v=c+u,x=h+d;0<=v&&v<this.size&&0<=x&&x<this.size&&this.setFunctionModule(v,x,m!=2&&m!=4)}}drawAlignmentPattern(c,h){for(let d=-2;d<=2;d++)for(let u=-2;u<=2;u++)this.setFunctionModule(c+u,h+d,Math.max(Math.abs(u),Math.abs(d))!=1)}setFunctionModule(c,h,d){this.modules[h][c]=d,this.isFunction[h][c]=!0}addEccAndInterleave(c){const h=this.version,d=this.errorCorrectionLevel;if(c.length!=xe.getNumDataCodewords(h,d))throw new RangeError("Invalid argument");const u=xe.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][h],m=xe.ECC_CODEWORDS_PER_BLOCK[d.ordinal][h],v=Math.floor(xe.getNumRawDataModules(h)/8),x=u-v%u,w=Math.floor(v/u);let _=[];const z=xe.reedSolomonComputeDivisor(m);for(let I=0,C=0;I<u;I++){let j=c.slice(C,C+w-m+(I<x?0:1));C+=j.length;const b=xe.reedSolomonComputeRemainder(j,z);I<x&&j.push(0),_.push(j.concat(b))}let y=[];for(let I=0;I<_[0].length;I++)_.forEach((C,j)=>{(I!=w-m||j>=x)&&y.push(C[I])});return a(y.length==v),y}drawCodewords(c){if(c.length!=Math.floor(xe.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let h=0;for(let d=this.size-1;d>=1;d-=2){d==6&&(d=5);for(let u=0;u<this.size;u++)for(let m=0;m<2;m++){const v=d-m,w=(d+1&2)==0?this.size-1-u:u;!this.isFunction[w][v]&&h<c.length*8&&(this.modules[w][v]=n(c[h>>>3],7-(h&7)),h++)}}a(h==c.length*8)}applyMask(c){if(c<0||c>7)throw new RangeError("Mask value out of range");for(let h=0;h<this.size;h++)for(let d=0;d<this.size;d++){let u;switch(c){case 0:u=(d+h)%2==0;break;case 1:u=h%2==0;break;case 2:u=d%3==0;break;case 3:u=(d+h)%3==0;break;case 4:u=(Math.floor(d/3)+Math.floor(h/2))%2==0;break;case 5:u=d*h%2+d*h%3==0;break;case 6:u=(d*h%2+d*h%3)%2==0;break;case 7:u=((d+h)%2+d*h%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[h][d]&&u&&(this.modules[h][d]=!this.modules[h][d])}}getPenaltyScore(){let c=0;for(let m=0;m<this.size;m++){let v=!1,x=0,w=[0,0,0,0,0,0,0];for(let _=0;_<this.size;_++)this.modules[m][_]==v?(x++,x==5?c+=xe.PENALTY_N1:x>5&&c++):(this.finderPenaltyAddHistory(x,w),v||(c+=this.finderPenaltyCountPatterns(w)*xe.PENALTY_N3),v=this.modules[m][_],x=1);c+=this.finderPenaltyTerminateAndCount(v,x,w)*xe.PENALTY_N3}for(let m=0;m<this.size;m++){let v=!1,x=0,w=[0,0,0,0,0,0,0];for(let _=0;_<this.size;_++)this.modules[_][m]==v?(x++,x==5?c+=xe.PENALTY_N1:x>5&&c++):(this.finderPenaltyAddHistory(x,w),v||(c+=this.finderPenaltyCountPatterns(w)*xe.PENALTY_N3),v=this.modules[_][m],x=1);c+=this.finderPenaltyTerminateAndCount(v,x,w)*xe.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let v=0;v<this.size-1;v++){const x=this.modules[m][v];x==this.modules[m][v+1]&&x==this.modules[m+1][v]&&x==this.modules[m+1][v+1]&&(c+=xe.PENALTY_N2)}let h=0;for(const m of this.modules)h=m.reduce((v,x)=>v+(x?1:0),h);const d=this.size*this.size,u=Math.ceil(Math.abs(h*20-d*10)/d)-1;return a(0<=u&&u<=9),c+=u*xe.PENALTY_N4,a(0<=c&&c<=2568888),c}getAlignmentPatternPositions(){if(this.version==1)return[];{const c=Math.floor(this.version/7)+2,h=this.version==32?26:Math.ceil((this.version*4+4)/(c*2-2))*2;let d=[6];for(let u=this.size-7;d.length<c;u-=h)d.splice(1,0,u);return d}}static getNumRawDataModules(c){if(c<xe.MIN_VERSION||c>xe.MAX_VERSION)throw new RangeError("Version number out of range");let h=(16*c+128)*c+64;if(c>=2){const d=Math.floor(c/7)+2;h-=(25*d-10)*d-55,c>=7&&(h-=36)}return a(208<=h&&h<=29648),h}static getNumDataCodewords(c,h){return Math.floor(xe.getNumRawDataModules(c)/8)-xe.ECC_CODEWORDS_PER_BLOCK[h.ordinal][c]*xe.NUM_ERROR_CORRECTION_BLOCKS[h.ordinal][c]}static reedSolomonComputeDivisor(c){if(c<1||c>255)throw new RangeError("Degree out of range");let h=[];for(let u=0;u<c-1;u++)h.push(0);h.push(1);let d=1;for(let u=0;u<c;u++){for(let m=0;m<h.length;m++)h[m]=xe.reedSolomonMultiply(h[m],d),m+1<h.length&&(h[m]^=h[m+1]);d=xe.reedSolomonMultiply(d,2)}return h}static reedSolomonComputeRemainder(c,h){let d=h.map(u=>0);for(const u of c){const m=u^d.shift();d.push(0),h.forEach((v,x)=>d[x]^=xe.reedSolomonMultiply(v,m))}return d}static reedSolomonMultiply(c,h){if(c>>>8||h>>>8)throw new RangeError("Byte out of range");let d=0;for(let u=7;u>=0;u--)d=d<<1^(d>>>7)*285,d^=(h>>>u&1)*c;return a(d>>>8==0),d}finderPenaltyCountPatterns(c){const h=c[1];a(h<=this.size*3);const d=h>0&&c[2]==h&&c[3]==h*3&&c[4]==h&&c[5]==h;return(d&&c[0]>=h*4&&c[6]>=h?1:0)+(d&&c[6]>=h*4&&c[0]>=h?1:0)}finderPenaltyTerminateAndCount(c,h,d){return c&&(this.finderPenaltyAddHistory(h,d),h=0),h+=this.size,this.finderPenaltyAddHistory(h,d),this.finderPenaltyCountPatterns(d)}finderPenaltyAddHistory(c,h){h[0]==0&&(c+=this.size),h.pop(),h.unshift(c)}};r.MIN_VERSION=1,r.MAX_VERSION=40,r.PENALTY_N1=3,r.PENALTY_N2=3,r.PENALTY_N3=40,r.PENALTY_N4=10,r.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],r.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],t.QrCode=r;function o(f,c,h){if(c<0||c>31||f>>>c)throw new RangeError("Value out of range");for(let d=c-1;d>=0;d--)h.push(f>>>d&1)}function n(f,c){return(f>>>c&1)!=0}function a(f){if(!f)throw new Error("Assertion error")}const s=class Pe{constructor(c,h,d){if(this.mode=c,this.numChars=h,this.bitData=d,h<0)throw new RangeError("Invalid argument");this.bitData=d.slice()}static makeBytes(c){let h=[];for(const d of c)o(d,8,h);return new Pe(Pe.Mode.BYTE,c.length,h)}static makeNumeric(c){if(!Pe.isNumeric(c))throw new RangeError("String contains non-numeric characters");let h=[];for(let d=0;d<c.length;){const u=Math.min(c.length-d,3);o(parseInt(c.substring(d,d+u),10),u*3+1,h),d+=u}return new Pe(Pe.Mode.NUMERIC,c.length,h)}static makeAlphanumeric(c){if(!Pe.isAlphanumeric(c))throw new RangeError("String contains unencodable characters in alphanumeric mode");let h=[],d;for(d=0;d+2<=c.length;d+=2){let u=Pe.ALPHANUMERIC_CHARSET.indexOf(c.charAt(d))*45;u+=Pe.ALPHANUMERIC_CHARSET.indexOf(c.charAt(d+1)),o(u,11,h)}return d<c.length&&o(Pe.ALPHANUMERIC_CHARSET.indexOf(c.charAt(d)),6,h),new Pe(Pe.Mode.ALPHANUMERIC,c.length,h)}static makeSegments(c){return c==""?[]:Pe.isNumeric(c)?[Pe.makeNumeric(c)]:Pe.isAlphanumeric(c)?[Pe.makeAlphanumeric(c)]:[Pe.makeBytes(Pe.toUtf8ByteArray(c))]}static makeEci(c){let h=[];if(c<0)throw new RangeError("ECI assignment value out of range");if(c<128)o(c,8,h);else if(c<16384)o(2,2,h),o(c,14,h);else if(c<1e6)o(6,3,h),o(c,21,h);else throw new RangeError("ECI assignment value out of range");return new Pe(Pe.Mode.ECI,0,h)}static isNumeric(c){return Pe.NUMERIC_REGEX.test(c)}static isAlphanumeric(c){return Pe.ALPHANUMERIC_REGEX.test(c)}getData(){return this.bitData.slice()}static getTotalBits(c,h){let d=0;for(const u of c){const m=u.mode.numCharCountBits(h);if(u.numChars>=1<<m)return 1/0;d+=4+m+u.bitData.length}return d}static toUtf8ByteArray(c){c=encodeURI(c);let h=[];for(let d=0;d<c.length;d++)c.charAt(d)!="%"?h.push(c.charCodeAt(d)):(h.push(parseInt(c.substring(d+1,d+3),16)),d+=2);return h}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let p=s;t.QrSegment=s})(Jt||(Jt={}));(t=>{(r=>{const o=class{constructor(a,s){this.ordinal=a,this.formatBits=s}};o.LOW=new o(0,1),o.MEDIUM=new o(1,0),o.QUARTILE=new o(2,3),o.HIGH=new o(3,2),r.Ecc=o})(t.QrCode||(t.QrCode={}))})(Jt||(Jt={}));(t=>{(r=>{const o=class{constructor(a,s){this.modeBits=a,this.numBitsCharCount=s}numCharCountBits(a){return this.numBitsCharCount[Math.floor((a+7)/17)]}};o.NUMERIC=new o(1,[10,12,14]),o.ALPHANUMERIC=new o(2,[9,11,13]),o.BYTE=new o(4,[8,16,16]),o.KANJI=new o(8,[8,10,12]),o.ECI=new o(7,[0,0,0]),r.Mode=o})(t.QrSegment||(t.QrSegment={}))})(Jt||(Jt={}));var ur=Jt;/**
|
|
3513
|
+
*/var Jt;(t=>{const r=class xe{constructor(c,h,d,u){if(this.version=c,this.errorCorrectionLevel=h,this.modules=[],this.isFunction=[],c<xe.MIN_VERSION||c>xe.MAX_VERSION)throw new RangeError("Version value out of range");if(u<-1||u>7)throw new RangeError("Mask value out of range");this.size=c*4+17;let m=[];for(let x=0;x<this.size;x++)m.push(!1);for(let x=0;x<this.size;x++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();const v=this.addEccAndInterleave(d);if(this.drawCodewords(v),u==-1){let x=1e9;for(let w=0;w<8;w++){this.applyMask(w),this.drawFormatBits(w);const _=this.getPenaltyScore();_<x&&(u=w,x=_),this.applyMask(w)}}a(0<=u&&u<=7),this.mask=u,this.applyMask(u),this.drawFormatBits(u),this.isFunction=[]}static encodeText(c,h){const d=t.QrSegment.makeSegments(c);return xe.encodeSegments(d,h)}static encodeBinary(c,h){const d=t.QrSegment.makeBytes(c);return xe.encodeSegments([d],h)}static encodeSegments(c,h,d=1,u=40,m=-1,v=!0){if(!(xe.MIN_VERSION<=d&&d<=u&&u<=xe.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let x,w;for(x=d;;x++){const P=xe.getNumDataCodewords(x,h)*8,C=p.getTotalBits(c,x);if(C<=P){w=C;break}if(x>=u)throw new RangeError("Data too long")}for(const P of[xe.Ecc.MEDIUM,xe.Ecc.QUARTILE,xe.Ecc.HIGH])v&&w<=xe.getNumDataCodewords(x,P)*8&&(h=P);let _=[];for(const P of c){o(P.mode.modeBits,4,_),o(P.numChars,P.mode.numCharCountBits(x),_);for(const C of P.getData())_.push(C)}a(_.length==w);const z=xe.getNumDataCodewords(x,h)*8;a(_.length<=z),o(0,Math.min(4,z-_.length),_),o(0,(8-_.length%8)%8,_),a(_.length%8==0);for(let P=236;_.length<z;P^=253)o(P,8,_);let y=[];for(;y.length*8<_.length;)y.push(0);return _.forEach((P,C)=>y[C>>>3]|=P<<7-(C&7)),new xe(x,h,y,m)}getModule(c,h){return 0<=c&&c<this.size&&0<=h&&h<this.size&&this.modules[h][c]}getModules(){return this.modules}drawFunctionPatterns(){for(let d=0;d<this.size;d++)this.setFunctionModule(6,d,d%2==0),this.setFunctionModule(d,6,d%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const c=this.getAlignmentPatternPositions(),h=c.length;for(let d=0;d<h;d++)for(let u=0;u<h;u++)d==0&&u==0||d==0&&u==h-1||d==h-1&&u==0||this.drawAlignmentPattern(c[d],c[u]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(c){const h=this.errorCorrectionLevel.formatBits<<3|c;let d=h;for(let m=0;m<10;m++)d=d<<1^(d>>>9)*1335;const u=(h<<10|d)^21522;a(u>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,n(u,m));this.setFunctionModule(8,7,n(u,6)),this.setFunctionModule(8,8,n(u,7)),this.setFunctionModule(7,8,n(u,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,n(u,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,n(u,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,n(u,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let c=this.version;for(let d=0;d<12;d++)c=c<<1^(c>>>11)*7973;const h=this.version<<12|c;a(h>>>18==0);for(let d=0;d<18;d++){const u=n(h,d),m=this.size-11+d%3,v=Math.floor(d/3);this.setFunctionModule(m,v,u),this.setFunctionModule(v,m,u)}}drawFinderPattern(c,h){for(let d=-4;d<=4;d++)for(let u=-4;u<=4;u++){const m=Math.max(Math.abs(u),Math.abs(d)),v=c+u,x=h+d;0<=v&&v<this.size&&0<=x&&x<this.size&&this.setFunctionModule(v,x,m!=2&&m!=4)}}drawAlignmentPattern(c,h){for(let d=-2;d<=2;d++)for(let u=-2;u<=2;u++)this.setFunctionModule(c+u,h+d,Math.max(Math.abs(u),Math.abs(d))!=1)}setFunctionModule(c,h,d){this.modules[h][c]=d,this.isFunction[h][c]=!0}addEccAndInterleave(c){const h=this.version,d=this.errorCorrectionLevel;if(c.length!=xe.getNumDataCodewords(h,d))throw new RangeError("Invalid argument");const u=xe.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][h],m=xe.ECC_CODEWORDS_PER_BLOCK[d.ordinal][h],v=Math.floor(xe.getNumRawDataModules(h)/8),x=u-v%u,w=Math.floor(v/u);let _=[];const z=xe.reedSolomonComputeDivisor(m);for(let P=0,C=0;P<u;P++){let j=c.slice(C,C+w-m+(P<x?0:1));C+=j.length;const b=xe.reedSolomonComputeRemainder(j,z);P<x&&j.push(0),_.push(j.concat(b))}let y=[];for(let P=0;P<_[0].length;P++)_.forEach((C,j)=>{(P!=w-m||j>=x)&&y.push(C[P])});return a(y.length==v),y}drawCodewords(c){if(c.length!=Math.floor(xe.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let h=0;for(let d=this.size-1;d>=1;d-=2){d==6&&(d=5);for(let u=0;u<this.size;u++)for(let m=0;m<2;m++){const v=d-m,w=(d+1&2)==0?this.size-1-u:u;!this.isFunction[w][v]&&h<c.length*8&&(this.modules[w][v]=n(c[h>>>3],7-(h&7)),h++)}}a(h==c.length*8)}applyMask(c){if(c<0||c>7)throw new RangeError("Mask value out of range");for(let h=0;h<this.size;h++)for(let d=0;d<this.size;d++){let u;switch(c){case 0:u=(d+h)%2==0;break;case 1:u=h%2==0;break;case 2:u=d%3==0;break;case 3:u=(d+h)%3==0;break;case 4:u=(Math.floor(d/3)+Math.floor(h/2))%2==0;break;case 5:u=d*h%2+d*h%3==0;break;case 6:u=(d*h%2+d*h%3)%2==0;break;case 7:u=((d+h)%2+d*h%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[h][d]&&u&&(this.modules[h][d]=!this.modules[h][d])}}getPenaltyScore(){let c=0;for(let m=0;m<this.size;m++){let v=!1,x=0,w=[0,0,0,0,0,0,0];for(let _=0;_<this.size;_++)this.modules[m][_]==v?(x++,x==5?c+=xe.PENALTY_N1:x>5&&c++):(this.finderPenaltyAddHistory(x,w),v||(c+=this.finderPenaltyCountPatterns(w)*xe.PENALTY_N3),v=this.modules[m][_],x=1);c+=this.finderPenaltyTerminateAndCount(v,x,w)*xe.PENALTY_N3}for(let m=0;m<this.size;m++){let v=!1,x=0,w=[0,0,0,0,0,0,0];for(let _=0;_<this.size;_++)this.modules[_][m]==v?(x++,x==5?c+=xe.PENALTY_N1:x>5&&c++):(this.finderPenaltyAddHistory(x,w),v||(c+=this.finderPenaltyCountPatterns(w)*xe.PENALTY_N3),v=this.modules[_][m],x=1);c+=this.finderPenaltyTerminateAndCount(v,x,w)*xe.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let v=0;v<this.size-1;v++){const x=this.modules[m][v];x==this.modules[m][v+1]&&x==this.modules[m+1][v]&&x==this.modules[m+1][v+1]&&(c+=xe.PENALTY_N2)}let h=0;for(const m of this.modules)h=m.reduce((v,x)=>v+(x?1:0),h);const d=this.size*this.size,u=Math.ceil(Math.abs(h*20-d*10)/d)-1;return a(0<=u&&u<=9),c+=u*xe.PENALTY_N4,a(0<=c&&c<=2568888),c}getAlignmentPatternPositions(){if(this.version==1)return[];{const c=Math.floor(this.version/7)+2,h=this.version==32?26:Math.ceil((this.version*4+4)/(c*2-2))*2;let d=[6];for(let u=this.size-7;d.length<c;u-=h)d.splice(1,0,u);return d}}static getNumRawDataModules(c){if(c<xe.MIN_VERSION||c>xe.MAX_VERSION)throw new RangeError("Version number out of range");let h=(16*c+128)*c+64;if(c>=2){const d=Math.floor(c/7)+2;h-=(25*d-10)*d-55,c>=7&&(h-=36)}return a(208<=h&&h<=29648),h}static getNumDataCodewords(c,h){return Math.floor(xe.getNumRawDataModules(c)/8)-xe.ECC_CODEWORDS_PER_BLOCK[h.ordinal][c]*xe.NUM_ERROR_CORRECTION_BLOCKS[h.ordinal][c]}static reedSolomonComputeDivisor(c){if(c<1||c>255)throw new RangeError("Degree out of range");let h=[];for(let u=0;u<c-1;u++)h.push(0);h.push(1);let d=1;for(let u=0;u<c;u++){for(let m=0;m<h.length;m++)h[m]=xe.reedSolomonMultiply(h[m],d),m+1<h.length&&(h[m]^=h[m+1]);d=xe.reedSolomonMultiply(d,2)}return h}static reedSolomonComputeRemainder(c,h){let d=h.map(u=>0);for(const u of c){const m=u^d.shift();d.push(0),h.forEach((v,x)=>d[x]^=xe.reedSolomonMultiply(v,m))}return d}static reedSolomonMultiply(c,h){if(c>>>8||h>>>8)throw new RangeError("Byte out of range");let d=0;for(let u=7;u>=0;u--)d=d<<1^(d>>>7)*285,d^=(h>>>u&1)*c;return a(d>>>8==0),d}finderPenaltyCountPatterns(c){const h=c[1];a(h<=this.size*3);const d=h>0&&c[2]==h&&c[3]==h*3&&c[4]==h&&c[5]==h;return(d&&c[0]>=h*4&&c[6]>=h?1:0)+(d&&c[6]>=h*4&&c[0]>=h?1:0)}finderPenaltyTerminateAndCount(c,h,d){return c&&(this.finderPenaltyAddHistory(h,d),h=0),h+=this.size,this.finderPenaltyAddHistory(h,d),this.finderPenaltyCountPatterns(d)}finderPenaltyAddHistory(c,h){h[0]==0&&(c+=this.size),h.pop(),h.unshift(c)}};r.MIN_VERSION=1,r.MAX_VERSION=40,r.PENALTY_N1=3,r.PENALTY_N2=3,r.PENALTY_N3=40,r.PENALTY_N4=10,r.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],r.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],t.QrCode=r;function o(f,c,h){if(c<0||c>31||f>>>c)throw new RangeError("Value out of range");for(let d=c-1;d>=0;d--)h.push(f>>>d&1)}function n(f,c){return(f>>>c&1)!=0}function a(f){if(!f)throw new Error("Assertion error")}const s=class Ie{constructor(c,h,d){if(this.mode=c,this.numChars=h,this.bitData=d,h<0)throw new RangeError("Invalid argument");this.bitData=d.slice()}static makeBytes(c){let h=[];for(const d of c)o(d,8,h);return new Ie(Ie.Mode.BYTE,c.length,h)}static makeNumeric(c){if(!Ie.isNumeric(c))throw new RangeError("String contains non-numeric characters");let h=[];for(let d=0;d<c.length;){const u=Math.min(c.length-d,3);o(parseInt(c.substring(d,d+u),10),u*3+1,h),d+=u}return new Ie(Ie.Mode.NUMERIC,c.length,h)}static makeAlphanumeric(c){if(!Ie.isAlphanumeric(c))throw new RangeError("String contains unencodable characters in alphanumeric mode");let h=[],d;for(d=0;d+2<=c.length;d+=2){let u=Ie.ALPHANUMERIC_CHARSET.indexOf(c.charAt(d))*45;u+=Ie.ALPHANUMERIC_CHARSET.indexOf(c.charAt(d+1)),o(u,11,h)}return d<c.length&&o(Ie.ALPHANUMERIC_CHARSET.indexOf(c.charAt(d)),6,h),new Ie(Ie.Mode.ALPHANUMERIC,c.length,h)}static makeSegments(c){return c==""?[]:Ie.isNumeric(c)?[Ie.makeNumeric(c)]:Ie.isAlphanumeric(c)?[Ie.makeAlphanumeric(c)]:[Ie.makeBytes(Ie.toUtf8ByteArray(c))]}static makeEci(c){let h=[];if(c<0)throw new RangeError("ECI assignment value out of range");if(c<128)o(c,8,h);else if(c<16384)o(2,2,h),o(c,14,h);else if(c<1e6)o(6,3,h),o(c,21,h);else throw new RangeError("ECI assignment value out of range");return new Ie(Ie.Mode.ECI,0,h)}static isNumeric(c){return Ie.NUMERIC_REGEX.test(c)}static isAlphanumeric(c){return Ie.ALPHANUMERIC_REGEX.test(c)}getData(){return this.bitData.slice()}static getTotalBits(c,h){let d=0;for(const u of c){const m=u.mode.numCharCountBits(h);if(u.numChars>=1<<m)return 1/0;d+=4+m+u.bitData.length}return d}static toUtf8ByteArray(c){c=encodeURI(c);let h=[];for(let d=0;d<c.length;d++)c.charAt(d)!="%"?h.push(c.charCodeAt(d)):(h.push(parseInt(c.substring(d+1,d+3),16)),d+=2);return h}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let p=s;t.QrSegment=s})(Jt||(Jt={}));(t=>{(r=>{const o=class{constructor(a,s){this.ordinal=a,this.formatBits=s}};o.LOW=new o(0,1),o.MEDIUM=new o(1,0),o.QUARTILE=new o(2,3),o.HIGH=new o(3,2),r.Ecc=o})(t.QrCode||(t.QrCode={}))})(Jt||(Jt={}));(t=>{(r=>{const o=class{constructor(a,s){this.modeBits=a,this.numBitsCharCount=s}numCharCountBits(a){return this.numBitsCharCount[Math.floor((a+7)/17)]}};o.NUMERIC=new o(1,[10,12,14]),o.ALPHANUMERIC=new o(2,[9,11,13]),o.BYTE=new o(4,[8,16,16]),o.KANJI=new o(8,[8,10,12]),o.ECI=new o(7,[0,0,0]),r.Mode=o})(t.QrSegment||(t.QrSegment={}))})(Jt||(Jt={}));var ur=Jt;/**
|
|
3514
3514
|
* @license qrcode.react
|
|
3515
3515
|
* Copyright (c) Paul O'Shannessy
|
|
3516
3516
|
* SPDX-License-Identifier: ISC
|
|
3517
|
-
*/var
|
|
3517
|
+
*/var Yx={L:ur.QrCode.Ecc.LOW,M:ur.QrCode.Ecc.MEDIUM,Q:ur.QrCode.Ecc.QUARTILE,H:ur.QrCode.Ecc.HIGH},bl=128,yl="L",wl="#FFFFFF",jl="#000000",kl=!1,_l=1,Zx=4,Kx=0,Qx=.1;function Cl(t,r=0){const o=[];return t.forEach(function(n,a){let s=null;n.forEach(function(p,f){if(!p&&s!==null){o.push(`M${s+r} ${a+r}h${f-s}v1H${s+r}z`),s=null;return}if(f===n.length-1){if(!p)return;s===null?o.push(`M${f+r},${a+r} h1v1H${f+r}z`):o.push(`M${s+r},${a+r} h${f+1-s}v1H${s+r}z`);return}p&&s===null&&(s=f)})}),o.join("")}function Sl(t,r){return t.slice().map((o,n)=>n<r.y||n>=r.y+r.h?o:o.map((a,s)=>s<r.x||s>=r.x+r.w?a:!1))}function Xx(t,r,o,n){if(n==null)return null;const a=t.length+o*2,s=Math.floor(r*Qx),p=a/r,f=(n.width||s)*p,c=(n.height||s)*p,h=n.x==null?t.length/2-f/2:n.x*p,d=n.y==null?t.length/2-c/2:n.y*p,u=n.opacity==null?1:n.opacity;let m=null;if(n.excavate){let x=Math.floor(h),w=Math.floor(d),_=Math.ceil(f+h-x),z=Math.ceil(c+d-w);m={x,y:w,w:_,h:z}}const v=n.crossOrigin;return{x:h,y:d,h:c,w:f,excavation:m,opacity:u,crossOrigin:v}}function Jx(t,r){return r!=null?Math.max(Math.floor(r),0):t?Zx:Kx}function $l({value:t,level:r,minVersion:o,includeMargin:n,marginSize:a,imageSettings:s,size:p,boostLevel:f}){let c=i.useMemo(()=>{const x=(Array.isArray(t)?t:[t]).reduce((w,_)=>(w.push(...ur.QrSegment.makeSegments(_)),w),[]);return ur.QrCode.encodeSegments(x,Yx[r],o,void 0,void 0,f)},[t,r,o,f]);const{cells:h,margin:d,numCells:u,calculatedImageSettings:m}=i.useMemo(()=>{let v=c.getModules();const x=Jx(n,a),w=v.length+x*2,_=Xx(v,p,x,s);return{cells:v,margin:x,numCells:w,calculatedImageSettings:_}},[c,p,s,n,a]);return{qrcode:c,margin:d,cells:h,numCells:u,calculatedImageSettings:m}}var e0=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),t0=i.forwardRef(function(r,o){const n=r,{value:a,size:s=bl,level:p=yl,bgColor:f=wl,fgColor:c=jl,includeMargin:h=kl,minVersion:d=_l,boostLevel:u,marginSize:m,imageSettings:v}=n,w=la(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:_}=w,z=la(w,["style"]),y=v==null?void 0:v.src,P=i.useRef(null),C=i.useRef(null),j=i.useCallback(I=>{P.current=I,typeof o=="function"?o(I):o&&(o.current=I)},[o]),[b,g]=i.useState(!1),{margin:S,cells:k,numCells:E,calculatedImageSettings:R}=$l({value:a,level:p,minVersion:d,boostLevel:u,includeMargin:h,marginSize:m,imageSettings:v,size:s});i.useEffect(()=>{if(P.current!=null){const I=P.current,T=I.getContext("2d");if(!T)return;let N=k;const L=C.current,D=R!=null&&L!==null&&L.complete&&L.naturalHeight!==0&&L.naturalWidth!==0;D&&R.excavation!=null&&(N=Sl(k,R.excavation));const B=window.devicePixelRatio||1;I.height=I.width=s*B;const oe=s/E*B;T.scale(oe,oe),T.fillStyle=f,T.fillRect(0,0,E,E),T.fillStyle=c,e0?T.fill(new Path2D(Cl(N,S))):k.forEach(function(se,ne){se.forEach(function(K,U){K&&T.fillRect(U+S,ne+S,1,1)})}),R&&(T.globalAlpha=R.opacity),D&&T.drawImage(L,R.x+S,R.y+S,R.w,R.h)}}),i.useEffect(()=>{g(!1)},[y]);const $=ca({height:s,width:s},_);let O=null;return y!=null&&(O=i.createElement("img",{src:y,key:y,style:{display:"none"},onLoad:()=>{g(!0)},ref:C,crossOrigin:R==null?void 0:R.crossOrigin})),i.createElement(i.Fragment,null,i.createElement("canvas",ca({style:$,height:s,width:s,ref:j,role:"img"},z)),O)});t0.displayName="QRCodeCanvas";var _a=i.forwardRef(function(r,o){const n=r,{value:a,size:s=bl,level:p=yl,bgColor:f=wl,fgColor:c=jl,includeMargin:h=kl,minVersion:d=_l,boostLevel:u,title:m,marginSize:v,imageSettings:x}=n,w=la(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:_,cells:z,numCells:y,calculatedImageSettings:P}=$l({value:a,level:p,minVersion:d,boostLevel:u,includeMargin:h,marginSize:v,imageSettings:x,size:s});let C=z,j=null;x!=null&&P!=null&&(P.excavation!=null&&(C=Sl(z,P.excavation)),j=i.createElement("image",{href:x.src,height:P.h,width:P.w,x:P.x+_,y:P.y+_,preserveAspectRatio:"none",opacity:P.opacity,crossOrigin:P.crossOrigin}));const b=Cl(C,_);return i.createElement("svg",ca({height:s,width:s,viewBox:`0 0 ${y} ${y}`,ref:o,role:"img"},w),!!m&&i.createElement("title",null,m),i.createElement("path",{fill:f,d:`M0,0 h${y}v${y}H0z`,shapeRendering:"crispEdges"}),i.createElement("path",{fill:c,d:b,shapeRendering:"crispEdges"}),j)});_a.displayName="QRCodeSVG";const r0=l.div`
|
|
3518
3518
|
position: fixed;
|
|
3519
3519
|
background: var(--color-background);
|
|
3520
3520
|
border-radius: var(--radius-md);
|
|
@@ -3538,11 +3538,11 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3538
3538
|
font-weight: 500;
|
|
3539
3539
|
color: var(--color-foreground);
|
|
3540
3540
|
margin-bottom: 12px;
|
|
3541
|
-
`,
|
|
3541
|
+
`,o0=l.div`
|
|
3542
3542
|
display: flex;
|
|
3543
3543
|
align-items: center;
|
|
3544
3544
|
gap: 8px;
|
|
3545
|
-
`,
|
|
3545
|
+
`,n0=l.div`
|
|
3546
3546
|
width: 40px;
|
|
3547
3547
|
height: 38px;
|
|
3548
3548
|
border-radius: var(--radius-sm);
|
|
@@ -3553,7 +3553,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3553
3553
|
justify-content: center;
|
|
3554
3554
|
color: var(--color-muted);
|
|
3555
3555
|
flex-shrink: 0;
|
|
3556
|
-
`,Qs=({onClose:t,onAddEmail:r,onAttemptVerification:o,onPrepareVerification:n,existingEmail:a,triggerRef:s})=>{const p=i.useRef(null),[f,c]=i.useState(!1),[h,d]=i.useState({top:0,left:0}),{toast:u}=Rt();i.useEffect(()=>{c(!0);const b=setTimeout(()=>{if(!p.current||!(s!=null&&s.current))return;const k=s.current;if(k){const E=k.getBoundingClientRect(),R=380,$=300,O=8;let
|
|
3556
|
+
`,Qs=({onClose:t,onAddEmail:r,onAttemptVerification:o,onPrepareVerification:n,existingEmail:a,triggerRef:s})=>{const p=i.useRef(null),[f,c]=i.useState(!1),[h,d]=i.useState({top:0,left:0}),{toast:u}=Rt();i.useEffect(()=>{c(!0);const b=setTimeout(()=>{if(!p.current||!(s!=null&&s.current))return;const k=s.current;if(k){const E=k.getBoundingClientRect(),R=380,$=300,O=8;let I=0,T=0;const N=window.innerHeight-E.bottom,L=E.top;N>=$+O?(I=E.bottom+O,T=E.right-R,T<O&&(T=E.left,T+R>window.innerWidth-O&&(T=(window.innerWidth-R)/2))):L>=$+O?(I=E.top-$-O,T=E.right-R,T<O&&(T=E.left,T+R>window.innerWidth-O&&(T=(window.innerWidth-R)/2))):(I=E.bottom+O,T=E.right-R,T<O&&(T=E.left)),d({top:I,left:T})}},10),g=k=>{p.current&&!p.current.contains(k.target)&&t()},S=k=>{k.key==="Escape"&&t()};return document.addEventListener("mousedown",g),document.addEventListener("keydown",S),()=>{clearTimeout(b),document.removeEventListener("mousedown",g),document.removeEventListener("keydown",S)}},[t,s]);const[m,v]=i.useState(a?"otp":"email"),[x,w]=i.useState(a||""),[_,z]=i.useState(""),[y,P]=i.useState(!1),C=async()=>{if(!(!x||y)){P(!0);try{await r(x),v("otp")}catch(b){const g=b.message||"Failed to add email address. Please try again.";u(g,"error")}finally{P(!1)}}},j=async()=>{P(!0);try{await o(_),t()}catch(b){const g=b.message||"Failed to verify email. Please check the code and try again.";u(g,"error")}finally{P(!1)}};return f?e.jsx(r0,{ref:p,style:{top:`${h.top}px`,left:`${h.left}px`,visibility:h.top>0?"visible":"hidden"},onClick:b=>b.stopPropagation(),children:m==="email"?e.jsxs(e.Fragment,{children:[e.jsx(Ks,{children:"Add email address"}),e.jsx(fe,{children:e.jsxs(o0,{children:[e.jsx(n0,{children:e.jsx(Ur,{size:16})}),e.jsx(le,{id:"email-input",type:"email",placeholder:"Email address",value:x,onChange:b=>w(b.target.value),style:{flex:1}})]})}),e.jsxs(Zs,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto",padding:"0 var(--space-md)"},children:"Cancel"}),e.jsx(X,{onClick:C,disabled:!x||y,style:{width:"auto",padding:"0 var(--space-md)"},children:y?"Adding...":"Continue"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ks,{children:"Verify your email"}),e.jsxs("div",{style:{fontSize:"14px",color:"var(--color-muted)",marginBottom:"16px"},children:["Enter the 6-digit code sent to ",x]}),e.jsx(Et,{onComplete:async b=>z(b),onResend:n,isSubmitting:y}),e.jsxs(Zs,{children:[e.jsx(X,{$outline:!0,onClick:()=>v("email"),style:{width:"auto",padding:"0 var(--space-md)"},children:"Back"}),e.jsx(X,{onClick:j,disabled:_.length<6||y,style:{width:"auto",padding:"0 var(--space-md)"},children:y?"Verifying...":"Verify"})]})]})}):null},a0=l.div`
|
|
3557
3557
|
position: fixed;
|
|
3558
3558
|
background: var(--color-background);
|
|
3559
3559
|
border-radius: var(--radius-md);
|
|
@@ -3577,7 +3577,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3577
3577
|
font-weight: 500;
|
|
3578
3578
|
color: var(--color-foreground);
|
|
3579
3579
|
margin-bottom: 12px;
|
|
3580
|
-
`,ei=({onClose:t,onAddPhone:r,onAttemptVerification:o,existingPhone:n,onPrepareVerification:a,triggerRef:s})=>{var S;const p=i.useRef(null),[f,c]=i.useState(!1),[h,d]=i.useState({top:0,left:0}),{toast:u}=Rt();i.useEffect(()=>{c(!0);const k=setTimeout(()=>{if(!p.current||!(s!=null&&s.current))return;const $=s.current;if($){const O=$.getBoundingClientRect(),
|
|
3580
|
+
`,ei=({onClose:t,onAddPhone:r,onAttemptVerification:o,existingPhone:n,onPrepareVerification:a,triggerRef:s})=>{var S;const p=i.useRef(null),[f,c]=i.useState(!1),[h,d]=i.useState({top:0,left:0}),{toast:u}=Rt();i.useEffect(()=>{c(!0);const k=setTimeout(()=>{if(!p.current||!(s!=null&&s.current))return;const $=s.current;if($){const O=$.getBoundingClientRect(),I=380,T=300,N=8;let L=0,D=0;const B=window.innerHeight-O.bottom,oe=O.top;B>=T+N?(L=O.bottom+N,D=O.right-I,D<N&&(D=O.left,D+I>window.innerWidth-N&&(D=(window.innerWidth-I)/2))):oe>=T+N?(L=O.top-T-N,D=O.right-I,D<N&&(D=O.left,D+I>window.innerWidth-N&&(D=(window.innerWidth-I)/2))):(L=O.bottom+N,D=O.right-I,D<N&&(D=O.left)),d({top:L,left:D})}},10),E=$=>{p.current&&!p.current.contains($.target)&&t()},R=$=>{$.key==="Escape"&&t()};return document.addEventListener("mousedown",E),document.addEventListener("keydown",R),()=>{clearTimeout(k),document.removeEventListener("mousedown",E),document.removeEventListener("keydown",R)}},[t,s]);const[m,v]=i.useState(n?"otp":"phone"),[x,w]=i.useState((n==null?void 0:n.replace(/^\+\d+/,""))||""),[_,z]=i.useState((S=Intl.DateTimeFormat().resolvedOptions().locale.split("-"))==null?void 0:S.pop()),[y,P]=i.useState(""),[C,j]=i.useState(!1),b=async()=>{if(!(!x||C)){j(!0);try{await r(x,_||""),v("otp")}catch(k){const E=k.message||"Failed to add phone number. Please try again.";u(E,"error")}finally{j(!1)}}},g=async()=>{j(!0);try{await o(y),t()}catch(k){const E=k.message||"Failed to verify phone. Please check the code and try again.";u(E,"error")}finally{j(!1)}};return f?e.jsx(a0,{ref:p,style:{top:`${h.top}px`,left:`${h.left}px`,visibility:h.top>0?"visible":"hidden"},onClick:k=>k.stopPropagation(),children:m==="phone"?e.jsxs(e.Fragment,{children:[e.jsx(Js,{children:"Add phone number"}),e.jsx(fe,{children:e.jsx(Br,{value:x,onChange:k=>w(k.target.value),error:"",countryCode:_,setCountryCode:z})}),e.jsxs(Xs,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto",padding:"0 var(--space-md)"},children:"Cancel"}),e.jsx(X,{onClick:b,disabled:!x||C,style:{width:"auto",padding:"0 var(--space-md)"},children:"Continue"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Js,{children:"Verify phone number"}),e.jsx(fe,{children:e.jsx(Et,{onComplete:k=>P(k),onResend:async()=>a()})}),e.jsxs(Xs,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto",padding:"0 var(--space-md)"},children:"Cancel"}),e.jsx(X,{onClick:g,disabled:y.length!==6||C,style:{width:"auto",padding:"0 var(--space-md)"},children:"Verify"})]})]})}):null},s0=l.div`
|
|
3581
3581
|
position: fixed;
|
|
3582
3582
|
background: var(--color-background);
|
|
3583
3583
|
border-radius: var(--radius-md);
|
|
@@ -3591,7 +3591,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3591
3591
|
@media (max-width: 600px) {
|
|
3592
3592
|
width: calc(100vw - 48px);
|
|
3593
3593
|
}
|
|
3594
|
-
`,
|
|
3594
|
+
`,An=l.button`
|
|
3595
3595
|
padding: 8px 16px;
|
|
3596
3596
|
background: ${t=>t.$primary?"var(--color-primary)":"var(--color-background)"};
|
|
3597
3597
|
color: ${t=>t.$primary?"white":"var(--color-secondary-text)"};
|
|
@@ -3620,7 +3620,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3620
3620
|
font-weight: 500;
|
|
3621
3621
|
color: var(--color-foreground);
|
|
3622
3622
|
margin-bottom: 8px;
|
|
3623
|
-
`,
|
|
3623
|
+
`,i0=({onClose:t,onSetupTOTP:r,onVerifyTOTP:o,triggerRef:n})=>{const a=i.useRef(null),[s,p]=i.useState("qr"),[f,c]=i.useState(""),[h,d]=i.useState(""),[u,m]=i.useState(["",""]),[v,x]=i.useState(!1),[w,_]=i.useState(!1),[z,y]=i.useState({top:0,left:0}),{toast:P}=Rt();i.useEffect(()=>{_(!0);const j=setTimeout(()=>{if(!a.current||!(n!=null&&n.current))return;const S=n.current;if(S){const k=S.getBoundingClientRect(),E=380,R=400,$=8;let O=0,I=0;const T=window.innerHeight-k.bottom,N=k.top;T>=R+$?(O=k.bottom+$,I=k.right-E,I<$&&(I=k.left,I+E>window.innerWidth-$&&(I=(window.innerWidth-E)/2))):N>=R+$?(O=k.top-R-$,I=k.right-E,I<$&&(I=k.left,I+E>window.innerWidth-$&&(I=(window.innerWidth-E)/2))):(O=k.bottom+$,I=k.right-E,I<$&&(I=k.left)),y({top:O,left:I})}},10),b=S=>{a.current&&!a.current.contains(S.target)&&t()},g=S=>{S.key==="Escape"&&t()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",g),()=>{clearTimeout(j),document.removeEventListener("mousedown",b),document.removeEventListener("keydown",g)}},[t,n]),i.useEffect(()=>{(async()=>{x(!0);try{const b=await r();c(b.otp_url||""),d(b.totp_secret||"")}catch(b){const g=b.message||"Failed to setup two-factor authentication. Please try again.";P(g,"error")}finally{x(!1)}})()},[]);const C=async()=>{if(!u.some(j=>j.length!==6)){x(!0);try{await o(u),t()}catch(j){const b=j.message||"Failed to verify codes. Please check your authenticator app and try again.";P(b,"error")}finally{x(!1)}}};return w?e.jsx(s0,{ref:a,style:{top:`${z.top}px`,left:`${z.left}px`,visibility:z.top>0?"visible":"hidden"},onClick:j=>j.stopPropagation(),children:s==="qr"?e.jsxs(e.Fragment,{children:[e.jsx(ri,{children:"Setup Two-Factor Authentication"}),e.jsx("div",{style:{fontSize:"14px",color:"var(--color-muted)",marginBottom:"16px"},children:"Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.)"}),e.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"16px"},children:v?e.jsx("div",{style:{width:"150px",height:"150px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",background:"var(--color-input-background)"},children:"Loading..."}):f?e.jsx("div",{style:{border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",padding:"8px",background:"white"},children:e.jsx(_a,{value:f,size:150,title:"QR Code for Two-Factor Authentication Setup","aria-label":"Scan this QR code with your authenticator app to set up two-factor authentication"})}):e.jsx("div",{style:{width:"150px",height:"150px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",background:"var(--color-input-background)",color:"var(--color-error)"},children:"QR Code Not Available"})}),h&&e.jsxs("div",{style:{background:"var(--color-input-background)",border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",padding:"8px",marginBottom:"16px",fontSize:"12px"},children:[e.jsx("div",{style:{color:"var(--color-secondary-text)",marginBottom:"4px"},children:"Or enter manually:"}),e.jsx("code",{style:{fontFamily:"monospace",wordBreak:"break-all",color:"var(--color-secondary-text)"},children:h})]}),e.jsx(ti,{children:e.jsx(An,{$primary:!0,onClick:()=>p("verify"),disabled:v||!f,children:"I've Scanned the Code"})})]}):e.jsxs(e.Fragment,{children:[e.jsx(ri,{children:"Verify Your Authenticator"}),e.jsx("div",{style:{fontSize:"14px",color:"var(--color-muted)",marginBottom:"16px"},children:"Enter two consecutive codes from your authenticator app"}),e.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"16px"},children:[e.jsx(le,{id:"totp-code-1",type:"text",placeholder:"000000",value:u[0],onChange:j=>{const b=j.target.value.replace(/[^0-9]/g,"").substring(0,6);m([b,u[1]])},maxLength:6,style:{textAlign:"center",fontFamily:"monospace"},"aria-label":"First verification code from authenticator app"}),e.jsx(le,{id:"totp-code-2",type:"text",placeholder:"000000",value:u[1],onChange:j=>{const b=j.target.value.replace(/[^0-9]/g,"").substring(0,6);m([u[0],b])},maxLength:6,style:{textAlign:"center",fontFamily:"monospace"},"aria-label":"Second verification code from authenticator app"})]}),e.jsxs(ti,{children:[e.jsx(An,{onClick:()=>p("qr"),children:"Back"}),e.jsx(An,{$primary:!0,onClick:C,disabled:v||u.some(j=>j.length!==6),children:v?"Verifying...":"Verify"})]})]})}):null},c0=l.div`
|
|
3624
3624
|
position: fixed;
|
|
3625
3625
|
background: var(--color-background);
|
|
3626
3626
|
border-radius: var(--radius-md);
|
|
@@ -3653,12 +3653,12 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3653
3653
|
opacity: 0.5;
|
|
3654
3654
|
cursor: not-allowed;
|
|
3655
3655
|
}
|
|
3656
|
-
`,
|
|
3656
|
+
`,l0=l.div`
|
|
3657
3657
|
display: flex;
|
|
3658
3658
|
gap: 8px;
|
|
3659
3659
|
justify-content: flex-end;
|
|
3660
3660
|
margin-top: 16px;
|
|
3661
|
-
`,
|
|
3661
|
+
`,d0=l.div`
|
|
3662
3662
|
font-size: 14px;
|
|
3663
3663
|
font-weight: 500;
|
|
3664
3664
|
color: var(--color-foreground);
|
|
@@ -3690,7 +3690,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3690
3690
|
color: var(--color-error);
|
|
3691
3691
|
font-size: 12px;
|
|
3692
3692
|
margin-top: 4px;
|
|
3693
|
-
`,ni=({onClose:t,onChangePassword:r,triggerRef:o,isSetup:n=!1})=>{const a=i.useRef(null),[s,p]=i.useState(!1),[f,c]=i.useState({top:0,left:0}),[h,d]=i.useState(""),[u,m]=i.useState(""),[v,x]=i.useState(""),[w,_]=i.useState(!1),[z,y]=i.useState(!1),[
|
|
3693
|
+
`,ni=({onClose:t,onChangePassword:r,triggerRef:o,isSetup:n=!1})=>{const a=i.useRef(null),[s,p]=i.useState(!1),[f,c]=i.useState({top:0,left:0}),[h,d]=i.useState(""),[u,m]=i.useState(""),[v,x]=i.useState(""),[w,_]=i.useState(!1),[z,y]=i.useState(!1),[P,C]=i.useState(!1),[j,b]=i.useState(!1),[g,S]=i.useState({});i.useEffect(()=>{p(!0);const E=setTimeout(()=>{if(!a.current||!(o!=null&&o.current))return;const O=o.current;if(O){const I=O.getBoundingClientRect(),T=380,N=350,L=8;let D=0,B=0;const oe=window.innerHeight-I.bottom,se=I.top;oe>=N+L?(D=I.bottom+L,B=I.right-T,B<L&&(B=I.left,B+T>window.innerWidth-L&&(B=(window.innerWidth-T)/2))):se>=N+L?(D=I.top-N-L,B=I.right-T,B<L&&(B=I.left,B+T>window.innerWidth-L&&(B=(window.innerWidth-T)/2))):(D=I.bottom+L,B=I.right-T,B<L&&(B=I.left)),c({top:D,left:B})}},10),R=O=>{a.current&&!a.current.contains(O.target)&&t()},$=O=>{O.key==="Escape"&&t()};return document.addEventListener("mousedown",R),document.addEventListener("keydown",$),()=>{clearTimeout(E),document.removeEventListener("mousedown",R),document.removeEventListener("keydown",$)}},[t,o]);const k=async()=>{if(j)return;const E={};if(!n&&!h&&(E.currentPassword="Current password is required"),u?u.length<8&&(E.newPassword="Password must be at least 8 characters"):E.newPassword="New password is required",u!==v&&(E.confirmPassword="Passwords do not match"),Object.keys(E).length>0){S(E);return}b(!0);try{await r(n?"":h,u),t()}catch(R){S({form:R.message||"Failed to update password"})}finally{b(!1)}};return s?e.jsxs(c0,{ref:a,style:{top:`${f.top}px`,left:`${f.left}px`,visibility:f.top>0?"visible":"hidden"},onClick:E=>E.stopPropagation(),children:[e.jsx(d0,{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(Dn,{children:[e.jsx(he,{children:"Current Password"}),e.jsxs(Nn,{children:[e.jsx(le,{type:w?"text":"password",placeholder:"Enter your current password",value:h,onChange:E=>d(E.target.value),style:{paddingRight:"40px"}}),e.jsx("button",{type:"button",onClick:()=>_(!w),"aria-label":w?"Hide current password":"Show current password",children:w?e.jsx(yn,{size:16}):e.jsx(wn,{size:16})})]}),g.currentPassword&&e.jsx(wo,{children:g.currentPassword})]}),e.jsxs(Dn,{children:[e.jsx(he,{children:n?"Password":"New Password"}),e.jsxs(Nn,{children:[e.jsx(le,{type:z?"text":"password",placeholder:n?"Enter your password":"Enter your new password",value:u,onChange:E=>m(E.target.value),style:{paddingRight:"40px"}}),e.jsx("button",{type:"button",onClick:()=>y(!z),"aria-label":z?"Hide new password":"Show new password",children:z?e.jsx(yn,{size:16}):e.jsx(wn,{size:16})})]}),g.newPassword&&e.jsx(wo,{children:g.newPassword})]}),e.jsxs(Dn,{children:[e.jsx(he,{children:"Confirm New Password"}),e.jsxs(Nn,{children:[e.jsx(le,{type:P?"text":"password",placeholder:"Confirm your new password",value:v,onChange:E=>x(E.target.value),style:{paddingRight:"40px"}}),e.jsx("button",{type:"button",onClick:()=>C(!P),"aria-label":P?"Hide confirm password":"Show confirm password",children:P?e.jsx(yn,{size:16}):e.jsx(wn,{size:16})})]}),g.confirmPassword&&e.jsx(wo,{children:g.confirmPassword})]}),g.form&&e.jsx(wo,{children:g.form}),e.jsxs(l0,{children:[e.jsx(oi,{onClick:t,children:"Cancel"}),e.jsx(oi,{$primary:!0,onClick:k,disabled:j,children:j?n?"Setting...":"Updating...":n?"Set Password":"Update Password"})]})]}):null},u0=l.div`
|
|
3694
3694
|
position: fixed;
|
|
3695
3695
|
background: var(--color-background);
|
|
3696
3696
|
border-radius: var(--radius-md);
|
|
@@ -3704,12 +3704,12 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3704
3704
|
@media (max-width: 600px) {
|
|
3705
3705
|
width: calc(100vw - 48px);
|
|
3706
3706
|
}
|
|
3707
|
-
`,
|
|
3707
|
+
`,p0=l.div`
|
|
3708
3708
|
display: flex;
|
|
3709
3709
|
gap: 8px;
|
|
3710
3710
|
justify-content: flex-end;
|
|
3711
3711
|
margin-top: 16px;
|
|
3712
|
-
`,
|
|
3712
|
+
`,h0=l.div`
|
|
3713
3713
|
font-size: 16px;
|
|
3714
3714
|
font-weight: 500;
|
|
3715
3715
|
color: var(--color-foreground);
|
|
@@ -3717,18 +3717,18 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3717
3717
|
display: flex;
|
|
3718
3718
|
align-items: center;
|
|
3719
3719
|
gap: 8px;
|
|
3720
|
-
`,
|
|
3720
|
+
`,f0=l.div`
|
|
3721
3721
|
background: var(--color-warning-bg, rgba(251, 191, 36, 0.1));
|
|
3722
3722
|
border: 1px solid var(--color-warning-border, rgba(251, 191, 36, 0.3));
|
|
3723
3723
|
border-radius: var(--radius-sm);
|
|
3724
3724
|
padding: 12px;
|
|
3725
3725
|
margin-bottom: 16px;
|
|
3726
|
-
`,
|
|
3726
|
+
`,g0=l.p`
|
|
3727
3727
|
font-size: 13px;
|
|
3728
3728
|
color: var(--color-warning-text, var(--color-foreground));
|
|
3729
3729
|
margin: 0;
|
|
3730
3730
|
line-height: 1.5;
|
|
3731
|
-
`,
|
|
3731
|
+
`,m0=({onClose:t,onRemovePassword:r,triggerRef:o})=>{const n=i.useRef(null),[a,s]=i.useState(!1),[p,f]=i.useState({top:0,left:0}),[c,h]=i.useState(""),[d,u]=i.useState(!1),{toast:m}=Rt();i.useEffect(()=>{s(!0);const x=setTimeout(()=>{if(!n.current||!(o!=null&&o.current))return;const z=o.current;if(z){const y=z.getBoundingClientRect(),P=400,C=300,j=8;let b=0,g=0;const S=window.innerHeight-y.bottom,k=y.top;S>=C+j?(b=y.bottom+j,g=y.right-P,g<j&&(g=y.left,g+P>window.innerWidth-j&&(g=(window.innerWidth-P)/2))):k>=C+j?(b=y.top-C-j,g=y.right-P,g<j&&(g=y.left,g+P>window.innerWidth-j&&(g=(window.innerWidth-P)/2))):(b=y.bottom+j,g=y.right-P,g<j&&(g=y.left)),f({top:b,left:g})}},10),w=z=>{n.current&&!n.current.contains(z.target)&&t()},_=z=>{z.key==="Escape"&&t()};return document.addEventListener("mousedown",w),document.addEventListener("keydown",_),()=>{clearTimeout(x),document.removeEventListener("mousedown",w),document.removeEventListener("keydown",_)}},[t,o]);const v=async()=>{if(!(!c||d)){u(!0);try{await r(c),t()}catch(x){const w=x.message||"Failed to remove password. Please try again.";m(w,"error")}finally{u(!1)}}};return a?e.jsxs(u0,{ref:n,style:{top:`${p.top}px`,left:`${p.left}px`,visibility:p.top>0?"visible":"hidden"},onClick:x=>x.stopPropagation(),children:[e.jsxs(h0,{children:[e.jsx(Pt,{size:18,color:"var(--color-warning, #fbbf24)"}),"Remove Password"]}),e.jsx(f0,{children:e.jsx(g0,{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(fe,{children:[e.jsx(he,{htmlFor:"current-password",children:"Confirm your current password"}),e.jsx(le,{id:"current-password",type:"password",placeholder:"Enter current password",value:c,onChange:x=>h(x.target.value),autoFocus:!0})]}),e.jsxs(p0,{children:[e.jsx(X,{$outline:!0,onClick:t,style:{width:"auto",padding:"0 var(--space-md)"},children:"Cancel"}),e.jsx(X,{onClick:v,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},x0=l.div`
|
|
3732
3732
|
position: fixed;
|
|
3733
3733
|
background: var(--color-background);
|
|
3734
3734
|
border-radius: var(--radius-md);
|
|
@@ -3761,24 +3761,24 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3761
3761
|
opacity: 0.5;
|
|
3762
3762
|
cursor: not-allowed;
|
|
3763
3763
|
}
|
|
3764
|
-
`,
|
|
3764
|
+
`,v0=l.div`
|
|
3765
3765
|
display: flex;
|
|
3766
3766
|
justify-content: space-between;
|
|
3767
3767
|
align-items: center;
|
|
3768
3768
|
margin-bottom: 8px;
|
|
3769
|
-
`,
|
|
3769
|
+
`,b0=l.div`
|
|
3770
3770
|
font-size: 14px;
|
|
3771
3771
|
font-weight: 400;
|
|
3772
3772
|
color: var(--color-foreground);
|
|
3773
|
-
`,
|
|
3773
|
+
`,y0=l.div`
|
|
3774
3774
|
display: flex;
|
|
3775
3775
|
gap: 8px;
|
|
3776
|
-
`,
|
|
3776
|
+
`,w0=l.div`
|
|
3777
3777
|
display: grid;
|
|
3778
3778
|
grid-template-columns: repeat(2, 1fr);
|
|
3779
3779
|
gap: 6px;
|
|
3780
3780
|
margin: 12px 0;
|
|
3781
|
-
`,
|
|
3781
|
+
`,j0=l.div`
|
|
3782
3782
|
background: var(--color-input-background);
|
|
3783
3783
|
border: 1px solid var(--color-border);
|
|
3784
3784
|
border-radius: var(--radius-sm);
|
|
@@ -3794,10 +3794,10 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3794
3794
|
background: var(--color-input-background-hover);
|
|
3795
3795
|
border-color: var(--color-primary);
|
|
3796
3796
|
}
|
|
3797
|
-
`,j0=({codes:t,onClose:r,onCopy:o,onDownload:n,triggerRef:a})=>{const s=i.useRef(null),[p,f]=i.useState(!1),[c,h]=i.useState({top:0,left:0});return i.useEffect(()=>{f(!0);const d=setTimeout(()=>{if(!s.current||!(a!=null&&a.current))return;const v=a.current;if(v){const x=v.getBoundingClientRect(),w=380,_=300,z=8;let y=0,I=0;const C=window.innerHeight-x.bottom,j=x.top;C>=_+z?(y=x.bottom+z,I=x.right-w,I<z&&(I=x.left,I+w>window.innerWidth-z&&(I=(window.innerWidth-w)/2))):j>=_+z?(y=x.top-_-z,I=x.right-w,I<z&&(I=x.left,I+w>window.innerWidth-z&&(I=(window.innerWidth-w)/2))):(y=x.bottom+z,I=x.right-w,I<z&&(I=x.left)),h({top:y,left:I})}},10),u=v=>{s.current&&!s.current.contains(v.target)&&r()},m=v=>{v.key==="Escape"&&r()};return document.addEventListener("mousedown",u),document.addEventListener("keydown",m),()=>{clearTimeout(d),document.removeEventListener("mousedown",u),document.removeEventListener("keydown",m)}},[r,a]),p?e.jsxs(m0,{ref:s,style:{top:`${c.top}px`,left:`${c.left}px`,visibility:c.top>0?"visible":"hidden"},onClick:d=>d.stopPropagation(),children:[e.jsxs(x0,{children:[e.jsx(v0,{children:"Backup Codes"}),e.jsxs(b0,{children:[e.jsxs(ai,{onClick:o,style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx(Ac,{size:14}),"Copy"]}),e.jsxs(ai,{onClick:n,style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx(Zo,{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(w0,{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)"}})]}),_0=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"})]}),C0=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})]}),S0=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)"})]}),$0=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)"})]}),z0=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)"})]}),E0=jr`
|
|
3797
|
+
`,k0=({codes:t,onClose:r,onCopy:o,onDownload:n,triggerRef:a})=>{const s=i.useRef(null),[p,f]=i.useState(!1),[c,h]=i.useState({top:0,left:0});return i.useEffect(()=>{f(!0);const d=setTimeout(()=>{if(!s.current||!(a!=null&&a.current))return;const v=a.current;if(v){const x=v.getBoundingClientRect(),w=380,_=300,z=8;let y=0,P=0;const C=window.innerHeight-x.bottom,j=x.top;C>=_+z?(y=x.bottom+z,P=x.right-w,P<z&&(P=x.left,P+w>window.innerWidth-z&&(P=(window.innerWidth-w)/2))):j>=_+z?(y=x.top-_-z,P=x.right-w,P<z&&(P=x.left,P+w>window.innerWidth-z&&(P=(window.innerWidth-w)/2))):(y=x.bottom+z,P=x.right-w,P<z&&(P=x.left)),h({top:y,left:P})}},10),u=v=>{s.current&&!s.current.contains(v.target)&&r()},m=v=>{v.key==="Escape"&&r()};return document.addEventListener("mousedown",u),document.addEventListener("keydown",m),()=>{clearTimeout(d),document.removeEventListener("mousedown",u),document.removeEventListener("keydown",m)}},[r,a]),p?e.jsxs(x0,{ref:s,style:{top:`${c.top}px`,left:`${c.left}px`,visibility:c.top>0?"visible":"hidden"},onClick:d=>d.stopPropagation(),children:[e.jsxs(v0,{children:[e.jsx(b0,{children:"Backup Codes"}),e.jsxs(y0,{children:[e.jsxs(ai,{onClick:o,style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx(Lc,{size:14}),"Copy"]}),e.jsxs(ai,{onClick:n,style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:"4px"},children:[e.jsx(Zo,{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(w0,{children:t.map((d,u)=>e.jsx(j0,{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},_0=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)"}})]}),C0=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"})]}),S0=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})]}),$0=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)"})]}),z0=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)"})]}),E0=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)"})]}),P0=jr`
|
|
3798
3798
|
0% { transform: rotate(0deg); }
|
|
3799
3799
|
100% { transform: rotate(360deg); }
|
|
3800
|
-
`,
|
|
3800
|
+
`,R0=l.div`
|
|
3801
3801
|
* {
|
|
3802
3802
|
box-sizing: border-box;
|
|
3803
3803
|
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
@@ -3849,14 +3849,14 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3849
3849
|
pointer-events: none;
|
|
3850
3850
|
z-index: 1;
|
|
3851
3851
|
}
|
|
3852
|
-
`,
|
|
3852
|
+
`,I0=l.div`
|
|
3853
3853
|
padding: 0 24px;
|
|
3854
3854
|
border-bottom: 1px solid var(--color-border);
|
|
3855
3855
|
|
|
3856
3856
|
@media (max-width: 768px) {
|
|
3857
3857
|
padding: 0 20px;
|
|
3858
3858
|
}
|
|
3859
|
-
`,
|
|
3859
|
+
`,T0=l.div`
|
|
3860
3860
|
display: flex;
|
|
3861
3861
|
align-items: center;
|
|
3862
3862
|
gap: 20px;
|
|
@@ -3898,7 +3898,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3898
3898
|
display: inline-flex;
|
|
3899
3899
|
align-items: center;
|
|
3900
3900
|
gap: 6px;
|
|
3901
|
-
`,
|
|
3901
|
+
`,O0=l.div`
|
|
3902
3902
|
flex: 1;
|
|
3903
3903
|
padding: 24px 24px 0 24px;
|
|
3904
3904
|
overflow-y: auto;
|
|
@@ -3929,18 +3929,18 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3929
3929
|
flex-wrap: wrap;
|
|
3930
3930
|
gap: 12px;
|
|
3931
3931
|
margin-bottom: 0;
|
|
3932
|
-
`,
|
|
3932
|
+
`,M0=()=>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:"?"})]}),L0=({browser:t})=>{const r=(t==null?void 0:t.toLowerCase())||"",o={width:20,height:20};return r.includes("chrome")?e.jsx(_0,{...o}):r.includes("firefox")?e.jsx(C0,{...o}):r.includes("safari")?e.jsx(S0,{...o}):r.includes("edge")?e.jsx($0,{...o}):r.includes("opera")?e.jsx(z0,{...o}):r.includes("brave")?e.jsx(E0,{...o}):e.jsx(M0,{})},A0=()=>{const[t,r]=i.useState(null),{signins:o,removeSignin:n,refetch:a,loading:s}=Gi(),{refetch:p}=Ue(),{toast:f}=Rt(),c=o,h=async u=>{try{await n(u),await Promise.all([a(),p()]),r(null),f("Session ended successfully","info")}catch(m){f(m.message||"Failed to end session. Please try again.","error")}},d=u=>{if(!u||u.trim()==="")return"Unknown";const m=new Date(u);if(isNaN(m.getTime()))return"Unknown";const x=Math.floor((new Date().getTime()-m.getTime())/(1e3*60));return x<1?"Just now":x<60?`${x}m ago`:x<1440?`${Math.floor(x/60)}h ago`:m.toLocaleDateString()};return s?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"20px"},children:e.jsx(Pe,{})}):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(yt,{children:[e.jsx(wt,{children:e.jsxs(Be,{children:[e.jsx(_e,{children:"Browser & Device"}),e.jsx(_e,{children:"Location"}),e.jsx(_e,{children:"Last Active"}),e.jsx(_e,{})]})}),e.jsx(jt,{children:c.map(u=>e.jsxs(Be,{children:[e.jsx(Oe,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(zl,{children:e.jsx(L0,{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(Oe,{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(Oe,{children:d(u.last_active_at)}),e.jsx(kt,{children:e.jsxs(rt,{open:t===u.id,openChange:m=>r(m?u.id:null),children:[e.jsx(nt,{children:e.jsx(tn,{children:"•••"})}),e.jsx(ot,{children:e.jsx(Ee,{onClick:()=>h(u.id),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(St,{size:14}),"End Session"]})})})]})})]},u.id))})]}):e.jsx(st,{title:"No active sessions",description:"You don't have any active sessions at the moment."})})]})},D0=()=>{var b,g,S,k;const{deployment:t}=ve(),{toast:r}=Rt(),[o,n]=i.useState(null),[a,s]=i.useState(""),[p,f]=i.useState(!1),[c,h]=i.useState(null),[d,u]=i.useState(""),m=i.useRef(null),v=i.useRef({}),{user:x,createEmailAddress:w,deleteEmailAddress:_,prepareEmailVerification:z,attemptEmailVerification:y,makeEmailPrimary:P}=er();if(!((g=(b=t==null?void 0:t.auth_settings)==null?void 0:b.email_address)!=null&&g.enabled))return null;const C=async E=>{try{if(E===(x==null?void 0:x.primary_email_address_id)){r("Cannot delete primary email address. Please set another email as primary first.","error");return}await _(E),x.refetch(),r("Email address deleted successfully","info")}catch(R){r(R.message||"Failed to delete email address. Please try again.","error")}},j=i.useMemo(()=>x!=null&&x.user_email_addresses?d.trim()?x.user_email_addresses.filter(E=>E.email.toLowerCase().includes(d.toLowerCase())):x.user_email_addresses:[],[x==null?void 0:x.user_email_addresses,d]);return e.jsxs(e.Fragment,{children:[e.jsxs(Fo,{style:{marginBottom:"20px"},children:[e.jsx(bt,{value:d,onChange:u,placeholder:"Search Email"}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:m,onClick:()=>f(!0),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"Add Email"}),p&&e.jsx(Qs,{triggerRef:m,onClose:()=>f(!1),onAddEmail:async E=>{const R=await w(E);s(R.data.id),await z(R.data.id),x.refetch()},onPrepareVerification:async()=>{await z(a),x.refetch()},onAttemptVerification:async E=>{await y(a,E),x.refetch(),f(!1),s(""),r("Email added and verified successfully!","info")}})]})]}),j!=null&&j.length?e.jsxs(yt,{children:[e.jsx(wt,{children:e.jsxs(Be,{children:[e.jsx(_e,{children:"Email Address"}),e.jsx(_e,{children:"Status"}),e.jsx(_e,{})]})}),e.jsx(jt,{children:j.map(E=>e.jsxs(Be,{children:[e.jsx(Oe,{children:E.email}),e.jsx(Oe,{children:E.id===(x==null?void 0:x.primary_email_address_id)?"Primary":E.verified?"Verified":"Not Verified"}),e.jsx(kt,{children:E.id!==(x==null?void 0:x.primary_email_address_id)||!E.verified?e.jsxs(rt,{open:o===E.id,openChange:R=>n(R?E.id:null),children:[e.jsx(nt,{children:e.jsx(tn,{ref:R=>{R&&(v.current[E.id]=R)},children:"•••"})}),e.jsxs(ot,{children:[E.id!==(x==null?void 0:x.primary_email_address_id)&&E.verified&&e.jsx(Ee,{onClick:async()=>{try{await P(E.id),x.refetch(),n(null),r("Primary email updated successfully","info")}catch(R){r(R.message||"Failed to update primary email","error")}},children:"Make primary"}),!E.verified&&e.jsx(Ee,{onClick:async()=>{n(null),await z(E.id),h(E.id)},children:"Verify email"}),E.id!==(x==null?void 0:x.primary_email_address_id)&&e.jsx(Ee,{$destructive:!0,onClick:()=>{C(E.id),n(null)},children:"Remove"})]})]}):null})]},E.id))})]}):e.jsx(st,{title:d?"No emails match your search":"No email addresses",description:"Add an email address to get started."}),c&&e.jsx(Qs,{existingEmail:(k=(S=x==null?void 0:x.user_email_addresses)==null?void 0:S.find(E=>E.id===c))==null?void 0:k.email,triggerRef:{current:v.current[c]},onClose:()=>h(null),onAddEmail:async()=>{},onPrepareVerification:async()=>{await z(c),x.refetch()},onAttemptVerification:async E=>{await y(c,E),x.refetch(),h(null),r("Email verified successfully!","info")}})]})},N0=()=>{var j,b,g,S;const{deployment:t}=ve(),[r,o]=i.useState(null),[n,a]=i.useState(""),[s,p]=i.useState(!1),[f,c]=i.useState(null),[h,d]=i.useState(""),u=i.useRef(null),m=i.useRef({}),{user:v,createPhoneNumber:x,deletePhoneNumber:w,preparePhoneVerification:_,attemptPhoneVerification:z,makePhonePrimary:y}=er();if(!((b=(j=t==null?void 0:t.auth_settings)==null?void 0:j.phone_number)!=null&&b.enabled))return null;const P=k=>{const E=Eo.find(R=>R.dialCode===k);return(E==null?void 0:E.flag)||"🌍"},C=i.useMemo(()=>v!=null&&v.user_phone_numbers?h.trim()?v.user_phone_numbers.filter(k=>k.phone_number.toLowerCase().includes(h.toLowerCase())):v.user_phone_numbers:[],[v==null?void 0:v.user_phone_numbers,h]);return e.jsxs(e.Fragment,{children:[e.jsxs(Fo,{style:{marginBottom:"20px"},children:[e.jsx(bt,{value:h,onChange:d,placeholder:"Search Phone"}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:u,onClick:()=>p(!0),style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,height:"36px"},children:"Add Phone"}),s&&e.jsx(ei,{triggerRef:u,onClose:()=>p(!1),onAddPhone:async(k,E)=>{const R=await x(k,E);a(R.data.id),await _(R.data.id)},onPrepareVerification:async()=>{await _(n),v.refetch()},onAttemptVerification:async k=>{await z(n,k),v.refetch(),p(!1)}}),f&&e.jsx(ei,{existingPhone:(S=(g=v==null?void 0:v.user_phone_numbers)==null?void 0:g.find(k=>k.id===f))==null?void 0:S.phone_number,triggerRef:{current:m.current[f]},onClose:()=>c(null),onAddPhone:async()=>{},onPrepareVerification:async()=>{await _(f),v.refetch()},onAttemptVerification:async k=>{await z(f,k),v.refetch(),c(null)}})]})]}),C!=null&&C.length?e.jsxs(yt,{children:[e.jsx(wt,{children:e.jsxs(Be,{children:[e.jsx(_e,{children:"Phone Number"}),e.jsx(_e,{children:"Status"}),e.jsx(_e,{})]})}),e.jsx(jt,{children:C.map(k=>e.jsxs(Be,{children:[e.jsx(Oe,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"18px"},children:P(k.country_code)}),e.jsx("span",{children:k.country_code}),e.jsx("span",{children:k.phone_number})]})}),e.jsx(Oe,{children:k.id===(v==null?void 0:v.primary_phone_number_id)?"Primary":k.verified?"Verified":"Not Verified"}),e.jsx(kt,{children:e.jsxs(rt,{open:r===k.id,openChange:E=>o(E?k.id:null),children:[e.jsx(nt,{children:e.jsx(tn,{ref:E=>{E&&(m.current[k.id]=E)},children:"•••"})}),e.jsxs(ot,{children:[k.id!==(v==null?void 0:v.primary_phone_number_id)&&k.verified&&e.jsx(Ee,{onClick:async()=>{await y(k.id),o(null),v.refetch()},children:"Make primary"}),!k.verified&&e.jsx(Ee,{onClick:async()=>{await _(k.id),c(k.id),o(null)},children:"Verify phone"}),e.jsx(Ee,{$destructive:!0,onClick:async()=>{await w(k.id),o(null),v.refetch()},children:"Remove"})]})]})})]},k.id))})]}):e.jsx(st,{title:h?"No phones match your search":"No phone numbers",description:"Add a phone number to get started."})]})},zl=l.div`
|
|
3933
3933
|
svg {
|
|
3934
3934
|
width: 20px;
|
|
3935
3935
|
height: 20px;
|
|
3936
3936
|
flex-shrink: 0;
|
|
3937
3937
|
display: block;
|
|
3938
3938
|
}
|
|
3939
|
-
`,
|
|
3939
|
+
`,F0=()=>{const{user:t,disconnectSocialConnection:r,connectSocialAccount:o}=er(),{deployment:n}=ve(),a={google_oauth:{icon:e.jsx(Ec,{}),label:"Google"},microsoft_oauth:{icon:e.jsx(zc,{}),label:"Microsoft"},github_oauth:{icon:e.jsx($c,{}),label:"GitHub"},gitlab_oauth:{icon:e.jsx(Ic,{}),label:"GitLab"},linkedin_oauth:{icon:e.jsx(Rc,{}),label:"LinkedIn"},discord_oauth:{icon:e.jsx(Tc,{}),label:"Discord"},x_oauth:{icon:e.jsx(Pc,{}),label:"X"}},s=(n==null?void 0:n.social_connections.filter(p=>p.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:s.map((p,f)=>{var d;const c=((d=t==null?void 0:t.social_connections)==null?void 0:d.filter(u=>u.provider===p.provider))||[],h=a[p.provider];return h?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(zl,{children:h.icon}),e.jsx("div",{style:{fontSize:"14px",fontWeight:500},children:h.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(tn,{onClick:async()=>{await r(u.id.toString()),t.refetch()},style:{padding:"2px"},children:e.jsx(Qe,{size:14})})]},u.id)),c.length>0?e.jsx(X,{onClick:()=>{o({provider:p.provider,redirectUri:window.location.href})},style:{padding:"6px 24px",fontSize:"13px"},children:"Add"}):e.jsx(X,{onClick:()=>{o({provider:p.provider,redirectUri:window.location.href})},style:{padding:"6px 14px",fontSize:"13px"},children:"Connect"})]})]}),f<s.length-1&&e.jsx("div",{style:{height:"1px",background:"var(--color-border)"}})]},p.provider):null})})]})},El=()=>{var v,x,w,_,z,y;const{loading:t}=er(),{deployment:r}=ve(),[o,n]=i.useState("profile"),[a,s]=i.useState(null),[p,f]=i.useState("info"),c=i.useCallback((P,C="info")=>{s(P),f(C),setTimeout(()=>s(null),3e3)},[s]);if(t)return e.jsx(ie,{children:e.jsx(si,{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(Pe,{})})});const h=r==null?void 0:r.auth_settings,d=(v=h==null?void 0:h.email_address)==null?void 0:v.enabled,u=(x=h==null?void 0:h.phone_number)==null?void 0:x.enabled,m=((w=h==null?void 0:h.password)==null?void 0:w.enabled)||((_=h==null?void 0:h.auth_factors_enabled)==null?void 0:_.authenticator)||((z=h==null?void 0:h.auth_factors_enabled)==null?void 0:z.phone_otp)||((y=h==null?void 0:h.auth_factors_enabled)==null?void 0:y.backup_code);return e.jsx(ie,{children:e.jsx(R0,{children:e.jsx(_r.Provider,{value:{screen:null,setScreen:()=>{},toast:c},children:e.jsxs(si,{children:[e.jsx(I0,{children:e.jsxs(T0,{children:[e.jsx(lr,{$isActive:o==="profile",onClick:()=>n("profile"),children:e.jsxs(dr,{children:[e.jsx(Mo,{size:16}),"Profile"]})}),d&&e.jsx(lr,{$isActive:o==="email",onClick:()=>n("email"),children:e.jsxs(dr,{children:[e.jsx(Ur,{size:16}),"Email"]})}),u&&e.jsx(lr,{$isActive:o==="phone",onClick:()=>n("phone"),children:e.jsxs(dr,{children:[e.jsx(jh,{size:16}),"Phone"]})}),e.jsx(lr,{$isActive:o==="social",onClick:()=>n("social"),children:e.jsxs(dr,{children:[e.jsx(ph,{size:16}),"Connections"]})}),m&&e.jsx(lr,{$isActive:o==="security",onClick:()=>n("security"),children:e.jsxs(dr,{children:[e.jsx(Ko,{size:16}),"Security"]})}),e.jsx(lr,{$isActive:o==="sessions",onClick:()=>n("sessions"),children:e.jsxs(dr,{children:[e.jsx(Bp,{size:16}),"Sessions"]})})]})}),e.jsxs(O0,{children:[o==="profile"&&e.jsx(U0,{}),o==="email"&&d&&e.jsx(D0,{}),o==="phone"&&u&&e.jsx(N0,{}),o==="social"&&e.jsx(F0,{}),o==="security"&&m&&e.jsx(B0,{}),o==="sessions"&&e.jsx(A0,{})]}),a&&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:[p==="error"?e.jsx(Pt,{size:16,color:"var(--color-error)"}):e.jsx(tt,{size:16,color:"var(--color-success)"}),e.jsx("span",{style:{fontSize:"14px",color:"var(--color-foreground)"},children:a})]})})]})})})})},B0=()=>{var Te,q,J;const{deployment:t}=ve(),{user:r,updatePassword:o,removePassword:n,setupAuthenticator:a,verifyAuthenticator:s,deleteAuthenticator:p,generateBackupCodes:f,regenerateBackupCodes:c,updateProfile:h}=er(),{toast:d}=Rt(),[u,m]=i.useState((r==null?void 0:r.second_factor_policy)||"none"),v=async Z=>{try{await h({second_factor_policy:Z}),m(Z),d("Second factor policy updated successfully","info")}catch(ce){d(ce.message||"Failed to update second factor policy","error")}},[x,w]=i.useState(!1),[_,z]=i.useState(!1),[y,P]=i.useState(!1),[C,j]=i.useState(!1),b=i.useRef(null),g=i.useRef(null),S=i.useRef(null),k=i.useRef(null),[E,R]=i.useState("table"),[$,O]=i.useState(""),[I,T]=i.useState(""),[N,L]=i.useState(""),[D,B]=i.useState(["",""]),[oe,se]=i.useState([]),[ne,K]=i.useState(!1),[U,H]=i.useState(!1),[Q]=i.useState(!1),[ae,te]=i.useState(!1),ee=(Te=t==null?void 0:t.auth_settings)==null?void 0:Te.auth_factors_enabled,Y=(J=(q=t==null?void 0:t.auth_settings)==null?void 0:q.password)==null?void 0:J.enabled;if(!(ee!=null&&ee.authenticator)&&!(ee!=null&&ee.backup_code)&&!Y)return null;const de=async(Z,ce)=>{await o(Z,ce),await r.refetch(),d("Password updated successfully","info")},ue=async Z=>{await n(Z),await r.refetch(),d("Password removed successfully","info")},F=()=>{var Ne,Re,ze,rr,or,Wr;if(!r)return!1;const Z=(Ne=r.user_email_addresses)==null?void 0:Ne.some(Cr=>Cr.verified),ce=(Re=r.user_phone_numbers)==null?void 0:Re.some(Cr=>Cr.verified),je=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"&&Z||((ze=Se==null?void 0:Se.magic_link)==null?void 0:ze.enabled)&&Z||((rr=Se==null?void 0:Se.passkey)==null?void 0:rr.enabled)||((or=Se==null?void 0:Se.auth_factors_enabled)==null?void 0:or.phone_otp)&&ce||je&&((Wr=t==null?void 0:t.social_connections)==null?void 0:Wr.some(Cr=>Cr.enabled))},M=async()=>{if(D.some(Z=>Z.length!==6)){d("Please enter both 6-digit verification codes","error");return}try{if(H(!0),await s(N,D),await r.refetch(),ee!=null&&ee.backup_code){const Z=await f();se(Z),await r.refetch(),R("backup")}else R("success")}catch(Z){d(Z.message||"Invalid verification codes","error")}finally{H(!1)}},W=()=>{R("table"),O(""),T(""),L(""),B(["",""]),se([]),d("Two-factor authentication setup completed successfully!","info")},A=async()=>{var Z;if((Z=r==null?void 0:r.user_authenticator)!=null&&Z.id)try{te(!0),await p(r.user_authenticator.id),await r.refetch(),d("Authenticator removed successfully","info")}catch(ce){d(ce.message||"Failed to remove authenticator","error")}finally{te(!1)}},G=async()=>{if(!ne)try{K(!0);const Z=await c();se(Z),await r.refetch(),j(!0),d("New backup codes generated","info")}catch(Z){d(Z.message||"Failed to generate backup codes","error")}finally{K(!1)}},re=()=>{const Z=oe.join(`
|
|
3940
3940
|
`);navigator.clipboard.writeText(Z).then(()=>{d("Backup codes copied to clipboard","info")}).catch(()=>{d("Failed to copy backup codes","error")})},pe=()=>{const Z=oe.join(`
|
|
3941
|
-
`),ce=new Blob([Z],{type:"text/plain"}),je=URL.createObjectURL(ce),Se=document.createElement("a");Se.href=je,Se.download="wacht-backup-codes.txt",Se.click(),URL.revokeObjectURL(je),d("Backup codes downloaded","info")},we=[];return Y&&we.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"]}),ee!=null&&ee.authenticator&&we.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&&we.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)&&we.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"]}),E!=="table"?e.jsxs(e.Fragment,{children:[e.jsxs(Fo,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Ko,{size:16}),e.jsxs("span",{style:{fontSize:"14px",fontWeight:500,color:"var(--color-foreground)"},children:[E==="qr"&&"Setup Two-Factor Authentication",E==="verify"&&"Verify Your Authenticator",E==="backup"&&"Save Your Backup Codes",E==="success"&&"Setup Complete!"]})]}),e.jsx(X,{onClick:()=>R("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:[E==="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:Q?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:`${E0} 1s linear infinite`,margin:"0 auto 8px"}}),e.jsx("div",{style:{fontSize:"12px",color:"var(--color-secondary-text)"},children:"Loading QR Code..."})]})}):$?e.jsx("div",{style:{border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",padding:"16px",background:"white"},children:e.jsx(_a,{value:$,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:P||"Loading..."})]}),e.jsx(X,{onClick:()=>R("verify"),disabled:!$||!P,style:{padding:"10px 20px",background:!$||!P?"var(--color-border)":"var(--color-primary)",color:!$||!P?"var(--color-secondary-text)":"white",border:`1px solid ${!$||!P?"var(--color-border)":"var(--color-primary)"}`,cursor:!$||!P?"not-allowed":"pointer"},children:"I've Scanned the Code"})]}),E==="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(le,{type:"text",placeholder:"000000",value:D[0],onChange:Z=>{const ce=Z.target.value.replace(/[^0-9]/g,"").substring(0,6);B([ce,D[1]])},maxLength:6,style:{width:"100px",textAlign:"center",fontFamily:"monospace"}}),e.jsx(le,{type:"text",placeholder:"000000",value:D[1],onChange:Z=>{const ce=Z.target.value.replace(/[^0-9]/g,"").substring(0,6);B([D[0],ce])},maxLength:6,style:{width:"100px",textAlign:"center",fontFamily:"monospace"}})]}),e.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"center"},children:[e.jsx(X,{onClick:()=>R("qr"),style:{padding:"8px 16px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:"Back"}),e.jsx(X,{onClick:M,disabled:U||D.some(Z=>Z.length!==6),style:{padding:"8px 16px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)"},children:U?"Verifying...":"Verify & Continue"})]})]}),E==="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(It,{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:oe.map((Z,ce)=>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(Z),children:Z},ce))}),e.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"center",marginBottom:"24px"},children:[e.jsx(X,{onClick:re,style:{padding:"8px 16px",fontSize:"14px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:"Copy All"}),e.jsxs(X,{onClick:pe,style:{padding:"8px 16px",fontSize:"14px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:[e.jsx(Zo,{size:16,style:{marginRight:"4px"}}),"Download"]})]}),e.jsx(X,{onClick:W,style:{padding:"10px 20px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)"},children:"Complete Setup"})]}),E==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx(tt,{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:W,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(Fo,{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"})})}),we.length?e.jsx("div",{children:we.map((Z,ce)=>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:Z.name}),e.jsx("div",{style:{fontSize:"13px",color:"var(--color-secondary-text)"},children:Z.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:Z.status==="Enabled"||Z.status==="Generated"?"var(--color-success-background)":"var(--color-background-hover)",color:Z.status==="Enabled"||Z.status==="Generated"?"var(--color-success)":"var(--color-secondary-text)"},children:Z.status}),e.jsxs("div",{style:{position:"relative"},children:[Z.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:g,onClick:()=>z(!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"}),_&&e.jsx(ni,{triggerRef:g,onClose:()=>z(!1),onChangePassword:de})]}),F()&&e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:S,onClick:()=>I(!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"}),y&&e.jsx(g0,{triggerRef:S,onClose:()=>I(!1),onRemovePassword:ue})]})]}):e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:g,onClick:()=>z(!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"}),_&&e.jsx(ni,{triggerRef:g,onClose:()=>z(!1),onChangePassword:de,isSetup:!0})]})}),Z.id==="authenticator"&&!(r!=null&&r.user_authenticator)&&e.jsx(e.Fragment,{children:e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:b,onClick:()=>w(!0),disabled:Q,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:Q?"Setting up...":"Setup"}),x&&e.jsx(s0,{triggerRef:b,onClose:()=>w(!1),onSetupTOTP:async()=>{const je=await a();return A(je.id),je},onVerifyTOTP:async je=>{await s(N,je),await r.refetch(),d("Two-factor authentication enabled successfully!","info")}})]})}),Z.id==="authenticator"&&(r==null?void 0:r.user_authenticator)&&e.jsx(X,{onClick:L,disabled:ae,style:{padding:"6px 12px",fontSize:"12px",background:"var(--color-error)",color:"white",border:"1px solid var(--color-error)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:ae?"Removing...":"Remove"}),Z.id==="backup_codes"&&e.jsx(e.Fragment,{children:e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:k,onClick:G,disabled:ne,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:ne?"Generating...":r!=null&&r.backup_codes_generated?"Regenerate":"Generate"}),C&&e.jsx(j0,{triggerRef:k,codes:oe,onClose:()=>j(!1),onCopy:re,onDownload:pe})]})}),Z.id==="second_factor_policy"&&e.jsx(Ao,{checked:u==="enforced",onChange:je=>{v(je?"enforced":"none")}})]})]})]}),ce<we.length-1&&e.jsx("div",{style:{height:"1px",background:"var(--color-border)",margin:"0"}})]},Z.id))}):e.jsx(st,{title:"No security features available",description:"Contact your administrator to enable security features."})]})},B0=()=>{var A,D;const{deployment:t}=ve(),{user:r,updateProfile:o,updateProfilePicture:n,deleteAccount:a}=er(),{toast:s}=Rt(),[p,f]=i.useState(""),[c,h]=i.useState(""),[d,u]=i.useState(""),[m,v]=i.useState(!1),[x,w]=i.useState(!1),[_,z]=i.useState(!1),[y,I]=i.useState(""),[C,j]=i.useState((r==null?void 0:r.profile_picture_url)||null),b=i.useRef(null);i.useEffect(()=>{r&&!m&&(f(r.first_name||""),h(r.last_name||""),u(r.username||""),j(r.profile_picture_url||null),v(!0))},[r,m]);const g=i.useCallback(async()=>{if(r)try{const B={};p!==r.first_name&&(B.first_name=p),c!==r.last_name&&(B.last_name=c),d!==r.username&&(B.username=d),Object.keys(B).length>0&&await o(B)}catch(B){s(B.message||"Failed to save profile changes","error")}},[r,o,p,c,d,s]),S=B=>{f(B.target.value)},k=B=>{h(B.target.value)},E=B=>{u(B.target.value)},R=()=>{g()},$=()=>{g()},O=()=>{g()},P=B=>{var oe;if((oe=B.target.files)!=null&&oe[0]){const se=B.target.files[0];j(URL.createObjectURL(se)),setTimeout(async()=>{try{await n(se),r.refetch(),s("Profile picture updated successfully","info")}catch(ne){s(ne.message||"Failed to update profile picture","error"),j((r==null?void 0:r.profile_picture_url)||null)}},100)}},T=()=>{b.current&&b.current.click()};if(!r)return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Ie,{})});const N=async()=>{if(!(!r||y!==r.username)){z(!0);try{await a(""),s("Account deleted successfully","info")}catch(B){s(B.message||"Failed to delete account","error")}finally{z(!1),I(""),w(!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:B=>{B.currentTarget.style.borderColor="var(--color-primary)",B.currentTarget.style.transform="scale(1.02)"},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--color-border)",B.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(Mo,{size:32,color:"var(--color-muted)"}),e.jsx("input",{type:"file",ref:b,style:{display:"none"},accept:"image/*",onChange:P})]})}),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 B;return(B=b.current)==null?void 0:B.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(Zo,{size:14}),C?"Change":"Upload"]}),e.jsxs(X,{onClick:async()=>{j(null),b.current&&(b.current.value="");try{await o({remove_profile_picture:!0}),await r.refetch(),s("Profile picture removed successfully","info")}catch(B){s(B.message||"Failed to remove profile picture","error"),j((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(It,{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(fe,{style:{flex:1},children:[e.jsx(he,{htmlFor:"firstName",children:"First Name"}),e.jsx(le,{id:"firstName",type:"text",value:p,onChange:S,onBlur:R,placeholder:"Enter your first name",required:!0})]}),e.jsxs(fe,{style:{flex:1},children:[e.jsx(he,{htmlFor:"lastName",children:"Last Name"}),e.jsx(le,{id:"lastName",type:"text",value:c,onChange:k,onBlur:$,placeholder:"Enter your last name",required:!0})]})]}),((D=(A=t==null?void 0:t.auth_settings)==null?void 0:A.username)==null?void 0:D.enabled)&&e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"username",children:"Username"}),e.jsx(le,{id:"username",type:"text",value:d,onChange:E,onBlur:O,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:x?"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:()=>{x?(w(!1),I("")):w(!0)},style:{background:"var(--color-error)",color:"white",border:"none",padding:"6px 12px",fontSize:"13px",height:"32px",width:"auto"},children:x?"Cancel":"Delete"})]}),x&&e.jsxs("div",{style:{maxWidth:"400px"},children:[e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"confirm_username",children:"Confirm by typing your username"}),e.jsx(le,{id:"confirm_username",type:"text",value:y,onChange:B=>I(B.target.value),placeholder:`Type "${r==null?void 0:r.username}" to confirm`})]}),e.jsx(X,{onClick:N,disabled:y!==(r==null?void 0:r.username)||_,style:{background:y===(r==null?void 0:r.username)?"var(--color-error)":"transparent",color:y===(r==null?void 0:r.username)?"white":"var(--color-muted)",border:"1px solid var(--color-border)",padding:"8px 16px",fontSize:"14px",height:"36px",cursor:y===(r==null?void 0:r.username)?"pointer":"not-allowed",opacity:y===(r==null?void 0:r.username)?1:.6,marginTop:"12px"},children:_?e.jsx(Ie,{size:12}):"Delete Forever"})]})]})]})]})})},Il=({isOpen:t,onClose:r,title:o,showHeader:n,headerContent:a,footerContent:s,customContent:p,children:f,showCloseButton:c})=>e.jsx(ye,{isOpen:t,onClose:r,children:e.jsx(ye.Overlay,{children:e.jsxs(ye.Content,{style:{width:"900px",maxWidth:"100%"},children:[n&&e.jsx(ye.Header,{showCloseButton:c,children:a||o}),p||f||e.jsx(El,{}),s&&e.jsx(ye.Footer,{children:s})]})})}),U0=l.div`
|
|
3941
|
+
`),ce=new Blob([Z],{type:"text/plain"}),je=URL.createObjectURL(ce),Se=document.createElement("a");Se.href=je,Se.download="wacht-backup-codes.txt",Se.click(),URL.revokeObjectURL(je),d("Backup codes downloaded","info")},we=[];return Y&&we.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"]}),ee!=null&&ee.authenticator&&we.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&&we.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)&&we.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"]}),E!=="table"?e.jsxs(e.Fragment,{children:[e.jsxs(Fo,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(Ko,{size:16}),e.jsxs("span",{style:{fontSize:"14px",fontWeight:500,color:"var(--color-foreground)"},children:[E==="qr"&&"Setup Two-Factor Authentication",E==="verify"&&"Verify Your Authenticator",E==="backup"&&"Save Your Backup Codes",E==="success"&&"Setup Complete!"]})]}),e.jsx(X,{onClick:()=>R("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:[E==="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:Q?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:`${P0} 1s linear infinite`,margin:"0 auto 8px"}}),e.jsx("div",{style:{fontSize:"12px",color:"var(--color-secondary-text)"},children:"Loading QR Code..."})]})}):$?e.jsx("div",{style:{border:"1px solid var(--color-border)",borderRadius:"var(--radius-md)",padding:"16px",background:"white"},children:e.jsx(_a,{value:$,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:I||"Loading..."})]}),e.jsx(X,{onClick:()=>R("verify"),disabled:!$||!I,style:{padding:"10px 20px",background:!$||!I?"var(--color-border)":"var(--color-primary)",color:!$||!I?"var(--color-secondary-text)":"white",border:`1px solid ${!$||!I?"var(--color-border)":"var(--color-primary)"}`,cursor:!$||!I?"not-allowed":"pointer"},children:"I've Scanned the Code"})]}),E==="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(le,{type:"text",placeholder:"000000",value:D[0],onChange:Z=>{const ce=Z.target.value.replace(/[^0-9]/g,"").substring(0,6);B([ce,D[1]])},maxLength:6,style:{width:"100px",textAlign:"center",fontFamily:"monospace"}}),e.jsx(le,{type:"text",placeholder:"000000",value:D[1],onChange:Z=>{const ce=Z.target.value.replace(/[^0-9]/g,"").substring(0,6);B([D[0],ce])},maxLength:6,style:{width:"100px",textAlign:"center",fontFamily:"monospace"}})]}),e.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"center"},children:[e.jsx(X,{onClick:()=>R("qr"),style:{padding:"8px 16px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:"Back"}),e.jsx(X,{onClick:M,disabled:U||D.some(Z=>Z.length!==6),style:{padding:"8px 16px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)"},children:U?"Verifying...":"Verify & Continue"})]})]}),E==="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(Pt,{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:oe.map((Z,ce)=>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(Z),children:Z},ce))}),e.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"center",marginBottom:"24px"},children:[e.jsx(X,{onClick:re,style:{padding:"8px 16px",fontSize:"14px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:"Copy All"}),e.jsxs(X,{onClick:pe,style:{padding:"8px 16px",fontSize:"14px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:[e.jsx(Zo,{size:16,style:{marginRight:"4px"}}),"Download"]})]}),e.jsx(X,{onClick:W,style:{padding:"10px 20px",background:"var(--color-primary)",color:"white",border:"1px solid var(--color-primary)"},children:"Complete Setup"})]}),E==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx(tt,{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:W,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(Fo,{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"})})}),we.length?e.jsx("div",{children:we.map((Z,ce)=>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:Z.name}),e.jsx("div",{style:{fontSize:"13px",color:"var(--color-secondary-text)"},children:Z.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:Z.status==="Enabled"||Z.status==="Generated"?"var(--color-success-background)":"var(--color-background-hover)",color:Z.status==="Enabled"||Z.status==="Generated"?"var(--color-success)":"var(--color-secondary-text)"},children:Z.status}),e.jsxs("div",{style:{position:"relative"},children:[Z.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:g,onClick:()=>z(!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"}),_&&e.jsx(ni,{triggerRef:g,onClose:()=>z(!1),onChangePassword:de})]}),F()&&e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:S,onClick:()=>P(!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"}),y&&e.jsx(m0,{triggerRef:S,onClose:()=>P(!1),onRemovePassword:ue})]})]}):e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:g,onClick:()=>z(!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"}),_&&e.jsx(ni,{triggerRef:g,onClose:()=>z(!1),onChangePassword:de,isSetup:!0})]})}),Z.id==="authenticator"&&!(r!=null&&r.user_authenticator)&&e.jsx(e.Fragment,{children:e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:b,onClick:()=>w(!0),disabled:Q,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:Q?"Setting up...":"Setup"}),x&&e.jsx(i0,{triggerRef:b,onClose:()=>w(!1),onSetupTOTP:async()=>{const je=await a();return L(je.id),je},onVerifyTOTP:async je=>{await s(N,je),await r.refetch(),d("Two-factor authentication enabled successfully!","info")}})]})}),Z.id==="authenticator"&&(r==null?void 0:r.user_authenticator)&&e.jsx(X,{onClick:A,disabled:ae,style:{padding:"6px 12px",fontSize:"12px",background:"var(--color-error)",color:"white",border:"1px solid var(--color-error)",borderRadius:"var(--radius-md)",fontWeight:"400"},children:ae?"Removing...":"Remove"}),Z.id==="backup_codes"&&e.jsx(e.Fragment,{children:e.jsxs("div",{style:{position:"relative"},children:[e.jsx(X,{ref:k,onClick:G,disabled:ne,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:ne?"Generating...":r!=null&&r.backup_codes_generated?"Regenerate":"Generate"}),C&&e.jsx(k0,{triggerRef:k,codes:oe,onClose:()=>j(!1),onCopy:re,onDownload:pe})]})}),Z.id==="second_factor_policy"&&e.jsx(Lo,{checked:u==="enforced",onChange:je=>{v(je?"enforced":"none")}})]})]})]}),ce<we.length-1&&e.jsx("div",{style:{height:"1px",background:"var(--color-border)",margin:"0"}})]},Z.id))}):e.jsx(st,{title:"No security features available",description:"Contact your administrator to enable security features."})]})},U0=()=>{var L,D;const{deployment:t}=ve(),{user:r,updateProfile:o,updateProfilePicture:n,deleteAccount:a}=er(),{toast:s}=Rt(),[p,f]=i.useState(""),[c,h]=i.useState(""),[d,u]=i.useState(""),[m,v]=i.useState(!1),[x,w]=i.useState(!1),[_,z]=i.useState(!1),[y,P]=i.useState(""),[C,j]=i.useState((r==null?void 0:r.profile_picture_url)||null),b=i.useRef(null);i.useEffect(()=>{r&&!m&&(f(r.first_name||""),h(r.last_name||""),u(r.username||""),j(r.profile_picture_url||null),v(!0))},[r,m]);const g=i.useCallback(async()=>{if(r)try{const B={};p!==r.first_name&&(B.first_name=p),c!==r.last_name&&(B.last_name=c),d!==r.username&&(B.username=d),Object.keys(B).length>0&&await o(B)}catch(B){s(B.message||"Failed to save profile changes","error")}},[r,o,p,c,d,s]),S=B=>{f(B.target.value)},k=B=>{h(B.target.value)},E=B=>{u(B.target.value)},R=()=>{g()},$=()=>{g()},O=()=>{g()},I=B=>{var oe;if((oe=B.target.files)!=null&&oe[0]){const se=B.target.files[0];j(URL.createObjectURL(se)),setTimeout(async()=>{try{await n(se),r.refetch(),s("Profile picture updated successfully","info")}catch(ne){s(ne.message||"Failed to update profile picture","error"),j((r==null?void 0:r.profile_picture_url)||null)}},100)}},T=()=>{b.current&&b.current.click()};if(!r)return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"40px 0"},children:e.jsx(Pe,{})});const N=async()=>{if(!(!r||y!==r.username)){z(!0);try{await a(""),s("Account deleted successfully","info")}catch(B){s(B.message||"Failed to delete account","error")}finally{z(!1),P(""),w(!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:B=>{B.currentTarget.style.borderColor="var(--color-primary)",B.currentTarget.style.transform="scale(1.02)"},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--color-border)",B.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(Mo,{size:32,color:"var(--color-muted)"}),e.jsx("input",{type:"file",ref:b,style:{display:"none"},accept:"image/*",onChange:I})]})}),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 B;return(B=b.current)==null?void 0:B.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(Zo,{size:14}),C?"Change":"Upload"]}),e.jsxs(X,{onClick:async()=>{j(null),b.current&&(b.current.value="");try{await o({remove_profile_picture:!0}),await r.refetch(),s("Profile picture removed successfully","info")}catch(B){s(B.message||"Failed to remove profile picture","error"),j((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(Pt,{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(fe,{style:{flex:1},children:[e.jsx(he,{htmlFor:"firstName",children:"First Name"}),e.jsx(le,{id:"firstName",type:"text",value:p,onChange:S,onBlur:R,placeholder:"Enter your first name",required:!0})]}),e.jsxs(fe,{style:{flex:1},children:[e.jsx(he,{htmlFor:"lastName",children:"Last Name"}),e.jsx(le,{id:"lastName",type:"text",value:c,onChange:k,onBlur:$,placeholder:"Enter your last name",required:!0})]})]}),((D=(L=t==null?void 0:t.auth_settings)==null?void 0:L.username)==null?void 0:D.enabled)&&e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"username",children:"Username"}),e.jsx(le,{id:"username",type:"text",value:d,onChange:E,onBlur:O,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:x?"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:()=>{x?(w(!1),P("")):w(!0)},style:{background:"var(--color-error)",color:"white",border:"none",padding:"6px 12px",fontSize:"13px",height:"32px",width:"auto"},children:x?"Cancel":"Delete"})]}),x&&e.jsxs("div",{style:{maxWidth:"400px"},children:[e.jsxs(fe,{children:[e.jsx(he,{htmlFor:"confirm_username",children:"Confirm by typing your username"}),e.jsx(le,{id:"confirm_username",type:"text",value:y,onChange:B=>P(B.target.value),placeholder:`Type "${r==null?void 0:r.username}" to confirm`})]}),e.jsx(X,{onClick:N,disabled:y!==(r==null?void 0:r.username)||_,style:{background:y===(r==null?void 0:r.username)?"var(--color-error)":"transparent",color:y===(r==null?void 0:r.username)?"white":"var(--color-muted)",border:"1px solid var(--color-border)",padding:"8px 16px",fontSize:"14px",height:"36px",cursor:y===(r==null?void 0:r.username)?"pointer":"not-allowed",opacity:y===(r==null?void 0:r.username)?1:.6,marginTop:"12px"},children:_?e.jsx(Pe,{size:12}):"Delete Forever"})]})]})]})]})})},Pl=({isOpen:t,onClose:r,title:o,showHeader:n,headerContent:a,footerContent:s,customContent:p,children:f,showCloseButton:c})=>e.jsx(ye,{isOpen:t,onClose:r,children:e.jsx(ye.Overlay,{children:e.jsxs(ye.Content,{style:{width:"900px",maxWidth:"100%"},children:[n&&e.jsx(ye.Header,{showCloseButton:c,children:a||o}),p||f||e.jsx(El,{}),s&&e.jsx(ye.Footer,{children:s})]})})}),W0=l.div`
|
|
3942
3942
|
position: relative;
|
|
3943
|
-
`,
|
|
3943
|
+
`,V0=l.button`
|
|
3944
3944
|
display: flex;
|
|
3945
3945
|
align-items: center;
|
|
3946
3946
|
gap: 12px;
|
|
@@ -3971,7 +3971,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3971
3971
|
height: 100%;
|
|
3972
3972
|
object-fit: cover;
|
|
3973
3973
|
}
|
|
3974
|
-
`,
|
|
3974
|
+
`,G0=l.div`
|
|
3975
3975
|
font-size: 14px;
|
|
3976
3976
|
font-weight: 500;
|
|
3977
3977
|
color: var(--color-foreground);
|
|
@@ -3982,7 +3982,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
3982
3982
|
`,ci=l.span`
|
|
3983
3983
|
font-size: 12px;
|
|
3984
3984
|
color: var(--color-secondary-text);
|
|
3985
|
-
`,
|
|
3985
|
+
`,H0=l.div`
|
|
3986
3986
|
position: fixed;
|
|
3987
3987
|
${t=>{var r;return((r=t.$position)==null?void 0:r.top)!==void 0?`top: ${t.$position.top}px;`:""}}
|
|
3988
3988
|
${t=>{var r;return((r=t.$position)==null?void 0:r.bottom)!==void 0?`bottom: ${t.$position.bottom}px;`:""}}
|
|
@@ -4078,7 +4078,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4078
4078
|
width: 14px;
|
|
4079
4079
|
height: 14px;
|
|
4080
4080
|
}
|
|
4081
|
-
`,
|
|
4081
|
+
`,Il=({showName:t=!0})=>{var g,S,k,E;const[r,o]=i.useState(!1),[n,a]=i.useState(),s=Or(!1),p=i.useRef(null),f=i.useRef(null),{session:c,signOut:h,switchSignIn:d,addNewAccount:u,refetch:m}=Ue(),{deployment:v}=ve(),x=(g=c==null?void 0:c.active_signin)==null?void 0:g.user,w=((k=(S=v==null?void 0:v.auth_settings)==null?void 0:S.multi_session_support)==null?void 0:k.enabled)??!1,_=(((E=c==null?void 0:c.signins)==null?void 0:E.length)??0)>1;i.useEffect(()=>{if(!r)return;const R=setTimeout(()=>{const $=O=>{var T,N;const I=O.target;(T=p.current)!=null&&T.contains(I)||(N=f.current)!=null&&N.contains(I)||o(!1)};return document.addEventListener("mousedown",$),()=>{document.removeEventListener("mousedown",$)}},50);return()=>{clearTimeout(R)}},[r]),i.useEffect(()=>{if(r&&p.current){const R=p.current.getBoundingClientRect(),$=380,O=window.innerWidth,I=window.innerHeight,T=O-R.left,N=R.right,L=I-R.bottom,D=R.top;let B,oe;const se=R.left;O-R.right<se&&N>=$?oe=O-R.right:T>=$?B=R.left:N>=$?B=R.right-$:B=Math.max(8,Math.min(O-$-8,R.left-($-R.width)/2));let K,U,H;L>=100?(K=R.bottom+8,H=L-16):D>=100?(U=I-R.top+8,H=Math.min(400,D-16)):(K=R.bottom+8,H=Math.max(100,L-16)),a({top:K,bottom:U,left:B,right:oe,maxHeight:H})}else a(void 0)},[r]);const z=()=>{o(!r)},y=R=>R.split(" ").map($=>$[0]).join("").toUpperCase(),P=async R=>{try{await h(R),await m(),o(!1)}catch{}},C=async()=>{try{await h(),await m(),o(!1)}catch{}},j=async R=>{try{await d(R),await m(),o(!1)}catch{}},b=()=>{s.open(),o(!1)};return e.jsx(ie,{children:e.jsxs(W0,{children:[e.jsxs(V0,{ref:p,onClick:z,children:[e.jsx(Fn,{children:e.jsx(Rl,{children:x!=null&&x.has_profile_picture?e.jsx("img",{src:x.profile_picture_url,alt:x.first_name}):y(`${(x==null?void 0:x.first_name)||""} ${(x==null?void 0:x.last_name)||""}`)})}),t&&e.jsx(G0,{children:`${(x==null?void 0:x.first_name)||""} ${(x==null?void 0:x.last_name)||""}`})]}),typeof window<"u"&&r&&Nr.createPortal(e.jsx(ie,{children:e.jsx(H0,{ref:f,$position:n,$isOpen:r,$maxHeight:n==null?void 0:n.maxHeight,children:e.jsxs("div",{children:[w?(()=>{const R=[...(c==null?void 0:c.signins)||[]].sort(($,O)=>{const I=$.user.id===(x==null?void 0:x.id),T=O.user.id===(x==null?void 0:x.id);return I&&!T?-1:!I&&T?1:0});return R.map(({user:$,id:O},I)=>{const T=$.id===(x==null?void 0:x.id),N=!T;return e.jsxs(i.Fragment,{children:[e.jsxs(li,{$isClickable:N,onClick:N?()=>j(O):void 0,children:[e.jsxs(di,{children:[e.jsx(Fn,{children:e.jsx(hi,{children:$.has_profile_picture?e.jsx("img",{src:$.profile_picture_url,alt:$.first_name}):y(`${($==null?void 0:$.first_name)||""} ${($==null?void 0:$.last_name)||""}`)})}),e.jsxs(ui,{children:[e.jsx(pi,{children:e.jsx(ii,{children:`${($==null?void 0:$.first_name)||""} ${($==null?void 0:$.last_name)||""}`})}),e.jsx(ci,{children:$.primary_email_address.email})]})]}),T&&e.jsxs(fi,{children:[e.jsxs(jo,{onClick:b,children:[e.jsx(Zt,{}),"Manage account"]}),e.jsxs(jo,{$destructive:!0,onClick:()=>P(O),children:[e.jsx(St,{}),"Sign out"]})]})]}),I===0&&R.length>1&&e.jsx("div",{style:{borderBottom:"1px solid var(--color-border)",margin:"0"}})]},$.id)})})():x&&e.jsxs(li,{$isClickable:!1,children:[e.jsxs(di,{children:[e.jsx(Fn,{children:e.jsx(hi,{children:x.has_profile_picture?e.jsx("img",{src:x.profile_picture_url,alt:x.first_name}):y(`${(x==null?void 0:x.first_name)||""} ${(x==null?void 0:x.last_name)||""}`)})}),e.jsxs(ui,{children:[e.jsx(pi,{children:e.jsx(ii,{children:`${(x==null?void 0:x.first_name)||""} ${(x==null?void 0:x.last_name)||""}`})}),e.jsx(ci,{children:x.primary_email_address.email})]})]}),e.jsxs(fi,{children:[e.jsxs(jo,{onClick:b,children:[e.jsx(Zt,{}),"Manage account"]}),e.jsxs(jo,{$destructive:!0,onClick:()=>{var R;return P(((R=c==null?void 0:c.active_signin)==null?void 0:R.id)||"")},children:[e.jsx(St,{}),"Sign out"]})]})]}),w&&e.jsxs(e.Fragment,{children:[e.jsx(gi,{style:{borderBottom:"1px solid var(--color-border)"},children:e.jsxs(mi,{onClick:u,children:[e.jsx(lt,{}),"Add new account"]})}),_&&e.jsx(gi,{children:e.jsxs(mi,{onClick:C,children:[e.jsx(St,{}),"Sign out of all accounts"]})})]})]})})}),document.body),e.jsx(Pl,{isOpen:s.isOpen,onClose:s.close})]})})},q0=l.div`
|
|
4082
4082
|
padding: var(--space-md) var(--space-lg);
|
|
4083
4083
|
background: ${t=>t.$unread?"var(--color-background-hover)":"transparent"};
|
|
4084
4084
|
transition: all 0.2s ease;
|
|
@@ -4093,49 +4093,49 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4093
4093
|
&:not(:last-child) {
|
|
4094
4094
|
border-bottom: 1px solid var(--color-border);
|
|
4095
4095
|
}
|
|
4096
|
-
`,
|
|
4096
|
+
`,Y0=l.div`
|
|
4097
4097
|
display: flex;
|
|
4098
4098
|
align-items: flex-start;
|
|
4099
4099
|
justify-content: space-between;
|
|
4100
4100
|
gap: var(--space-sm);
|
|
4101
4101
|
margin-bottom: var(--space-xs);
|
|
4102
|
-
`,
|
|
4102
|
+
`,Z0=l.div`
|
|
4103
4103
|
display: flex;
|
|
4104
4104
|
align-items: center;
|
|
4105
4105
|
flex: 1;
|
|
4106
4106
|
gap: var(--space-xs);
|
|
4107
|
-
`,
|
|
4107
|
+
`,K0=l.h4`
|
|
4108
4108
|
font-size: var(--font-xs);
|
|
4109
4109
|
font-weight: 500;
|
|
4110
4110
|
color: var(--color-foreground);
|
|
4111
4111
|
margin: 0;
|
|
4112
4112
|
flex: 1;
|
|
4113
4113
|
line-height: 1.4;
|
|
4114
|
-
`,
|
|
4114
|
+
`,Q0=l.span`
|
|
4115
4115
|
display: inline-block;
|
|
4116
4116
|
width: 8px;
|
|
4117
4117
|
height: 8px;
|
|
4118
4118
|
border-radius: var(--radius-full);
|
|
4119
4119
|
background: ${t=>{switch(t.$severity){case"success":return"var(--color-success)";case"warning":return"var(--color-warning)";case"error":return"var(--color-error)";default:return"var(--color-primary)"}}};
|
|
4120
4120
|
flex-shrink: 0;
|
|
4121
|
-
`,
|
|
4121
|
+
`,X0=l.p`
|
|
4122
4122
|
font-size: var(--font-2xs);
|
|
4123
4123
|
color: var(--color-secondary-text);
|
|
4124
4124
|
margin: 0 0 var(--space-sm) 0;
|
|
4125
4125
|
line-height: 1.5;
|
|
4126
|
-
`,
|
|
4126
|
+
`,J0=l.div`
|
|
4127
4127
|
display: flex;
|
|
4128
4128
|
align-items: center;
|
|
4129
4129
|
justify-content: space-between;
|
|
4130
4130
|
gap: var(--space-sm);
|
|
4131
|
-
`,
|
|
4131
|
+
`,e1=l.span`
|
|
4132
4132
|
font-size: var(--font-2xs);
|
|
4133
4133
|
color: var(--color-muted);
|
|
4134
|
-
`,
|
|
4134
|
+
`,t1=l.div`
|
|
4135
4135
|
display: flex;
|
|
4136
4136
|
align-items: center;
|
|
4137
4137
|
gap: var(--space-xs);
|
|
4138
|
-
`,
|
|
4138
|
+
`,r1=l.button`
|
|
4139
4139
|
background: transparent;
|
|
4140
4140
|
border: none;
|
|
4141
4141
|
padding: var(--space-2xs);
|
|
@@ -4161,7 +4161,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4161
4161
|
width: 14px;
|
|
4162
4162
|
height: 14px;
|
|
4163
4163
|
}
|
|
4164
|
-
`,
|
|
4164
|
+
`,o1=l.a`
|
|
4165
4165
|
display: inline-flex;
|
|
4166
4166
|
align-items: center;
|
|
4167
4167
|
gap: var(--space-2xs);
|
|
@@ -4187,7 +4187,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4187
4187
|
width: 12px;
|
|
4188
4188
|
height: 12px;
|
|
4189
4189
|
}
|
|
4190
|
-
`;function Tl({notification:t,onMarkAsRead:r,onDelete:o}){const n=()=>{t.is_read||r(t.id)},a=s=>{const p=new Date(s),c=new Date().getTime()-p.getTime(),h=Math.floor(c/1e3),d=Math.floor(h/60),u=Math.floor(d/60),m=Math.floor(u/24);return m>7?p.toLocaleDateString():m>0?`${m}d ago`:u>0?`${u}h ago`:d>0?`${d}m ago`:"Just now"};return e.jsxs(
|
|
4190
|
+
`;function Tl({notification:t,onMarkAsRead:r,onDelete:o}){const n=()=>{t.is_read||r(t.id)},a=s=>{const p=new Date(s),c=new Date().getTime()-p.getTime(),h=Math.floor(c/1e3),d=Math.floor(h/60),u=Math.floor(d/60),m=Math.floor(u/24);return m>7?p.toLocaleDateString():m>0?`${m}d ago`:u>0?`${u}h ago`:d>0?`${d}m ago`:"Just now"};return e.jsxs(q0,{$unread:!t.is_read,onClick:n,children:[e.jsxs(Y0,{children:[e.jsxs(Z0,{children:[e.jsx(Q0,{$severity:t.severity}),e.jsx(K0,{children:t.title})]}),e.jsx(r1,{onClick:s=>{s.stopPropagation(),o(t.id)},"aria-label":"Delete notification",children:e.jsx(Qe,{})})]}),e.jsx(X0,{children:t.body}),e.jsxs(J0,{children:[e.jsx(e1,{children:a(t.created_at)}),t.action_url&&e.jsx(t1,{children:e.jsxs(o1,{href:t.action_url,target:"_blank",rel:"noopener noreferrer",onClick:s=>s.stopPropagation(),children:[t.action_label||"View",e.jsx(Ac,{})]})})]})]})}const n1=l.div`
|
|
4191
4191
|
position: fixed;
|
|
4192
4192
|
${t=>{var r;return((r=t.$position)==null?void 0:r.top)!==void 0?`top: ${t.$position.top}px;`:""}}
|
|
4193
4193
|
${t=>{var r;return((r=t.$position)==null?void 0:r.bottom)!==void 0?`bottom: ${t.$position.bottom}px;`:""}}
|
|
@@ -4208,19 +4208,19 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4208
4208
|
width: 320px;
|
|
4209
4209
|
max-height: 500px;
|
|
4210
4210
|
}
|
|
4211
|
-
`,
|
|
4211
|
+
`,a1=l.div`
|
|
4212
4212
|
padding: 10px 16px;
|
|
4213
4213
|
border-bottom: 1px solid var(--color-border);
|
|
4214
4214
|
display: flex;
|
|
4215
4215
|
align-items: center;
|
|
4216
4216
|
justify-content: space-between;
|
|
4217
4217
|
background: var(--color-background);
|
|
4218
|
-
`,
|
|
4218
|
+
`,s1=l.h3`
|
|
4219
4219
|
font-size: 14px;
|
|
4220
4220
|
font-weight: 500;
|
|
4221
4221
|
color: var(--color-foreground);
|
|
4222
4222
|
margin: 0;
|
|
4223
|
-
`,
|
|
4223
|
+
`,i1=l.button`
|
|
4224
4224
|
background: transparent;
|
|
4225
4225
|
border: none;
|
|
4226
4226
|
color: var(--color-primary);
|
|
@@ -4240,23 +4240,23 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4240
4240
|
outline: none;
|
|
4241
4241
|
box-shadow: 0 0 0 2px var(--color-primary);
|
|
4242
4242
|
}
|
|
4243
|
-
`,
|
|
4243
|
+
`,c1=l.div`
|
|
4244
4244
|
flex: 1;
|
|
4245
4245
|
overflow-y: auto;
|
|
4246
4246
|
max-height: 450px;
|
|
4247
|
-
`,
|
|
4247
|
+
`,l1=l.div`
|
|
4248
4248
|
display: flex;
|
|
4249
4249
|
align-items: center;
|
|
4250
4250
|
justify-content: center;
|
|
4251
4251
|
padding: 32px;
|
|
4252
|
-
`,
|
|
4252
|
+
`,d1=l.div`
|
|
4253
4253
|
padding: 40px 16px;
|
|
4254
4254
|
display: flex;
|
|
4255
4255
|
flex-direction: column;
|
|
4256
4256
|
align-items: center;
|
|
4257
4257
|
justify-content: center;
|
|
4258
4258
|
text-align: center;
|
|
4259
|
-
`,
|
|
4259
|
+
`,u1=l.div`
|
|
4260
4260
|
width: 40px;
|
|
4261
4261
|
height: 40px;
|
|
4262
4262
|
border-radius: 50%;
|
|
@@ -4272,22 +4272,22 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4272
4272
|
color: var(--color-secondary-text);
|
|
4273
4273
|
opacity: 0.6;
|
|
4274
4274
|
}
|
|
4275
|
-
`,
|
|
4275
|
+
`,p1=l.h3`
|
|
4276
4276
|
font-size: 14px;
|
|
4277
4277
|
font-weight: 500;
|
|
4278
4278
|
color: var(--color-foreground);
|
|
4279
4279
|
margin: 0 0 4px 0;
|
|
4280
|
-
`,
|
|
4280
|
+
`,h1=l.p`
|
|
4281
4281
|
font-size: var(--font-xs);
|
|
4282
4282
|
color: var(--color-secondary-text);
|
|
4283
4283
|
margin: 0;
|
|
4284
4284
|
line-height: 1.4;
|
|
4285
|
-
`,
|
|
4285
|
+
`,f1=l.div`
|
|
4286
4286
|
padding: 8px 16px;
|
|
4287
4287
|
border-top: 1px solid var(--color-border);
|
|
4288
4288
|
background: var(--color-background);
|
|
4289
4289
|
text-align: center;
|
|
4290
|
-
`,
|
|
4290
|
+
`,g1=l.a`
|
|
4291
4291
|
color: var(--color-primary);
|
|
4292
4292
|
font-size: var(--font-xs);
|
|
4293
4293
|
font-weight: 500;
|
|
@@ -4298,9 +4298,9 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4298
4298
|
color: var(--color-primary-hover);
|
|
4299
4299
|
text-decoration: underline;
|
|
4300
4300
|
}
|
|
4301
|
-
`,Ol=i.forwardRef(({position:t,notifications:r,loading:o,onMarkAsRead:n,onMarkAllAsRead:a,onDelete:s},p)=>{const f=!o&&r.some(c=>!c.is_read);return console.log("loadings",o),e.jsxs(
|
|
4301
|
+
`,Ol=i.forwardRef(({position:t,notifications:r,loading:o,onMarkAsRead:n,onMarkAllAsRead:a,onDelete:s},p)=>{const f=!o&&r.some(c=>!c.is_read);return console.log("loadings",o),e.jsxs(n1,{ref:p,$position:t,children:[e.jsxs(a1,{children:[e.jsx(s1,{children:"Notifications"}),f&&e.jsx(i1,{onClick:a,children:"Mark all as read"})]}),e.jsx(c1,{children:o?e.jsx(l1,{children:e.jsx(Pe,{})}):r.length===0?e.jsxs(d1,{children:[e.jsx(u1,{children:e.jsx(Wp,{})}),e.jsx(p1,{children:"No notifications"}),e.jsx(h1,{children:"You're all caught up!"})]}):r.map(c=>e.jsx(Tl,{notification:c,onMarkAsRead:n,onDelete:s},c.id))}),!o&&r.length>0&&e.jsx(f1,{children:e.jsx(g1,{href:"/notifications",children:"View all notifications"})})]})}),m1=l.div`
|
|
4302
4302
|
position: relative;
|
|
4303
|
-
`,
|
|
4303
|
+
`,x1=l.div`
|
|
4304
4304
|
width: 40px;
|
|
4305
4305
|
height: 40px;
|
|
4306
4306
|
border-radius: 50%;
|
|
@@ -4315,7 +4315,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4315
4315
|
background: var(--color-background-hover);
|
|
4316
4316
|
border-color: var(--color-primary);
|
|
4317
4317
|
}
|
|
4318
|
-
`,
|
|
4318
|
+
`,v1=l.button`
|
|
4319
4319
|
position: relative;
|
|
4320
4320
|
display: flex;
|
|
4321
4321
|
align-items: center;
|
|
@@ -4344,7 +4344,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4344
4344
|
&:hover svg {
|
|
4345
4345
|
color: var(--color-primary);
|
|
4346
4346
|
}
|
|
4347
|
-
`,
|
|
4347
|
+
`,b1=l.span`
|
|
4348
4348
|
position: absolute;
|
|
4349
4349
|
top: -2px;
|
|
4350
4350
|
right: -2px;
|
|
@@ -4361,18 +4361,18 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4361
4361
|
justify-content: center;
|
|
4362
4362
|
border: 2px solid var(--color-background);
|
|
4363
4363
|
box-shadow: 0 1px 3px var(--color-shadow);
|
|
4364
|
-
`;function Ml({className:t,showBadge:r=!0,channels:o=["user"],organizationIds:n,workspaceIds:a}){const[s,p]=i.useState(!1),[f,c]=i.useState(),h=i.useRef(null),d=i.useRef(null),u={channels:o,organization_ids:n,workspace_ids:a,limit:20},{unreadCount:m,notifications:v,loading:x,markAsRead:w,markAllAsRead:_,deleteNotification:z}=Ji(u);return i.useEffect(()=>{if(!s)return;const y=setTimeout(()=>{const
|
|
4364
|
+
`;function Ml({className:t,showBadge:r=!0,channels:o=["user"],organizationIds:n,workspaceIds:a}){const[s,p]=i.useState(!1),[f,c]=i.useState(),h=i.useRef(null),d=i.useRef(null),u={channels:o,organization_ids:n,workspace_ids:a,limit:20},{unreadCount:m,notifications:v,loading:x,markAsRead:w,markAllAsRead:_,deleteNotification:z}=Ji(u);return i.useEffect(()=>{if(!s)return;const y=setTimeout(()=>{const P=C=>{var b,g;const j=C.target;(b=h.current)!=null&&b.contains(j)||(g=d.current)!=null&&g.contains(j)||p(!1)};return document.addEventListener("mousedown",P),()=>{document.removeEventListener("mousedown",P)}},50);return()=>{clearTimeout(y)}},[s]),i.useEffect(()=>{if(s&&h.current){const y=h.current.getBoundingClientRect(),P=400,C=600,j=window.innerWidth,b=window.innerHeight,g=j-y.left,S=b-y.bottom,k=y.top;let E,R;g>=P?E=y.left:R=j-y.right;let $,O;S>=C+8?$=y.bottom+8:k>=C+8?O=b-y.top+8:$=y.bottom+8,c({top:$,bottom:O,left:E,right:R})}else c(void 0)},[s]),e.jsx(ie,{children:e.jsxs(m1,{ref:h,className:t,children:[e.jsx(x1,{children:e.jsxs(v1,{onClick:()=>p(!s),children:[e.jsx(Gp,{size:16}),r&&m>0&&e.jsx(b1,{children:m>9?"9+":m})]})}),typeof window<"u"&&s&&Nr.createPortal(e.jsx(ie,{children:e.jsx(Ol,{ref:d,position:f,notifications:v,loading:x,onMarkAsRead:w,onMarkAllAsRead:_,onDelete:z})}),document.body)]})})}const y1=l.div`
|
|
4365
4365
|
display: flex;
|
|
4366
4366
|
align-items: center;
|
|
4367
4367
|
gap: 8px;
|
|
4368
|
-
`,
|
|
4368
|
+
`,w1=({showName:t=!0,showNotifications:r=!0})=>e.jsxs(y1,{children:[r&&e.jsx(Ml,{}),e.jsx(Il,{showName:t})]}),j1=({children:t})=>{var s;const{session:r,loading:o}=Ue(),{deployment:n}=ve(),{navigate:a}=qe();return i.useEffect(()=>{var p;if(!o&&(p=r==null?void 0:r.signins)!=null&&p.length&&!r.active_signin){let f=window.location.href,c=new URL(f);c.searchParams.set("redirect_uri",f),a(c.toString())}},[o,r,n,a]),o||!((s=r.signins)!=null&&s.length)||!r.active_signin?null:e.jsx(e.Fragment,{children:t})},k1=({children:t})=>{var n;const{loading:r,session:o}=Ue();return r||(n=o.signins)!=null&&n.length?null:e.jsx(e.Fragment,{children:t})},Ll=jr`
|
|
4369
4369
|
0% {
|
|
4370
4370
|
background-position: -1000px 0;
|
|
4371
4371
|
}
|
|
4372
4372
|
100% {
|
|
4373
4373
|
background-position: 1000px 0;
|
|
4374
4374
|
}
|
|
4375
|
-
`,
|
|
4375
|
+
`,_1=jr`
|
|
4376
4376
|
from {
|
|
4377
4377
|
transform: rotate(0deg);
|
|
4378
4378
|
}
|
|
@@ -4403,7 +4403,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4403
4403
|
`,wi=l.p`
|
|
4404
4404
|
color: var(--color-secondary-text);
|
|
4405
4405
|
font-size: var(--font-xs);
|
|
4406
|
-
`,
|
|
4406
|
+
`,C1=l.div`
|
|
4407
4407
|
display: flex;
|
|
4408
4408
|
align-items: center;
|
|
4409
4409
|
gap: var(--space-md);
|
|
@@ -4456,7 +4456,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4456
4456
|
50% { opacity: 0.5; }
|
|
4457
4457
|
}
|
|
4458
4458
|
`}
|
|
4459
|
-
`,
|
|
4459
|
+
`,S1=l.div`
|
|
4460
4460
|
width: 40px;
|
|
4461
4461
|
height: 40px;
|
|
4462
4462
|
border-radius: 50%;
|
|
@@ -4475,10 +4475,10 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4475
4475
|
height: 100%;
|
|
4476
4476
|
object-fit: cover;
|
|
4477
4477
|
}
|
|
4478
|
-
|
|
4478
|
+
`,$1=l.div`
|
|
4479
4479
|
flex: 1;
|
|
4480
4480
|
min-width: 0;
|
|
4481
|
-
|
|
4481
|
+
`,z1=l.div`
|
|
4482
4482
|
font-size: var(--font-sm);
|
|
4483
4483
|
font-weight: 500;
|
|
4484
4484
|
color: var(--color-foreground);
|
|
@@ -4486,13 +4486,13 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4486
4486
|
white-space: nowrap;
|
|
4487
4487
|
overflow: hidden;
|
|
4488
4488
|
text-overflow: ellipsis;
|
|
4489
|
-
`,
|
|
4489
|
+
`,E1=l.div`
|
|
4490
4490
|
font-size: var(--font-xs);
|
|
4491
4491
|
color: var(--color-secondary-text);
|
|
4492
4492
|
white-space: nowrap;
|
|
4493
4493
|
overflow: hidden;
|
|
4494
4494
|
text-overflow: ellipsis;
|
|
4495
|
-
`,
|
|
4495
|
+
`,P1=l.button`
|
|
4496
4496
|
display: flex;
|
|
4497
4497
|
align-items: center;
|
|
4498
4498
|
gap: var(--space-xs);
|
|
@@ -4512,10 +4512,10 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4512
4512
|
}
|
|
4513
4513
|
|
|
4514
4514
|
svg {
|
|
4515
|
-
animation: ${t=>t.$isLoading?
|
|
4515
|
+
animation: ${t=>t.$isLoading?_1:"none"} 1s linear
|
|
4516
4516
|
infinite;
|
|
4517
4517
|
}
|
|
4518
|
-
`,
|
|
4518
|
+
`,R1=l.button`
|
|
4519
4519
|
display: flex;
|
|
4520
4520
|
align-items: center;
|
|
4521
4521
|
justify-content: center;
|
|
@@ -4540,7 +4540,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4540
4540
|
width: 16px;
|
|
4541
4541
|
height: 16px;
|
|
4542
4542
|
}
|
|
4543
|
-
`,
|
|
4543
|
+
`,I1=l.div`
|
|
4544
4544
|
display: flex;
|
|
4545
4545
|
align-items: center;
|
|
4546
4546
|
gap: var(--space-md);
|
|
@@ -4550,7 +4550,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4550
4550
|
&:last-child {
|
|
4551
4551
|
border-bottom: none;
|
|
4552
4552
|
}
|
|
4553
|
-
`,
|
|
4553
|
+
`,T1=l.div`
|
|
4554
4554
|
width: 40px;
|
|
4555
4555
|
height: 40px;
|
|
4556
4556
|
border-radius: 50%;
|
|
@@ -4561,8 +4561,8 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4561
4561
|
var(--color-background-hover) 100%
|
|
4562
4562
|
);
|
|
4563
4563
|
background-size: 1000px 100%;
|
|
4564
|
-
animation: ${
|
|
4565
|
-
`,
|
|
4564
|
+
animation: ${Ll} 2s infinite linear;
|
|
4565
|
+
`,O1=l.div`
|
|
4566
4566
|
flex: 1;
|
|
4567
4567
|
display: flex;
|
|
4568
4568
|
flex-direction: column;
|
|
@@ -4578,13 +4578,13 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4578
4578
|
var(--color-background-hover) 100%
|
|
4579
4579
|
);
|
|
4580
4580
|
background-size: 1000px 100%;
|
|
4581
|
-
animation: ${
|
|
4582
|
-
`,
|
|
4581
|
+
animation: ${Ll} 2s infinite linear;
|
|
4582
|
+
`,M1=l.p`
|
|
4583
4583
|
margin-top: var(--space-lg);
|
|
4584
4584
|
text-align: center;
|
|
4585
4585
|
font-size: var(--font-xs);
|
|
4586
4586
|
color: var(--color-secondary-text);
|
|
4587
|
-
`,
|
|
4587
|
+
`,L1=l.span`
|
|
4588
4588
|
color: var(--color-primary);
|
|
4589
4589
|
text-decoration: none;
|
|
4590
4590
|
font-weight: 500;
|
|
@@ -4594,24 +4594,24 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4594
4594
|
&:hover {
|
|
4595
4595
|
color: var(--color-primary-hover);
|
|
4596
4596
|
}
|
|
4597
|
-
`,A1=({onAccountSelect:t,showAddAccount:r=!0})=>{var
|
|
4597
|
+
`,A1=({onAccountSelect:t,showAddAccount:r=!0})=>{var P,C,j;const{session:o,loading:n,switchSignIn:a,addNewAccount:s,signOut:p}=Ue(),{deployment:f}=ve(),{navigate:c}=qe(),[h,d]=i.useState(null),[u,m]=i.useState(null),v=o==null?void 0:o.active_signin,x=(o==null?void 0:o.signins)||[];i.useEffect(()=>{var b;if(!n&&!x.length){const g=(b=f==null?void 0:f.ui_settings)==null?void 0:b.sign_in_page_url;g&&c(`${g}${window.location.search}`)}},[n,x,f,c]);const w=b=>b.split(" ").map(g=>g[0]).join("").toUpperCase().slice(0,2),_=async b=>{var g;if(!(b===(v==null?void 0:v.id)||u)){m(b);try{if(await a(b),t)t(b),m(null);else{let S=new URLSearchParams(window.location.search).get("redirect_uri");if(S||(S=(g=f.ui_settings)==null?void 0:g.after_signin_redirect_url),S){const k=new URL(S);(f==null?void 0:f.mode)==="staging"&&k.searchParams.set("dev_session",localStorage.getItem("__dev_session__")??""),c(k.toString())}else m(null)}}catch(S){console.error("Failed to switch account:",S),m(null)}}},z=async(b,g)=>{b.stopPropagation(),d(g);try{await p(g)}catch(S){console.error("Failed to sign out:",S)}finally{d(null)}},y=()=>{var b;if(s)s();else{const g=(b=f==null?void 0:f.ui_settings)==null?void 0:b.sign_in_page_url;g&&c(`${g}${window.location.search}`)}};return n?e.jsx(ie,{children:e.jsxs(xi,{children:[e.jsx(De,{}),e.jsxs(bi,{children:[e.jsx(yi,{children:"Choose an account"}),e.jsxs(wi,{children:["to continue to ",((P=f==null?void 0:f.ui_settings)==null?void 0:P.app_name)||"App"]})]}),e.jsx(vi,{children:[1,2].map(b=>e.jsxs(I1,{children:[e.jsx(T1,{}),e.jsxs(O1,{children:[e.jsx(ji,{}),e.jsx(ji,{$width:"small"})]})]},b))})]})}):x.length?e.jsx(ie,{children:e.jsxs(xi,{children:[e.jsx(De,{}),e.jsxs(bi,{children:[e.jsx(yi,{children:"Choose an account"}),e.jsxs(wi,{children:["to continue to ",(C=f==null?void 0:f.ui_settings)==null?void 0:C.app_name]})]}),e.jsxs(vi,{children:[x.map(({user:b,id:g})=>{var R,$,O,I,T;if(!b)return null;const S=g===(v==null?void 0:v.id),k=u===g,E=`${b.first_name||""} ${b.last_name||""}`.trim();return e.jsxs(C1,{$isActive:S,$isSwitching:k,onClick:()=>_(g),children:[e.jsx(S1,{children:b.has_profile_picture?e.jsx("img",{src:b.profile_picture_url,alt:E}):w(E||((R=b.primary_email_address)==null?void 0:R.email)||(($=b.primary_phone_number)==null?void 0:$.phone_number)||b.username||"U")}),e.jsxs($1,{children:[e.jsx(z1,{children:E||((O=b.primary_email_address)==null?void 0:O.email)||((I=b.primary_phone_number)==null?void 0:I.phone_number)||b.username||"User"}),e.jsx(E1,{children:((T=b.primary_email_address)==null?void 0:T.email)||b.username})]}),!k&&e.jsxs(P1,{onClick:N=>z(N,g),$isLoading:h===g,disabled:h===g,children:[h===g?e.jsx(vr,{size:12}):e.jsx(St,{size:12}),h===g?"Signing out...":"Sign out"]})]},g)}),r&&e.jsxs(R1,{onClick:y,children:[e.jsx(lt,{}),"Add another account"]})]}),e.jsxs(M1,{children:["Don't have an account?"," ",e.jsx(L1,{children:e.jsx(Ze,{to:`${(j=f.ui_settings)==null?void 0:j.sign_up_page_url}${window.location.search}`,children:"Sign up"})})]})]})}):null},D1=()=>{const{navigateToSignIn:t}=qe();return i.useEffect(()=>{t()},[t]),null},N1=()=>{const{navigateToSignUp:t}=qe();return i.useEffect(()=>{t()},[t]),null},F1=l.div`
|
|
4598
4598
|
width: 100%;
|
|
4599
4599
|
padding: var(--space-3xl) var(--space-sm);
|
|
4600
4600
|
background: var(--color-background);
|
|
4601
|
-
`,
|
|
4601
|
+
`,B1=l.div`
|
|
4602
4602
|
text-align: center;
|
|
4603
4603
|
margin-bottom: var(--space-xl);
|
|
4604
|
-
`,
|
|
4604
|
+
`,U1=l.h1`
|
|
4605
4605
|
font-size: var(--font-lg);
|
|
4606
4606
|
font-weight: 400;
|
|
4607
4607
|
color: var(--color-foreground);
|
|
4608
4608
|
margin-bottom: var(--space-xs);
|
|
4609
4609
|
margin-top: 0;
|
|
4610
|
-
`,
|
|
4610
|
+
`,W1=l.p`
|
|
4611
4611
|
color: var(--color-secondary-text);
|
|
4612
4612
|
font-size: var(--font-xs);
|
|
4613
4613
|
margin: 0;
|
|
4614
|
-
`,
|
|
4614
|
+
`,V1=l.div`
|
|
4615
4615
|
max-height: 400px;
|
|
4616
4616
|
overflow-y: auto;
|
|
4617
4617
|
border-top: 1px solid var(--color-border);
|
|
@@ -4641,7 +4641,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4641
4641
|
cursor: not-allowed;
|
|
4642
4642
|
opacity: 0.7;
|
|
4643
4643
|
}
|
|
4644
|
-
`,
|
|
4644
|
+
`,G1=l.div`
|
|
4645
4645
|
width: ${t=>t.$small?"32px":"40px"};
|
|
4646
4646
|
height: ${t=>t.$small?"32px":"40px"};
|
|
4647
4647
|
border-radius: 50%;
|
|
@@ -4654,7 +4654,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4654
4654
|
font-size: var(--font-sm);
|
|
4655
4655
|
font-weight: 500;
|
|
4656
4656
|
flex-shrink: 0;
|
|
4657
|
-
`,
|
|
4657
|
+
`,H1=l.img`
|
|
4658
4658
|
width: 100%;
|
|
4659
4659
|
height: 100%;
|
|
4660
4660
|
object-fit: cover;
|
|
@@ -4672,11 +4672,11 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4672
4672
|
text-overflow: ellipsis;
|
|
4673
4673
|
white-space: nowrap;
|
|
4674
4674
|
color: var(--color-foreground);
|
|
4675
|
-
`,
|
|
4675
|
+
`,q1=l.span`
|
|
4676
4676
|
font-size: var(--font-2xs);
|
|
4677
4677
|
color: var(--color-secondary-text);
|
|
4678
4678
|
font-weight: 400;
|
|
4679
|
-
`,
|
|
4679
|
+
`,Y1=l.div`
|
|
4680
4680
|
width: 32px;
|
|
4681
4681
|
height: 32px;
|
|
4682
4682
|
border-radius: 50%;
|
|
@@ -4740,12 +4740,12 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4740
4740
|
&:hover {
|
|
4741
4741
|
color: var(--color-primary-hover);
|
|
4742
4742
|
}
|
|
4743
|
-
`,
|
|
4743
|
+
`,Z1=({onSelect:t,onCreateOrganization:r,onCreateWorkspace:o})=>{var j,b,g;const{organizations:n}=br(),{workspaces:a}=vt(),{switchOrganization:s,switchWorkspace:p}=Ue(),{deployment:f}=ve(),[c,h]=i.useState(null),[d,u]=i.useState(null),m=f==null?void 0:f.b2b_settings.workspaces_enabled,v=f==null?void 0:f.b2b_settings.allow_users_to_create_orgs,x=m&&d,w=S=>S.split(" ").map(k=>k[0]).join("").toUpperCase().slice(0,2),_=async S=>{if(m){h(S.id);try{await s(S.id),u(S)}finally{h(null)}return}h(S.id);try{await s(S.id),t(S.id)}finally{h(null)}},z=async(S,k)=>{h(k.id);try{await p(k.id),t(S.id,k.id)}finally{h(null)}},y=x?"Select a workspace":"Select an organization",P=x?`to continue to ${((j=f==null?void 0:f.ui_settings)==null?void 0:j.app_name)||"App"}`:m?"Choose an organization to view its workspaces":`to continue to ${((b=f==null?void 0:f.ui_settings)==null?void 0:b.app_name)||"App"}`,C=d?a==null?void 0:a.filter(S=>S.organization.id===d.id):[];return e.jsxs(F1,{children:[e.jsx(De,{}),e.jsxs(B1,{children:[e.jsx(U1,{children:y}),e.jsx(W1,{children:P})]}),e.jsxs(V1,{children:[x?e.jsxs(e.Fragment,{children:[C&&C.length>0?e.jsx(e.Fragment,{children:C.map(S=>e.jsxs(ki,{as:"button",onClick:()=>z(d,S),disabled:c===S.id,children:[e.jsx(Y1,{children:S.image_url?e.jsx("img",{src:S.image_url,alt:S.name,style:{width:"100%",height:"100%",objectFit:"cover"}}):w(S.name).charAt(0)}),e.jsx(_i,{children:e.jsx(Ci,{children:S.name})})]},S.id))}):e.jsx(Si,{children:"No workspaces available in this organization."}),e.jsxs(Bn,{onClick:()=>o==null?void 0:o(d.id),disabled:c!==null,children:[e.jsx(lt,{}),"Create workspace"]})]}):n&&n.length>0?e.jsx(e.Fragment,{children:n.map(S=>{const k=a==null?void 0:a.filter(R=>R.organization.id===S.id),E=(k==null?void 0:k.length)||0;return e.jsxs(ki,{as:"button",onClick:()=>_(S),disabled:c===S.id,children:[e.jsx(G1,{$small:!m,children:S.image_url?e.jsx(H1,{src:S.image_url,alt:S.name}):w(S.name)}),e.jsxs(_i,{children:[e.jsx(Ci,{children:S.name}),m&&e.jsxs(q1,{children:[E," workspace",E!==1?"s":""]})]})]},S.id)})}):e.jsx(Si,{children:m?"No workspaces available. Create one to get started.":"No organizations available. Create one to get started."}),!x&&e.jsx(e.Fragment,{children:m?n&&n.length>0&&n[0]&&e.jsxs(Bn,{onClick:()=>{o==null||o(n[0].id)},disabled:c!==null,children:[e.jsx(lt,{}),"Create workspace"]}):v&&e.jsxs(Bn,{onClick:()=>{r==null||r()},disabled:c!==null,children:[e.jsx(lt,{}),"Create organization"]})})]}),x?e.jsxs($i,{children:["Make a mistake?"," ",e.jsx(zi,{onClick:()=>u(null),children:"Select Organizations"})]}):e.jsxs($i,{children:["Having trouble?"," ",e.jsx(zi,{children:e.jsx(Ze,{to:((g=f==null?void 0:f.ui_settings)==null?void 0:g.support_page_url)||"#",children:"Get help"})})]})]})},K1=({children:t})=>{const[r,o]=i.useState(null),[n,a]=i.useState(null),{loading:s}=Ue(),{organizations:p,loading:f}=br(),{activeOrganization:c}=Xe(),{activeWorkspace:h,loading:d}=zt(),{workspaces:u,loading:m}=vt(),{deployment:v}=ve(),{refetch:x,organizationMemberships:w}=tr(),_=v==null?void 0:v.b2b_settings.workspaces_enabled;if(i.useEffect(()=>{if(!(s||f)&&!(_&&d)){if((p==null?void 0:p.length)===0){o("createOrg");return}if(!c&&p&&p.length>0){o("select");return}if(_&&c&&!h){const y=u==null?void 0:u.filter(P=>P.organization.id===c.id);!y||y.length===0?o("createWorkspace"):o("select");return}o(null)}},[s,f,d,p,c,h,u,_]),f||s||_&&(d||m))return null;if(!r)return e.jsx(e.Fragment,{children:t});const z=async()=>{if(await x(),!_){o(null);return}setTimeout(()=>{if(w&&w.length>0){const y=w[w.length-1];a(y.organization.id)}o("createWorkspace")},500)};return e.jsx(ie,{children:e.jsx(ye,{isOpen:!0,children:e.jsx(ye.Overlay,{children:e.jsx(ye.Content,{style:{width:r==="select"?"400px":"900px",maxWidth:"90vw",padding:0},children:r==="select"?e.jsx(Z1,{onSelect:()=>{o(null)},onCreateOrganization:()=>{o("createOrg")},onCreateWorkspace:y=>{a(y),o("createWorkspace")}}):e.jsxs(ye.Body,{style:{padding:0},children:[r==="createOrg"&&e.jsx(en,{onSuccess:z,onCancel:()=>o("select")}),r==="createWorkspace"&&(n||c)&&e.jsx(ja,{organizationId:n||c.id,onSuccess:()=>{a(null),o(null)},onCancel:()=>{a(null),o("select")},onCreateOrganization:()=>{o("createOrg")}})]})})})})})},Q1=l.div`
|
|
4744
4744
|
display: flex;
|
|
4745
4745
|
gap: 8px;
|
|
4746
4746
|
flex-wrap: wrap;
|
|
4747
4747
|
margin-bottom: 12px;
|
|
4748
|
-
`,
|
|
4748
|
+
`,X1=l.button`
|
|
4749
4749
|
padding: 4px 8px;
|
|
4750
4750
|
border-radius: 12px;
|
|
4751
4751
|
border: 1px solid var(--color-border);
|
|
@@ -4761,21 +4761,21 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4761
4761
|
&:hover {
|
|
4762
4762
|
background: ${t=>t.$active?"var(--color-primary)":"var(--color-background-hover)"};
|
|
4763
4763
|
}
|
|
4764
|
-
`,
|
|
4764
|
+
`,J1=l.span`
|
|
4765
4765
|
background: var(--color-background);
|
|
4766
4766
|
color: var(--color-text);
|
|
4767
4767
|
padding: 1px 4px;
|
|
4768
4768
|
border-radius: 8px;
|
|
4769
4769
|
font-size: 10px;
|
|
4770
4770
|
font-weight: 500;
|
|
4771
|
-
`,
|
|
4771
|
+
`,ev={user:"Personal",organization:"Organization",workspace:"Workspace",current:"Current Context"};function tv({selectedChannels:t,channelCounts:r,onChannelsChange:o}){const n=a=>{if(t.includes(a)){const p=t.filter(f=>f!==a);p.length===0?o(["user"]):o(p)}else o([...t,a])};return e.jsx(Q1,{children:Object.entries(ev).map(([a,s])=>{const p=(r==null?void 0:r[a])||0,f=t.includes(a);return e.jsxs(X1,{$active:f,onClick:()=>n(a),children:[s,p>0&&e.jsx(J1,{children:p})]},a)})})}const Ei=l.div`
|
|
4772
4772
|
display: flex;
|
|
4773
4773
|
flex-direction: column;
|
|
4774
4774
|
width: 100%;
|
|
4775
4775
|
height: 100%;
|
|
4776
4776
|
background: var(--color-background);
|
|
4777
4777
|
overflow: hidden;
|
|
4778
|
-
`,
|
|
4778
|
+
`,rv=l.div`
|
|
4779
4779
|
display: flex;
|
|
4780
4780
|
align-items: center;
|
|
4781
4781
|
justify-content: space-between;
|
|
@@ -4783,11 +4783,11 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4783
4783
|
background: var(--color-background);
|
|
4784
4784
|
border-bottom: 1px solid var(--color-border-subtle);
|
|
4785
4785
|
flex-shrink: 0;
|
|
4786
|
-
`,
|
|
4786
|
+
`,ov=l.div`
|
|
4787
4787
|
display: flex;
|
|
4788
4788
|
align-items: center;
|
|
4789
4789
|
gap: 12px;
|
|
4790
|
-
`,
|
|
4790
|
+
`,nv=l.button`
|
|
4791
4791
|
display: flex;
|
|
4792
4792
|
align-items: center;
|
|
4793
4793
|
justify-content: center;
|
|
@@ -4803,11 +4803,11 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4803
4803
|
&:hover {
|
|
4804
4804
|
background: var(--color-background-hover);
|
|
4805
4805
|
}
|
|
4806
|
-
`,
|
|
4806
|
+
`,av=l.div`
|
|
4807
4807
|
display: flex;
|
|
4808
4808
|
align-items: center;
|
|
4809
4809
|
gap: 10px;
|
|
4810
|
-
`,
|
|
4810
|
+
`,sv=l.div`
|
|
4811
4811
|
width: 36px;
|
|
4812
4812
|
height: 36px;
|
|
4813
4813
|
border-radius: 50%;
|
|
@@ -4816,10 +4816,10 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4816
4816
|
align-items: center;
|
|
4817
4817
|
justify-content: center;
|
|
4818
4818
|
color: white;
|
|
4819
|
-
`,
|
|
4819
|
+
`,iv=l.div`
|
|
4820
4820
|
display: flex;
|
|
4821
4821
|
flex-direction: column;
|
|
4822
|
-
`,
|
|
4822
|
+
`,cv=l.div`
|
|
4823
4823
|
width: 6px;
|
|
4824
4824
|
height: 6px;
|
|
4825
4825
|
border-radius: 50%;
|
|
@@ -4833,18 +4833,18 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4833
4833
|
50% { opacity: 0.5; }
|
|
4834
4834
|
}
|
|
4835
4835
|
`}
|
|
4836
|
-
`,
|
|
4836
|
+
`,lv=l.h3`
|
|
4837
4837
|
margin: 0;
|
|
4838
4838
|
font-size: 14px;
|
|
4839
4839
|
font-weight: 400;
|
|
4840
4840
|
color: var(--color-foreground);
|
|
4841
4841
|
letter-spacing: -0.01em;
|
|
4842
|
-
`,
|
|
4842
|
+
`,dv=l.p`
|
|
4843
4843
|
margin: 0;
|
|
4844
4844
|
font-size: 11px;
|
|
4845
4845
|
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)"};
|
|
4846
4846
|
font-weight: 400;
|
|
4847
|
-
`,
|
|
4847
|
+
`,uv=l.div`
|
|
4848
4848
|
font-size: 10px;
|
|
4849
4849
|
padding: 2px 6px;
|
|
4850
4850
|
border-radius: 9999px;
|
|
@@ -4863,7 +4863,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4863
4863
|
background-color: var(--color-error-background);
|
|
4864
4864
|
color: var(--color-error-text);
|
|
4865
4865
|
`;default:return"display: none;"}}}
|
|
4866
|
-
`,
|
|
4866
|
+
`,pv=l.div`
|
|
4867
4867
|
flex: 1;
|
|
4868
4868
|
overflow-y: auto;
|
|
4869
4869
|
overflow-x: hidden;
|
|
@@ -4891,7 +4891,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4891
4891
|
`,Un=l.div`
|
|
4892
4892
|
display: flex;
|
|
4893
4893
|
justify-content: ${t=>t.$isUser?"flex-end":"flex-start"};
|
|
4894
|
-
`,
|
|
4894
|
+
`,Al=l.div`
|
|
4895
4895
|
max-width: 85%;
|
|
4896
4896
|
padding: 10px 14px;
|
|
4897
4897
|
border-radius: 12px;
|
|
@@ -4914,7 +4914,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4914
4914
|
margin-right: auto;
|
|
4915
4915
|
font-weight: 400;
|
|
4916
4916
|
`}
|
|
4917
|
-
`,
|
|
4917
|
+
`,hv=l.span`
|
|
4918
4918
|
display: inline-flex;
|
|
4919
4919
|
gap: 2px;
|
|
4920
4920
|
margin-left: 8px;
|
|
@@ -4938,7 +4938,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4938
4938
|
opacity: 1;
|
|
4939
4939
|
}
|
|
4940
4940
|
}
|
|
4941
|
-
`,
|
|
4941
|
+
`,fv=l(Al)`
|
|
4942
4942
|
opacity: 0.7;
|
|
4943
4943
|
position: relative;
|
|
4944
4944
|
display: inline-block;
|
|
@@ -4963,7 +4963,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4963
4963
|
transform: rotate(360deg);
|
|
4964
4964
|
}
|
|
4965
4965
|
}
|
|
4966
|
-
`,
|
|
4966
|
+
`,gv=l.div`
|
|
4967
4967
|
display: flex;
|
|
4968
4968
|
justify-content: flex-start;
|
|
4969
4969
|
align-items: center;
|
|
@@ -5007,7 +5007,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5007
5007
|
overflow-wrap: break-word;
|
|
5008
5008
|
max-width: calc(100% - 24px);
|
|
5009
5009
|
}
|
|
5010
|
-
`,
|
|
5010
|
+
`,Pi=l.div`
|
|
5011
5011
|
flex: 1;
|
|
5012
5012
|
display: flex;
|
|
5013
5013
|
flex-direction: column;
|
|
@@ -5021,7 +5021,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5021
5021
|
margin: 0;
|
|
5022
5022
|
font-size: 13px;
|
|
5023
5023
|
}
|
|
5024
|
-
`,
|
|
5024
|
+
`,mv=l.div`
|
|
5025
5025
|
background: var(--color-primary-background);
|
|
5026
5026
|
border: 1px solid var(--color-primary-border);
|
|
5027
5027
|
border-radius: 8px;
|
|
@@ -5119,12 +5119,12 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5119
5119
|
flex-direction: row;
|
|
5120
5120
|
gap: 20px;
|
|
5121
5121
|
}
|
|
5122
|
-
`,
|
|
5122
|
+
`,xv=l.form`
|
|
5123
5123
|
padding: 20px;
|
|
5124
5124
|
background: var(--color-background);
|
|
5125
5125
|
border-top: 1px solid var(--color-border);
|
|
5126
5126
|
flex-shrink: 0;
|
|
5127
|
-
`,
|
|
5127
|
+
`,vv=l.div`
|
|
5128
5128
|
position: relative;
|
|
5129
5129
|
display: flex;
|
|
5130
5130
|
align-items: flex-end;
|
|
@@ -5133,13 +5133,13 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5133
5133
|
border-radius: 12px;
|
|
5134
5134
|
padding: 8px 8px 8px 20px;
|
|
5135
5135
|
min-height: 56px;
|
|
5136
|
-
`,
|
|
5136
|
+
`,bv=l.div`
|
|
5137
5137
|
flex: 1;
|
|
5138
5138
|
display: flex;
|
|
5139
5139
|
flex-direction: column;
|
|
5140
5140
|
gap: 8px;
|
|
5141
5141
|
padding-right: 12px;
|
|
5142
|
-
`,
|
|
5142
|
+
`,yv=l.textarea`
|
|
5143
5143
|
width: 100%;
|
|
5144
5144
|
padding: 0;
|
|
5145
5145
|
border: none;
|
|
@@ -5161,11 +5161,11 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5161
5161
|
color: var(--color-text-disabled);
|
|
5162
5162
|
cursor: not-allowed;
|
|
5163
5163
|
}
|
|
5164
|
-
`,
|
|
5164
|
+
`,wv=l.div`
|
|
5165
5165
|
display: flex;
|
|
5166
5166
|
gap: 8px;
|
|
5167
5167
|
margin-top: 4px;
|
|
5168
|
-
`,
|
|
5168
|
+
`,jv=l.div`
|
|
5169
5169
|
display: flex;
|
|
5170
5170
|
gap: 8px;
|
|
5171
5171
|
padding: 8px 20px;
|
|
@@ -5173,7 +5173,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5173
5173
|
background: var(--color-background);
|
|
5174
5174
|
overflow-x: auto;
|
|
5175
5175
|
max-height: 120px;
|
|
5176
|
-
`,
|
|
5176
|
+
`,kv=l.div`
|
|
5177
5177
|
position: relative;
|
|
5178
5178
|
width: 80px;
|
|
5179
5179
|
height: 80px;
|
|
@@ -5187,7 +5187,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5187
5187
|
height: 100%;
|
|
5188
5188
|
object-fit: cover;
|
|
5189
5189
|
}
|
|
5190
|
-
`,
|
|
5190
|
+
`,_v=l.button`
|
|
5191
5191
|
position: absolute;
|
|
5192
5192
|
top: 4px;
|
|
5193
5193
|
right: 4px;
|
|
@@ -5205,9 +5205,9 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5205
5205
|
&:hover {
|
|
5206
5206
|
background: rgba(0, 0, 0, 0.9);
|
|
5207
5207
|
}
|
|
5208
|
-
`,
|
|
5208
|
+
`,Cv=l.input`
|
|
5209
5209
|
display: none;
|
|
5210
|
-
`,
|
|
5210
|
+
`,Sv=l.button`
|
|
5211
5211
|
padding: 4px 10px;
|
|
5212
5212
|
border: 1px solid var(--color-border);
|
|
5213
5213
|
border-radius: 8px;
|
|
@@ -5232,7 +5232,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5232
5232
|
border-color: var(--color-border);
|
|
5233
5233
|
cursor: not-allowed;
|
|
5234
5234
|
}
|
|
5235
|
-
|
|
5235
|
+
`,$v=l.button`
|
|
5236
5236
|
align-self: flex-end;
|
|
5237
5237
|
padding: 6px;
|
|
5238
5238
|
border: none;
|
|
@@ -5257,7 +5257,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5257
5257
|
color: var(--color-text-disabled);
|
|
5258
5258
|
cursor: not-allowed;
|
|
5259
5259
|
}
|
|
5260
|
-
|
|
5260
|
+
`,zv=l.div`
|
|
5261
5261
|
display: ${t=>t.$isOpen?"flex":"none"};
|
|
5262
5262
|
position: fixed;
|
|
5263
5263
|
top: 0;
|
|
@@ -5282,7 +5282,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5282
5282
|
backdrop-filter: blur(10px);
|
|
5283
5283
|
}
|
|
5284
5284
|
}
|
|
5285
|
-
`,
|
|
5285
|
+
`,Ev=l.div`
|
|
5286
5286
|
position: relative;
|
|
5287
5287
|
width: 100%;
|
|
5288
5288
|
height: 100%;
|
|
@@ -5338,7 +5338,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5338
5338
|
`,ko=l(Dl)`
|
|
5339
5339
|
width: 32px;
|
|
5340
5340
|
padding: 0;
|
|
5341
|
-
`,
|
|
5341
|
+
`,Pv=l.img`
|
|
5342
5342
|
max-width: calc(100% - 20px);
|
|
5343
5343
|
max-height: calc(100% - 20px);
|
|
5344
5344
|
width: auto;
|
|
@@ -5349,7 +5349,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5349
5349
|
transition: ${t=>t.$isDragging?"none":"transform 0.2s ease"};
|
|
5350
5350
|
user-select: none;
|
|
5351
5351
|
-webkit-user-drag: none;
|
|
5352
|
-
`,
|
|
5352
|
+
`,Rv=l.div`
|
|
5353
5353
|
position: absolute;
|
|
5354
5354
|
bottom: 20px;
|
|
5355
5355
|
left: 50%;
|
|
@@ -5357,7 +5357,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5357
5357
|
display: flex;
|
|
5358
5358
|
gap: 8px;
|
|
5359
5359
|
align-items: center;
|
|
5360
|
-
`,
|
|
5360
|
+
`,Iv=l.div`
|
|
5361
5361
|
display: flex;
|
|
5362
5362
|
gap: 4px;
|
|
5363
5363
|
align-items: center;
|
|
@@ -5367,14 +5367,14 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5367
5367
|
border-radius: 12px;
|
|
5368
5368
|
padding: 4px;
|
|
5369
5369
|
box-shadow: 0 10px 25px -5px var(--color-shadow);
|
|
5370
|
-
`,
|
|
5370
|
+
`,Tv=l.span`
|
|
5371
5371
|
min-width: 60px;
|
|
5372
5372
|
text-align: center;
|
|
5373
5373
|
font-size: 12px;
|
|
5374
5374
|
font-weight: 400;
|
|
5375
5375
|
color: var(--color-foreground);
|
|
5376
5376
|
padding: 0 8px;
|
|
5377
|
-
`,
|
|
5377
|
+
`,Ov=l.div`
|
|
5378
5378
|
height: 125px;
|
|
5379
5379
|
width: auto;
|
|
5380
5380
|
min-width: 125px;
|
|
@@ -5422,7 +5422,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5422
5422
|
&:hover .expand-icon {
|
|
5423
5423
|
opacity: 1;
|
|
5424
5424
|
}
|
|
5425
|
-
`,Ov=({isOpen:t,imageUrl:r,zoomLevel:o,dragPosition:n,isDragging:a,onClose:s,onDownload:p,onZoom:f,onReset:c,onWheel:h,onMouseDown:d,onMouseMove:u,onMouseUp:m})=>{const[v,x]=i.useState(!1),w=i.useRef(null);return i.useEffect(()=>(x(!0),()=>x(!1)),[]),i.useEffect(()=>{if(t){const _=document.body.style.overflow;document.body.style.overflow="hidden";const z=C=>{(C.ctrlKey||C.metaKey)&&C.preventDefault()},y=C=>{C.preventDefault()},I=C=>{C.preventDefault()};return document.addEventListener("wheel",z,{passive:!1}),document.addEventListener("gesturestart",y,{passive:!1}),document.addEventListener("gesturechange",I,{passive:!1}),()=>{document.body.style.overflow=_,document.removeEventListener("wheel",z),document.removeEventListener("gesturestart",y),document.removeEventListener("gesturechange",I)}}},[t]),!v||!t||!r?null:Nr.createPortal(e.jsx(ie,{children:e.jsx($v,{ref:w,$isOpen:!0,onClick:_=>{_.target===_.currentTarget&&s()},children:e.jsxs(zv,{onClick:_=>_.stopPropagation(),onWheel:_=>{_.preventDefault(),_.stopPropagation(),h(_)},onMouseMove:u,onMouseUp:m,onMouseLeave:m,children:[e.jsx(Ev,{src:r,alt:"Preview",$zoom:o,$x:n.x,$y:n.y,$isDragging:a,onMouseDown:d,draggable:!1}),e.jsx(ko,{$variant:"ghost",onClick:s,title:"Close",style:{position:"absolute",top:"16px",right:"16px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:e.jsx(Qe,{size:14})}),e.jsxs(Iv,{children:[e.jsxs(Rv,{children:[e.jsx(ko,{$variant:"ghost",onClick:()=>f(-.25),title:"Zoom out",disabled:o<=.5,children:e.jsx(Dh,{size:14})}),e.jsxs(Pv,{children:[Math.round(o*100),"%"]}),e.jsx(ko,{$variant:"ghost",onClick:()=>f(.25),title:"Zoom in",disabled:o>=3,children:e.jsx(Ah,{size:14})}),e.jsx(ko,{$variant:"ghost",onClick:c,title:"Reset zoom",children:e.jsx(xh,{size:14})})]}),e.jsxs(Dl,{$variant:"primary",onClick:p,title:"Download image",children:[e.jsx(Zo,{size:14}),"Download"]})]})]})})}),document.body)};function Nl({showBackButton:t=!1,onBack:r}){const{agentName:o,token:n,platformAdapter:a,selectedSession:s,selectSession:p}=Bo(),f=s==null?void 0:s.id;if(!f)return e.jsx(ie,{style:{height:"100%",width:"100%"},children:e.jsx(Ei,{children:e.jsxs(Ii,{children:[e.jsx(bn,{size:48,strokeWidth:1.5}),e.jsx("p",{children:"No conversation selected"})]})})});const c=!0,h=!0,d="Start a conversation by typing a message below",[u,m]=i.useState(""),[v,x]=i.useState(!1),[w,_]=i.useState(null),[z,y]=i.useState([]),[I,C]=i.useState([]),[j,b]=i.useState(null),[g,S]=i.useState(1),[k,E]=i.useState(!1),[R,$]=i.useState({x:0,y:0}),[O,P]=i.useState({x:0,y:0}),T=i.useRef(null),N=i.useRef(null),{messages:A,pendingMessage:D,pendingImages:B,connectionState:oe,isConnected:se,isExecuting:ne,executionStatus:K,isWaitingForInput:U,sendMessage:H,submitUserInput:Q,cancelExecution:ae}=ec({contextId:f,agentName:o,token:n,platformAdapter:a,autoConnect:c});i.useEffect(()=>{var q;(q=T.current)==null||q.scrollIntoView({behavior:"smooth"})},[A]),i.useEffect(()=>{var q;if(U){const J=A.slice().reverse().find(Z=>{var ce;return((ce=Z.metadata)==null?void 0:ce.type)==="user_input_request"});(q=J==null?void 0:J.metadata)!=null&&q.userInputRequest&&_(J.metadata.userInputRequest)}else _(null),y([])},[U,A]);const te=q=>{if(q.preventDefault(),!!se)if(U&&w){let J=u.trim();w.input_type==="multiselect"&&(J=z.join(",")),J&&(Q(J),m(""),y([]))}else!ne&&u.trim()&&(H(u,I.length>0?I:void 0),m(""),C([]))},ee=q=>{const J=q.target.files;J&&(Array.from(J).forEach(Z=>{if(Z.type.startsWith("image/")){const ce=new FileReader;ce.onload=je=>{var Se;if((Se=je.target)!=null&&Se.result){const Ne=je.target.result.split(",")[1];C(Re=>[...Re,{mime_type:Z.type,data:Ne}])}},ce.readAsDataURL(Z)}}),N.current&&(N.current.value=""))},Y=q=>{C(J=>J.filter((Z,ce)=>ce!==q))},de=q=>{b(q),S(1),$({x:0,y:0})},ue=()=>{b(null),S(1),$({x:0,y:0}),E(!1)},F=q=>{const J=document.createElement("a");J.href=q,J.download=`image-${Date.now()}.png`,document.body.appendChild(J),J.click(),document.body.removeChild(J)},M=q=>{S(J=>{const Z=J+q;return Math.min(Math.max(Z,.5),3)})},W=q=>{q.preventDefault(),q.stopPropagation();const J=q.deltaY>0?-.1:.1;M(J)},L=q=>{g>1&&(E(!0),P({x:q.clientX-R.x,y:q.clientY-R.y}))},G=q=>{k&&g>1&&$({x:q.clientX-O.x,y:q.clientY-O.y})},re=()=>{E(!1)},pe=()=>oe.status===mt.CONNECTING?"Connecting...":oe.status===mt.ERROR?"Connection error":oe.status===mt.DISCONNECTED||!se?"Disconnected":U?"Waiting for your input...":ne?"Working...":"Ready",we=()=>{if(!U||!w)return"Ask anything";switch(w.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..."}},Te=()=>!U||!w?!1:["select","multiselect","boolean","date"].includes(w.input_type||"");return e.jsxs(ie,{style:{height:"100%",width:"100%"},children:[e.jsxs(Ei,{children:[e.jsxs(tv,{children:[e.jsxs(rv,{children:[t&&e.jsx(ov,{onClick:()=>{r?r():p(null)},children:e.jsx(Yo,{size:20})}),e.jsxs(nv,{children:[e.jsx(av,{children:e.jsx(bn,{size:20})}),e.jsxs(sv,{children:[e.jsx(cv,{children:o}),e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[e.jsx(iv,{$status:pe()}),e.jsx(lv,{$status:pe(),children:pe()})]})]})]})]}),K!==Ae.IDLE&&e.jsx(dv,{$status:K,children:K.replace("_"," ")})]}),e.jsx(uv,{children:A.length===0&&h?e.jsxs(Ii,{children:[e.jsx(bn,{size:48,strokeWidth:1.5}),e.jsx("p",{children:d})]}):e.jsxs(e.Fragment,{children:[A.map((q,J)=>{var Z,ce,je,Se;if(((Z=q.metadata)==null?void 0:Z.type)==="user_input_request"&&q.metadata.userInputRequest){const Ce=q.metadata.userInputRequest,Ne=!Ce.input_type||Ce.input_type==="text"||Ce.input_type==="number",Re=U&&(w==null?void 0:w.input_type)===Ce.input_type;return e.jsx(Un,{$isUser:!1,children:e.jsxs(gv,{children:[e.jsx("div",{className:"question",children:Ce.question}),Ce.context&&Ce.context.trim()&&e.jsx("div",{className:"context",children:Ce.context}),!Ne&&e.jsxs("div",{className:"controls",children:[Ce.input_type==="select"&&Ce.options&&e.jsxs("select",{value:Re?u:"",onChange:ze=>m(ze.target.value),disabled:!Re,children:[e.jsx("option",{value:"",children:"Choose an option..."}),Ce.options.map(ze=>e.jsx("option",{value:ze,children:ze},ze))]}),Ce.input_type==="multiselect"&&Ce.options&&e.jsx("div",{className:"checkbox-group",children:Ce.options.map(ze=>e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:Re&&z.includes(ze),onChange:rr=>{rr.target.checked?y([...z,ze]):y(z.filter(or=>or!==ze))},disabled:!Re}),e.jsx("span",{children:ze})]},ze))}),Ce.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:Re&&u==="true",onChange:ze=>m(ze.target.value),disabled:!Re}),e.jsx("span",{children:"Yes"})]}),e.jsxs("label",{className:"radio-label",children:[e.jsx("input",{type:"radio",name:"boolean",value:"false",checked:Re&&u==="false",onChange:ze=>m(ze.target.value),disabled:!Re}),e.jsx("span",{children:"No"})]})]}),Ce.input_type==="date"&&e.jsx("input",{type:"date",value:Re?u:"",onChange:ze=>m(ze.target.value),disabled:!Re})]}),e.jsx("div",{className:"instruction",children:Re?Ne?"Type your response below":Ce.input_type==="multiselect"?"Select options above and click send":"Make your selection above and click send":""})]})},q.id)}if(((ce=q.metadata)==null?void 0:ce.type)==="log"){const Ce=A[J-1],Ne=A[J+1],Re=((je=Ce==null?void 0:Ce.metadata)==null?void 0:je.type)==="log",ze=((Se=Ne==null?void 0:Ne.metadata)==null?void 0:Se.type)==="log",rr=Re||ze,or=!Re&&ze,Wr=Re&&!ze;return e.jsx(fv,{$isGrouped:rr,$isFirstInGroup:or,$isLastInGroup:Wr,children:e.jsx("div",{className:"log-content",children:q.content})},q.id)}return!q.content&&(!q.images||q.images.length===0)?null:e.jsx(Un,{$isUser:q.role==="user",children:e.jsxs(Ll,{$isUser:q.role==="user",children:[e.jsx("div",{children:q.content}),q.images&&q.images.length>0&&e.jsx("div",{style:{display:"flex",gap:"8px",marginTop:"8px",flexWrap:"wrap"},children:q.images.map((Ce,Ne)=>{const Re=Ce.url||`data:${Ce.mime_type};base64,${Ce.data}`;return e.jsxs(Tv,{onClick:()=>de(Re),title:"Click to preview",children:[e.jsx("img",{src:Re,alt:`Image ${Ne+1}`,loading:"lazy"}),e.jsx("div",{className:"expand-icon",children:e.jsx(ah,{size:14})})]},Ne)})}),q.isStreaming&&e.jsx(pv,{})]})},q.id)}),D&&e.jsx(Un,{$isUser:!0,children:e.jsxs(hv,{$isUser:!0,children:[e.jsx("div",{children:D}),B&&B.length>0&&e.jsx("div",{style:{display:"flex",gap:"8px",marginTop:"8px",flexWrap:"wrap"},children:B.map((q,J)=>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:q.data?`data:${q.mime_type};base64,${q.data}`:"#",alt:`Image ${J+1}`,style:{maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",objectFit:"contain"},loading:"lazy"})},J))})]})}),e.jsx("div",{ref:T})]})}),I.length>0&&e.jsx(wv,{children:I.map((q,J)=>e.jsxs(jv,{children:[e.jsx("img",{src:q.data?`data:${q.mime_type};base64,${q.data}`:"#",alt:`Upload ${J+1}`}),e.jsx(kv,{type:"button",onClick:()=>Y(J),children:e.jsx(Qe,{size:12})})]},J))}),e.jsx(mv,{onSubmit:te,children:e.jsxs(xv,{children:[e.jsxs(vv,{children:[e.jsx(bv,{value:u,onChange:q=>m(q.target.value),onKeyDown:q=>{q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),te(q))},placeholder:we(),disabled:!se||ne&&!U||Te(),rows:1}),e.jsx(yv,{children:e.jsxs(Cv,{type:"button",disabled:!se||ne,onClick:()=>{var q;return(q=N.current)==null?void 0:q.click()},children:[e.jsx(yh,{size:16}),"Attach"]})}),e.jsx(_v,{ref:N,type:"file",accept:"image/*",multiple:!0,onChange:ee})]}),e.jsx(Sv,{type:ne?"button":"submit",disabled:!se||!U&&!ne&&!u.trim(),onClick:ne?ae:void 0,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),style:{background:ne&&v?"var(--color-error)":void 0},children:ne?v?e.jsx(Qe,{size:14}):e.jsx(vr,{size:14,className:"animate-spin"}):e.jsx(Dc,{size:14})})]})})]}),e.jsx(Ov,{isOpen:!!j,imageUrl:j,zoomLevel:g,dragPosition:R,isDragging:k,onClose:ue,onDownload:()=>j&&F(j),onZoom:M,onReset:()=>{S(1),$({x:0,y:0})},onWheel:W,onMouseDown:L,onMouseMove:G,onMouseUp:re})]})}const Mv=l.div`
|
|
5425
|
+
`,Mv=({isOpen:t,imageUrl:r,zoomLevel:o,dragPosition:n,isDragging:a,onClose:s,onDownload:p,onZoom:f,onReset:c,onWheel:h,onMouseDown:d,onMouseMove:u,onMouseUp:m})=>{const[v,x]=i.useState(!1),w=i.useRef(null);return i.useEffect(()=>(x(!0),()=>x(!1)),[]),i.useEffect(()=>{if(t){const _=document.body.style.overflow;document.body.style.overflow="hidden";const z=C=>{(C.ctrlKey||C.metaKey)&&C.preventDefault()},y=C=>{C.preventDefault()},P=C=>{C.preventDefault()};return document.addEventListener("wheel",z,{passive:!1}),document.addEventListener("gesturestart",y,{passive:!1}),document.addEventListener("gesturechange",P,{passive:!1}),()=>{document.body.style.overflow=_,document.removeEventListener("wheel",z),document.removeEventListener("gesturestart",y),document.removeEventListener("gesturechange",P)}}},[t]),!v||!t||!r?null:Nr.createPortal(e.jsx(ie,{children:e.jsx(zv,{ref:w,$isOpen:!0,onClick:_=>{_.target===_.currentTarget&&s()},children:e.jsxs(Ev,{onClick:_=>_.stopPropagation(),onWheel:_=>{_.preventDefault(),_.stopPropagation(),h(_)},onMouseMove:u,onMouseUp:m,onMouseLeave:m,children:[e.jsx(Pv,{src:r,alt:"Preview",$zoom:o,$x:n.x,$y:n.y,$isDragging:a,onMouseDown:d,draggable:!1}),e.jsx(ko,{$variant:"ghost",onClick:s,title:"Close",style:{position:"absolute",top:"16px",right:"16px",background:"var(--color-background)",border:"1px solid var(--color-border)"},children:e.jsx(Qe,{size:14})}),e.jsxs(Rv,{children:[e.jsxs(Iv,{children:[e.jsx(ko,{$variant:"ghost",onClick:()=>f(-.25),title:"Zoom out",disabled:o<=.5,children:e.jsx(Dh,{size:14})}),e.jsxs(Tv,{children:[Math.round(o*100),"%"]}),e.jsx(ko,{$variant:"ghost",onClick:()=>f(.25),title:"Zoom in",disabled:o>=3,children:e.jsx(Lh,{size:14})}),e.jsx(ko,{$variant:"ghost",onClick:c,title:"Reset zoom",children:e.jsx(xh,{size:14})})]}),e.jsxs(Dl,{$variant:"primary",onClick:p,title:"Download image",children:[e.jsx(Zo,{size:14}),"Download"]})]})]})})}),document.body)};function Nl({showBackButton:t=!1,onBack:r}){const{agentName:o,token:n,platformAdapter:a,selectedSession:s,selectSession:p}=Bo(),f=s==null?void 0:s.id;if(!f)return e.jsx(ie,{style:{height:"100%",width:"100%"},children:e.jsx(Ei,{children:e.jsxs(Pi,{children:[e.jsx(bn,{size:48,strokeWidth:1.5}),e.jsx("p",{children:"No conversation selected"})]})})});const c=!0,h=!0,d="Start a conversation by typing a message below",[u,m]=i.useState(""),[v,x]=i.useState(!1),[w,_]=i.useState(null),[z,y]=i.useState([]),[P,C]=i.useState([]),[j,b]=i.useState(null),[g,S]=i.useState(1),[k,E]=i.useState(!1),[R,$]=i.useState({x:0,y:0}),[O,I]=i.useState({x:0,y:0}),T=i.useRef(null),N=i.useRef(null),{messages:L,pendingMessage:D,pendingImages:B,connectionState:oe,isConnected:se,isExecuting:ne,executionStatus:K,isWaitingForInput:U,sendMessage:H,submitUserInput:Q,cancelExecution:ae}=ec({contextId:f,agentName:o,token:n,platformAdapter:a,autoConnect:c});i.useEffect(()=>{var q;(q=T.current)==null||q.scrollIntoView({behavior:"smooth"})},[L]),i.useEffect(()=>{var q;if(U){const J=L.slice().reverse().find(Z=>{var ce;return((ce=Z.metadata)==null?void 0:ce.type)==="user_input_request"});(q=J==null?void 0:J.metadata)!=null&&q.userInputRequest&&_(J.metadata.userInputRequest)}else _(null),y([])},[U,L]);const te=q=>{if(q.preventDefault(),!!se)if(U&&w){let J=u.trim();w.input_type==="multiselect"&&(J=z.join(",")),J&&(Q(J),m(""),y([]))}else!ne&&u.trim()&&(H(u,P.length>0?P:void 0),m(""),C([]))},ee=q=>{const J=q.target.files;J&&(Array.from(J).forEach(Z=>{if(Z.type.startsWith("image/")){const ce=new FileReader;ce.onload=je=>{var Se;if((Se=je.target)!=null&&Se.result){const Ne=je.target.result.split(",")[1];C(Re=>[...Re,{mime_type:Z.type,data:Ne}])}},ce.readAsDataURL(Z)}}),N.current&&(N.current.value=""))},Y=q=>{C(J=>J.filter((Z,ce)=>ce!==q))},de=q=>{b(q),S(1),$({x:0,y:0})},ue=()=>{b(null),S(1),$({x:0,y:0}),E(!1)},F=q=>{const J=document.createElement("a");J.href=q,J.download=`image-${Date.now()}.png`,document.body.appendChild(J),J.click(),document.body.removeChild(J)},M=q=>{S(J=>{const Z=J+q;return Math.min(Math.max(Z,.5),3)})},W=q=>{q.preventDefault(),q.stopPropagation();const J=q.deltaY>0?-.1:.1;M(J)},A=q=>{g>1&&(E(!0),I({x:q.clientX-R.x,y:q.clientY-R.y}))},G=q=>{k&&g>1&&$({x:q.clientX-O.x,y:q.clientY-O.y})},re=()=>{E(!1)},pe=()=>oe.status===mt.CONNECTING?"Connecting...":oe.status===mt.ERROR?"Connection error":oe.status===mt.DISCONNECTED||!se?"Disconnected":U?"Waiting for your input...":ne?"Working...":"Ready",we=()=>{if(!U||!w)return"Ask anything";switch(w.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..."}},Te=()=>!U||!w?!1:["select","multiselect","boolean","date"].includes(w.input_type||"");return e.jsxs(ie,{style:{height:"100%",width:"100%"},children:[e.jsxs(Ei,{children:[e.jsxs(rv,{children:[e.jsxs(ov,{children:[t&&e.jsx(nv,{onClick:()=>{r?r():p(null)},children:e.jsx(Yo,{size:20})}),e.jsxs(av,{children:[e.jsx(sv,{children:e.jsx(bn,{size:20})}),e.jsxs(iv,{children:[e.jsx(lv,{children:o}),e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[e.jsx(cv,{$status:pe()}),e.jsx(dv,{$status:pe(),children:pe()})]})]})]})]}),K!==Le.IDLE&&e.jsx(uv,{$status:K,children:K.replace("_"," ")})]}),e.jsx(pv,{children:L.length===0&&h?e.jsxs(Pi,{children:[e.jsx(bn,{size:48,strokeWidth:1.5}),e.jsx("p",{children:d})]}):e.jsxs(e.Fragment,{children:[L.map((q,J)=>{var Z,ce,je,Se;if(((Z=q.metadata)==null?void 0:Z.type)==="user_input_request"&&q.metadata.userInputRequest){const Ce=q.metadata.userInputRequest,Ne=!Ce.input_type||Ce.input_type==="text"||Ce.input_type==="number",Re=U&&(w==null?void 0:w.input_type)===Ce.input_type;return e.jsx(Un,{$isUser:!1,children:e.jsxs(mv,{children:[e.jsx("div",{className:"question",children:Ce.question}),Ce.context&&Ce.context.trim()&&e.jsx("div",{className:"context",children:Ce.context}),!Ne&&e.jsxs("div",{className:"controls",children:[Ce.input_type==="select"&&Ce.options&&e.jsxs("select",{value:Re?u:"",onChange:ze=>m(ze.target.value),disabled:!Re,children:[e.jsx("option",{value:"",children:"Choose an option..."}),Ce.options.map(ze=>e.jsx("option",{value:ze,children:ze},ze))]}),Ce.input_type==="multiselect"&&Ce.options&&e.jsx("div",{className:"checkbox-group",children:Ce.options.map(ze=>e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:Re&&z.includes(ze),onChange:rr=>{rr.target.checked?y([...z,ze]):y(z.filter(or=>or!==ze))},disabled:!Re}),e.jsx("span",{children:ze})]},ze))}),Ce.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:Re&&u==="true",onChange:ze=>m(ze.target.value),disabled:!Re}),e.jsx("span",{children:"Yes"})]}),e.jsxs("label",{className:"radio-label",children:[e.jsx("input",{type:"radio",name:"boolean",value:"false",checked:Re&&u==="false",onChange:ze=>m(ze.target.value),disabled:!Re}),e.jsx("span",{children:"No"})]})]}),Ce.input_type==="date"&&e.jsx("input",{type:"date",value:Re?u:"",onChange:ze=>m(ze.target.value),disabled:!Re})]}),e.jsx("div",{className:"instruction",children:Re?Ne?"Type your response below":Ce.input_type==="multiselect"?"Select options above and click send":"Make your selection above and click send":""})]})},q.id)}if(((ce=q.metadata)==null?void 0:ce.type)==="log"){const Ce=L[J-1],Ne=L[J+1],Re=((je=Ce==null?void 0:Ce.metadata)==null?void 0:je.type)==="log",ze=((Se=Ne==null?void 0:Ne.metadata)==null?void 0:Se.type)==="log",rr=Re||ze,or=!Re&&ze,Wr=Re&&!ze;return e.jsx(gv,{$isGrouped:rr,$isFirstInGroup:or,$isLastInGroup:Wr,children:e.jsx("div",{className:"log-content",children:q.content})},q.id)}return!q.content&&(!q.images||q.images.length===0)?null:e.jsx(Un,{$isUser:q.role==="user",children:e.jsxs(Al,{$isUser:q.role==="user",children:[e.jsx("div",{children:q.content}),q.images&&q.images.length>0&&e.jsx("div",{style:{display:"flex",gap:"8px",marginTop:"8px",flexWrap:"wrap"},children:q.images.map((Ce,Ne)=>{const Re=Ce.url||`data:${Ce.mime_type};base64,${Ce.data}`;return e.jsxs(Ov,{onClick:()=>de(Re),title:"Click to preview",children:[e.jsx("img",{src:Re,alt:`Image ${Ne+1}`,loading:"lazy"}),e.jsx("div",{className:"expand-icon",children:e.jsx(ah,{size:14})})]},Ne)})}),q.isStreaming&&e.jsx(hv,{})]})},q.id)}),D&&e.jsx(Un,{$isUser:!0,children:e.jsxs(fv,{$isUser:!0,children:[e.jsx("div",{children:D}),B&&B.length>0&&e.jsx("div",{style:{display:"flex",gap:"8px",marginTop:"8px",flexWrap:"wrap"},children:B.map((q,J)=>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:q.data?`data:${q.mime_type};base64,${q.data}`:"#",alt:`Image ${J+1}`,style:{maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",objectFit:"contain"},loading:"lazy"})},J))})]})}),e.jsx("div",{ref:T})]})}),P.length>0&&e.jsx(jv,{children:P.map((q,J)=>e.jsxs(kv,{children:[e.jsx("img",{src:q.data?`data:${q.mime_type};base64,${q.data}`:"#",alt:`Upload ${J+1}`}),e.jsx(_v,{type:"button",onClick:()=>Y(J),children:e.jsx(Qe,{size:12})})]},J))}),e.jsx(xv,{onSubmit:te,children:e.jsxs(vv,{children:[e.jsxs(bv,{children:[e.jsx(yv,{value:u,onChange:q=>m(q.target.value),onKeyDown:q=>{q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),te(q))},placeholder:we(),disabled:!se||ne&&!U||Te(),rows:1}),e.jsx(wv,{children:e.jsxs(Sv,{type:"button",disabled:!se||ne,onClick:()=>{var q;return(q=N.current)==null?void 0:q.click()},children:[e.jsx(yh,{size:16}),"Attach"]})}),e.jsx(Cv,{ref:N,type:"file",accept:"image/*",multiple:!0,onChange:ee})]}),e.jsx($v,{type:ne?"button":"submit",disabled:!se||!U&&!ne&&!u.trim(),onClick:ne?ae:void 0,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),style:{background:ne&&v?"var(--color-error)":void 0},children:ne?v?e.jsx(Qe,{size:14}):e.jsx(vr,{size:14,className:"animate-spin"}):e.jsx(Dc,{size:14})})]})})]}),e.jsx(Mv,{isOpen:!!j,imageUrl:j,zoomLevel:g,dragPosition:R,isDragging:k,onClose:ue,onDownload:()=>j&&F(j),onZoom:M,onReset:()=>{S(1),$({x:0,y:0})},onWheel:W,onMouseDown:A,onMouseMove:G,onMouseUp:re})]})}const Lv=l.div`
|
|
5426
5426
|
height: 100%;
|
|
5427
5427
|
display: flex;
|
|
5428
5428
|
flex-direction: column;
|
|
@@ -5433,7 +5433,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5433
5433
|
gap: var(--space-md);
|
|
5434
5434
|
padding: var(--space-lg);
|
|
5435
5435
|
border-bottom: 1px solid var(--color-border);
|
|
5436
|
-
`,
|
|
5436
|
+
`,Dv=l.button`
|
|
5437
5437
|
display: flex;
|
|
5438
5438
|
align-items: center;
|
|
5439
5439
|
justify-content: center;
|
|
@@ -5449,16 +5449,16 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5449
5449
|
&:hover {
|
|
5450
5450
|
background: var(--color-background-hover);
|
|
5451
5451
|
}
|
|
5452
|
-
`,
|
|
5452
|
+
`,Nv=l.h1`
|
|
5453
5453
|
flex: 1;
|
|
5454
5454
|
margin: 0;
|
|
5455
5455
|
font-size: var(--font-lg);
|
|
5456
5456
|
font-weight: 400;
|
|
5457
5457
|
color: var(--color-foreground);
|
|
5458
|
-
`,
|
|
5458
|
+
`,Fv=l.div`
|
|
5459
5459
|
padding: var(--space-lg);
|
|
5460
5460
|
border-bottom: 1px solid var(--color-border);
|
|
5461
|
-
`,
|
|
5461
|
+
`,Bv=l.input`
|
|
5462
5462
|
width: 100%;
|
|
5463
5463
|
padding: var(--space-sm) var(--space-md);
|
|
5464
5464
|
background: var(--color-background-subtle);
|
|
@@ -5477,20 +5477,20 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5477
5477
|
border-color: var(--color-primary);
|
|
5478
5478
|
background: var(--color-background);
|
|
5479
5479
|
}
|
|
5480
|
-
`,
|
|
5480
|
+
`,Uv=l.div`
|
|
5481
5481
|
flex: 1;
|
|
5482
5482
|
overflow-y: auto;
|
|
5483
5483
|
padding: var(--space-lg);
|
|
5484
|
-
`,
|
|
5484
|
+
`,Wv=l.div`
|
|
5485
5485
|
margin-bottom: var(--space-xl);
|
|
5486
|
-
`,
|
|
5486
|
+
`,Vv=l.h3`
|
|
5487
5487
|
font-size: var(--font-xs);
|
|
5488
5488
|
font-weight: 400;
|
|
5489
5489
|
color: var(--color-muted);
|
|
5490
5490
|
margin: 0 0 var(--space-sm) 0;
|
|
5491
5491
|
text-transform: uppercase;
|
|
5492
5492
|
letter-spacing: 0.05em;
|
|
5493
|
-
`,
|
|
5493
|
+
`,Gv=l.div`
|
|
5494
5494
|
display: flex;
|
|
5495
5495
|
align-items: center;
|
|
5496
5496
|
gap: var(--space-md);
|
|
@@ -5506,7 +5506,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5506
5506
|
background: var(--color-surface-hover, var(--color-background-hover));
|
|
5507
5507
|
border-color: var(--color-border-hover, var(--color-border));
|
|
5508
5508
|
}
|
|
5509
|
-
`,
|
|
5509
|
+
`,Hv=l.div`
|
|
5510
5510
|
width: 36px;
|
|
5511
5511
|
height: 36px;
|
|
5512
5512
|
display: flex;
|
|
@@ -5515,10 +5515,10 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5515
5515
|
background: var(--color-background-subtle);
|
|
5516
5516
|
border-radius: var(--radius-md);
|
|
5517
5517
|
color: var(--color-secondary-text);
|
|
5518
|
-
`,
|
|
5518
|
+
`,qv=l.div`
|
|
5519
5519
|
flex: 1;
|
|
5520
5520
|
min-width: 0;
|
|
5521
|
-
`,
|
|
5521
|
+
`,Yv=l.div`
|
|
5522
5522
|
font-size: var(--font-sm);
|
|
5523
5523
|
font-weight: 400;
|
|
5524
5524
|
color: var(--color-foreground);
|
|
@@ -5526,13 +5526,13 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5526
5526
|
white-space: nowrap;
|
|
5527
5527
|
overflow: hidden;
|
|
5528
5528
|
text-overflow: ellipsis;
|
|
5529
|
-
`,
|
|
5529
|
+
`,Zv=l.div`
|
|
5530
5530
|
font-size: var(--font-2xs);
|
|
5531
5531
|
color: var(--color-secondary-text);
|
|
5532
5532
|
display: flex;
|
|
5533
5533
|
align-items: center;
|
|
5534
5534
|
gap: var(--space-xs);
|
|
5535
|
-
`,
|
|
5535
|
+
`,Kv=l.span`
|
|
5536
5536
|
display: inline-block;
|
|
5537
5537
|
padding: 2px 6px;
|
|
5538
5538
|
border-radius: var(--radius-sm);
|
|
@@ -5540,7 +5540,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5540
5540
|
font-weight: 400;
|
|
5541
5541
|
background: ${t=>{switch(t.$status){case"running":return"var(--color-success-bg)";case"waiting_for_input":return"var(--color-warning-bg)";case"failed":return"var(--color-error-bg)";default:return"var(--color-background-subtle)"}}};
|
|
5542
5542
|
color: ${t=>{switch(t.$status){case"running":return"var(--color-success)";case"waiting_for_input":return"var(--color-warning)";case"failed":return"var(--color-error)";default:return"var(--color-secondary-text)"}}};
|
|
5543
|
-
`,
|
|
5543
|
+
`,Qv=l.button`
|
|
5544
5544
|
display: flex;
|
|
5545
5545
|
align-items: center;
|
|
5546
5546
|
justify-content: center;
|
|
@@ -5557,7 +5557,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5557
5557
|
background: var(--color-error-bg);
|
|
5558
5558
|
color: var(--color-error);
|
|
5559
5559
|
}
|
|
5560
|
-
`,
|
|
5560
|
+
`,Xv=l.div`
|
|
5561
5561
|
display: flex;
|
|
5562
5562
|
flex-direction: column;
|
|
5563
5563
|
align-items: center;
|
|
@@ -5573,11 +5573,11 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5573
5573
|
margin-bottom: var(--space-md);
|
|
5574
5574
|
opacity: 0.5;
|
|
5575
5575
|
}
|
|
5576
|
-
`,
|
|
5576
|
+
`,Jv=l.div`
|
|
5577
5577
|
display: flex;
|
|
5578
5578
|
flex-direction: column;
|
|
5579
5579
|
gap: var(--space-sm);
|
|
5580
|
-
`,
|
|
5580
|
+
`,e2=l.div`
|
|
5581
5581
|
display: flex;
|
|
5582
5582
|
align-items: center;
|
|
5583
5583
|
gap: var(--space-md);
|
|
@@ -5596,33 +5596,33 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5596
5596
|
opacity: 0.5;
|
|
5597
5597
|
}
|
|
5598
5598
|
}
|
|
5599
|
-
`,
|
|
5599
|
+
`,t2=l.div`
|
|
5600
5600
|
width: 36px;
|
|
5601
5601
|
height: 36px;
|
|
5602
5602
|
background: var(--color-border);
|
|
5603
5603
|
border-radius: var(--radius-md);
|
|
5604
|
-
`,
|
|
5604
|
+
`,r2=l.div`
|
|
5605
5605
|
flex: 1;
|
|
5606
5606
|
display: flex;
|
|
5607
5607
|
flex-direction: column;
|
|
5608
5608
|
gap: var(--space-xs);
|
|
5609
|
-
`,
|
|
5609
|
+
`,o2=l.div`
|
|
5610
5610
|
height: 14px;
|
|
5611
5611
|
width: 60%;
|
|
5612
5612
|
background: var(--color-border);
|
|
5613
5613
|
border-radius: var(--radius-sm);
|
|
5614
|
-
`,
|
|
5614
|
+
`,n2=l.div`
|
|
5615
5615
|
height: 12px;
|
|
5616
5616
|
width: 30%;
|
|
5617
5617
|
background: var(--color-border);
|
|
5618
5618
|
border-radius: var(--radius-sm);
|
|
5619
5619
|
opacity: 0.6;
|
|
5620
|
-
`;function Fl({showBackButton:t=!1}){const[r,o]=i.useState(""),{sessions:n,loadingSessions:a,selectSession:s,deleteSession:p,setShowHistory:f}=Bo(),c=n.filter(v=>v.title.toLowerCase().includes(r.toLowerCase())),h=v=>{const x={},w=new Date,_=new Date(w.getFullYear(),w.getMonth(),w.getDate()),z=new Date(_);z.setDate(z.getDate()-1);const y=new Date(_);return y.setDate(y.getDate()-7),v.forEach(
|
|
5620
|
+
`;function Fl({showBackButton:t=!1}){const[r,o]=i.useState(""),{sessions:n,loadingSessions:a,selectSession:s,deleteSession:p,setShowHistory:f}=Bo(),c=n.filter(v=>v.title.toLowerCase().includes(r.toLowerCase())),h=v=>{const x={},w=new Date,_=new Date(w.getFullYear(),w.getMonth(),w.getDate()),z=new Date(_);z.setDate(z.getDate()-1);const y=new Date(_);return y.setDate(y.getDate()-7),v.forEach(P=>{const C=new Date(P.last_activity_at);let j;C>=_?j="Today":C>=z?j="Yesterday":C>=y?j="This Week":j="Older",x[j]||(x[j]=[]),x[j].push(P)}),x},d=async(v,x)=>{if(v.stopPropagation(),confirm("Are you sure you want to delete this conversation?"))try{await p(x)}catch(w){console.error("Failed to delete session:",w)}},u=v=>new Date(v).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),m=h(c);return e.jsx(ie,{style:{height:"100%",width:"100%"},children:e.jsxs(Lv,{children:[e.jsxs(Av,{children:[t&&e.jsx(Dv,{onClick:()=>f(!1),children:e.jsx(Yo,{size:20})}),e.jsx(Nv,{children:"Conversation History"})]}),e.jsx(Fv,{children:e.jsx(Bv,{type:"text",placeholder:"Search conversations...",value:r,onChange:v=>o(v.target.value)})}),e.jsx(Uv,{children:a?e.jsx(Jv,{children:[1,2,3,4,5].map(v=>e.jsxs(e2,{children:[e.jsx(t2,{}),e.jsxs(r2,{children:[e.jsx(o2,{}),e.jsx(n2,{})]})]},v))}):c.length===0?e.jsxs(Xv,{children:[e.jsx(os,{}),e.jsx("div",{children:"No conversations found"}),r&&e.jsx("div",{style:{fontSize:"var(--font-xs)",marginTop:"var(--space-sm)"},children:"Try a different search term"})]}):Object.entries(m).map(([v,x])=>e.jsxs(Wv,{children:[e.jsx(Vv,{children:v}),x.map(w=>e.jsxs(Gv,{onClick:()=>s(w),children:[e.jsx(Hv,{children:e.jsx(os,{size:18})}),e.jsxs(qv,{children:[e.jsx(Yv,{children:w.title}),e.jsxs(Zv,{children:[e.jsx("span",{children:u(w.last_activity_at)}),w.status!=="idle"&&e.jsx(Kv,{$status:w.status,children:w.status.replace("_"," ")})]})]}),e.jsx(Qv,{onClick:_=>d(_,w.id),children:e.jsx(Qo,{size:16})})]},w.id))]},v))})]})})}const a2=l.div`
|
|
5621
5621
|
height: 100%;
|
|
5622
5622
|
display: flex;
|
|
5623
5623
|
flex-direction: column;
|
|
5624
5624
|
background: var(--color-background);
|
|
5625
|
-
`,
|
|
5625
|
+
`,s2=l.div`
|
|
5626
5626
|
height: 100%;
|
|
5627
5627
|
display: flex;
|
|
5628
5628
|
flex-direction: column;
|
|
@@ -5630,7 +5630,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5630
5630
|
justify-content: center;
|
|
5631
5631
|
padding: var(--space-2xl);
|
|
5632
5632
|
overflow: auto;
|
|
5633
|
-
`,
|
|
5633
|
+
`,i2=l.div`
|
|
5634
5634
|
width: 56px;
|
|
5635
5635
|
height: 56px;
|
|
5636
5636
|
margin-bottom: var(--space-lg);
|
|
@@ -5641,18 +5641,18 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5641
5641
|
color: var(--color-secondary-text);
|
|
5642
5642
|
opacity: 0.6;
|
|
5643
5643
|
}
|
|
5644
|
-
`,
|
|
5644
|
+
`,c2=l.h2`
|
|
5645
5645
|
font-size: var(--font-lg);
|
|
5646
5646
|
font-weight: 400;
|
|
5647
5647
|
color: var(--color-foreground);
|
|
5648
5648
|
margin: 0 0 var(--space-sm) 0;
|
|
5649
5649
|
text-align: center;
|
|
5650
|
-
`,
|
|
5650
|
+
`,l2=l.p`
|
|
5651
5651
|
font-size: var(--font-sm);
|
|
5652
5652
|
color: var(--color-secondary-text);
|
|
5653
5653
|
margin: 0 0 var(--space-xl) 0;
|
|
5654
5654
|
text-align: center;
|
|
5655
|
-
`,
|
|
5655
|
+
`,d2=l.button`
|
|
5656
5656
|
background: var(--color-primary);
|
|
5657
5657
|
color: white;
|
|
5658
5658
|
border: none;
|
|
@@ -5690,7 +5690,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5690
5690
|
opacity: 0.6;
|
|
5691
5691
|
}
|
|
5692
5692
|
}
|
|
5693
|
-
`,
|
|
5693
|
+
`,u2=l.span`
|
|
5694
5694
|
&::after {
|
|
5695
5695
|
content: ".";
|
|
5696
5696
|
animation: dots 1.5s steps(3, end) infinite;
|
|
@@ -5709,7 +5709,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5709
5709
|
content: "...";
|
|
5710
5710
|
}
|
|
5711
5711
|
}
|
|
5712
|
-
`,
|
|
5712
|
+
`,p2=l.div`
|
|
5713
5713
|
width: 100%;
|
|
5714
5714
|
padding: var(--space-md);
|
|
5715
5715
|
background: var(--color-surface, var(--color-background));
|
|
@@ -5724,7 +5724,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5724
5724
|
background: var(--color-surface-hover, var(--color-background-hover));
|
|
5725
5725
|
border-color: var(--color-border-hover, var(--color-border));
|
|
5726
5726
|
}
|
|
5727
|
-
`,
|
|
5727
|
+
`,h2=l.div`
|
|
5728
5728
|
font-size: var(--font-sm);
|
|
5729
5729
|
font-weight: 400;
|
|
5730
5730
|
color: var(--color-foreground);
|
|
@@ -5732,34 +5732,34 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5732
5732
|
white-space: nowrap;
|
|
5733
5733
|
overflow: hidden;
|
|
5734
5734
|
text-overflow: ellipsis;
|
|
5735
|
-
`,
|
|
5735
|
+
`,f2=l.div`
|
|
5736
5736
|
font-size: var(--font-2xs);
|
|
5737
5737
|
color: var(--color-secondary-text);
|
|
5738
5738
|
display: flex;
|
|
5739
5739
|
align-items: center;
|
|
5740
5740
|
gap: var(--space-xs);
|
|
5741
|
-
`,
|
|
5741
|
+
`,g2=l.div`
|
|
5742
5742
|
flex: 1;
|
|
5743
5743
|
min-width: 0;
|
|
5744
|
-
`,
|
|
5744
|
+
`,m2=l.div`
|
|
5745
5745
|
width: 100%;
|
|
5746
5746
|
max-width: 320px;
|
|
5747
5747
|
margin-top: var(--space-2xl);
|
|
5748
5748
|
padding-top: var(--space-2xl);
|
|
5749
5749
|
border-top: 1px solid var(--color-border);
|
|
5750
|
-
`,
|
|
5750
|
+
`,x2=l.div`
|
|
5751
5751
|
display: flex;
|
|
5752
5752
|
justify-content: space-between;
|
|
5753
5753
|
align-items: center;
|
|
5754
5754
|
margin-bottom: var(--space-md);
|
|
5755
|
-
`,
|
|
5755
|
+
`,v2=l.h3`
|
|
5756
5756
|
font-size: var(--font-xs);
|
|
5757
5757
|
font-weight: 400;
|
|
5758
5758
|
color: var(--color-muted);
|
|
5759
5759
|
margin: 0;
|
|
5760
5760
|
text-transform: uppercase;
|
|
5761
5761
|
letter-spacing: 0.05em;
|
|
5762
|
-
`,
|
|
5762
|
+
`,b2=l.button`
|
|
5763
5763
|
background: transparent;
|
|
5764
5764
|
border: none;
|
|
5765
5765
|
color: var(--color-primary);
|
|
@@ -5771,9 +5771,9 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
5771
5771
|
&:hover {
|
|
5772
5772
|
opacity: 0.8;
|
|
5773
5773
|
}
|
|
5774
|
-
`,
|
|
5774
|
+
`,y2=l.div`
|
|
5775
5775
|
display: flex;
|
|
5776
5776
|
flex-direction: column;
|
|
5777
5777
|
gap: var(--space-xs);
|
|
5778
|
-
`;function
|
|
5778
|
+
`;function w2(){const[t,r]=i.useState(!1),{sessions:o,selectedSession:n,showHistory:a,selectSession:s,createSession:p,setShowHistory:f}=Bo(),c=async()=>{try{r(!0),await p()}finally{r(!1)}},h=d=>{try{const u=new Date(d),v=new Date().getTime()-u.getTime(),x=Math.floor(v/6e4),w=Math.floor(x/60),_=Math.floor(w/24);return _>0?`${_}d ago`:w>0?`${w}h ago`:x>0?`${x}m ago`:"Just now"}catch{return""}};return a?e.jsx(Fl,{showBackButton:!0}):n?e.jsx(Nl,{showBackButton:!0}):e.jsx(ie,{style:{height:"100%",width:"100%"},children:e.jsx(a2,{children:e.jsxs(s2,{children:[e.jsx(i2,{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(c2,{children:"Hi there! 👋"}),e.jsx(l2,{children:"How can I help you today?"}),e.jsx(d2,{onClick:c,disabled:t,children:t?e.jsxs(e.Fragment,{children:["Starting",e.jsx(u2,{})]}):"Start a conversation"}),o.length>0&&e.jsxs(m2,{children:[e.jsxs(x2,{children:[e.jsx(v2,{children:"Recent Chats"}),e.jsx(b2,{onClick:()=>f(!0),children:"View All →"})]}),e.jsx(y2,{children:o.slice(0,2).map(d=>e.jsx(p2,{onClick:()=>s(d),children:e.jsxs(g2,{children:[e.jsx(h2,{children:d.title}),e.jsxs(f2,{children:[e.jsx("span",{children:h(d.last_activity_at)}),d.status==="running"&&e.jsx("span",{children:"• Active"})]})]})},d.id))})]})]})})})}const j2=t=>{const r=t.toLowerCase().trim();return["javascript:","data:","vbscript:"].some(a=>r.startsWith(a))?!0:["http://","https://","//","ftp://","ftps://","mailto:","tel:","sms:","file:","blob:"].some(a=>r.startsWith(a))},k2=t=>{const r=t.toLowerCase().trim();return!["javascript:","data:","vbscript:"].some(n=>r.startsWith(n))};exports.AcceptInvite=Fg;exports.AgentConversation=Nl;exports.AgentConversationHistory=Fl;exports.AgentConversationHub=w2;exports.AgentConversationProvider=_d;exports.AuthFormImage=De;exports.ChannelSelector=tv;exports.CreateOrganizationForm=en;exports.CreateWorkspaceDialog=pl;exports.CreateWorkspaceForm=ja;exports.DeploymentInitialized=Xd;exports.DeploymentInitializing=Jd;exports.DeploymentProvider=Wl;exports.Dialog=ye;exports.DialogTrigger=Jh;exports.Dropdown=rt;exports.DropdownDivider=Jo;exports.DropdownItem=Ee;exports.DropdownItems=ot;exports.DropdownTrigger=nt;exports.Form=dt;exports.FormGroup=fe;exports.Input=le;exports.Label=he;exports.MagicLinkVerification=Tg;exports.ManageAccount=El;exports.ManageAccountDialog=Pl;exports.ManageOrganization=ll;exports.ManageWorkspace=fl;exports.ManageWorkspaceDialog=gl;exports.NavigateToSignIn=D1;exports.NavigateToSignUp=N1;exports.NavigationLink=Ze;exports.NotificationBell=Ml;exports.NotificationItem=Tl;exports.NotificationPopover=Ol;exports.OAuthProvider=Ui;exports.OTPInput=Et;exports.OrganizationSwitcher=ml;exports.PhoneNumberInput=Br;exports.PhoneVerification=tl;exports.ProfileCompletion=ol;exports.RequireActiveTenancy=K1;exports.SSOCallback=_g;exports.SignInForm=ng;exports.SignInStrategy=pr;exports.SignUpForm=Lp;exports.SignedIn=j1;exports.SignedInAccounts=A1;exports.SignedOut=k1;exports.SimpleDialog=Xh;exports.Spinner=Pe;exports.Switch=Lo;exports.TwoFactorMethodSelector=el;exports.TwoFactorVerification=rl;exports.UserButton=Il;exports.UserControls=w1;exports.WaitlistForm=bg;exports.fetchChannelCounts=Hd;exports.hasIncompleteProfile=Og;exports.isExternalUrl=j2;exports.isSafeUrl=k2;exports.redirectToProfileCompletion=Mg;exports.useActiveOrganization=Xe;exports.useActiveWorkspace=zt;exports.useAgentConversation=ec;exports.useAgentConversationContext=Bo;exports.useChannelCounts=Qd;exports.useClient=Me;exports.useConversationSessions=Fi;exports.useDeployment=ve;exports.useForgotPassword=Ki;exports.useInvitation=tc;exports.useMagicLinkParams=Zi;exports.useMagicLinkVerification=Yi;exports.useNavigation=qe;exports.useNotificationStream=Xi;exports.useNotifications=Ji;exports.useOrganizationList=br;exports.useOrganizationMemberships=tr;exports.useResetPassword=Qi;exports.useSSOCallback=qi;exports.useSession=Ue;exports.useSignIn=Wi;exports.useSignInWithStrategy=Ar;exports.useSignUp=Vi;exports.useUser=er;exports.useUserSignins=Gi;exports.useWaitlist=Hi;exports.useWorkspaceList=vt;exports.useWorkspaceMemberships=pa;Object.keys(Ve).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Ve[t]})});
|
|
5779
5779
|
//# sourceMappingURL=index.cjs.js.map
|