@atproto/oauth-provider-ui 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Os=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);import{r as _,j as c,c as G,L as Ps,A as Bs,u as D,U as Us,C as $s,a as at,b as Me,T as y,E as As,d as ot,e as Ls,B as Gs,f as Ys,I as Ms,V as qs,P as Hs,N as dr,g as pr,h as Ct,i as Fs,k as zs,l as Vs,m as Ws,n as Si,S as Ks,o as Xs,p as Js,q as hr,s as fr,X as Zs,t as Qs,v as ea,w as ta,x as na}from"./error-view-DUrzON7u.js";var bd=Os((Td,Is)=>{const Ei=_.createContext(null),Zt={didCatch:!1,error:null};class ra extends _.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Zt}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:s,reason:"imperative-api"}),this.setState(Zt)}}componentDidCatch(t,n){var r,i;(r=(i=this.props).onError)===null||r===void 0||r.call(i,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:i}=this.props;if(r&&n.error!==null&&ia(t.resetKeys,i)){var s,a;(s=(a=this.props).onReset)===null||s===void 0||s.call(a,{next:i,prev:t.resetKeys,reason:"keys"}),this.setState(Zt)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:i}=this.props,{didCatch:s,error:a}=this.state;let o=t;if(s){const l={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")o=n(l);else if(r)o=_.createElement(r,l);else if(i!==void 0)o=i;else throw a}return _.createElement(Ei.Provider,{value:{didCatch:s,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}}function ia(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}function sa(e){if(e==null||typeof e.didCatch!="boolean"||typeof e.resetErrorBoundary!="function")throw new Error("ErrorBoundaryContext not found")}function aa(){const e=_.useContext(Ei);sa(e);const[t,n]=_.useState({error:null,hasError:!1}),r=_.useMemo(()=>({resetBoundary:()=>{e.resetErrorBoundary(),n({error:null,hasError:!1})},showBoundary:i=>n({error:i,hasError:!0})}),[e.resetErrorBoundary]);if(t.hasError)throw t.error;return r}function ee({customizationData:e,title:t,subtitle:n,htmlTitle:r=typeof t=="string"?t:void 0,className:i,children:s,...a}){return c.jsxs("div",{...a,className:G(i,"flex flex-col items-center","md:flex md:flex-row md:items-center md:justify-stretch","min-w-screen min-h-screen","bg-white text-slate-900","dark:bg-slate-900 dark:text-slate-100"),children:[r&&c.jsx("title",{children:r}),c.jsxs("div",{className:G("px-6 pt-4","w-full","md:max-w-lg","flex flex-row items-start","md:flex-col md:items-end","md:self-stretch","md:max-w-fix md:w-1/2 md:p-4","md:text-right","md:dark:border-r md:dark:border-slate-700","md:bg-slate-100 md:dark:bg-slate-800"),children:[c.jsxs("div",{className:"grid grow content-center md:justify-items-end",children:[t&&c.jsx("h1",{className:"text-primary text-xl font-semibold md:my-4 md:text-2xl lg:text-5xl",children:t},"title"),n&&c.jsx("p",{className:"hidden max-w-xs text-slate-600 md:block dark:text-slate-400",children:n},"subtitle")]}),c.jsx(Ps,{className:"m-1 md:m-2"},"localeSelector")]}),c.jsx("main",{className:"w-full p-6 md:max-w-3xl md:px-12",children:s})]})}function oa(e,t,n){if(!e)return[t];const r=e.findIndex(n);return r===-1?[...e,t]:[...e.slice(0,r),t,...e.slice(r+1)]}function ve(e,t){const{showBoundary:n}=aa();return _.useCallback(async(...r)=>{try{return await e(...r)}catch(i){throw i instanceof Us&&n(i),i}},t.concat(n))}function ca({sessions:e=[],onRedirected:t}){const[n]=_.useState(()=>new Bs),[r,i]=_.useState(e),{i18n:s,_:a}=D(),{locale:o}=s,l=_.useCallback(S=>{i(E=>{var w;return S===(((w=E.find(j=>j.selected))==null?void 0:w.account.sub)||null)?E:E.map(j=>({...j,selected:j.account.sub===S}))})},[i]),u=_.useCallback(({account:S,ephemeralToken:E,consentRequired:w=!0,selected:j=!0,loginRequired:C=!1})=>{const N={account:S,ephemeralToken:E,selected:j,loginRequired:C,consentRequired:w};i(Y=>oa(Y,N,P=>P.account.sub===S.sub).map(P=>!j||P===N||!P.selected?P:{...P,selected:!1}))},[i]),d=_.useCallback(S=>{window.location.href=String(S),t&&setTimeout(t)},[t]),p=ve(async(S,E)=>{const w=await n.fetch("POST","/sign-in",{...S,locale:o},{signal:E});u(w)},[n,o,u]),f=ve(async(S,E)=>{await n.fetch("POST","/reset-password-request",{...S,locale:o},{signal:E})},[n,o]),h=ve(async(S,E)=>{await n.fetch("POST","/reset-password-confirm",S,{signal:E})},[n]),g=ve(async(S,E)=>{await n.fetch("POST","/verify-handle-availability",S,{signal:E})},[n]),v=ve(async(S,E)=>{const w=await n.fetch("POST","/sign-up",{...S,locale:o},{signal:E});u(w)},[n,o,u]),b=ve(async(S,E)=>{var C;const w=(C=r.find(N=>N.account.sub===S))==null?void 0:C.ephemeralToken,{url:j}=await n.fetch("POST","/consent",{sub:S,scope:E},{bearer:w});d(j)},[n,r,d]),T=ve(async()=>{const{url:S}=await n.fetch("POST","/reject",{});d(S)},[n,d]);return{sessions:r,selectSub:l,doSignIn:p,doInitiatePasswordReset:f,doConfirmResetPassword:h,doValidateNewHandle:g,doSignUp:v,doConsent:b,doReject:T}}function ke(e,t){return _.useCallback(()=>e(t),[e,t])}function la({clientId:e,clientMetadata:t,clientTrusted:n}){const[r,i]=_.useState(!1),s=n?t.logo_uri:void 0,a=t.client_name||e;return _.useEffect(()=>{i(!1)},[s]),s&&!r?c.jsx("img",{"aria-hidden":!0,src:s,alt:a,className:"-ml-1 size-8",onError:()=>i(!0)}):c.jsx("div",{"aria-hidden":!0,className:"bg-primary flex size-8 items-center justify-center overflow-hidden rounded-full text-white",children:c.jsx($s,{className:"size-4"})})}function z({color:e="grey",transparent:t=!1,loading:n=void 0,shape:r="rounded",children:i,className:s,type:a="button",role:o="Button",disabled:l=!1,...u}){const d=a==="submit"||u.onClick!=null;return c.jsx("button",{role:o,type:a,disabled:l||n===!0,tabIndex:(u==null?void 0:u.tabIndex)??(d?0:-1),...u,className:G("touch-manipulation overflow-hidden","truncate tracking-wide",d?"cursor-pointer":null,r==="circle"?"rounded-full":"rounded-md",r==="circle"?"size-8":null,r==="rounded"?"px-6 py-2":r==="padded"?"p-2":void 0,"focus:outline-none focus:ring-2","transition duration-300 ease-in-out",e==="primary"?G("accent-slate-100","focus:ring-primary focus:ring-offset-1 focus:ring-offset-white dark:focus:ring-offset-black",t?"text-primary bg-transparent":"bg-primary text-primary-contrast"):e==="grey"?G("accent-primary","focus:ring-slate-300 dark:focus:ring-slate-500","text-slate-600 dark:text-slate-300","hover:bg-gray-200 dark:hover:bg-gray-700",t?"bg-transparent":"bg-gray-100 dark:bg-gray-800"):void 0,"disabled:opacity-50",s),children:i})}function ua(e,t){_.useEffect(()=>{const n=r=>{!r.defaultPrevented&&e.current&&!e.current.contains(r.target)&&t(r)};return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[e,t])}function da(e){const t=n=>{n.key==="Escape"&&(n.preventDefault(),e())};_.useEffect(()=>(window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}),[e])}function X({hint:e,image:t,title:n,description:r,append:i,className:s,children:a,...o}){const{i18n:l,_:u}=D(),[d,p]=_.useState(!1),f=_.useCallback(()=>p(!1),[]),h=_.useRef(null);da(f),ua(h,f);const g=a!=null,v=at("details-card-");return c.jsxs("div",{ref:h,className:s,...o,children:[c.jsxs("div",{className:"flex items-center justify-start gap-2",children:[c.jsx("div",{className:"ml-2 flex w-8 flex-grow-0 items-center justify-center","aria-hidden":!0,children:t}),c.jsxs("div",{className:"flex flex-1 flex-col","aria-describedby":g?v:void 0,children:[n&&c.jsx("h3",{children:n}),r&&c.jsx("p",{className:"text-sm",children:r})]}),i&&c.jsx("div",{className:"flex shrink-0 grow-0 items-center justify-center",children:i}),g&&c.jsx(z,{onClick:b=>{b.defaultPrevented||(b.preventDefault(),p(T=>!T))},shape:"circle",title:e??l._({id:"xz9eAw"}),"aria-expanded":d,"aria-label":d?l._({id:"183A6G"}):e??l._({id:"xAo8pm"}),"aria-haspopup":"true","aria-controls":v,children:"?"})]}),g&&c.jsx(Me,{className:"mt-4",hidden:!d,id:v,"aria-hidden":!d,children:a})]})}var xe={},We={},_r;function Bn(){if(_r)return We;_r=1,Object.defineProperty(We,"__esModule",{value:!0}),We.ScopeMissingError=void 0;class e extends Error{get statusCode(){return this.status}constructor(n){super(`Missing required scope "${n}"`),Object.defineProperty(this,"scope",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ScopeMissingError"}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:403}),Object.defineProperty(this,"expose",{enumerable:!0,configurable:!0,writable:!0,value:!0})}}return We.ScopeMissingError=e,We}var Ke={},Qt={},Ce={},en={},Xe={},mr;function pa(){if(mr)return Xe;mr=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.minIdx=e,Xe.toRecord=t;function e(n,r){return n===-1?r:r===-1?n:Math.min(n,r)}function t(n){const r=Object.create(null);for(const[i,s]of n)Object.hasOwn(r,i)?r[i].push(s):r[i]=[s];return r}return Xe}var gr;function ge(){return gr||(gr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ALLOWED_SCOPE_CHARS=e.ResourceSyntax=void 0,e.isScopeForResource=n,e.formatScope=i,e.encodeScope=s,e.encodeScopeComponent=a,e.normalizeScopeComponent=l;const t=pa();function n(u,d){if(!u.startsWith(d))return!1;if(u.length===d.length)return!0;const p=u.charCodeAt(d.length);return p===58||p===63}class r{constructor(d,p,f){Object.defineProperty(this,"resource",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(this,"positional",{enumerable:!0,configurable:!0,writable:!0,value:p}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:f})}is(d){return this.resource===d}containsParamsOtherThan(d){const{params:p}=this;if(p){for(const f of p.keys())if(!d.includes(f))return!0}return!1}getSingle(d,p=!1){const{params:f}=this,h=f!=null&&f.has(d)?f.getAll(d):void 0;return h?h.length!==1||p&&this.positional!==void 0?null:h[0]:p?this.positional:void 0}getMulti(d,p=!1){const{params:f}=this,h=f!=null&&f.has(d)?f.getAll(d):void 0;return h?p&&this.positional!==void 0?null:h:p&&this.positional!==void 0?[this.positional]:void 0}toString(){return s(this.resource,this.positional,this.params)}toJSON(){var d;return{resource:this.resource,positional:this.positional,params:(d=this.params)!=null&&d.size?(0,t.toRecord)(this.params):void 0}}static fromString(d){const p=d.indexOf("?"),f=d.indexOf(":"),h=(0,t.minIdx)(p,f),g=h!==-1?d.slice(0,h):d,v=f!==-1?p===-1?decodeURIComponent(d.slice(f+1)):f<p?decodeURIComponent(d.slice(f+1,p)):void 0:void 0,b=p!==-1?p===d.length-1?void 0:new URLSearchParams(d.slice(p+1)):void 0;return new r(g,v,b)}}e.ResourceSyntax=r;function i(u,d,p){const f=new URLSearchParams;let h;for(const[g,v]of d){if(v===void 0)continue;const b=g===p&&h===void 0;if(typeof v=="string")b?h=v:f.append(g,v);else{if(v.length===0)throw new Error(`Invalid scope: parameter "${g}" cannot be an empty array`);if(b&&v.length===1)h=v[0];else for(const T of v)f.append(g,T)}}return h!==void 0&&f.has(p)&&(f.append(p,h),h=void 0),s(u,h,f)}function s(u,d,p){let f=u;return d!==void 0&&(f+=`:${a(d)}`),p!=null&&p.size&&(f+=`?${l(p.toString())}`),f}e.ALLOWED_SCOPE_CHARS=new Set([":","/","+",",","@","%"]);function a(u){return l(encodeURIComponent(u))}const o=new Map(Array.from(e.ALLOWED_SCOPE_CHARS,u=>[encodeURIComponent(u),u]).filter(([u,d])=>u!==d&&u.length===3&&u.startsWith("%")));function l(u){let d=u.length-2;for(let p=0;p<d;p++)if(u.charCodeAt(p)===37){const f=u.slice(p,p+3),h=o.get(f);h&&(u=`${u.slice(0,p)}${h}${u.slice(p+f.length)}`,p+=h.length-1,d-=f.length-h.length)}return u}}(en)),en}var yr;function qe(){if(yr)return Ce;yr=1,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.Parser=void 0,Ce.knownValuesValidator=r;const e=ge();class t{constructor(s,a,o){Object.defineProperty(this,"resource",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"positionalName",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"schemaKeys",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.schemaKeys=Object.keys(a)}format(s){const a=[];for(const o of this.schemaKeys){const l=s[o];if(l===void 0)continue;const u=this.schema[o],d=u.normalize?u.normalize(l):l;!u.required&&(u.default===d||u.multiple&&u.default&&n(u.default,d))||a.push([o,d])}return(0,e.formatScope)(this.resource,a,this.positionalName)}parse(s){if(!s.is(this.resource)||s.containsParamsOtherThan(this.schemaKeys))return null;const a=Object.create(null);for(const o of this.schemaKeys){const l=this.schema[o],u=l.multiple?s.getMulti(o,o===this.positionalName):s.getSingle(o,o===this.positionalName);if(u===null||u===void 0&&l.required)return null;if(u!==void 0&&l.validate){if(l.multiple){if(!u.every(l.validate))return null}else if(!l.validate(u))return null}a[o]=u??l.default}return a}parseString(s){const a=e.ResourceSyntax.fromString(s);return this.parse(a)}}Ce.Parser=t;function n(i,s){for(const a of i)if(!s.includes(a))return!1;for(const a of s)if(!i.includes(a))return!1;return!0}function r(i){const s=new Set(i);return a=>s.has(a)}return Ce}var vr;function Un(){return vr||(vr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.AccountScope=e.accountParser=void 0;const t=qe(),n=ge(),r=Object.freeze(["email","repo","status"]),i=Object.freeze(["read","manage"]);e.accountParser=new t.Parser("account",{attr:{multiple:!1,required:!0,validate:(0,t.knownValuesValidator)(r)},action:{multiple:!1,required:!1,validate:(0,t.knownValuesValidator)(i),default:"read"}},"attr");class s{constructor(o,l){Object.defineProperty(this,"attr",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"action",{enumerable:!0,configurable:!0,writable:!0,value:l})}matches(o){return this.attr===o.attr&&(this.action==="manage"||this.action===o.action)}toString(){return e.accountParser.format(this)}static fromString(o){if(!(0,n.isScopeForResource)(o,"account"))return null;const l=n.ResourceSyntax.fromString(o);return this.fromSyntax(l)}static fromSyntax(o){const l=e.accountParser.parse(o);return l?new s(l.attr,l.action):null}static scopeNeededFor(o){return e.accountParser.format(o)}}e.AccountScope=s}(Qt)),Qt}var tn={},be={},xr;function Ti(){if(xr)return be;xr=1,Object.defineProperty(be,"__esModule",{value:!0}),be.isMime=t,be.isAccept=n,be.matchesAccept=i,be.matchesAnyAccept=a;function e(o){const l=o.indexOf("/");return!(l===-1||l===0||l===o.length-1||o.includes("/",l+1)||o.includes(" "))}function t(o){return e(o)&&!o.includes("*")}function n(o){return o==="*/*"?!0:e(o)?!o.includes("*")||o.endsWith("/*"):!1}function r(o,l){return o==="*/*"?!0:o.endsWith("/*")?l.startsWith(o.slice(0,-1)):o===l}function i(o,l){return t(l)&&r(o,l)}function s(o,l){for(const u of o)if(r(u,l))return!0;return!1}function a(o,l){return t(l)&&s(o,l)}return be}var br;function $n(){return br||(br=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.BlobScope=e.blobParser=e.DEFAULT_ACCEPT=void 0;const t=Ti(),n=qe(),r=ge();e.DEFAULT_ACCEPT=Object.freeze(["*/*"]),e.blobParser=new n.Parser("blob",{accept:{multiple:!0,required:!0,validate:t.isAccept,normalize:o=>o.includes("*/*")?e.DEFAULT_ACCEPT:o.map(s).filter(a)}},"accept");class i{constructor(l){Object.defineProperty(this,"accept",{enumerable:!0,configurable:!0,writable:!0,value:l})}matches(l){return(0,t.matchesAnyAccept)(this.accept,l.mime)}toString(){return e.blobParser.format(this)}static fromString(l){if(!(0,r.isScopeForResource)(l,"blob"))return null;const u=r.ResourceSyntax.fromString(l);return this.fromSyntax(u)}static fromSyntax(l){const u=e.blobParser.parse(l);return u?new i(u.accept):null}static scopeNeededFor(l){return e.blobParser.format({accept:[l.mime]})}}e.BlobScope=i;function s(o){return o.toLowerCase()}function a(o,l,u){if(o.endsWith("/*"))return!0;const d=o.split("/",1)[0];return!u.includes(`${d}/*`)}}(tn)),tn}var nn={},Sr;function An(){return Sr||(Sr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.IdentityScope=e.identityParser=void 0;const t=qe(),n=ge(),r=Object.freeze(["handle","*"]);e.identityParser=new t.Parser("identity",{attr:{multiple:!1,required:!0,validate:(0,t.knownValuesValidator)(r)}},"attr");class i{constructor(a){Object.defineProperty(this,"attr",{enumerable:!0,configurable:!0,writable:!0,value:a})}matches(a){return this.attr==="*"||this.attr===a.attr}toString(){return e.identityParser.format(this)}static fromString(a){if(!(0,n.isScopeForResource)(a,"identity"))return null;const o=n.ResourceSyntax.fromString(a);return this.fromSyntax(o)}static fromSyntax(a){const o=e.identityParser.parse(a);return o?new i(o.attr):null}static scopeNeededFor(a){return e.identityParser.format(a)}}e.IdentityScope=i}(nn)),nn}var rn={},Je={},Er;function Ln(){if(Er)return Je;Er=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.isNSID=void 0;const e=t=>t.includes(".")&&!t.includes(" ")&&!t.startsWith(".")&&!t.endsWith(".");return Je.isNSID=e,Je}var Tr;function Gn(){return Tr||(Tr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RepoScope=e.repoParser=e.isRepoAction=void 0;const t=Ln(),n=qe(),r=ge(),i=Object.freeze(["create","update","delete"]);e.isRepoAction=(0,n.knownValuesValidator)(i),e.repoParser=new n.Parser("repo",{collection:{multiple:!0,required:!0,validate:o=>o==="*"||(0,t.isNSID)(o),normalize:o=>o.length>1&&o.includes("*")?["*"]:o},action:{multiple:!0,required:!1,validate:e.isRepoAction,default:i}},"collection");class s{constructor(l,u){Object.defineProperty(this,"collection",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"action",{enumerable:!0,configurable:!0,writable:!0,value:u})}get allowsAnyCollection(){return this.collection.includes("*")}matches({action:l,collection:u}){return this.action.includes(l)&&(this.allowsAnyCollection||this.collection.includes(u))}toString(){return e.repoParser.format({collection:this.allowsAnyCollection?["*"]:this.collection.length>1?[...new Set(this.collection)].sort():this.collection,action:this.action===i?i:i.filter(a,this.action)})}static fromString(l){if(!(0,r.isScopeForResource)(l,"repo"))return null;const u=r.ResourceSyntax.fromString(l);return this.fromSyntax(u)}static fromSyntax(l){const u=e.repoParser.parse(l);return u?new s(u.collection,u.action):null}static scopeNeededFor(l){return e.repoParser.format({collection:[l.collection],action:[l.action]})}}e.RepoScope=s;function a(o){return this.includes(o)}}(rn)),rn}var sn={},Ze={},jr;function ji(){if(jr)return Ze;jr=1,Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.isDIDLike=void 0;const e=t=>t.startsWith("did:");return Ze.isDIDLike=e,Ze}var wr;function Yn(){return wr||(wr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RpcScope=e.rpcParser=void 0;const t=ji(),n=Ln(),r=qe(),i=ge(),s=l=>l==="*"||(0,n.isNSID)(l),a=l=>l==="*"||(0,t.isDIDLike)(l);e.rpcParser=new r.Parser("rpc",{lxm:{multiple:!0,required:!0,validate:s},aud:{multiple:!1,required:!0,validate:a}},"lxm");class o{constructor(u,d){Object.defineProperty(this,"aud",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"lxm",{enumerable:!0,configurable:!0,writable:!0,value:d})}matches(u){const{aud:d,lxm:p}=this;return(d==="*"||d===u.aud)&&(p.includes("*")||p.includes(u.lxm))}toString(){const{lxm:u,aud:d}=this;return e.rpcParser.format({aud:d,lxm:u.includes("*")?["*"]:[...new Set(u)].sort()})}static fromString(u){if(!(0,i.isScopeForResource)(u,"rpc"))return null;const d=i.ResourceSyntax.fromString(u);return this.fromSyntax(d)}static fromSyntax(u){const d=e.rpcParser.parse(u);return!d||d.aud==="*"&&d.lxm.includes("*")?null:new o(d.aud,d.lxm)}static scopeNeededFor(u){return e.rpcParser.format({aud:u.aud,lxm:[u.lxm]})}}e.RpcScope=o}(sn)),sn}var an={},Se={},Rr;function wi(){if(Rr)return Se;Rr=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.isValidAtprotoOauthScope=a,Se.parseScope=o,Se.scopeNeededFor=l,Se.scopeMatches=u;const e=Un(),t=$n(),n=An(),r=Gn(),i=Yn(),s=ge();function a(d){if(d==="atproto"||d==="transition:email"||d==="transition:generic"||d==="transition:chat.bsky")return!0;const p=s.ResourceSyntax.fromString(d);return p.resource==="repo"?r.RepoScope.fromSyntax(p)!=null:p.resource==="rpc"?i.RpcScope.fromSyntax(p)!=null:p.resource==="account"?e.AccountScope.fromSyntax(p)!=null:p.resource==="identity"?n.IdentityScope.fromSyntax(p)!=null:p.resource==="blob"?t.BlobScope.fromSyntax(p)!=null:!1}function o(d){const p=s.ResourceSyntax.fromString(d);return p.is("account")?e.AccountScope.fromSyntax(p):p.is("identity")?n.IdentityScope.fromSyntax(p):p.is("repo")?r.RepoScope.fromSyntax(p):p.is("rpc")?i.RpcScope.fromSyntax(p):p.is("blob")?t.BlobScope.fromSyntax(p):null}function l(d,p){switch(d){case"account":return e.AccountScope.scopeNeededFor(p);case"identity":return n.IdentityScope.scopeNeededFor(p);case"repo":return r.RepoScope.scopeNeededFor(p);case"rpc":return i.RpcScope.scopeNeededFor(p);case"blob":return t.BlobScope.scopeNeededFor(p)}}function u(d,p,f){if(!(0,s.isScopeForResource)(d,p))return!1;if(p==="rpc"){const h=i.RpcScope.fromString(d);if(h!=null&&h.matches(f))return!0}else if(p==="account"){const h=e.AccountScope.fromString(d);if(h!=null&&h.matches(f))return!0}else if(p==="identity"){const h=n.IdentityScope.fromString(d);if(h!=null&&h.matches(f))return!0}else if(p==="repo"){const h=r.RepoScope.fromString(d);if(h!=null&&h.matches(f))return!0}else if(p==="blob"){const h=t.BlobScope.fromString(d);if(h!=null&&h.matches(f))return!0}return!1}return Se}var Nr;function Ri(){return Nr||(Nr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ScopesSet=e.ScopeMissingError=void 0;const t=Bn();Object.defineProperty(e,"ScopeMissingError",{enumerable:!0,get:function(){return t.ScopeMissingError}});const n=wi();class r extends Set{matches(s,a){for(const o of this)if((0,n.scopeMatches)(o,s,a))return!0;return!1}assert(s,a){if(!this.matches(s,a)){const o=(0,n.scopeNeededFor)(s,a);throw new t.ScopeMissingError(o)}}some(s){for(const a of this)if(s(a))return!0;return!1}every(s){for(const a of this)if(!s(a))return!1;return!0}*filter(s){for(const a of this)s(a)&&(yield a)}*map(s){for(const a of this)yield s(a)}static fromString(s){return new r(s==null?void 0:s.split(" "))}}e.ScopesSet=r}(an)),an}var kr;function Ni(){if(kr)return Ke;kr=1,Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.PermissionSet=void 0;const e=Un(),t=$n(),n=An(),r=Gn(),i=Yn(),s=Bn(),a=Ri();class o{constructor(u){Object.defineProperty(this,"scopes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.scopes=new a.ScopesSet(typeof u=="string"?u.split(" "):u)}allowsAccount(u){return this.scopes.matches("account",u)}assertAccount(u){if(!this.allowsAccount(u)){const d=e.AccountScope.scopeNeededFor(u);throw new s.ScopeMissingError(d)}}allowsIdentity(u){return this.scopes.matches("identity",u)}assertIdentity(u){if(!this.allowsIdentity(u)){const d=n.IdentityScope.scopeNeededFor(u);throw new s.ScopeMissingError(d)}}allowsBlob(u){return this.scopes.matches("blob",u)}assertBlob(u){if(!this.allowsBlob(u)){const d=t.BlobScope.scopeNeededFor(u);throw new s.ScopeMissingError(d)}}allowsRepo(u){return this.scopes.matches("repo",u)}assertRepo(u){if(!this.allowsRepo(u)){const d=r.RepoScope.scopeNeededFor(u);throw new s.ScopeMissingError(d)}}allowsRpc(u){return this.scopes.matches("rpc",u)}assertRpc(u){if(!this.allowsRpc(u)){const d=i.RpcScope.scopeNeededFor(u);throw new s.ScopeMissingError(d)}}}return Ke.PermissionSet=o,Ke}var Qe={},Cr;function ha(){if(Cr)return Qe;Cr=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.PermissionSetTransition=void 0;const e=Ni();class t extends e.PermissionSet{get hasTransitionGeneric(){return this.scopes.has("transition:generic")}get hasTransitionEmail(){return this.scopes.has("transition:email")}get hasTransitionChatBsky(){return this.scopes.has("transition:chat.bsky")}allowsAccount(r){return r.attr==="email"&&this.hasTransitionEmail?!0:super.allowsAccount(r)}allowsBlob(r){return this.hasTransitionGeneric?!0:super.allowsBlob(r)}allowsRepo(r){return this.hasTransitionGeneric?!0:super.allowsRepo(r)}allowsRpc(r){const{lxm:i}=r;return this.hasTransitionGeneric&&i==="*"||this.hasTransitionGeneric&&!i.startsWith("chat.bsky.")||this.hasTransitionChatBsky&&i.startsWith("chat.bsky.")?!0:super.allowsRpc(r)}}return Qe.PermissionSetTransition=t,Qe}var Dr;function fa(){return Dr||(Dr=1,function(e){var t=xe&&xe.__createBinding||(Object.create?function(r,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(r,a,o)}:function(r,i,s,a){a===void 0&&(a=s),r[a]=i[s]}),n=xe&&xe.__exportStar||function(r,i){for(var s in r)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,r,s)};Object.defineProperty(e,"__esModule",{value:!0}),n(Bn(),e),n(Ni(),e),n(ha(),e),n(Ri(),e),n(qe(),e),n(ge(),e),n(wi(),e),n(Un(),e),n($n(),e),n(An(),e),n(Gn(),e),n(Yn(),e),n(Ti(),e),n(ji(),e),n(Ln(),e)}(xe)),xe}var V=fa();const Mn=_.forwardRef(({className:e,invalid:t,disabled:n,...r},i)=>c.jsx("input",{...r,type:"checkbox",ref:i,disabled:n,className:G(["block size-4 rounded-md border-2 focus:shadow-sm focus:outline-none","border-contrast-200 focus:border-primary-500 focus:bg-contrast-25 dark:focus:bg-contrast-50 focus:shadow-primary-600/30",t&&"border-error-300 text-error-900 placeholder-error-300 focus:border-error-500",n&&"bg-contrast-50 text-contrast-500 cursor-not-allowed",e])}));Mn.displayName="Checkbox";function _a({scope:e,clientTrusted:t=!1,clientFirstParty:n=!1,allowEmail:r,onAllowEmail:i,className:s="",...a}){const o=_.useMemo(()=>new V.PermissionSetTransition(e),[e]),l=!xa(o);return o.scopes.size===0||o.scopes.size===1&&o.scopes.has("atproto")?null:c.jsxs("div",{className:`flex flex-col gap-2 ${s}`,...a,role:"list",children:[c.jsx(ga,{permissions:o,allowEmail:r,onAllowEmail:i}),c.jsx(Ea,{permissions:o}),c.jsx(va,{permissions:o}),c.jsx(ba,{permissions:o}),c.jsx(Sa,{permissions:o}),l&&c.jsxs(c.Fragment,{children:[c.jsx(ya,{permissions:o}),c.jsx(wa,{permissions:o}),c.jsx(Ta,{permissions:o})]}),(!n||!t)&&c.jsx(ma,{className:"mt-2",permissions:o})]})}function ma({permissions:e,type:t="alert",prominent:n=!0,...r}){return _.useMemo(()=>e.allowsIdentity({attr:"*"}),[e])?c.jsx(Me,{...r,type:t,prominent:n,children:c.jsx(y,{id:"zb3TS0",components:{0:c.jsx("b",{}),1:c.jsx("b",{})}})}):null}function ga({permissions:e,allowEmail:t,onAllowEmail:n}){const{i18n:r,_:i}=D(),s=_.useMemo(()=>["manage","read"].find(a=>e.allowsAccount({attr:"email",action:a})),[e]);return s?c.jsx("label",{className:n?"cursor-pointer":void 0,children:c.jsx(X,{role:"listitem",image:c.jsx(As,{className:"size-6"}),title:r._({id:"O3oNi5"}),description:s==="manage"?c.jsx(y,{id:"FLm/n9"}):c.jsx(y,{id:"fEvm25"}),append:n&&c.jsx(Mn,{className:"m-2",checked:t,onChange:a=>n(a.target.checked)})})}):null}function ya({permissions:e}){const{i18n:t,_:n}=D(),r=_.useMemo(()=>e.hasTransitionGeneric||e.scopes.some(a=>V.RepoScope.fromString(a)!=null),[e]),i=_.useMemo(()=>e.hasTransitionGeneric?[new V.BlobScope(["*/*"])]:Array.from(e.scopes.map(a=>V.BlobScope.fromString(a))).filter(a=>a!=null),[e]),s=_.useMemo(()=>{const a=i.some(l=>l.accept.includes("*/*")),o={images:a,videos:a,audio:a,other:a};if(!a)for(const l of i)for(const u of l.accept)u.startsWith("image/")?o.images=!0:u.startsWith("video/")?o.videos=!0:u.startsWith("audio/")?o.audio=!0:o.other=!0;return o},[i]);return!r||i.length===0?null:s.images&&!s.videos&&!s.audio&&!s.other?c.jsx(X,{role:"listitem",image:c.jsx(Ms,{className:"size-6"}),title:t._({id:"BrrIs8"}),description:t._({id:"Pqo+0V"})}):!s.images&&s.videos&&!s.audio&&!s.other?c.jsx(X,{role:"listitem",image:c.jsx(qs,{className:"size-6"}),title:t._({id:"BrrIs8"}),description:t._({id:"BawXMM"})}):c.jsx(X,{role:"listitem",image:c.jsx(Hs,{className:"size-6"}),title:t._({id:"BrrIs8"}),description:t._({id:"sCtyHQ"})})}function va({permissions:e}){const{i18n:t,_:n}=D();return e.allowsAccount({attr:"status",action:"manage"})?c.jsx(X,{role:"listitem",image:c.jsx(Ls,{className:"size-6"}),title:t._({id:"AeXO77"}),description:t._({id:"NKHn7N"})}):null}function xa(e){return _.useMemo(()=>{if(e.allowsAccount({attr:"repo",action:"manage"}))return!1;let t=!1;for(const n of e.scopes){const r=V.RpcScope.fromString(n);if(r){if(t=!0,ki(r.aud)||r.lxm.every(fn))continue;return!1}const i=V.RepoScope.fromString(n);if(i){if(t=!0,i.collection.every(fn))continue;return!1}}return t},[e])}function ba({permissions:e}){const t=_.useMemo(()=>e.scopes.some(Ca),[e]),n=_.useMemo(()=>e.scopes.some(Da),[e]);return t||n?c.jsx(X,{role:"listitem",image:c.jsx(Gs,{className:"size-6"}),title:"Bluesky",description:t&&n?c.jsx(y,{id:"0ZqxWk"}):c.jsx(y,{id:"YRqkn2"})}):null}function Sa({permissions:e}){const{i18n:t,_:n}=D();return _.useMemo(()=>e.hasTransitionChatBsky||e.scopes.some(ka),[e])?c.jsx(X,{role:"listitem",image:c.jsx(Ys,{className:"size-6"}),title:t._({id:"AHZflp"}),description:t._({id:"yZDyOS"})}):null}function Ea({permissions:e}){const{i18n:t,_:n}=D(),r=_.useMemo(()=>e.allowsIdentity({attr:"*"})?"*":e.allowsIdentity({attr:"handle"})?"handle":null,[e]);return r?c.jsx(X,{role:"listitem",image:c.jsx(ot,{className:"h-6"}),title:t._({id:"ePYQjq"}),description:r==="*"?c.jsx(y,{id:"hqGoYC",components:{0:c.jsx("b",{}),1:c.jsx("b",{})}}):c.jsx(y,{id:"lbjZdy",components:{0:c.jsx("b",{})}})}):null}function Ta({permissions:e}){const{i18n:t,_:n}=D();return e.hasTransitionGeneric?c.jsx(X,{role:"listitem",image:c.jsx(pr,{className:"size-6"}),title:t._({id:"OX6vme"}),description:c.jsx(y,{id:"17SnJo",components:{0:c.jsx("b",{})}}),children:c.jsx("p",{children:c.jsx(Ir,{})})}):e.scopes.some(r=>V.RpcScope.fromString(r)!=null)?c.jsxs(X,{role:"listitem",image:c.jsx(pr,{className:"size-6"}),title:t._({id:"OX6vme"}),description:t._({id:"RZlEhS"}),children:[c.jsx("p",{children:c.jsx(Ir,{})}),c.jsx("p",{className:"mt-1",children:c.jsx(y,{id:"rBUDH4"})}),c.jsx(ja,{className:"mt-2",permissions:e})]}):null}function Ir(){return c.jsx(y,{id:"sVs8xu"})}function ja({permissions:e,className:t="",...n}){const{i18n:r,_:i}=D(),s=_.useMemo(()=>{const a=new Map;for(const o of e.scopes){const l=V.RpcScope.fromString(o);if(!l)continue;let u=a.get(l.aud);u||a.set(l.aud,u=new Set);for(const d of l.lxm)u.add(d)}return Array.from(a.entries()).sort(([o],[l])=>o.localeCompare(l)).map(([o,l])=>[o,Array.from(l).sort((u,d)=>u.localeCompare(d))])},[e]);return c.jsxs("table",{className:`w-full table-auto ${t}`,...n,children:[c.jsx("thead",{children:c.jsxs("tr",{className:"text-sm",children:[c.jsx("th",{className:"text-left font-normal",children:r._({id:"T3bXxK"})}),c.jsx("th",{className:"text-left font-normal",children:r._({id:"ZiFCSO"})})]})}),c.jsx("tbody",{children:s.map(([a,o])=>c.jsxs("tr",{className:"text-sm",children:[c.jsx("td",{className:"align-top text-slate-500",children:a==="*"?c.jsx("em",{children:r._({id:"UuQciw"})}):c.jsx("code",{children:a})}),c.jsx("td",{className:"text-slate-500",children:o.includes("*")?c.jsx("em",{children:r._({id:"P5xSNt"})}):o.map(l=>c.jsx("code",{className:"block",children:l},l))})]},a))})]})}function wa({permissions:e}){const{i18n:t,_:n}=D();return e.hasTransitionGeneric||e.allowsAccount({attr:"repo",action:"manage"})||e.allowsRepo({collection:"*",action:"create"})&&e.allowsRepo({collection:"*",action:"delete"})&&e.allowsRepo({collection:"*",action:"update"})?c.jsxs(X,{role:"listitem",image:c.jsx(dr,{className:"size-6"}),title:t._({id:"IreQBq"}),description:t._({id:"NnNRWU"}),children:[c.jsx("p",{children:c.jsx(Or,{})}),c.jsx("p",{className:"mt-1",children:c.jsx(y,{id:"AtArvR",components:{0:c.jsx("b",{})}})})]}):e.scopes.some(r=>V.RepoScope.fromString(r)!=null)?c.jsxs(X,{role:"listitem",image:c.jsx(dr,{className:"size-6"}),title:t._({id:"IreQBq"}),description:t._({id:"xs63gu"}),children:[c.jsx("p",{children:c.jsx(Or,{})}),c.jsx("p",{className:"mt-1",children:c.jsx(y,{id:"RO+zdy"})}),c.jsx(Ra,{className:"mt-2",permissions:e})]}):null}function Or(){return c.jsx(y,{id:"Gmgygg"})}function Ra({permissions:e,className:t,...n}){const{i18n:r,_:i}=D(),s=_.useMemo(()=>{const l=new Map;for(const u of e.scopes){const d=V.RepoScope.fromString(u);if(d)for(const p of d.collection)if(l.has(p)){const f=l.get(p);for(const h of d.action)f[h]=!0}else l.set(p,{create:d.action.includes("create"),update:d.action.includes("update"),delete:d.action.includes("delete")})}return l},[e]),a=s.get("*"),o=_.useMemo(()=>Array.from(s.entries()).sort(([l],[u])=>l.localeCompare(u)),[s]);return c.jsxs("table",{className:`w-full table-auto text-left ${t}`,...n,children:[c.jsx("thead",{children:c.jsxs("tr",{className:"text-sm",children:[c.jsx("th",{className:"font-normal",children:r._({id:"q+hNag"})}),c.jsx("th",{className:"text-center font-normal",children:r._({id:"hYgDIe"})}),c.jsx("th",{className:"text-center font-normal",children:r._({id:"EkH9pt"})}),c.jsx("th",{className:"text-center font-normal",children:r._({id:"cnGeoo"})})]})}),c.jsx("tbody",{children:o.map(([l,u])=>c.jsxs("tr",{className:"text-sm",children:[c.jsx("td",{className:"text-slate-500",children:l==="*"?c.jsx("em",{children:r._({id:"a6yfpg"})}):c.jsx("code",{children:l})}),c.jsx("td",{className:"text-center",children:a!=null&&a.create||u.create?c.jsx(Ct,{className:"inline-block size-4"}):null}),c.jsx("td",{className:"text-center",children:a!=null&&a.update||u.update?c.jsx(Ct,{className:"inline-block size-4"}):null}),c.jsx("td",{className:"text-center",children:a!=null&&a.delete||u.delete?c.jsx(Ct,{className:"inline-block size-4"}):null})]},l))})]})}function ki(e){return e==="did:web:bsky.app#bsky_appview"}function Na(e){return e.startsWith("app.bsky.")}function Ci(e){return e.startsWith("chat.bsky.")}function ka(e){if(e==="transition:chat.bsky")return!0;const t=V.RpcScope.fromString(e);return!t||ki(t.aud)?!1:t.lxm.includes("*")||t.lxm.some(Ci)}function fn(e){return e==="*"?!1:e==="com.atproto.moderation.createReport"||Na(e)||Ci(e)}function Ca(e){if(e==="transition:generic")return!0;const t=V.RepoScope.fromString(e);return t?t.collection.includes("*")||t.collection.some(fn):!1}function Da(e){if(e==="transition:generic")return!0;const t=V.RpcScope.fromString(e);return t?t.lxm.includes("app.bsky.actor.getPreferences")||t.lxm.includes("app.bsky.graph.block")||t.lxm.includes("app.bsky.graph.muteActor")||t.lxm.includes("app.bsky.graph.muteActorList")||t.lxm.includes("app.bsky.graph.muteThread")||t.lxm.includes("app.bsky.graph.unmuteActor")||t.lxm.includes("app.bsky.graph.unmuteActorList")||t.lxm.includes("app.bsky.graph.unmuteThread")||t.lxm.includes("app.bsky.graph.getMutes")||t.lxm.includes("*"):!1}function qn({actions:e,cancel:t,append:n,children:r,prepend:i,disabled:s,inert:a=s,...o}){return c.jsxs("form",{...o,inert:a,className:"flex flex-col gap-4",children:[i&&c.jsx("div",{children:i},"prepend"),c.jsx("div",{className:"space-y-4",children:r},"children"),n&&c.jsx("div",{children:n},"append"),(e||t)&&c.jsxs("div",{className:"flex flex-row-reverse flex-wrap items-center justify-end space-x-2 space-x-reverse",children:[e,c.jsx("div",{className:"flex-auto"}),t]},"buttons")]})}function Pr({account:e,...t}){return c.jsx("b",{...t,children:e.preferred_username||e.email||e.sub})}const Ia=e=>{try{const t=new URL(e);return t.protocol==="https:"&&t.pathname==="/oauth-client-metadata.json"&&!t.port&&!t.search}catch{return!1}};function Oa({url:e,proto:t=!1,host:n=!0,path:r=!1,query:i=!1,hash:s=!1,as:a="span",...o}){const l=_.useMemo(()=>e instanceof URL?e:new URL(e),[e]);return c.jsxs(a,{...o,children:[t&&c.jsx(et,{value:`${l.protocol}//`,...t===!0?null:t}),n&&c.jsx(et,{value:l.host,...n===!0?{faded:!1,bold:!0}:n}),r&&c.jsx(et,{value:l.pathname,...r===!0?null:r}),i&&c.jsx(et,{value:l.search,...i===!0?null:i}),s&&c.jsx(et,{value:l.hash,...s===!0?null:s})]})}function et({value:e,faded:t=!0,bold:n=!1}){const r=n?"b":"span";return c.jsx(r,{className:t?"opacity-50":"",children:e})}function Pa({clientId:e,clientMetadata:t,clientTrusted:n,...r}){const i=_.useMemo(()=>{try{return new URL(e)}catch{return null}},[e]);if(n&&t.client_name)return c.jsx("span",{...r,children:t.client_name});if((i==null?void 0:i.protocol)==="http:")return c.jsx("span",{...r,children:c.jsx(y,{id:"eYNzrj"})});if((i==null?void 0:i.protocol)==="https:"){const s=Ia(e);return c.jsx(Oa,{...r,url:i,proto:!s,host:!0,path:!s,query:!s,hash:!1})}return c.jsx("span",{...r,children:e})}function Ba(e){return e.startsWith("transition:")}function Ua(e){const t=V.AccountScope.fromString(e);return t?t.matches({attr:"email",action:"read"}):!1}function $a(e){return e==null?void 0:e.split(" ").filter(t=>!Ua(t)).join(" ")}function Aa({clientId:e,clientMetadata:t,clientTrusted:n,clientFirstParty:r,account:i,scope:s,onConsent:a,consentLabel:o,onReject:l,rejectLabel:u,onBack:d,backLabel:p,...f}){const{i18n:h,_:g}=D(),[v,b]=_.useState(!0),T=!(s!=null&&s.split(" ").some(Ba));return c.jsxs(qn,{...f,onSubmit:S=>{S.preventDefault();const E=T&&!v?$a(s):s;a(E)},cancel:d&&c.jsx(z,{onClick:d,children:p||c.jsx(y,{id:"iH8pgl"})}),actions:c.jsxs(c.Fragment,{children:[c.jsx(z,{type:"submit",color:"primary",children:o||c.jsx(y,{id:"yIVrHZ"})}),c.jsx(z,{onClick:l,children:u||c.jsx(y,{id:"54JiGG"})})]}),children:[c.jsx(X,{image:c.jsx(la,{clientId:e,clientMetadata:t,clientTrusted:n}),title:c.jsx(Pa,{clientId:e,clientMetadata:t,clientTrusted:n}),description:!s||s==="atproto"?c.jsx(y,{id:"AM8FL/",components:{0:c.jsx(Pr,{account:i})}}):c.jsx(y,{id:"sUabXh",components:{0:c.jsx(Pr,{account:i})}}),hint:h._({id:"69Gavs"}),children:s?c.jsxs(c.Fragment,{children:[c.jsx("p",{children:c.jsx(y,{id:"Poe314"})}),c.jsx("ul",{className:"mt-2",children:s.split(" ").map(S=>c.jsx("li",{children:c.jsx("code",{children:S})},S))})]}):null}),c.jsx(_a,{scope:s,clientTrusted:n,clientFirstParty:r,allowEmail:T?v:!0,onAllowEmail:T?b:void 0}),c.jsx("p",{children:c.jsx(y,{id:"TQzU6E",values:{0:o||c.jsx(y,{id:"yIVrHZ"})},components:{0:c.jsx("b",{}),1:c.jsx("a",{role:"link",href:t.tos_uri,rel:"nofollow noopener",target:"_blank",className:t.tos_uri?"text-primary underline":void 0}),2:c.jsx("a",{role:"link",href:t.policy_uri,rel:"nofollow noopener",target:"_blank",className:t.policy_uri?"text-primary underline":void 0})}})})]})}function La({clientId:e,clientMetadata:t,clientTrusted:n,clientFirstParty:r,account:i,scope:s,onConsent:a,onReject:o,onBack:l,title:u,subtitle:d=c.jsx(y,{id:"QdVx1C",values:{0:i.preferred_username||i.email||i.sub},components:{0:c.jsx("b",{className:"text-slate-800 dark:text-slate-200"})}}),...p}){const{i18n:f,_:h}=D();return c.jsx(ee,{...p,title:u??f._({id:"yIVrHZ"}),subtitle:d,children:c.jsx(Aa,{clientId:e,clientMetadata:t,clientTrusted:n,clientFirstParty:r,account:i,scope:s,onBack:l,onConsent:a,onReject:o})})}const Yt=_.createContext({disabled:!1});Yt.displayName="FieldsetContext";function ue({label:e,children:t,disabled:n,...r}){const i=at({prefix:"fieldset-"}),s=_.useMemo(()=>({disabled:n??!1,labelId:e?i:void 0}),[n,e,i]);return c.jsxs("fieldset",{...r,"aria-labelledby":i,disabled:n,children:[e&&c.jsx("legend",{id:i,className:"mb-1 text-sm font-medium text-slate-600 dark:text-slate-400",children:e},"title"),c.jsx("div",{className:"flex flex-col space-y-4",children:c.jsx(Yt,{value:s,children:t})})]})}function Ga(e,{ref:t,onLoading:n,onError:r}={}){const[i,s]=_.useState(!1),[a,o]=_.useState(),l=_.useCallback(h=>{o(h),r==null||r(h)},[r]),u=_.useCallback(h=>{s(h),n==null||n(h)},[n]),d=_.useRef(null),p=_.useRef(null);_.useEffect(()=>(p.current=()=>{var h;(h=d.current)==null||h.abort(),d.current=null,l(void 0),u(!1)},()=>{p.current=null}),[l,u]),_.useImperativeHandle(t,()=>({reset:()=>{var h;return(h=p.current)==null?void 0:h.call(p)}}),[]),_.useEffect(()=>()=>{var h;(h=d.current)==null||h.abort(),d.current=null},[]);const f=_.useCallback(async()=>{var v;(v=d.current)==null||v.abort(),u(!0),l(void 0);const h=new AbortController,{signal:g}=h;d.current=h;try{await e(g)}catch(b){h===d.current?l(b instanceof Error?b:new Error(String(b))):Ya(g,b)||console.warn("Async action error after abort",b)}finally{h===d.current&&(d.current=null,u(!1)),h.abort()}},[e,u,l]);return{loading:i,error:a,run:f}}function Ya(e,t){return e.aborted&&(e.reason===t||e.reason===(t==null?void 0:t.cause)||t instanceof DOMException&&t.name==="AbortError")}const Ma=({error:e})=>c.jsx(Fs,{error:e});function He({invalid:e,disabled:t,onSubmit:n,submitLabel:r,onCancel:i=void 0,cancelLabel:s,errorRender:a=Ma,ref:o,onLoading:l,onError:u,children:d,...p}){const{run:f,loading:h,error:g}=Ga(n,{ref:o,onError:u,onLoading:l}),v=_.useCallback(b=>{b.preventDefault(),b.currentTarget.reportValidity()&&!t&&!e&&f()},[t,e,f]);return c.jsx(qn,{...p,onSubmit:v,disabled:t||h,prepend:g!=null?a({error:g}):void 0,cancel:i&&c.jsx(z,{onClick:i,children:s||c.jsx(y,{id:"dEgA5A"})}),actions:c.jsx(z,{color:"primary",type:"submit",loading:h,disabled:t,children:r||c.jsx(y,{id:"hQRttt"})}),children:d})}const oe=8,qa=/(\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/,ft=/[A-Z]/,_t=/[a-z]/,mt=/[0-9]/,gt=/[^a-zA-Z0-9]/;var je=function(e){return e[e.weak=1]="weak",e[e.moderate=2]="moderate",e[e.strong=3]="strong",e[e.extra=4]="extra",e}({});function Di(e){return e.length<oe?1:e.length>=oe+12?4:e.length>=oe+8?ae(e,[gt])||ae(e,[ft,_t,mt],2)?4:3:e.length>=oe&&ae(e,[qa])?3:e.length>=oe+6?ae(e,[gt])||ae(e,[ft,_t,mt],2)?3:2:e.length>=oe+4?ae(e,[gt])||ae(e,[ft,_t,mt],2)?2:1:e.length>=oe&&(ae(e,[gt])||ae(e,[ft,_t,mt]))?2:1}function ae(e,t,n=t.length){if(n<1||n>t.length)throw new TypeError("Invalid regexpsCountToMatch");for(const r of t)if(r.test(e)&&(n--,n===0))return!0;return!1}function Ha({password:e,...t}){const{i18n:n,_:r}=D(),i=Di(e);return c.jsx("span",{...t,"aria-label":n._({id:"osAB4a"}),children:i===je.extra?c.jsx(y,{id:"/Ltc/k"}):i===je.strong?c.jsx(y,{id:"LLx/nr"}):i===je.moderate?c.jsx(y,{id:"dvYuhh"}):e?c.jsx(y,{id:"9ls/Vs"}):c.jsx(y,{id:"VU3Nrn"})})}function Fa({password:e,className:t,...n}){const{i18n:r,_:i}=D(),s=e?Di(e):0,a="bg-gray-300 dark:bg-slate-500",o=s===je.extra||s===je.strong?"bg-success":s===je.moderate?"bg-warning":"bg-error";return c.jsx("div",{...n,className:G("flex h-1 w-full space-x-2",t),role:"meter","aria-label":r._({id:"xfNKwI"}),"aria-valuemin":0,"aria-valuemax":je.extra,"aria-valuenow":s,children:Array.from({length:4},(l,u)=>c.jsx("div",{className:`h-1 w-1/4 rounded-sm ${s>u?o:a}`},u))})}function za(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function ye(e){return t=>{for(const n of e)n&&za(n,t)}}function Va({visible:e,toggleVisible:t,onClick:n,...r}){const{i18n:i,_:s}=D();return c.jsx(z,{...r,shape:"padded",onClick:a=>{n==null||n(a),a.defaultPrevented||t()},"aria-label":e?i._({id:"vLyv1R"}):i._({id:"huXYDE"}),children:e?c.jsx(zs,{className:"w-5","aria-hidden":!0}):c.jsx(Vs,{className:"w-5","aria-hidden":!0})})}function Bt({icon:e,append:t,bellow:n,className:r,children:i,onFocus:s,onBlur:a,...o}){const[l,u]=_.useState(!1);return c.jsxs("div",{...o,onFocus:d=>{s==null||s(d),d.defaultPrevented||u(!0)},onBlur:d=>{a==null||a(d),d.defaultPrevented||u(!1)},className:G("min-h-12","max-w-full","overflow-hidden","rounded-lg",r),children:[c.jsxs("div",{className:G("px-1","min-h-12 w-full","flex items-center justify-stretch","rounded-lg",n?"rounded-bl-none rounded-br-none":void 0,"outline-hidden","border-2 border-solid border-transparent","focus:border-primary has-focus:border-primary","hover:border-gray-400 hover:focus:border-gray-400","dark:hover:border-gray-500 dark:hover:focus:border-gray-500","has-focus:bg-slate-200 bg-gray-100 focus:bg-slate-200","dark:has-focus:bg-slate-700 dark:bg-slate-800 dark:focus:bg-slate-700","text-slate-600 dark:text-slate-300","accent-primary"),children:[e&&c.jsx("div",{className:G("flex shrink-0 grow-0 items-center justify-center","mx-1",l?"text-primary":"text-slate-500"),children:e}),i,c.jsx("div",{className:"ml-1 flex shrink-0 grow-0 items-center",children:t})]}),n&&c.jsx("div",{className:G("space-x-2 px-3 py-2","flex flex-row items-center gap-1","rounded-br-2 rounded-bl-2","bg-gray-200 dark:bg-slate-700","text-gray-700 dark:text-gray-300","text-sm italic"),children:n})]})}function Fe({icon:e,append:t,bellow:n,className:r,onFocus:i,onBlur:s,ref:a,disabled:o,title:l,"aria-label":u=l,"aria-labelledby":d,placeholder:p=u,...f}){const h=_.useContext(Yt),g=_.useRef(null),v=_.useRef(!1);return c.jsx(Bt,{icon:e,append:t,bellow:n,className:G("cursor-text",r),tabIndex:-1,onClick:b=>{var T;g.current!==b.target&&(b.preventDefault(),b.stopPropagation(),(T=g.current)==null||T.focus())},onMouseDown:b=>{v.current&&b.target!==g.current&&(b.preventDefault(),b.stopPropagation())},children:c.jsx("input",{...f,disabled:o??h.disabled,title:l,placeholder:p,"aria-label":u,"aria-labelledby":d??h.labelId,ref:ye([a,g]),className:"outline-hidden w-full text-ellipsis bg-transparent bg-clip-padding text-base text-inherit dark:placeholder-gray-500",onFocus:b=>{i==null||i(b),b.defaultPrevented||(v.current=!0)},onBlur:b=>{s==null||s(b),b.defaultPrevented||(v.current=!1)}})})}function Ii({autoHide:e=!0,onBlur:t,onChange:n,append:r,autoComplete:i="current-password",icon:s=c.jsx(Ws,{className:"w-5"}),value:a,defaultValue:o=a,ref:l,title:u,dir:d="auto",autoCapitalize:p="none",autoCorrect:f="off",spellCheck:h="false",...g}){const{i18n:v,_:b}=D(),T=_.useRef(null),[S,E]=_.useState(!1),[w,j]=_.useState(typeof o=="string"?o:""),C=_.useCallback(N=>{n==null||n(N),j(N.target.value)},[n]);return c.jsx(Fe,{...g,title:u??v._({id:"8ZsakT"}),ref:ye([l,T]),dir:d,autoCapitalize:p,autoCorrect:f,spellCheck:h,icon:s,onBlur:e?N=>{t==null||t(N),N.defaultPrevented||E(!1)}:t,value:w,onChange:C,type:S?"text":"password",autoComplete:i,append:c.jsxs(c.Fragment,{children:[c.jsx(Va,{className:"m-1",visible:S,toggleVisible:()=>{var N;E(Y=>!Y),(N=T.current)==null||N.focus()}}),r]})})}function Oi({password:e="",onPassword:t,onChange:n,autoComplete:r="new-password",minLength:i=oe,...s}){const{i18n:a,_:o}=D(),[l,u]=_.useState(e),d=_.useCallback(p=>{const{value:f}=p.target;n==null||n(p),!p.defaultPrevented&&(u(f),t==null||t(p.target.validity.valid?f:void 0))},[n,t]);return c.jsx(Ii,{...s,placeholder:a._({id:"3tOlz6"}),"aria-label":a._({id:"0StR7t"}),title:a._({id:"5CqSPX",values:{MIN_PASSWORD_LENGTH:oe}}),minLength:i,onChange:d,value:l,autoComplete:r,bellow:c.jsxs(c.Fragment,{children:[c.jsx(Fa,{password:l}),c.jsx(Ha,{className:"grow-1 min-w-max text-xs text-gray-500 dark:text-gray-400",password:l})]})})}const Wa="XXXXX-XXXXX";function Pi({example:e=Wa,onToken:t,icon:n=c.jsx(Si,{className:"w-5"}),title:r=e,onChange:i,value:s,defaultValue:a=s,...o}){const{i18n:l,_:u}=D(),[d,p]=_.useState(typeof a=="string"?a:"");return c.jsx(Fe,{...o,type:"text",autoCapitalize:"characters",autoCorrect:"off",autoComplete:"one-time-code",spellCheck:"false",minLength:11,maxLength:11,dir:"auto",icon:n,pattern:"^[A-Z2-7]{5}-[A-Z2-7]{5}$",placeholder:l._({id:"0hTJM+",values:{example:e}}),title:r,value:d,onChange:f=>{const{value:h,selectionEnd:g,selectionStart:v}=f.currentTarget,b=Br(h);f.currentTarget.value=b;const T=g??v;if(T!=null){const S=Br(h.slice(0,T));f.currentTarget.selectionStart=f.currentTarget.selectionEnd=S.length}p(b),i==null||i(f),f.isDefaultPrevented()||t==null||t(b.length===11?b:null)}})}function Br(e){const t=e.toUpperCase().replaceAll(/[^A-Z2-7]/g,"");return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5,10)}`}function Ka({onSubmit:e,invalid:t,...n}){const r=at({prefix:"reset-pwd-email-"}),i=_.useRef(null),[s,a]=_.useState(null),[o,l]=_.useState(void 0);return c.jsxs(He,{...n,onSubmit:u=>{if(s&&o)return e({token:s,password:o},u)},invalid:t||!s||!o,children:[c.jsx(Me,{id:r,type:"status",children:c.jsx(y,{id:"imRJNy"})}),c.jsx(ue,{label:c.jsx(y,{id:"vJgYMA"}),children:c.jsx(Pi,{name:"code","aria-labelledby":r,enterKeyHint:"next",required:!0,autoFocus:!0,onToken:u=>{var d;a(u),u&&((d=i.current)==null||d.focus())}})}),c.jsx(ue,{label:c.jsx(y,{id:"/nT6AE"}),children:c.jsx(Oi,{ref:i,name:"password",enterKeyHint:"done",required:!0,password:o,onPassword:l})})]})}function Bi({onEmail:e,autoCapitalize:t="none",autoComplete:n="email",autoCorrect:r="off",dir:i="auto",icon:s=c.jsx(ot,{className:"w-5"}),onBlur:a,onChange:o,pattern:l="^[^@]+@[^@]+\\.[^@]+$",spellCheck:u="false",value:d,defaultValue:p=d,title:f,...h}){const{i18n:g,_:v}=D(),[b,T]=_.useState(typeof p=="string"?p:""),S=_.useCallback(E=>{const w=E.target.value.toLowerCase();T(w),o==null||o(E),e==null||e(E.target.validity.valid?w:void 0)},[o,e]);return c.jsx(Fe,{...h,title:f??g._({id:"ATGYL1"}),type:"email",autoCapitalize:t,autoCorrect:r,dir:i,spellCheck:u,icon:s,pattern:l,autoComplete:n,value:b,onChange:S,onBlur:a})}function Xa({emailDefault:e,onSubmit:t,invalid:n,ref:r,...i}){const{i18n:s,_:a}=D(),o=at({prefix:"reset-pwd-email-"}),[l,u]=_.useState(e),d=_.useRef(null),p=_.useCallback(f=>{if(l)return t({email:l},f)},[l,t]);return c.jsx(He,{...i,ref:ye([r,d]),invalid:n||!l,onSubmit:p,children:c.jsxs(ue,{label:c.jsx(y,{id:"ATGYL1"}),children:[c.jsx(Bi,{name:"email",placeholder:s._({id:"xRPn3U"}),"aria-labelledby":o,title:s._({id:"ATGYL1"}),required:!0,autoFocus:!0,value:l,onEmail:f=>{var h;(h=d.current)==null||h.reset(),u(f)}}),c.jsx(Me,{type:"status",id:o,children:c.jsx(y,{id:"cHrOqs"})})]})})}function Ja({emailDefault:e,onresetPasswordRequest:t,onResetPasswordConfirm:n,onBack:r,...i}){const{i18n:s,_:a}=D(),[o,l]=_.useState(0);if(o===0)return c.jsxs(ee,{...i,title:i.title||s._({id:"dn8X5t"}),subtitle:i.subtitle||c.jsx(y,{id:"Esfg1M"}),children:[c.jsx(Xa,{emailDefault:e,submitLabel:c.jsx(y,{id:"hXzOVo"}),onSubmit:async(u,d)=>{await t(u,d),d.aborted||l(1)},cancelLabel:c.jsx(y,{id:"iH8pgl"}),onCancel:r}),c.jsx("hr",{className:"my-5 border-gray-300 dark:border-gray-700"}),c.jsx("center",{children:c.jsx(z,{transparent:!0,onClick:()=>l(1),children:c.jsx(y,{id:"FTT4a4"})})})]});if(o===1)return c.jsx(ee,{...i,title:i.title||s._({id:"KbS2K9"}),subtitle:i.subtitle||c.jsx(y,{id:"xg/UcZ"}),children:c.jsx(Ka,{submitLabel:c.jsx(y,{id:"hXzOVo"}),onSubmit:async(u,d)=>{await n(u,d),d.aborted||l(2)},cancelLabel:c.jsx(y,{id:"iH8pgl"}),onCancel:r})});if(o===2)return c.jsx(ee,{...i,title:i.title||s._({id:"fSy6T1"}),subtitle:i.subtitle||c.jsx(y,{id:"+qGdcW"}),children:c.jsxs("center",{children:[c.jsx("h2",{className:"pb-2 text-xl font-bold",children:c.jsx(y,{id:"DKeVgZ"})}),c.jsx("p",{className:"pb-4",children:c.jsx(y,{id:"67nRLM"})}),c.jsx(z,{color:"primary",onClick:r,children:c.jsx(y,{id:"UaXeX3"})})]})});throw new Error(`Invalid view: ${o}`)}function Za({className:e,children:t,id:n,ref:r,disabled:i,title:s,"aria-label":a=s,"aria-labelledby":o,...l}){const u=at("input-checkbox-"),d=_.useRef(null),p=_.useRef(null),f=_.useContext(Yt),h=n??u;return c.jsx(Bt,{className:G("cursor-pointer",e),icon:c.jsx(Mn,{...l,disabled:i??f.disabled,title:s,"aria-label":a,"aria-labelledby":t?void 0:o??f.labelId,ref:ye([r,p]),id:h,className:"accent-primary outline-hidden"}),tabIndex:-1,onClick:({target:g})=>{var v;g!==d.current&&g!==p.current&&((v=p.current)==null||v.click())},children:t&&c.jsx("label",{ref:d,htmlFor:h,className:"block w-full cursor-pointer select-none leading-[1.6]",children:t})})}function yt({usernameDefault:e="",usernameReadonly:t=!1,rememberDefault:n=!1,onSubmit:r,onBack:i,backLabel:s,onForgotPassword:a,ref:o,invalid:l,children:u,...d}){const{i18n:p,_:f}=D(),[h,g]=_.useState(e),[v,b]=_.useState(""),[T,S]=_.useState(n),[E,w]=_.useState(null),[j,C]=_.useState(null),[N,Y]=_.useState(!1),P=_.useRef(null),K=_.useCallback(()=>{w(null),C(null)},[w,C]),R=_.useCallback(()=>{var H;K(),(H=P.current)==null||H.reset()},[K,P]),q=_.useCallback(async H=>{try{await r({username:h,password:v,remember:T,...j?{[j.type]:E}:{}},H)}catch(F){if(H.aborted)return;if(F instanceof Ks){C(F);return}throw F instanceof Xs&&K(),F}},[h,v,T,j,E,r]);return c.jsxs(He,{...d,ref:ye([o,P]),onLoading:Y,onCancel:i,cancelLabel:s??p._({id:"iH8pgl"}),append:u,invalid:l||!h||!v||j!=null&&!E,submitLabel:j?c.jsx(y,{id:"UwGV9B"}):c.jsx(y,{id:"yKDCQ1"}),onSubmit:q,children:[c.jsx(ue,{disabled:N,label:c.jsx(y,{id:"sJGljQ"}),children:c.jsx(Fe,{icon:c.jsx(ot,{className:"w-5"}),name:"username",type:"text",title:p._({id:"nZx9mr"}),autoCapitalize:"none",autoCorrect:"off",autoComplete:"username",spellCheck:"false",dir:"auto",enterKeyHint:"next",required:!0,readOnly:t,disabled:t,autoFocus:!t,value:h,onChange:H=>{R(),g(H.target.value)}})}),c.jsx(ue,{disabled:N,label:c.jsx(y,{id:"8ZsakT"}),children:c.jsx(Ii,{name:"password",onChange:H=>{R(),b(H.target.value)},append:a&&c.jsx(z,{className:"text-sm",type:"button",onClick:()=>{a(h!=null&&h.includes("@")?h:void 0)},"aria-label":p._({id:"slOprG"}),children:c.jsx(y,{id:"F4OP4y"})}),enterKeyHint:j?"next":"done",disabled:N,autoFocus:t,required:!0})}),c.jsx(Me,{role:"alert",title:c.jsx(y,{id:"r6y+jM"}),children:c.jsx(y,{id:"+Z2ZNt"})}),c.jsx(Za,{name:"remember",title:p._({id:"1TxdLU"}),enterKeyHint:j?"next":"done",checked:T,onChange:H=>S(H.target.checked),children:c.jsx(y,{id:"1TxdLU"})}),j&&c.jsx(ue,{disabled:N,label:c.jsx(y,{id:"4blS0m"}),children:c.jsxs("div",{children:[c.jsx(Pi,{title:p._({id:"ioZOzk"}),enterKeyHint:"done",required:!0,autoFocus:!0,value:E??"",onToken:w}),c.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-400",children:c.jsx(y,{id:"B+Yy3b",values:{0:j.hint}})})]})},"2fa")]})}function Qa({src:e,alt:t}){const[n,r]=_.useState(!1);return _.useEffect(()=>{r(!1)},[e]),e&&!n?c.jsx("img",{"aria-hidden":!0,src:e,alt:t,className:"-ml-1 h-6 w-6 rounded-full",onError:()=>r(!0)}):c.jsx("div",{"aria-hidden":!0,className:"bg-primary border-primary h-6 w-6 overflow-hidden rounded-full border-2 border-solid text-white",children:c.jsx(Js,{className:"-mx-1 -mb-1"})})}function eo({accounts:e,onAccount:t,onOther:n=void 0,onBack:r,onSignUp:i,backLabel:s,children:a,...o}){const{i18n:l,_:u}=D();return c.jsxs(qn,{...o,append:a,actions:i&&c.jsx(z,{onClick:i,color:"primary",transparent:!0,children:c.jsx(y,{id:"e+RpCP"})}),cancel:r&&c.jsx(z,{onClick:r,children:s||c.jsx(y,{id:"iH8pgl"})}),children:[c.jsx("p",{className:"text-sm font-medium text-slate-600 dark:text-slate-400",children:c.jsx(y,{id:"FT1MVS"})}),e.map(d=>c.jsx(Bt,{tabIndex:0,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&t(d)},onClick:()=>t(d),role:"button","aria-label":l._({id:"N9o7n5",values:{0:d.name}}),icon:c.jsx(Qa,{src:d.picture,alt:l._({id:"kfcRb0"})}),append:c.jsx(hr,{"aria-hidden":!0,className:"h-4"}),className:"cursor-pointer",children:c.jsxs("span",{className:"flex flex-wrap items-center",children:[d.name&&c.jsx("span",{className:"mr-2 truncate font-medium","arial-label":l._({id:"6YtxFj"}),children:d.name}),c.jsx("span",{className:"truncate text-sm text-neutral-500 dark:text-neutral-400","arial-label":l._({id:"sJGljQ"}),children:d.preferred_username||d.email||d.sub})]})},d.sub)),n&&c.jsx(Bt,{tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&n()},onClick:n,"aria-label":l._({id:"cR9UpQ"}),role:"button",append:c.jsx(hr,{"aria-hidden":!0,className:"h-4"}),icon:c.jsx(ot,{"aria-hidden":!0,className:"h-4"}),className:"cursor-pointer",children:c.jsx("span",{className:"truncate text-slate-700 dark:text-slate-400",children:c.jsx(y,{id:"+TaG50"})})},"other")]})}function to({loginHint:e,sessions:t,selectSub:n,onSignIn:r,onSignUp:i,onForgotPassword:s,onBack:a,backLabel:o,title:l,subtitle:u,...d}){const{i18n:p,_:f}=D(),h=_.useMemo(()=>t.find(S=>S.selected),[t]),g=_.useCallback(()=>n(null),[n]),v=_.useMemo(()=>t.map(S=>S.account),[t]),[b,T]=_.useState(t.length===0);return l??(l=p._({id:"cQae5I"})),_.useEffect(()=>{h&&T(!1)},[h]),h?h.loginRequired?c.jsx(ee,{...d,title:l,subtitle:u??c.jsx(y,{id:"HaGV2g"}),children:c.jsx(yt,{onSubmit:r,onForgotPassword:s,onBack:g,usernameDefault:h.account.preferred_username||h.account.sub,usernameReadonly:!0,rememberDefault:!0})}):null:e?c.jsx(ee,{...d,title:l,subtitle:u??c.jsx(y,{id:"NgaR6B"}),children:c.jsx(yt,{onSubmit:r,onForgotPassword:s,onBack:a,backLabel:o,usernameDefault:e,usernameReadonly:!0})}):t.length===0?c.jsx(ee,{...d,title:l,subtitle:u??c.jsx(y,{id:"T0KLp4"}),children:c.jsx(yt,{onSubmit:r,onForgotPassword:s,onBack:a,backLabel:o})}):b?c.jsx(ee,{...d,title:l,subtitle:u??c.jsx(y,{id:"T0KLp4"}),children:c.jsx(yt,{onSubmit:r,onForgotPassword:s,onBack:()=>T(!1)})}):c.jsx(ee,{...d,title:l,subtitle:u??c.jsx(y,{id:"o3dwub"}),children:c.jsx(eo,{accounts:v,onAccount:S=>n(S.sub),onOther:()=>T(!0),onBack:a,backLabel:o,onSignUp:i})})}const ce=e=>e!=null&&e!==!1,no=e=>ce(e)&&e.invalid===!0,ro=e=>!ce(e)||e.invalid===!1;function io(e){const t=e.findIndex(ce),n=e.findLastIndex(ce),r=e.findIndex(no),[i,s]=_.useState(t),a=_.useCallback(E=>E!==-1&&e[E]?(s(E),!0):!1,[e.map(ce).join()]),o=e.findLastIndex((E,w)=>ce(E)&&w<i),l=e.findIndex((E,w)=>ce(E)&&w>i),u=_.useCallback(()=>a(t),[a,t]),d=_.useCallback(()=>a(n),[a,n]),p=_.useCallback(()=>a(o),[a,o]),f=_.useCallback(()=>a(l),[a,l]),h=_.useCallback(()=>a(r),[a,r]),g=i+1+e.reduce((E,w,j)=>j>=i||ce(w)?E:E-1,0),v=e.filter(ce).length,b=e.every(ro),T=i===-1||!e[i]?void 0:e[i],S=i===-1;return _.useEffect(()=>{S&&u()},[S]),{current:T,currentPosition:g,count:v,completed:b,atFirst:g===1,atLast:g===v,toFirst:u,toLast:d,toPrev:p,toNext:f,toRequired:h}}function so({prevLabel:e,nextLabel:t,onBack:n,backLabel:r,onDone:i,doneLabel:s,steps:a,className:o,...l}){var C,N;const{atFirst:u,atLast:d,count:p,current:f,currentPosition:h,completed:g,toNext:v,toPrev:b,toRequired:T}=io(a),S=_.useCallback(()=>{v()||T()},[v,T]),E={current:!0,invalid:f?f.invalid:!1,prevLabel:u&&r||e||c.jsx(y,{id:"iH8pgl"}),prev:u?n:b,nextLabel:d&&s||t||c.jsx(y,{id:"hXzOVo"}),next:d&&g?i:S},w=(C=f==null?void 0:f.titleRender)==null?void 0:C.call(f,E),j=(N=f==null?void 0:f.contentRender)==null?void 0:N.call(f,E);return c.jsxs("div",{className:G(o,"flex flex-col"),...l,children:[c.jsx("p",{className:"text-slate-500 dark:text-slate-400",children:c.jsx(y,{id:"BEx8rG",values:{currentPosition:h,count:p}})}),w&&c.jsx("h2",{className:"mb-4 text-xl font-medium",children:w}),j]})}function ao({links:e,className:t,...n}){const r=e==null?void 0:e.find(i=>i.rel==="help");return r?c.jsx("p",{...n,className:G("rounded-md bg-slate-100 p-3 text-sm text-slate-800 dark:bg-slate-800 dark:text-slate-400",t),children:c.jsx(y,{id:"87VTIH",components:{0:c.jsx("a",{role:"link",href:r.href,rel:r.rel,target:"_blank",className:"text-primary"})}})}):null}function oo({inviteCodeRequired:e=!0,credentials:t,onCredentials:n,onNext:r,nextLabel:i,onPrev:s,prevLabel:a,children:o,ref:l,invalid:u,...d}){const{i18n:p,_:f}=D(),[h,g]=_.useState(t==null?void 0:t.email),[v,b]=_.useState(t==null?void 0:t.password),[T,S]=_.useState(t==null?void 0:t.inviteCode),E=_.useRef(null),w=()=>{var C;return(C=E.current)==null?void 0:C.reset()},j=_.useMemo(()=>h&&v&&(!e||T)?{email:h,password:v,inviteCode:e?T:void 0}:void 0,[h,v,T,e]);return _.useEffect(()=>{n==null||n(j)},[j,n]),c.jsxs(He,{...d,ref:ye([l,E]),invalid:u||!j,onCancel:s,cancelLabel:a,onSubmit:r,submitLabel:i,append:o,children:[e&&c.jsx(ue,{label:c.jsx(y,{id:"6KlkHI"}),children:c.jsx(Fe,{icon:c.jsx(Si,{className:"w-5"}),autoFocus:!0,name:"inviteCode",title:p._({id:"6KlkHI"}),placeholder:p._({id:"jxqcgY"}),required:!0,value:T||"",onChange:C=>{S(C.target.value||void 0),w()},enterKeyHint:"next"})}),c.jsx(ue,{label:c.jsx(y,{id:"O3oNi5"}),children:c.jsx(Bi,{autoFocus:!e,name:"email",enterKeyHint:"next",required:!0,defaultValue:h,onEmail:C=>{g(C),w()}})}),c.jsx(ue,{label:c.jsx(y,{id:"8ZsakT"}),children:c.jsx(Oi,{name:"password",enterKeyHint:"next",required:!0,password:v,onPassword:C=>{b(C),w()}})})]})}function on({links:e,className:t,...n}){const r=e==null?void 0:e.find(s=>s.rel==="terms-of-service"),i=e==null?void 0:e.find(s=>s.rel==="privacy-policy");return c.jsx("p",{className:G("text-sm text-slate-500 dark:text-slate-400",t),...n,children:c.jsx(y,{id:"mBUXx0",values:{0:r?c.jsx(fr,{className:"text-primary underline",link:r,children:c.jsx(y,{id:"xowcRf"})}):c.jsx(y,{id:"xowcRf"}),1:i?c.jsx(fr,{className:"text-primary underline",link:i,children:c.jsx(y,{id:"LcET2C"})}):c.jsx(y,{id:"LcET2C"})}})})}const co=18,Ui=3,$i=30,lo=e=>Ui+e.length<=$i&&e.startsWith(".")&&!e.endsWith(".");function uo(e){const t=Ui,n=Math.min(co,$i-e.length),r=_.useCallback(i=>{const s=i.length>=t&&i.length<=n,a=/^[a-z0-9][a-z0-9-]+[a-z0-9]$/g.test(i);return{validLength:s,validCharset:a,valid:s&&a}},[n,t]);return{minLength:t,maxLength:n,validateSegment:r}}function po({domains:e,onNext:t,nextLabel:n,onPrev:r,prevLabel:i,handle:s,onHandle:a,invalid:o,children:l,ref:u,...d}){const{i18n:p,_:f}=D(),h=e.filter(lo),g=_.useRef(null),[v,b]=_.useState(()=>{const R=h.findIndex(q=>s==null?void 0:s.endsWith(q));return R===-1?0:R}),[T,S]=_.useState(()=>(s==null?void 0:s.split(".")[0])||"");_.useEffect(()=>{b(R=>Math.min(R,h.length-1))},[h.length]);const E=h[v]||h[0]||null,{minLength:w,maxLength:j,validateSegment:C}=uo(E),N=C(T),Y=E&&N.valid?`${T}${E}`:void 0;_.useEffect(()=>{var R;(R=g.current)==null||R.reset(),a==null||a(Y)},[a,Y]);const P=_.useRef(null),K=`@${T}${E}`;return c.jsxs(He,{...d,ref:ye([u,g]),onCancel:r,cancelLabel:i,onSubmit:t,submitLabel:n,invalid:o||!Y,append:l,children:[c.jsxs("div",{children:[c.jsx(Ur,{hasValue:!!T,valid:N.validLength,children:c.jsx(y,{id:"4Rgp24",values:{minLength:w,maxLength:j}})}),c.jsx(Ur,{hasValue:!!T,valid:N.validCharset,children:c.jsx(y,{id:"yDlXDJ"})})]}),c.jsx(Fe,{ref:P,icon:c.jsx(ot,{className:"w-5"}),name:"handle",type:"text",title:p._({id:"LX2sHe"}),pattern:"[a-z0-9][a-z0-9\\-]+[a-z0-9]",minLength:w,maxLength:j,autoCapitalize:"none",autoCorrect:"off",autoComplete:"off",dir:"auto",enterKeyHint:"done",autoFocus:!0,required:!0,value:T,onChange:R=>{const q=R.target.value.toLowerCase(),H=R.target.selectionStart,F=R.target.selectionEnd;R.target.value=q,R.target.setSelectionRange(H,F),S(q)},append:h.length>1&&c.jsx("select",{onClick:R=>R.stopPropagation(),onMouseDown:R=>R.stopPropagation(),value:v,"aria-label":p._({id:"HB+TbB"}),onChange:R=>{var q;b(Number(R.target.value)),(q=P.current)==null||q.focus()},className:G("block w-full","text-sm","rounded-lg p-2","bg-white dark:bg-slate-600"),children:h.map((R,q)=>c.jsx("option",{value:q,children:R},R))}),bellow:c.jsx(y,{id:"r/b/p8",values:{0:T.length?c.jsx("strong",{className:"text-gray-800 dark:text-gray-200",children:K}):c.jsx("span",{"aria-hidden":!0,className:"w-24 rounded-md bg-gray-300 p-2 dark:bg-slate-600"})}})}),c.jsx(Me,{type:"status",children:c.jsx(y,{id:"B9VwbO"})})]})}function Ur({valid:e,hasValue:t,children:n,className:r,...i}){const{i18n:s,_:a}=D();return c.jsxs("div",{...i,className:G("flex flex-row items-center gap-2",r),children:[t?c.jsx(c.Fragment,{children:e?c.jsx(Ct,{className:"text-success inline-block h-4 w-4",title:s._({id:"nfagfM"})}):c.jsx(Zs,{className:"text-error inline-block h-4 w-4",title:s._({id:"JHB/Ky"})})}):c.jsx("div",{"aria-hidden":!0,className:"flex h-4 w-4 items-center justify-center",children:c.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-300 dark:bg-slate-600"})}),c.jsx("div",{className:"text-sm",children:n})]})}function J(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _n(e,t){return _n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},_n(e,t)}function ho(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,_n(e,t)}var Ai=Object.defineProperty,fo=Object.defineProperties,_o=Object.getOwnPropertyDescriptors,Ut=Object.getOwnPropertySymbols,Li=Object.prototype.hasOwnProperty,Gi=Object.prototype.propertyIsEnumerable,$r=(e,t,n)=>t in e?Ai(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,m=(e,t)=>{for(var n in t||(t={}))Li.call(t,n)&&$r(e,n,t[n]);if(Ut)for(var n of Ut(t))Gi.call(t,n)&&$r(e,n,t[n]);return e},k=(e,t)=>fo(e,_o(t)),mo=(e,t)=>{var n={};for(var r in e)Li.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ut)for(var r of Ut(e))t.indexOf(r)<0&&Gi.call(e,r)&&(n[r]=e[r]);return n},Yi=(e,t)=>{for(var n in t)Ai(e,n,{get:t[n],enumerable:!0})},Hn=(e,t,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(u){i(u)}},a=l=>{try{o(n.throw(l))}catch(u){i(u)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(e,t)).next())});function go(e){return Object.entries(e).filter(([,t])=>t||t===!1).map(([t,n])=>`${encodeURIComponent(t)}=${encodeURIComponent(String(n))}`).join("&")}function Mi(e){let t=e&&e.ownerDocument||document,n=t.defaultView||t.parentWindow||window;return{document:t,window:n}}function qi(e){return e||document.head}var yo="hCaptcha-script",Dt="hCaptchaOnLoad",mn="script-error",Oe="@hCaptcha/loader",Hi=Object.prototype.toString;function Fi(e){switch(Hi.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return de(e,Error)}}function ze(e,t){return Hi.call(e)===`[object ${t}]`}function Fn(e){return ze(e,"ErrorEvent")}function Ar(e){return ze(e,"DOMError")}function vo(e){return ze(e,"DOMException")}function _e(e){return ze(e,"String")}function zi(e){return e===null||typeof e!="object"&&typeof e!="function"}function $e(e){return ze(e,"Object")}function Mt(e){return typeof Event<"u"&&de(e,Event)}function xo(e){return typeof Element<"u"&&de(e,Element)}function bo(e){return ze(e,"RegExp")}function zn(e){return!!(e&&e.then&&typeof e.then=="function")}function So(e){return $e(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function Vi(e){return typeof e=="number"&&e!==e}function de(e,t){try{return e instanceof t}catch{return!1}}function Wi(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue))}function Be(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Lr(e,t){if(!Array.isArray(e))return"";let n=[];for(let r=0;r<e.length;r++){let i=e[r];try{Wi(i)?n.push("[VueViewModel]"):n.push(String(i))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function Eo(e,t,n=!1){return _e(e)?bo(t)?t.test(e):_e(t)?n?e===t:e.includes(t):!1:!1}function ct(e,t=[],n=!1){return t.some(r=>Eo(e,r,n))}function To(e,t,n=250,r,i,s,a){if(!s.exception||!s.exception.values||!a||!de(a.originalException,Error))return;let o=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;o&&(s.exception.values=jo(gn(e,t,i,a.originalException,r,s.exception.values,o,0),n))}function gn(e,t,n,r,i,s,a,o){if(s.length>=n+1)return s;let l=[...s];if(de(r[i],Error)){Gr(a,o);let u=e(t,r[i]),d=l.length;Yr(u,i,d,o),l=gn(e,t,n,r[i],i,[u,...l],u,d)}return Array.isArray(r.errors)&&r.errors.forEach((u,d)=>{if(de(u,Error)){Gr(a,o);let p=e(t,u),f=l.length;Yr(p,`errors[${d}]`,f,o),l=gn(e,t,n,u,i,[p,...l],p,f)}}),l}function Gr(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism=k(m({},e.mechanism),{is_exception_group:!0,exception_id:t})}function Yr(e,t,n,r){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism=k(m({},e.mechanism),{type:"chained",source:t,exception_id:n,parent_id:r})}function jo(e,t){return e.map(n=>(n.value&&(n.value=Be(n.value,t)),n))}function vt(e){return e&&e.Math==Math?e:void 0}var $=typeof globalThis=="object"&&vt(globalThis)||typeof window=="object"&&vt(window)||typeof self=="object"&&vt(self)||typeof global=="object"&&vt(global)||function(){return this}()||{};function lt(){return $}function Ki(e,t,n){let r=n||$,i=r.__SENTRY__=r.__SENTRY__||{};return i[e]||(i[e]=t())}var It=lt(),wo=80;function Ae(e,t={}){try{let n=e,r=5,i=[],s=0,a=0,o=" > ",l=o.length,u,d=Array.isArray(t)?t:t.keyAttrs,p=!Array.isArray(t)&&t.maxStringLength||wo;for(;n&&s++<r&&(u=Ro(n,d),!(u==="html"||s>1&&a+i.length*l+u.length>=p));)i.push(u),a+=u.length,n=n.parentNode;return i.reverse().join(o)}catch{return"<unknown>"}}function Ro(e,t){let n=e,r=[],i,s,a,o,l;if(!n||!n.tagName)return"";r.push(n.tagName.toLowerCase());let u=t&&t.length?t.filter(p=>n.getAttribute(p)).map(p=>[p,n.getAttribute(p)]):null;if(u&&u.length)u.forEach(p=>{r.push(`[${p[0]}="${p[1]}"]`)});else if(n.id&&r.push(`#${n.id}`),i=n.className,i&&_e(i))for(s=i.split(/\s+/),l=0;l<s.length;l++)r.push(`.${s[l]}`);let d=["aria-label","type","name","title","alt"];for(l=0;l<d.length;l++)a=d[l],o=n.getAttribute(a),o&&r.push(`[${a}="${o}"]`);return r.join("")}function No(){try{return It.document.location.href}catch{return""}}function ko(e){return It.document&&It.document.querySelector?It.document.querySelector(e):null}var Co="Sentry Logger ",yn=["debug","info","warn","error","log","assert","trace"],$t={};function Xi(e){if(!("console"in $))return e();let t=$.console,n={},r=Object.keys($t);r.forEach(i=>{let s=$t[i];n[i]=t[i],t[i]=s});try{return e()}finally{r.forEach(i=>{t[i]=n[i]})}}function Do(){let e=!1,t={enable:()=>{e=!0},disable:()=>{e=!1}};return typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__?yn.forEach(n=>{t[n]=(...r)=>{e&&Xi(()=>{$.console[n](`${Co}[${n}]:`,...r)})}}):yn.forEach(n=>{t[n]=()=>{}}),t}var x=Do(),Io=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Oo(e){return e==="http"||e==="https"}function qt(e,t=!1){let{host:n,path:r,pass:i,port:s,projectId:a,protocol:o,publicKey:l}=e;return`${o}://${l}${t&&i?`:${i}`:""}@${n}${s?`:${s}`:""}/${r&&`${r}/`}${a}`}function Po(e){let t=Io.exec(e);if(!t){console.error(`Invalid Sentry Dsn: ${e}`);return}let[n,r,i="",s,a="",o]=t.slice(1),l="",u=o,d=u.split("/");if(d.length>1&&(l=d.slice(0,-1).join("/"),u=d.pop()),u){let p=u.match(/^\d+/);p&&(u=p[0])}return Ji({host:s,pass:i,path:l,projectId:u,port:a,protocol:n,publicKey:r})}function Ji(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Bo(e){if(!(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__))return!0;let{port:t,projectId:n,protocol:r}=e;return["protocol","publicKey","host","projectId"].find(i=>e[i]?!1:(x.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:n.match(/^\d+$/)?Oo(r)?t&&isNaN(parseInt(t,10))?(x.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(x.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(x.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Uo(e){let t=typeof e=="string"?Po(e):Ji(e);if(!(!t||!Bo(t)))return t}var ie=class extends Error{constructor(e,t="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=t}};function M(e,t,n){if(!(t in e))return;let r=e[t],i=n(r);typeof i=="function"&&Zi(i,r),e[t]=i}function Vn(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Zi(e,t){try{let n=t.prototype||{};e.prototype=t.prototype=n,Vn(e,"__sentry_original__",t)}catch{}}function Wn(e){return e.__sentry_original__}function $o(e){return Object.keys(e).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&")}function Qi(e){if(Fi(e))return m({message:e.message,name:e.name,stack:e.stack},qr(e));if(Mt(e)){let t=m({type:e.type,target:Mr(e.target),currentTarget:Mr(e.currentTarget)},qr(e));return typeof CustomEvent<"u"&&de(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function Mr(e){try{return xo(e)?Ae(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function qr(e){if(typeof e=="object"&&e!==null){let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}else return{}}function Ao(e,t=40){let n=Object.keys(Qi(e));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=t)return Be(n[0],t);for(let r=n.length;r>0;r--){let i=n.slice(0,r).join(", ");if(!(i.length>t))return r===n.length?i:Be(i,t)}return""}function fe(e){return vn(e,new Map)}function vn(e,t){if($e(e)){let n=t.get(e);if(n!==void 0)return n;let r={};t.set(e,r);for(let i of Object.keys(e))typeof e[i]<"u"&&(r[i]=vn(e[i],t));return r}if(Array.isArray(e)){let n=t.get(e);if(n!==void 0)return n;let r=[];return t.set(e,r),e.forEach(i=>{r.push(vn(i,t))}),r}return e}var es=50,Hr=/\(error: (.*)\)/,Fr=/captureMessage|captureException/;function Lo(...e){let t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0)=>{let i=[],s=n.split(`
|
|
1
|
+
var Os=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);import{r as _,j as c,c as G,L as Ps,A as Bs,u as D,U as Us,C as $s,a as at,b as Me,T as y,E as As,d as ot,e as Ls,B as Gs,f as Ys,I as Ms,V as qs,P as Hs,N as dr,g as pr,h as Ct,i as Fs,k as zs,l as Vs,m as Ws,n as Si,S as Ks,o as Xs,p as Js,q as hr,s as fr,X as Zs,t as Qs,v as ea,w as ta,x as na}from"./error-view-DUrzON7u.js";var bd=Os((Td,Is)=>{const Ei=_.createContext(null),Zt={didCatch:!1,error:null};class ra extends _.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Zt}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:s,reason:"imperative-api"}),this.setState(Zt)}}componentDidCatch(t,n){var r,i;(r=(i=this.props).onError)===null||r===void 0||r.call(i,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:i}=this.props;if(r&&n.error!==null&&ia(t.resetKeys,i)){var s,a;(s=(a=this.props).onReset)===null||s===void 0||s.call(a,{next:i,prev:t.resetKeys,reason:"keys"}),this.setState(Zt)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:i}=this.props,{didCatch:s,error:a}=this.state;let o=t;if(s){const l={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")o=n(l);else if(r)o=_.createElement(r,l);else if(i!==void 0)o=i;else throw a}return _.createElement(Ei.Provider,{value:{didCatch:s,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}}function ia(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}function sa(e){if(e==null||typeof e.didCatch!="boolean"||typeof e.resetErrorBoundary!="function")throw new Error("ErrorBoundaryContext not found")}function aa(){const e=_.useContext(Ei);sa(e);const[t,n]=_.useState({error:null,hasError:!1}),r=_.useMemo(()=>({resetBoundary:()=>{e.resetErrorBoundary(),n({error:null,hasError:!1})},showBoundary:i=>n({error:i,hasError:!0})}),[e.resetErrorBoundary]);if(t.hasError)throw t.error;return r}function ee({customizationData:e,title:t,subtitle:n,htmlTitle:r=typeof t=="string"?t:void 0,className:i,children:s,...a}){return c.jsxs("div",{...a,className:G(i,"flex flex-col items-center","md:flex md:flex-row md:items-center md:justify-stretch","min-w-screen min-h-screen","bg-white text-slate-900","dark:bg-slate-900 dark:text-slate-100"),children:[r&&c.jsx("title",{children:r}),c.jsxs("div",{className:G("px-6 pt-4","w-full","md:max-w-lg","flex flex-row items-start","md:flex-col md:items-end","md:self-stretch","md:max-w-fix md:w-1/2 md:p-4","md:text-right","md:dark:border-r md:dark:border-slate-700","md:bg-slate-100 md:dark:bg-slate-800"),children:[c.jsxs("div",{className:"grid grow content-center md:justify-items-end",children:[t&&c.jsx("h1",{className:"text-primary text-xl font-semibold md:my-4 md:text-2xl lg:text-5xl",children:t},"title"),n&&c.jsx("p",{className:"hidden max-w-xs text-slate-600 md:block dark:text-slate-400",children:n},"subtitle")]}),c.jsx(Ps,{className:"m-1 md:m-2"},"localeSelector")]}),c.jsx("main",{className:"w-full p-6 md:max-w-3xl md:px-12",children:s})]})}function oa(e,t,n){if(!e)return[t];const r=e.findIndex(n);return r===-1?[...e,t]:[...e.slice(0,r),t,...e.slice(r+1)]}function ve(e,t){const{showBoundary:n}=aa();return _.useCallback(async(...r)=>{try{return await e(...r)}catch(i){throw i instanceof Us&&n(i),i}},t.concat(n))}function ca({sessions:e=[],onRedirected:t}){const[n]=_.useState(()=>new Bs),[r,i]=_.useState(e),{i18n:s,_:a}=D(),{locale:o}=s,l=_.useCallback(S=>{i(E=>{var w;return S===(((w=E.find(j=>j.selected))==null?void 0:w.account.sub)||null)?E:E.map(j=>({...j,selected:j.account.sub===S}))})},[i]),u=_.useCallback(({account:S,ephemeralToken:E,consentRequired:w=!0,selected:j=!0,loginRequired:C=!1})=>{const N={account:S,ephemeralToken:E,selected:j,loginRequired:C,consentRequired:w};i(Y=>oa(Y,N,P=>P.account.sub===S.sub).map(P=>!j||P===N||!P.selected?P:{...P,selected:!1}))},[i]),d=_.useCallback(S=>{window.location.href=String(S),t&&setTimeout(t)},[t]),p=ve(async(S,E)=>{const w=await n.fetch("POST","/sign-in",{...S,locale:o},{signal:E});u(w)},[n,o,u]),f=ve(async(S,E)=>{await n.fetch("POST","/reset-password-request",{...S,locale:o},{signal:E})},[n,o]),h=ve(async(S,E)=>{await n.fetch("POST","/reset-password-confirm",S,{signal:E})},[n]),g=ve(async(S,E)=>{await n.fetch("POST","/verify-handle-availability",S,{signal:E})},[n]),v=ve(async(S,E)=>{const w=await n.fetch("POST","/sign-up",{...S,locale:o},{signal:E});u(w)},[n,o,u]),b=ve(async(S,E)=>{var C;const w=(C=r.find(N=>N.account.sub===S))==null?void 0:C.ephemeralToken,{url:j}=await n.fetch("POST","/consent",{sub:S,scope:E},{bearer:w});d(j)},[n,r,d]),T=ve(async()=>{const{url:S}=await n.fetch("POST","/reject",{});d(S)},[n,d]);return{sessions:r,selectSub:l,doSignIn:p,doInitiatePasswordReset:f,doConfirmResetPassword:h,doValidateNewHandle:g,doSignUp:v,doConsent:b,doReject:T}}function ke(e,t){return _.useCallback(()=>e(t),[e,t])}function la({clientId:e,clientMetadata:t,clientTrusted:n}){const[r,i]=_.useState(!1),s=n?t.logo_uri:void 0,a=t.client_name||e;return _.useEffect(()=>{i(!1)},[s]),s&&!r?c.jsx("img",{"aria-hidden":!0,src:s,alt:a,className:"-ml-1 size-8",onError:()=>i(!0)}):c.jsx("div",{"aria-hidden":!0,className:"bg-primary flex size-8 items-center justify-center overflow-hidden rounded-full text-white",children:c.jsx($s,{className:"size-4"})})}function z({color:e="grey",transparent:t=!1,loading:n=void 0,shape:r="rounded",children:i,className:s,type:a="button",role:o="Button",disabled:l=!1,...u}){const d=a==="submit"||u.onClick!=null;return c.jsx("button",{role:o,type:a,disabled:l||n===!0,tabIndex:(u==null?void 0:u.tabIndex)??(d?0:-1),...u,className:G("touch-manipulation overflow-hidden","truncate tracking-wide",d?"cursor-pointer":null,r==="circle"?"rounded-full":"rounded-md",r==="circle"?"size-8":null,r==="rounded"?"px-6 py-2":r==="padded"?"p-2":void 0,"focus:outline-none focus:ring-2","transition duration-300 ease-in-out",e==="primary"?G("accent-slate-100","focus:ring-primary focus:ring-offset-1 focus:ring-offset-white dark:focus:ring-offset-black",t?"text-primary bg-transparent":"bg-primary text-primary-contrast"):e==="grey"?G("accent-primary","focus:ring-slate-300 dark:focus:ring-slate-500","text-slate-600 dark:text-slate-300","hover:bg-gray-200 dark:hover:bg-gray-700",t?"bg-transparent":"bg-gray-100 dark:bg-gray-800"):void 0,"disabled:opacity-50",s),children:i})}function ua(e,t){_.useEffect(()=>{const n=r=>{!r.defaultPrevented&&e.current&&!e.current.contains(r.target)&&t(r)};return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[e,t])}function da(e){const t=n=>{n.key==="Escape"&&(n.preventDefault(),e())};_.useEffect(()=>(window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}),[e])}function X({hint:e,image:t,title:n,description:r,append:i,className:s,children:a,...o}){const{i18n:l,_:u}=D(),[d,p]=_.useState(!1),f=_.useCallback(()=>p(!1),[]),h=_.useRef(null);da(f),ua(h,f);const g=a!=null,v=at("details-card-");return c.jsxs("div",{ref:h,className:s,...o,children:[c.jsxs("div",{className:"flex items-center justify-start gap-2",children:[c.jsx("div",{className:"ml-2 flex w-8 flex-grow-0 items-center justify-center","aria-hidden":!0,children:t}),c.jsxs("div",{className:"flex flex-1 flex-col","aria-describedby":g?v:void 0,children:[n&&c.jsx("h3",{children:n}),r&&c.jsx("p",{className:"text-sm",children:r})]}),i&&c.jsx("div",{className:"flex shrink-0 grow-0 items-center justify-center",children:i}),g&&c.jsx(z,{onClick:b=>{b.defaultPrevented||(b.preventDefault(),p(T=>!T))},shape:"circle",title:e??l._({id:"xz9eAw"}),"aria-expanded":d,"aria-label":d?l._({id:"183A6G"}):e??l._({id:"xAo8pm"}),"aria-haspopup":"true","aria-controls":v,children:"?"})]}),g&&c.jsx(Me,{className:"mt-4",hidden:!d,id:v,"aria-hidden":!d,children:a})]})}var xe={},We={},_r;function Bn(){if(_r)return We;_r=1,Object.defineProperty(We,"__esModule",{value:!0}),We.ScopeMissingError=void 0;class e extends Error{get statusCode(){return this.status}constructor(n){super(`Missing required scope "${n}"`),Object.defineProperty(this,"scope",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ScopeMissingError"}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:403}),Object.defineProperty(this,"expose",{enumerable:!0,configurable:!0,writable:!0,value:!0})}}return We.ScopeMissingError=e,We}var Ke={},Qt={},Ce={},en={},Xe={},mr;function pa(){if(mr)return Xe;mr=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.minIdx=e,Xe.toRecord=t;function e(n,r){return n===-1?r:r===-1?n:Math.min(n,r)}function t(n){const r=Object.create(null);for(const[i,s]of n)Object.hasOwn(r,i)?r[i].push(s):r[i]=[s];return r}return Xe}var gr;function ge(){return gr||(gr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ALLOWED_SCOPE_CHARS=e.ResourceSyntax=void 0,e.isScopeForResource=n,e.formatScope=i,e.encodeScope=s,e.encodeScopeComponent=a,e.normalizeScopeComponent=l;const t=pa();function n(u,d){if(!u.startsWith(d))return!1;if(u.length===d.length)return!0;const p=u.charCodeAt(d.length);return p===58||p===63}class r{constructor(d,p,f){Object.defineProperty(this,"resource",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(this,"positional",{enumerable:!0,configurable:!0,writable:!0,value:p}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:f})}is(d){return this.resource===d}containsParamsOtherThan(d){const{params:p}=this;if(p){for(const f of p.keys())if(!d.includes(f))return!0}return!1}getSingle(d,p=!1){const{params:f}=this,h=f!=null&&f.has(d)?f.getAll(d):void 0;return h?h.length!==1||p&&this.positional!==void 0?null:h[0]:p?this.positional:void 0}getMulti(d,p=!1){const{params:f}=this,h=f!=null&&f.has(d)?f.getAll(d):void 0;return h?p&&this.positional!==void 0?null:h:p&&this.positional!==void 0?[this.positional]:void 0}toString(){return s(this.resource,this.positional,this.params)}toJSON(){var d;return{resource:this.resource,positional:this.positional,params:(d=this.params)!=null&&d.size?(0,t.toRecord)(this.params):void 0}}static fromString(d){const p=d.indexOf("?"),f=d.indexOf(":"),h=(0,t.minIdx)(p,f),g=h!==-1?d.slice(0,h):d,v=f!==-1?p===-1?decodeURIComponent(d.slice(f+1)):f<p?decodeURIComponent(d.slice(f+1,p)):void 0:void 0,b=p!==-1?p===d.length-1?void 0:new URLSearchParams(d.slice(p+1)):void 0;return new r(g,v,b)}}e.ResourceSyntax=r;function i(u,d,p){const f=new URLSearchParams;let h;for(const[g,v]of d){if(v===void 0)continue;const b=g===p&&h===void 0;if(typeof v=="string")b?h=v:f.append(g,v);else{if(v.length===0)throw new Error(`Invalid scope: parameter "${g}" cannot be an empty array`);if(b&&v.length===1)h=v[0];else for(const T of v)f.append(g,T)}}return h!==void 0&&f.has(p)&&(f.append(p,h),h=void 0),s(u,h,f)}function s(u,d,p){let f=u;return d!==void 0&&(f+=`:${a(d)}`),p!=null&&p.size&&(f+=`?${l(p.toString())}`),f}e.ALLOWED_SCOPE_CHARS=new Set([":","/","+",",","@","%"]);function a(u){return l(encodeURIComponent(u))}const o=new Map(Array.from(e.ALLOWED_SCOPE_CHARS,u=>[encodeURIComponent(u),u]).filter(([u,d])=>u!==d&&u.length===3&&u.startsWith("%")));function l(u){let d=u.length-2;for(let p=0;p<d;p++)if(u.charCodeAt(p)===37){const f=u.slice(p,p+3),h=o.get(f);h&&(u=`${u.slice(0,p)}${h}${u.slice(p+f.length)}`,p+=h.length-1,d-=f.length-h.length)}return u}}(en)),en}var yr;function qe(){if(yr)return Ce;yr=1,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.Parser=void 0,Ce.knownValuesValidator=r;const e=ge();class t{constructor(s,a,o){Object.defineProperty(this,"resource",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"positionalName",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"schemaKeys",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.schemaKeys=Object.keys(a)}format(s){const a=[];for(const o of this.schemaKeys){const l=s[o];if(l===void 0)continue;const u=this.schema[o],d=u.normalize?u.normalize(l):l;!u.required&&(u.default===d||u.multiple&&u.default&&n(u.default,d))||a.push([o,d])}return(0,e.formatScope)(this.resource,a,this.positionalName)}parse(s){if(!s.is(this.resource)||s.containsParamsOtherThan(this.schemaKeys))return null;const a=Object.create(null);for(const o of this.schemaKeys){const l=this.schema[o],u=l.multiple?s.getMulti(o,o===this.positionalName):s.getSingle(o,o===this.positionalName);if(u===null||u===void 0&&l.required)return null;if(u!==void 0&&l.validate){if(l.multiple){if(!u.every(l.validate))return null}else if(!l.validate(u))return null}a[o]=u??l.default}return a}parseString(s){const a=e.ResourceSyntax.fromString(s);return this.parse(a)}}Ce.Parser=t;function n(i,s){for(const a of i)if(!s.includes(a))return!1;for(const a of s)if(!i.includes(a))return!1;return!0}function r(i){const s=new Set(i);return a=>s.has(a)}return Ce}var vr;function Un(){return vr||(vr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.AccountScope=e.accountParser=void 0;const t=qe(),n=ge(),r=Object.freeze(["email","repo","status"]),i=Object.freeze(["read","manage"]);e.accountParser=new t.Parser("account",{attr:{multiple:!1,required:!0,validate:(0,t.knownValuesValidator)(r)},action:{multiple:!1,required:!1,validate:(0,t.knownValuesValidator)(i),default:"read"}},"attr");class s{constructor(o,l){Object.defineProperty(this,"attr",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"action",{enumerable:!0,configurable:!0,writable:!0,value:l})}matches(o){return this.attr===o.attr&&(this.action==="manage"||this.action===o.action)}toString(){return e.accountParser.format(this)}static fromString(o){if(!(0,n.isScopeForResource)(o,"account"))return null;const l=n.ResourceSyntax.fromString(o);return this.fromSyntax(l)}static fromSyntax(o){const l=e.accountParser.parse(o);return l?new s(l.attr,l.action):null}static scopeNeededFor(o){return e.accountParser.format(o)}}e.AccountScope=s}(Qt)),Qt}var tn={},be={},xr;function Ti(){if(xr)return be;xr=1,Object.defineProperty(be,"__esModule",{value:!0}),be.isMime=t,be.isAccept=n,be.matchesAccept=i,be.matchesAnyAccept=a;function e(o){const l=o.indexOf("/");return!(l===-1||l===0||l===o.length-1||o.includes("/",l+1)||o.includes(" "))}function t(o){return e(o)&&!o.includes("*")}function n(o){return o==="*/*"?!0:e(o)?!o.includes("*")||o.endsWith("/*"):!1}function r(o,l){return o==="*/*"?!0:o.endsWith("/*")?l.startsWith(o.slice(0,-1)):o===l}function i(o,l){return t(l)&&r(o,l)}function s(o,l){for(const u of o)if(r(u,l))return!0;return!1}function a(o,l){return t(l)&&s(o,l)}return be}var br;function $n(){return br||(br=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.BlobScope=e.blobParser=e.DEFAULT_ACCEPT=void 0;const t=Ti(),n=qe(),r=ge();e.DEFAULT_ACCEPT=Object.freeze(["*/*"]),e.blobParser=new n.Parser("blob",{accept:{multiple:!0,required:!0,validate:t.isAccept,normalize:o=>o.includes("*/*")?e.DEFAULT_ACCEPT:o.map(s).filter(a)}},"accept");class i{constructor(l){Object.defineProperty(this,"accept",{enumerable:!0,configurable:!0,writable:!0,value:l})}matches(l){return(0,t.matchesAnyAccept)(this.accept,l.mime)}toString(){return e.blobParser.format(this)}static fromString(l){if(!(0,r.isScopeForResource)(l,"blob"))return null;const u=r.ResourceSyntax.fromString(l);return this.fromSyntax(u)}static fromSyntax(l){const u=e.blobParser.parse(l);return u?new i(u.accept):null}static scopeNeededFor(l){return e.blobParser.format({accept:[l.mime]})}}e.BlobScope=i;function s(o){return o.toLowerCase()}function a(o,l,u){if(o.endsWith("/*"))return!0;const d=o.split("/",1)[0];return!u.includes(`${d}/*`)}}(tn)),tn}var nn={},Sr;function An(){return Sr||(Sr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.IdentityScope=e.identityParser=void 0;const t=qe(),n=ge(),r=Object.freeze(["handle","*"]);e.identityParser=new t.Parser("identity",{attr:{multiple:!1,required:!0,validate:(0,t.knownValuesValidator)(r)}},"attr");class i{constructor(a){Object.defineProperty(this,"attr",{enumerable:!0,configurable:!0,writable:!0,value:a})}matches(a){return this.attr==="*"||this.attr===a.attr}toString(){return e.identityParser.format(this)}static fromString(a){if(!(0,n.isScopeForResource)(a,"identity"))return null;const o=n.ResourceSyntax.fromString(a);return this.fromSyntax(o)}static fromSyntax(a){const o=e.identityParser.parse(a);return o?new i(o.attr):null}static scopeNeededFor(a){return e.identityParser.format(a)}}e.IdentityScope=i}(nn)),nn}var rn={},Je={},Er;function Ln(){if(Er)return Je;Er=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.isNSID=void 0;const e=t=>t.includes(".")&&!t.includes(" ")&&!t.startsWith(".")&&!t.endsWith(".");return Je.isNSID=e,Je}var Tr;function Gn(){return Tr||(Tr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RepoScope=e.repoParser=e.isRepoAction=void 0;const t=Ln(),n=qe(),r=ge(),i=Object.freeze(["create","update","delete"]);e.isRepoAction=(0,n.knownValuesValidator)(i),e.repoParser=new n.Parser("repo",{collection:{multiple:!0,required:!0,validate:o=>o==="*"||(0,t.isNSID)(o),normalize:o=>o.length>1&&o.includes("*")?["*"]:o},action:{multiple:!0,required:!1,validate:e.isRepoAction,default:i}},"collection");class s{constructor(l,u){Object.defineProperty(this,"collection",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"action",{enumerable:!0,configurable:!0,writable:!0,value:u})}get allowsAnyCollection(){return this.collection.includes("*")}matches({action:l,collection:u}){return this.action.includes(l)&&(this.allowsAnyCollection||this.collection.includes(u))}toString(){return e.repoParser.format({collection:this.allowsAnyCollection?["*"]:this.collection.length>1?[...new Set(this.collection)].sort():this.collection,action:this.action===i?i:i.filter(a,this.action)})}static fromString(l){if(!(0,r.isScopeForResource)(l,"repo"))return null;const u=r.ResourceSyntax.fromString(l);return this.fromSyntax(u)}static fromSyntax(l){const u=e.repoParser.parse(l);return u?new s(u.collection,u.action):null}static scopeNeededFor(l){return e.repoParser.format({collection:[l.collection],action:[l.action]})}}e.RepoScope=s;function a(o){return this.includes(o)}}(rn)),rn}var sn={},Ze={},jr;function ji(){if(jr)return Ze;jr=1,Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.isDIDLike=void 0;const e=t=>t.startsWith("did:");return Ze.isDIDLike=e,Ze}var wr;function Yn(){return wr||(wr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RpcScope=e.rpcParser=void 0;const t=ji(),n=Ln(),r=qe(),i=ge(),s=l=>l==="*"||(0,n.isNSID)(l),a=l=>l==="*"||(0,t.isDIDLike)(l);e.rpcParser=new r.Parser("rpc",{lxm:{multiple:!0,required:!0,validate:s},aud:{multiple:!1,required:!0,validate:a}},"lxm");class o{constructor(u,d){Object.defineProperty(this,"aud",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"lxm",{enumerable:!0,configurable:!0,writable:!0,value:d})}matches(u){const{aud:d,lxm:p}=this;return(d==="*"||d===u.aud)&&(p.includes("*")||p.includes(u.lxm))}toString(){const{lxm:u,aud:d}=this;return e.rpcParser.format({aud:d,lxm:u.includes("*")?["*"]:[...new Set(u)].sort()})}static fromString(u){if(!(0,i.isScopeForResource)(u,"rpc"))return null;const d=i.ResourceSyntax.fromString(u);return this.fromSyntax(d)}static fromSyntax(u){const d=e.rpcParser.parse(u);return!d||d.aud==="*"&&d.lxm.includes("*")?null:new o(d.aud,d.lxm)}static scopeNeededFor(u){return e.rpcParser.format({aud:u.aud,lxm:[u.lxm]})}}e.RpcScope=o}(sn)),sn}var an={},Se={},Rr;function wi(){if(Rr)return Se;Rr=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.isValidAtprotoOauthScope=a,Se.parseScope=o,Se.scopeNeededFor=l,Se.scopeMatches=u;const e=Un(),t=$n(),n=An(),r=Gn(),i=Yn(),s=ge();function a(d){if(d==="atproto"||d==="transition:email"||d==="transition:generic"||d==="transition:chat.bsky")return!0;const p=s.ResourceSyntax.fromString(d);return p.resource==="repo"?r.RepoScope.fromSyntax(p)!=null:p.resource==="rpc"?i.RpcScope.fromSyntax(p)!=null:p.resource==="account"?e.AccountScope.fromSyntax(p)!=null:p.resource==="identity"?n.IdentityScope.fromSyntax(p)!=null:p.resource==="blob"?t.BlobScope.fromSyntax(p)!=null:!1}function o(d){const p=s.ResourceSyntax.fromString(d);return p.is("account")?e.AccountScope.fromSyntax(p):p.is("identity")?n.IdentityScope.fromSyntax(p):p.is("repo")?r.RepoScope.fromSyntax(p):p.is("rpc")?i.RpcScope.fromSyntax(p):p.is("blob")?t.BlobScope.fromSyntax(p):null}function l(d,p){switch(d){case"account":return e.AccountScope.scopeNeededFor(p);case"identity":return n.IdentityScope.scopeNeededFor(p);case"repo":return r.RepoScope.scopeNeededFor(p);case"rpc":return i.RpcScope.scopeNeededFor(p);case"blob":return t.BlobScope.scopeNeededFor(p)}}function u(d,p,f){if(!(0,s.isScopeForResource)(d,p))return!1;if(p==="rpc"){const h=i.RpcScope.fromString(d);if(h!=null&&h.matches(f))return!0}else if(p==="account"){const h=e.AccountScope.fromString(d);if(h!=null&&h.matches(f))return!0}else if(p==="identity"){const h=n.IdentityScope.fromString(d);if(h!=null&&h.matches(f))return!0}else if(p==="repo"){const h=r.RepoScope.fromString(d);if(h!=null&&h.matches(f))return!0}else if(p==="blob"){const h=t.BlobScope.fromString(d);if(h!=null&&h.matches(f))return!0}return!1}return Se}var Nr;function Ri(){return Nr||(Nr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ScopesSet=e.ScopeMissingError=void 0;const t=Bn();Object.defineProperty(e,"ScopeMissingError",{enumerable:!0,get:function(){return t.ScopeMissingError}});const n=wi();class r extends Set{matches(s,a){for(const o of this)if((0,n.scopeMatches)(o,s,a))return!0;return!1}assert(s,a){if(!this.matches(s,a)){const o=(0,n.scopeNeededFor)(s,a);throw new t.ScopeMissingError(o)}}some(s){for(const a of this)if(s(a))return!0;return!1}every(s){for(const a of this)if(!s(a))return!1;return!0}*filter(s){for(const a of this)s(a)&&(yield a)}*map(s){for(const a of this)yield s(a)}static fromString(s){return new r(s==null?void 0:s.split(" "))}}e.ScopesSet=r}(an)),an}var kr;function Ni(){if(kr)return Ke;kr=1,Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.PermissionSet=void 0;const e=Un(),t=$n(),n=An(),r=Gn(),i=Yn(),s=Bn(),a=Ri();class o{constructor(u){Object.defineProperty(this,"scopes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.scopes=new a.ScopesSet(typeof u=="string"?u.split(" "):u)}allowsAccount(u){return this.scopes.matches("account",u)}assertAccount(u){if(!this.allowsAccount(u)){const d=e.AccountScope.scopeNeededFor(u);throw new s.ScopeMissingError(d)}}allowsIdentity(u){return this.scopes.matches("identity",u)}assertIdentity(u){if(!this.allowsIdentity(u)){const d=n.IdentityScope.scopeNeededFor(u);throw new s.ScopeMissingError(d)}}allowsBlob(u){return this.scopes.matches("blob",u)}assertBlob(u){if(!this.allowsBlob(u)){const d=t.BlobScope.scopeNeededFor(u);throw new s.ScopeMissingError(d)}}allowsRepo(u){return this.scopes.matches("repo",u)}assertRepo(u){if(!this.allowsRepo(u)){const d=r.RepoScope.scopeNeededFor(u);throw new s.ScopeMissingError(d)}}allowsRpc(u){return this.scopes.matches("rpc",u)}assertRpc(u){if(!this.allowsRpc(u)){const d=i.RpcScope.scopeNeededFor(u);throw new s.ScopeMissingError(d)}}}return Ke.PermissionSet=o,Ke}var Qe={},Cr;function ha(){if(Cr)return Qe;Cr=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.PermissionSetTransition=void 0;const e=Ni();class t extends e.PermissionSet{get hasTransitionGeneric(){return this.scopes.has("transition:generic")}get hasTransitionEmail(){return this.scopes.has("transition:email")}get hasTransitionChatBsky(){return this.scopes.has("transition:chat.bsky")}allowsAccount(r){return r.attr==="email"&&r.action==="read"&&this.hasTransitionEmail?!0:super.allowsAccount(r)}allowsBlob(r){return this.hasTransitionGeneric?!0:super.allowsBlob(r)}allowsRepo(r){return this.hasTransitionGeneric?!0:super.allowsRepo(r)}allowsRpc(r){const{lxm:i}=r;return this.hasTransitionGeneric&&i==="*"||this.hasTransitionGeneric&&!i.startsWith("chat.bsky.")||this.hasTransitionChatBsky&&i.startsWith("chat.bsky.")?!0:super.allowsRpc(r)}}return Qe.PermissionSetTransition=t,Qe}var Dr;function fa(){return Dr||(Dr=1,function(e){var t=xe&&xe.__createBinding||(Object.create?function(r,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(r,a,o)}:function(r,i,s,a){a===void 0&&(a=s),r[a]=i[s]}),n=xe&&xe.__exportStar||function(r,i){for(var s in r)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,r,s)};Object.defineProperty(e,"__esModule",{value:!0}),n(Bn(),e),n(Ni(),e),n(ha(),e),n(Ri(),e),n(qe(),e),n(ge(),e),n(wi(),e),n(Un(),e),n($n(),e),n(An(),e),n(Gn(),e),n(Yn(),e),n(Ti(),e),n(ji(),e),n(Ln(),e)}(xe)),xe}var V=fa();const Mn=_.forwardRef(({className:e,invalid:t,disabled:n,...r},i)=>c.jsx("input",{...r,type:"checkbox",ref:i,disabled:n,className:G(["block size-4 rounded-md border-2 focus:shadow-sm focus:outline-none","border-contrast-200 focus:border-primary-500 focus:bg-contrast-25 dark:focus:bg-contrast-50 focus:shadow-primary-600/30",t&&"border-error-300 text-error-900 placeholder-error-300 focus:border-error-500",n&&"bg-contrast-50 text-contrast-500 cursor-not-allowed",e])}));Mn.displayName="Checkbox";function _a({scope:e,clientTrusted:t=!1,clientFirstParty:n=!1,allowEmail:r,onAllowEmail:i,className:s="",...a}){const o=_.useMemo(()=>new V.PermissionSetTransition(e),[e]),l=!xa(o);return o.scopes.size===0||o.scopes.size===1&&o.scopes.has("atproto")?null:c.jsxs("div",{className:`flex flex-col gap-2 ${s}`,...a,role:"list",children:[c.jsx(ga,{permissions:o,allowEmail:r,onAllowEmail:i}),c.jsx(Ea,{permissions:o}),c.jsx(va,{permissions:o}),c.jsx(ba,{permissions:o}),c.jsx(Sa,{permissions:o}),l&&c.jsxs(c.Fragment,{children:[c.jsx(ya,{permissions:o}),c.jsx(wa,{permissions:o}),c.jsx(Ta,{permissions:o})]}),(!n||!t)&&c.jsx(ma,{className:"mt-2",permissions:o})]})}function ma({permissions:e,type:t="alert",prominent:n=!0,...r}){return _.useMemo(()=>e.allowsIdentity({attr:"*"}),[e])?c.jsx(Me,{...r,type:t,prominent:n,children:c.jsx(y,{id:"zb3TS0",components:{0:c.jsx("b",{}),1:c.jsx("b",{})}})}):null}function ga({permissions:e,allowEmail:t,onAllowEmail:n}){const{i18n:r,_:i}=D(),s=_.useMemo(()=>["manage","read"].find(a=>e.allowsAccount({attr:"email",action:a})),[e]);return s?c.jsx("label",{className:n?"cursor-pointer":void 0,children:c.jsx(X,{role:"listitem",image:c.jsx(As,{className:"size-6"}),title:r._({id:"O3oNi5"}),description:s==="manage"?c.jsx(y,{id:"FLm/n9"}):c.jsx(y,{id:"fEvm25"}),append:n&&c.jsx(Mn,{className:"m-2",checked:t,onChange:a=>n(a.target.checked)})})}):null}function ya({permissions:e}){const{i18n:t,_:n}=D(),r=_.useMemo(()=>e.hasTransitionGeneric||e.scopes.some(a=>V.RepoScope.fromString(a)!=null),[e]),i=_.useMemo(()=>e.hasTransitionGeneric?[new V.BlobScope(["*/*"])]:Array.from(e.scopes.map(a=>V.BlobScope.fromString(a))).filter(a=>a!=null),[e]),s=_.useMemo(()=>{const a=i.some(l=>l.accept.includes("*/*")),o={images:a,videos:a,audio:a,other:a};if(!a)for(const l of i)for(const u of l.accept)u.startsWith("image/")?o.images=!0:u.startsWith("video/")?o.videos=!0:u.startsWith("audio/")?o.audio=!0:o.other=!0;return o},[i]);return!r||i.length===0?null:s.images&&!s.videos&&!s.audio&&!s.other?c.jsx(X,{role:"listitem",image:c.jsx(Ms,{className:"size-6"}),title:t._({id:"BrrIs8"}),description:t._({id:"Pqo+0V"})}):!s.images&&s.videos&&!s.audio&&!s.other?c.jsx(X,{role:"listitem",image:c.jsx(qs,{className:"size-6"}),title:t._({id:"BrrIs8"}),description:t._({id:"BawXMM"})}):c.jsx(X,{role:"listitem",image:c.jsx(Hs,{className:"size-6"}),title:t._({id:"BrrIs8"}),description:t._({id:"sCtyHQ"})})}function va({permissions:e}){const{i18n:t,_:n}=D();return e.allowsAccount({attr:"status",action:"manage"})?c.jsx(X,{role:"listitem",image:c.jsx(Ls,{className:"size-6"}),title:t._({id:"AeXO77"}),description:t._({id:"NKHn7N"})}):null}function xa(e){return _.useMemo(()=>{if(e.allowsAccount({attr:"repo",action:"manage"}))return!1;let t=!1;for(const n of e.scopes){const r=V.RpcScope.fromString(n);if(r){if(t=!0,ki(r.aud)||r.lxm.every(fn))continue;return!1}const i=V.RepoScope.fromString(n);if(i){if(t=!0,i.collection.every(fn))continue;return!1}}return t},[e])}function ba({permissions:e}){const t=_.useMemo(()=>e.scopes.some(Ca),[e]),n=_.useMemo(()=>e.scopes.some(Da),[e]);return t||n?c.jsx(X,{role:"listitem",image:c.jsx(Gs,{className:"size-6"}),title:"Bluesky",description:t&&n?c.jsx(y,{id:"0ZqxWk"}):c.jsx(y,{id:"YRqkn2"})}):null}function Sa({permissions:e}){const{i18n:t,_:n}=D();return _.useMemo(()=>e.hasTransitionChatBsky||e.scopes.some(ka),[e])?c.jsx(X,{role:"listitem",image:c.jsx(Ys,{className:"size-6"}),title:t._({id:"AHZflp"}),description:t._({id:"yZDyOS"})}):null}function Ea({permissions:e}){const{i18n:t,_:n}=D(),r=_.useMemo(()=>e.allowsIdentity({attr:"*"})?"*":e.allowsIdentity({attr:"handle"})?"handle":null,[e]);return r?c.jsx(X,{role:"listitem",image:c.jsx(ot,{className:"h-6"}),title:t._({id:"ePYQjq"}),description:r==="*"?c.jsx(y,{id:"hqGoYC",components:{0:c.jsx("b",{}),1:c.jsx("b",{})}}):c.jsx(y,{id:"lbjZdy",components:{0:c.jsx("b",{})}})}):null}function Ta({permissions:e}){const{i18n:t,_:n}=D();return e.hasTransitionGeneric?c.jsx(X,{role:"listitem",image:c.jsx(pr,{className:"size-6"}),title:t._({id:"OX6vme"}),description:c.jsx(y,{id:"17SnJo",components:{0:c.jsx("b",{})}}),children:c.jsx("p",{children:c.jsx(Ir,{})})}):e.scopes.some(r=>V.RpcScope.fromString(r)!=null)?c.jsxs(X,{role:"listitem",image:c.jsx(pr,{className:"size-6"}),title:t._({id:"OX6vme"}),description:t._({id:"RZlEhS"}),children:[c.jsx("p",{children:c.jsx(Ir,{})}),c.jsx("p",{className:"mt-1",children:c.jsx(y,{id:"rBUDH4"})}),c.jsx(ja,{className:"mt-2",permissions:e})]}):null}function Ir(){return c.jsx(y,{id:"sVs8xu"})}function ja({permissions:e,className:t="",...n}){const{i18n:r,_:i}=D(),s=_.useMemo(()=>{const a=new Map;for(const o of e.scopes){const l=V.RpcScope.fromString(o);if(!l)continue;let u=a.get(l.aud);u||a.set(l.aud,u=new Set);for(const d of l.lxm)u.add(d)}return Array.from(a.entries()).sort(([o],[l])=>o.localeCompare(l)).map(([o,l])=>[o,Array.from(l).sort((u,d)=>u.localeCompare(d))])},[e]);return c.jsxs("table",{className:`w-full table-auto ${t}`,...n,children:[c.jsx("thead",{children:c.jsxs("tr",{className:"text-sm",children:[c.jsx("th",{className:"text-left font-normal",children:r._({id:"T3bXxK"})}),c.jsx("th",{className:"text-left font-normal",children:r._({id:"ZiFCSO"})})]})}),c.jsx("tbody",{children:s.map(([a,o])=>c.jsxs("tr",{className:"text-sm",children:[c.jsx("td",{className:"align-top text-slate-500",children:a==="*"?c.jsx("em",{children:r._({id:"UuQciw"})}):c.jsx("code",{children:a})}),c.jsx("td",{className:"text-slate-500",children:o.includes("*")?c.jsx("em",{children:r._({id:"P5xSNt"})}):o.map(l=>c.jsx("code",{className:"block",children:l},l))})]},a))})]})}function wa({permissions:e}){const{i18n:t,_:n}=D();return e.hasTransitionGeneric||e.allowsAccount({attr:"repo",action:"manage"})||e.allowsRepo({collection:"*",action:"create"})&&e.allowsRepo({collection:"*",action:"delete"})&&e.allowsRepo({collection:"*",action:"update"})?c.jsxs(X,{role:"listitem",image:c.jsx(dr,{className:"size-6"}),title:t._({id:"IreQBq"}),description:t._({id:"NnNRWU"}),children:[c.jsx("p",{children:c.jsx(Or,{})}),c.jsx("p",{className:"mt-1",children:c.jsx(y,{id:"AtArvR",components:{0:c.jsx("b",{})}})})]}):e.scopes.some(r=>V.RepoScope.fromString(r)!=null)?c.jsxs(X,{role:"listitem",image:c.jsx(dr,{className:"size-6"}),title:t._({id:"IreQBq"}),description:t._({id:"xs63gu"}),children:[c.jsx("p",{children:c.jsx(Or,{})}),c.jsx("p",{className:"mt-1",children:c.jsx(y,{id:"RO+zdy"})}),c.jsx(Ra,{className:"mt-2",permissions:e})]}):null}function Or(){return c.jsx(y,{id:"Gmgygg"})}function Ra({permissions:e,className:t,...n}){const{i18n:r,_:i}=D(),s=_.useMemo(()=>{const l=new Map;for(const u of e.scopes){const d=V.RepoScope.fromString(u);if(d)for(const p of d.collection)if(l.has(p)){const f=l.get(p);for(const h of d.action)f[h]=!0}else l.set(p,{create:d.action.includes("create"),update:d.action.includes("update"),delete:d.action.includes("delete")})}return l},[e]),a=s.get("*"),o=_.useMemo(()=>Array.from(s.entries()).sort(([l],[u])=>l.localeCompare(u)),[s]);return c.jsxs("table",{className:`w-full table-auto text-left ${t}`,...n,children:[c.jsx("thead",{children:c.jsxs("tr",{className:"text-sm",children:[c.jsx("th",{className:"font-normal",children:r._({id:"q+hNag"})}),c.jsx("th",{className:"text-center font-normal",children:r._({id:"hYgDIe"})}),c.jsx("th",{className:"text-center font-normal",children:r._({id:"EkH9pt"})}),c.jsx("th",{className:"text-center font-normal",children:r._({id:"cnGeoo"})})]})}),c.jsx("tbody",{children:o.map(([l,u])=>c.jsxs("tr",{className:"text-sm",children:[c.jsx("td",{className:"text-slate-500",children:l==="*"?c.jsx("em",{children:r._({id:"a6yfpg"})}):c.jsx("code",{children:l})}),c.jsx("td",{className:"text-center",children:a!=null&&a.create||u.create?c.jsx(Ct,{className:"inline-block size-4"}):null}),c.jsx("td",{className:"text-center",children:a!=null&&a.update||u.update?c.jsx(Ct,{className:"inline-block size-4"}):null}),c.jsx("td",{className:"text-center",children:a!=null&&a.delete||u.delete?c.jsx(Ct,{className:"inline-block size-4"}):null})]},l))})]})}function ki(e){return e==="did:web:bsky.app#bsky_appview"}function Na(e){return e.startsWith("app.bsky.")}function Ci(e){return e.startsWith("chat.bsky.")}function ka(e){if(e==="transition:chat.bsky")return!0;const t=V.RpcScope.fromString(e);return!t||ki(t.aud)?!1:t.lxm.includes("*")||t.lxm.some(Ci)}function fn(e){return e==="*"?!1:e==="com.atproto.moderation.createReport"||Na(e)||Ci(e)}function Ca(e){if(e==="transition:generic")return!0;const t=V.RepoScope.fromString(e);return t?t.collection.includes("*")||t.collection.some(fn):!1}function Da(e){if(e==="transition:generic")return!0;const t=V.RpcScope.fromString(e);return t?t.lxm.includes("app.bsky.actor.getPreferences")||t.lxm.includes("app.bsky.graph.block")||t.lxm.includes("app.bsky.graph.muteActor")||t.lxm.includes("app.bsky.graph.muteActorList")||t.lxm.includes("app.bsky.graph.muteThread")||t.lxm.includes("app.bsky.graph.unmuteActor")||t.lxm.includes("app.bsky.graph.unmuteActorList")||t.lxm.includes("app.bsky.graph.unmuteThread")||t.lxm.includes("app.bsky.graph.getMutes")||t.lxm.includes("*"):!1}function qn({actions:e,cancel:t,append:n,children:r,prepend:i,disabled:s,inert:a=s,...o}){return c.jsxs("form",{...o,inert:a,className:"flex flex-col gap-4",children:[i&&c.jsx("div",{children:i},"prepend"),c.jsx("div",{className:"space-y-4",children:r},"children"),n&&c.jsx("div",{children:n},"append"),(e||t)&&c.jsxs("div",{className:"flex flex-row-reverse flex-wrap items-center justify-end space-x-2 space-x-reverse",children:[e,c.jsx("div",{className:"flex-auto"}),t]},"buttons")]})}function Pr({account:e,...t}){return c.jsx("b",{...t,children:e.preferred_username||e.email||e.sub})}const Ia=e=>{try{const t=new URL(e);return t.protocol==="https:"&&t.pathname==="/oauth-client-metadata.json"&&!t.port&&!t.search}catch{return!1}};function Oa({url:e,proto:t=!1,host:n=!0,path:r=!1,query:i=!1,hash:s=!1,as:a="span",...o}){const l=_.useMemo(()=>e instanceof URL?e:new URL(e),[e]);return c.jsxs(a,{...o,children:[t&&c.jsx(et,{value:`${l.protocol}//`,...t===!0?null:t}),n&&c.jsx(et,{value:l.host,...n===!0?{faded:!1,bold:!0}:n}),r&&c.jsx(et,{value:l.pathname,...r===!0?null:r}),i&&c.jsx(et,{value:l.search,...i===!0?null:i}),s&&c.jsx(et,{value:l.hash,...s===!0?null:s})]})}function et({value:e,faded:t=!0,bold:n=!1}){const r=n?"b":"span";return c.jsx(r,{className:t?"opacity-50":"",children:e})}function Pa({clientId:e,clientMetadata:t,clientTrusted:n,...r}){const i=_.useMemo(()=>{try{return new URL(e)}catch{return null}},[e]);if(n&&t.client_name)return c.jsx("span",{...r,children:t.client_name});if((i==null?void 0:i.protocol)==="http:")return c.jsx("span",{...r,children:c.jsx(y,{id:"eYNzrj"})});if((i==null?void 0:i.protocol)==="https:"){const s=Ia(e);return c.jsx(Oa,{...r,url:i,proto:!s,host:!0,path:!s,query:!s,hash:!1})}return c.jsx("span",{...r,children:e})}function Ba(e){return e.startsWith("transition:")}function Ua(e){const t=V.AccountScope.fromString(e);return t?t.matches({attr:"email",action:"read"}):!1}function $a(e){return e==null?void 0:e.split(" ").filter(t=>!Ua(t)).join(" ")}function Aa({clientId:e,clientMetadata:t,clientTrusted:n,clientFirstParty:r,account:i,scope:s,onConsent:a,consentLabel:o,onReject:l,rejectLabel:u,onBack:d,backLabel:p,...f}){const{i18n:h,_:g}=D(),[v,b]=_.useState(!0),T=!(s!=null&&s.split(" ").some(Ba));return c.jsxs(qn,{...f,onSubmit:S=>{S.preventDefault();const E=T&&!v?$a(s):s;a(E)},cancel:d&&c.jsx(z,{onClick:d,children:p||c.jsx(y,{id:"iH8pgl"})}),actions:c.jsxs(c.Fragment,{children:[c.jsx(z,{type:"submit",color:"primary",children:o||c.jsx(y,{id:"yIVrHZ"})}),c.jsx(z,{onClick:l,children:u||c.jsx(y,{id:"54JiGG"})})]}),children:[c.jsx(X,{image:c.jsx(la,{clientId:e,clientMetadata:t,clientTrusted:n}),title:c.jsx(Pa,{clientId:e,clientMetadata:t,clientTrusted:n}),description:!s||s==="atproto"?c.jsx(y,{id:"AM8FL/",components:{0:c.jsx(Pr,{account:i})}}):c.jsx(y,{id:"sUabXh",components:{0:c.jsx(Pr,{account:i})}}),hint:h._({id:"69Gavs"}),children:s?c.jsxs(c.Fragment,{children:[c.jsx("p",{children:c.jsx(y,{id:"Poe314"})}),c.jsx("ul",{className:"mt-2",children:s.split(" ").map(S=>c.jsx("li",{children:c.jsx("code",{children:S})},S))})]}):null}),c.jsx(_a,{scope:s,clientTrusted:n,clientFirstParty:r,allowEmail:T?v:!0,onAllowEmail:T?b:void 0}),c.jsx("p",{children:c.jsx(y,{id:"TQzU6E",values:{0:o||c.jsx(y,{id:"yIVrHZ"})},components:{0:c.jsx("b",{}),1:c.jsx("a",{role:"link",href:t.tos_uri,rel:"nofollow noopener",target:"_blank",className:t.tos_uri?"text-primary underline":void 0}),2:c.jsx("a",{role:"link",href:t.policy_uri,rel:"nofollow noopener",target:"_blank",className:t.policy_uri?"text-primary underline":void 0})}})})]})}function La({clientId:e,clientMetadata:t,clientTrusted:n,clientFirstParty:r,account:i,scope:s,onConsent:a,onReject:o,onBack:l,title:u,subtitle:d=c.jsx(y,{id:"QdVx1C",values:{0:i.preferred_username||i.email||i.sub},components:{0:c.jsx("b",{className:"text-slate-800 dark:text-slate-200"})}}),...p}){const{i18n:f,_:h}=D();return c.jsx(ee,{...p,title:u??f._({id:"yIVrHZ"}),subtitle:d,children:c.jsx(Aa,{clientId:e,clientMetadata:t,clientTrusted:n,clientFirstParty:r,account:i,scope:s,onBack:l,onConsent:a,onReject:o})})}const Yt=_.createContext({disabled:!1});Yt.displayName="FieldsetContext";function ue({label:e,children:t,disabled:n,...r}){const i=at({prefix:"fieldset-"}),s=_.useMemo(()=>({disabled:n??!1,labelId:e?i:void 0}),[n,e,i]);return c.jsxs("fieldset",{...r,"aria-labelledby":i,disabled:n,children:[e&&c.jsx("legend",{id:i,className:"mb-1 text-sm font-medium text-slate-600 dark:text-slate-400",children:e},"title"),c.jsx("div",{className:"flex flex-col space-y-4",children:c.jsx(Yt,{value:s,children:t})})]})}function Ga(e,{ref:t,onLoading:n,onError:r}={}){const[i,s]=_.useState(!1),[a,o]=_.useState(),l=_.useCallback(h=>{o(h),r==null||r(h)},[r]),u=_.useCallback(h=>{s(h),n==null||n(h)},[n]),d=_.useRef(null),p=_.useRef(null);_.useEffect(()=>(p.current=()=>{var h;(h=d.current)==null||h.abort(),d.current=null,l(void 0),u(!1)},()=>{p.current=null}),[l,u]),_.useImperativeHandle(t,()=>({reset:()=>{var h;return(h=p.current)==null?void 0:h.call(p)}}),[]),_.useEffect(()=>()=>{var h;(h=d.current)==null||h.abort(),d.current=null},[]);const f=_.useCallback(async()=>{var v;(v=d.current)==null||v.abort(),u(!0),l(void 0);const h=new AbortController,{signal:g}=h;d.current=h;try{await e(g)}catch(b){h===d.current?l(b instanceof Error?b:new Error(String(b))):Ya(g,b)||console.warn("Async action error after abort",b)}finally{h===d.current&&(d.current=null,u(!1)),h.abort()}},[e,u,l]);return{loading:i,error:a,run:f}}function Ya(e,t){return e.aborted&&(e.reason===t||e.reason===(t==null?void 0:t.cause)||t instanceof DOMException&&t.name==="AbortError")}const Ma=({error:e})=>c.jsx(Fs,{error:e});function He({invalid:e,disabled:t,onSubmit:n,submitLabel:r,onCancel:i=void 0,cancelLabel:s,errorRender:a=Ma,ref:o,onLoading:l,onError:u,children:d,...p}){const{run:f,loading:h,error:g}=Ga(n,{ref:o,onError:u,onLoading:l}),v=_.useCallback(b=>{b.preventDefault(),b.currentTarget.reportValidity()&&!t&&!e&&f()},[t,e,f]);return c.jsx(qn,{...p,onSubmit:v,disabled:t||h,prepend:g!=null?a({error:g}):void 0,cancel:i&&c.jsx(z,{onClick:i,children:s||c.jsx(y,{id:"dEgA5A"})}),actions:c.jsx(z,{color:"primary",type:"submit",loading:h,disabled:t,children:r||c.jsx(y,{id:"hQRttt"})}),children:d})}const oe=8,qa=/(\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/,ft=/[A-Z]/,_t=/[a-z]/,mt=/[0-9]/,gt=/[^a-zA-Z0-9]/;var je=function(e){return e[e.weak=1]="weak",e[e.moderate=2]="moderate",e[e.strong=3]="strong",e[e.extra=4]="extra",e}({});function Di(e){return e.length<oe?1:e.length>=oe+12?4:e.length>=oe+8?ae(e,[gt])||ae(e,[ft,_t,mt],2)?4:3:e.length>=oe&&ae(e,[qa])?3:e.length>=oe+6?ae(e,[gt])||ae(e,[ft,_t,mt],2)?3:2:e.length>=oe+4?ae(e,[gt])||ae(e,[ft,_t,mt],2)?2:1:e.length>=oe&&(ae(e,[gt])||ae(e,[ft,_t,mt]))?2:1}function ae(e,t,n=t.length){if(n<1||n>t.length)throw new TypeError("Invalid regexpsCountToMatch");for(const r of t)if(r.test(e)&&(n--,n===0))return!0;return!1}function Ha({password:e,...t}){const{i18n:n,_:r}=D(),i=Di(e);return c.jsx("span",{...t,"aria-label":n._({id:"osAB4a"}),children:i===je.extra?c.jsx(y,{id:"/Ltc/k"}):i===je.strong?c.jsx(y,{id:"LLx/nr"}):i===je.moderate?c.jsx(y,{id:"dvYuhh"}):e?c.jsx(y,{id:"9ls/Vs"}):c.jsx(y,{id:"VU3Nrn"})})}function Fa({password:e,className:t,...n}){const{i18n:r,_:i}=D(),s=e?Di(e):0,a="bg-gray-300 dark:bg-slate-500",o=s===je.extra||s===je.strong?"bg-success":s===je.moderate?"bg-warning":"bg-error";return c.jsx("div",{...n,className:G("flex h-1 w-full space-x-2",t),role:"meter","aria-label":r._({id:"xfNKwI"}),"aria-valuemin":0,"aria-valuemax":je.extra,"aria-valuenow":s,children:Array.from({length:4},(l,u)=>c.jsx("div",{className:`h-1 w-1/4 rounded-sm ${s>u?o:a}`},u))})}function za(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function ye(e){return t=>{for(const n of e)n&&za(n,t)}}function Va({visible:e,toggleVisible:t,onClick:n,...r}){const{i18n:i,_:s}=D();return c.jsx(z,{...r,shape:"padded",onClick:a=>{n==null||n(a),a.defaultPrevented||t()},"aria-label":e?i._({id:"vLyv1R"}):i._({id:"huXYDE"}),children:e?c.jsx(zs,{className:"w-5","aria-hidden":!0}):c.jsx(Vs,{className:"w-5","aria-hidden":!0})})}function Bt({icon:e,append:t,bellow:n,className:r,children:i,onFocus:s,onBlur:a,...o}){const[l,u]=_.useState(!1);return c.jsxs("div",{...o,onFocus:d=>{s==null||s(d),d.defaultPrevented||u(!0)},onBlur:d=>{a==null||a(d),d.defaultPrevented||u(!1)},className:G("min-h-12","max-w-full","overflow-hidden","rounded-lg",r),children:[c.jsxs("div",{className:G("px-1","min-h-12 w-full","flex items-center justify-stretch","rounded-lg",n?"rounded-bl-none rounded-br-none":void 0,"outline-hidden","border-2 border-solid border-transparent","focus:border-primary has-focus:border-primary","hover:border-gray-400 hover:focus:border-gray-400","dark:hover:border-gray-500 dark:hover:focus:border-gray-500","has-focus:bg-slate-200 bg-gray-100 focus:bg-slate-200","dark:has-focus:bg-slate-700 dark:bg-slate-800 dark:focus:bg-slate-700","text-slate-600 dark:text-slate-300","accent-primary"),children:[e&&c.jsx("div",{className:G("flex shrink-0 grow-0 items-center justify-center","mx-1",l?"text-primary":"text-slate-500"),children:e}),i,c.jsx("div",{className:"ml-1 flex shrink-0 grow-0 items-center",children:t})]}),n&&c.jsx("div",{className:G("space-x-2 px-3 py-2","flex flex-row items-center gap-1","rounded-br-2 rounded-bl-2","bg-gray-200 dark:bg-slate-700","text-gray-700 dark:text-gray-300","text-sm italic"),children:n})]})}function Fe({icon:e,append:t,bellow:n,className:r,onFocus:i,onBlur:s,ref:a,disabled:o,title:l,"aria-label":u=l,"aria-labelledby":d,placeholder:p=u,...f}){const h=_.useContext(Yt),g=_.useRef(null),v=_.useRef(!1);return c.jsx(Bt,{icon:e,append:t,bellow:n,className:G("cursor-text",r),tabIndex:-1,onClick:b=>{var T;g.current!==b.target&&(b.preventDefault(),b.stopPropagation(),(T=g.current)==null||T.focus())},onMouseDown:b=>{v.current&&b.target!==g.current&&(b.preventDefault(),b.stopPropagation())},children:c.jsx("input",{...f,disabled:o??h.disabled,title:l,placeholder:p,"aria-label":u,"aria-labelledby":d??h.labelId,ref:ye([a,g]),className:"outline-hidden w-full text-ellipsis bg-transparent bg-clip-padding text-base text-inherit dark:placeholder-gray-500",onFocus:b=>{i==null||i(b),b.defaultPrevented||(v.current=!0)},onBlur:b=>{s==null||s(b),b.defaultPrevented||(v.current=!1)}})})}function Ii({autoHide:e=!0,onBlur:t,onChange:n,append:r,autoComplete:i="current-password",icon:s=c.jsx(Ws,{className:"w-5"}),value:a,defaultValue:o=a,ref:l,title:u,dir:d="auto",autoCapitalize:p="none",autoCorrect:f="off",spellCheck:h="false",...g}){const{i18n:v,_:b}=D(),T=_.useRef(null),[S,E]=_.useState(!1),[w,j]=_.useState(typeof o=="string"?o:""),C=_.useCallback(N=>{n==null||n(N),j(N.target.value)},[n]);return c.jsx(Fe,{...g,title:u??v._({id:"8ZsakT"}),ref:ye([l,T]),dir:d,autoCapitalize:p,autoCorrect:f,spellCheck:h,icon:s,onBlur:e?N=>{t==null||t(N),N.defaultPrevented||E(!1)}:t,value:w,onChange:C,type:S?"text":"password",autoComplete:i,append:c.jsxs(c.Fragment,{children:[c.jsx(Va,{className:"m-1",visible:S,toggleVisible:()=>{var N;E(Y=>!Y),(N=T.current)==null||N.focus()}}),r]})})}function Oi({password:e="",onPassword:t,onChange:n,autoComplete:r="new-password",minLength:i=oe,...s}){const{i18n:a,_:o}=D(),[l,u]=_.useState(e),d=_.useCallback(p=>{const{value:f}=p.target;n==null||n(p),!p.defaultPrevented&&(u(f),t==null||t(p.target.validity.valid?f:void 0))},[n,t]);return c.jsx(Ii,{...s,placeholder:a._({id:"3tOlz6"}),"aria-label":a._({id:"0StR7t"}),title:a._({id:"5CqSPX",values:{MIN_PASSWORD_LENGTH:oe}}),minLength:i,onChange:d,value:l,autoComplete:r,bellow:c.jsxs(c.Fragment,{children:[c.jsx(Fa,{password:l}),c.jsx(Ha,{className:"grow-1 min-w-max text-xs text-gray-500 dark:text-gray-400",password:l})]})})}const Wa="XXXXX-XXXXX";function Pi({example:e=Wa,onToken:t,icon:n=c.jsx(Si,{className:"w-5"}),title:r=e,onChange:i,value:s,defaultValue:a=s,...o}){const{i18n:l,_:u}=D(),[d,p]=_.useState(typeof a=="string"?a:"");return c.jsx(Fe,{...o,type:"text",autoCapitalize:"characters",autoCorrect:"off",autoComplete:"one-time-code",spellCheck:"false",minLength:11,maxLength:11,dir:"auto",icon:n,pattern:"^[A-Z2-7]{5}-[A-Z2-7]{5}$",placeholder:l._({id:"0hTJM+",values:{example:e}}),title:r,value:d,onChange:f=>{const{value:h,selectionEnd:g,selectionStart:v}=f.currentTarget,b=Br(h);f.currentTarget.value=b;const T=g??v;if(T!=null){const S=Br(h.slice(0,T));f.currentTarget.selectionStart=f.currentTarget.selectionEnd=S.length}p(b),i==null||i(f),f.isDefaultPrevented()||t==null||t(b.length===11?b:null)}})}function Br(e){const t=e.toUpperCase().replaceAll(/[^A-Z2-7]/g,"");return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5,10)}`}function Ka({onSubmit:e,invalid:t,...n}){const r=at({prefix:"reset-pwd-email-"}),i=_.useRef(null),[s,a]=_.useState(null),[o,l]=_.useState(void 0);return c.jsxs(He,{...n,onSubmit:u=>{if(s&&o)return e({token:s,password:o},u)},invalid:t||!s||!o,children:[c.jsx(Me,{id:r,type:"status",children:c.jsx(y,{id:"imRJNy"})}),c.jsx(ue,{label:c.jsx(y,{id:"vJgYMA"}),children:c.jsx(Pi,{name:"code","aria-labelledby":r,enterKeyHint:"next",required:!0,autoFocus:!0,onToken:u=>{var d;a(u),u&&((d=i.current)==null||d.focus())}})}),c.jsx(ue,{label:c.jsx(y,{id:"/nT6AE"}),children:c.jsx(Oi,{ref:i,name:"password",enterKeyHint:"done",required:!0,password:o,onPassword:l})})]})}function Bi({onEmail:e,autoCapitalize:t="none",autoComplete:n="email",autoCorrect:r="off",dir:i="auto",icon:s=c.jsx(ot,{className:"w-5"}),onBlur:a,onChange:o,pattern:l="^[^@]+@[^@]+\\.[^@]+$",spellCheck:u="false",value:d,defaultValue:p=d,title:f,...h}){const{i18n:g,_:v}=D(),[b,T]=_.useState(typeof p=="string"?p:""),S=_.useCallback(E=>{const w=E.target.value.toLowerCase();T(w),o==null||o(E),e==null||e(E.target.validity.valid?w:void 0)},[o,e]);return c.jsx(Fe,{...h,title:f??g._({id:"ATGYL1"}),type:"email",autoCapitalize:t,autoCorrect:r,dir:i,spellCheck:u,icon:s,pattern:l,autoComplete:n,value:b,onChange:S,onBlur:a})}function Xa({emailDefault:e,onSubmit:t,invalid:n,ref:r,...i}){const{i18n:s,_:a}=D(),o=at({prefix:"reset-pwd-email-"}),[l,u]=_.useState(e),d=_.useRef(null),p=_.useCallback(f=>{if(l)return t({email:l},f)},[l,t]);return c.jsx(He,{...i,ref:ye([r,d]),invalid:n||!l,onSubmit:p,children:c.jsxs(ue,{label:c.jsx(y,{id:"ATGYL1"}),children:[c.jsx(Bi,{name:"email",placeholder:s._({id:"xRPn3U"}),"aria-labelledby":o,title:s._({id:"ATGYL1"}),required:!0,autoFocus:!0,value:l,onEmail:f=>{var h;(h=d.current)==null||h.reset(),u(f)}}),c.jsx(Me,{type:"status",id:o,children:c.jsx(y,{id:"cHrOqs"})})]})})}function Ja({emailDefault:e,onresetPasswordRequest:t,onResetPasswordConfirm:n,onBack:r,...i}){const{i18n:s,_:a}=D(),[o,l]=_.useState(0);if(o===0)return c.jsxs(ee,{...i,title:i.title||s._({id:"dn8X5t"}),subtitle:i.subtitle||c.jsx(y,{id:"Esfg1M"}),children:[c.jsx(Xa,{emailDefault:e,submitLabel:c.jsx(y,{id:"hXzOVo"}),onSubmit:async(u,d)=>{await t(u,d),d.aborted||l(1)},cancelLabel:c.jsx(y,{id:"iH8pgl"}),onCancel:r}),c.jsx("hr",{className:"my-5 border-gray-300 dark:border-gray-700"}),c.jsx("center",{children:c.jsx(z,{transparent:!0,onClick:()=>l(1),children:c.jsx(y,{id:"FTT4a4"})})})]});if(o===1)return c.jsx(ee,{...i,title:i.title||s._({id:"KbS2K9"}),subtitle:i.subtitle||c.jsx(y,{id:"xg/UcZ"}),children:c.jsx(Ka,{submitLabel:c.jsx(y,{id:"hXzOVo"}),onSubmit:async(u,d)=>{await n(u,d),d.aborted||l(2)},cancelLabel:c.jsx(y,{id:"iH8pgl"}),onCancel:r})});if(o===2)return c.jsx(ee,{...i,title:i.title||s._({id:"fSy6T1"}),subtitle:i.subtitle||c.jsx(y,{id:"+qGdcW"}),children:c.jsxs("center",{children:[c.jsx("h2",{className:"pb-2 text-xl font-bold",children:c.jsx(y,{id:"DKeVgZ"})}),c.jsx("p",{className:"pb-4",children:c.jsx(y,{id:"67nRLM"})}),c.jsx(z,{color:"primary",onClick:r,children:c.jsx(y,{id:"UaXeX3"})})]})});throw new Error(`Invalid view: ${o}`)}function Za({className:e,children:t,id:n,ref:r,disabled:i,title:s,"aria-label":a=s,"aria-labelledby":o,...l}){const u=at("input-checkbox-"),d=_.useRef(null),p=_.useRef(null),f=_.useContext(Yt),h=n??u;return c.jsx(Bt,{className:G("cursor-pointer",e),icon:c.jsx(Mn,{...l,disabled:i??f.disabled,title:s,"aria-label":a,"aria-labelledby":t?void 0:o??f.labelId,ref:ye([r,p]),id:h,className:"accent-primary outline-hidden"}),tabIndex:-1,onClick:({target:g})=>{var v;g!==d.current&&g!==p.current&&((v=p.current)==null||v.click())},children:t&&c.jsx("label",{ref:d,htmlFor:h,className:"block w-full cursor-pointer select-none leading-[1.6]",children:t})})}function yt({usernameDefault:e="",usernameReadonly:t=!1,rememberDefault:n=!1,onSubmit:r,onBack:i,backLabel:s,onForgotPassword:a,ref:o,invalid:l,children:u,...d}){const{i18n:p,_:f}=D(),[h,g]=_.useState(e),[v,b]=_.useState(""),[T,S]=_.useState(n),[E,w]=_.useState(null),[j,C]=_.useState(null),[N,Y]=_.useState(!1),P=_.useRef(null),K=_.useCallback(()=>{w(null),C(null)},[w,C]),R=_.useCallback(()=>{var H;K(),(H=P.current)==null||H.reset()},[K,P]),q=_.useCallback(async H=>{try{await r({username:h,password:v,remember:T,...j?{[j.type]:E}:{}},H)}catch(F){if(H.aborted)return;if(F instanceof Ks){C(F);return}throw F instanceof Xs&&K(),F}},[h,v,T,j,E,r]);return c.jsxs(He,{...d,ref:ye([o,P]),onLoading:Y,onCancel:i,cancelLabel:s??p._({id:"iH8pgl"}),append:u,invalid:l||!h||!v||j!=null&&!E,submitLabel:j?c.jsx(y,{id:"UwGV9B"}):c.jsx(y,{id:"yKDCQ1"}),onSubmit:q,children:[c.jsx(ue,{disabled:N,label:c.jsx(y,{id:"sJGljQ"}),children:c.jsx(Fe,{icon:c.jsx(ot,{className:"w-5"}),name:"username",type:"text",title:p._({id:"nZx9mr"}),autoCapitalize:"none",autoCorrect:"off",autoComplete:"username",spellCheck:"false",dir:"auto",enterKeyHint:"next",required:!0,readOnly:t,disabled:t,autoFocus:!t,value:h,onChange:H=>{R(),g(H.target.value)}})}),c.jsx(ue,{disabled:N,label:c.jsx(y,{id:"8ZsakT"}),children:c.jsx(Ii,{name:"password",onChange:H=>{R(),b(H.target.value)},append:a&&c.jsx(z,{className:"text-sm",type:"button",onClick:()=>{a(h!=null&&h.includes("@")?h:void 0)},"aria-label":p._({id:"slOprG"}),children:c.jsx(y,{id:"F4OP4y"})}),enterKeyHint:j?"next":"done",disabled:N,autoFocus:t,required:!0})}),c.jsx(Me,{role:"alert",title:c.jsx(y,{id:"r6y+jM"}),children:c.jsx(y,{id:"+Z2ZNt"})}),c.jsx(Za,{name:"remember",title:p._({id:"1TxdLU"}),enterKeyHint:j?"next":"done",checked:T,onChange:H=>S(H.target.checked),children:c.jsx(y,{id:"1TxdLU"})}),j&&c.jsx(ue,{disabled:N,label:c.jsx(y,{id:"4blS0m"}),children:c.jsxs("div",{children:[c.jsx(Pi,{title:p._({id:"ioZOzk"}),enterKeyHint:"done",required:!0,autoFocus:!0,value:E??"",onToken:w}),c.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-400",children:c.jsx(y,{id:"B+Yy3b",values:{0:j.hint}})})]})},"2fa")]})}function Qa({src:e,alt:t}){const[n,r]=_.useState(!1);return _.useEffect(()=>{r(!1)},[e]),e&&!n?c.jsx("img",{"aria-hidden":!0,src:e,alt:t,className:"-ml-1 h-6 w-6 rounded-full",onError:()=>r(!0)}):c.jsx("div",{"aria-hidden":!0,className:"bg-primary border-primary h-6 w-6 overflow-hidden rounded-full border-2 border-solid text-white",children:c.jsx(Js,{className:"-mx-1 -mb-1"})})}function eo({accounts:e,onAccount:t,onOther:n=void 0,onBack:r,onSignUp:i,backLabel:s,children:a,...o}){const{i18n:l,_:u}=D();return c.jsxs(qn,{...o,append:a,actions:i&&c.jsx(z,{onClick:i,color:"primary",transparent:!0,children:c.jsx(y,{id:"e+RpCP"})}),cancel:r&&c.jsx(z,{onClick:r,children:s||c.jsx(y,{id:"iH8pgl"})}),children:[c.jsx("p",{className:"text-sm font-medium text-slate-600 dark:text-slate-400",children:c.jsx(y,{id:"FT1MVS"})}),e.map(d=>c.jsx(Bt,{tabIndex:0,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&t(d)},onClick:()=>t(d),role:"button","aria-label":l._({id:"N9o7n5",values:{0:d.name}}),icon:c.jsx(Qa,{src:d.picture,alt:l._({id:"kfcRb0"})}),append:c.jsx(hr,{"aria-hidden":!0,className:"h-4"}),className:"cursor-pointer",children:c.jsxs("span",{className:"flex flex-wrap items-center",children:[d.name&&c.jsx("span",{className:"mr-2 truncate font-medium","arial-label":l._({id:"6YtxFj"}),children:d.name}),c.jsx("span",{className:"truncate text-sm text-neutral-500 dark:text-neutral-400","arial-label":l._({id:"sJGljQ"}),children:d.preferred_username||d.email||d.sub})]})},d.sub)),n&&c.jsx(Bt,{tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&n()},onClick:n,"aria-label":l._({id:"cR9UpQ"}),role:"button",append:c.jsx(hr,{"aria-hidden":!0,className:"h-4"}),icon:c.jsx(ot,{"aria-hidden":!0,className:"h-4"}),className:"cursor-pointer",children:c.jsx("span",{className:"truncate text-slate-700 dark:text-slate-400",children:c.jsx(y,{id:"+TaG50"})})},"other")]})}function to({loginHint:e,sessions:t,selectSub:n,onSignIn:r,onSignUp:i,onForgotPassword:s,onBack:a,backLabel:o,title:l,subtitle:u,...d}){const{i18n:p,_:f}=D(),h=_.useMemo(()=>t.find(S=>S.selected),[t]),g=_.useCallback(()=>n(null),[n]),v=_.useMemo(()=>t.map(S=>S.account),[t]),[b,T]=_.useState(t.length===0);return l??(l=p._({id:"cQae5I"})),_.useEffect(()=>{h&&T(!1)},[h]),h?h.loginRequired?c.jsx(ee,{...d,title:l,subtitle:u??c.jsx(y,{id:"HaGV2g"}),children:c.jsx(yt,{onSubmit:r,onForgotPassword:s,onBack:g,usernameDefault:h.account.preferred_username||h.account.sub,usernameReadonly:!0,rememberDefault:!0})}):null:e?c.jsx(ee,{...d,title:l,subtitle:u??c.jsx(y,{id:"NgaR6B"}),children:c.jsx(yt,{onSubmit:r,onForgotPassword:s,onBack:a,backLabel:o,usernameDefault:e,usernameReadonly:!0})}):t.length===0?c.jsx(ee,{...d,title:l,subtitle:u??c.jsx(y,{id:"T0KLp4"}),children:c.jsx(yt,{onSubmit:r,onForgotPassword:s,onBack:a,backLabel:o})}):b?c.jsx(ee,{...d,title:l,subtitle:u??c.jsx(y,{id:"T0KLp4"}),children:c.jsx(yt,{onSubmit:r,onForgotPassword:s,onBack:()=>T(!1)})}):c.jsx(ee,{...d,title:l,subtitle:u??c.jsx(y,{id:"o3dwub"}),children:c.jsx(eo,{accounts:v,onAccount:S=>n(S.sub),onOther:()=>T(!0),onBack:a,backLabel:o,onSignUp:i})})}const ce=e=>e!=null&&e!==!1,no=e=>ce(e)&&e.invalid===!0,ro=e=>!ce(e)||e.invalid===!1;function io(e){const t=e.findIndex(ce),n=e.findLastIndex(ce),r=e.findIndex(no),[i,s]=_.useState(t),a=_.useCallback(E=>E!==-1&&e[E]?(s(E),!0):!1,[e.map(ce).join()]),o=e.findLastIndex((E,w)=>ce(E)&&w<i),l=e.findIndex((E,w)=>ce(E)&&w>i),u=_.useCallback(()=>a(t),[a,t]),d=_.useCallback(()=>a(n),[a,n]),p=_.useCallback(()=>a(o),[a,o]),f=_.useCallback(()=>a(l),[a,l]),h=_.useCallback(()=>a(r),[a,r]),g=i+1+e.reduce((E,w,j)=>j>=i||ce(w)?E:E-1,0),v=e.filter(ce).length,b=e.every(ro),T=i===-1||!e[i]?void 0:e[i],S=i===-1;return _.useEffect(()=>{S&&u()},[S]),{current:T,currentPosition:g,count:v,completed:b,atFirst:g===1,atLast:g===v,toFirst:u,toLast:d,toPrev:p,toNext:f,toRequired:h}}function so({prevLabel:e,nextLabel:t,onBack:n,backLabel:r,onDone:i,doneLabel:s,steps:a,className:o,...l}){var C,N;const{atFirst:u,atLast:d,count:p,current:f,currentPosition:h,completed:g,toNext:v,toPrev:b,toRequired:T}=io(a),S=_.useCallback(()=>{v()||T()},[v,T]),E={current:!0,invalid:f?f.invalid:!1,prevLabel:u&&r||e||c.jsx(y,{id:"iH8pgl"}),prev:u?n:b,nextLabel:d&&s||t||c.jsx(y,{id:"hXzOVo"}),next:d&&g?i:S},w=(C=f==null?void 0:f.titleRender)==null?void 0:C.call(f,E),j=(N=f==null?void 0:f.contentRender)==null?void 0:N.call(f,E);return c.jsxs("div",{className:G(o,"flex flex-col"),...l,children:[c.jsx("p",{className:"text-slate-500 dark:text-slate-400",children:c.jsx(y,{id:"BEx8rG",values:{currentPosition:h,count:p}})}),w&&c.jsx("h2",{className:"mb-4 text-xl font-medium",children:w}),j]})}function ao({links:e,className:t,...n}){const r=e==null?void 0:e.find(i=>i.rel==="help");return r?c.jsx("p",{...n,className:G("rounded-md bg-slate-100 p-3 text-sm text-slate-800 dark:bg-slate-800 dark:text-slate-400",t),children:c.jsx(y,{id:"87VTIH",components:{0:c.jsx("a",{role:"link",href:r.href,rel:r.rel,target:"_blank",className:"text-primary"})}})}):null}function oo({inviteCodeRequired:e=!0,credentials:t,onCredentials:n,onNext:r,nextLabel:i,onPrev:s,prevLabel:a,children:o,ref:l,invalid:u,...d}){const{i18n:p,_:f}=D(),[h,g]=_.useState(t==null?void 0:t.email),[v,b]=_.useState(t==null?void 0:t.password),[T,S]=_.useState(t==null?void 0:t.inviteCode),E=_.useRef(null),w=()=>{var C;return(C=E.current)==null?void 0:C.reset()},j=_.useMemo(()=>h&&v&&(!e||T)?{email:h,password:v,inviteCode:e?T:void 0}:void 0,[h,v,T,e]);return _.useEffect(()=>{n==null||n(j)},[j,n]),c.jsxs(He,{...d,ref:ye([l,E]),invalid:u||!j,onCancel:s,cancelLabel:a,onSubmit:r,submitLabel:i,append:o,children:[e&&c.jsx(ue,{label:c.jsx(y,{id:"6KlkHI"}),children:c.jsx(Fe,{icon:c.jsx(Si,{className:"w-5"}),autoFocus:!0,name:"inviteCode",title:p._({id:"6KlkHI"}),placeholder:p._({id:"jxqcgY"}),required:!0,value:T||"",onChange:C=>{S(C.target.value||void 0),w()},enterKeyHint:"next"})}),c.jsx(ue,{label:c.jsx(y,{id:"O3oNi5"}),children:c.jsx(Bi,{autoFocus:!e,name:"email",enterKeyHint:"next",required:!0,defaultValue:h,onEmail:C=>{g(C),w()}})}),c.jsx(ue,{label:c.jsx(y,{id:"8ZsakT"}),children:c.jsx(Oi,{name:"password",enterKeyHint:"next",required:!0,password:v,onPassword:C=>{b(C),w()}})})]})}function on({links:e,className:t,...n}){const r=e==null?void 0:e.find(s=>s.rel==="terms-of-service"),i=e==null?void 0:e.find(s=>s.rel==="privacy-policy");return c.jsx("p",{className:G("text-sm text-slate-500 dark:text-slate-400",t),...n,children:c.jsx(y,{id:"mBUXx0",values:{0:r?c.jsx(fr,{className:"text-primary underline",link:r,children:c.jsx(y,{id:"xowcRf"})}):c.jsx(y,{id:"xowcRf"}),1:i?c.jsx(fr,{className:"text-primary underline",link:i,children:c.jsx(y,{id:"LcET2C"})}):c.jsx(y,{id:"LcET2C"})}})})}const co=18,Ui=3,$i=30,lo=e=>Ui+e.length<=$i&&e.startsWith(".")&&!e.endsWith(".");function uo(e){const t=Ui,n=Math.min(co,$i-e.length),r=_.useCallback(i=>{const s=i.length>=t&&i.length<=n,a=/^[a-z0-9][a-z0-9-]+[a-z0-9]$/g.test(i);return{validLength:s,validCharset:a,valid:s&&a}},[n,t]);return{minLength:t,maxLength:n,validateSegment:r}}function po({domains:e,onNext:t,nextLabel:n,onPrev:r,prevLabel:i,handle:s,onHandle:a,invalid:o,children:l,ref:u,...d}){const{i18n:p,_:f}=D(),h=e.filter(lo),g=_.useRef(null),[v,b]=_.useState(()=>{const R=h.findIndex(q=>s==null?void 0:s.endsWith(q));return R===-1?0:R}),[T,S]=_.useState(()=>(s==null?void 0:s.split(".")[0])||"");_.useEffect(()=>{b(R=>Math.min(R,h.length-1))},[h.length]);const E=h[v]||h[0]||null,{minLength:w,maxLength:j,validateSegment:C}=uo(E),N=C(T),Y=E&&N.valid?`${T}${E}`:void 0;_.useEffect(()=>{var R;(R=g.current)==null||R.reset(),a==null||a(Y)},[a,Y]);const P=_.useRef(null),K=`@${T}${E}`;return c.jsxs(He,{...d,ref:ye([u,g]),onCancel:r,cancelLabel:i,onSubmit:t,submitLabel:n,invalid:o||!Y,append:l,children:[c.jsxs("div",{children:[c.jsx(Ur,{hasValue:!!T,valid:N.validLength,children:c.jsx(y,{id:"4Rgp24",values:{minLength:w,maxLength:j}})}),c.jsx(Ur,{hasValue:!!T,valid:N.validCharset,children:c.jsx(y,{id:"yDlXDJ"})})]}),c.jsx(Fe,{ref:P,icon:c.jsx(ot,{className:"w-5"}),name:"handle",type:"text",title:p._({id:"LX2sHe"}),pattern:"[a-z0-9][a-z0-9\\-]+[a-z0-9]",minLength:w,maxLength:j,autoCapitalize:"none",autoCorrect:"off",autoComplete:"off",dir:"auto",enterKeyHint:"done",autoFocus:!0,required:!0,value:T,onChange:R=>{const q=R.target.value.toLowerCase(),H=R.target.selectionStart,F=R.target.selectionEnd;R.target.value=q,R.target.setSelectionRange(H,F),S(q)},append:h.length>1&&c.jsx("select",{onClick:R=>R.stopPropagation(),onMouseDown:R=>R.stopPropagation(),value:v,"aria-label":p._({id:"HB+TbB"}),onChange:R=>{var q;b(Number(R.target.value)),(q=P.current)==null||q.focus()},className:G("block w-full","text-sm","rounded-lg p-2","bg-white dark:bg-slate-600"),children:h.map((R,q)=>c.jsx("option",{value:q,children:R},R))}),bellow:c.jsx(y,{id:"r/b/p8",values:{0:T.length?c.jsx("strong",{className:"text-gray-800 dark:text-gray-200",children:K}):c.jsx("span",{"aria-hidden":!0,className:"w-24 rounded-md bg-gray-300 p-2 dark:bg-slate-600"})}})}),c.jsx(Me,{type:"status",children:c.jsx(y,{id:"B9VwbO"})})]})}function Ur({valid:e,hasValue:t,children:n,className:r,...i}){const{i18n:s,_:a}=D();return c.jsxs("div",{...i,className:G("flex flex-row items-center gap-2",r),children:[t?c.jsx(c.Fragment,{children:e?c.jsx(Ct,{className:"text-success inline-block h-4 w-4",title:s._({id:"nfagfM"})}):c.jsx(Zs,{className:"text-error inline-block h-4 w-4",title:s._({id:"JHB/Ky"})})}):c.jsx("div",{"aria-hidden":!0,className:"flex h-4 w-4 items-center justify-center",children:c.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-300 dark:bg-slate-600"})}),c.jsx("div",{className:"text-sm",children:n})]})}function J(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _n(e,t){return _n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},_n(e,t)}function ho(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,_n(e,t)}var Ai=Object.defineProperty,fo=Object.defineProperties,_o=Object.getOwnPropertyDescriptors,Ut=Object.getOwnPropertySymbols,Li=Object.prototype.hasOwnProperty,Gi=Object.prototype.propertyIsEnumerable,$r=(e,t,n)=>t in e?Ai(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,m=(e,t)=>{for(var n in t||(t={}))Li.call(t,n)&&$r(e,n,t[n]);if(Ut)for(var n of Ut(t))Gi.call(t,n)&&$r(e,n,t[n]);return e},k=(e,t)=>fo(e,_o(t)),mo=(e,t)=>{var n={};for(var r in e)Li.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ut)for(var r of Ut(e))t.indexOf(r)<0&&Gi.call(e,r)&&(n[r]=e[r]);return n},Yi=(e,t)=>{for(var n in t)Ai(e,n,{get:t[n],enumerable:!0})},Hn=(e,t,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(u){i(u)}},a=l=>{try{o(n.throw(l))}catch(u){i(u)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(e,t)).next())});function go(e){return Object.entries(e).filter(([,t])=>t||t===!1).map(([t,n])=>`${encodeURIComponent(t)}=${encodeURIComponent(String(n))}`).join("&")}function Mi(e){let t=e&&e.ownerDocument||document,n=t.defaultView||t.parentWindow||window;return{document:t,window:n}}function qi(e){return e||document.head}var yo="hCaptcha-script",Dt="hCaptchaOnLoad",mn="script-error",Oe="@hCaptcha/loader",Hi=Object.prototype.toString;function Fi(e){switch(Hi.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return de(e,Error)}}function ze(e,t){return Hi.call(e)===`[object ${t}]`}function Fn(e){return ze(e,"ErrorEvent")}function Ar(e){return ze(e,"DOMError")}function vo(e){return ze(e,"DOMException")}function _e(e){return ze(e,"String")}function zi(e){return e===null||typeof e!="object"&&typeof e!="function"}function $e(e){return ze(e,"Object")}function Mt(e){return typeof Event<"u"&&de(e,Event)}function xo(e){return typeof Element<"u"&&de(e,Element)}function bo(e){return ze(e,"RegExp")}function zn(e){return!!(e&&e.then&&typeof e.then=="function")}function So(e){return $e(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function Vi(e){return typeof e=="number"&&e!==e}function de(e,t){try{return e instanceof t}catch{return!1}}function Wi(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue))}function Be(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Lr(e,t){if(!Array.isArray(e))return"";let n=[];for(let r=0;r<e.length;r++){let i=e[r];try{Wi(i)?n.push("[VueViewModel]"):n.push(String(i))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function Eo(e,t,n=!1){return _e(e)?bo(t)?t.test(e):_e(t)?n?e===t:e.includes(t):!1:!1}function ct(e,t=[],n=!1){return t.some(r=>Eo(e,r,n))}function To(e,t,n=250,r,i,s,a){if(!s.exception||!s.exception.values||!a||!de(a.originalException,Error))return;let o=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;o&&(s.exception.values=jo(gn(e,t,i,a.originalException,r,s.exception.values,o,0),n))}function gn(e,t,n,r,i,s,a,o){if(s.length>=n+1)return s;let l=[...s];if(de(r[i],Error)){Gr(a,o);let u=e(t,r[i]),d=l.length;Yr(u,i,d,o),l=gn(e,t,n,r[i],i,[u,...l],u,d)}return Array.isArray(r.errors)&&r.errors.forEach((u,d)=>{if(de(u,Error)){Gr(a,o);let p=e(t,u),f=l.length;Yr(p,`errors[${d}]`,f,o),l=gn(e,t,n,u,i,[p,...l],p,f)}}),l}function Gr(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism=k(m({},e.mechanism),{is_exception_group:!0,exception_id:t})}function Yr(e,t,n,r){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism=k(m({},e.mechanism),{type:"chained",source:t,exception_id:n,parent_id:r})}function jo(e,t){return e.map(n=>(n.value&&(n.value=Be(n.value,t)),n))}function vt(e){return e&&e.Math==Math?e:void 0}var $=typeof globalThis=="object"&&vt(globalThis)||typeof window=="object"&&vt(window)||typeof self=="object"&&vt(self)||typeof global=="object"&&vt(global)||function(){return this}()||{};function lt(){return $}function Ki(e,t,n){let r=n||$,i=r.__SENTRY__=r.__SENTRY__||{};return i[e]||(i[e]=t())}var It=lt(),wo=80;function Ae(e,t={}){try{let n=e,r=5,i=[],s=0,a=0,o=" > ",l=o.length,u,d=Array.isArray(t)?t:t.keyAttrs,p=!Array.isArray(t)&&t.maxStringLength||wo;for(;n&&s++<r&&(u=Ro(n,d),!(u==="html"||s>1&&a+i.length*l+u.length>=p));)i.push(u),a+=u.length,n=n.parentNode;return i.reverse().join(o)}catch{return"<unknown>"}}function Ro(e,t){let n=e,r=[],i,s,a,o,l;if(!n||!n.tagName)return"";r.push(n.tagName.toLowerCase());let u=t&&t.length?t.filter(p=>n.getAttribute(p)).map(p=>[p,n.getAttribute(p)]):null;if(u&&u.length)u.forEach(p=>{r.push(`[${p[0]}="${p[1]}"]`)});else if(n.id&&r.push(`#${n.id}`),i=n.className,i&&_e(i))for(s=i.split(/\s+/),l=0;l<s.length;l++)r.push(`.${s[l]}`);let d=["aria-label","type","name","title","alt"];for(l=0;l<d.length;l++)a=d[l],o=n.getAttribute(a),o&&r.push(`[${a}="${o}"]`);return r.join("")}function No(){try{return It.document.location.href}catch{return""}}function ko(e){return It.document&&It.document.querySelector?It.document.querySelector(e):null}var Co="Sentry Logger ",yn=["debug","info","warn","error","log","assert","trace"],$t={};function Xi(e){if(!("console"in $))return e();let t=$.console,n={},r=Object.keys($t);r.forEach(i=>{let s=$t[i];n[i]=t[i],t[i]=s});try{return e()}finally{r.forEach(i=>{t[i]=n[i]})}}function Do(){let e=!1,t={enable:()=>{e=!0},disable:()=>{e=!1}};return typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__?yn.forEach(n=>{t[n]=(...r)=>{e&&Xi(()=>{$.console[n](`${Co}[${n}]:`,...r)})}}):yn.forEach(n=>{t[n]=()=>{}}),t}var x=Do(),Io=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Oo(e){return e==="http"||e==="https"}function qt(e,t=!1){let{host:n,path:r,pass:i,port:s,projectId:a,protocol:o,publicKey:l}=e;return`${o}://${l}${t&&i?`:${i}`:""}@${n}${s?`:${s}`:""}/${r&&`${r}/`}${a}`}function Po(e){let t=Io.exec(e);if(!t){console.error(`Invalid Sentry Dsn: ${e}`);return}let[n,r,i="",s,a="",o]=t.slice(1),l="",u=o,d=u.split("/");if(d.length>1&&(l=d.slice(0,-1).join("/"),u=d.pop()),u){let p=u.match(/^\d+/);p&&(u=p[0])}return Ji({host:s,pass:i,path:l,projectId:u,port:a,protocol:n,publicKey:r})}function Ji(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Bo(e){if(!(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__))return!0;let{port:t,projectId:n,protocol:r}=e;return["protocol","publicKey","host","projectId"].find(i=>e[i]?!1:(x.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:n.match(/^\d+$/)?Oo(r)?t&&isNaN(parseInt(t,10))?(x.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(x.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(x.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Uo(e){let t=typeof e=="string"?Po(e):Ji(e);if(!(!t||!Bo(t)))return t}var ie=class extends Error{constructor(e,t="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=t}};function M(e,t,n){if(!(t in e))return;let r=e[t],i=n(r);typeof i=="function"&&Zi(i,r),e[t]=i}function Vn(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Zi(e,t){try{let n=t.prototype||{};e.prototype=t.prototype=n,Vn(e,"__sentry_original__",t)}catch{}}function Wn(e){return e.__sentry_original__}function $o(e){return Object.keys(e).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&")}function Qi(e){if(Fi(e))return m({message:e.message,name:e.name,stack:e.stack},qr(e));if(Mt(e)){let t=m({type:e.type,target:Mr(e.target),currentTarget:Mr(e.currentTarget)},qr(e));return typeof CustomEvent<"u"&&de(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function Mr(e){try{return xo(e)?Ae(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function qr(e){if(typeof e=="object"&&e!==null){let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}else return{}}function Ao(e,t=40){let n=Object.keys(Qi(e));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=t)return Be(n[0],t);for(let r=n.length;r>0;r--){let i=n.slice(0,r).join(", ");if(!(i.length>t))return r===n.length?i:Be(i,t)}return""}function fe(e){return vn(e,new Map)}function vn(e,t){if($e(e)){let n=t.get(e);if(n!==void 0)return n;let r={};t.set(e,r);for(let i of Object.keys(e))typeof e[i]<"u"&&(r[i]=vn(e[i],t));return r}if(Array.isArray(e)){let n=t.get(e);if(n!==void 0)return n;let r=[];return t.set(e,r),e.forEach(i=>{r.push(vn(i,t))}),r}return e}var es=50,Hr=/\(error: (.*)\)/,Fr=/captureMessage|captureException/;function Lo(...e){let t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0)=>{let i=[],s=n.split(`
|
|
2
2
|
`);for(let a=r;a<s.length;a++){let o=s[a];if(o.length>1024)continue;let l=Hr.test(o)?o.replace(Hr,"$1"):o;if(!l.match(/\S*Error: /)){for(let u of t){let d=u(l);if(d){i.push(d);break}}if(i.length>=es)break}}return Go(i)}}function Go(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(t[t.length-1].function||"")&&t.pop(),t.reverse(),Fr.test(t[t.length-1].function||"")&&(t.pop(),Fr.test(t[t.length-1].function||"")&&t.pop()),t.slice(0,es).map(n=>k(m({},n),{filename:n.filename||t[t.length-1].filename,function:n.function||"?"}))}var cn="<anonymous>";function me(e){try{return!e||typeof e!="function"?cn:e.name||cn}catch{return cn}}var xn=lt();function Yo(){if(!("fetch"in xn))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function bn(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function Mo(){if(!Yo())return!1;if(bn(xn.fetch))return!0;let e=!1,t=xn.document;if(t&&typeof t.createElement=="function")try{let n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(e=bn(n.contentWindow.fetch)),t.head.removeChild(n)}catch(n){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return e}var xt=lt();function qo(){let e=xt.chrome,t=e&&e.app&&e.app.runtime,n="history"in xt&&!!xt.history.pushState&&!!xt.history.replaceState;return!t&&n}var L=lt(),Pe="__sentry_xhr_v2__",rt={},zr={};function Ho(e){if(!zr[e])switch(zr[e]=!0,e){case"console":Fo();break;case"dom":Qo();break;case"xhr":Wo();break;case"fetch":zo();break;case"history":Ko();break;case"error":ec();break;case"unhandledrejection":tc();break;default:(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.warn("unknown instrumentation type:",e);return}}function Q(e,t){rt[e]=rt[e]||[],rt[e].push(t),Ho(e)}function te(e,t){if(!(!e||!rt[e]))for(let n of rt[e]||[])try{n(t)}catch(r){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.error(`Error while triggering instrumentation handler.
|
|
3
3
|
Type: ${e}
|
|
4
4
|
Name: ${me(n)}
|
|
@@ -17,4 +17,4 @@ Event: ${he(e)}.
|
|
|
17
17
|
Url: ${Lt(e)}`),!0):wl(e,t.allowUrls)?!1:((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
18
18
|
Event: ${he(e)}.
|
|
19
19
|
Url: ${Lt(e)}`),!0)}function El(e,t){return e.type||!t||!t.length?!1:Rl(e).some(n=>ct(n,t))}function Tl(e,t){if(e.type!=="transaction"||!t||!t.length)return!1;let n=e.transaction;return n?ct(n,t):!1}function jl(e,t){if(!t||!t.length)return!1;let n=Lt(e);return n?ct(n,t):!1}function wl(e,t){if(!t||!t.length)return!0;let n=Lt(e);return n?ct(n,t):!0}function Rl(e){let t=[];e.message&&t.push(e.message);let n;try{n=e.exception.values[e.exception.values.length-1]}catch{}return n&&n.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`)),(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&t.length===0&&x.error(`Could not extract message for event ${he(e)}`),t}function Nl(e){try{return e.exception.values[0].type==="SentryError"}catch{}return!1}function kl(e=[]){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function Lt(e){try{let t;try{t=e.exception.values[0].stacktrace.frames}catch{}return t?kl(t):null}catch{return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.error(`Cannot extract url for event ${he(e)}`),null}}var O=$,Dn=0;function gs(){return Dn>0}function Cl(){Dn++,setTimeout(()=>{Dn--})}function Ge(e,t={},n){if(typeof e!="function")return e;try{let i=e.__sentry_wrapped__;if(i)return i;if(Wn(e))return e}catch{return e}let r=function(){let i=Array.prototype.slice.call(arguments);try{n&&typeof n=="function"&&n.apply(this,arguments);let s=i.map(a=>Ge(a,t));return e.apply(this,s)}catch(s){throw Cl(),Qc(a=>{a.addEventProcessor(o=>(t.mechanism&&(En(o,void 0),st(o,t.mechanism)),o.extra=k(m({},o.extra),{arguments:i}),o)),Zc(s)}),s}};try{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}catch{}Zi(r,e),Vn(e,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return e.name}})}catch{}return r}function ys(e,t){let n=rr(e,t),r={type:t&&t.name,value:Pl(t)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function Dl(e,t,n,r){let i=A().getClient(),s=i&&i.getOptions().normalizeDepth,a={exception:{values:[{type:Mt(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:$l(t,{isUnhandledRejection:r})}]},extra:{__serialized__:ns(t,s)}};if(n){let o=rr(e,n);o.length&&(a.exception.values[0].stacktrace={frames:o})}return a}function dn(e,t){return{exception:{values:[ys(e,t)]}}}function rr(e,t){let n=t.stacktrace||t.stack||"",r=Ol(t);try{return e(n,r)}catch{}return[]}var Il=/Minified React error #\d+;/i;function Ol(e){if(e){if(typeof e.framesToPop=="number")return e.framesToPop;if(Il.test(e.message))return 1}return 0}function Pl(e){let t=e&&e.message;return t?t.error&&typeof t.error.message=="string"?t.error.message:t:"No error message"}function Bl(e,t,n,r){let i=n&&n.syntheticException||void 0,s=ir(e,t,i,r);return st(s),s.level="error",n&&n.event_id&&(s.event_id=n.event_id),we(s)}function Ul(e,t,n="info",r,i){let s=r&&r.syntheticException||void 0,a=In(e,t,s,i);return a.level=n,r&&r.event_id&&(a.event_id=r.event_id),we(a)}function ir(e,t,n,r,i){let s;if(Fn(t)&&t.error)return dn(e,t.error);if(Ar(t)||vo(t)){let a=t;if("stack"in t)s=dn(e,t);else{let o=a.name||(Ar(a)?"DOMError":"DOMException"),l=a.message?`${o}: ${a.message}`:o;s=In(e,l,n,r),En(s,l)}return"code"in a&&(s.tags=k(m({},s.tags),{"DOMException.code":`${a.code}`})),s}return Fi(t)?dn(e,t):$e(t)||Mt(t)?(s=Dl(e,t,n,i),st(s,{synthetic:!0}),s):(s=In(e,t,n,r),En(s,`${t}`),st(s,{synthetic:!0}),s)}function In(e,t,n,r){let i={message:t};if(r&&n){let s=rr(e,n);s.length&&(i.exception={values:[{value:t,stacktrace:{frames:s}}]})}return i}function $l(e,{isUnhandledRejection:t}){let n=Ao(e),r=t?"promise rejection":"exception";return Fn(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:Mt(e)?`Event \`${Al(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function Al(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Ll(e,{metadata:t,tunnel:n,dsn:r}){let i=m(m({event_id:e.event_id,sent_at:new Date().toISOString()},t&&t.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}}),!!n&&!!r&&{dsn:qt(r)}),s=Gl(e);return ut(i,[s])}function Gl(e){return[{type:"user_report"},e]}var Yl=class extends _l{constructor(e){let t=O.SENTRY_SDK_SOURCE||sc();e._metadata=e._metadata||{},e._metadata.sdk=e._metadata.sdk||{name:"sentry.javascript.browser",packages:[{name:`${t}:@sentry/browser`,version:ci}],version:ci},super(e),e.sendClientReports&&O.document&&O.document.addEventListener("visibilitychange",()=>{O.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,t){return Bl(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",n){return Ul(this._options.stackParser,e,t,n,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled()){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.warn("SDK not enabled, will not capture user feedback.");return}let t=Ll(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this._sendEnvelope(t)}_prepareEvent(e,t,n){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,n)}_flushOutcomes(){let e=this._clearOutcomes();if(e.length===0){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log("No outcomes to send");return}if(!this._dsn){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log("No dsn provided, will not send outcomes");return}(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log("Sending outcomes:",e);let t=Cc(e,this._options.tunnel&&qt(this._dsn));this._sendEnvelope(t)}},nt;function Ml(){if(nt)return nt;if(bn(O.fetch))return nt=O.fetch.bind(O);let e=O.document,t=O.fetch;if(e&&typeof e.createElement=="function")try{let n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n);let r=n.contentWindow;r&&r.fetch&&(t=r.fetch),e.head.removeChild(n)}catch(n){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return nt=t.bind(O)}function ql(){nt=void 0}function Hl(e,t=Ml()){let n=0,r=0;function i(s){let a=s.body.length;n+=a,r++;let o=m({body:s.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:n<=6e4&&r<15},e.fetchOptions);try{return t(e.url,o).then(l=>(n-=a,r--,{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}))}catch(l){return ql(),n-=a,r--,Kn(l)}}return _s(e,i)}var Fl=4;function zl(e){function t(n){return new Z((r,i)=>{let s=new XMLHttpRequest;s.onerror=i,s.onreadystatechange=()=>{s.readyState===Fl&&r({statusCode:s.status,headers:{"x-sentry-rate-limits":s.getResponseHeader("X-Sentry-Rate-Limits"),"retry-after":s.getResponseHeader("Retry-After")}})},s.open("POST",e.url);for(let a in e.headers)Object.prototype.hasOwnProperty.call(e.headers,a)&&s.setRequestHeader(a,e.headers[a]);s.send(n.body)})}return _s(e,t)}var zt="?",Vl=30,Wl=40,Kl=50;function sr(e,t,n,r){let i={filename:e,function:t,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}var Xl=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Jl=/\((\S*)(?::(\d+))(?::(\d+))\)/,Zl=e=>{let t=Xl.exec(e);if(t){if(t[2]&&t[2].indexOf("eval")===0){let i=Jl.exec(t[2]);i&&(t[2]=i[1],t[3]=i[2],t[4]=i[3])}let[n,r]=vs(t[1]||zt,t[2]);return sr(r,n,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}},Ql=[Vl,Zl],eu=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,tu=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,nu=e=>{let t=eu.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){let i=tu.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}let n=t[3],r=t[1]||zt;return[r,n]=vs(r,n),sr(n,r,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},ru=[Kl,nu],iu=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,su=e=>{let t=iu.exec(e);return t?sr(t[2],t[1]||zt,+t[3],t[4]?+t[4]:void 0):void 0},au=[Wl,su],ou=[Ql,ru,au],cu=Lo(...ou),vs=(e,t)=>{let n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:zt,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Ve=class{static __initStatic(){this.id="GlobalHandlers"}constructor(e){this.name=Ve.id,this._options=m({onerror:!0,onunhandledrejection:!0},e),this._installFunc={onerror:lu,onunhandledrejection:uu}}setupOnce(){Error.stackTraceLimit=50;let e=this._options;for(let t in e){let n=this._installFunc[t];n&&e[t]&&(hu(t),n(),this._installFunc[t]=void 0)}}};Ve.__initStatic();function lu(){Q("error",e=>{let[t,n,r]=Ss();if(!t.getIntegration(Ve))return;let{msg:i,url:s,line:a,column:o,error:l}=e;if(gs()||l&&l.__sentry_own_request__)return;let u=l===void 0&&_e(i)?pu(i,s,a,o):xs(ir(n,l||i,void 0,r,!1),s,a,o);u.level="error",bs(t,l,u,"onerror")})}function uu(){Q("unhandledrejection",e=>{let[t,n,r]=Ss();if(!t.getIntegration(Ve))return;let i=e;try{"reason"in e?i=e.reason:"detail"in e&&"reason"in e.detail&&(i=e.detail.reason)}catch{}if(gs()||i&&i.__sentry_own_request__)return!0;let s=zi(i)?du(i):ir(n,i,void 0,r,!0);s.level="error",bs(t,i,s,"onunhandledrejection")})}function du(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function pu(e,t,n,r){let i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,s=Fn(e)?e.message:e,a="Error",o=s.match(i);return o&&(a=o[1],s=o[2]),xs({exception:{values:[{type:a,value:s}]}},t,n,r)}function xs(e,t,n,r){let i=e.exception=e.exception||{},s=i.values=i.values||[],a=s[0]=s[0]||{},o=a.stacktrace=a.stacktrace||{},l=o.frames=o.frames||[],u=isNaN(parseInt(r,10))?void 0:r,d=isNaN(parseInt(n,10))?void 0:n,p=_e(t)&&t.length>0?t:No();return l.length===0&&l.push({colno:u,filename:p,function:"?",in_app:!0,lineno:d}),e}function hu(e){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log(`Global Handler attached: ${e}`)}function bs(e,t,n,r){st(n,{handled:!1,type:r}),e.captureEvent(n,{originalException:t})}function Ss(){let e=A(),t=e.getClient(),n=t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1};return[e,n.stackParser,n.attachStacktrace]}var fu=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],ar=class{static __initStatic(){this.id="TryCatch"}constructor(e){this.name=ar.id,this._options=m({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},e)}setupOnce(){this._options.setTimeout&&M(O,"setTimeout",ui),this._options.setInterval&&M(O,"setInterval",ui),this._options.requestAnimationFrame&&M(O,"requestAnimationFrame",_u),this._options.XMLHttpRequest&&"XMLHttpRequest"in O&&M(XMLHttpRequest.prototype,"send",mu);let e=this._options.eventTarget;e&&(Array.isArray(e)?e:fu).forEach(gu)}};ar.__initStatic();function ui(e){return function(...t){let n=t[0];return t[0]=Ge(n,{mechanism:{data:{function:me(e)},handled:!1,type:"instrument"}}),e.apply(this,t)}}function _u(e){return function(t){return e.apply(this,[Ge(t,{mechanism:{data:{function:"requestAnimationFrame",handler:me(e)},handled:!1,type:"instrument"}})])}}function mu(e){return function(...t){let n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(r=>{r in n&&typeof n[r]=="function"&&M(n,r,function(i){let s={mechanism:{data:{function:r,handler:me(i)},handled:!1,type:"instrument"}},a=Wn(i);return a&&(s.mechanism.data.handler=me(a)),Ge(i,s)})}),e.apply(this,t)}}function gu(e){let t=O,n=t[e]&&t[e].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(M(n,"addEventListener",function(r){return function(i,s,a){try{typeof s.handleEvent=="function"&&(s.handleEvent=Ge(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:me(s),target:e},handled:!1,type:"instrument"}}))}catch{}return r.apply(this,[i,Ge(s,{mechanism:{data:{function:"addEventListener",handler:me(s),target:e},handled:!1,type:"instrument"}}),a])}}),M(n,"removeEventListener",function(r){return function(i,s,a){let o=s;try{let l=o&&o.__sentry_wrapped__;l&&r.call(this,i,l,a)}catch{}return r.call(this,i,o,a)}}))}var wt=1024,Vt=class{static __initStatic(){this.id="Breadcrumbs"}constructor(e){this.name=Vt.id,this.options=m({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},e)}setupOnce(){if(this.options.console&&Q("console",xu),this.options.dom&&Q("dom",vu(this.options.dom)),this.options.xhr&&Q("xhr",bu),this.options.fetch&&Q("fetch",Su),this.options.history&&Q("history",Eu),this.options.sentry){let e=A().getClient();e&&e.on&&e.on("beforeSendEvent",yu)}}};Vt.__initStatic();function yu(e){A().addBreadcrumb({category:`sentry.${e.type==="transaction"?"transaction":"event"}`,event_id:e.event_id,level:e.level,message:he(e)},{event:e})}function vu(e){function t(n){let r,i=typeof e=="object"?e.serializeAttribute:void 0,s=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;s&&s>wt&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.warn(`\`dom.maxStringLength\` cannot exceed ${wt}, but a value of ${s} was configured. Sentry will use ${wt} instead.`),s=wt),typeof i=="string"&&(i=[i]);try{let a=n.event;r=Tu(a)?Ae(a.target,{keyAttrs:i,maxStringLength:s}):Ae(a,{keyAttrs:i,maxStringLength:s})}catch{r="<unknown>"}r.length!==0&&A().addBreadcrumb({category:`ui.${n.name}`,message:r},{event:n.event,name:n.name,global:n.global})}return t}function xu(e){let t={category:"console",data:{arguments:e.args,logger:"console"},level:fc(e.level),message:Lr(e.args," ")};if(e.level==="assert")if(e.args[0]===!1)t.message=`Assertion failed: ${Lr(e.args.slice(1)," ")||"console.assert"}`,t.data.arguments=e.args.slice(1);else return;A().addBreadcrumb(t,{input:e.args,level:e.level})}function bu(e){let{startTimestamp:t,endTimestamp:n}=e,r=e.xhr[Pe];if(!t||!n||!r)return;let{method:i,url:s,status_code:a,body:o}=r,l={method:i,url:s,status_code:a},u={xhr:e.xhr,input:o,startTimestamp:t,endTimestamp:n};A().addBreadcrumb({category:"xhr",data:l,type:"http"},u)}function Su(e){let{startTimestamp:t,endTimestamp:n}=e;if(n&&!(e.fetchData.url.match(/sentry_key/)&&e.fetchData.method==="POST"))if(e.error){let r=e.fetchData,i={data:e.error,input:e.args,startTimestamp:t,endTimestamp:n};A().addBreadcrumb({category:"fetch",data:r,level:"error",type:"http"},i)}else{let r=k(m({},e.fetchData),{status_code:e.response&&e.response.status}),i={input:e.args,response:e.response,startTimestamp:t,endTimestamp:n};A().addBreadcrumb({category:"fetch",data:r,type:"http"},i)}}function Eu(e){let t=e.from,n=e.to,r=ln(O.location.href),i=ln(t),s=ln(n);i.path||(i=r),r.protocol===s.protocol&&r.host===s.host&&(n=s.relative),r.protocol===i.protocol&&r.host===i.host&&(t=i.relative),A().addBreadcrumb({category:"navigation",data:{from:t,to:n}})}function Tu(e){return!!e&&!!e.target}var ju="cause",wu=5,Wt=class{static __initStatic(){this.id="LinkedErrors"}constructor(e={}){this.name=Wt.id,this._key=e.key||ju,this._limit=e.limit||wu}setupOnce(){}preprocessEvent(e,t,n){let r=n.getOptions();To(ys,r.stackParser,r.maxValueLength,this._key,this._limit,e,t)}};Wt.__initStatic();var Kt=class{static __initStatic(){this.id="HttpContext"}constructor(){this.name=Kt.id}setupOnce(){}preprocessEvent(e){if(!O.navigator&&!O.location&&!O.document)return;let t=e.request&&e.request.url||O.location&&O.location.href,{referrer:n}=O.document||{},{userAgent:r}=O.navigator||{},i=m(m(m({},e.request&&e.request.headers),n&&{Referer:n}),r&&{"User-Agent":r}),s=k(m(m({},e.request),t&&{url:t}),{headers:i});e.request=s}};Kt.__initStatic();var Xt=class{static __initStatic(){this.id="Dedupe"}constructor(){this.name=Xt.id}setupOnce(e,t){}processEvent(e){if(e.type)return e;try{if(Ru(e,this._previousEvent))return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return this._previousEvent=e}};Xt.__initStatic();function Ru(e,t){return t?!!(Nu(e,t)||ku(e,t)):!1}function Nu(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!Ts(e,t)||!Es(e,t))}function ku(e,t){let n=di(t),r=di(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!Ts(e,t)||!Es(e,t))}function Es(e,t){let n=pi(e),r=pi(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let i=0;i<r.length;i++){let s=r[i],a=n[i];if(s.filename!==a.filename||s.lineno!==a.lineno||s.colno!==a.colno||s.function!==a.function)return!1}return!0}function Ts(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function di(e){return e.exception&&e.exception.values&&e.exception.values[0]}function pi(e){let t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch{return}}var js={};Yi(js,{Breadcrumbs:()=>Vt,Dedupe:()=>Xt,GlobalHandlers:()=>Ve,HttpContext:()=>Kt,LinkedErrors:()=>Wt,TryCatch:()=>ar});var I=$;function Cu(){I&&I.document?I.document.addEventListener("visibilitychange",()=>{let e=pt();if(I.document.hidden&&e){let t="cancelled";(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log(`[Tracing] Transaction: ${t} -> since tab moved to the background, op: ${e.op}`),e.status||e.setStatus(t),e.setTag("visibilitychange","document.hidden"),e.finish()}}):(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.warn("[Tracing] Could not set up background tab detection due to lack of global document")}var or=(e,t,n)=>{let r,i;return s=>{t.value>=0&&(s||n)&&(i=t.value-(r||0),(i||r===void 0)&&(r=t.value,t.delta=i,e(t)))}},Du=()=>`v3-${Date.now()}-${Math.floor(Math.random()*8999999999999)+1e12}`,Iu=()=>{let e=I.performance.timing,t=I.performance.navigation.type,n={entryType:"navigation",startTime:0,type:t==2?"back_forward":t===1?"reload":"navigate"};for(let r in e)r!=="navigationStart"&&r!=="toJSON"&&(n[r]=Math.max(e[r]-e.navigationStart,0));return n},ws=()=>I.__WEB_VITALS_POLYFILL__?I.performance&&(performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]||Iu()):I.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0],Rs=()=>{let e=ws();return e&&e.activationStart||0},cr=(e,t)=>{let n=ws(),r="navigate";return n&&(I.document.prerendering||Rs()>0?r="prerender":r=n.type.replace(/_/g,"-")),{name:e,value:typeof t>"u"?-1:t,rating:"good",delta:0,entries:[],id:Du(),navigationType:r}},ht=(e,t,n)=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let r=new PerformanceObserver(i=>{t(i.getEntries())});return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch{}},Jt=(e,t)=>{let n=r=>{(r.type==="pagehide"||I.document.visibilityState==="hidden")&&(e(r),t&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},Ou=e=>{let t=cr("CLS",0),n,r=0,i=[],s=o=>{o.forEach(l=>{if(!l.hadRecentInput){let u=i[0],d=i[i.length-1];r&&i.length!==0&&l.startTime-d.startTime<1e3&&l.startTime-u.startTime<5e3?(r+=l.value,i.push(l)):(r=l.value,i=[l]),r>t.value&&(t.value=r,t.entries=i,n&&n())}})},a=ht("layout-shift",s);if(a){n=or(e,t);let o=()=>{s(a.takeRecords()),n(!0)};return Jt(o),o}},Pt=-1,Pu=()=>I.document.visibilityState==="hidden"&&!I.document.prerendering?0:1/0,Bu=()=>{Jt(({timeStamp:e})=>{Pt=e},!0)},lr=()=>(Pt<0&&(Pt=Pu(),Bu()),{get firstHiddenTime(){return Pt}}),Uu=e=>{let t=lr(),n=cr("FID"),r,i=o=>{o.startTime<t.firstHiddenTime&&(n.value=o.processingStart-o.startTime,n.entries.push(o),r(!0))},s=o=>{o.forEach(i)},a=ht("first-input",s);r=or(e,n),a&&Jt(()=>{s(a.takeRecords()),a.disconnect()},!0)},hi={},$u=e=>{let t=lr(),n=cr("LCP"),r,i=a=>{let o=a[a.length-1];if(o){let l=Math.max(o.startTime-Rs(),0);l<t.firstHiddenTime&&(n.value=l,n.entries=[o],r())}},s=ht("largest-contentful-paint",i);if(s){r=or(e,n);let a=()=>{hi[n.id]||(i(s.takeRecords()),s.disconnect(),hi[n.id]=!0,r(!0))};return["keydown","click"].forEach(o=>{addEventListener(o,a,{once:!0,capture:!0})}),Jt(a,!0),a}};function pn(e){return typeof e=="number"&&isFinite(e)}function Ye(e,t){var n=t,{startTimestamp:r}=n,i=mo(n,["startTimestamp"]);return r&&e.startTimestamp>r&&(e.startTimestamp=r),e.startChild(m({startTimestamp:r},i))}function U(e){return e/1e3}function Ns(){return I&&I.addEventListener&&I.performance}var fi=0,B={},re,it;function Au(){let e=Ns();if(e&&se){e.mark&&I.performance.mark("sentry-tracing-init"),qu();let t=Yu(),n=Mu();return()=>{t&&t(),n&&n()}}return()=>{}}function Lu(){ht("longtask",e=>{for(let t of e){let n=pt();if(!n)return;let r=U(se+t.startTime),i=U(t.duration);n.startChild({description:"Main UI thread blocked",op:"ui.long-task",origin:"auto.ui.browser.metrics",startTimestamp:r,endTimestamp:r+i})}})}function Gu(){ht("event",e=>{for(let t of e){let n=pt();if(!n)return;if(t.name==="click"){let r=U(se+t.startTime),i=U(t.duration);n.startChild({description:Ae(t.target),op:`ui.interaction.${t.name}`,origin:"auto.ui.browser.metrics",startTimestamp:r,endTimestamp:r+i})}}},{durationThreshold:0})}function Yu(){return Ou(e=>{let t=e.entries.pop();t&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log("[Measurements] Adding CLS"),B.cls={value:e.value,unit:""},it=t)})}function Mu(){return $u(e=>{let t=e.entries.pop();t&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log("[Measurements] Adding LCP"),B.lcp={value:e.value,unit:"millisecond"},re=t)})}function qu(){Uu(e=>{let t=e.entries.pop();if(!t)return;let n=U(se),r=U(t.startTime);(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log("[Measurements] Adding FID"),B.fid={value:e.value,unit:"millisecond"},B["mark.fid"]={value:n+r,unit:"second"}})}function Hu(e){let t=Ns();if(!t||!I.performance.getEntries||!se)return;(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log("[Tracing] Adding & adjusting spans using Performance API");let n=U(se),r=t.getEntries(),i,s;if(r.slice(fi).forEach(a=>{let o=U(a.startTime),l=U(a.duration);if(!(e.op==="navigation"&&n+o<e.startTimestamp))switch(a.entryType){case"navigation":{zu(e,a,n),i=n+U(a.responseStart),s=n+U(a.requestStart);break}case"mark":case"paint":case"measure":{Fu(e,a,o,l,n);let u=lr(),d=a.startTime<u.firstHiddenTime;a.name==="first-paint"&&d&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log("[Measurements] Adding FP"),B.fp={value:a.startTime,unit:"millisecond"}),a.name==="first-contentful-paint"&&d&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log("[Measurements] Adding FCP"),B.fcp={value:a.startTime,unit:"millisecond"});break}case"resource":{let u=a.name.replace(I.location.origin,"");Wu(e,a,u,o,l,n);break}}}),fi=Math.max(r.length-1,0),Ku(e),e.op==="pageload"){typeof i=="number"&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log("[Measurements] Adding TTFB"),B.ttfb={value:(i-e.startTimestamp)*1e3,unit:"millisecond"},typeof s=="number"&&s<=i&&(B["ttfb.requestTime"]={value:(i-s)*1e3,unit:"millisecond"})),["fcp","fp","lcp"].forEach(o=>{if(!B[o]||n>=e.startTimestamp)return;let l=B[o].value,u=n+U(l),d=Math.abs((u-e.startTimestamp)*1e3),p=d-l;(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log(`[Measurements] Normalized ${o} from ${l} to ${d} (${p})`),B[o].value=d});let a=B["mark.fid"];a&&B.fid&&(Ye(e,{description:"first input delay",endTimestamp:a.value+U(B.fid.value),op:"ui.action",origin:"auto.ui.browser.metrics",startTimestamp:a.value}),delete B["mark.fid"]),"fcp"in B||delete B.cls,Object.keys(B).forEach(o=>{e.setMeasurement(o,B[o].value,B[o].unit)}),Xu(e)}re=void 0,it=void 0,B={}}function Fu(e,t,n,r,i){let s=i+n,a=s+r;return Ye(e,{description:t.name,endTimestamp:a,op:t.entryType,origin:"auto.resource.browser.metrics",startTimestamp:s}),s}function zu(e,t,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(r=>{Rt(e,t,r,n)}),Rt(e,t,"secureConnection",n,"TLS/SSL","connectEnd"),Rt(e,t,"fetch",n,"cache","domainLookupStart"),Rt(e,t,"domainLookup",n,"DNS"),Vu(e,t,n)}function Rt(e,t,n,r,i,s){let a=s?t[s]:t[`${n}End`],o=t[`${n}Start`];!o||!a||Ye(e,{op:"browser",origin:"auto.browser.browser.metrics",description:i||n,startTimestamp:r+U(o),endTimestamp:r+U(a)})}function Vu(e,t,n){Ye(e,{op:"browser",origin:"auto.browser.browser.metrics",description:"request",startTimestamp:n+U(t.requestStart),endTimestamp:n+U(t.responseEnd)}),Ye(e,{op:"browser",origin:"auto.browser.browser.metrics",description:"response",startTimestamp:n+U(t.responseStart),endTimestamp:n+U(t.responseEnd)})}function Wu(e,t,n,r,i,s){if(t.initiatorType==="xmlhttprequest"||t.initiatorType==="fetch")return;let a={};"transferSize"in t&&(a["http.response_transfer_size"]=t.transferSize),"encodedBodySize"in t&&(a["http.response_content_length"]=t.encodedBodySize),"decodedBodySize"in t&&(a["http.decoded_response_content_length"]=t.decodedBodySize),"renderBlockingStatus"in t&&(a["resource.render_blocking_status"]=t.renderBlockingStatus);let o=s+r,l=o+i;Ye(e,{description:n,endTimestamp:l,op:t.initiatorType?`resource.${t.initiatorType}`:"resource.other",origin:"auto.resource.browser.metrics",startTimestamp:o,data:a})}function Ku(e){let t=I.navigator;if(!t)return;let n=t.connection;n&&(n.effectiveType&&e.setTag("effectiveConnectionType",n.effectiveType),n.type&&e.setTag("connectionType",n.type),pn(n.rtt)&&(B["connection.rtt"]={value:n.rtt,unit:"millisecond"})),pn(t.deviceMemory)&&e.setTag("deviceMemory",`${t.deviceMemory} GB`),pn(t.hardwareConcurrency)&&e.setTag("hardwareConcurrency",String(t.hardwareConcurrency))}function Xu(e){re&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log("[Measurements] Adding LCP Data"),re.element&&e.setTag("lcp.element",Ae(re.element)),re.id&&e.setTag("lcp.id",re.id),re.url&&e.setTag("lcp.url",re.url.trim().slice(0,200)),e.setTag("lcp.size",re.size)),it&&it.sources&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log("[Measurements] Adding CLS Data"),it.sources.forEach((t,n)=>e.setTag(`cls.source.${n+1}`,Ae(t.node))))}var On=["localhost",/^\/(?!\/)/],Pn={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,tracingOrigins:On,tracePropagationTargets:On};function Ju(e){let{traceFetch:t,traceXHR:n,tracePropagationTargets:r,tracingOrigins:i,shouldCreateSpanForRequest:s,enableHTTPTimings:a}=m({traceFetch:Pn.traceFetch,traceXHR:Pn.traceXHR},e),o=typeof s=="function"?s:d=>!0,l=d=>td(d,r||i),u={};t&&Q("fetch",d=>{let p=nd(d,o,l,u);a&&p&&_i(p)}),n&&Q("xhr",d=>{let p=id(d,o,l,u);a&&p&&_i(p)})}function Zu(e){return e.entryType==="resource"&&"initiatorType"in e&&typeof e.nextHopProtocol=="string"&&(e.initiatorType==="fetch"||e.initiatorType==="xmlhttprequest")}function _i(e){let t=e.data.url,n=new PerformanceObserver(r=>{r.getEntries().forEach(i=>{Zu(i)&&i.name.endsWith(t)&&(ed(i).forEach(s=>e.setData(...s)),n.disconnect())})});n.observe({entryTypes:["resource"]})}function Qu(e){let t="unknown",n="unknown",r="";for(let i of e){if(i==="/"){[t,n]=e.split("/");break}if(!isNaN(Number(i))){t=r==="h"?"http":r,n=e.split(r)[1];break}r+=i}return r===e&&(t=r),{name:t,version:n}}function ne(e=0){return((se||performance.timeOrigin)+e)/1e3}function ed(e){let{name:t,version:n}=Qu(e.nextHopProtocol),r=[];return r.push(["network.protocol.version",n],["network.protocol.name",t]),se?[...r,["http.request.redirect_start",ne(e.redirectStart)],["http.request.fetch_start",ne(e.fetchStart)],["http.request.domain_lookup_start",ne(e.domainLookupStart)],["http.request.domain_lookup_end",ne(e.domainLookupEnd)],["http.request.connect_start",ne(e.connectStart)],["http.request.secure_connection_start",ne(e.secureConnectionStart)],["http.request.connection_end",ne(e.connectEnd)],["http.request.request_start",ne(e.requestStart)],["http.request.response_start",ne(e.responseStart)],["http.request.response_end",ne(e.responseEnd)]]:r}function td(e,t){return ct(e,t||On)}function nd(e,t,n,r){if(!er()||!e.fetchData)return;let i=t(e.fetchData.url);if(e.endTimestamp&&i){let f=e.fetchData.__span;if(!f)return;let h=r[f];if(h){if(e.response){h.setHttpStatus(e.response.status);let g=e.response&&e.response.headers&&e.response.headers.get("content-length"),v=parseInt(g);v>0&&h.setData("http.response_content_length",v)}else e.error&&h.setStatus("internal_error");h.finish(),delete r[f]}return}let s=A(),a=s.getScope(),o=s.getClient(),l=a.getSpan(),{method:u,url:d}=e.fetchData,p=i&&l?l.startChild({data:{url:d,type:"fetch","http.method":u},description:`${u} ${d}`,op:"http.client",origin:"auto.http.browser"}):void 0;if(p&&(e.fetchData.__span=p.spanId,r[p.spanId]=p),n(e.fetchData.url)&&o){let f=e.args[0];e.args[1]=e.args[1]||{};let h=e.args[1];h.headers=rd(f,o,a,h,p)}return p}function rd(e,t,n,r,i){let s=i||n.getSpan(),a=s&&s.transaction,{traceId:o,sampled:l,dsc:u}=n.getPropagationContext(),d=s?s.toTraceparent():Xn(o,void 0,l),p=a?a.getDynamicSamplingContext():u||Ft(o,t,n),f=Rn(p),h=typeof Request<"u"&&de(e,Request)?e.headers:r.headers;if(h)if(typeof Headers<"u"&&de(h,Headers)){let g=new Headers(h);return g.append("sentry-trace",d),f&&g.append(wn,f),g}else if(Array.isArray(h)){let g=[...h,["sentry-trace",d]];return f&&g.push([wn,f]),g}else{let g="baggage"in h?h.baggage:void 0,v=[];return Array.isArray(g)?v.push(...g):g&&v.push(g),f&&v.push(f),k(m({},h),{"sentry-trace":d,baggage:v.length>0?v.join(","):void 0})}else return{"sentry-trace":d,baggage:f}}function id(e,t,n,r){let i=e.xhr,s=i&&i[Pe];if(!er()||i&&i.__sentry_own_request__||!i||!s)return;let a=t(s.url);if(e.endTimestamp&&a){let p=i.__sentry_xhr_span_id__;if(!p)return;let f=r[p];f&&(f.setHttpStatus(s.status_code),f.finish(),delete r[p]);return}let o=A(),l=o.getScope(),u=l.getSpan(),d=a&&u?u.startChild({data:k(m({},s.data),{type:"xhr","http.method":s.method,url:s.url}),description:`${s.method} ${s.url}`,op:"http.client",origin:"auto.http.browser"}):void 0;if(d&&(i.__sentry_xhr_span_id__=d.spanId,r[i.__sentry_xhr_span_id__]=d),i.setRequestHeader&&n(s.url))if(d){let p=d&&d.transaction,f=p&&p.getDynamicSamplingContext(),h=Rn(f);mi(i,d.toTraceparent(),h)}else{let p=o.getClient(),{traceId:f,sampled:h,dsc:g}=l.getPropagationContext(),v=Xn(f,void 0,h),b=g||(p?Ft(f,p,l):void 0),T=Rn(b);mi(i,v,T)}return d}function mi(e,t,n){try{e.setRequestHeader("sentry-trace",t),n&&e.setRequestHeader(wn,n)}catch{}}function sd(e,t=!0,n=!0){if(!I||!I.location){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.warn("Could not initialize routing instrumentation due to invalid location");return}let r=I.location.href,i;t&&(i=e({name:I.location.pathname,startTimestamp:se?se/1e3:void 0,op:"pageload",origin:"auto.pageload.browser",metadata:{source:"url"}})),n&&Q("history",({to:s,from:a})=>{if(a===void 0&&r&&r.indexOf(s)!==-1){r=void 0;return}a!==s&&(r=void 0,i&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log(`[Tracing] Finishing current transaction with op: ${i.op}`),i.finish()),i=e({name:I.location.pathname,op:"navigation",origin:"auto.navigation.browser",metadata:{source:"url"}}))})}var ad="BrowserTracing",od=m(k(m({},Ot),{markBackgroundTransactions:!0,routingInstrumentation:sd,startTransactionOnLocationChange:!0,startTransactionOnPageLoad:!0,enableLongTask:!0,_experiments:{}}),Pn),cd=class{constructor(e){this.name=ad,this._hasSetTracePropagationTargets=!1,Jc(),(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&(this._hasSetTracePropagationTargets=!!(e&&(e.tracePropagationTargets||e.tracingOrigins))),this.options=m(m({},od),e),this.options._experiments.enableLongTask!==void 0&&(this.options.enableLongTask=this.options._experiments.enableLongTask),e&&!e.tracePropagationTargets&&e.tracingOrigins&&(this.options.tracePropagationTargets=e.tracingOrigins),this._collectWebVitals=Au(),this.options.enableLongTask&&Lu(),this.options._experiments.enableInteractions&&Gu()}setupOnce(e,t){this._getCurrentHub=t;let n=t().getClient(),r=n&&n.getOptions(),{routingInstrumentation:i,startTransactionOnLocationChange:s,startTransactionOnPageLoad:a,markBackgroundTransactions:o,traceFetch:l,traceXHR:u,shouldCreateSpanForRequest:d,enableHTTPTimings:p,_experiments:f}=this.options,h=r&&r.tracePropagationTargets,g=h||this.options.tracePropagationTargets;(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&this._hasSetTracePropagationTargets&&h&&x.warn("[Tracing] The `tracePropagationTargets` option was set in the BrowserTracing integration and top level `Sentry.init`. The top level `Sentry.init` value is being used."),i(v=>{let b=this._createRouteTransaction(v);return this.options._experiments.onStartRouteTransaction&&this.options._experiments.onStartRouteTransaction(b,v,t),b},a,s),o&&Cu(),f.enableInteractions&&this._registerInteractionListener(),Ju({traceFetch:l,traceXHR:u,tracePropagationTargets:g,shouldCreateSpanForRequest:d,enableHTTPTimings:p})}_createRouteTransaction(e){if(!this._getCurrentHub){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.warn(`[Tracing] Did not create ${e.op} transaction because _getCurrentHub is invalid.`);return}let t=this._getCurrentHub(),{beforeNavigate:n,idleTimeout:r,finalTimeout:i,heartbeatInterval:s}=this.options,a=e.op==="pageload",o=a?gi("sentry-trace"):"",l=a?gi("baggage"):"",{traceparentData:u,dynamicSamplingContext:d,propagationContext:p}=Ec(o,l),f=k(m(m({},e),u),{metadata:k(m({},e.metadata),{dynamicSamplingContext:u&&!d?{}:d}),trimEnd:!0}),h=typeof n=="function"?n(f):f,g=h===void 0?k(m({},f),{sampled:!1}):h;g.metadata=g.name!==f.name?k(m({},g.metadata),{source:"custom"}):g.metadata,this._latestRouteName=g.name,this._latestRouteSource=g.metadata&&g.metadata.source,g.sampled===!1&&(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log(`[Tracing] Will not send ${g.op} transaction because of beforeNavigate.`),(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.log(`[Tracing] Starting ${g.op} transaction on scope`);let{location:v}=I,b=ri(t,g,r,i,!0,{location:v},s),T=t.getScope();return a&&u?T.setPropagationContext(p):T.setPropagationContext({traceId:b.traceId,spanId:b.spanId,parentSpanId:b.parentSpanId,sampled:b.sampled}),b.registerBeforeFinishCallback(S=>{this._collectWebVitals(),Hu(S)}),b}_registerInteractionListener(){let e,t=()=>{let{idleTimeout:n,finalTimeout:r,heartbeatInterval:i}=this.options,s="ui.action.click",a=pt();if(a&&a.op&&["navigation","pageload"].includes(a.op)){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.warn(`[Tracing] Did not create ${s} transaction because a pageload or navigation transaction is in progress.`);return}if(e&&(e.setFinishReason("interactionInterrupted"),e.finish(),e=void 0),!this._getCurrentHub){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.warn(`[Tracing] Did not create ${s} transaction because _getCurrentHub is invalid.`);return}if(!this._latestRouteName){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&x.warn(`[Tracing] Did not create ${s} transaction because _latestRouteName is missing.`);return}let o=this._getCurrentHub(),{location:l}=I,u={name:this._latestRouteName,op:s,trimEnd:!0,metadata:{source:this._latestRouteSource||"url"}};e=ri(o,u,n,r,!0,{location:l},i)};["click"].forEach(n=>{addEventListener(n,t,{once:!1,capture:!0})})}};function gi(e){let t=ko(`meta[name=${e}]`);return t?t.getAttribute("content"):void 0}var ks={};O.Sentry&&O.Sentry.Integrations&&(ks=O.Sentry.Integrations);m(m(m({},ks),ms),js);var ld="https://d233059272824702afc8c43834c4912d@sentry.hcaptcha.com/6",Nt=null;function Cs(e,t){if(e===!1)return hn(e);if(Nt)return hn(Nt,t);let n=new Yl({dsn:ld,transport:window.fetch?Hl:zl,stackParser:cu,integrations:[new Vt,new Ve,new Wt,new Xt,new Kt,new cd]});return Nt=new Qn(n),hn(Nt,t)}function hn(e,t={key:"source",value:"@hCaptcha/loader"}){return{addBreadcrumb:n=>{e&&e.addBreadcrumb(n)},captureMessage:n=>{e&&e.withScope(function(r){r.setTag(t.key,t.value),e.captureMessage(n)})},captureException:n=>{e&&e.withScope(function(r){r.setTag(t.key,t.value),e.captureEvent({message:mn,level:"error",extra:n})})}}}function ud({scriptLocation:e,query:t,loadAsync:n=!0,crossOrigin:r,apihost:i="https://js.hcaptcha.com",cleanup:s=!0,secureApi:a=!1,scriptSource:o=""}={}){let l=qi(e),u=Mi(l);return new Promise((d,p)=>{let f=u.document.createElement("script");f.id=yo,o?f.src=`${o}?onload=${Dt}`:a?f.src=`${i}/1/secure-api.js?onload=${Dt}`:f.src=`${i}/1/api.js?onload=${Dt}`,f.crossOrigin=r,f.async=n;let h=(g,v)=>{try{!a&&s&&l.removeChild(f),v(g)}catch(b){p(b)}};f.onload=g=>h(g,d),f.onerror=g=>h(g,p),f.src+=t!==""?`&${t}`:"",l.appendChild(f)})}var kt=[];function dd(e={cleanup:!0},t){try{t.addBreadcrumb({category:Oe,message:"hCaptcha loader params",data:e});let n=qi(e.scriptLocation),r=Mi(n),i=kt.find(({scope:a})=>a===r.window);if(i)return t.addBreadcrumb({category:Oe,message:"hCaptcha already loaded"}),i.promise;let s=new Promise((a,o)=>Hn(this,null,function*(){try{r.window[Dt]=()=>{t.addBreadcrumb({category:Oe,message:"hCaptcha script called onload function"}),a(r.window.hcaptcha)};let l=go({custom:e.custom,render:e.render,sentry:e.sentry,assethost:e.assethost,imghost:e.imghost,reportapi:e.reportapi,endpoint:e.endpoint,host:e.host,recaptchacompat:e.recaptchacompat,hl:e.hl});yield ud(m({query:l},e)),t.addBreadcrumb({category:Oe,message:"hCaptcha loaded",data:i})}catch(l){t.addBreadcrumb({category:Oe,message:"hCaptcha failed to load",data:l});let u=kt.findIndex(d=>d.scope===r.window);u!==-1&&kt.splice(u,1),t.captureException(l),o(new Error(mn))}}));return kt.push({promise:s,scope:r.window}),s}catch(n){return t.captureException(n),Promise.reject(new Error(mn))}}function Ds(e,t=0){return Hn(this,null,function*(){let n=t<2?"Retry loading hCaptcha Api":"Exceeded maximum retries",r=Cs(e.sentry);try{return yield dd(e,r)}catch(i){return r.addBreadcrumb({SENTRY_SOURCE:Oe,message:n,data:{error:i}}),t>=2?(r.captureException(i),Promise.reject(i)):(t+=1,Ds(e,t))}})}function pd(){return Hn(this,arguments,function*(e={}){return yield Ds(e)})}function yi(e){var t=e&&e.ownerDocument||document,n=t.defaultView||t.parentWindow||window;return{document:t,window:n}}function vi(e){return e||document.head}var Ie={key:"source",value:"@hCaptcha/react"},tt={mounted:"hCaptcha component mounted",expired:"hCaptcha expired",unmounted:"hCaptcha component unmounted",reset:"hCaptcha reset",removed:"hCaptcha removed"},hd=function(e){ho(t,e);function t(r){var i;return i=e.call(this,r)||this,i._hcaptcha=void 0,i.renderCaptcha=i.renderCaptcha.bind(J(i)),i.resetCaptcha=i.resetCaptcha.bind(J(i)),i.removeCaptcha=i.removeCaptcha.bind(J(i)),i.isReady=i.isReady.bind(J(i)),i._onReady=null,i.loadCaptcha=i.loadCaptcha.bind(J(i)),i.handleOnLoad=i.handleOnLoad.bind(J(i)),i.handleSubmit=i.handleSubmit.bind(J(i)),i.handleExpire=i.handleExpire.bind(J(i)),i.handleError=i.handleError.bind(J(i)),i.handleOpen=i.handleOpen.bind(J(i)),i.handleClose=i.handleClose.bind(J(i)),i.handleChallengeExpired=i.handleChallengeExpired.bind(J(i)),i.ref=_.createRef(),i.apiScriptRequested=!1,i.sentryHub=null,i.captchaId="",i.state={isApiReady:!1,isRemoved:!1,elementId:r.id},i}var n=t.prototype;return n.componentDidMount=function(){var i=this,s=vi(this.props.scriptLocation),a=yi(s);this._hcaptcha=a.window.hcaptcha||void 0;var o=typeof this._hcaptcha<"u";if(this.sentryHub=Cs(this.props.sentry,Ie),this.sentryHub.addBreadcrumb({category:Ie.value,message:tt.mounted}),o){this.setState({isApiReady:!0},function(){i.renderCaptcha()});return}this.loadCaptcha()},n.componentWillUnmount=function(){var i=this._hcaptcha,s=this.captchaId;this.isReady()&&(i.reset(s),i.remove(s),this.sentryHub.addBreadcrumb({category:Ie.value,message:tt.unmounted}))},n.shouldComponentUpdate=function(i,s){return!(this.state.isApiReady!==s.isApiReady||this.state.isRemoved!==s.isRemoved)},n.componentDidUpdate=function(i){var s=this,a=["sitekey","size","theme","tabindex","languageOverride","endpoint"],o=a.every(function(l){return i[l]===s.props[l]});o||this.removeCaptcha(function(){s.renderCaptcha()})},n.loadCaptcha=function(){if(!this.apiScriptRequested){var i=this.props,s=i.apihost,a=i.assethost,o=i.endpoint,l=i.host,u=i.imghost,d=i.languageOverride,p=i.reCaptchaCompat,f=i.reportapi,h=i.sentry,g=i.custom,v=i.loadAsync,b=i.scriptLocation,T=i.scriptSource,S=i.secureApi,E=i.cleanup,w=E===void 0?!0:E,j={render:"explicit",apihost:s,assethost:a,endpoint:o,hl:d,host:l,imghost:u,recaptchacompat:p===!1?"off":null,reportapi:f,sentry:h,custom:g,loadAsync:v,scriptLocation:b,scriptSource:T,secureApi:S,cleanup:w};pd(j).then(this.handleOnLoad,this.handleError).catch(this.handleError),this.apiScriptRequested=!0}},n.renderCaptcha=function(i){var s=this,a=this.props.onReady,o=this.state.isApiReady,l=this.captchaId;if(!(!o||l)){var u=Object.assign({"open-callback":this.handleOpen,"close-callback":this.handleClose,"error-callback":this.handleError,"chalexpired-callback":this.handleChallengeExpired,"expired-callback":this.handleExpire,callback:this.handleSubmit},this.props,{hl:this.props.hl||this.props.languageOverride,languageOverride:void 0}),d=this._hcaptcha,p=d.render(this.ref.current,u);this.captchaId=p,this.setState({isRemoved:!1},function(){i&&i(),a&&a(),s._onReady&&s._onReady(p)})}},n.resetCaptcha=function(){var i=this._hcaptcha,s=this.captchaId;this.isReady()&&(i.reset(s),this.sentryHub.addBreadcrumb({category:Ie.value,message:tt.reset}))},n.removeCaptcha=function(i){var s=this._hcaptcha,a=this.captchaId;this.isReady()&&(this.setState({isRemoved:!0},function(){s.remove(a),i&&i()}),this.sentryHub.addBreadcrumb({category:Ie.value,message:tt.removed}))},n.handleOnLoad=function(){var i=this;this.setState({isApiReady:!0},function(){try{var s=vi(i.props.scriptLocation),a=yi(s);i._hcaptcha=a.window.hcaptcha,i.renderCaptcha(function(){var o=i.props.onLoad;o&&o()})}catch(o){i.sentryHub.captureException(o)}})},n.handleSubmit=function(i){var s=this.props.onVerify,a=this.state.isRemoved,o=this._hcaptcha,l=this.captchaId;if(!(typeof o>"u"||a)){var u=o.getResponse(l),d=o.getRespKey(l);s&&s(u,d)}},n.handleExpire=function(){var i=this.props.onExpire,s=this._hcaptcha,a=this.captchaId;this.isReady()&&(s.reset(a),i&&i(),this.sentryHub.addBreadcrumb({category:Ie.value,message:tt.expired}))},n.handleError=function(i){var s=this.props.onError,a=this._hcaptcha,o=this.captchaId;this.isReady()&&a.reset(o),s&&s(i)},n.isReady=function(){var i=this.state,s=i.isApiReady,a=i.isRemoved;return s&&!a},n.handleOpen=function(){!this.isReady()||!this.props.onOpen||this.props.onOpen()},n.handleClose=function(){!this.isReady()||!this.props.onClose||this.props.onClose()},n.handleChallengeExpired=function(){!this.isReady()||!this.props.onChalExpired||this.props.onChalExpired()},n.execute=function(i){var s=this;i===void 0&&(i=null),i=typeof i=="object"?i:null;try{var a=this._hcaptcha,o=this.captchaId;if(!this.isReady()){var l,u=new Promise(function(d,p){s._onReady=function(f){try{var h=s._hcaptcha;i&&i.async?h.execute(f,i).then(d).catch(p):d(h.execute(f,i))}catch(g){p(g)}}});return(l=i)!=null&&l.async?u:null}return a.execute(o,i)}catch(d){return this.sentryHub.captureException(d),i&&i.async?Promise.reject(d):null}},n.close=function(){var i=this._hcaptcha,s=this.captchaId;if(this.isReady())return i.close(s)},n.setData=function(i){var s=this._hcaptcha,a=this.captchaId;this.isReady()&&(i&&typeof i!="object"&&(i=null),s.setData(a,i))},n.getResponse=function(){var i=this._hcaptcha;return i.getResponse(this.captchaId)},n.getRespKey=function(){var i=this._hcaptcha;return i.getRespKey(this.captchaId)},n.render=function(){var i=this.state.elementId;return _.createElement("div",{ref:this.ref,id:i})},t}(_.Component);const Ee=typeof window>"u"?null:window.matchMedia("(prefers-color-scheme: dark)");function fd(){const[e,t]=_.useState(Ee!=null&&Ee.matches?"dark":"light");return _.useEffect(()=>{if(!Ee)return;const n=()=>{t(Ee.matches?"dark":"light")};return Ee.addEventListener("change",n),()=>{Ee.removeEventListener("change",n)}},[]),e}function _d({siteKey:e,token:t,onToken:n,prevLabel:r,onPrev:i,nextLabel:s,onNext:a,ref:o,invalid:l,children:u,...d}){const p=_.useRef(null),f=fd(),[h,g]=_.useState(t),v=_.useCallback(()=>{var S;(S=p.current)==null||S.execute()},[]),b=_.useCallback((S,E)=>{g(S),n(S,E)},[n]),T=_.useCallback(S=>{if(h)return a(S);if(p.current)p.current.execute();else throw new Error("Unable to load hCaptcha")},[h,a]);return c.jsx(He,{...d,cancelLabel:r,onCancel:i,submitLabel:s,onSubmit:T,append:u,invalid:l||!h,children:c.jsx(hd,{theme:f,sitekey:e,onLoad:v,onVerify:b,ref:ye([o,p])})})}function md({customizationData:{availableUserDomains:e=[],hcaptchaSiteKey:t=void 0,inviteCodeRequired:n=!0,links:r}={},onValidateNewHandle:i,onDone:s,onBack:a,backLabel:o,title:l,subtitle:u,...d}){const{i18n:p,_:f}=D(),[h,g]=_.useState(void 0),[v,b]=_.useState(void 0),[T,S]=_.useState(void 0),E=t==null?void 0:T||!1,w=_.useCallback(j=>{if(h&&v&&E!==!1)return s({...h,handle:v,hcaptchaToken:E},j)},[h,v,E,s]);return c.jsxs(ee,{...d,title:l??p._({id:"IS0nrP"}),subtitle:u??c.jsx(y,{id:"qjBGxf"}),children:[c.jsx(so,{doneLabel:c.jsx(y,{id:"e+RpCP"}),onBack:a,backLabel:o,onDone:w,steps:[{invalid:!v,titleRender:()=>c.jsx(y,{id:"khEQ02"}),contentRender:({prev:j,prevLabel:C,next:N,nextLabel:Y,invalid:P})=>c.jsx(po,{className:"grow",invalid:P,domains:e,handle:v,onHandle:b,prevLabel:C,onPrev:j,nextLabel:Y,onNext:async K=>{if(v&&await i({handle:v},K),!K.aborted)return N(K)},children:c.jsx(on,{links:r})})},{invalid:!h,titleRender:()=>c.jsx(y,{id:"gdRnT7"}),contentRender:({prev:j,prevLabel:C,next:N,nextLabel:Y,invalid:P})=>c.jsx(oo,{className:"grow",invalid:P,prevLabel:C,onPrev:j,nextLabel:Y,onNext:N,inviteCodeRequired:n,credentials:h,onCredentials:g,children:c.jsx(on,{links:r})})},t!=null&&{invalid:E===!1,titleRender:()=>c.jsx(y,{id:"aIar4b"}),contentRender:({prev:j,prevLabel:C,next:N,nextLabel:Y,invalid:P})=>c.jsx(_d,{className:"grow",invalid:P,siteKey:t,token:T,onToken:S,prevLabel:C,onPrev:j,nextLabel:Y,onNext:N,children:c.jsx(on,{links:r})})}]}),c.jsx(ao,{className:"mt-4",links:r})]})}function gd({onSignUp:e,onSignIn:t,onCancel:n,...r}){const{i18n:i,_:s}=D();return c.jsxs(Qs,{...r,title:r.title??i._({id:"OX6vme"}),children:[e&&c.jsx(z,{className:"m-1 w-60 min-w-min max-w-full",color:t?"primary":void 0,onClick:e,children:c.jsx(y,{id:"mpt9T+"})}),t&&c.jsx(z,{className:"m-1 w-60 min-w-min max-w-full",color:e?void 0:"primary",onClick:t,children:c.jsx(y,{id:"yKDCQ1"})}),n&&c.jsx(z,{className:"m-1 w-60 min-w-min max-w-full",onClick:n,children:c.jsx(y,{id:"dEgA5A"})})]})}function yd({authorizeData:e,initialSessions:t,customizationData:n,...r}){var ur;const{i18n:i,_:s}=D(),a=e.loginHint!=null,o=!a&&!!((ur=n==null?void 0:n.availableUserDomains)!=null&&ur.length),l=!o||t.length?2:0,[u,d]=_.useState(l),p=ke(d,5),f=ke(d,2),h=ke(d,3),g=ke(d,1),v=ke(d,4),[b,T]=_.useState(void 0),{sessions:S,selectSub:E,doValidateNewHandle:w,doSignUp:j,doSignIn:C,doInitiatePasswordReset:N,doConfirmResetPassword:Y,doConsent:P,doReject:K}=ca({sessions:t,onRedirected:p}),R=!o||S.length?2:0,q=ke(d,R),H=o?g:void 0,F=S.find(Ne=>Ne.selected&&!Ne.loginRequired);if(_.useEffect(()=>{F&&(F.consentRequired?v():P(F.account.sub))},[F,P,v]),_.useEffect(()=>{u===1&&!o&&d(R)},[u,R,!o]),_.useEffect(()=>{u===4&&!F&&d(R)},[u,R,!F]),_.useEffect(()=>{u===0&&R!==0&&d(R)},[u,R]),u===0)return c.jsx(gd,{...r,customizationData:n,onSignIn:f,onSignUp:H,onCancel:K});if(u===1)return c.jsx(md,{...r,customizationData:n,onValidateNewHandle:w,onBack:q,onDone:j});if(u===3)return c.jsx(Ja,{...r,emailDefault:b,onresetPasswordRequest:N,onResetPasswordConfirm:Y,onBack:q});if(u===2)return c.jsx(to,{...r,loginHint:e.loginHint,sessions:S,selectSub:E,onSignIn:C,onSignUp:H,onBack:R===2?K:q,backLabel:R===2?i._({id:"dEgA5A"}):void 0,onForgotPassword:Ne=>{h(),T(Ne)}});if(u===4)return F?c.jsx(La,{...r,clientId:e.clientId,clientMetadata:e.clientMetadata,clientTrusted:e.clientTrusted,clientFirstParty:e.clientFirstParty,account:F.account,scope:e.scope,onConsent:Ne=>P(F.account.sub,Ne),onReject:K,onBack:a?void 0:()=>{E(null),q()}}):null;if(u===5)return c.jsx(ee,{...r,title:r.title??i._({id:"UCOd1e"}),children:c.jsx(y,{id:"qq6QQ5"})});throw new Error("Unexpected application state")}const{__authorizeData:Gt,__customizationData:xi,__sessions:vd}=window,Te=new URL(window.location.href);Te.pathname==="/oauth/authorize"&&!Te.searchParams.has("request_uri")&&(Te.search="",Te.searchParams.set("client_id",Gt.clientId),Te.searchParams.set("request_uri",Gt.requestUri),window.history.replaceState(history.state,"",Te.pathname+Te.search));const xd=document.getElementById("root");var bi;ea.createRoot(xd).render(c.jsx(_.StrictMode,{children:c.jsx(ta,{userLocales:(bi=Gt.uiLocales)==null?void 0:bi.split(" "),children:c.jsx(ra,{fallbackRender:({error:e})=>c.jsx(na,{error:e,customizationData:xi}),children:c.jsx(yd,{authorizeData:Gt,customizationData:xi,initialSessions:vd})})})}))});export default bd();
|
|
20
|
-
//# sourceMappingURL=authorization-page-
|
|
20
|
+
//# sourceMappingURL=authorization-page-CyAyumVs.js.map
|