/*! For license information please see clerk.browser.js.LICENSE.txt */ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(globalThis,(function(){return function(){var e,t,n,r,i={9721:function(e,t,n){"use strict";n.d(t,{Z:function(){return re}});var r=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t0?u(b,--y):0,g--,10===w&&(g=1,m--),w}function P(){return w=y2||E(w)>3?"":" "}function x(e,t){for(;--t&&P()&&!(w<48||w>102||w>57&&w<65||w>70&&w<97););return C(e,O()+(t<6&&32==U()&&32==P()))}function z(e){for(;P();)switch(w){case e:return y;case 34:case 39:34!==e&&39!==e&&z(w);break;case 40:41===e&&z(e);break;case 92:P()}return y}function M(e,t){for(;P()&&e+w!==57&&(e+w!==84||47!==U()););return"/*"+C(t,y-1)+"*"+s(47===e?e:P())}function N(e){for(;!E(U());)P();return C(e,y)}var $="-ms-",L="-moz-",W="-webkit-",D="comm",F="rule",j="decl",V="@keyframes";function K(e,t){for(var n="",r=f(e),i=0;i0&&h(L)-v&&p(w>32?H(L+";",r,n,v-1):H(c(L," ","")+";",r,n,v-2),f);break;case 59:L+=";";default:if(p($=Z(L,t,n,m,g,i,d,I,A=[],z=[],v),a),123===E)if(0===g)B(L,t,$,$,A,a,v,d,z);else switch(99===y&&110===u(L,3)?100:y){case 100:case 108:case 109:case 115:B(e,$,$,r&&p(Z(e,$,$,0,0,i,d,I,i,A=[],v),z),i,z,v,d,r?A:z);break;default:B(L,$,$,$,[""],z,0,d,z)}}m=g=w=0,_=C=1,I=L="",v=o;break;case 58:v=1+h(L),w=b;default:if(_<1)if(123==E)--_;else if(125==E&&0==_++&&125==k())continue;switch(L+=s(E),E*_){case 38:C=g>0?1:(L+="\f",-1);break;case 44:d[m++]=(h(L)-1)*C,C=1;break;case 64:45===U()&&(L+=T(P())),y=U(),g=v=h(I=L+=N(O())),E++;break;case 45:45===b&&2==h(L)&&(_=0)}}return a}function Z(e,t,n,r,s,a,l,u,h,p,m){for(var g=s-1,v=0===s?a:[""],y=f(v),w=0,b=0,S=0;w0?v[k]+" "+P:c(P,/&\f/g,v[k])))&&(h[S++]=U);return _(e,t,n,0===s?F:u,h,p,m)}function G(e,t,n){return _(e,t,n,D,s(w),d(e,2,-2),0)}function H(e,t,n,r){return _(e,t,n,j,d(e,0,r),d(e,r+1,-1),r)}var Y=function(e,t,n){for(var r=0,i=0;r=i,i=U(),38===r&&12===i&&(t[n]=1),!E(i);)P();return C(e,y)},X=new WeakMap,Q=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||X.get(n))&&!r){X.set(e,!0);for(var i=[],a=function(e,t){return A(function(e,t){var n=-1,r=44;do{switch(E(r)){case 0:38===r&&12===U()&&(t[n]=1),e[n]+=Y(y-1,t,n);break;case 2:e[n]+=T(r);break;case 4:if(44===r){e[++n]=58===U()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=s(r)}}while(r=P());return e}(I(e),t))}(t,i),o=n.props,c=0,l=0;c6)switch(u(e,t+1)){case 109:if(45!==u(e,t+4))break;case 102:return c(e,/(.+:)(.+)-([^]+)/,"$1"+W+"$2-$3$1"+L+(108==u(e,t+3)?"$3":"$2-$3"))+e;case 115:return~l(e,"stretch")?te(c(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==u(e,t+1))break;case 6444:switch(u(e,h(e)-3-(~l(e,"!important")&&10))){case 107:return c(e,":",":"+W)+e;case 101:return c(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+W+(45===u(e,14)?"inline-":"")+"box$3$1"+W+"$2$3$1"+$+"$2box$3")+e}break;case 5936:switch(u(e,t+11)){case 114:return W+e+$+c(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return W+e+$+c(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return W+e+$+c(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return W+e+$+e+e}return e}var ne=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case j:e.return=te(e.value,e.length);break;case V:return K([S(e,{value:c(e.value,"@","@"+W)})],r);case F:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return K([S(e,{props:[c(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return K([S(e,{props:[c(t,/:(plac\w+)/,":"+W+"input-$1")]}),S(e,{props:[c(t,/:(plac\w+)/,":-moz-$1")]}),S(e,{props:[c(t,/:(plac\w+)/,$+"input-$1")]})],r)}return""}))}}],re=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var i,s,a=e.stylisPlugins||ne,o={},c=[];i=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n=4;++r,i-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(i){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(i)+c;return{name:l,styles:i,next:h}}},2668:function(e,t,n){"use strict";var r;n.d(t,{L:function(){return a}});var i=n(2784),s=!!(r||(r=n.t(i,2))).useInsertionEffect&&(r||(r=n.t(i,2))).useInsertionEffect,a=s||function(e){return e()};s||i.useLayoutEffect},1096:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function a(e){try{c(r.next(e))}catch(t){s(t)}}function o(e){try{c(r.throw(e))}catch(t){s(t)}}function c(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(a,o)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,s,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(s){return function(o){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]0?setTimeout(n,t):n()}}window.addEventListener("storage",a),e.addToWaiting(a);var o=setTimeout(a,Math.max(0,t-Date.now()))}))];case 1:return n.sent(),[2]}}))}))},e.addToWaiting=function(t){this.removeFromWaiting(t),void 0!==e.waiters&&e.waiters.push(t)},e.removeFromWaiting=function(t){void 0!==e.waiters&&(e.waiters=e.waiters.filter((function(e){return e!==t})))},e.notifyWaiters=function(){void 0!==e.waiters&&e.waiters.slice().forEach((function(e){return e()}))},e.prototype.releaseLock=function(e){return r(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.releaseLock__private__(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.releaseLock__private__=function(t){return r(this,void 0,void 0,(function(){var n,r,o;return i(this,(function(i){switch(i.label){case 0:return n=window.localStorage,r=a+"-"+t,null===(o=n.getItem(r))?[2]:(o=JSON.parse(o)).id!==this.id?[3,2]:[4,s.default().lock(o.iat)];case 1:i.sent(),this.acquiredIatSet.delete(o.iat),n.removeItem(r),s.default().unlock(o.iat),e.notifyWaiters(),i.label=2;case 2:return[2]}}))}))},e.lockCorrector=function(){for(var t=Date.now()-5e3,n=window.localStorage,r=Object.keys(n),i=!1,s=0;s1)||"/"!==d&&void 0!==d||"/"!==f&&void 0!==f?i+="([^/]*)":(i+="((?:[^/]*(?:/|$))*)",l++):i+=".*";break;default:i+=n}return c&&~c.indexOf("g")||(i="^"+i+"$"),new RegExp(i,c)}},3463:function(e,t,n){"use strict";var r=n(8570),i={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},s={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},o={};function c(e){return r.isMemo(e)?a:o[e.$$typeof]||i}o[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},o[r.Memo]=a;var l=Object.defineProperty,u=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,h=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,p=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(p){var i=f(n);i&&i!==p&&e(t,i,r)}var a=u(n);d&&(a=a.concat(d(n)));for(var o=c(t),m=c(n),g=0;g=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(c&&l){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;I(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:T(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}(e.exports);try{regeneratorRuntime=t}catch(n){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}},9841:function(e,t,n){"use strict";n.d(t,{O1:function(){return o},Yt:function(){return r},bf:function(){return l},cD:function(){return s},hz:function(){return u},im:function(){return c},v_:function(){return i},w9:function(){return a}});const r=["redirect_url","after_sign_in_url","after_sign_up_url","sign_in_force_redirect_url","sign_in_fallback_redirect_url","sign_up_force_redirect_url","sign_up_fallback_redirect_url"],i="__clerk_modal_state",s="__clerk_synced",a="__clerk_satellite_url",o={FORM_IDENTIFIER_NOT_FOUND:"form_identifier_not_found",FORM_PASSWORD_INCORRECT:"form_password_incorrect",INVALID_STRATEGY_FOR_USER:"strategy_for_user_invalid",NOT_ALLOWED_TO_SIGN_UP:"not_allowed_to_sign_up",OAUTH_ACCESS_DENIED:"oauth_access_denied",OAUTH_EMAIL_DOMAIN_RESERVED_BY_SAML:"oauth_email_domain_reserved_by_saml",NOT_ALLOWED_ACCESS:"not_allowed_access",SAML_USER_ATTRIBUTE_MISSING:"saml_user_attribute_missing",USER_LOCKED:"user_locked"},c=["email_address","phone_number","username"],l=["email_address","phone_number","username","first_name","last_name"],u=350},361:function(e,t,n){"use strict";n.d(t,{$C:function(){return I},C:function(){return p},Dg:function(){return a},FI:function(){return O},Fo:function(){return h},G6:function(){return l},HE:function(){return u},O7:function(){return f},PQ:function(){return C},RE:function(){return E},Rz:function(){return m},WC:function(){return y},Ws:function(){return w},Xp:function(){return s},_5:function(){return k},an:function(){return i},cT:function(){return S},ep:function(){return v},k2:function(){return c},lb:function(){return g},qO:function(){return b},qW:function(){return P},rn:function(){return d},sY:function(){return U},xZ:function(){return _},yI:function(){return o}});const r="ClerkJS:";function i(e,t){throw new Error(`${r} Network error at "${e}" - ${t}. Please try again.`)}function s(){throw new Error(`${r} Something went wrong initializing Clerk.`)}function a(e=""){throw new Error(`${r} Something went wrong initializing Clerk in development mode.${e&&` ${e}`}`)}function o(e){throw new Error(`${r} Missing path option. The ${e} component was mounted with path routing so you need to specify the path where the component is mounted on e.g. path="/sign-in".`)}function c(e){throw new Error(`${r} You must wrap your application in a <${e}> component.`)}function l(){throw new Error(`${r} Clerk is undefined`)}function u(){throw new Error(`${r} The target element is empty. Provide a valid DOM element.`)}function d(){throw new Error(`${r} Missing FAPI client in resources.`)}function h(e){throw new Error(`${r} Token refresh failed (error='${e}')`)}function f(e){throw new Error(`${r} Something went wrong initializing Clerk during the ${e} flow. Please contact support.`)}function p(e){throw new Error(`${r} You need to start a ${e} flow by calling ${e}.create() first.`)}function m(e,t){throw new Error(`${r} Strategy "${t}" is not a valid strategy for ${e}.`)}function g(e){throw new Error(`${r} You need to start a ${e} flow by calling ${e}.create({ identifier: 'your web3 wallet address' }) first`)}function v(){throw new Error(`${r} You need to start a SignIn flow by calling SignIn.create({ strategy: 'passkey' }) first`)}function y(e=""){throw new Error(`${r} Missing '${e}' option`)}function w(e,t){throw new Error(`${r} Response: ${e||0} not supported yet.\nFor more information contact us at ${t}`)}function b(){throw new Error(`${r} Missing dev browser jwt. Please contact support.`)}function _(){throw new Error(`${r} Missing domain and proxyUrl. A satellite application needs to specify a domain or a proxyUrl.`)}function S(){throw new Error(`${r} The signInUrl needs to be on a different origin than your satellite application.`)}function k(){throw new Error(`${r} The signInUrl needs to have a absolute url format.`)}function P(){throw new Error(`${r} Missing signInUrl. A satellite application needs to specify the signInUrl for development instances.`)}function U(){throw new Error(`${r} Invalid redirect_url. A valid http or https url should be used for the redirection.`)}function O(e){throw new Error(`${r} Unable to retrieve a third party script${e?` ${e}`:""}.`)}function C(e){throw new Error(`${r} Invalid routing strategy, path cannot be used in tandem with ${e}.`)}function E(e){throw new Error(`${r} Calling ${e}.reload is not currently supported. Please contact support.`)}function I(e){throw new Error(`${r} Missing publicKey. When calling 'navigator.credentials.${e}()' it is required to pass a publicKey object.`)}},7084:function(e,t,n){"use strict";n.d(t,{U:function(){return r},Y:function(){return i}});const r={TokenUpdate:"token:update"},i=(()=>{const e=new Map;return{on:(t,n)=>{var r;e.get(t)||e.set(t,[]),null===(r=e.get(t))||void 0===r||r.push(n)},dispatch:(t,n)=>{(e.get(t)||[]).forEach((e=>"function"==typeof e&&e(n)))},off:(t,n)=>{const r=e.get(t)||[];r.length&&(n&&e.set(t,r.filter((e=>e!==n))),e.set(t,[]))}}})()},3351:function(e,t,n){"use strict";n.d(t,{g:function(){return a}});var r=n(2022),i=n(2045),s=n(361);function a(e){const t=[],n=[];function a({method:t,path:n,sessionId:r,search:s,rotatingTokenNonce:a}){const o=new URLSearchParams(s);e.version&&o.append("_clerk_js_version",e.version),a&&o.append("rotating_token_nonce",a),"development"===e.instanceType&&e.isSatellite&&o.append("__domain",e.domain),t&&"GET"!==t&&"POST"!==t&&o.append("_method",t),n&&!n.startsWith("/client")&&r&&o.append("_clerk_session_id",r);const c=[...o.entries()].reduce(((e,[t,n])=>(e[t]=n.includes(",")?n.split(","):n,e)),{});return(0,i.f0)(c)}function o(t){const{path:n,pathPrefix:r="v1"}=t,{proxyUrl:s,domain:o,frontendApi:c,instanceType:l}=e,u="production"===l?o:"";if(s){const e=new URL(s),o=e.pathname.slice(1,e.pathname.length);return(0,i.KV)({base:e.origin,pathname:`${o}/${r}${n}`,search:a(t)},{stringify:!1})}return(0,i.KV)({base:`https://${u||c}`,pathname:`${r}${n}`,search:a(t)},{stringify:!1})}return{buildEmailAddress:function(t){return(0,i.aR)({localPart:t,frontendApi:e.frontendApi})},buildUrl:o,onAfterResponse:function(e){n.push(e)},onBeforeRequest:function(e){t.push(e)},request:async function(a){var c;let{method:l="GET",body:u}=a;a.url=o({...a,sessionId:null===(c=e.session)||void 0===c?void 0:c.id}),a.headers||(a.headers=new Headers),"GET"===l||u instanceof FormData||a.headers.has("content-type")||a.headers.set("content-type","application/x-www-form-urlencoded"),"application/x-www-form-urlencoded"===a.headers.get("content-type")&&(a.body=u?(0,i.f0)(u,{keyEncoder:r.a1}):u);const d=await async function(e){const n="undefined"!=typeof window&&window.__unstable__onBeforeRequest;for await(const r of[n,...t].filter((e=>e)))if(!1===await r(e))return!1;return!0}(a),h="GET"===l?"GET":"POST";let f;const p=a.url.toString(),m={...a,credentials:"include",method:h};try{if(d){const e=(0,r.TN)()?4:11;f="GET"===h?await(0,r.$V)((()=>fetch(p,m)),{firstDelay:500,maxDelay:3e3,shouldRetry:(t,n)=>ne)))if(!1===await i(e,t))return!1;return!0}(a,v),v}}}},7984:function(e,t,n){"use strict";n.d(t,{Tg:function(){return o},i:function(){return s},gO:function(){return w.gO},w$:function(){return w.w$},KU:function(){return d},FF:function(){return h},lR:function(){return f},b5:function(){return m},N:function(){return w.N},_L:function(){return w._L},qA:function(){return v},z:function(){return O},YN:function(){return C},Ee:function(){return E},cp:function(){return M},$h:function(){return N},fr:function(){return $},wJ:function(){return L},Vk:function(){return B},P$:function(){return k},Bh:function(){return I},VO:function(){return Z},gt:function(){return W},z_:function(){return J},Ax:function(){return G},cL:function(){return X},Mo:function(){return ne},EJ:function(){return P},GF:function(){return ie},WU:function(){return re},n5:function(){return oe},mt:function(){return Q},ff:function(){return ce},PG:function(){return a},GX:function(){return S},q2:function(){return le},kD:function(){return w.kD},uX:function(){return w.uX},sZ:function(){return w.sZ},ZC:function(){return w.ZC}});var r=n(305),i=n(361);class s{constructor(){this.pathRoot=""}static get fapiClient(){return s.clerk.getFapiClient()}static async _fetch(e,t={}){let n;s.fapiClient||(0,i.rn)();try{n=await s.fapiClient.request(e)}catch(u){if((0,r.af)())throw u;return console.warn(u),null}const{payload:a,status:o,statusText:c,headers:l}=n;if(l){const e=l.get("x-country");this.clerk.__internal_setCountry(e?e.toLowerCase():null)}if(("GET"!==e.method||t.forceUpdateClient)&&this._updateClient(a),o>=200&&o<=299)return a;if(401===o&&await s.clerk.handleUnauthenticated(),o>=400)throw new w.gO(c,{data:null==a?void 0:a.errors,status:o});return null}static _updateClient(e){var t;if(!e)return;const n=e.client||(null===(t=e.meta)||void 0===t?void 0:t.client);n&&s.clerk&&s.clerk.updateClient(d.getInstance().fromJSON(n))}isNew(){return!this.id}path(e){const t=this.pathRoot;if(this.isNew())return t;const n=t.replace(/[^/]$/,"$&/")+encodeURIComponent(this.id);return e?n.replace(/[^/]$/,"$&/")+encodeURIComponent(e):n}async _baseGet(e={}){const t=await s._fetch({method:"GET",path:this.path(),rotatingTokenNonce:e.rotatingTokenNonce},e);return this.fromJSON((null==t?void 0:t.response)||t)}async _baseMutate({action:e,body:t,method:n="POST",path:r}){const i=await s._fetch({method:n,path:r||this.path(e),body:t});return this.fromJSON((null==i?void 0:i.response)||i)}async _basePost(e={}){return this._baseMutate({...e,method:"POST"})}async _basePut(e={}){return this._baseMutate({...e,method:"PUT"})}async _basePatch(e={}){return this._baseMutate({...e,method:"PATCH"})}async _baseDelete(e={}){await this._baseMutate({...e,method:"DELETE"})}async reload(e){const{rotatingTokenNonce:t}=e||{};return this._baseGet({forceUpdateClient:!0,rotatingTokenNonce:t})}}class a extends s{constructor(e){super(),this.id=void 0,this.socialProviderStrategies=[],this.authenticatableSocialStrategies=[],this.web3FirstFactors=[],this.enabledFirstFactorIdentifiers=[],this.fromJSON(e)}get instanceIsPasswordBased(){return this.attributes.password.enabled&&this.attributes.password.required}get hasValidAuthFactor(){return this.attributes.email_address.enabled||this.attributes.phone_number.enabled||this.attributes.password.required&&this.attributes.username.required}fromJSON(e){var t,n,r;return e?(this.social=e.social,this.saml=e.saml,this.attributes=Object.fromEntries(Object.entries(e.attributes).map((e=>[e[0],{...e[1],name:e[0]}]))),this.actions=e.actions,this.signIn=e.sign_in,this.signUp=e.sign_up,this.passwordSettings={...e.password_settings,min_length:Math.max(null===(t=null==e?void 0:e.password_settings)||void 0===t?void 0:t.min_length,8),max_length:0===(null===(n=null==e?void 0:e.password_settings)||void 0===n?void 0:n.max_length)?72:Math.min(null===(r=null==e?void 0:e.password_settings)||void 0===r?void 0:r.max_length,72)},this.passkeySettings=e.passkey_settings,this.socialProviderStrategies=this.getSocialProviderStrategies(e.social),this.authenticatableSocialStrategies=this.getAuthenticatableSocialStrategies(e.social),this.web3FirstFactors=this.getWeb3FirstFactors(this.attributes),this.enabledFirstFactorIdentifiers=this.getEnabledFirstFactorIdentifiers(this.attributes),this):this}getEnabledFirstFactorIdentifiers(e){return e?Object.entries(e).filter((([e,t])=>t.used_for_first_factor&&!e.startsWith("web3"))).map((([e])=>e)):[]}getWeb3FirstFactors(e){return e?Object.entries(e).filter((([e,t])=>t.used_for_first_factor&&e.startsWith("web3"))).map((([,e])=>e.first_factors)).flat():[]}getSocialProviderStrategies(e){return e?Object.entries(e).filter((([,e])=>e.enabled)).map((([,e])=>e.strategy)).sort():[]}getAuthenticatableSocialStrategies(e){return e?Object.entries(e).filter((([,e])=>e.enabled&&e.authenticatable)).map((([,e])=>e.strategy)).sort():[]}}class o extends s{constructor(e){super(),this.fromJSON(e)}fromJSON(e){return this.singleSessionMode=!e||e.single_session_mode,this}}function c(e){const t=new Date(e||new Date);return(n=t)instanceof Date&&!isNaN(n.getTime())?t:new Date;var n}class l{static fromKey(e){const[t,n,r=""]=e.split("::");return new l(t,{audience:r,tokenId:n})}constructor(e,t){this.prefix=e,this.data=t,this.prefix=e,this.data=t}toKey(){const{tokenId:e,audience:t}=this.data;return[this.prefix,e,t||""].join("::")}}const u=((e="clerk")=>{const t=new Map;let n;return{get:(n,r=10)=>{const i=new l(e,n),s=t.get(i.toKey());if(!s)return;const a=Math.floor(Date.now()/1e3)-s.createdAt;if(!(s.expiresIn-a<(r||1)+5))return s.entry;t.delete(i.toKey())},set:r=>{const i=new l(e,{audience:r.audience,tokenId:r.tokenId}).toKey(),s={entry:r,createdAt:Math.floor(Date.now()/1e3)},a=()=>{t.get(i)===s&&t.delete(i)};r.tokenResolver.then((e=>{if(!e.jwt)return a();const t=e.jwt.claims.exp-e.jwt.claims.iat;s.expiresIn=t,n=setTimeout(a,1e3*t),"function"==typeof n.unref&&n.unref()})).catch((()=>{a()})),t.set(i,s)},clear:()=>{clearTimeout(n),t.clear()},size:()=>t.size}})();class d extends s{static getInstance(){return d.instance||(d.instance=new d),d.instance}static isClientResource(e){return!!e&&e instanceof d}constructor(e=null){super(),this.pathRoot="/client",this.sessions=[],this.signUp=new ne,this.signIn=new X,this.lastActiveSessionId=null,this.createdAt=null,this.updatedAt=null,this.fromJSON(e)}get signUpAttempt(){return this.signUp}get signInAttempt(){return this.signIn}get activeSessions(){return this.sessions.filter((e=>"active"===e.status))}create(){return this._basePut()}fetch(){return this._baseGet()}async destroy(){return this._baseDelete({path:"/client"}).then((()=>{u.clear(),this.sessions=[],this.signUp=new ne(null),this.signIn=new X(null),this.lastActiveSessionId=null,this.createdAt=null,this.updatedAt=null}))}clearCache(){return this.sessions.forEach((e=>e.clearCache()))}fromJSON(e){return e&&(this.id=e.id,this.sessions=(e.sessions||[]).map((e=>new J(e))),this.signUp=new ne(e.sign_up),this.signIn=new X(e.sign_in),this.lastActiveSessionId=e.last_active_session_id,this.createdAt=c(e.created_at),this.updatedAt=c(e.updated_at)),this}path(){return this.pathRoot}}class h{constructor(e){this.object="",this.deleted=!1,this.fromJSON(e)}fromJSON(e){return e?(this.object=e.object,this.id=e.id,this.slug=e.slug,this.deleted=e.deleted,this):this}}class f extends s{constructor(e){super(),this.captchaPublicKey=null,this.captchaWidgetType=null,this.captchaProvider="turnstile",this.captchaPublicKeyInvisible=null,this.fromJSON(e)}fromJSON(e){return e?(this.id=e.id,this.instanceEnvironmentType=e.instance_environment_type,this.applicationName=e.application_name,this.theme=e.theme,this.preferredSignInStrategy=e.preferred_sign_in_strategy,this.logoImageUrl=e.logo_image_url,this.faviconImageUrl=e.favicon_image_url,this.homeUrl=e.home_url,this.signInUrl=e.sign_in_url,this.signUpUrl=e.sign_up_url,this.userProfileUrl=e.user_profile_url,this.afterSignInUrl=e.after_sign_in_url,this.afterSignUpUrl=e.after_sign_up_url,this.afterSignOutOneUrl=e.after_sign_out_one_url,this.afterSignOutAllUrl=e.after_sign_out_all_url,this.afterSwitchSessionUrl=e.after_switch_session_url,this.branded=e.branded,this.captchaPublicKey=e.captcha_public_key,this.captchaWidgetType=e.captcha_widget_type,this.captchaProvider=e.captcha_provider,this.captchaPublicKeyInvisible=e.captcha_public_key_invisible,this.supportEmail=e.support_email||"",this.clerkJSVersion=e.clerk_js_version,this.organizationProfileUrl=e.organization_profile_url,this.createOrganizationUrl=e.create_organization_url,this.afterLeaveOrganizationUrl=e.after_leave_organization_url,this.afterCreateOrganizationUrl=e.after_create_organization_url,this.googleOneTapClientId=e.google_one_tap_client_id,this):this}}var p=n(2351);n(7498);class m extends s{constructor(e,t){super(),this.emailAddress="",this.linkedTo=[],this.prepareVerification=e=>this._basePost({action:"prepare_verification",body:{...e}}),this.attemptVerification=e=>{const{code:t}=e||{};return this._basePost({action:"attempt_verification",body:{code:t}})},this.createEmailLinkFlow=()=>{const{run:e,stop:t}=(0,p.Ww)();return{startEmailLinkFlow:async({redirectUrl:n})=>(this.id||(0,i.C)("SignUp"),await this.prepareVerification({strategy:"email_link",redirectUrl:n}),new Promise(((n,r)=>{e((()=>this.reload().then((e=>{"verified"===e.verification.status&&(t(),n(e))})).catch((e=>{t(),r(e)}))))}))),cancelEmailLinkFlow:t}},this.destroy=()=>this._baseDelete(),this.toString=()=>this.emailAddress,this.pathRoot=t,this.fromJSON(e)}create(){return this._basePost({body:{email_address:this.emailAddress}})}fromJSON(e){return e?(this.id=e.id,this.emailAddress=e.email_address,this.verification=new S(e.verification),this.linkedTo=(e.linked_to||[]).map((e=>new C(e))),this):this}}class g extends s{constructor(e){super(),this.fromJSON(e)}fromJSON(e){const{enabled:t=!1,max_allowed_memberships:n=0,actions:r,domains:i}=e||{};return this.enabled=t,this.maxAllowedMemberships=n,this.actions={adminDelete:(null==r?void 0:r.admin_delete)||!1},this.domains={enabled:(null==i?void 0:i.enabled)||!1,enrollmentModes:(null==i?void 0:i.enrollment_modes)||[]},this}}class v extends s{static getInstance(){return v.instance||(v.instance=new v),v.instance}constructor(e=null){super(),this.pathRoot="/environment",this.isSingleSession=()=>this.authConfig.singleSessionMode,this.isProduction=()=>"production"===this.displayConfig.instanceEnvironmentType,this.isDevelopmentOrStaging=()=>!this.isProduction(),this.onWindowLocationHost=()=>this.displayConfig.backendHost===window.location.host,this.fromJSON(e)}fetch({touch:e=!1}){return e?this._basePatch({}):this._baseGet()}fromJSON(e){return e&&(this.authConfig=new o(e.auth_config),this.displayConfig=new f(e.display_config),this.userSettings=new a(e.user_settings),this.organizationSettings=new g(e.organization_settings),this.maintenanceMode=e.maintenance_mode),this}}var y,w=n(221),b=n(2022),_=n(969);class S extends s{constructor(e){super(),this.pathRoot="",this.status=null,this.strategy=null,this.nonce=null,this.externalVerificationRedirectURL=null,this.attempts=null,this.expireAt=null,this.error=null,this.verifiedAtClient=null,this.verifiedFromTheSameClient=()=>{var e,t;return this.verifiedAtClient===(null===(t=null===(e=s.clerk)||void 0===e?void 0:e.client)||void 0===t?void 0:t.id)},this.fromJSON(e)}fromJSON(e){return e&&(this.status=e.status,this.verifiedAtClient=e.verified_at_client,this.strategy=e.strategy,this.nonce=e.nonce||null,e.external_verification_redirect_url?this.externalVerificationRedirectURL=new URL(e.external_verification_redirect_url):this.externalVerificationRedirectURL=null,this.attempts=e.attempts,this.expireAt=c(e.expire_at),this.error=e.error?(0,w.nU)(e.error):null),this}}class k extends S{constructor(e){super(e),this.publicKey=null,this.fromJSON(e)}fromJSON(e){return super.fromJSON(e),(null==e?void 0:e.nonce)&&(this.publicKey=(0,_.GH)(JSON.parse(e.nonce))),this}}class P{constructor(e){e?(this.emailAddress=new U(e.email_address),this.phoneNumber=new U(e.phone_number),this.web3Wallet=new U(e.web3_wallet),this.externalAccount=new S(e.external_account)):(this.emailAddress=new U(null),this.phoneNumber=new U(null),this.web3Wallet=new U(null),this.externalAccount=new S(null))}}class U extends S{constructor(e){super(e),e?(this.nextAction=e.next_action,this.supportedStrategies=e.supported_strategies):(this.nextAction="",this.supportedStrategies=[])}}class O extends s{constructor(e,t){super(),this.providerUserId="",this.emailAddress="",this.approvedScopes="",this.firstName="",this.lastName="",this.imageUrl="",this.username="",this.publicMetadata={},this.label="",this.verification=null,this.reauthorize=e=>{const{additionalScopes:t,redirectUrl:n}=e||{};return this._basePatch({action:"reauthorize",body:{additional_scope:t,redirect_url:n}})},this.destroy=()=>this._baseDelete(),this.pathRoot=t,this.fromJSON(e)}fromJSON(e){return e?(this.id=e.id,this.identificationId=e.identification_id,this.providerUserId=e.provider_user_id,this.approvedScopes=e.approved_scopes,this.imageUrl=e.image_url,this.emailAddress=e.email_address,this.firstName=e.first_name,this.lastName=e.last_name,this.provider=(e.provider||"").replace("oauth_",""),this.username=e.username,this.publicMetadata=e.public_metadata,this.label=e.label,e.verification&&(this.verification=new S(e.verification)),this):this}providerSlug(){return this.provider}providerTitle(){return[(0,b.up)(this.providerSlug()),"Account"].join(" ")}accountIdentifier(){return this.username||this.emailAddress||this.label}}class C extends s{constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e?(this.id=e.id,this.type=e.type,this):this}}class E extends s{static async create(e,t={}){var n;let r,i=t;"string"==typeof t.file?(i=t.file,r=new Headers({"Content-Type":"application/octet-stream"})):t.file&&(i=new FormData,i.append("file",t.file));const a=null===(n=await s._fetch({path:e,method:"POST",body:i,headers:r}))||void 0===n?void 0:n.response;return new E(a)}static async delete(e){var t;const n=null===(t=await s._fetch({path:e,method:"DELETE"}))||void 0===t?void 0:t.response;return new E(n)}constructor(e){super(),this.name=null,this.publicUrl=null,this.fromJSON(e)}fromJSON(e){return e?(this.id=e.id,this.name=e.name,this.publicUrl=e.public_url,this):this}}class I extends s{constructor(e,t){super(),this.phoneNumber="",this.reservedForSecondFactor=!1,this.defaultSecondFactor=!1,this.linkedTo=[],this.create=()=>this._basePost({body:{phone_number:this.phoneNumber}}),this.prepareVerification=()=>this._basePost({action:"prepare_verification",body:{strategy:"phone_code"}}),this.attemptVerification=e=>{const{code:t}=e||{};return this._basePost({action:"attempt_verification",body:{code:t}})},this.setReservedForSecondFactor=e=>{const{reserved:t}=e||{};return this._basePatch({body:{reserved_for_second_factor:t}})},this.makeDefaultSecondFactor=()=>this._basePatch({body:{default_second_factor:!0}}),this.destroy=()=>this._baseDelete(),this.toString=()=>{const e=this.phoneNumber.match(/^(\d{3})(\d{3})(\d{4})$/);return e?"("+e[1]+") "+e[2]+"-"+e[3]:this.phoneNumber},this.pathRoot=t,this.fromJSON(e)}fromJSON(e){return e?(this.id=e.id,this.phoneNumber=e.phone_number,this.reservedForSecondFactor=e.reserved_for_second_factor,this.defaultSecondFactor=e.default_second_factor,this.verification=new S(e.verification),this.linkedTo=(e.linked_to||[]).map((e=>new C(e))),this.backupCodes=e.backup_codes,this):this}}function A(e){const{pageSize:t,initialPage:n,...r}=e||{},i=null!=t?t:10,s=null!=n?n:1,a={...(0,b.L4)(r),limit:i+"",offset:(s-1)*i+""};return new URLSearchParams(a)}class T extends s{constructor(e){super(),this.prepareAffiliationVerification=async e=>this._basePost({path:`/organizations/${this.organizationId}/domains/${this.id}/prepare_affiliation_verification`,method:"POST",body:e}),this.attemptAffiliationVerification=async e=>this._basePost({path:`/organizations/${this.organizationId}/domains/${this.id}/attempt_affiliation_verification`,method:"POST",body:e}),this.updateEnrollmentMode=e=>this._basePost({path:`/organizations/${this.organizationId}/domains/${this.id}/update_enrollment_mode`,body:e}),this.delete=()=>this._baseDelete({path:`/organizations/${this.organizationId}/domains/${this.id}`}),this.fromJSON(e)}static async create(e,{name:t}){var n;const r=null===(n=await s._fetch({path:`/organizations/${e}/domains`,method:"POST",body:{name:t}}))||void 0===n?void 0:n.response;return new T(r)}fromJSON(e){return e&&(this.id=e.id,this.name=e.name,this.organizationId=e.organization_id,this.enrollmentMode=e.enrollment_mode,this.affiliationEmailAddress=e.affiliation_email_address,this.totalPendingSuggestions=e.total_pending_suggestions,this.totalPendingInvitations=e.total_pending_invitations,e.verification?this.verification={status:e.verification.status,strategy:e.verification.strategy,attempts:e.verification.attempts,expiresAt:c(e.verification.expires_at)}:this.verification=null),this}}class R extends s{constructor(e){super(),this.accept=async()=>await this._basePost({path:`/organizations/${this.organizationId}/membership_requests/${this.id}/accept`}),this.reject=async()=>await this._basePost({path:`/organizations/${this.organizationId}/membership_requests/${this.id}/reject`}),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.organizationId=e.organization_id,this.status=e.status,this.createdAt=c(e.created_at),this.updatedAt=c(e.updated_at),e.public_user_data&&(this.publicUserData=new Z(e.public_user_data))),this}}class x extends s{constructor(e){super(),this.fromJSON(e)}fromJSON(e){return e?(this.id=e.id,this.key=e.key,this.name=e.name,this.description=e.description,this.type=e.type,this.createdAt=c(e.created_at),this.updatedAt=c(e.updated_at),this):this}}class z extends s{constructor(e){super(),this.permissions=[],this.fromJSON(e)}fromJSON(e){return e?(this.id=e.id,this.key=e.key,this.name=e.name,this.description=e.description,this.permissions=e.permissions.map((e=>new x(e))),this.createdAt=c(e.created_at),this.updatedAt=c(e.updated_at),this):this}}class M extends s{constructor(e){super(),this.pathRoot="/organizations",this.publicMetadata={},this.membersCount=0,this.pendingInvitationsCount=0,this.update=async e=>this._basePatch({body:e}),this.getRoles=async e=>await s._fetch({path:`/organizations/${this.id}/roles`,method:"GET",search:A(e)},{forceUpdateClient:!0}).then((e=>{const{data:t,total_count:n}=null==e?void 0:e.response;return{total_count:n,data:t.map((e=>new z(e)))}})),this.getDomains=async e=>await s._fetch({path:`/organizations/${this.id}/domains`,method:"GET",search:A(e)},{forceUpdateClient:!0}).then((e=>{const{data:t,total_count:n}=null==e?void 0:e.response;return{total_count:n,data:t.map((e=>new T(e)))}})),this.getDomain=async({domainId:e})=>{var t;const n=null===(t=await s._fetch({path:`/organizations/${this.id}/domains/${e}`,method:"GET"}))||void 0===t?void 0:t.response;return new T(n)},this.getMembershipRequests=async e=>await s._fetch({path:`/organizations/${this.id}/membership_requests`,method:"GET",search:A(e)}).then((e=>{const{data:t,total_count:n}=null==e?void 0:e.response;return{total_count:n,data:t.map((e=>new R(e)))}})),this.createDomain=async e=>T.create(this.id,{name:e}),this.getMemberships=async e=>await s._fetch({path:`/organizations/${this.id}/memberships`,method:"GET",search:A({...e,paginated:!0})}).then((e=>{const{data:t,total_count:n}=null==e?void 0:e.response;return{total_count:n,data:t.map((e=>new $(e)))}})),this.getInvitations=async e=>await s._fetch({path:`/organizations/${this.id}/invitations`,method:"GET",search:A(e)},{forceUpdateClient:!0}).then((e=>{const{data:t,total_count:n}=null==e?void 0:e.response;return{total_count:n,data:t.map((e=>new N(e)))}})),this.addMember=async({userId:e,role:t})=>await s._fetch({method:"POST",path:`/organizations/${this.id}/memberships`,body:{userId:e,role:t}}).then((e=>new $(null==e?void 0:e.response))),this.inviteMember=async e=>N.create(this.id,e),this.inviteMembers=async e=>N.createBulk(this.id,e),this.updateMember=async({userId:e,role:t})=>await s._fetch({method:"PATCH",path:`/organizations/${this.id}/memberships/${e}`,body:{role:t}}).then((e=>new $(null==e?void 0:e.response))),this.removeMember=async e=>await s._fetch({method:"DELETE",path:`/organizations/${this.id}/memberships/${e}`}).then((e=>new $(null==e?void 0:e.response))),this.destroy=async()=>this._baseDelete(),this.setLogo=async({file:e})=>{if(null===e)return await s._fetch({path:`/organizations/${this.id}/logo`,method:"DELETE"}).then((e=>new M(null==e?void 0:e.response)));let t,n;return"string"==typeof e?(t=e,n=new Headers({"Content-Type":"application/octet-stream"})):(t=new FormData,t.append("file",e)),await s._fetch({path:`/organizations/${this.id}/logo`,method:"PUT",body:t,headers:n}).then((e=>new M(null==e?void 0:e.response)))},this.fromJSON(e)}static async create(e){var t;const n=null===(t=await s._fetch({path:"/organizations",method:"POST",body:e}))||void 0===t?void 0:t.response;return new M(n)}static async get(e){var t;const n=null===(t=await s._fetch({path:`/organizations/${e}`,method:"GET"}))||void 0===t?void 0:t.response;return new M(n)}fromJSON(e){return e?(this.id=e.id,this.name=e.name,this.slug=e.slug,this.imageUrl=e.image_url,this.hasImage=e.has_image,this.publicMetadata=e.public_metadata,this.membersCount=e.members_count,this.pendingInvitationsCount=e.pending_invitations_count,this.maxAllowedMemberships=e.max_allowed_memberships,this.adminDeleteEnabled=e.admin_delete_enabled,this.createdAt=c(e.created_at),this.updatedAt=c(e.updated_at),this):this}async reload(e){var t;const{rotatingTokenNonce:n}=e||{},r=null===(t=await s._fetch({path:`/organizations/${this.id}`,method:"GET",rotatingTokenNonce:n},{forceUpdateClient:!0}))||void 0===t?void 0:t.response;return this.fromJSON(r)}}class N extends s{static async create(e,{emailAddress:t,role:n}){var r;const i=null===(r=await s._fetch({path:`/organizations/${e}/invitations`,method:"POST",body:{email_address:t,role:n}}))||void 0===r?void 0:r.response;return new N(i)}static async createBulk(e,t){var n;const{emailAddresses:r,role:i}=t;return(null===(n=await s._fetch({path:`/organizations/${e}/invitations/bulk`,method:"POST",body:{email_address:r,role:i}}))||void 0===n?void 0:n.response).map((e=>new N(e)))}constructor(e){super(),this.publicMetadata={},this.revoke=async()=>await this._basePost({path:`/organizations/${this.organizationId}/invitations/${this.id}/revoke`}),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.emailAddress=e.email_address,this.organizationId=e.organization_id,this.publicMetadata=e.public_metadata,this.role=e.role,this.status=e.status,this.createdAt=c(e.created_at),this.updatedAt=c(e.updated_at)),this}}class $ extends s{constructor(e){super(),this.publicMetadata={},this.permissions=[],this.destroy=async()=>await this._baseDelete({path:`/organizations/${this.organization.id}/memberships/${this.publicUserData.userId}`}),this.update=async({role:e})=>await this._basePatch({path:`/organizations/${this.organization.id}/memberships/${this.publicUserData.userId}`,body:{role:e}}),this.fromJSON(e)}fromJSON(e){return e?(this.id=e.id,this.organization=new M(e.organization),this.publicMetadata=e.public_metadata,e.public_user_data&&(this.publicUserData=new Z(e.public_user_data)),this.permissions=Array.isArray(e.permissions)?[...e.permissions]:[],this.role=e.role,this.createdAt=c(e.created_at),this.updatedAt=c(e.updated_at),this):this}reload(e){(0,i.RE)("OrganizationMembership")}}y=$,$.retrieve=async e=>await s._fetch({path:"/me/organization_memberships",method:"GET",search:A({...e,paginated:!0})}).then((e=>{const{data:t,total_count:n}=null==e?void 0:e.response;return{total_count:n,data:t.map((e=>new y(e)))}}));class L extends s{constructor(e){super(),this.accept=async()=>await this._basePost({path:`/me/organization_suggestions/${this.id}/accept`}),this.fromJSON(e)}static async retrieve(e){return await s._fetch({path:"/me/organization_suggestions",method:"GET",search:A(e)}).then((e=>{const{data:t,total_count:n}=null==e?void 0:e.response;return{total_count:n,data:t.map((e=>new L(e)))}}))}fromJSON(e){return e&&(this.id=e.id,this.status=e.status,this.publicOrganizationData={hasImage:e.public_organization_data.has_image,imageUrl:e.public_organization_data.image_url,name:e.public_organization_data.name,id:e.public_organization_data.id,slug:e.public_organization_data.slug},this.createdAt=c(e.created_at),this.updatedAt=c(e.updated_at)),this}}class W extends s{constructor(e,t){super(),this.provider="saml_custom",this.providerUserId=null,this.active=!1,this.emailAddress="",this.firstName="",this.lastName="",this.verification=null,this.pathRoot=t,this.fromJSON(e)}fromJSON(e){return e?(this.id=e.id,this.provider=e.provider,this.providerUserId=e.provider_user_id,this.active=e.active,this.emailAddress=e.email_address,this.firstName=e.first_name,this.lastName=e.last_name,e.verification&&(this.verification=new S(e.verification)),this):this}}var D,F,j,V=n(7084),K=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};class J extends s{static isSessionResource(e){return!!e&&e instanceof J}constructor(e){super(),D.add(this),this.pathRoot="/client/sessions",this.end=()=>(u.clear(),this._basePost({action:"end"})),this.remove=()=>(u.clear(),this._basePost({action:"remove"})),this.touch=()=>this._basePost({action:"touch",body:{active_organization_id:this.lastActiveOrganizationId}}),this.clearCache=()=>u.clear(),this.getToken=async e=>(0,b.$V)((()=>this._getToken(e)),{shouldRetry:(e,t)=>!(0,w.ix)(e)&&t<4}),this.checkAuthorization=e=>{if(!this.lastActiveOrganizationId||!this.user)return!1;const t=(this.user.organizationMemberships||[]).find((e=>e.organization.id===this.lastActiveOrganizationId));if(!t)return!1;const n=t.permissions,r=t.role;return e.permission?n.includes(e.permission):!!e.role&&r===e.role},F.set(this,(e=>{e&&(u.set({tokenId:K(this,D,"m",j).call(this),tokenResolver:Promise.resolve(e)}),V.Y.dispatch(V.U.TokenUpdate,{token:e}))})),this.fromJSON(e),K(this,F,"f").call(this,this.lastActiveToken)}fromJSON(e){return e?(this.id=e.id,this.status=e.status,this.expireAt=c(e.expire_at),this.abandonAt=c(e.abandon_at),this.lastActiveAt=c(e.last_active_at),this.lastActiveOrganizationId=e.last_active_organization_id,this.actor=e.actor,this.createdAt=c(e.created_at),this.updatedAt=c(e.updated_at),this.user=new oe(e.user),e.public_user_data&&(this.publicUserData=new Z(e.public_user_data)),this.lastActiveToken=e.last_active_token?new re(e.last_active_token):null,this):this}async _getToken(e){if(!this.user)return null;const{leewayInSeconds:t,template:n,skipCache:r=!1}=e||{};if(!n&&Number(t)>=60)throw new Error("Leeway can not exceed the token lifespan (60 seconds)");const i=K(this,D,"m",j).call(this,n),s=r?void 0:u.get({tokenId:i},t);if(s){const e=await s.tokenResolver;return n||V.Y.dispatch(V.U.TokenUpdate,{token:e}),e.getRawString()||null}const a=n?`${this.path()}/tokens/${n}`:`${this.path()}/tokens`,o=re.create(a);return u.set({tokenId:i,tokenResolver:o}),o.then((e=>(n||V.Y.dispatch(V.U.TokenUpdate,{token:e}),e.getRawString()||null)))}}F=new WeakMap,D=new WeakSet,j=function(e){return`${e?`${this.id}-${e}`:this.id}-${this.updatedAt.getTime()}`};var q=n(3394);class B extends s{constructor(e){super(),this.pathRoot="/me/passkeys",this.verification=null,this.name=null,this.lastUsedAt=null,this.update=e=>this._basePatch({body:e}),this.delete=async()=>{var e;const t=null===(e=await s._fetch({path:this.path(),method:"DELETE"}))||void 0===e?void 0:e.response;return new h(t)},this.fromJSON(e)}static async create(){return s._fetch({path:"/me/passkeys",method:"POST"}).then((e=>new B(null==e?void 0:e.response)))}static async attemptVerification(e,t){const n=(0,_.ku)(t);return s._fetch({path:`/me/passkeys/${e}/attempt_verification`,method:"POST",body:{strategy:"passkey",publicKeyCredential:JSON.stringify(n)}}).then((e=>new B(null==e?void 0:e.response)))}static async registerPasskey(){var e;if(!(0,q.iW)())throw new _.RK("Passkeys are not supported on this device.",{code:"passkey_not_supported"});const t=await this.create(),{verification:n}=t,r=null==n?void 0:n.publicKey;if(r||(0,i.$C)("create"),"platform"===(null===(e=r.authenticatorSelection)||void 0===e?void 0:e.authenticatorAttachment)&&!await(0,q.C6)())throw new _.RK("Registration requires a platform authenticator but the device does not support it.",{code:"passkey_pa_not_supported"});const{publicKeyCredential:s,error:a}=await(0,_.pr)(r);if(!s)throw a;return this.attemptVerification(t.id,s)}fromJSON(e){return e?(this.id=e.id,this.name=e.name,this.lastUsedAt=e.last_used_at?c(e.last_used_at):null,this.createdAt=c(e.created_at),this.updatedAt=c(e.updated_at),e.verification&&(this.verification=new k(e.verification)),this):this}}class Z{constructor(e){this.fromJSON(e)}fromJSON(e){return e&&(this.firstName=e.first_name,this.lastName=e.last_name,this.imageUrl=e.image_url,this.hasImage=e.has_image,this.identifier=e.identifier,this.userId=e.user_id),this}}class G extends s{constructor(e,t){super(),this.pathRoot="",this.pathRoot=t,this.fromJSON(e)}static retrieve(){var e;const t=null===(e=s.clerk.session)||void 0===e?void 0:e.id;return this.clerk.getFapiClient().request({method:"GET",path:"/me/sessions/active",sessionId:t}).then((e=>e.payload.map((e=>new G(e,"/me/sessions"))))).catch((()=>[]))}revoke(){return this._basePost({action:"revoke",body:{}})}fromJSON(e){var t;return e?(this.id=e.id,this.status=e.status,this.expireAt=c(e.expire_at),this.abandonAt=c(e.abandon_at),this.lastActiveAt=c(e.last_active_at),this.latestActivity=(e=>({id:e.id,deviceType:e.device_type,browserName:e.browser_name,browserVersion:e.browser_version,country:e.country,city:e.city,isMobile:e.is_mobile,ipAddress:e.ip_address}))(null!==(t=e.latest_activity)&&void 0!==t?t:{}),this.actor=e.actor,this):this}}var H=n(2045),Y=n(2469);class X extends s{constructor(e=null){super(),this.pathRoot="/client/sign_ins",this.status=null,this.supportedIdentifiers=[],this.supportedFirstFactors=[],this.supportedSecondFactors=[],this.firstFactorVerification=new S(null),this.secondFactorVerification=new S(null),this.identifier=null,this.createdSessionId=null,this.userData=new Q(null),this.create=e=>this._basePost({path:this.pathRoot,body:e}),this.resetPassword=e=>this._basePost({body:e,action:"reset_password"}),this.prepareFirstFactor=e=>{let t;switch(e.strategy){case"passkey":t={};break;case"email_link":t={emailAddressId:e.emailAddressId,redirectUrl:e.redirectUrl};break;case"email_code":case"reset_password_email_code":t={emailAddressId:e.emailAddressId};break;case"phone_code":t={phoneNumberId:e.phoneNumberId,default:e.default};break;case"web3_metamask_signature":t={web3WalletId:e.web3WalletId};break;case"reset_password_phone_code":t={phoneNumberId:e.phoneNumberId};break;case"saml":t={redirectUrl:e.redirectUrl,actionCompleteRedirectUrl:e.actionCompleteRedirectUrl};break;default:(0,i.Rz)("SignIn.prepareFirstFactor",e.strategy)}return this._basePost({body:{...t,strategy:e.strategy},action:"prepare_first_factor"})},this.attemptFirstFactor=e=>{let t;return t="passkey"===e.strategy?{publicKeyCredential:JSON.stringify((0,_.zQ)(e.publicKeyCredential))}:{...e},this._basePost({body:{...t,strategy:e.strategy},action:"attempt_first_factor"})},this.createEmailLinkFlow=()=>{const{run:e,stop:t}=(0,b.Ww)();return{startEmailLinkFlow:async({emailAddressId:n,redirectUrl:r})=>(this.id||(0,i.C)("SignIn"),await this.prepareFirstFactor({strategy:"email_link",emailAddressId:n,redirectUrl:r}),new Promise(((n,r)=>{e((()=>this.reload().then((e=>{const r=e.firstFactorVerification.status;"verified"!==r&&"expired"!==r||(t(),n(e))})).catch((e=>{t(),r(e)}))))}))),cancelEmailLinkFlow:t}},this.prepareSecondFactor=e=>this._basePost({body:e,action:"prepare_second_factor"}),this.attemptSecondFactor=e=>this._basePost({body:e,action:"attempt_second_factor"}),this.authenticateWithRedirect=async e=>{const{strategy:t,redirectUrl:n,redirectUrlComplete:r,identifier:s}=e||{},{firstFactorVerification:a}="saml"===t&&this.id?await this.prepareFirstFactor({strategy:t,redirectUrl:X.clerk.buildUrlWithAuth(n),actionCompleteRedirectUrl:r}):await this.create({strategy:t,identifier:s,redirectUrl:X.clerk.buildUrlWithAuth(n),actionCompleteRedirectUrl:r}),{status:o,externalVerificationRedirectURL:c}=a;"unverified"===o&&c?(0,H.T7)(c):(0,i.Ws)(o,X.fapiClient.buildEmailAddress("support"))},this.authenticateWithWeb3=async e=>{const{identifier:t,generateSignature:n}=e||{};"function"!=typeof n&&(0,i.WC)("generateSignature"),await this.create({identifier:t});const r=this.supportedFirstFactors.find((e=>"web3_metamask_signature"===e.strategy));r||(0,i.lb)("SignIn"),await this.prepareFirstFactor(r);const{nonce:s}=this.firstFactorVerification,a=await n({identifier:this.identifier,nonce:s});return this.attemptFirstFactor({signature:a,strategy:"web3_metamask_signature"})},this.authenticateWithMetamask=async()=>{const e=await(0,H.M8)();return this.authenticateWithWeb3({identifier:e,generateSignature:H.wO})},this.authenticateWithPasskey=async e=>{const{flow:t}=e||{};if(!(0,q.iW)())throw new _.RK("Passkeys are not supported",{code:"passkey_not_supported"});if("autofill"===t||"discoverable"===t)await this.create({strategy:"passkey"});else{const e=this.supportedFirstFactors.find((e=>"passkey"===e.strategy));e||(0,i.ep)(),await this.prepareFirstFactor(e)}const{nonce:n}=this.firstFactorVerification,r=n?(0,_.N7)(JSON.parse(n)):null;r||(0,i.$C)("get");let s=!1;"autofill"===t&&(s=await(0,q.h_)());const{publicKeyCredential:a,error:o}=await(0,_.t1)({publicKeyOptions:r,conditionalUI:s});if(!a)throw o;return this.attemptFirstFactor({publicKeyCredential:a,strategy:"passkey"})},this.validatePassword=(e,t)=>{var n,r;if(null===(n=X.clerk.__unstable__environment)||void 0===n?void 0:n.userSettings.passwordSettings)return(0,Y.z)({...null===(r=X.clerk.__unstable__environment)||void 0===r?void 0:r.userSettings.passwordSettings,validatePassword:!0})(e,t)},this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.status=e.status,this.supportedIdentifiers=e.supported_identifiers,this.identifier=e.identifier,this.supportedFirstFactors=(0,b.aw)(e.supported_first_factors),this.supportedSecondFactors=(0,b.aw)(e.supported_second_factors),this.firstFactorVerification=new S(e.first_factor_verification),this.secondFactorVerification=new S(e.second_factor_verification),this.createdSessionId=e.created_session_id,this.userData=new Q(e.user_data)),this}}class Q{constructor(e){this.fromJSON(e)}fromJSON(e){return e&&(this.firstName=e.first_name,this.lastName=e.last_name,this.imageUrl=e.image_url,this.hasImage=e.has_image),this}}var ee=n(9514);function te(e){const{unsafeMetadata:t}={...e},n=t?"object"==typeof t?JSON.stringify(t):t:"";return{...e,...t?{unsafeMetadata:n}:{}}}class ne extends s{constructor(e=null){super(),this.pathRoot="/client/sign_ups",this.status=null,this.requiredFields=[],this.optionalFields=[],this.missingFields=[],this.unverifiedFields=[],this.verifications=new P(null),this.username=null,this.firstName=null,this.lastName=null,this.emailAddress=null,this.phoneNumber=null,this.web3wallet=null,this.hasPassword=!1,this.unsafeMetadata={},this.createdSessionId=null,this.createdUserId=null,this.abandonAt=null,this.create=async e=>{const t=e,{captchaSiteKey:n,canUseCaptcha:r,captchaURL:i,captchaWidgetType:s,captchaProvider:a,captchaPublicKeyInvisible:o}=(0,ee.zb)(ne.clerk);if(r&&n&&i&&o)try{const{captchaToken:e,captchaWidgetTypeUsed:r}=await(0,ee.ky)({siteKey:n,widgetType:s,invisibleSiteKey:o,scriptUrl:i,captchaProvider:a});t.captchaToken=e,t.captchaWidgetType=r}catch(c){if(!c.captchaError)throw new w.w$(c.message,{code:"captcha_unavailable"});t.captchaError=c.captchaError}return this._basePost({path:this.pathRoot,body:te(t)})},this.prepareVerification=e=>this._basePost({body:e,action:"prepare_verification"}),this.attemptVerification=e=>this._basePost({body:e,action:"attempt_verification"}),this.prepareEmailAddressVerification=e=>this.prepareVerification(e||{strategy:"email_code"}),this.attemptEmailAddressVerification=e=>this.attemptVerification({...e,strategy:"email_code"}),this.createEmailLinkFlow=()=>{const{run:e,stop:t}=(0,b.Ww)();return{startEmailLinkFlow:async({redirectUrl:n})=>(this.id||(0,i.C)("SignUp"),await this.prepareEmailAddressVerification({strategy:"email_link",redirectUrl:n}),new Promise(((n,r)=>{e((()=>this.reload().then((e=>{const r=e.verifications.emailAddress.status;"verified"!==r&&"expired"!==r||(t(),n(e))})).catch((e=>{t(),r(e)}))))}))),cancelEmailLinkFlow:t}},this.preparePhoneNumberVerification=e=>this.prepareVerification(e||{strategy:"phone_code"}),this.attemptPhoneNumberVerification=e=>this.attemptVerification({...e,strategy:"phone_code"}),this.prepareWeb3WalletVerification=()=>this.prepareVerification({strategy:"web3_metamask_signature"}),this.attemptWeb3WalletVerification=async e=>{const{signature:t}=e;return this.attemptVerification({signature:t,strategy:"web3_metamask_signature"})},this.authenticateWithWeb3=async e=>{const{generateSignature:t,identifier:n,unsafeMetadata:r}=e||{},s=n||this.web3wallet;await this.create({web3Wallet:s,unsafeMetadata:r}),await this.prepareWeb3WalletVerification();const{nonce:a}=this.verifications.web3Wallet;a||(0,i.lb)("SignUp");const o=await t({identifier:n,nonce:a});return this.attemptWeb3WalletVerification({signature:o})},this.authenticateWithMetamask=async e=>{const t=await(0,H.M8)();return this.authenticateWithWeb3({identifier:t,generateSignature:H.wO,unsafeMetadata:null==e?void 0:e.unsafeMetadata})},this.authenticateWithRedirect=async({redirectUrl:e,redirectUrlComplete:t,strategy:n,continueSignUp:r=!1,unsafeMetadata:s,emailAddress:a})=>{const{verifications:o}=await(e=>r&&this.id?this.update(e):this.create(e))({strategy:n,redirectUrl:ne.clerk.buildUrlWithAuth(e),actionCompleteRedirectUrl:t,unsafeMetadata:s,emailAddress:a}),{externalAccount:c}=o,{status:l,externalVerificationRedirectURL:u}=c;"unverified"===l&&u?(0,H.T7)(u):(0,i.Ws)(l,ne.fapiClient.buildEmailAddress("support"))},this.update=e=>this._basePatch({body:te(e)}),this.validatePassword=(e,t)=>{var n,r;if(null===(n=ne.clerk.__unstable__environment)||void 0===n?void 0:n.userSettings.passwordSettings)return(0,Y.z)({...null===(r=ne.clerk.__unstable__environment)||void 0===r?void 0:r.userSettings.passwordSettings,validatePassword:!0})(e,t)},this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.status=e.status,this.requiredFields=e.required_fields,this.optionalFields=e.optional_fields,this.missingFields=e.missing_fields,this.unverifiedFields=e.unverified_fields,this.verifications=new P(e.verifications),this.username=e.username,this.firstName=e.first_name,this.lastName=e.last_name,this.emailAddress=e.email_address,this.phoneNumber=e.phone_number,this.hasPassword=e.has_password,this.unsafeMetadata=e.unsafe_metadata,this.createdSessionId=e.created_session_id,this.createdUserId=e.created_user_id,this.abandonAt=e.abandon_at,this.web3wallet=e.web3_wallet),this}}class re extends s{static async create(e,t={}){const n=await s._fetch({path:e,method:"POST",body:t});return new re(n,e)}constructor(e,t){super(),this.pathRoot="tokens",this.getRawString=()=>{var e;return(null===(e=this.jwt)||void 0===e?void 0:e.claims.__raw)||""},t&&(this.pathRoot=t),(null==e?void 0:e.jwt)&&(this.jwt=(0,H.Jx)(e.jwt))}fromJSON(e){return e?(this.jwt=(0,H.Jx)(e.jwt),this):this}}class ie extends s{constructor(e){super(),this.pathRoot="/me",this.id="",this.verified=!1,this.updatedAt=null,this.createdAt=null,this.fromJSON(e)}fromJSON(e){return e?(this.id=e.id,this.secret=e.secret,this.uri=e.uri,this.verified=e.verified,this.backupCodes=e.backup_codes,this.updatedAt=c(e.updated_at),this.createdAt=c(e.created_at),this):this}}var se=n(4016);class ae extends s{constructor(e){super(),this.pathRoot="/me",this.codes=[],this.updatedAt=null,this.createdAt=null,this.fromJSON(e)}fromJSON(e){return e?(this.id=e.id,this.codes=e.codes,this.updatedAt=c(e.updated_at),this.createdAt=c(e.created_at),this):this}}class oe extends s{static isUserResource(e){return!!e&&e instanceof oe}constructor(e){super(),this.pathRoot="/me",this.id="",this.externalId=null,this.username=null,this.emailAddresses=[],this.phoneNumbers=[],this.web3Wallets=[],this.externalAccounts=[],this.passkeys=[],this.samlAccounts=[],this.organizationMemberships=[],this.passwordEnabled=!1,this.firstName=null,this.lastName=null,this.fullName=null,this.primaryEmailAddressId=null,this.primaryEmailAddress=null,this.primaryPhoneNumberId=null,this.primaryPhoneNumber=null,this.primaryWeb3WalletId=null,this.primaryWeb3Wallet=null,this.imageUrl="",this.hasImage=!1,this.twoFactorEnabled=!1,this.totpEnabled=!1,this.backupCodeEnabled=!1,this.publicMetadata={},this.unsafeMetadata={},this.createOrganizationEnabled=!1,this.deleteSelfEnabled=!1,this.lastSignInAt=null,this.updatedAt=null,this.createdAt=null,this.cachedSessionsWithActivities=null,this.isPrimaryIdentification=e=>{switch(e.constructor){case m:return this.primaryEmailAddressId===e.id;case I:return this.primaryPhoneNumberId===e.id;case le:return this.primaryWeb3WalletId===e.id;default:return!1}},this.createEmailAddress=e=>{const{email:t}=e||{};return new m({email_address:t},this.path()+"/email_addresses/").create()},this.createPasskey=()=>B.registerPasskey(),this.createPhoneNumber=e=>{const{phoneNumber:t}=e||{};return new I({phone_number:t},this.path()+"/phone_numbers/").create()},this.createWeb3Wallet=e=>{const{web3Wallet:t}=e||{};return new le({web3_wallet:t},this.path()+"/web3_wallets/").create()},this.createExternalAccount=async e=>{var t;const{strategy:n,redirectUrl:r,additionalScopes:i}=e||{},a=null===(t=await s._fetch({path:"/me/external_accounts",method:"POST",body:{strategy:n,redirect_url:r,additional_scope:i}}))||void 0===t?void 0:t.response;return new O(a,this.path()+"/external_accounts")},this.createTOTP=async()=>{var e;const t=null===(e=await s._fetch({path:"/me/totp",method:"POST"}))||void 0===e?void 0:e.response;return new ie(t)},this.verifyTOTP=async({code:e})=>{var t;const n=null===(t=await s._fetch({path:"/me/totp/attempt_verification",method:"POST",body:{code:e}}))||void 0===t?void 0:t.response;return new ie(n)},this.disableTOTP=async()=>{var e;const t=null===(e=await s._fetch({path:"/me/totp",method:"DELETE"}))||void 0===e?void 0:e.response;return new h(t)},this.createBackupCode=async()=>{var e;const t=null===(e=await s._fetch({path:this.path()+"/backup_codes/",method:"POST"}))||void 0===e?void 0:e.response;return new ae(t)},this.update=e=>this._basePatch({body:te(e)}),this.updatePassword=e=>this._basePost({body:e,path:`${this.path()}/change_password`}),this.removePassword=e=>this._basePost({body:e,path:`${this.path()}/remove_password`}),this.delete=()=>this._baseDelete({path:"/me"}),this.getSessions=async()=>{if(this.cachedSessionsWithActivities)return this.cachedSessionsWithActivities;const e=await G.retrieve();return this.cachedSessionsWithActivities=e,e},this.setProfileImage=e=>{const{file:t}=e||{};return null===t?E.delete(`${this.path()}/profile_image`):E.create(`${this.path()}/profile_image`,{file:t})},this.getOrganizationInvitations=e=>ce.retrieve(e),this.getOrganizationSuggestions=e=>L.retrieve(e),this.getOrganizationMemberships=e=>$.retrieve(e),this.leaveOrganization=async e=>{var t;const n=null===(t=await s._fetch({path:`${this.path()}/organization_memberships/${e}`,method:"DELETE"}))||void 0===t?void 0:t.response;return new h(n)},this.fromJSON(e)}path(){return this.pathRoot}get verifiedExternalAccounts(){return this.externalAccounts.filter((e=>{var t;return"verified"==(null===(t=e.verification)||void 0===t?void 0:t.status)}))}get unverifiedExternalAccounts(){return this.externalAccounts.filter((e=>{var t;return"verified"!=(null===(t=e.verification)||void 0===t?void 0:t.status)}))}get hasVerifiedEmailAddress(){return this.emailAddresses.filter((e=>"verified"===e.verification.status)).length>0}get hasVerifiedPhoneNumber(){return this.phoneNumbers.filter((e=>"verified"===e.verification.status)).length>0}fromJSON(e){return e?(this.id=e.id,this.externalId=e.external_id,this.firstName=e.first_name,this.lastName=e.last_name,(this.firstName||this.lastName)&&(this.fullName=(0,se.Pp)({firstName:this.firstName,lastName:this.lastName})),this.imageUrl=e.image_url,this.hasImage=e.has_image,this.username=e.username,this.passwordEnabled=e.password_enabled,this.emailAddresses=(e.email_addresses||[]).map((e=>new m(e,this.path()+"/email_addresses"))),this.primaryEmailAddressId=e.primary_email_address_id,this.primaryEmailAddress=this.emailAddresses.find((({id:e})=>e===this.primaryEmailAddressId))||null,this.phoneNumbers=(e.phone_numbers||[]).map((e=>new I(e,this.path()+"/phone_numbers"))),this.primaryPhoneNumberId=e.primary_phone_number_id,this.primaryPhoneNumber=this.phoneNumbers.find((({id:e})=>e===this.primaryPhoneNumberId))||null,this.web3Wallets=(e.web3_wallets||[]).map((e=>new le(e,this.path()+"/web3_wallets"))),this.primaryWeb3WalletId=e.primary_web3_wallet_id,this.primaryWeb3Wallet=this.web3Wallets.find((({id:e})=>e===this.primaryWeb3WalletId))||null,this.externalAccounts=(e.external_accounts||[]).map((e=>new O(e,this.path()+"/external_accounts"))),this.passkeys=(e.passkeys||[]).map((e=>new B(e))),this.organizationMemberships=(e.organization_memberships||[]).map((e=>new $(e))),this.samlAccounts=(e.saml_accounts||[]).map((e=>new W(e,this.path()+"/saml_accounts"))),this.publicMetadata=e.public_metadata,this.unsafeMetadata=e.unsafe_metadata,this.totpEnabled=e.totp_enabled,this.backupCodeEnabled=e.backup_code_enabled,this.twoFactorEnabled=e.two_factor_enabled,this.createOrganizationEnabled=e.create_organization_enabled,this.deleteSelfEnabled=e.delete_self_enabled,e.last_sign_in_at&&(this.lastSignInAt=c(e.last_sign_in_at)),this.updatedAt=c(e.updated_at),this.createdAt=c(e.created_at),this):this}}class ce extends s{static async retrieve(e){return await s._fetch({path:"/me/organization_invitations",method:"GET",search:A(e)}).then((e=>{const{data:t,total_count:n}=null==e?void 0:e.response;return{total_count:n,data:t.map((e=>new ce(e)))}}))}constructor(e){super(),this.publicMetadata={},this.accept=async()=>await this._basePost({path:`/me/organization_invitations/${this.id}/accept`}),this.fromJSON(e)}fromJSON(e){return e&&(this.id=e.id,this.emailAddress=e.email_address,this.publicOrganizationData={hasImage:e.public_organization_data.has_image,imageUrl:e.public_organization_data.image_url,name:e.public_organization_data.name,id:e.public_organization_data.id,slug:e.public_organization_data.slug},this.publicMetadata=e.public_metadata,this.role=e.role,this.status=e.status,this.createdAt=c(e.created_at),this.updatedAt=c(e.updated_at)),this}}class le extends s{constructor(e,t){super(),this.web3Wallet="",this.prepareVerification=e=>this._basePost({action:"prepare_verification",body:{...e}}),this.attemptVerification=e=>{const{signature:t}=e;return this._basePost({action:"attempt_verification",body:{signature:t}})},this.pathRoot=t,this.fromJSON(e)}create(){return this._basePost({body:{web3_wallet:this.web3Wallet}})}destroy(){return this._baseDelete()}toString(){return this.web3Wallet}fromJSON(e){return e?(this.id=e.id,this.web3Wallet=e.web3_wallet,this.verification=new S(e.verification),this):this}}},4850:function(e,t,n){"use strict";n.d(t,{q:function(){return i}});const r=e=>`🔒 Clerk:\n${e.trim()}\n(This notice only appears in development)`,i={cannotRenderComponentWhenSessionExists:"The and components cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the Home URL instead.",cannotRenderSignUpComponentWhenSessionExists:"The component cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the value set in `afterSignUp` URL instead.",cannotRenderSignInComponentWhenSessionExists:"The component cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the `afterSignIn` URL instead.",cannotRenderComponentWhenUserDoesNotExist:" cannot render unless a user is signed in. Since no user is signed in, this is no-op.",cannotRenderComponentWhenOrgDoesNotExist:" cannot render unless an organization is active. Since no organization is currently active, this is no-op.",cannotRenderAnyOrganizationComponent:e=>r(`The <${e}/> cannot be rendered when the feature is turned off. Visit 'dashboard.clerk.com' to enable the feature. Since the feature is turned off, this is no-op.`),cannotOpenUserProfile:"The UserProfile modal cannot render unless a user is signed in. Since no user is signed in, this is no-op.",cannotOpenSignInOrSignUp:"The SignIn or SignUp modals do not render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, this is no-op."};for(const s of Object.keys(i)){const e=i[s];"function"!=typeof e&&(i[s]=r(e))}},3859:function(e,t,n){"use strict";n.d(t,{_:function(){return a}});var r=n(2784),i=n(9841),s=n(2045);const a=()=>{const[e,t]=r.useState({startPath:"",path:"",componentName:"",socialProvider:""}),n=(0,s.w$)();r.useLayoutEffect((()=>{n&&t(n)}),[]);const a=()=>{t({startPath:"",path:"",componentName:"",socialProvider:""})};return{urlStateParam:{...e,clearUrlStateParam:a},decodedRedirectParams:n,clearUrlStateParam:a,removeQueryParam:()=>(0,s.xy)(i.v_)}}},9673:function(e,t,n){"use strict";n.d(t,{L:function(){return s},v:function(){return i}});var r=n(4661);function i(e){const t=["redirectUrl","afterSignInUrl","afterSignUpUrl","after_sign_in_url","after_sign_up_url"],n=Object.keys(e).find((e=>t.includes(e)));n&&e[n]&&r.k.warnOnce(`Clerk: The prop "${n}" is deprecated and should be replaced with the new "fallbackRedirectUrl" or "forceRedirectUrl" props instead.`)}function s(e,t,n,i){t&&i&&r.k.warnOnce(`Clerk: The "${e}" prop ("${t}") has priority over the legacy "${n}" (or "redirectUrl") ("${i}"), which will be completely ignored in this case. "${n}" (or "redirectUrl" prop) should be replaced with the new "fallbackRedirectUrl" or "forceRedirectUrl" props instead.`)}},9514:function(e,t,n){"use strict";n.d(t,{Mc:function(){return s},ky:function(){return c},zb:function(){return i}});var r=n(3351);const i=e=>{const t=e.__unstable__environment,n=(0,r.g)(e),i=t?t.displayConfig.captchaProvider:"turnstile";return{captchaSiteKey:t?t.displayConfig.captchaPublicKey:null,captchaWidgetType:t?t.displayConfig.captchaWidgetType:null,captchaProvider:i,captchaPublicKeyInvisible:t?t.displayConfig.captchaPublicKeyInvisible:null,canUseCaptcha:t?t.userSettings.signUp.captcha_enabled&&e.isStandardBrowser&&"production"===e.instanceType:null,captchaURL:n.buildUrl({path:"hcaptcha"==i?"hcaptcha/1/api.js":"cloudflare/turnstile/v0/api.js",pathPrefix:"",search:"?render=explicit"}).toString()}},s="clerk-captcha",a="clerk-invisible-captcha";var o=n(5213);const c=e=>{const{captchaProvider:t,...n}=e;return"hcaptcha"===t?(async e=>{const{siteKey:t,scriptUrl:n,widgetType:r,invisibleSiteKey:i}=e;let c="",l="",u=!r||"invisible"===r,d=t,h=null;const f=()=>{const e=document.createElement("div");return e.id=a,document.body.appendChild(e),e},p=await async function(e){if(!window.hcaptcha)try{await(0,o.v)(e,{defer:!0})}catch{throw console.error("Clerk: Failed to load the CAPTCHA script from the URL: ",e),{captchaError:"captcha_script_failed_to_load"}}return window.hcaptcha}(n);let m=0;const g=[];try{[c,l]=await new Promise(((e,t)=>{try{if(u)h=f();else{const e=document.getElementById(s);e?(e.style.display="block",h=e):(console.error("Captcha DOM element not found. Using invisible captcha widget."),h=f(),u=!0,d=i)}const n=p.render(u?a:s,{sitekey:d,size:u?"invisible":"normal",callback:function(t){e([t,n])},"error-callback":function(e){g.push(e),m<2?setTimeout((()=>{p.reset(n),m++}),250):t([g.join(","),n])}});u&&p.execute(n)}catch(n){t([n,void 0])}})),p.remove(l)}catch([v,l]){throw l&&p.remove(l),{captchaError:v}}finally{h&&(u?document.body.removeChild(h):h.style.display="none")}return{captchaToken:c,captchaWidgetTypeUsed:u?"invisible":"smart"}})(n):(async e=>{const{siteKey:t,scriptUrl:n,widgetType:r,invisibleSiteKey:i}=e;let c="",l="",u=!r||"invisible"===r,d=t,h=null;const f=()=>{const e=document.createElement("div");return e.classList.add(a),document.body.appendChild(e),e},p=await async function(e){if(!window.turnstile)try{await(0,o.v)(e,{defer:!0})}catch{throw console.error("Clerk: Failed to load the CAPTCHA script from the URL: ",e),{captchaError:"captcha_script_failed_to_load"}}return window.turnstile}(n);let m=0;const g=[];try{[c,l]=await new Promise(((e,t)=>{try{if(u)h=f();else{const e=document.getElementById(s);e?(e.style.display="block",h=e):(console.error("Captcha DOM element not found. Using invisible captcha widget."),h=f(),u=!0,d=i)}const n=p.render(u?`.${a}`:`#${s}`,{sitekey:d,appearance:"interaction-only",retry:"never","refresh-expired":"auto",callback:function(t){e([t,n])},"error-callback":function(e){g.push(e),m<2&&(e=>!!["crashed","undefined_error","102","103","104","106","110600","300","600"].find((t=>e.startsWith(t))))(e.toString())?setTimeout((()=>{p.reset(n),m++}),250):t([g.join(","),n])},"unsupported-callback":function(){return t(["This browser is not supported by the CAPTCHA.",n]),!0}})}catch(n){t([n,void 0])}})),p.remove(l)}catch([v,l]){throw l&&p.remove(l),{captchaError:v}}finally{h&&(u?document.body.removeChild(h):h.style.display="none")}return{captchaToken:c,captchaWidgetTypeUsed:u?"invisible":"smart"}})(n)}},9069:function(e,t,n){"use strict";n.d(t,{v:function(){return r}});const r=({signUp:e,verifyEmailPath:t,verifyPhonePath:n,navigate:r,handleComplete:i,redirectUrl:s="",redirectUrlComplete:a=""})=>{var o,c;if("complete"===e.status)return i&&i();if("missing_requirements"===e.status){if(e.missingFields.some((e=>"saml"===e)))return e.authenticateWithRedirect({strategy:"saml",redirectUrl:s,redirectUrlComplete:a,continueSignUp:!0});if((null===(o=e.unverifiedFields)||void 0===o?void 0:o.includes("email_address"))&&t)return r(t);if((null===(c=e.unverifiedFields)||void 0===c?void 0:c.includes("phone_number"))&&n)return r(n)}}},6816:function(e,t,n){"use strict";n.d(t,{X:function(){return i},x:function(){return s}});var r=n(9841);function i(e){return new URL(window.location.href).searchParams.get(e)||null}function s(e){const t=new URL(window.location.href);t.searchParams.has(e)&&(t.searchParams.delete(e),window.history.replaceState(window.history.state,"",t))}r.cD,r.w9},2045:function(e,t,n){"use strict";n.d(t,{bX:function(){return C},aR:function(){return u},KV:function(){return y.KV},e1:function(){return U},vx:function(){return M.v},$1:function(){return y.$1},HV:function(){return i},OY:function(){return l},LM:function(){return S},Jx:function(){return w},sW:function(){return c},eg:function(){return d},RM:function(){return p},wO:function(){return R.w},XV:function(){return m.X},M8:function(){return R.M},vl:function(){return E.v},l1:function(){return y.l1},eT:function(){return y.eT},BT:function(){return v},oH:function(){return A},_f:function(){return I},TI:function(){return T},pU:function(){return y.pU},QO:function(){return z},u9:function(){return y.u9},un:function(){return y.un},VZ:function(){return f},To:function(){return y.To},jv:function(){return y.jv},z9:function(){return y.z9},n$:function(){return o},f:function(){return a},hb:function(){return y.hb},w$:function(){return O},xy:function(){return m.x},WW:function(){return y.WW},OR:function(){return k},So:function(){return s},f0:function(){return E.f},M:function(){return y.M},Os:function(){return y.Os},T7:function(){return r.T}});var r=n(196);const i=()=>{let e=!1;const t=()=>e=!0;return{startTracking:()=>{window.addEventListener("beforeunload",t),window.addEventListener(r.I,t)},stopTracking:()=>{window.removeEventListener("beforeunload",t),window.removeEventListener(r.I,t)},isUnloading:()=>e}},s=(e,t)=>!(!e.session||!(null==t?void 0:t.authConfig.singleSessionMode)),a=e=>!e.user,o=e=>!e.organization,c=(e,t)=>!(null==t?void 0:t.organizationSettings.enabled),l=({regex:e})=>({urlWithParam:t,entity:n})=>{const r=e.exec(t);if(r){const e=r[1];if(e in n){const i=n[e];return t.replace(r[0],i)}}return t};function u({localPart:e,frontendApi:t}){return`${e}@${t?t.replace("clerk.",""):"clerk.com"}`}function d(e){return n.g.btoa(e)}function h(e){return function(e){return decodeURIComponent(n.g.atob(e).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""))}(e.replace(/_/g,"/").replace(/-/g,"+"))}function f(e,t=""){return e.errors&&!!e.errors.find((e=>e.code===t))}const p=(0,n(221).t5)({packageName:"@clerk/clerk-js"});var m=n(6816);const g=e=>!!e&&"object"==typeof e&&"target"in e&&"currentTarget"in e&&"preventDefault"in e;function v(e,t={}){if(!(t.requireType&&typeof e!==t.requireType||g(e)))return e}var y=n(3547);function w(e){const t=(e||"").split("."),[n,r,i]=t;if(3!==t.length||!n||!r||!i)throw new Error("JWT could not be decoded");const s=JSON.parse(h(r)),a={__raw:e};return Object.keys(s).forEach((e=>{a[e]=s[e]})),{encoded:{header:n,payload:r,signature:i},header:JSON.parse(h(n)),claims:a}}var b=n(305);const _=()=>{},S=()=>{if(!(0,b._f)())return{isUnloading:_,onPageVisible:_};const e={"visibilitychange:visible":[]};return document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&e["visibilitychange:visible"].forEach((e=>e()))})),{onPageVisible:t=>{e["visibilitychange:visible"].push(t)}}};function k(e){return"function"==typeof e?e():e}n(5810);var P=n(9841);const U=({base:e,path:t})=>t?e+t:e,O=()=>{var e;const t=null!==(e=(0,m.X)(P.v_))&&void 0!==e?e:"";return t?JSON.parse(atob(t)):null},C=({url:e,startPath:t="/user",currentPath:n="",componentName:r,socialProvider:i=""})=>{const s={path:n.replace(/CLERK-ROUTER\/VIRTUAL\/.*\//,"")||"",componentName:r,startPath:t,socialProvider:i},a=d(JSON.stringify(s)),o=new URL(e),c=o.searchParams;return c.set(P.v_,a),o.search=c.toString(),o.toString()};var E=n(5616);function I(){return void 0!==globalThis.document}function A(){return I()&&globalThis.document.hasFocus()}function T(){return I()&&window.self!==window.top&&!("undefined"!=typeof window&&void 0!==window.Cypress)&&!window.frameElement}var R=n(8621),x=n(3063);n(7498);const z=e=>{if((e||"").includes("gravatar")||(e||"").includes("avatar_placeholder"))return!0;try{const t=new URL(e).pathname.replace("/",""),n=(0,x.S)(t);return"default"===JSON.parse(n).type}catch{return!1}};var M=n(9069)},969:function(e,t,n){"use strict";n.d(t,{GH:function(){return l},N7:function(){return u},RK:function(){return g},YI:function(){return a},ku:function(){return h},pr:function(){return s},t1:function(){return o},zQ:function(){return f}});var r=n(221);class i{static encode(e){return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}static decode(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=atob(t),r=n.length,i=new Uint8Array(r);for(let s=0;s({...e,id:m(e.id)})));return{...e,excludeCredentials:r,challenge:n,user:{...e.user,id:t}}}function u(e){const t=m(e.challenge),n=(e.allowCredentials||[]).map((e=>({...e,id:m(e.id)})));return{...e,allowCredentials:n,challenge:t}}function d(e){return{type:e.type,id:e.id,rawId:p(e.rawId),authenticatorAttachment:e.authenticatorAttachment}}function h(e){const t=e.response;return{...d(e),response:{clientDataJSON:p(t.clientDataJSON),attestationObject:p(t.attestationObject),transports:t.getTransports()}}}function f(e){const t=e.response;return{...d(e),response:{clientDataJSON:p(t.clientDataJSON),authenticatorData:p(t.authenticatorData),signature:p(t.signature),userHandle:t.userHandle?p(t.userHandle):null}}}const p=i.encode.bind(i),m=i.decode.bind(i);class g extends r.w${constructor(e,{code:t}){super(e,{code:t}),this.code=t}}},2469:function(e,t,n){"use strict";n.d(t,{z:function(){return i}});var r=n(2022);const i=(e,t)=>{const{onValidation:i=r.ZT,onValidationComplexity:s=r.ZT}=t||{},{show_zxcvbn:a,validatePassword:o}=e,c=(e=>t=>((e,t)=>{const{max_length:n,min_length:r,require_special_char:i,require_lowercase:s,require_numbers:a,require_uppercase:o}=t,c=(e=>{let t;if(e.allowed_special_characters){let n=e.allowed_special_characters.replace("[","\\[");n=n.replace("]","\\]"),t=new RegExp(`[${n}]`)}else t=/[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]/;return(e,{minLength:n,maxLength:r})=>({max_length:e.length=n,require_numbers:/\d/.test(e),require_lowercase:/[a-z]/.test(e),require_uppercase:/[A-Z]/.test(e),require_special_char:t.test(e)})})(t),l=c(e,{maxLength:t.max_length,minLength:t.min_length}),u={max_length:n,min_length:r,require_special_char:i,require_lowercase:s,require_numbers:a,require_uppercase:o},d=new Map;for(const h in u){const e=h;u[e]&&(l[e]||d.set(e,!0))}return Object.freeze(Object.fromEntries(d))})(t,e))(e),l=(({min_zxcvbn_strength:e,onResult:t})=>n=>r=>{const i=n(r);return null==t||t(i),i.score>=e&&i.score<3?{state:"pass",keys:["unstable__errors.zxcvbn.couldBeStronger"],result:i}:i.score>=e?{state:"excellent",result:i}:{state:"fail",keys:["unstable__errors.zxcvbn.notEnough",...i.feedback.suggestions.map((e=>`unstable__errors.zxcvbn.suggestions.${e}`))],result:i}})(e);let u={};return(e,t)=>{const{onValidation:r=i,onValidationComplexity:d=s}=t||{};if(!o)return;const h=c(e);d(0===Object.keys(h).length),u={...u,complexity:h},a&&Promise.all([Promise.all([n.e(220),n.e(216)]).then(n.bind(n,3502)),n.e(804).then(n.bind(n,5052))]).then((([e,t])=>{const{zxcvbnOptions:n,zxcvbn:r}=e,{dictionary:i,adjacencyGraphs:s}=t;return n.setOptions({dictionary:{...i},graphs:s}),r})).then((t=>{const n=l(t)(e);u={...u,strength:n},r({...u,strength:n})})),u.complexity&&0===Object.keys(u.complexity).length&&a||r(u)}}},5810:function(e,t,n){"use strict";n.d(t,{R:function(){return s}});const r="/",i=new RegExp(r+"{1,}","g");function s(e,t){return[e,t].filter((e=>e)).join(r).replace(i,r)}},5616:function(e,t,n){"use strict";n.d(t,{f:function(){return i},v:function(){return r}});const r=e=>{const t={};return new URLSearchParams(e).forEach(((e,n)=>{if(n in t){const r=t[n];Array.isArray(r)?r.push(e):t[n]=[r,e]}else t[n]=e})),t},i=(e,t={})=>{if(null==e)return"";if(!e||"object"!=typeof e)return"";const n=new URLSearchParams;return Object.keys(e).forEach((r=>{const i=t.keyEncoder?t.keyEncoder(r):r,s=e[r];if(Array.isArray(s))s.forEach((e=>void 0!==e&&n.append(i,e||"")));else{if(void 0===s)return;"object"==typeof s&&null!==s?n.append(i,JSON.stringify(s)):n.append(i,s||"")}})),n.toString()}},9169:function(e,t,n){"use strict";n.d(t,{O:function(){return v}}),n(7498);var r,i,s,a,o,c,l,u,d,h,f=n(6479),p=n(9673),m=n(3547),g=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};class v{constructor(e,t={},n={}){r.add(this),h.set(this,(e=>{var t;return((e,t)=>{const n={};for(const r in e)e[r]&&t(e[r])&&(n[r]=e[r]);return n})(e,(0,m.F9)(null===(t=this.options)||void 0===t?void 0:t.allowedRedirectOrigins))})),this.options=e,this.fromOptions=g(this,r,"m",l).call(this,e||{}),this.fromProps=g(this,r,"m",l).call(this,t||{}),this.fromSearchParams=g(this,r,"m",u).call(this,n||{})}getAfterSignInUrl(){return g(this,r,"m",c).call(this,"signIn")}getAfterSignUpUrl(){return g(this,r,"m",c).call(this,"signUp")}getPreservedSearchParams(){return g(this,r,"m",s).call(this,g(this,r,"m",a).call(this))}toSearchParams(){return g(this,r,"m",s).call(this,g(this,r,"m",o).call(this))}}i=v,h=new WeakMap,r=new WeakSet,s=function(e){const t=Object.fromEntries(Object.entries(e).map((([e,t])=>[(0,f.a1)(e),t])));return new URLSearchParams((e=>Object.entries(e).reduce(((e,[t,n])=>(null!=n&&(e[t]=n),e)),{}))(t))},a=function(){return Object.fromEntries(Object.entries({...this.fromSearchParams}).filter((([e])=>i.preserved.includes(e))))},o=function(){const e=this.fromSearchParams.signUpForceRedirectUrl||this.fromProps.signUpForceRedirectUrl||this.fromOptions.signUpForceRedirectUrl,t=this.fromSearchParams.signUpFallbackRedirectUrl||this.fromProps.signUpFallbackRedirectUrl||this.fromOptions.signUpFallbackRedirectUrl,n=this.fromSearchParams.signInForceRedirectUrl||this.fromProps.signInForceRedirectUrl||this.fromOptions.signInForceRedirectUrl,r={signUpForceRedirectUrl:e,signUpFallbackRedirectUrl:t,signInFallbackRedirectUrl:this.fromSearchParams.signInFallbackRedirectUrl||this.fromProps.signInFallbackRedirectUrl||this.fromOptions.signInFallbackRedirectUrl,signInForceRedirectUrl:n,afterSignInUrl:this.fromSearchParams.afterSignInUrl||this.fromProps.afterSignInUrl||this.fromOptions.afterSignInUrl,afterSignUpUrl:this.fromSearchParams.afterSignUpUrl||this.fromProps.afterSignUpUrl||this.fromOptions.afterSignUpUrl,redirectUrl:this.fromSearchParams.redirectUrl||this.fromProps.redirectUrl||this.fromOptions.redirectUrl};return e&&delete r.signUpFallbackRedirectUrl,n&&delete r.signInFallbackRedirectUrl,r},c=function(e){const t=`${e}ForceRedirectUrl`,n=`${e}FallbackRedirectUrl`;let r;const i=`after${e[0].toUpperCase()}${e.slice(1)}Url`;let s;s=this.fromSearchParams[t]||this.fromProps[t]||this.fromOptions[t],s&&(r=t),s||(s=this.fromSearchParams.redirectUrl),s&&(r="redirectUrl"),s||(s=this.fromSearchParams[n]||this.fromProps[n]||this.fromOptions[n]),s&&(r=n);const a=this.fromSearchParams[i]||this.fromProps[i]||this.fromProps.redirectUrl||this.fromOptions[i];return(0,p.L)(r,s,i,a),s||(s=a),s||"/"},l=function(e){(0,p.v)(e);const t={};return i.keys.forEach((n=>{t[n]=e[n]})),g(this,r,"m",d).call(this,g(this,h,"f").call(this,t))},u=function(e){(0,p.v)(e);const t={};return i.keys.forEach((n=>{t[n]=e[(0,f.a1)(n)]})),t.redirectUrl=e.redirect_url,g(this,r,"m",d).call(this,g(this,h,"f").call(this,t))},d=function(e){return((e,t)=>{const n={};for(const i in e)n[i]=(r=e[i],(0,m.R9)(r,window.location.origin));var r;return n})(e)},v.keys=["signInForceRedirectUrl","signInFallbackRedirectUrl","signUpForceRedirectUrl","signUpFallbackRedirectUrl","afterSignInUrl","afterSignUpUrl","redirectUrl"],v.preserved=["redirectUrl"]},3547:function(e,t,n){"use strict";n.d(t,{KV:function(){return m},$1:function(){return A},l1:function(){return y},eT:function(){return S},F9:function(){return I},pU:function(){return _},u9:function(){return f},un:function(){return d},To:function(){return C},jv:function(){return w},z9:function(){return k},hb:function(){return P},R9:function(){return b},WW:function(){return E},M:function(){return g},Os:function(){return v}}),n(7498);var r=n(450),i=n(3911),s=n(4661),a=n(6479),o=n(5323),c=n(5810),l=n(5616);const u="http://clerk-dummy",{isDevOrStagingUrl:d}=(0,i.MY)(),h=new Map;function f(e=window.location.hostname){if(!e)return!1;let t=h.get(e);return void 0===t&&(t=(0,o.A5)(e)||(0,o.LQ)(e),h.set(e,t)),t}function p(e){return e.replace("clerk.","")}function m(e,t={}){const{base:n,hashPath:r,hashSearch:i,searchParams:s,hashSearchParams:o,...d}=e;let h="";h="undefined"!=typeof window&&window.location?window.location.href:"http://react-native-fake-base-url";const f=new URL(n||"",h);if(s instanceof URLSearchParams&&s.forEach(((e,t)=>{null!=e&&f.searchParams.set((0,a.a1)(t),e)})),Object.assign(f,d),r||i||o){const e=new URL(u+f.hash.substring(1));e.pathname=(0,c.R)(e.pathname,r||"");const t=(0,l.v)(i||"");for(const[r,i]of Object.entries(t))e.searchParams.append(r,i);if(o){const t=Array.isArray(o)?o:[o];for(const n of t)(n instanceof URLSearchParams||"object"==typeof n)&&new URLSearchParams(n).forEach(((t,n)=>{null!=t&&e.searchParams.set((0,a.a1)(n),t)}))}const n=e.href.replace(u,"");"/"!==n&&(f.hash=n)}const{stringify:p,skipOrigin:m}=t;return p?m?f.href.replace(f.origin,""):f.href:f}function g(e){return(e=function(e){return new URL(e.toString(),window.location.origin)}(e)).href.replace(e.origin,"")}const v=e=>(e||"").replace(/\/+$/,""),y=e=>{const{externalAccount:t}=e.verifications;return!!t.error};function w(e){if(!e)return!1;try{return new URL(e),!0}catch(t){return!1}}function b(e,t){return w(e)?e:new URL(e,t).href}function _(e){return!!w(e)&&"data:"===new URL(e).protocol}const S=e=>new URL(e,u).hash.startsWith("#/"),k=e=>{const t=new URL(e);if(!S(t))return t;const n=new URL(t.hash.replace("#/","/"),t.href),r=[t.pathname,n.pathname].map((e=>e.split("/"))).flat().filter(Boolean).join("/"),i=new URL(r,t.origin);return t.searchParams.forEach(((e,t)=>{i.searchParams.set(t,e)})),n.searchParams.forEach(((e,t)=>{i.searchParams.set(t,e)})),i},P=e=>e.replace(/CLERK-ROUTER\/(.*?)\//,""),U=["/oauth/authorize"],O=["/v1/verify","/v1/tickets/accept"];function C(e,t){const n=new URL(t,u),r=n.pathname,i=U.includes(r)||O.includes(r);return e===n.host&&i}function E(e){const t=new URL(e,u);return U.includes(t.pathname)}const I=e=>t=>{if(!e)return!0;const n=new URL(t,u);if(n.origin===u)return!0;const i=e.map((e=>"string"==typeof e?(e=>{try{return r(e)}catch(t){throw new Error(`Invalid pattern: ${e}.\nConsult the documentation of glob-to-regexp here: https://www.npmjs.com/package/glob-to-regexp.\n${t.message}`)}})(v(e)):e)).some((e=>e.test(v(n.origin))));return i||s.k.warnOnce(`Clerk: Redirect URL ${n} is not on one of the allowedRedirectOrigins, falling back to the default redirect URL.`),i};function A(e,t){if(Array.isArray(e)&&e.length)return e;const n=[];return"undefined"!=typeof window&&window.location&&n.push(window.location.origin),n.push(`https://${p(t)}`),n.push(`https://*.${p(t)}`),n}},4016:function(e,t,n){"use strict";n.d(t,{Pp:function(){return r},Qm:function(){return i},xC:function(){return s}});const r=({firstName:e,lastName:t,name:n})=>n||[e,t].join(" ").trim()||"",i=({firstName:e,lastName:t,name:n})=>[(e||"")[0],(t||"")[0]].join("").trim()||(n||"")[0],s=e=>e.username?e.username:e.primaryEmailAddress?e.primaryEmailAddress.emailAddress:e.primaryPhoneNumber?e.primaryPhoneNumber.phoneNumber:e.primaryWeb3Wallet?e.primaryWeb3Wallet.web3Wallet:""},8621:function(e,t,n){"use strict";async function r(){if(!n.g.ethereum)return"";const e=await n.g.ethereum.request({method:"eth_requestAccounts"});return e&&e[0]||""}async function i({identifier:e,nonce:t}){return n.g.ethereum?await n.g.ethereum.request({method:"personal_sign",params:[`0x${r=t,r.split("").map((e=>e.charCodeAt(0).toString(16).padStart(2,"0"))).join("")}`,e]}):"";var r}n.d(t,{w:function(){return i},M:function(){return r}})},196:function(e,t,n){"use strict";n.d(t,{I:function(){return r},T:function(){return s}});const r="clerk:beforeunload",i=["http:","https:","wails:","chrome-extension:"];function s(e){let t=new URL(e,window.location.href);i.includes(t.protocol)||(console.warn(`Clerk: "${t.protocol}" is not a valid protocol. Redirecting to "/" instead. If you think this is a mistake, please open an issue.`),t=new URL("/",window.location.href)),window.dispatchEvent(new CustomEvent(r)),window.location.href=t.href}},452:function(e,t,n){"use strict";var r=n(2784),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=r.useState,a=r.useEffect,o=r.useLayoutEffect,c=r.useDebugValue;function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(r){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=s({inst:{value:n,getSnapshot:t}}),i=r[0].inst,u=r[1];return o((function(){i.value=n,i.getSnapshot=t,l(i)&&u({inst:i})}),[e,n,t]),a((function(){return l(i)&&u({inst:i}),e((function(){l(i)&&u({inst:i})}))}),[e]),c(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},3100:function(e,t,n){"use strict";e.exports=n(452)},305:function(e,t,n){"use strict";n.d(t,{_f:function(){return r._f},af:function(){return r.af}});var r=n(4409);n(7498)},7498:function(e,t,n){"use strict";n.d(t,{Ko:function(){return f},U9:function(){return m},ac:function(){return h},qx:function(){return p},r2:function(){return c},yA:function(){return u}});var r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=e=>{throw TypeError(e)},c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let c of s(t))a.call(e,c)||c===n||r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,n)=>(l(e,t,"default"),n&&l(n,t,"default")),d=(e,t,n)=>t.has(e)||o("Cannot "+n),h=(e,t,n)=>(d(e,t,"read from private field"),n?n.call(e):t.get(e)),f=(e,t,n)=>t.has(e)?o("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),p=(e,t,n,r)=>(d(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),m=(e,t,n)=>(d(e,t,"access private method"),n)},7655:function(e,t,n){"use strict";n.d(t,{k:function(){return i}});var r=new Set,i={warnOnce:e=>{r.has(e)||(r.add(e),console.warn(e))},logOnce:e=>{r.has(e)||(console.log(e),r.add(e))}}},4455:function(e,t,n){"use strict";n.d(t,{Bc:function(){return a},P9:function(){return i},lY:function(){return s}});var r=864e5;function i(e){try{return new Date(e||new Date)}catch(t){return new Date}}function s(e){const{date:t,relativeTo:n}=e;if(!t||!n)return null;const s=i(t),a=function(e,t,{absolute:n=!0}={}){if(!e||!t)return 0;const i=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),s=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()),a=Math.floor((s-i)/r);return n?Math.abs(a):a}(i(n),s,{absolute:!1});return a<-6?{relativeDateCase:"other",date:s}:a<-1?{relativeDateCase:"previous6Days",date:s}:-1===a?{relativeDateCase:"lastDay",date:s}:0===a?{relativeDateCase:"sameDay",date:s}:1===a?{relativeDateCase:"nextDay",date:s}:a<7?{relativeDateCase:"next6Days",date:s}:{relativeDateCase:"other",date:s}}function a(e,t){const n=i(e);return n.setFullYear(n.getFullYear()+t),n}},5323:function(e,t,n){"use strict";n.d(t,{A5:function(){return a},LQ:function(){return o},d5:function(){return i},xy:function(){return s}});var r=n(9458);function i(e=""){return(e||"").replace(/^.+:\/\//,"")}function s(e){if(!e)return"";let t;if(e.match(/^(clerk\.)+\w*$/))t=/(clerk\.)*(?=clerk\.)/;else{if(e.match(/\.clerk.accounts/))return e;t=/^(clerk\.)*/gi}return`clerk.${e.replace(t,"")}`}function a(e){return r.mv.some((t=>e.startsWith("accounts.")&&e.endsWith(t)))}function o(e){return r.JF.some((t=>e.endsWith(t)&&!e.endsWith(".clerk"+t)))}},4409:function(e,t,n){"use strict";function r(){return"undefined"!=typeof window}n.d(t,{Er:function(){return s},TN:function(){return a},_f:function(){return r},af:function(){return o}});var i=new RegExp(["bot","spider","crawl","APIs-Google","AdsBot","Googlebot","mediapartners","Google Favicon","FeedFetcher","Google-Read-Aloud","DuplexWeb-Google","googleweblight","bing","yandex","baidu","duckduck","yahoo","ecosia","ia_archiver","facebook","instagram","pinterest","reddit","slack","twitter","whatsapp","youtube","semrush"].join("|"),"i");function s(){const e=r()?null==window?void 0:window.navigator:null;return!(!e||(t=null==e?void 0:e.userAgent,t&&i.test(t)||(null==e?void 0:e.webdriver)));var t}function a(){var e,t;const n=r()?null==window?void 0:window.navigator:null;if(!n)return!1;const i=null==n?void 0:n.onLine;return 0!==(null==(e=null==n?void 0:n.connection)?void 0:e.rtt)&&0!==(null==(t=null==n?void 0:n.connection)?void 0:t.downlink)&&i}function o(){return a()&&s()}},3151:function(e,t,n){"use strict";function r(e){const t=e||"";return t.charAt(0).toUpperCase()+t.slice(1)}function i(e){return e?e.replace(/([-_][a-z])/g,(e=>e.toUpperCase().replace(/-|_/,""))):""}function s(e){return e?e.replace(/[A-Z]/g,(e=>`_${e.toLowerCase()}`)):""}n.d(t,{MI:function(){return r},TD:function(){return i},a1:function(){return s},aw:function(){return o},fQ:function(){return c},hF:function(){return l}});var a=e=>{const t=n=>{if(!n)return n;if(Array.isArray(n))return n.map((e=>"object"==typeof e||Array.isArray(e)?t(e):e));const r={...n},i=Object.keys(r);for(const s of i){const n=e(s.toString());n!==s&&(r[n]=r[s],delete r[s]),"object"==typeof r[n]&&(r[n]=t(r[n]))}return r};return t},o=(a(s),a(i));function c(e){if("boolean"==typeof e)return e;if(null==e)return!1;if("string"==typeof e){if("true"===e.toLowerCase())return!0;if("false"===e.toLowerCase())return!1}const t=parseInt(e,10);return!isNaN(t)&&t>0}function l(e){return Object.entries(e).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=n),e)),{})}},2289:function(e,t,n){"use strict";function r(e){const t=null==e?void 0:e.status;return!!t&&t>=400&&t<500}function i(e){return(`${e.message}${e.name}`||"").toLowerCase().replace(/\s+/g,"").includes("networkerror")}function s(e){return a(e)||c(e)||o(e)}function a(e){return"clerkError"in e}function o(e){return"clerkRuntimeError"in e}function c(e){return"code"in e&&[4001,32602,32603].includes(e.code)&&"message"in e}function l(e){var t,n;return a(e)&&"user_locked"===(null==(n=null==(t=e.errors)?void 0:t[0])?void 0:n.code)}function u(e){var t,n;return a(e)&&"form_password_pwned"===(null==(n=null==(t=e.errors)?void 0:t[0])?void 0:n.code)}function d(e=[]){return e.length>0?e.map(h):[]}function h(e){var t,n,r,i,s;return{code:e.code,message:e.message,longMessage:e.long_message,meta:{paramName:null==(t=null==e?void 0:e.meta)?void 0:t.param_name,sessionId:null==(n=null==e?void 0:e.meta)?void 0:n.session_id,emailAddresses:null==(r=null==e?void 0:e.meta)?void 0:r.email_addresses,identifiers:null==(i=null==e?void 0:e.meta)?void 0:i.identifiers,zxcvbn:null==(s=null==e?void 0:e.meta)?void 0:s.zxcvbn}}}n.d(t,{G1:function(){return g},N:function(){return m},UZ:function(){return u},ZC:function(){return c},_L:function(){return v},ay:function(){return l},eE:function(){return i},gO:function(){return f},iR:function(){return d},ix:function(){return r},kD:function(){return a},nU:function(){return h},sZ:function(){return s},t5:function(){return w},uX:function(){return o},w$:function(){return p}});var f=class e extends Error{constructor(t,{data:n,status:r,clerkTraceId:i}){super(t),this.toString=()=>{let e=`[${this.name}]\nMessage:${this.message}\nStatus:${this.status}\nSerialized errors: ${this.errors.map((e=>JSON.stringify(e)))}`;return this.clerkTraceId&&(e+=`\nClerk Trace ID: ${this.clerkTraceId}`),e},Object.setPrototypeOf(this,e.prototype),this.status=r,this.message=t,this.clerkTraceId=i,this.clerkError=!0,this.errors=d(n)}},p=class e extends Error{constructor(t,{code:n}){super(t),this.toString=()=>`[${this.name}]\nMessage:${this.message}`,Object.setPrototypeOf(this,e.prototype),this.code=n,this.message=t,this.clerkRuntimeError=!0}},m=class e extends Error{constructor(t){super(t),this.code=t,Object.setPrototypeOf(this,e.prototype)}};function g(e){return e instanceof m}var v={Expired:"expired",Failed:"failed",ClientMismatch:"client_mismatch"},y=Object.freeze({InvalidProxyUrlErrorMessage:"The proxyUrl passed to Clerk is invalid. The expected value for proxyUrl is an absolute URL or a relative path with a leading '/'. (key={{url}})",InvalidPublishableKeyErrorMessage:"The publishableKey passed to Clerk is invalid. You can get your Publishable key at https://dashboard.clerk.com/last-active?path=api-keys. (key={{key}})",MissingPublishableKeyErrorMessage:"Missing publishableKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.",MissingSecretKeyErrorMessage:"Missing secretKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.",MissingClerkProvider:"{{source}} can only be used within the component. Learn more: https://clerk.com/docs/components/clerk-provider"});function w({packageName:e,customMessages:t}){let n=e;const r={...y,...t};function i(e,t){if(!t)return`${n}: ${e}`;let r=e;const i=e.matchAll(/{{([a-zA-Z0-9-_]+)}}/g);for(const n of i){const e=(t[n[1]]||"").toString();r=r.replace(`{{${n[1]}}}`,e)}return`${n}: ${r}`}return{setPackageName({packageName:e}){return"string"==typeof e&&(n=e),this},setMessages({customMessages:e}){return Object.assign(r,e||{}),this},throwInvalidPublishableKeyError(e){throw new Error(i(r.InvalidPublishableKeyErrorMessage,e))},throwInvalidProxyUrl(e){throw new Error(i(r.InvalidProxyUrlErrorMessage,e))},throwMissingPublishableKeyError(){throw new Error(i(r.MissingPublishableKeyErrorMessage))},throwMissingSecretKeyError(){throw new Error(i(r.MissingSecretKeyErrorMessage))},throwMissingClerkProviderError(e){throw new Error(i(r.MissingClerkProvider,e))},throw(e){throw new Error(i(e))}}}},3063:function(e,t,n){"use strict";n.d(t,{S:function(){return r}});var r=e=>"undefined"!=typeof atob&&"function"==typeof atob?atob(e):"undefined"!=typeof global&&global.Buffer?new global.Buffer(e,"base64").toString():e},9458:function(e,t,n){"use strict";n.d(t,{JF:function(){return i},mv:function(){return r},vO:function(){return s}});var r=[".lcl.dev",".lclstage.dev",".lclclerk.com"],i=[".accounts.dev",".accountsstage.dev",".accounts.lclclerk.com"],s=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"]},2351:function(e,t,n){"use strict";n.d(t,{Q5:function(){return a},Ww:function(){return o},ZT:function(){return r}});var r=(...e)=>{},i='const respond=r=>{self.postMessage(r)},workerToTabIds={};self.addEventListener("message",r=>{const e=r.data;switch(e.type){case"setTimeout":workerToTabIds[e.id]=setTimeout(()=>{respond({id:e.id})},e.ms);break;case"clearTimeout":workerToTabIds[e.id]&&(clearTimeout(workerToTabIds[e.id]),delete workerToTabIds[e.id]);break;case"setInterval":workerToTabIds[e.id]=setInterval(()=>{respond({id:e.id})},e.ms);break;case"clearInterval":workerToTabIds[e.id]&&(clearInterval(workerToTabIds[e.id]),delete workerToTabIds[e.id]);break}});\n',s=(e,t={})=>{if("undefined"==typeof Worker)return null;try{const n=new Blob([e],{type:"application/javascript; charset=utf-8"}),r=globalThis.URL.createObjectURL(n);return new Worker(r,t)}catch(n){return console.warn("Clerk: Cannot create worker from blob. Consider adding worker-src blob:; to your CSP"),null}},a=()=>{let e=0;const t=()=>e++,n=new Map,a=(e,t)=>null==e?void 0:e.postMessage(t),o=e=>{var t;null==(t=n.get(e.data.id))||t()};let c=s(i,{name:"clerk-timers"});if(null==c||c.addEventListener("message",o),!c)return{setTimeout:globalThis.setTimeout.bind(globalThis),setInterval:globalThis.setInterval.bind(globalThis),clearTimeout:globalThis.clearTimeout.bind(globalThis),clearInterval:globalThis.clearInterval.bind(globalThis),cleanup:r};const l=()=>{c||(c=s(i,{name:"clerk-timers"}),null==c||c.addEventListener("message",o))};return{setTimeout:(e,r)=>{l();const i=t();return n.set(i,e),a(c,{type:"setTimeout",id:i,ms:r}),i},setInterval:(e,r)=>{l();const i=t();return n.set(i,e),a(c,{type:"setInterval",id:i,ms:r}),i},clearTimeout:e=>{l(),n.delete(e),a(c,{type:"clearTimeout",id:e})},clearInterval:e=>{l(),n.delete(e),a(c,{type:"clearInterval",id:e})},cleanup:()=>{c&&(c.terminate(),c=null,n.clear())}}};function o({delayInMs:e}={delayInMs:1e3}){const t=a();let n,r=!1;const i=()=>{n&&(t.clearTimeout(n),t.cleanup()),r=!0},s=async a=>{r=!1,await a(i),r||(n=t.setTimeout((()=>{s(a)}),e))};return{run:s,stop:i}}},7189:function(e,t,n){"use strict";n.d(t,{MY:function(){return c},kZ:function(){return l},nQ:function(){return o}});var r=n(3063),i=n(9458),s="pk_live_",a="pk_test_";function o(e,t={}){if(!(e=e||"")||!function(e){const t=(e=e||"").startsWith(s)||e.startsWith(a),n=(0,r.S)(e.split("_")[2]||"").endsWith("$");return t&&n}(e)){if(t.fatal)throw new Error("Publishable key not valid.");return null}const n=e.startsWith(s)?"production":"development";let i=(0,r.S)(e.split("_")[2]);return i=i.slice(0,-1),t.proxyUrl?i=t.proxyUrl:"development"!==n&&t.domain&&(i=`clerk.${t.domain}`),{instanceType:n,frontendApi:i}}function c(){const e=new Map;return{isDevOrStagingUrl:t=>{if(!t)return!1;const n="string"==typeof t?t:t.hostname;let r=e.get(n);return void 0===r&&(r=i.vO.some((e=>n.endsWith(e))),e.set(n,r)),r}}}function l(e){return e.startsWith("test_")||e.startsWith("pk_test_")}},221:function(e,t,n){"use strict";n.d(t,{G1:function(){return r.G1},N:function(){return r.N},UZ:function(){return r.UZ},ZC:function(){return r.ZC},_L:function(){return r._L},ay:function(){return r.ay},eE:function(){return r.eE},gO:function(){return r.gO},iR:function(){return r.iR},ix:function(){return r.ix},kD:function(){return r.kD},nU:function(){return r.nU},sZ:function(){return r.sZ},t5:function(){return r.t5},uX:function(){return r.uX},w$:function(){return r.w$}});var r=n(2289);n(7498)},2022:function(e,t,n){"use strict";n.d(t,{w$:function(){return d.w$},yd:function(){return i},Ww:function(){return s.Ww},xy:function(){return r.xy},a1:function(){return u.a1},WK:function(){return v},Q5:function(){return s.Q5},aw:function(){return u.aw},lY:function(){return m.lY},L4:function(){return u.hF},YZ:function(){return h},_f:function(){return p._f},ix:function(){return d.ix},TN:function(){return p.TN},kD:function(){return d.kD},vf:function(){return g},ZD:function(){return o},ay:function(){return d.ay},af:function(){return p.af},jL:function(){return a},ZT:function(){return s.ZT},P9:function(){return m.P9},nQ:function(){return f.nQ},kI:function(){return l},$V:function(){return w},TD:function(){return u.TD},d5:function(){return r.d5},up:function(){return u.MI}});var r=n(5323),i=class{constructor(e){this.eventTarget=window,this.postMessage=e=>{if("undefined"!=typeof window)try{window.localStorage.setItem(this.channelKey,JSON.stringify(e)),window.localStorage.removeItem(this.channelKey)}catch(t){}},this.addEventListener=(e,t)=>{this.eventTarget.addEventListener(this.prefixEventName(e),(e=>{t(e)}))},this.setupLocalStorageListener=()=>{window.addEventListener("storage",(e=>{if(e.key===this.channelKey&&e.newValue)try{const t=JSON.parse(e.newValue||""),n=new MessageEvent(this.prefixEventName("message"),{data:t});this.eventTarget.dispatchEvent(n)}catch(t){}}))},this.channelKey="__lsbc__"+e,this.setupLocalStorageListener()}prefixEventName(e){return this.channelKey+e}},s=(n(7655),n(2351));function a(e){return!e||o(e)||c(e)}function o(e){return/^http(s)?:\/\//.test(e||"")}function c(e){return e.startsWith("/")}function l(e){return e?c(e)?new URL(e,window.location.origin).toString():e:""}var u=n(3151),d=n(2289);function h(e,t,n){return"function"==typeof e?e(t):void 0!==e?e:void 0!==n?n:void 0}Object.freeze({"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/x-icon":"ico","image/vnd.microsoft.icon":"ico"});var f=n(7189),p=n(4409),m=n(4455),g=()=>{try{return!1}catch(e){}return!1},v=(n(7498),()=>{let e=s.ZT,t=s.ZT;return{promise:new Promise(((n,r)=>{e=n,t=r})),resolve:e,reject:t}}),y={firstDelay:125,maxDelay:0,timeMultiple:2,shouldRetry:()=>!0},w=async(e,t={})=>{let n=0;const{shouldRetry:r,firstDelay:i,maxDelay:s,timeMultiple:a}={...y,...t},o=(e=>{let t=0;return async()=>{await(async e=>new Promise((t=>setTimeout(t,e))))((()=>{const n=e.firstDelay,r=e.timeMultiple,i=n*Math.pow(r,t);return Math.min(e.maxDelay||i,i)})()),t++}})({firstDelay:i,maxDelay:s,timeMultiple:a});for(;;)try{return await e()}catch(c){if(n++,!r(c,n))throw c;await o()}}},3911:function(e,t,n){"use strict";n.d(t,{MY:function(){return r.MY},kZ:function(){return r.kZ}});var r=n(7189);n(7498)},5213:function(e,t,n){"use strict";n.d(t,{v:function(){return s}});var r="loadScript cannot be called when document does not exist",i="loadScript cannot be called without a src";async function s(e="",t){const{async:n,defer:s,beforeLoad:a,crossOrigin:o}=t||{};return new Promise(((t,c)=>{e||c(i),document&&document.body||c(r);const l=document.createElement("script");o&&l.setAttribute("crossorigin",o),l.async=n||!1,l.defer=s||!1,l.addEventListener("load",(()=>{l.remove(),t(l)})),l.addEventListener("error",(()=>{l.remove(),c()})),l.src=e,null==a||a(l),document.body.appendChild(l)}))}n(7498)},4661:function(e,t,n){"use strict";n.d(t,{k:function(){return r.k}});var r=n(7655);n(7498)},7752:function(e,t,n){"use strict";n.d(t,{b5:function(){return me},RY:function(){return we},f0:function(){return Ue},B3:function(){return _e},St:function(){return ve},LB:function(){return he},uH:function(){return fe},cL:function(){return We},sX:function(){return be},I7:function(){return Ve},o8:function(){return Re},eW:function(){return ze},Gw:function(){return Me},kP:function(){return Ne},Tt:function(){return Se},xo:function(){return $e},aF:function(){return Le},SE:function(){return ye}});var r={};function i(e,t){return{event:"METHOD_CALLED",payload:{method:e,...t}}}n.r(r),n.d(r,{SWRConfig:function(){return se},default:function(){return ae},mutate:function(){return j},preload:function(){return X},unstable_serialize:function(){return ne},useSWRConfig:function(){return Y}});var s=n(7498),a=n(2784),o=n(3100);const c=()=>{},l=c(),u=Object,d=e=>e===l,h=e=>"function"==typeof e,f=(e,t)=>({...e,...t}),p=new WeakMap;let m=0;const g=e=>{const t=typeof e,n=e&&e.constructor,r=n==Date;let i,s;if(u(e)!==e||r||n==RegExp)i=r?e.toJSON():"symbol"==t?e.toString():"string"==t?JSON.stringify(e):""+e;else{if(i=p.get(e),i)return i;if(i=++m+"~",p.set(e,i),n==Array){for(i="@",s=0;s{const n=v.get(e);return[()=>!d(t)&&e.get(t)||y,r=>{if(!d(t)){const i=e.get(t);t in w||(w[t]=i),n[5](t,f(i,r),i||y)}},n[6],()=>!d(t)&&t in w?w[t]:!d(t)&&e.get(t)||y]};let P=!0;const[U,O]=_&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[c,c],C={isOnline:()=>P,isVisible:()=>{const e=S&&document.visibilityState;return d(e)||"hidden"!==e}},E={initFocus:e=>(S&&document.addEventListener("visibilitychange",e),U("focus",e),()=>{S&&document.removeEventListener("visibilitychange",e),O("focus",e)}),initReconnect:e=>{const t=()=>{P=!0,e()},n=()=>{P=!1};return U("online",t),U("offline",n),()=>{O("online",t),O("offline",n)}}},I=!a.useId,A=!_||"Deno"in window,T=e=>_&&typeof window.requestAnimationFrame!=b?window.requestAnimationFrame(e):setTimeout(e,1),R=A?a.useEffect:a.useLayoutEffect,x="undefined"!=typeof navigator&&navigator.connection,z=!A&&x&&(["slow-2g","2g"].includes(x.effectiveType)||x.saveData),M=e=>{if(h(e))try{e=e()}catch(n){e=""}const t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?g(e):"",t]};let N=0;const $=()=>++N;async function L(...e){const[t,n,r,i]=e,s=f({populateCache:!0,throwOnError:!0},"boolean"==typeof i?{revalidate:i}:i||{});let a=s.populateCache;const o=s.rollbackOnError;let c=s.optimisticData;const u=s.throwOnError;if(h(n)){const e=n,r=[],i=t.keys();for(const n of i)!/^\$(inf|sub)\$/.test(n)&&e(t.get(n)._k)&&r.push(n);return Promise.all(r.map(p))}return p(n);async function p(n){const[i]=M(n);if(!i)return;const[f,p]=k(t,i),[m,g,y,w]=v.get(t),b=()=>{const e=m[i];return(h(s.revalidate)?s.revalidate(f().data,n):!1!==s.revalidate)&&(delete y[i],delete w[i],e&&e[0])?e[0](2).then((()=>f().data)):f().data};if(e.length<3)return b();let _,S=r;const P=$();g[i]=[P,0];const U=!d(c),O=f(),C=O.data,E=O._c,I=d(E)?C:E;if(U&&(c=h(c)?c(I,C):c,p({data:c,_c:I})),h(S))try{S=S(I)}catch(A){_=A}if(S&&h(S.then)){if(S=await S.catch((e=>{_=e})),P!==g[i][0]){if(_)throw _;return S}_&&U&&(e=>"function"==typeof o?o(e):!1!==o)(_)&&(a=!0,p({data:I,_c:l}))}if(a&&!_)if(h(a)){const e=a(S,I);p({data:e,error:l,_c:l})}else p({data:S,error:l,_c:l});if(g[i][1]=$(),Promise.resolve(b()).then((()=>{p({_c:l})})),!_)return S;if(u)throw _}}const W=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},D=(e,t)=>{if(!v.has(e)){const n=f(E,t),r={},i=L.bind(l,e);let s=c;const a={},o=(e,t)=>{const n=a[e]||[];return a[e]=n,n.push(t),()=>n.splice(n.indexOf(t),1)},u=(t,n,r)=>{e.set(t,n);const i=a[t];if(i)for(const e of i)e(n,r)},d=()=>{if(!v.has(e)&&(v.set(e,[r,{},{},{},i,u,o]),!A)){const t=n.initFocus(setTimeout.bind(l,W.bind(l,r,0))),i=n.initReconnect(setTimeout.bind(l,W.bind(l,r,1)));s=()=>{t&&t(),i&&i(),v.delete(e)}}};return d(),[e,i,d,s]}return[e,v.get(e)[4]]},[F,j]=D(new Map),V=f({onLoadingSlow:c,onSuccess:c,onError:c,onErrorRetry:(e,t,n,r,i)=>{const s=n.errorRetryCount,a=i.retryCount,o=~~((Math.random()+.5)*(1<<(a<8?a:8)))*n.errorRetryInterval;!d(s)&&a>s||setTimeout(r,o,i)},onDiscarded:c,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:z?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:z?5e3:3e3,compare:(e,t)=>g(e)==g(t),isPaused:()=>!1,cache:F,mutate:j,fallback:{}},C),K=(e,t)=>{const n=f(e,t);if(t){const{use:r,fallback:i}=e,{use:s,fallback:a}=t;r&&s&&(n.use=r.concat(s)),i&&a&&(n.fallback=f(i,a))}return n},J=(0,a.createContext)({}),q=e=>{const{value:t}=e,n=(0,a.useContext)(J),r=h(t),i=(0,a.useMemo)((()=>r?t(n):t),[r,n,t]),s=(0,a.useMemo)((()=>r?i:K(n,i)),[r,n,i]),o=i&&i.provider,c=(0,a.useRef)(l);o&&!c.current&&(c.current=D(o(s.cache||F),i));const u=c.current;return u&&(s.cache=u[0],s.mutate=u[1]),R((()=>{if(u)return u[2]&&u[2](),u[3]}),[]),(0,a.createElement)(J.Provider,f(e,{value:s}))},B="$inf$",Z=_&&window.__SWR_DEVTOOLS_USE__,G=Z?window.__SWR_DEVTOOLS_USE__:[],H=e=>h(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],Y=()=>f(V,(0,a.useContext)(J)),X=(e,t)=>{const[n,r]=M(e),[,,,i]=v.get(F);if(i[n])return i[n];const s=t(r);return i[n]=s,s},Q=G.concat((e=>(t,n,r)=>e(t,n&&((...e)=>{const[r]=M(t),[,,,i]=v.get(F);if(r.startsWith(B))return n(...e);const s=i[r];return d(s)?n(...e):(delete i[r],s)}),r))),ee=e=>function(...t){const n=Y(),[r,i,s]=H(t),a=K(n,s);let o=e;const{use:c}=a,l=(c||[]).concat(Q);for(let e=l.length;e--;)o=l[e](o);return o(r,i||a.fetcher||null,a)},te=(e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const e=r.indexOf(n);e>=0&&(r[e]=r[r.length-1],r.pop())}};Z&&(window.__SWR_DEVTOOLS_REACT__=a);const ne=e=>M(e)[0],re=a.use||(e=>{if("pending"===e.status)throw e;if("fulfilled"===e.status)return e.value;throw"rejected"===e.status?e.reason:(e.status="pending",e.then((t=>{e.status="fulfilled",e.value=t}),(t=>{e.status="rejected",e.reason=t})),e)}),ie={dedupe:!0},se=u.defineProperty(q,"defaultValue",{value:V}),ae=ee(((e,t,n)=>{const{cache:r,compare:i,suspense:s,fallbackData:c,revalidateOnMount:u,revalidateIfStale:p,refreshInterval:m,refreshWhenHidden:g,refreshWhenOffline:y,keepPreviousData:w}=n,[b,_,S,P]=v.get(r),[U,O]=M(e),C=(0,a.useRef)(!1),E=(0,a.useRef)(!1),x=(0,a.useRef)(U),z=(0,a.useRef)(t),N=(0,a.useRef)(n),W=()=>N.current,D=()=>W().isVisible()&&W().isOnline(),[F,j,V,K]=k(r,U),J=(0,a.useRef)({}).current,q=d(c)?n.fallback[U]:c,B=(e,t)=>{for(const n in J){const r=n;if("data"===r){if(!i(e[r],t[r])){if(!d(e[r]))return!1;if(!i(se,t[r]))return!1}}else if(t[r]!==e[r])return!1}return!0},Z=(0,a.useMemo)((()=>{const e=!!U&&!!t&&(d(u)?!W().isPaused()&&!s&&(!!d(p)||p):u),n=t=>{const n=f(t);return delete n._k,e?{isValidating:!0,isLoading:!0,...n}:n},r=F(),i=K(),a=n(r),o=r===i?a:n(i);let c=a;return[()=>{const e=n(F());return B(e,c)?(c.data=e.data,c.isLoading=e.isLoading,c.isValidating=e.isValidating,c.error=e.error,c):(c=e,e)},()=>o]}),[r,U]),G=(0,o.useSyncExternalStore)((0,a.useCallback)((e=>V(U,((t,n)=>{B(n,t)||e()}))),[r,U]),Z[0],Z[1]),H=!C.current,Y=b[U]&&b[U].length>0,X=G.data,Q=d(X)?q:X,ee=G.error,ne=(0,a.useRef)(Q),se=w?d(X)?ne.current:X:Q,ae=!(Y&&!d(ee))&&(H&&!d(u)?u:!W().isPaused()&&(s?!d(Q)&&p:d(Q)||p)),oe=!!(U&&t&&H&&ae),ce=d(G.isValidating)?oe:G.isValidating,le=d(G.isLoading)?oe:G.isLoading,ue=(0,a.useCallback)((async e=>{const t=z.current;if(!U||!t||E.current||W().isPaused())return!1;let r,s,a=!0;const o=e||{},c=!S[U]||!o.dedupe,u=()=>I?!E.current&&U===x.current&&C.current:U===x.current,f={isValidating:!1,isLoading:!1},p=()=>{j(f)},m=()=>{const e=S[U];e&&e[1]===s&&delete S[U]},g={isValidating:!0};d(F().data)&&(g.isLoading=!0);try{if(c&&(j(g),n.loadingTimeout&&d(F().data)&&setTimeout((()=>{a&&u()&&W().onLoadingSlow(U,n)}),n.loadingTimeout),S[U]=[t(O),$()]),[r,s]=S[U],r=await r,c&&setTimeout(m,n.dedupingInterval),!S[U]||S[U][1]!==s)return c&&u()&&W().onDiscarded(U),!1;f.error=l;const e=_[U];if(!d(e)&&(s<=e[0]||s<=e[1]||0===e[1]))return p(),c&&u()&&W().onDiscarded(U),!1;const o=F().data;f.data=i(o,r)?o:r,c&&u()&&W().onSuccess(r,U,n)}catch(v){m();const e=W(),{shouldRetryOnError:t}=e;e.isPaused()||(f.error=v,c&&u()&&(e.onError(v,U,e),(!0===t||h(t)&&t(v))&&(W().revalidateOnFocus&&W().revalidateOnReconnect&&!D()||e.onErrorRetry(v,U,e,(e=>{const t=b[U];t&&t[0]&&t[0](3,e)}),{retryCount:(o.retryCount||0)+1,dedupe:!0}))))}return a=!1,p(),!0}),[U,r]),de=(0,a.useCallback)(((...e)=>L(r,x.current,...e)),[]);if(R((()=>{z.current=t,N.current=n,d(X)||(ne.current=X)})),R((()=>{if(!U)return;const e=ue.bind(l,ie);let t=0;const n=te(U,b,((n,r={})=>{if(0==n){const n=Date.now();W().revalidateOnFocus&&n>t&&D()&&(t=n+W().focusThrottleInterval,e())}else if(1==n)W().revalidateOnReconnect&&D()&&e();else{if(2==n)return ue();if(3==n)return ue(r)}}));return E.current=!1,x.current=U,C.current=!0,j({_k:O}),ae&&(d(Q)||A?e():T(e)),()=>{E.current=!0,n()}}),[U]),R((()=>{let e;function t(){const t=h(m)?m(F().data):m;t&&-1!==e&&(e=setTimeout(n,t))}function n(){F().error||!g&&!W().isVisible()||!y&&!W().isOnline()?t():ue(ie).then(t)}return t(),()=>{e&&(clearTimeout(e),e=-1)}}),[m,g,y,U]),(0,a.useDebugValue)(se),s&&d(Q)&&U){if(!I&&A)throw new Error("Fallback data is required when using suspense in SSR.");z.current=t,N.current=n,E.current=!1;const e=P[U];if(!d(e)){const t=de(e);re(t)}if(!d(ee))throw ee;{const e=ue(ie);d(se)||(e.status="fulfilled",e.value=!0),re(e)}}return{mutate:de,get data(){return J.data=!0,se},get error(){return J.error=!0,ee},get isValidating(){return J.isValidating=!0,ce},get isLoading(){return J.isLoading=!0,le}}})),oe=a.use||(e=>{if("pending"===e.status)throw e;if("fulfilled"===e.status)return e.value;throw"rejected"===e.status?e.reason:(e.status="pending",e.then((t=>{e.status="fulfilled",e.value=t}),(t=>{e.status="rejected",e.reason=t})),e)}),ce={dedupe:!0};u.defineProperty(q,"defaultValue",{value:V});const le=ee(((e,t,n)=>{const{cache:r,compare:i,suspense:s,fallbackData:c,revalidateOnMount:u,revalidateIfStale:p,refreshInterval:m,refreshWhenHidden:g,refreshWhenOffline:y,keepPreviousData:w}=n,[b,_,S,P]=v.get(r),[U,O]=M(e),C=(0,a.useRef)(!1),E=(0,a.useRef)(!1),x=(0,a.useRef)(U),z=(0,a.useRef)(t),N=(0,a.useRef)(n),W=()=>N.current,D=()=>W().isVisible()&&W().isOnline(),[F,j,V,K]=k(r,U),J=(0,a.useRef)({}).current,q=d(c)?n.fallback[U]:c,B=(e,t)=>{for(const n in J){const r=n;if("data"===r){if(!i(e[r],t[r])){if(!d(e[r]))return!1;if(!i(re,t[r]))return!1}}else if(t[r]!==e[r])return!1}return!0},Z=(0,a.useMemo)((()=>{const e=!!U&&!!t&&(d(u)?!W().isPaused()&&!s&&(!!d(p)||p):u),n=t=>{const n=f(t);return delete n._k,e?{isValidating:!0,isLoading:!0,...n}:n},r=F(),i=K(),a=n(r),o=r===i?a:n(i);let c=a;return[()=>{const e=n(F());return B(e,c)?(c.data=e.data,c.isLoading=e.isLoading,c.isValidating=e.isValidating,c.error=e.error,c):(c=e,e)},()=>o]}),[r,U]),G=(0,o.useSyncExternalStore)((0,a.useCallback)((e=>V(U,((t,n)=>{B(n,t)||e()}))),[r,U]),Z[0],Z[1]),H=!C.current,Y=b[U]&&b[U].length>0,X=G.data,Q=d(X)?q:X,ee=G.error,ne=(0,a.useRef)(Q),re=w?d(X)?ne.current:X:Q,ie=!(Y&&!d(ee))&&(H&&!d(u)?u:!W().isPaused()&&(s?!d(Q)&&p:d(Q)||p)),se=!!(U&&t&&H&&ie),ae=d(G.isValidating)?se:G.isValidating,le=d(G.isLoading)?se:G.isLoading,ue=(0,a.useCallback)((async e=>{const t=z.current;if(!U||!t||E.current||W().isPaused())return!1;let r,s,a=!0;const o=e||{},c=!S[U]||!o.dedupe,u=()=>I?!E.current&&U===x.current&&C.current:U===x.current,f={isValidating:!1,isLoading:!1},p=()=>{j(f)},m=()=>{const e=S[U];e&&e[1]===s&&delete S[U]},g={isValidating:!0};d(F().data)&&(g.isLoading=!0);try{if(c&&(j(g),n.loadingTimeout&&d(F().data)&&setTimeout((()=>{a&&u()&&W().onLoadingSlow(U,n)}),n.loadingTimeout),S[U]=[t(O),$()]),[r,s]=S[U],r=await r,c&&setTimeout(m,n.dedupingInterval),!S[U]||S[U][1]!==s)return c&&u()&&W().onDiscarded(U),!1;f.error=l;const e=_[U];if(!d(e)&&(s<=e[0]||s<=e[1]||0===e[1]))return p(),c&&u()&&W().onDiscarded(U),!1;const o=F().data;f.data=i(o,r)?o:r,c&&u()&&W().onSuccess(r,U,n)}catch(v){m();const e=W(),{shouldRetryOnError:t}=e;e.isPaused()||(f.error=v,c&&u()&&(e.onError(v,U,e),(!0===t||h(t)&&t(v))&&(W().revalidateOnFocus&&W().revalidateOnReconnect&&!D()||e.onErrorRetry(v,U,e,(e=>{const t=b[U];t&&t[0]&&t[0](3,e)}),{retryCount:(o.retryCount||0)+1,dedupe:!0}))))}return a=!1,p(),!0}),[U,r]),de=(0,a.useCallback)(((...e)=>L(r,x.current,...e)),[]);if(R((()=>{z.current=t,N.current=n,d(X)||(ne.current=X)})),R((()=>{if(!U)return;const e=ue.bind(l,ce);let t=0;const n=te(U,b,((n,r={})=>{if(0==n){const n=Date.now();W().revalidateOnFocus&&n>t&&D()&&(t=n+W().focusThrottleInterval,e())}else if(1==n)W().revalidateOnReconnect&&D()&&e();else{if(2==n)return ue();if(3==n)return ue(r)}}));return E.current=!1,x.current=U,C.current=!0,j({_k:O}),ie&&(d(Q)||A?e():T(e)),()=>{E.current=!0,n()}}),[U]),R((()=>{let e;function t(){const t=h(m)?m(F().data):m;t&&-1!==e&&(e=setTimeout(n,t))}function n(){F().error||!g&&!W().isVisible()||!y&&!W().isOnline()?t():ue(ce).then(t)}return t(),()=>{e&&(clearTimeout(e),e=-1)}}),[m,g,y,U]),(0,a.useDebugValue)(re),s&&d(Q)&&U){if(!I&&A)throw new Error("Fallback data is required when using suspense in SSR.");z.current=t,N.current=n,E.current=!1;const e=P[U];if(!d(e)){const t=de(e);oe(t)}if(!d(ee))throw ee;{const e=ue(ce);d(re)||(e.status="fulfilled",e.value=!0),oe(e)}}return{mutate:de,get data(){return J.data=!0,re},get error(){return J.error=!0,ee},get isValidating(){return J.isValidating=!0,ae},get isLoading(){return J.isLoading=!0,le}}})),ue=Promise.resolve(),de=((e,t)=>(...n)=>{const[r,i,s]=H(n),a=(s.use||[]).concat(t);return e(r,i,{...s,use:a})})(le,(e=>(t,n,r)=>{const i=(0,a.useRef)(!1),{cache:s,initialSize:c=1,revalidateAll:u=!1,persistSize:f=!1,revalidateFirstPage:p=!0,revalidateOnMount:m=!1,parallel:g=!1}=r,[,,,y]=v.get(F);let w;try{w=(e=>M(e?e(0,null):null)[0])(t),w&&(w=B+w)}catch(T){}const[b,_,S]=k(s,w),P=(0,a.useCallback)((()=>d(b()._l)?c:b()._l),[s,w,c]);(0,o.useSyncExternalStore)((0,a.useCallback)((e=>w?S(w,(()=>{e()})):()=>{}),[s,w]),P,P);const U=(0,a.useCallback)((()=>{const e=b()._l;return d(e)?c:e}),[w,c]),O=(0,a.useRef)(U());R((()=>{i.current?w&&_({_l:f?O.current:U()}):i.current=!0}),[w,s]);const C=m&&!i.current,E=e(w,(async e=>{const i=b()._i,a=b()._r;_({_r:l});const o=[],c=U(),[h]=k(s,e),f=h().data,m=[];let v=null;for(let l=0;l{if(e in y){const t=y[e];delete y[e],b=await t}else b=await n(c);w({data:b,_k:c}),o[l]=b};g?m.push(t):await t()}else o[l]=b;g||(v=b)}return g&&await Promise.all(m.map((e=>e()))),_({_i:l}),o}),r),I=(0,a.useCallback)((function(e,t){const n="boolean"==typeof t?{revalidate:t}:t||{},r=!1!==n.revalidate;return w?(r&&(d(e)?_({_i:!0,_r:n.revalidate}):_({_i:!1,_r:n.revalidate})),arguments.length?E.mutate(e,{...n,revalidate:r}):E.mutate()):ue}),[w,s]),A=(0,a.useCallback)((e=>{if(!w)return ue;const[,n]=k(s,w);let r;if(h(e)?r=e(U()):"number"==typeof e&&(r=e),"number"!=typeof r)return ue;n({_l:r}),O.current=r;const i=[],[a]=k(s,w);let o=null;for(let c=0;c{const{assertCtxFn:n=he}=t||{},r=a.createContext(void 0);return r.displayName=e,[r,()=>{const t=a.useContext(r);return n(t,`${e} not found`),t.value},()=>{const e=a.useContext(r);return e?e.value:{}}]},pe={};(0,s.r2)(pe,{SWRConfig:()=>se,useSWR:()=>ae,useSWRInfinite:()=>de}),(0,s.yA)(pe,r);var[me,ge]=fe("ClerkInstanceContext"),[ve,ye]=fe("UserContext"),[we,be]=fe("ClientContext"),[_e,Se]=fe("SessionContext"),[ke,Pe]=fe("OrganizationContext"),Ue=({children:e,organization:t,swrConfig:n})=>a.createElement(se,{value:n},a.createElement(ke.Provider,{value:{value:{organization:t}}},e));function Oe(e){if(!a.useContext(me)){if("function"==typeof e)return void e();throw new Error(`${e} can only be used within the component. Learn more: https://clerk.com/docs/components/clerk-provider`)}}function Ce(e,t){const n=new Set(Object.keys(t)),r={};for(const i of Object.keys(e))n.has(i)||(r[i]=e[i]);return r}var Ee=(e,t)=>{var n,r,i;const s="boolean"==typeof e&&e,o=(0,a.useRef)(s?t.initialPage:null!=(n=null==e?void 0:e.initialPage)?n:t.initialPage),c=(0,a.useRef)(s?t.pageSize:null!=(r=null==e?void 0:e.pageSize)?r:t.pageSize),l={};for(const a of Object.keys(t))l[a]=s?t[a]:null!=(i=null==e?void 0:e[a])?i:t[a];return{...l,initialPage:o.current,pageSize:c.current}},Ie={dedupingInterval:6e4,focusThrottleInterval:12e4},Ae=(e,t,n,r)=>{var i,s,o,c,l,u,d;const[h,f]=(0,a.useState)(null!=(i=e.initialPage)?i:1),p=(0,a.useRef)(null!=(s=e.initialPage)?s:1),m=(0,a.useRef)(null!=(o=e.pageSize)?o:10),g=null==(c=n.enabled)||c,v=null!=(l=n.infinite)&&l,y=null!=(u=n.keepPreviousData)&&u,w={...r,...e,initialPage:h,pageSize:m.current},{data:b,isValidating:_,isLoading:S,error:k,mutate:P}=ae(!v&&t&&g?w:null,(e=>{const n=Ce(e,r);return null==t?void 0:t(n)}),{keepPreviousData:y,...Ie}),{data:U,isLoading:O,isValidating:C,error:E,size:I,setSize:A,mutate:T}=de((t=>v&&g?{...e,...r,initialPage:p.current+t,pageSize:m.current}:null),(e=>{const n=Ce(e,r);return null==t?void 0:t(n)}),Ie),R=(0,a.useMemo)((()=>v?I:h),[v,I,h]),x=(0,a.useCallback)((e=>{if(!v)return f(e);A(e)}),[A]),z=(0,a.useMemo)((()=>{var e,t;return v?null!=(e=null==U?void 0:U.map((e=>null==e?void 0:e.data)).flat())?e:[]:null!=(t=null==b?void 0:b.data)?t:[]}),[v,b,U]),M=(0,a.useMemo)((()=>{var e,t;return v?(null==(e=null==U?void 0:U[(null==U?void 0:U.length)-1])?void 0:e.total_count)||0:null!=(t=null==b?void 0:b.total_count)?t:0}),[v,b,U]),N=v?O:S,$=v?C:_,L=null!=(d=v?E:k)?d:null,W=!!L,D=(0,a.useCallback)((()=>{x((e=>Math.max(0,e+1)))}),[x]),F=(0,a.useCallback)((()=>{x((e=>Math.max(0,e-1)))}),[x]),j=(p.current-1)*m.current,V=Math.ceil((M-j)/m.current),K=M-j*m.current>R*m.current,J=(R-1)*m.current>j*m.current;return{data:z,count:M,error:L,isLoading:N,isFetching:$,isError:W,page:R,pageCount:V,fetchPage:x,fetchNext:D,fetchPrevious:F,hasNextPage:K,hasPreviousPage:J,revalidate:v?()=>T():()=>P(),setData:v?e=>T(e,{revalidate:!1}):e=>P(e,{revalidate:!1})}},Te={data:void 0,count:void 0,error:void 0,isLoading:!1,isFetching:!1,isError:!1,page:void 0,pageCount:void 0,fetchPage:void 0,fetchNext:void 0,fetchPrevious:void 0,hasNextPage:!1,hasPreviousPage:!1,revalidate:void 0,setData:void 0},Re=e=>{var t;const{domains:n,membershipRequests:r,memberships:s,invitations:a}=e||{};Oe("useOrganization");const{organization:o}=Pe(),c=Se(),l=Ee(n,{initialPage:1,pageSize:10,keepPreviousData:!1,infinite:!1,enrollmentMode:void 0}),u=Ee(r,{initialPage:1,pageSize:10,status:"pending",keepPreviousData:!1,infinite:!1}),d=Ee(s,{initialPage:1,pageSize:10,role:void 0,keepPreviousData:!1,infinite:!1}),h=Ee(a,{initialPage:1,pageSize:10,status:["pending"],keepPreviousData:!1,infinite:!1}),f=ge();null==(t=f.telemetry)||t.record(i("useOrganization"));const p=void 0===n?void 0:{initialPage:l.initialPage,pageSize:l.pageSize,enrollmentMode:l.enrollmentMode},m=void 0===r?void 0:{initialPage:u.initialPage,pageSize:u.pageSize,status:u.status},g=void 0===s?void 0:{initialPage:d.initialPage,pageSize:d.pageSize,role:d.role},v=void 0===a?void 0:{initialPage:h.initialPage,pageSize:h.pageSize,status:h.status},y=Ae({...p},null==o?void 0:o.getDomains,{keepPreviousData:l.keepPreviousData,infinite:l.infinite,enabled:!!p},{type:"domains",organizationId:null==o?void 0:o.id}),w=Ae({...m},null==o?void 0:o.getMembershipRequests,{keepPreviousData:u.keepPreviousData,infinite:u.infinite,enabled:!!m},{type:"membershipRequests",organizationId:null==o?void 0:o.id}),b=Ae(g||{},null==o?void 0:o.getMemberships,{keepPreviousData:d.keepPreviousData,infinite:d.infinite,enabled:!!g},{type:"members",organizationId:null==o?void 0:o.id}),_=Ae({...v},null==o?void 0:o.getInvitations,{keepPreviousData:h.keepPreviousData,infinite:h.infinite,enabled:!!v},{type:"invitations",organizationId:null==o?void 0:o.id});return void 0===o?{isLoaded:!1,organization:void 0,membership:void 0,domains:Te,membershipRequests:Te,memberships:Te,invitations:Te}:null===o?{isLoaded:!0,organization:null,membership:null,domains:null,membershipRequests:null,memberships:null,invitations:null}:!f.loaded&&o?{isLoaded:!0,organization:o,membership:void 0,domains:Te,membershipRequests:Te,memberships:Te,invitations:Te}:{isLoaded:f.loaded,organization:o,membership:(S=c.user.organizationMemberships,k=o.id,S.find((e=>e.organization.id===k))),domains:y,membershipRequests:w,memberships:b,invitations:_};var S,k},xe={data:void 0,count:void 0,error:void 0,isLoading:!1,isFetching:!1,isError:!1,page:void 0,pageCount:void 0,fetchPage:void 0,fetchNext:void 0,fetchPrevious:void 0,hasNextPage:!1,hasPreviousPage:!1,revalidate:void 0,setData:void 0},ze=e=>{var t;const{userMemberships:n,userInvitations:r,userSuggestions:s}=e||{};Oe("useOrganizationList");const a=Ee(n,{initialPage:1,pageSize:10,keepPreviousData:!1,infinite:!1}),o=Ee(r,{initialPage:1,pageSize:10,status:"pending",keepPreviousData:!1,infinite:!1}),c=Ee(s,{initialPage:1,pageSize:10,status:"pending",keepPreviousData:!1,infinite:!1}),l=ge(),u=ye();null==(t=l.telemetry)||t.record(i("useOrganizationList"));const d=void 0===n?void 0:{initialPage:a.initialPage,pageSize:a.pageSize},h=void 0===r?void 0:{initialPage:o.initialPage,pageSize:o.pageSize,status:o.status},f=void 0===s?void 0:{initialPage:c.initialPage,pageSize:c.pageSize,status:c.status},p=!(!l.loaded||!u),m=Ae(d||{},null==u?void 0:u.getOrganizationMemberships,{keepPreviousData:a.keepPreviousData,infinite:a.infinite,enabled:!!d},{type:"userMemberships",userId:null==u?void 0:u.id}),g=Ae({...h},null==u?void 0:u.getOrganizationInvitations,{keepPreviousData:o.keepPreviousData,infinite:o.infinite,enabled:!!h},{type:"userInvitations",userId:null==u?void 0:u.id}),v=Ae({...f},null==u?void 0:u.getOrganizationSuggestions,{keepPreviousData:c.keepPreviousData,infinite:c.infinite,enabled:!!f},{type:"userSuggestions",userId:null==u?void 0:u.id});return p?{isLoaded:p,setActive:l.setActive,createOrganization:l.createOrganization,userMemberships:m,userInvitations:g,userSuggestions:v}:{isLoaded:!1,createOrganization:void 0,setActive:void 0,userMemberships:xe,userInvitations:xe,userSuggestions:xe}},Me="undefined"!=typeof window?a.useLayoutEffect:a.useEffect,Ne=()=>{Oe("useSession");const e=Se();return void 0===e?{isLoaded:!1,isSignedIn:void 0,session:void 0}:null===e?{isLoaded:!0,isSignedIn:!1,session:null}:{isLoaded:!0,isSignedIn:!0,session:e}},$e=()=>{Oe("useSessionList");const e=ge(),t=be();return t?{isLoaded:!0,sessions:t.sessions,setActive:e.setActive}:{isLoaded:!1,sessions:void 0,setActive:void 0}};function Le(){Oe("useUser");const e=ye();return void 0===e?{isLoaded:!1,isSignedIn:void 0,user:void 0}:null===e?{isLoaded:!0,isSignedIn:!1,user:null}:{isLoaded:!0,isSignedIn:!0,user:e}}var We=()=>(Oe("useClerk"),ge()),De=Object.prototype.hasOwnProperty;function Fe(e,t,n){for(n of e.keys())if(je(n,t))return n}function je(e,t){var n,r,i;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&je(e[r],t[r]););return-1===r}if(n===Set){if(e.size!==t.size)return!1;for(r of e){if((i=r)&&"object"==typeof i&&!(i=Fe(t,i)))return!1;if(!t.has(i))return!1}return!0}if(n===Map){if(e.size!==t.size)return!1;for(r of e){if((i=r[0])&&"object"==typeof i&&!(i=Fe(t,i)))return!1;if(!je(r[1],t.get(i)))return!1}return!0}if(n===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(n===DataView){if((r=e.byteLength)===t.byteLength)for(;r--&&e.getInt8(r)===t.getInt8(r););return-1===r}if(ArrayBuffer.isView(e)){if((r=e.byteLength)===t.byteLength)for(;r--&&e[r]===t[r];);return-1===r}if(!n||"object"==typeof e){for(n in r=0,e){if(De.call(e,n)&&++r&&!De.call(t,n))return!1;if(!(n in t)||!je(e[n],t[n]))return!1}return Object.keys(t).length===r}}return e!=e&&t!=t}var Ve=(e,t)=>a.useMemo(e,(e=>{const t=a.useRef(e);return je(e,t.current)||(t.current=e),a.useMemo((()=>t.current),[t.current])})(t))},6479:function(e,t,n){"use strict";n.d(t,{TD:function(){return r.TD},a1:function(){return r.a1}});var r=n(3151);n(7498)},3394:function(e,t,n){"use strict";n.d(t,{C6:function(){return a},h_:function(){return s},iW:function(){return i}});var r=n(4409);function i(){return(0,r.Er)()&&"function"==typeof window.PublicKeyCredential}async function s(){try{return i()&&await window.PublicKeyCredential.isConditionalMediationAvailable()}catch(e){return!1}}async function a(){try{return"undefined"!=typeof window&&await window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch(e){return!1}}n(7498)}},s={};function a(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return i[e].call(n.exports,n,n.exports,a),n.exports}a.m=i,a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},t=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},a.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var i=Object.create(null);a.r(i);var s={};e=e||[null,t({}),t([]),t(t)];for(var o=2&r&&n;"object"==typeof o&&!~e.indexOf(o);o=t(o))Object.getOwnPropertyNames(o).forEach((function(e){s[e]=function(){return n[e]}}));return s.default=function(){return n},a.d(i,s),i},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.f={},a.e=function(e){return Promise.all(Object.keys(a.f).reduce((function(t,n){return a.f[n](e,t),t}),[]))},a.u=function(e){return({132:"userbutton",216:"vendors",220:"zxcvbn-ts-core",229:"organizationprofile",336:"organizationswitcher",379:"oneTap",490:"impersonationfab",577:"signin",653:"organizationlist",700:"ui-common",804:"zxcvbn-common",830:"signup",971:"userprofile",979:"createorganization"}[e]||e)+"_"+a.h().slice(0,6)+"_5.7.1.js"},a.h=function(){return"2e154d8584218bb65bdd"},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n={},r="@clerk/clerk-js:",a.l=function(e,t,i,s){if(n[e])n[e].push(t);else{var o,c;if(void 0!==i)for(var l=document.getElementsByTagName("script"),u=0;u-1&&!e;)e=n[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e}(),function(){var e={787:0};a.f.j=function(t,n){var r=a.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var i=new Promise((function(n,i){r=e[t]=[n,i]}));n.push(r[2]=i);var s=a.p+a.u(t),o=new Error;a.l(s,(function(n){if(a.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var i=n&&("load"===n.type?"missing":n.type),s=n&&n.target&&n.target.src;o.message="Loading chunk "+t+" failed.\n("+i+": "+s+")",o.name="ChunkLoadError",o.type=i,o.request=s,r[1](o)}}),"chunk-"+t,t)}};var t=function(t,n){var r,i,s=n[0],o=n[1],c=n[2],l=0;if(s.some((function(t){return 0!==e[t]}))){for(r in o)a.o(o,r)&&(a.m[r]=o[r]);c&&c(a)}for(t&&t(n);l{try{const t=new URL(document.currentScript.src);let n=new URL(t.href.split("/").slice(0,-1).join("/")).href;n+=n.endsWith("/")?"":"/",a.p=n.replace(e,"$15.7.1$3")}catch(t){}})()}a(5047);var e,t,n,r,i,s,c=a(2022),l=a(3151),u=a(7189),d=a(7498),h=class{constructor(){(0,d.Ko)(this,n),(0,d.Ko)(this,e,"clerk_telemetry_throttler"),(0,d.Ko)(this,t,864e5)}isEventThrottled(a){var o;if(!(0,d.ac)(this,n,s))return!1;const c=Date.now(),l=(0,d.U9)(this,n,r).call(this,a),u=null==(o=(0,d.ac)(this,n,i))?void 0:o[l];if(!u){const t={...(0,d.ac)(this,n,i),[l]:c};localStorage.setItem((0,d.ac)(this,e),JSON.stringify(t))}if(u&&c-u>(0,d.ac)(this,t)){const t=(0,d.ac)(this,n,i);delete t[l],localStorage.setItem((0,d.ac)(this,e),JSON.stringify(t))}return!!u}};e=new WeakMap,t=new WeakMap,n=new WeakSet,r=function(e){const{sk:t,pk:n,payload:r,...i}=e,s={...r,...i};return JSON.stringify(Object.keys({...r,...i}).sort().map((e=>s[e])))},i=function(){const t=localStorage.getItem((0,d.ac)(this,e));return t?JSON.parse(t):{}},s=function(){if("undefined"==typeof window)return!1;const t=window.localStorage;if(!t)return!1;try{const e="test";return t.setItem(e,e),t.removeItem(e),!0}catch(n){return n instanceof DOMException&&("QuotaExceededError"===n.name||"NS_ERROR_DOM_QUOTA_REACHED"===n.name)&&t.length>0&&t.removeItem((0,d.ac)(this,e)),!1}};var f,p,m,g,v,y,w,b,_,S,k,P,U,O=class{constructor(e){var t,n,r,i,s,a;(0,d.Ko)(this,y),(0,d.Ko)(this,f),(0,d.Ko)(this,p),(0,d.Ko)(this,m,{}),(0,d.Ko)(this,g,[]),(0,d.Ko)(this,v),(0,d.qx)(this,f,{maxBufferSize:null!=(t=e.maxBufferSize)?t:5,samplingRate:null!=(n=e.samplingRate)?n:1,disabled:null!=(r=e.disabled)&&r,debug:null!=(i=e.debug)&&i,endpoint:"https://clerk-telemetry.com"}),e.clerkVersion||"undefined"!=typeof window?(0,d.ac)(this,m).clerkVersion=null!=(s=e.clerkVersion)?s:"":(0,d.ac)(this,m).clerkVersion="",(0,d.ac)(this,m).sdk=e.sdk,(0,d.ac)(this,m).sdkVersion=e.sdkVersion,(0,d.ac)(this,m).publishableKey=null!=(a=e.publishableKey)?a:"";const o=(0,u.nQ)(e.publishableKey);o&&((0,d.ac)(this,m).instanceType=o.instanceType),e.secretKey&&((0,d.ac)(this,m).secretKey=e.secretKey.substring(0,16)),(0,d.qx)(this,p,new h)}get isEnabled(){var e;return!("development"!==(0,d.ac)(this,m).instanceType||(0,d.ac)(this,f).disabled||"undefined"!=typeof process&&(0,l.fQ)(process.env.CLERK_TELEMETRY_DISABLED)||"undefined"!=typeof window&&(null==(e=null==window?void 0:window.navigator)?void 0:e.webdriver))}get isDebug(){return(0,d.ac)(this,f).debug||"undefined"!=typeof process&&(0,l.fQ)(process.env.CLERK_TELEMETRY_DEBUG)}record(e){const t=(0,d.U9)(this,y,U).call(this,e.event,e.payload);(0,d.U9)(this,y,k).call(this,t.event,t),(0,d.U9)(this,y,w).call(this,t,e.eventSamplingRate)&&((0,d.ac)(this,g).push(t),(0,d.U9)(this,y,_).call(this))}};f=new WeakMap,p=new WeakMap,m=new WeakMap,g=new WeakMap,v=new WeakMap,y=new WeakSet,w=function(e,t){return this.isEnabled&&!this.isDebug&&(0,d.U9)(this,y,b).call(this,e,t)},b=function(e,t){const n=Math.random();return!(0,d.ac)(this,p).isEventThrottled(e)&&n<=(0,d.ac)(this,f).samplingRate&&(void 0===t||n<=t)},_=function(){"undefined"!=typeof window?(0,d.ac)(this,g).length>=(0,d.ac)(this,f).maxBufferSize?((0,d.ac)(this,v)&&("undefined"!=typeof cancelIdleCallback?cancelIdleCallback:clearTimeout)((0,d.ac)(this,v)),(0,d.U9)(this,y,S).call(this)):(0,d.ac)(this,v)||("requestIdleCallback"in window?(0,d.qx)(this,v,requestIdleCallback((()=>{(0,d.U9)(this,y,S).call(this)}))):(0,d.qx)(this,v,setTimeout((()=>{(0,d.U9)(this,y,S).call(this)}),0))):(0,d.U9)(this,y,S).call(this)},S=function(){fetch(new URL("/v1/event",(0,d.ac)(this,f).endpoint),{method:"POST",body:JSON.stringify({events:(0,d.ac)(this,g)}),headers:{"Content-Type":"application/json"}}).catch((()=>{})).then((()=>{(0,d.qx)(this,g,[])})).catch((()=>{}))},k=function(e,t){this.isDebug&&(void 0!==console.groupCollapsed?(console.groupCollapsed("[clerk/telemetry]",e),console.log(t),console.groupEnd()):console.log("[clerk/telemetry]",e,t))},P=function(){let e={name:(0,d.ac)(this,m).sdk,version:(0,d.ac)(this,m).sdkVersion};return"undefined"!=typeof window&&window.Clerk&&(e={...e,...window.Clerk.constructor.sdkMetadata}),e},U=function(e,t){var n,r;const i=(0,d.U9)(this,y,P).call(this);return{event:e,cv:null!=(n=(0,d.ac)(this,m).clerkVersion)?n:"",it:null!=(r=(0,d.ac)(this,m).instanceType)?r:"",sdk:i.name,sdkv:i.version,...(0,d.ac)(this,m).publishableKey?{pk:(0,d.ac)(this,m).publishableKey}:{},...(0,d.ac)(this,m).secretKey?{sk:(0,d.ac)(this,m).secretKey}:{},payload:t}};function C(e,t){var n,r,i;return{event:"COMPONENT_MOUNTED",eventSamplingRate:.1,payload:{component:e,appearanceProp:Boolean(null==t?void 0:t.appearance),baseTheme:Boolean(null==(n=null==t?void 0:t.appearance)?void 0:n.baseTheme),elements:Boolean(null==(r=null==t?void 0:t.appearance)?void 0:r.elements),variables:Boolean(null==(i=null==t?void 0:t.appearance)?void 0:i.variables)}}}var E=a(2045),I=a(9673),A=a(7984);function T(e,t){return function(e,t){if(!e&&t||e&&!t)return!0;if(!e&&e===t)return!1;if(!e||!t)return!0;try{if(A.KU.isClientResource(e))return function(e,t){return e.id!==t.id||e.updatedAt.getTime()t.organization.id===e.lastActiveOrganizationId)),l=null===(s=null===(i=t.user)||void 0===i?void 0:i.organizationMemberships)||void 0===s?void 0:s.find((t=>t.organization.id===e.lastActiveOrganizationId));return(null==c?void 0:c.role)!==(null==l?void 0:l.role)||(null===(a=null==c?void 0:c.permissions)||void 0===a?void 0:a.length)!==(null===(o=null==l?void 0:l.permissions)||void 0===o?void 0:o.length)}(t,e)}(e,t);if(A.n5.isUserResource(e))return function(e,t){return e.id!==t.id||e.updatedAt.getTime()N($(e)),N=e=>{const t=new URL(e);return t.searchParams.delete(x),t},$=e=>{const t=new URL(e);return t.searchParams.delete("__dev_session"),t.hash=decodeURI(t.hash).replace(/__clerk_db_jwt\[(.*)\]/,""),t.href.endsWith("#")&&(t.hash=""),t},L=a(221),W=a(361),D=a(7084);function F(e){for(var t=1;t{const e=V(x);return{get:()=>e.get(),set:t=>{const n=(0,K.Bc)(Date.now(),1),r=(0,E.TI)()?"None":"Lax",i="https:"===window.location.protocol;return e.set(t,{expires:n,sameSite:r,secure:i})},remove:()=>e.remove()}})();function r(){return n.get()}function i(e){n.set(e)}function s(){n.remove()}return{clear:function(){s()},setup:async function(){if(!(0,E.un)(e))return;t.onBeforeRequest((e=>{const t=r();t&&(null==e?void 0:e.url)&&(e.url=z(e.url,t))})),t.onAfterResponse(((e,t)=>{var n;const r=null===(n=null==t?void 0:t.headers)||void 0===n?void 0:n.get("Clerk-Db-Jwt");r&&i(r)}));const s=function(e){const t=(e=>e.searchParams.get(x)||"")(e);return M(e).href!==e.href&&void 0!==globalThis.history&&globalThis.history.replaceState(null,"",M(e)),t}(new URL(window.location.href));if(s)return void i(s);if(n.get())return;const a=t.buildUrl({path:"/dev_browser"}),o=await fetch(a.toString(),{method:"POST"});if(!o.ok){const e=await o.json(),t=(0,L.iR)(e.errors);t[0]?(0,W.Dg)(t[0].longMessage):(0,W.Dg)()}const c=await o.json();i(null==c?void 0:c.token)},getDevBrowserJWT:r,setDevBrowserJWT:i,removeDevBrowserJWT:s}}var Z=a(1096),G=a.n(Z);class H{constructor(){this.lock=function(e){const t=new(G());return window.addEventListener("beforeunload",(async()=>{await t.releaseLock(e)})),{acquireLockAndRun:async n=>{if(await t.acquireLock(e,5e3))try{return await n()}finally{await t.releaseLock(e)}}}}("clerk.lock.refreshSessionToken"),this.workerTimers=(0,c.Q5)(),this.timerId=null}startPollingForSessionToken(e){this.timerId||(this.timerId=this.workerTimers.setInterval((()=>{this.lock.acquireLockAndRun(e)}),5e3))}stopPollingForSessionToken(){this.timerId&&(this.workerTimers.clearInterval(this.timerId),this.timerId=null)}}class Y{constructor(e,t){this.clerk=e,this.poller=null,D.Y.on(D.U.TokenUpdate,(({token:e})=>{this.updateSessionCookie(e&&e.getRawString()),this.setClientUatCookieForDevelopmentInstances()})),this.refreshTokenOnVisibilityChange(),this.startPollingForToken(),this.clientUat=(()=>{const e=V("__client_uat");return{set:t=>{const n=(0,K.Bc)(Date.now(),1),r=(0,E.TI)()?"None":"Strict",i="https:"===window.location.protocol,s=function(e=window.location.hostname,t=q){if(J)return J;if(["localhost","127.0.0.1","0.0.0.0"].includes(e))return e;const n=e.split(".");if(1===n.length)return e;for(let r=n.length-2;r>=0;r--){const e=n.slice(r).join(".");if(t.set("1",{domain:e}),"1"===t.get())return t.remove({domain:e}),J=e,e;t.remove({domain:e})}}();let a="0";return t&&t.updatedAt&&t.activeSessions.length>0&&(a=Math.floor(t.updatedAt.getTime()/1e3).toString()),e.remove(),e.set(a,{expires:n,sameSite:r,domain:s,secure:i})},get:()=>parseInt(e.get()||"0",10)}})(),this.sessionCookie=(()=>{const e=V("__session");return{set:t=>{const n=(0,K.Bc)(Date.now(),1),r=(0,E.TI)()?"None":"Lax",i="https:"===window.location.protocol;return e.set(t,{expires:n,sameSite:r,secure:i})},remove:()=>e.remove()}})(),this.devBrowser=B({frontendApi:e.frontendApi,fapiClient:t})}setEnvironment(e){this.environment=e,this.setClientUatCookieForDevelopmentInstances()}isSignedOut(){return this.clerk.loaded?!!this.clerk.user:this.clientUat.get()<=0}async setupDevelopment(){await this.devBrowser.setup()}setupProduction(){this.devBrowser.clear()}async handleUnauthenticatedDevBrowser(){this.devBrowser.clear(),await this.devBrowser.setup()}decorateUrlWithDevBrowserToken(e){const t=this.devBrowser.getDevBrowserJWT();return t?z(e,t):(0,W.qO)()}startPollingForToken(){this.poller||(this.poller=new H),this.poller.startPollingForSessionToken((()=>this.refreshSessionToken()))}refreshTokenOnVisibilityChange(){document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&this.refreshSessionToken()}))}async refreshSessionToken(){if(this.clerk.session)try{await this.clerk.session.getToken()}catch(e){return this.handleGetTokenError(e)}}updateSessionCookie(e){return e?this.sessionCookie.set(e):this.sessionCookie.remove()}setClientUatCookieForDevelopmentInstances(){var e;(null===(e=this.environment)||void 0===e?void 0:e.isDevelopmentOrStaging())&&this.inCustomDevelopmentDomain()&&this.clientUat.set(this.clerk.client)}inCustomDevelopmentDomain(){const e=this.clerk.frontendApi.replace("clerk.","");return!window.location.host.endsWith(e)}handleGetTokenError(e){(0,L.kD)(e)||(0,W.Fo)(e.message||e),(0,L.ix)(e)?this.clerk.handleUnauthenticated():(0,L.eE)(e)||(0,W.Fo)(e.toString())}}var X,Q,ee,te,ne,re,ie,se,ae,oe,ce,le,ue,de,he,fe,pe,me,ge,ve,ye,we,be,_e,Se,ke,Pe,Ue,Oe,Ce,Ee,Ie,Ae,Te,Re,xe,ze,Me,Ne,$e,Le=a(9841),We=a(3351),De=a(4850),Fe=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},je=function(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n};const Ve={polling:!0,standardBrowser:!0,touchSession:!0,isSatellite:!1,signInUrl:void 0,signUpUrl:void 0,afterSignOutUrl:void 0,signInFallbackRedirectUrl:void 0,signUpFallbackRedirectUrl:void 0,signInForceRedirectUrl:void 0,signUpForceRedirectUrl:void 0};class Ke{get publishableKey(){return Fe(this,Q,"f")}get version(){return X.version}set sdkMetadata(e){X.sdkMetadata=e}get sdkMetadata(){return X.sdkMetadata}get loaded(){return Fe(this,oe,"f")}get isSatellite(){return!!(0,E._f)()&&(0,c.YZ)(Fe(this,le,"f").isSatellite,new URL(window.location.href),!1)}get domain(){if((0,E._f)()){const e=(0,c.d5)((0,c.YZ)(Fe(this,ee,"f"),new URL(window.location.href)));return"production"===Fe(this,ae,"f")?(0,c.xy)(e):e}return""}get proxyUrl(){if((0,E._f)()){const e=(0,c.YZ)(Fe(this,te,"f"),new URL(window.location.href));return(0,c.jL)(e)||E.RM.throwInvalidProxyUrl({url:e}),(0,c.kI)(e)}return""}get frontendApi(){const e=(0,c.nQ)(this.publishableKey);return e?e.frontendApi:E.RM.throwInvalidPublishableKeyError({key:this.publishableKey})}get instanceType(){return Fe(this,ae,"f")}get isStandardBrowser(){return Fe(this,le,"f").standardBrowser||!1}constructor(e,t){if(this.internal_last_error=null,Q.set(this,""),ee.set(this,void 0),te.set(this,void 0),ne.set(this,null),re.set(this,null),ie.set(this,void 0),se.set(this,void 0),ae.set(this,void 0),oe.set(this,!1),ce.set(this,[]),le.set(this,{}),ue.set(this,null),this.getFapiClient=()=>Fe(this,se,"f"),this.load=async e=>{this.loaded||(je(this,le,{...Ve,...e},"f"),(0,I.v)(Fe(this,le,"f")),Fe(this,le,"f").sdkMetadata&&(X.sdkMetadata=Fe(this,le,"f").sdkMetadata),!1!==Fe(this,le,"f").telemetry&&(this.telemetry=new O({clerkVersion:X.version,samplingRate:1,publishableKey:this.publishableKey,...Fe(this,le,"f").telemetry})),Fe(this,le,"f").allowedRedirectOrigins=(0,E.$1)(Fe(this,le,"f").allowedRedirectOrigins,this.frontendApi),Fe(this,le,"f").standardBrowser?je(this,oe,await Fe(this,_e,"f").call(this),"f"):je(this,oe,await Fe(this,Se,"f").call(this),"f"))},this.signOut=async(e,t)=>{var n;if(!this.client||0===this.client.sessions.length)return;const r=e&&"object"==typeof e?e:t||{},i=(null==r?void 0:r.redirectUrl)||this.buildAfterSignOutUrl(),s="function"==typeof e?e:()=>this.navigate(i);if(!r.sessionId||1===this.client.activeSessions.length)return await this.client.destroy(),this.setActive({session:null,beforeEmit:(0,E.BT)(s)});const a=this.client.activeSessions.find((e=>e.id===r.sessionId)),o=(null==a?void 0:a.id)&&(null===(n=this.session)||void 0===n?void 0:n.id)===a.id;return await(null==a?void 0:a.remove()),o?this.setActive({session:null,beforeEmit:(0,E.BT)(s)}):void 0},this.openGoogleOneTap=e=>{this.assertComponentsReady(Fe(this,ie,"f")),Fe(this,ie,"f").ensureMounted({preloadHint:"GoogleOneTap"}).then((t=>t.openModal("googleOneTap",e||{})))},this.closeGoogleOneTap=()=>{this.assertComponentsReady(Fe(this,ie,"f")),Fe(this,ie,"f").ensureMounted().then((e=>e.closeModal("googleOneTap")))},this.openSignIn=e=>{if(this.assertComponentsReady(Fe(this,ie,"f")),(0,E.So)(this,this.environment)){if("development"===Fe(this,ae,"f"))throw new c.w$(De.q.cannotOpenSignInOrSignUp,{code:"cannot_render_single_session_enabled"})}else Fe(this,ie,"f").ensureMounted({preloadHint:"SignIn"}).then((t=>t.openModal("signIn",e||{})))},this.closeSignIn=()=>{this.assertComponentsReady(Fe(this,ie,"f")),Fe(this,ie,"f").ensureMounted().then((e=>e.closeModal("signIn")))},this.openSignUp=e=>{if(this.assertComponentsReady(Fe(this,ie,"f")),(0,E.So)(this,this.environment)){if("development"===Fe(this,ae,"f"))throw new c.w$(De.q.cannotOpenSignInOrSignUp,{code:"cannot_render_single_session_enabled"})}else Fe(this,ie,"f").ensureMounted({preloadHint:"SignUp"}).then((t=>t.openModal("signUp",e||{})))},this.closeSignUp=()=>{this.assertComponentsReady(Fe(this,ie,"f")),Fe(this,ie,"f").ensureMounted().then((e=>e.closeModal("signUp")))},this.openUserProfile=e=>{if(this.assertComponentsReady(Fe(this,ie,"f")),(0,E.f)(this)){if("development"===Fe(this,ae,"f"))throw new c.w$(De.q.cannotOpenUserProfile,{code:"cannot_render_user_missing"})}else Fe(this,ie,"f").ensureMounted({preloadHint:"UserProfile"}).then((t=>t.openModal("userProfile",e||{})))},this.closeUserProfile=()=>{this.assertComponentsReady(Fe(this,ie,"f")),Fe(this,ie,"f").ensureMounted().then((e=>e.closeModal("userProfile")))},this.openOrganizationProfile=e=>{if(this.assertComponentsReady(Fe(this,ie,"f")),(0,E.sW)(this,this.environment)){if("development"===Fe(this,ae,"f"))throw new c.w$(De.q.cannotRenderAnyOrganizationComponent("OrganizationProfile"),{code:"cannot_render_organizations_disabled"})}else if((0,E.n$)(this)){if("development"===Fe(this,ae,"f"))throw new c.w$(De.q.cannotRenderComponentWhenOrgDoesNotExist,{code:"cannot_render_organization_missing"})}else Fe(this,ie,"f").ensureMounted({preloadHint:"OrganizationProfile"}).then((t=>t.openModal("organizationProfile",e||{})))},this.closeOrganizationProfile=()=>{this.assertComponentsReady(Fe(this,ie,"f")),Fe(this,ie,"f").ensureMounted().then((e=>e.closeModal("organizationProfile")))},this.openCreateOrganization=e=>{if(this.assertComponentsReady(Fe(this,ie,"f")),(0,E.sW)(this,this.environment)){if("development"===Fe(this,ae,"f"))throw new c.w$(De.q.cannotRenderAnyOrganizationComponent("CreateOrganization"),{code:"cannot_render_organizations_disabled"})}else Fe(this,ie,"f").ensureMounted({preloadHint:"CreateOrganization"}).then((t=>t.openModal("createOrganization",e||{})))},this.closeCreateOrganization=()=>{this.assertComponentsReady(Fe(this,ie,"f")),Fe(this,ie,"f").ensureMounted().then((e=>e.closeModal("createOrganization")))},this.mountSignIn=(e,t)=>{var n;this.assertComponentsReady(Fe(this,ie,"f")),Fe(this,ie,"f").ensureMounted({preloadHint:"SignIn"}).then((n=>n.mountComponent({name:"SignIn",appearanceKey:"signIn",node:e,props:t}))),null===(n=this.telemetry)||void 0===n||n.record(C("SignIn",t))},this.unmountSignIn=e=>{this.assertComponentsReady(Fe(this,ie,"f")),Fe(this,ie,"f").ensureMounted().then((t=>t.unmountComponent({node:e})))},this.mountSignUp=(e,t)=>{var n;this.assertComponentsReady(Fe(this,ie,"f")),Fe(this,ie,"f").ensureMounted({preloadHint:"SignUp"}).then((n=>n.mountComponent({name:"SignUp",appearanceKey:"signUp",node:e,props:t}))),null===(n=this.telemetry)||void 0===n||n.record(C("SignUp",t))},this.unmountSignUp=e=>{this.assertComponentsReady(Fe(this,ie,"f")),Fe(this,ie,"f").ensureMounted().then((t=>t.unmountComponent({node:e})))},this.mountUserProfile=(e,t)=>{var n;if(this.assertComponentsReady(Fe(this,ie,"f")),(0,E.f)(this)){if("development"===Fe(this,ae,"f"))throw new c.w$(De.q.cannotRenderComponentWhenUserDoesNotExist,{code:"cannot_render_user_missing"})}else Fe(this,ie,"f").ensureMounted({preloadHint:"UserProfile"}).then((n=>n.mountComponent({name:"UserProfile",appearanceKey:"userProfile",node:e,props:t}))),null===(n=this.telemetry)||void 0===n||n.record(C("UserProfile",t))},this.unmountUserProfile=e=>{this.assertComponentsReady(Fe(this,ie,"f")),Fe(this,ie,"f").ensureMounted().then((t=>t.unmountComponent({node:e})))},this.mountOrganizationProfile=(e,t)=>{var n;if(this.assertComponentsReady(Fe(this,ie,"f")),(0,E.sW)(this,this.environment)){if("development"===Fe(this,ae,"f"))throw new c.w$(De.q.cannotRenderAnyOrganizationComponent("OrganizationProfile"),{code:"cannot_render_organizations_disabled"});return}const r=!(0,E.f)(this);if((0,E.n$)(this)&&r){if("development"===Fe(this,ae,"f"))throw new c.w$(De.q.cannotRenderComponentWhenOrgDoesNotExist,{code:"cannot_render_organization_missing"})}else Fe(this,ie,"f").ensureMounted({preloadHint:"OrganizationProfile"}).then((n=>n.mountComponent({name:"OrganizationProfile",appearanceKey:"userProfile",node:e,props:t}))),null===(n=this.telemetry)||void 0===n||n.record(C("OrganizationProfile",t))},this.unmountOrganizationProfile=e=>{this.assertComponentsReady(Fe(this,ie,"f")),Fe(this,ie,"f").ensureMounted().then((t=>t.unmountComponent({node:e})))},this.mountCreateOrganization=(e,t)=>{var n,r;if(this.assertComponentsReady(Fe(this,ie,"f")),(0,E.sW)(this,this.environment)){if("development"===Fe(this,ae,"f"))throw new c.w$(De.q.cannotRenderAnyOrganizationComponent("CreateOrganization"),{code:"cannot_render_organizations_disabled"})}else null===(n=Fe(this,ie,"f"))||void 0===n||n.ensureMounted({preloadHint:"CreateOrganization"}).then((n=>n.mountComponent({name:"CreateOrganization",appearanceKey:"createOrganization",node:e,props:t}))),null===(r=this.telemetry)||void 0===r||r.record(C("CreateOrganization",t))},this.unmountCreateOrganization=e=>{var t;this.assertComponentsReady(Fe(this,ie,"f")),null===(t=Fe(this,ie,"f"))||void 0===t||t.ensureMounted().then((t=>t.unmountComponent({node:e})))},this.mountOrganizationSwitcher=(e,t)=>{var n,r;if(this.assertComponentsReady(Fe(this,ie,"f")),(0,E.sW)(this,this.environment)){if("development"===Fe(this,ae,"f"))throw new c.w$(De.q.cannotRenderAnyOrganizationComponent("OrganizationSwitcher"),{code:"cannot_render_organizations_disabled"})}else null===(n=Fe(this,ie,"f"))||void 0===n||n.ensureMounted({preloadHint:"OrganizationSwitcher"}).then((n=>n.mountComponent({name:"OrganizationSwitcher",appearanceKey:"organizationSwitcher",node:e,props:t}))),null===(r=this.telemetry)||void 0===r||r.record(C("OrganizationSwitcher",t))},this.unmountOrganizationSwitcher=e=>{var t;this.assertComponentsReady(Fe(this,ie,"f")),null===(t=Fe(this,ie,"f"))||void 0===t||t.ensureMounted().then((t=>t.unmountComponent({node:e})))},this.mountOrganizationList=(e,t)=>{var n,r;if(this.assertComponentsReady(Fe(this,ie,"f")),(0,E.sW)(this,this.environment)){if("development"===Fe(this,ae,"f"))throw new c.w$(De.q.cannotRenderAnyOrganizationComponent("OrganizationList"),{code:"cannot_render_organizations_disabled"})}else null===(n=Fe(this,ie,"f"))||void 0===n||n.ensureMounted({preloadHint:"OrganizationList"}).then((n=>n.mountComponent({name:"OrganizationList",appearanceKey:"organizationList",node:e,props:t}))),null===(r=this.telemetry)||void 0===r||r.record(C("OrganizationList",t))},this.unmountOrganizationList=e=>{var t;this.assertComponentsReady(Fe(this,ie,"f")),null===(t=Fe(this,ie,"f"))||void 0===t||t.ensureMounted().then((t=>t.unmountComponent({node:e})))},this.mountUserButton=(e,t)=>{var n,r;this.assertComponentsReady(Fe(this,ie,"f")),null===(n=Fe(this,ie,"f"))||void 0===n||n.ensureMounted({preloadHint:"UserButton"}).then((n=>n.mountComponent({name:"UserButton",appearanceKey:"userButton",node:e,props:t}))),null===(r=this.telemetry)||void 0===r||r.record(C("UserButton",t))},this.unmountUserButton=e=>{var t;this.assertComponentsReady(Fe(this,ie,"f")),null===(t=Fe(this,ie,"f"))||void 0===t||t.ensureMounted().then((t=>t.unmountComponent({node:e})))},this.setActive=async({session:e,organization:t,beforeEmit:n})=>{if(!this.client)throw new Error("setActive is being called before the client is loaded. Wait for init.");if(void 0===e&&!this.session)throw new Error("setActive should either be called with a session param or there should be already an active session.");const r="undefined"!=typeof window&&"function"==typeof window.__unstable__onBeforeSetActive?window.__unstable__onBeforeSetActive:c.ZT,i="undefined"!=typeof window&&"function"==typeof window.__unstable__onAfterSetActive?window.__unstable__onAfterSetActive:c.ZT;"string"==typeof e&&(e=this.client.sessions.find((t=>t.id===e))||null);let s=void 0===e?this.session:e;if(s&&void 0!==t){const e="string"==typeof t?t:null==t?void 0:t.id;s.lastActiveOrganizationId=e||null}this.session&&null===s&&(Fe(this,Ce,"f").call(this),D.Y.dispatch(D.U.TokenUpdate,{token:null})),await r(),!(0,E.oH)()&&Fe(this,le,"f").standardBrowser||(await Fe(this,Ue,"f").call(this,s),s=Fe(this,Re,"f").call(this,null==s?void 0:s.id)),await(null==s?void 0:s.getToken());const a=Fe(this,le,"f").standardBrowser?(0,E.HV)():void 0;n&&(null==a||a.startTracking(),Fe(this,Ie,"f").call(this),await n(s),null==a||a.stopTracking()),(null==a?void 0:a.isUnloading())||(Fe(this,Te,"f").call(this,s),Fe(this,Oe,"f").call(this),await i(),Fe(this,Ee,"f").call(this))},this.addListener=e=>(e=function(e){let t;return n=>{var r,i;t||(t={...n}),t={...(r=t,i=n,{client:T(r.client,i.client),session:T(r.session,i.session),user:T(r.user,i.user),organization:T(r.organization,i.organization)})},e(t)}}(e),Fe(this,ce,"f").push(e),this.client&&e({client:this.client,session:this.session,user:this.user,organization:this.organization}),()=>{je(this,ce,Fe(this,ce,"f").filter((t=>t!==e)),"f")}),this.navigate=async(e,t)=>{if(!e||!(0,E._f)())return;let n=new URL(e,window.location.href);"http:"!==n.protocol&&"https:"!==n.protocol&&(console.warn("Clerk: Not a valid protocol. Redirecting to /"),n=new URL("/",window.location.href));const r=(null==t?void 0:t.replace)&&Fe(this,le,"f").routerReplace?Fe(this,le,"f").routerReplace:Fe(this,le,"f").routerPush;if(Fe(this,le,"f").routerDebug&&console.log(`Clerk is navigating to: ${n}`),n.origin!==window.location.origin||!r)return void(0,E.T7)(n);const i=(null==t?void 0:t.metadata)?{__internal_metadata:null==t?void 0:t.metadata}:void 0;return await r((0,E.M)(n),i)},de.set(this,(async()=>{if(!(0,E._f)())return;const e=new URLSearchParams({[Le.cD]:"true"}),t=(0,E.XV)(Le.w9);t&&(0,c.ZD)(t)||(0,W.sY)();const n=(0,E.KV)({base:(0,E.XV)(Le.w9),searchParams:e},{stringify:!0});return this.navigate(this.buildUrlWithAuth(n))})),this.redirectWithAuth=async e=>{if((0,E._f)())return this.navigate(this.buildUrlWithAuth(e))},this.redirectToSignIn=async e=>{if((0,E._f)())return this.navigate(this.buildSignInUrl(e))},this.redirectToSignUp=async e=>{if((0,E._f)())return this.navigate(this.buildSignUpUrl(e))},this.redirectToUserProfile=async()=>{if((0,E._f)())return this.navigate(this.buildUserProfileUrl())},this.redirectToCreateOrganization=async()=>{if((0,E._f)())return this.navigate(this.buildCreateOrganizationUrl())},this.redirectToOrganizationProfile=async()=>{if((0,E._f)())return this.navigate(this.buildOrganizationProfileUrl())},this.redirectToAfterSignIn=async()=>{if((0,E._f)())return this.navigate(this.buildAfterSignInUrl())},this.redirectToAfterSignUp=async()=>{if((0,E._f)())return this.navigate(this.buildAfterSignUpUrl())},this.redirectToAfterSignOut=async()=>{if((0,E._f)())return this.navigate(this.buildAfterSignOutUrl())},this.handleEmailLinkVerification=async(e,t)=>{if(!this.client)return;const n=(0,E.XV)("__clerk_status");if("expired"===n)throw new A.N(A._L.Expired);if("client_mismatch"===n)throw new A.N(A._L.ClientMismatch);if("verified"!==n)throw new A.N(A._L.Failed);const r=(0,E.XV)("__clerk_created_session"),{signIn:i,signUp:s,sessions:a}=this.client,o=a.some((e=>e.id===r)),l="needs_second_factor"===i.status||"missing_requirements"===s.status,u=e=>t&&"function"==typeof t?t(e):this.navigate(e),d=e.redirectUrlComplete?()=>u(e.redirectUrlComplete):c.ZT,h=e.redirectUrl?()=>u(e.redirectUrl):c.ZT;return o?this.setActive({session:r,beforeEmit:d}):l?h():("function"==typeof e.onVerifiedOnOtherDevice&&e.onVerifiedOnOtherDevice(),null)},this.handleGoogleOneTapCallback=async(e,t,n)=>{if(!this.loaded||!this.environment||!this.client)return;const{signIn:r,signUp:i}=this.client,s="identifier"in(e||{})?e:r,a="missingFields"in(e||{})?e:i;return this._handleRedirectCallback(t,{signUp:a,signIn:s,navigate:e=>n&&"function"==typeof n?n(this.buildUrlWithAuth(e)):this.navigate(this.buildUrlWithAuth(e))})},this._handleRedirectCallback=async(e,{signIn:t,signUp:n,navigate:r})=>{var i,s,a,o,c,l;if(!this.loaded||!this.environment||!this.client)return;const{displayConfig:u}=this.environment,{firstFactorVerification:d}=t,{externalAccount:h}=n.verifications,f={status:n.status,missingFields:n.missingFields,externalAccountStatus:h.status,externalAccountErrorCode:null===(i=h.error)||void 0===i?void 0:i.code,externalAccountSessionId:null===(a=null===(s=h.error)||void 0===s?void 0:s.meta)||void 0===a?void 0:a.sessionId,sessionId:n.createdSessionId},p={status:t.status,firstFactorVerificationStatus:d.status,firstFactorVerificationErrorCode:null===(o=d.error)||void 0===o?void 0:o.code,firstFactorVerificationSessionId:null===(l=null===(c=d.error)||void 0===c?void 0:c.meta)||void 0===l?void 0:l.sessionId,sessionId:t.createdSessionId},m=e=>()=>r(e),g=m(e.signInUrl||u.signInUrl),v=m(e.signUpUrl||u.signUpUrl),y=m(e.firstFactorUrl||(0,E.KV)({base:u.signInUrl,hashPath:"/factor-one"},{stringify:!0})),w=m(e.secondFactorUrl||(0,E.KV)({base:u.signInUrl,hashPath:"/factor-two"},{stringify:!0})),b=m(e.resetPasswordUrl||(0,E.KV)({base:u.signInUrl,hashPath:"/reset-password"},{stringify:!0})),_=new R.O(Fe(this,le,"f"),e),S=m(_.getAfterSignInUrl()),k=m(_.getAfterSignUpUrl()),P=m(e.continueSignUpUrl||(0,E.KV)({base:u.signUpUrl,hashPath:"/continue"},{stringify:!0})),U=({missingFields:t})=>t.length?P():(0,E.vx)({signUp:n,verifyEmailPath:e.verifyEmailAddressUrl||(0,E.KV)({base:u.signUpUrl,hashPath:"/verify-email-address"},{stringify:!0}),verifyPhonePath:e.verifyPhoneNumberUrl||(0,E.KV)({base:u.signUpUrl,hashPath:"/verify-phone-number"},{stringify:!0}),navigate:r});if("complete"===p.status)return this.setActive({session:p.sessionId,beforeEmit:S});if("transferable"===f.externalAccountStatus&&"external_account_exists"===f.externalAccountErrorCode){const e=await t.create({transfer:!0});switch(e.status){case"complete":return this.setActive({session:e.createdSessionId,beforeEmit:S});case"needs_first_factor":return y();case"needs_second_factor":return w();case"needs_new_password":return b();default:(0,W.O7)("sign in")}}const O="user_locked"===p.firstFactorVerificationErrorCode;if("user_locked"===f.externalAccountErrorCode)return v();if(O)return g();if("needs_first_factor"===p.status)return y();if("needs_new_password"===p.status)return b();if("transferable"===p.firstFactorVerificationStatus){const e=await n.create({transfer:!0});switch(e.status){case"complete":return this.setActive({session:e.createdSessionId,beforeEmit:k});case"missing_requirements":return U({missingFields:e.missingFields});default:(0,W.O7)("sign in")}}if("complete"===f.status)return this.setActive({session:f.sessionId,beforeEmit:k});if("needs_second_factor"===p.status)return w();if(("failed"===f.externalAccountStatus||"unverified"===f.externalAccountStatus)&&"identifier_already_signed_in"===f.externalAccountErrorCode&&f.externalAccountSessionId||"failed"===p.firstFactorVerificationStatus&&"identifier_already_signed_in"===p.firstFactorVerificationErrorCode&&p.firstFactorVerificationSessionId){const e=p.firstFactorVerificationSessionId||f.externalAccountSessionId;if(e)return this.setActive({session:e,beforeEmit:S})}return(0,E.l1)(n)?v():"verified"===f.externalAccountStatus&&"missing_requirements"===f.status?U({missingFields:n.missingFields}):g()},this.handleRedirectCallback=async(e={},t)=>{if(!this.loaded||!this.environment||!this.client)return;const{signIn:n,signUp:r}=this.client;return this._handleRedirectCallback(e,{signUp:r,signIn:n,navigate:e=>t&&"function"==typeof t?t(e):this.navigate(e)})},this.handleUnauthenticated=async(e={broadcast:!0})=>{if(!this.client||!this.session)return;const t=await A.KU.getInstance().fetch();return this.updateClient(t),this.session?void 0:(e.broadcast&&Fe(this,Ce,"f").call(this),this.setActive({session:null}))},this.authenticateWithGoogleOneTap=async e=>{var t;return null===(t=this.client)||void 0===t?void 0:t.signIn.create({strategy:"google_one_tap",token:e.token}).catch((t=>{var n;if((0,c.kD)(t)&&"external_account_not_found"===t.errors[0].code)return null===(n=this.client)||void 0===n?void 0:n.signUp.create({strategy:"google_one_tap",token:e.token});throw t}))},this.authenticateWithMetamask=async({redirectUrl:e,signUpContinueUrl:t,customNavigate:n,unsafeMetadata:r}={})=>{if(!this.client||!this.environment)return;const i=e=>n&&"function"==typeof n?n(e):this.navigate(e);let s;try{s=await this.client.signIn.authenticateWithMetamask()}catch(a){if(!(0,E.VZ)(a,Le.O1.FORM_IDENTIFIER_NOT_FOUND))throw a;s=await this.client.signUp.authenticateWithMetamask({unsafeMetadata:r}),t&&"missing_requirements"===s.status&&"verified"===s.verifications.web3Wallet.status&&await i(t)}s.createdSessionId&&await this.setActive({session:s.createdSessionId,beforeEmit:()=>e?i(e):Promise.resolve()})},this.createOrganization=async({name:e,slug:t})=>A.cp.create({name:e,slug:t}),this.getOrganization=async e=>A.cp.get(e),this.__internal_setCountry=e=>{this.__internal_country||(this.__internal_country=e)},this.updateClient=e=>{if(!this.client){const t=Fe(this,le,"f").selectInitialSession?Fe(this,le,"f").selectInitialSession(e):Fe(this,ke,"f").call(this,e);Fe(this,Te,"f").call(this,t)}if(this.client=e,this.session){const e=Fe(this,Re,"f").call(this,this.session.id);Fe(this,Te,"f").call(this,e)}Fe(this,Oe,"f").call(this)},this.__unstable__setEnvironment=async e=>{this.environment=new A.qA(e),X.mountComponentRenderer&&je(this,ie,X.mountComponentRenderer(this,this.environment,Fe(this,le,"f")),"f")},this.__unstable__onBeforeRequest=e=>{Fe(this,se,"f").onBeforeRequest(e)},this.__unstable__onAfterResponse=e=>{Fe(this,se,"f").onAfterResponse(e)},this.__unstable__updateProps=e=>{var t;return null===(t=Fe(this,ie,"f"))||void 0===t?void 0:t.ensureMounted().then((t=>t.updateProps(e)))},he.set(this,(()=>"true"===(0,E.XV)(Le.cD))),fe.set(this,(()=>(0,E.xy)(Le.cD))),pe.set(this,(()=>{const e=new URLSearchParams({[Le.w9]:window.location.href});return(0,E.KV)({base:Fe(this,le,"f").signInUrl,searchParams:e},{stringify:!0})})),me.set(this,(()=>{let e;if(this.proxyUrl){const t=new URL(this.proxyUrl);e=new URL(`${t.pathname}/v1/client/sync`,t.origin)}else this.domain&&(e=new URL("/v1/client/sync",`https://${this.domain}`));return null==e||e.searchParams.append("redirect_url",window.location.href),(null==e?void 0:e.toString())||""})),ge.set(this,(()=>{var e;return Fe(this,he,"f").call(this)?(Fe(this,fe,"f").call(this),!1):!!this.isSatellite&&!!(null===(e=Fe(this,ne,"f"))||void 0===e?void 0:e.isSignedOut())})),ve.set(this,(()=>"production"!==Fe(this,ae,"f")&&(!this.isSatellite&&!!(0,E.XV)(Le.w9)))),ye.set(this,(async()=>{"development"===this.instanceType?await this.navigate(Fe(this,pe,"f").call(this)):"production"===this.instanceType&&await this.navigate(Fe(this,me,"f").call(this))})),we.set(this,((e,t)=>{let n;try{n=new URL(e)}catch{(0,W._5)()}n.origin===t&&(0,W.cT)()})),be.set(this,(()=>{this.isSatellite&&("development"!==Fe(this,ae,"f")||Fe(this,le,"f").signInUrl||(0,W.qW)(),this.proxyUrl||this.domain||(0,W.xZ)(),Fe(this,le,"f").signInUrl&&Fe(this,we,"f").call(this,Fe(this,le,"f").signInUrl,window.location.origin))})),_e.set(this,(async()=>{var e,t;if(je(this,ne,new Y(this,Fe(this,se,"f")),"f"),Fe(this,be,"f").call(this),Fe(this,ge,"f").call(this))return await Fe(this,ye,"f").call(this),!1;if("production"===Fe(this,ae,"f")?null===(e=Fe(this,ne,"f"))||void 0===e||e.setupProduction():await(null===(t=Fe(this,ne,"f"))||void 0===t?void 0:t.setupDevelopment()),Fe(this,ve,"f").call(this))return await Fe(this,de,"f").call(this),!1;je(this,ue,(0,E.LM)(),"f"),je(this,re,new c.yd("clerk"),"f"),Fe(this,Pe,"f").call(this);const n=(0,E.u9)(null===window||void 0===window?void 0:window.location.hostname),r="development"===Fe(this,ae,"f")&&!n;let i=0;for(;i<2;){i++;try{const[e,t]=await Promise.all([A.qA.getInstance().fetch({touch:r}),A.KU.getInstance().fetch()]);if(this.updateClient(t),this.updateEnvironment(e),await Fe(this,Ne,"f").call(this))return!1;X.mountComponentRenderer&&je(this,ie,X.mountComponentRenderer(this,this.environment,Fe(this,le,"f")),"f");break}catch(s){if(!(0,E.VZ)(s,"dev_browser_unauthenticated")){if((0,c.af)())throw s;return console.warn(s),!1}await Fe(this,ne,"f").handleUnauthenticatedDevBrowser()}i>=2&&(0,W.Xp)()}return Fe(this,$e,"f").call(this),Fe(this,ze,"f").call(this),!0})),Se.set(this,(async()=>{const[e,t]=await Promise.all([A.qA.getInstance().fetch({touch:!1}),A.KU.getInstance().fetch()]);return this.updateClient(t),this.updateEnvironment(e),X.mountComponentRenderer&&je(this,ie,X.mountComponentRenderer(this,this.environment,Fe(this,le,"f")),"f"),!0})),ke.set(this,(e=>{if(e.lastActiveSessionId){const t=e.activeSessions.find((t=>t.id===e.lastActiveSessionId));if(t)return t}return e.activeSessions[0]||null})),Pe.set(this,(()=>{var e,t;(0,c._f)()&&(null===(e=Fe(this,ue,"f"))||void 0===e||e.onPageVisible((()=>{this.session&&Fe(this,Ue,"f").call(this,this.session)})),null===(t=Fe(this,re,"f"))||void 0===t||t.addEventListener("message",(({data:e})=>{"signout"===e.type&&this.handleUnauthenticated()})))})),Ue.set(this,(async e=>{if(!e||!Fe(this,le,"f").touchSession)return Promise.resolve();await e.touch().catch((e=>{(0,c.ix)(e)&&this.handleUnauthenticated()}))})),Oe.set(this,(()=>{if(this.client)for(const e of Fe(this,ce,"f"))e({client:this.client,session:this.session,user:this.user,organization:this.organization})})),Ce.set(this,(()=>{var e;null===(e=Fe(this,re,"f"))||void 0===e||e.postMessage({type:"signout"})})),Ee.set(this,(()=>{X.mountComponentRenderer&&(this.closeSignUp(),this.closeSignIn())})),Ie.set(this,(()=>{this.session=void 0,this.organization=void 0,this.user=void 0,Fe(this,Oe,"f").call(this)})),Ae.set(this,(()=>{var e;return((null===(e=this.session)||void 0===e?void 0:e.user.organizationMemberships)||[]).map((e=>e.organization)).find((e=>{var t;return e.id===(null===(t=this.session)||void 0===t?void 0:t.lastActiveOrganizationId)}))||null})),Te.set(this,(e=>{this.session=e||null,this.organization=Fe(this,Ae,"f").call(this),Fe(this,xe,"f").call(this)})),Re.set(this,(e=>{var t;return(null===(t=this.client)||void 0===t?void 0:t.activeSessions.find((t=>t.id===e)))||null})),xe.set(this,(()=>{this.user=this.session?this.session.user:null})),ze.set(this,(()=>{this.addListener((({session:e})=>{var t;(null==e?void 0:e.actor)&&(null===(t=Fe(this,ie,"f"))||void 0===t||t.ensureMounted().then((e=>e.mountImpersonationFab())))}))})),Me.set(this,((e,t,n)=>{if(!(e&&this.loaded&&this.environment&&this.environment.displayConfig))return"";const r=Fe(this,le,"f")[e]||this.environment.displayConfig[e],i=new R.O(Fe(this,le,"f"),t).toSearchParams(),s=new URLSearchParams(n||{}),a=(0,E.KV)({base:r,hashSearchParams:[s,i]},{stringify:!0});return this.buildUrlWithAuth(a)})),Ne.set(this,(async()=>{var e,t;const n=new URLSearchParams(window.location.search).get("redirect_url"),r="production"===this.instanceType,i=null!==n&&(0,E.To)(this.frontendApi,n);if(r||!i)return!1;const s=this.session,a=Fe(this,le,"f").signInUrl||(null===(e=this.environment)||void 0===e?void 0:e.displayConfig.signInUrl),o=a&&window.location.href.startsWith(a),c=Fe(this,le,"f").signUpUrl||(null===(t=this.environment)||void 0===t?void 0:t.displayConfig.signUpUrl),l=c&&window.location.href.startsWith(c);return!((0,E.WW)(n)&&!s&&(o||l)||(await this.navigate(this.buildUrlWithAuth(n)),0))})),$e.set(this,(()=>{try{(0,E.xy)("__clerk_handshake"),(0,E.xy)("__clerk_help")}catch(e){}})),e=(e||"").trim(),je(this,ee,null==t?void 0:t.domain,"f"),je(this,te,null==t?void 0:t.proxyUrl,"f"),!e)return E.RM.throwMissingPublishableKeyError();const n=(0,c.nQ)(e);if(!n)return E.RM.throwInvalidPublishableKeyError({key:e});je(this,Q,e,"f"),je(this,ae,n.instanceType,"f"),je(this,se,(0,We.g)(this),"f"),A.i.clerk=this}buildUrlWithAuth(e){if("production"===Fe(this,ae,"f"))return e;const t=new URL(e,window.location.origin);return t.origin===window.location.origin?t.href:Fe(this,ne,"f")?Fe(this,ne,"f").decorateUrlWithDevBrowserToken(t).href:t.href}buildSignInUrl(e){return Fe(this,Me,"f").call(this,"signInUrl",{...e,redirectUrl:(null==e?void 0:e.redirectUrl)||window.location.href},null==e?void 0:e.initialValues)}buildSignUpUrl(e){return Fe(this,Me,"f").call(this,"signUpUrl",{...e,redirectUrl:(null==e?void 0:e.redirectUrl)||window.location.href},null==e?void 0:e.initialValues)}buildUserProfileUrl(){return this.environment&&this.environment.displayConfig?this.buildUrlWithAuth(this.environment.displayConfig.userProfileUrl):""}buildHomeUrl(){return this.environment&&this.environment.displayConfig?this.buildUrlWithAuth(this.environment.displayConfig.homeUrl):""}buildAfterSignInUrl(){return this.buildUrlWithAuth(new R.O(Fe(this,le,"f")).getAfterSignInUrl())}buildAfterSignUpUrl(){return this.buildUrlWithAuth(new R.O(Fe(this,le,"f")).getAfterSignUpUrl())}buildAfterSignOutUrl(){return Fe(this,le,"f").afterSignOutUrl?this.buildUrlWithAuth(Fe(this,le,"f").afterSignOutUrl):"/"}buildCreateOrganizationUrl(){return this.environment&&this.environment.displayConfig?this.buildUrlWithAuth(this.environment.displayConfig.createOrganizationUrl):""}buildOrganizationProfileUrl(){return this.environment&&this.environment.displayConfig?this.buildUrlWithAuth(this.environment.displayConfig.organizationProfileUrl):""}updateEnvironment(e){var t;this.environment=e,null===(t=Fe(this,ne,"f"))||void 0===t||t.setEnvironment(e)}get __internal_last_error(){const e=this.internal_last_error;return this.internal_last_error=null,e}set __internal_last_error(e){this.internal_last_error=e}get __unstable__environment(){return this.environment}__internal_navigateWithError(e,t){return this.__internal_last_error=t,this.navigate(e)}assertComponentsReady(e){if(!X.mountComponentRenderer)throw new Error("ClerkJS was loaded without UI components.");if(!e)throw new Error("ClerkJS components are not ready yet.")}}X=Ke,Q=new WeakMap,ee=new WeakMap,te=new WeakMap,ne=new WeakMap,re=new WeakMap,ie=new WeakMap,se=new WeakMap,ae=new WeakMap,oe=new WeakMap,ce=new WeakMap,le=new WeakMap,ue=new WeakMap,de=new WeakMap,he=new WeakMap,fe=new WeakMap,pe=new WeakMap,me=new WeakMap,ge=new WeakMap,ve=new WeakMap,ye=new WeakMap,we=new WeakMap,be=new WeakMap,_e=new WeakMap,Se=new WeakMap,ke=new WeakMap,Pe=new WeakMap,Ue=new WeakMap,Oe=new WeakMap,Ce=new WeakMap,Ee=new WeakMap,Ie=new WeakMap,Ae=new WeakMap,Te=new WeakMap,Re=new WeakMap,xe=new WeakMap,ze=new WeakMap,Me=new WeakMap,Ne=new WeakMap,$e=new WeakMap,Ke.version="5.7.1",Ke.sdkMetadata={name:"@clerk/clerk-js",version:"5.7.1",environment:"production"};var Je=a(2903),qe=a(7752),Be=a(2784),Ze=a(3859);const Ge={SignIn:()=>Promise.all([a.e(216),a.e(700),a.e(577)]).then(a.bind(a,3483)),SignUp:()=>Promise.all([a.e(216),a.e(700),a.e(830)]).then(a.bind(a,2847)),UserButton:()=>Promise.all([a.e(216),a.e(700),a.e(132)]).then(a.bind(a,3898)),UserProfile:()=>Promise.all([a.e(216),a.e(700),a.e(971)]).then(a.bind(a,906)),CreateOrganization:()=>Promise.all([a.e(216),a.e(700),a.e(647),a.e(979)]).then(a.bind(a,3555)),OrganizationProfile:()=>Promise.all([a.e(216),a.e(700),a.e(229)]).then(a.bind(a,8472)),OrganizationSwitcher:()=>Promise.all([a.e(216),a.e(700),a.e(336)]).then(a.bind(a,3617)),OrganizationList:()=>Promise.all([a.e(216),a.e(700),a.e(647),a.e(653)]).then(a.bind(a,1987)),ImpersonationFab:()=>Promise.all([a.e(216),a.e(700),a.e(490)]).then(a.bind(a,4921)),GoogleOneTap:()=>Promise.all([a.e(216),a.e(700),a.e(379)]).then(a.bind(a,5058))},He=(0,Be.lazy)((()=>Ge.SignIn().then((e=>({default:e.SignIn}))))),Ye=(0,Be.lazy)((()=>Ge.SignIn().then((e=>({default:e.SignInModal}))))),Xe=(0,Be.lazy)((()=>Ge.GoogleOneTap().then((e=>({default:e.OneTap}))))),Qe=(0,Be.lazy)((()=>Ge.SignUp().then((e=>({default:e.SignUp}))))),et=(0,Be.lazy)((()=>Ge.SignUp().then((e=>({default:e.SignUpModal}))))),tt=(0,Be.lazy)((()=>Ge.UserButton().then((e=>({default:e.UserButton}))))),nt=(0,Be.lazy)((()=>Ge.UserProfile().then((e=>({default:e.UserProfile}))))),rt=(0,Be.lazy)((()=>Ge.UserProfile().then((e=>({default:e.UserProfileModal}))))),it=(0,Be.lazy)((()=>Ge.CreateOrganization().then((e=>({default:e.CreateOrganization}))))),st=(0,Be.lazy)((()=>Ge.CreateOrganization().then((e=>({default:e.CreateOrganizationModal}))))),at=(0,Be.lazy)((()=>Ge.OrganizationProfile().then((e=>({default:e.OrganizationProfile}))))),ot=(0,Be.lazy)((()=>Ge.OrganizationProfile().then((e=>({default:e.OrganizationProfileModal}))))),ct=(0,Be.lazy)((()=>Ge.OrganizationSwitcher().then((e=>({default:e.OrganizationSwitcher}))))),lt=(0,Be.lazy)((()=>Ge.OrganizationList().then((e=>({default:e.OrganizationList}))))),ut=(0,Be.lazy)((()=>Ge.ImpersonationFab().then((e=>({default:e.ImpersonationFab}))))),dt={SignIn:He,SignUp:Qe,UserButton:tt,UserProfile:nt,OrganizationSwitcher:ct,OrganizationList:lt,OrganizationProfile:at,CreateOrganization:it,SignInModal:Ye,SignUpModal:et,UserProfileModal:rt,OrganizationProfileModal:ot,CreateOrganizationModal:st,GoogleOneTap:Xe},ht=(0,Be.lazy)((()=>Promise.all([a.e(216),a.e(700)]).then(a.bind(a,3918)).then((e=>({default:e.CoreClerkContextWrapper}))))),ft=(0,Be.lazy)((()=>Promise.all([a.e(216),a.e(700)]).then(a.bind(a,3918)).then((e=>({default:e.EnvironmentProvider}))))),pt=(0,Be.lazy)((()=>Promise.all([a.e(216),a.e(700)]).then(a.bind(a,3918)).then((e=>({default:e.OptionsProvider}))))),mt=(0,Be.lazy)((()=>Promise.all([a.e(216),a.e(700)]).then(a.bind(a,3476)).then((e=>({default:e.AppearanceProvider}))))),gt=(0,Be.lazy)((()=>Promise.all([a.e(216),a.e(700)]).then(a.bind(a,3736)).then((e=>({default:e.VirtualRouter}))))),vt=(0,Be.lazy)((()=>Promise.all([a.e(216),a.e(700)]).then(a.bind(a,9820)).then((e=>({default:e.InternalThemeProvider}))))),yt=(0,Be.lazy)((()=>Promise.all([a.e(216),a.e(700)]).then(a.bind(a,7116)).then((e=>({default:e.Portal}))))),wt=(0,Be.lazy)((()=>Promise.all([a.e(216),a.e(700)]).then(a.bind(a,7116)).then((e=>({default:e.VirtualBodyRootPortal}))))),bt=(0,Be.lazy)((()=>Promise.all([a.e(216),a.e(700)]).then(a.bind(a,8512)).then((e=>({default:e.FlowMetadataProvider}))))),_t=(0,Be.lazy)((()=>Promise.all([a.e(216),a.e(700)]).then(a.bind(a,8512)).then((e=>({default:e.Modal}))))),St=e=>(0,Je.tZ)(ht,{clerk:e.clerk,children:(0,Je.tZ)(ft,{value:e.environment,children:(0,Je.tZ)(pt,{value:e.options,children:e.children})})}),kt=e=>(0,Je.tZ)(mt,{globalAppearance:e.globalAppearance,appearanceKey:e.appearanceKey,appearance:e.componentAppearance,children:(0,Je.tZ)(yt,{node:e.node,component:dt[e.componentName],props:e.componentProps,componentName:e.componentName})}),Pt=e=>(0,Je.tZ)(Be.Suspense,{fallback:"",children:(0,Je.tZ)(mt,{globalAppearance:e.globalAppearance,appearanceKey:e.appearanceKey,appearance:e.componentAppearance,children:(0,Je.tZ)(bt,{flow:e.flowName||"",children:(0,Je.tZ)(vt,{children:(0,Je.tZ)(_t,{handleClose:e.onClose,containerSx:e.modalContainerSx,contentSx:e.modalContentSx,children:e.startPath?(0,Je.tZ)(Be.Suspense,{children:(0,Je.tZ)(gt,{startPath:e.startPath,onExternalNavigate:e.onExternalNavigate,children:e.children})}):e.children})})})})}),Ut=e=>(0,Je.tZ)(Be.Suspense,{children:(0,Je.tZ)(mt,{globalAppearance:e.globalAppearance,appearanceKey:"impersonationFab",children:e.children})}),Ot=e=>(0,Je.tZ)(mt,{globalAppearance:e.globalAppearance,appearanceKey:"oneTap",appearance:e.componentAppearance,children:(0,Je.tZ)(wt,{startPath:e.startPath,component:dt.GoogleOneTap,props:e.componentProps,componentName:"GoogleOneTap"})});let Ct=0;const Et={},It=Object.freeze({SignUp:"signUpModal",SignIn:"signInModal",UserProfile:"userProfileModal",OrganizationProfile:"organizationProfileModal",CreateOrganization:"createOrganizationModal"}),At=e=>{const[t,n]=Be.useState({appearance:e.options.appearance,options:e.options,googleOneTapModal:null,signInModal:null,signUpModal:null,userProfileModal:null,organizationProfileModal:null,createOrganizationModal:null,nodes:new Map,impersonationFab:!1}),{googleOneTapModal:r,signInModal:i,signUpModal:s,userProfileModal:a,organizationProfileModal:o,createOrganizationModal:c,nodes:l}=t,{urlStateParam:u,clearUrlStateParam:d,decodedRedirectParams:h}=(0,Ze._)();(0,qe.Gw)((()=>{h&&n((e=>({...e,[It[h.componentName]]:!0}))),Et.mountComponent=e=>{const{node:t,name:r,props:i,appearanceKey:s}=e;t||(0,W.HE)(),n((e=>(e.nodes.set(t,{key:"p"+ ++Ct,name:r,props:i,appearanceKey:s}),{...e,nodes:l})))},Et.unmountComponent=e=>{const{node:t}=e;n((e=>(e.nodes.delete(t),{...e,nodes:l})))},Et.updateProps=({node:e,props:r,...i})=>{if(e&&r&&"object"==typeof r){const i=t.nodes.get(e);if(i)return i.props={...r},void n((e=>({...e})))}n((e=>({...e,...i,options:{...e.options,...i.options}})))},Et.closeModal=e=>{d(),n((t=>({...t,[e+"Modal"]:null})))},Et.openModal=(e,t)=>{n((n=>({...n,[e+"Modal"]:t})))},Et.mountImpersonationFab=()=>{n((e=>({...e,impersonationFab:!0})))},e.onComponentsMounted()}),[]);const f=(0,Je.tZ)(Ot,{componentProps:r,globalAppearance:t.appearance,componentAppearance:null==r?void 0:r.appearance,startPath:(0,E.e1)({base:"/one-tap",path:""})}),p=(0,Je.BX)(Pt,{globalAppearance:t.appearance,appearanceKey:"signIn",componentAppearance:null==i?void 0:i.appearance,flowName:"signIn",onClose:()=>Et.closeModal("signIn"),onExternalNavigate:()=>Et.closeModal("signIn"),startPath:(0,E.e1)({base:"/sign-in",path:null==u?void 0:u.path}),componentName:"SignInModal",children:[(0,Je.tZ)(Ye,{...i}),(0,Je.tZ)(et,{...i})]}),m=(0,Je.BX)(Pt,{globalAppearance:t.appearance,appearanceKey:"signUp",componentAppearance:null==s?void 0:s.appearance,flowName:"signUp",onClose:()=>Et.closeModal("signUp"),onExternalNavigate:()=>Et.closeModal("signUp"),startPath:(0,E.e1)({base:"/sign-up",path:null==u?void 0:u.path}),componentName:"SignUpModal",children:[(0,Je.tZ)(Ye,{...s}),(0,Je.tZ)(et,{...s})]}),g=(0,Je.tZ)(Pt,{globalAppearance:t.appearance,appearanceKey:"userProfile",componentAppearance:null==a?void 0:a.appearance,flowName:"userProfile",onClose:()=>Et.closeModal("userProfile"),onExternalNavigate:()=>Et.closeModal("userProfile"),startPath:(0,E.e1)({base:"/user",path:null==u?void 0:u.path}),componentName:"SignUpModal",modalContainerSx:{alignItems:"center"},modalContentSx:e=>({height:`min(${e.sizes.$176}, calc(100% - ${e.sizes.$12}))`,margin:0}),children:(0,Je.tZ)(rt,{...a})}),v=(0,Je.tZ)(Pt,{globalAppearance:t.appearance,appearanceKey:"organizationProfile",componentAppearance:null==o?void 0:o.appearance,flowName:"organizationProfile",onClose:()=>Et.closeModal("organizationProfile"),onExternalNavigate:()=>Et.closeModal("organizationProfile"),startPath:(0,E.e1)({base:"/organizationProfile",path:null==u?void 0:u.path}),componentName:"OrganizationProfileModal",modalContainerSx:{alignItems:"center"},modalContentSx:e=>({height:`min(${e.sizes.$176}, calc(100% - ${e.sizes.$12}))`,margin:0}),children:(0,Je.tZ)(ot,{...o})}),y=(0,Je.tZ)(Pt,{globalAppearance:t.appearance,appearanceKey:"createOrganization",componentAppearance:null==c?void 0:c.appearance,flowName:"createOrganization",onClose:()=>Et.closeModal("createOrganization"),onExternalNavigate:()=>Et.closeModal("createOrganization"),startPath:(0,E.e1)({base:"/createOrganization",path:null==u?void 0:u.path}),componentName:"CreateOrganizationModal",modalContainerSx:{alignItems:"center"},modalContentSx:e=>({height:`min(${e.sizes.$120}, calc(100% - ${e.sizes.$12}))`,margin:0}),children:(0,Je.tZ)(st,{...c})});return(0,Je.tZ)(Be.Suspense,{fallback:"",children:(0,Je.BX)(St,{clerk:e.clerk,environment:e.environment,options:t.options,children:[[...l].map((([e,n])=>{var r;return(0,Je.tZ)(kt,{node:e,globalAppearance:t.appearance,appearanceKey:n.appearanceKey,componentAppearance:null===(r=n.props)||void 0===r?void 0:r.appearance,componentName:n.name,componentProps:n.props},n.key)})),r&&f,i&&p,s&&m,a&&g,o&&v,c&&y,t.impersonationFab&&(0,Je.tZ)(Ut,{globalAppearance:t.appearance,children:(0,Je.tZ)(ut,{})})]})})};var Tt,Rt,xt;Ke.mountComponentRenderer=(e,t,n)=>{let r,i=document.getElementById("clerk-components");return i||(i=document.createElement("div"),i.setAttribute("id","clerk-components"),document.body.appendChild(i)),{ensureMounted:async s=>{const{preloadHint:o}=s||{};if(!r){const s=(0,c.WK)();o&&(async e=>{var t;null===(t=Ge[e])||void 0===t||t.call(Ge)})(o),r=Promise.all([a.e(216),a.e(700)]).then(a.bind(a,1434)).then((({createRoot:r})=>(r(i).render((0,Je.tZ)(At,{clerk:e,environment:t,options:n,onComponentsMounted:s.resolve})),s.promise.then((()=>Et)))))}return r.then((e=>e))}}};const zt=(null===(Tt=document.querySelector("script[data-clerk-publishable-key]"))||void 0===Tt?void 0:Tt.getAttribute("data-clerk-publishable-key"))||window.__clerk_publishable_key||"",Mt=(null===(Rt=document.querySelector("script[data-clerk-proxy-url]"))||void 0===Rt?void 0:Rt.getAttribute("data-clerk-proxy-url"))||window.__clerk_proxy_url||"",Nt=(null===(xt=document.querySelector("script[data-clerk-domain]"))||void 0===xt?void 0:xt.getAttribute("data-clerk-domain"))||window.__clerk_domain||"";window.Clerk=new Ke(zt,{proxyUrl:Mt,domain:Nt})}(),o}()}));