New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@clerk/shared

Package Overview
Dependencies
Maintainers
9
Versions
2039
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clerk/shared - npm Package Compare versions

Comparing version 0.15.2-staging.0 to 0.15.2

36

dist/esm/index.js

@@ -1,18 +0,24 @@

import{c as Z}from"./chunk-GW3MP3TA.js";var St=Object.freeze({InvalidFrontendApiErrorMessage:"The frontendApi passed to Clerk is invalid. You can get your Frontend API key at https://dashboard.clerk.com/last-active?path=api-keys. (key={{key}})",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."});function It({packageName:e,customMessages:r}){let t=e,n={...St,...r};function o(i,a){if(!a)return`${t}: ${i}`;let u=i,f=i.matchAll(/{{([a-zA-Z0-9-_]+)}}/g);for(let s of f){let l=(a[s[1]]||"").toString();u=u.replace(`{{${s[1]}}}`,l)}return`${t}: ${u}`}return{setPackageName({packageName:i}){return typeof i=="string"&&(t=i),this},setMessages({customMessages:i}){return Object.assign(n,i||{}),this},throwInvalidPublishableKeyError(i){throw new Error(o(n.InvalidPublishableKeyErrorMessage,i))},throwInvalidFrontendApiError(i){throw new Error(o(n.InvalidFrontendApiErrorMessage,i))},throwInvalidProxyUrl(i){throw new Error(o(n.InvalidProxyUrlErrorMessage,i))},throwMissingPublishableKeyError(){throw new Error(o(n.MissingPublishableKeyErrorMessage))}}}var Nr=e=>{if(e.length==0)return"";if(e.length==1)return e[0];let r=e.slice(0,-1).join(", ");return r+=`, or ${e.slice(-1)}`,r};function Lt(){return typeof window<"u"}function zt(e){return 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/].map(t=>t.source).join("|"),"i").test(e)}function Gr(){let e=window?.navigator;if(!Lt()||!e)return!1;let r=zt(e?.userAgent),t=e?.webdriver,n=e?.onLine,o=e?.connection?.rtt!==0&&e?.connection?.downlink!==0;return!r&&!t&&o&&n}var Mt=/^#?([A-F0-9]{6}|[A-F0-9]{3})$/i,Dt=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/i,Pt=/^rgba\((\d+),\s*(\d+),\s*(\d+)(,\s*\d+(\.\d+)?)\)$/i,At=/^hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)$/i,Ut=/^hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%(,\s*\d+(\.\d+)?)*\)$/i,oe=e=>!!e.match(Mt),ve=e=>!!(e.match(Dt)||e.match(Pt)),he=e=>!!e.match(At)||!!e.match(Ut),Be=e=>typeof e!="string"&&"r"in e,je=e=>typeof e!="string"&&"h"in e,be=e=>e==="transparent",jr=e=>typeof e!="string"&&e.a!=null&&e.a<1;var _t=/[hsla()]/g,Ft=/[rgba()]/g,Jr=e=>e==="transparent"?{h:0,s:0,l:0,a:0}:oe(e)?Nt(e):he(e)?Je(e):ve(e)?Xe(e):null,qr=e=>(e=e.trim(),oe(e)?e.startsWith("#")?e:`#${e}`:ve(e)?Ye(e):he(e)?Je(e):be(e)?e:""),Wt=e=>typeof e=="string"&&(oe(e)||be(e))?e:Be(e)?$t(e):je(e)?Ht(e):"",Vt=e=>{e=e.replace("#","");let r=parseInt(e.substring(0,2),16),t=parseInt(e.substring(2,4),16),n=parseInt(e.substring(4,6),16);return{r,g:t,b:n}},$t=e=>{let{a:r,b:t,g:n,r:o}=e;return e.a===0?"transparent":e.a!=null?`rgba(${o},${n},${t},${r})`:`rgb(${o},${n},${t})`},Ht=e=>{let{h:r,s:t,l:n,a:o}=e,i=Math.round(t*100),a=Math.round(n*100);return e.a===0?"transparent":e.a!=null?`hsla(${r},${i}%,${a}%,${o})`:`hsl(${r},${i}%,${a}%)`},Nt=e=>{let r=Wt(Vt(e));return Xe(r)},Xe=e=>{let r=Ye(e),t=r.r/255,n=r.g/255,o=r.b/255,i=Math.max(t,n,o),a=Math.min(t,n,o),u,f,s=(i+a)/2;if(i==a)u=f=0;else{let c=i-a;switch(f=s>=.5?c/(2-(i+a)):c/(i+a),i){case t:u=(n-o)/c*60;break;case n:u=((o-t)/c+2)*60;break;default:u=((t-n)/c+4)*60;break}}let l={h:Math.round(u),s:f,l:s},p=r.a;return p!=null&&(l.a=p),l},Ye=e=>{let[r,t,n,o]=e.replace(Ft,"").split(",").map(i=>Number.parseFloat(i));return{r,g:t,b:n,a:o}},Je=e=>{let[r,t,n,o]=e.replace(_t,"").split(",").map(i=>Number.parseFloat(i));return{h:r,s:t/100,l:n/100,a:o}};function ae(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)e[n]=t[n]}return e}var Kt={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function ye(e,r){function t(o,i,a){if(!(typeof document>"u")){a=ae({},r,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var u="";for(var f in a)!a[f]||(u+="; "+f,a[f]!==!0&&(u+="="+a[f].split(";")[0]));return document.cookie=o+"="+e.write(i,o)+u}}function n(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var i=document.cookie?document.cookie.split("; "):[],a={},u=0;u<i.length;u++){var f=i[u].split("="),s=f.slice(1).join("=");try{var l=decodeURIComponent(f[0]);if(a[l]=e.read(s,l),o===l)break}catch{}}return o?a[o]:a}}return Object.create({set:t,get:n,remove:function(o,i){t(o,"",ae({},i,{expires:-1}))},withAttributes:function(o){return ye(this.converter,ae({},this.attributes,o))},withConverter:function(o){return ye(ae({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(e)}})}var Gt=ye(Kt,{path:"/"}),se=Gt;function tn(e){return{get(){return se.get(e)},set(r,t={}){return se.set(e,r,t)},remove(r){se.remove(e,r)}}}var on=()=>{let e=Z,r=Z;return{promise:new Promise((n,o)=>{e=n,r=o}),resolve:e,reject:r}};function sn(e){return e?e.toLocaleString("en-US",{hour:"2-digit",minute:"numeric",hour12:!0}):""}function Bt(e,r,{absolute:t=!0}={}){if(!e||!r)return 0;let n=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),o=Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()),i=Math.floor((o-n)/864e5);return t?Math.abs(i):i}function Ce(e){try{return new Date(e||new Date)}catch{return new Date}}function un(e){let{date:r,relativeTo:t}=e;if(!r||!t)return null;let n=Ce(r),o=Ce(t),i=Bt(o,n,{absolute:!1});return i<-6?{relativeDateCase:"other",date:n}:i<-1?{relativeDateCase:"previous6Days",date:n}:i===-1?{relativeDateCase:"lastDay",date:n}:i===0?{relativeDateCase:"sameDay",date:n}:i===1?{relativeDateCase:"nextDay",date:n}:i<7?{relativeDateCase:"next6Days",date:n}:{relativeDateCase:"other",date:n}}function ln(e,r){let t=Ce(e);return t.setFullYear(t.getFullYear()+r),t}function dn(e){let r=e?.status;return e?.errors?.[0]?.code==="authentication_invalid"&&r===401}function fn(e){return(`${e.message}${e.name}`||"").toLowerCase().replace(/\s+/g,"").includes("networkerror")}function gn(e){return new Promise((r,t)=>{let n=new FileReader;n.addEventListener("load",function(){let o=JSON.parse(n.result);r(o)}),n.addEventListener("error",t),n.readAsText(e)})}var xe=e=>typeof atob<"u"&&typeof atob=="function"?atob(e):typeof global<"u"&&global.Buffer?new global.Buffer(e,"base64").toString():e;var Te="pk_live_",qe="pk_test_",jt=/^(([a-z]+)-){2}([0-9]{1,2})\.clerk\.accounts([a-z.]*)(dev|com)$/i;function bn(e){return`${jt.test(e)?qe:Te}${btoa(`${e}$`)}`}function yn(e){if(e=e||"",!Xt(e))return null;let r=e.startsWith(Te)?"production":"development",t=xe(e.split("_")[2]);return t.endsWith("$")?(t=t.slice(0,-1),{instanceType:r,frontendApi:t}):null}function Xt(e){e=e||"";let r=e.startsWith(Te)||e.startsWith(qe),t=xe(e.split("_")[2]||"").endsWith("$");return r&&t}function Cn(e){return e=e||"",e.startsWith("clerk.")}function xn(){let e=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"],r=new Map;return{isDevOrStagingUrl:t=>{if(!t)return!1;let n=typeof t=="string"?t:t.hostname,o=r.get(n);return o===void 0&&(o=e.some(i=>n.endsWith(i)),r.set(n,o)),o}}}function Rn(){if(!window.matchMedia)return!1;let e=window.matchMedia("only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)");return e&&e.matches||window.devicePixelRatio>1}var Yt="__lsbc__",Ze=class{constructor(r){this.eventTarget=window;this.postMessage=r=>{try{localStorage.setItem(this.channelKey,JSON.stringify(r)),localStorage.removeItem(this.channelKey)}catch{}};this.addEventListener=(r,t)=>{this.eventTarget.addEventListener(this.prefixEventName(r),n=>{t(n)})};this.setupLocalStorageListener=()=>{let r=t=>{if(!(t.key!==this.channelKey||!t.newValue))try{let n=JSON.parse(t.newValue||""),o=new MessageEvent(this.prefixEventName("message"),{data:n});this.eventTarget.dispatchEvent(o)}catch{}};window.addEventListener("storage",r)};this.channelKey=Yt+r,this.setupLocalStorageListener()}prefixEventName(r){return this.channelKey+r}};var Jt=Object.freeze({"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/x-icon":"ico","image/vnd.microsoft.icon":"ico"}),En=e=>Jt[e];function Sn(e,r,t){if(typeof e=="function")return e(r);if(typeof e<"u")return e;if(typeof t<"u")return t}var qt=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;function Ln(e){return qt.test(e||"")}function zn(e){let r=e||"";return r.charAt(0).toUpperCase()+r.slice(1)}function Qe(e){return e?e.replace(/([-_][a-z])/g,r=>r.toUpperCase().replace(/-|_/,"")):""}function et(e){return e?e.replace(/[A-Z]/g,r=>`_${r.toLowerCase()}`):""}var tt=e=>{let r=t=>{if(!t)return t;if(Array.isArray(t))return t.map(i=>typeof i=="object"||Array.isArray(i)?r(i):i);let n={...t},o=Object.keys(n);for(let i of o){let a=e(i.toString());a!==i&&(n[a]=n[i],delete n[i]),typeof n[a]=="object"&&(n[a]=r(n[a]))}return n};return r},Pn=tt(et),An=tt(Qe);var Re=`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}});
`;var rt=(e,r={})=>{if(typeof Worker>"u")return null;try{let t=new Blob([e],{type:"application/javascript; charset=utf-8"}),n=globalThis.URL.createObjectURL(t);return new Worker(n,r)}catch{return console.warn("Clerk: Cannot create worker from blob. Consider adding worker-src blob:; to your CSP"),null}},Qt=()=>{let e=globalThis.setTimeout.bind(globalThis),r=globalThis.setInterval.bind(globalThis),t=globalThis.clearTimeout.bind(globalThis),n=globalThis.clearInterval.bind(globalThis);return{setTimeout:e,setInterval:r,clearTimeout:t,clearInterval:n,cleanup:Z}},we=()=>{let e=0,r=()=>e++,t=new Map,n=(c,m)=>c?.postMessage(m),o=c=>{t.get(c.data.id)?.()},i=rt(Re,{name:"clerk-timers"});if(i?.addEventListener("message",o),!i)return Qt();let a=()=>{i||(i=rt(Re,{name:"clerk-timers"}),i?.addEventListener("message",o))};return{setTimeout:(c,m)=>{a();let C=r();return t.set(C,c),n(i,{type:"setTimeout",id:C,ms:m}),C},setInterval:(c,m)=>{a();let C=r();return t.set(C,c),n(i,{type:"setInterval",id:C,ms:m}),C},clearTimeout:c=>{a(),t.delete(c),n(i,{type:"clearTimeout",id:c})},clearInterval:c=>{a(),t.delete(c),n(i,{type:"clearInterval",id:c})},cleanup:()=>{i&&(i.terminate(),i=null,t.clear())}}};function Kn({delayInMs:e}={delayInMs:1e3}){let r=we(),t,n=!1,o=()=>{t&&(r.clearTimeout(t),r.cleanup()),n=!0},i=async a=>{n=!1,await a(o),!n&&(t=r.setTimeout(()=>{i(a)},e))};return{run:i,stop:o}}function Bn(e){return e?er(e)||nt(e):!0}function er(e){return/^http(s)?:\/\//.test(e||"")}function nt(e){return e.startsWith("/")}function jn(e){return e?nt(e)?new URL(e,window.location.origin).toString():e:""}var Yn=()=>typeof window<"u";function qn(e=""){return e.startsWith("?")&&(e=e.slice(1)),new URLSearchParams(e)}function Zn(e=""){return(e||"").replace(/^.+:\/\//,"")}function Qn(e){if(!e)return"";let r;if(e.match(/^(clerk\.)+\w*$/))r=/(clerk\.)*(?=clerk\.)/;else{if(e.match(/\.clerk.accounts/))return e;r=/^(clerk\.)*/gi}return`clerk.${e.replace(r,"")}`}var ei=e=>e.replace(/CLERK-ROUTER\/(.*?)\//,"");var tr={maxRetries:10,firstDelay:125,maxDelay:0,timeMultiple:2,shouldRetry:()=>!0},rr=async e=>new Promise(r=>setTimeout(r,e)),nr=e=>{let r=0,t=()=>{let n=e.firstDelay,o=e.timeMultiple,i=n*Math.pow(o,r);return Math.min(e.maxDelay||i,i)};return async()=>{await rr(t()),r++}},ri=async(e,r={})=>{let t=0,{maxRetries:n,shouldRetry:o,firstDelay:i,maxDelay:a,timeMultiple:u}={...tr,...r},f=()=>t===n,s=nr({firstDelay:i,maxDelay:a,timeMultiple:u});for(;!f();)try{return await e()}catch(l){if(t++,!o(l,t)||f())throw l;await s()}throw new Error("Something went wrong")};import Oe from"react";function it(e,r){if(!e)throw typeof r=="string"?new Error(r):new Error(`${r.displayName} not found`)}var V=(e,r)=>{let{assertCtxFn:t=it}=r||{},n=Oe.createContext(void 0);return n.displayName=e,[n,()=>{let a=Oe.useContext(n);return t(a,`${e} not found`),a.value},()=>{let a=Oe.useContext(n);return a?a.value:{}}]};import{useEffect as ir,useLayoutEffect as or,createContext as ar,useContext as ut,useState as lt,createElement as sr,useRef as $,useCallback as Se,useDebugValue as ur}from"react";function ct(e,r,t,n){function o(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function u(l){try{s(n.next(l))}catch(p){a(p)}}function f(l){try{s(n.throw(l))}catch(p){a(p)}}function s(l){l.done?i(l.value):o(l.value).then(u,f)}s((n=n.apply(e,r||[])).next())})}function dt(e,r){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(s){return function(l){return f([s,l])}}function f(s){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,o&&(i=s[0]&2?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[s[0]&2,i.value]),s[0]){case 0:case 1:i=s;break;case 4:return t.label++,{value:s[1],done:!1};case 5:t.label++,o=s[1],s=[0];continue;case 7:s=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){t.label=s[1];break}if(s[0]===6&&t.label<i[1]){t.label=i[1],i=s;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(s);break}i[2]&&t.ops.pop(),t.trys.pop();continue}s=r.call(e,t)}catch(l){s=[6,l],o=0}finally{n=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}var I=function(){},h=I(),Q=Object,y=function(e){return e===h},A=function(e){return typeof e=="function"},M=function(e,r){return Q.assign({},e,r)},Pe="undefined",Ae=function(){return typeof window!=Pe},lr=function(){return typeof document!=Pe},cr=function(){return Ae()&&typeof window.requestAnimationFrame!=Pe},ue=new WeakMap,dr=0,re=function(e){var r=typeof e,t=e&&e.constructor,n=t==Date,o,i;if(Q(e)===e&&!n&&t!=RegExp){if(o=ue.get(e),o)return o;if(o=++dr+"~",ue.set(e,o),t==Array){for(o="@",i=0;i<e.length;i++)o+=re(e[i])+",";ue.set(e,o)}if(t==Q){o="#";for(var a=Q.keys(e).sort();!y(i=a.pop());)y(e[i])||(o+=i+":"+re(e[i])+",");ue.set(e,o)}}else o=n?e.toJSON():r=="symbol"?e.toString():r=="string"?JSON.stringify(e):""+e;return o},Ie=!0,fr=function(){return Ie},ft=Ae(),Ue=lr(),Le=ft&&window.addEventListener?window.addEventListener.bind(window):I,pr=Ue?document.addEventListener.bind(document):I,ze=ft&&window.removeEventListener?window.removeEventListener.bind(window):I,gr=Ue?document.removeEventListener.bind(document):I,mr=function(){var e=Ue&&document.visibilityState;return y(e)||e!=="hidden"},vr=function(e){return pr("visibilitychange",e),Le("focus",e),function(){gr("visibilitychange",e),ze("focus",e)}},hr=function(e){var r=function(){Ie=!0,e()},t=function(){Ie=!1};return Le("online",r),Le("offline",t),function(){ze("online",r),ze("offline",t)}},br={isOnline:fr,isVisible:mr},yr={initFocus:vr,initReconnect:hr},le=!Ae()||"Deno"in window,Cr=function(e){return cr()?window.requestAnimationFrame(e):setTimeout(e,1)},ee=le?ir:or,Ee=typeof navigator<"u"&&navigator.connection,ot=!le&&Ee&&(["slow-2g","2g"].includes(Ee.effectiveType)||Ee.saveData),pt=function(e){if(A(e))try{e=e()}catch{e=""}var r=[].concat(e);e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?re(e):"";var t=e?"$swr$"+e:"";return[e,r,t]},H=new WeakMap,gt=0,mt=1,vt=2,te=function(e,r,t,n,o,i,a){a===void 0&&(a=!0);var u=H.get(e),f=u[0],s=u[1],l=u[3],p=f[r],c=s[r];if(a&&c)for(var m=0;m<c.length;++m)c[m](t,n,o);return i&&(delete l[r],p&&p[0])?p[0](vt).then(function(){return e.get(r)}):e.get(r)},xr=0,Me=function(){return++xr},ht=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return ct(void 0,void 0,void 0,function(){var t,n,o,i,a,u,f,s,l,p,c,m,C,x,g,d,B,U,L,E,_;return dt(this,function(D){switch(D.label){case 0:if(t=e[0],n=e[1],o=e[2],i=e[3],a=typeof i=="boolean"?{revalidate:i}:i||{},u=y(a.populateCache)?!0:a.populateCache,f=a.revalidate!==!1,s=a.rollbackOnError!==!1,l=a.optimisticData,p=pt(n),c=p[0],m=p[2],!c)return[2];if(C=H.get(t),x=C[2],e.length<3)return[2,te(t,c,t.get(c),h,h,f,!0)];if(g=o,B=Me(),x[c]=[B,0],U=!y(l),L=t.get(c),U&&(E=A(l)?l(L):l,t.set(c,E),te(t,c,E)),A(g))try{g=g(t.get(c))}catch(F){d=F}return g&&A(g.then)?[4,g.catch(function(F){d=F})]:[3,2];case 1:if(g=D.sent(),B!==x[c][0]){if(d)throw d;return[2,g]}else d&&U&&s&&(u=!0,g=L,t.set(c,L));D.label=2;case 2:return u&&(d||(A(u)&&(g=u(g,L)),t.set(c,g)),t.set(m,M(t.get(m),{error:d}))),x[c][1]=Me(),[4,te(t,c,g,d,h,f,!!u)];case 3:if(_=D.sent(),d)throw d;return[2,u?_:g]}})})},at=function(e,r){for(var t in e)e[t][0]&&e[t][0](r)},bt=function(e,r){if(!H.has(e)){var t=M(yr,r),n={},o=ht.bind(h,e),i=I;if(H.set(e,[n,{},{},{},o]),!le){var a=t.initFocus(setTimeout.bind(h,at.bind(h,n,gt))),u=t.initReconnect(setTimeout.bind(h,at.bind(h,n,mt)));i=function(){a&&a(),u&&u(),H.delete(e)}}return[e,o,i]}return[e,H.get(e)[4]]},Tr=function(e,r,t,n,o){var i=t.errorRetryCount,a=o.retryCount,u=~~((Math.random()+.5)*(1<<(a<8?a:8)))*t.errorRetryInterval;!y(i)&&a>i||setTimeout(n,u,o)},yt=bt(new Map),Ct=yt[0],Rr=yt[1],xt=M({onLoadingSlow:I,onSuccess:I,onError:I,onErrorRetry:Tr,onDiscarded:I,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:ot?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:ot?5e3:3e3,compare:function(e,r){return re(e)==re(r)},isPaused:function(){return!1},cache:Ct,mutate:Rr,fallback:{}},br),Tt=function(e,r){var t=M(e,r);if(r){var n=e.use,o=e.fallback,i=r.use,a=r.fallback;n&&i&&(t.use=n.concat(i)),o&&a&&(t.fallback=M(o,a))}return t},De=ar({}),wr=function(e){var r=e.value,t=Tt(ut(De),r),n=r&&r.provider,o=lt(function(){return n?bt(n(t.cache||Ct),r):h})[0];return o&&(t.cache=o[0],t.mutate=o[1]),ee(function(){return o?o[2]:h},[]),sr(De.Provider,M(e,{value:t}))},Or=function(e,r){var t=lt({})[1],n=$(e),o=$({data:!1,error:!1,isValidating:!1}),i=Se(function(a){var u=!1,f=n.current;for(var s in a){var l=s;f[l]!==a[l]&&(f[l]=a[l],o.current[l]&&(u=!0))}u&&!r.current&&t({})},[]);return ee(function(){n.current=e}),[n,o.current,i]},Er=function(e){return A(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}]},kr=function(){return M(xt,ut(De))},Sr=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=kr(),i=Er(t),a=i[0],u=i[1],f=i[2],s=Tt(o,f),l=e,p=s.use;if(p)for(var c=p.length;c-- >0;)l=p[c](l);return l(a,u||s.fetcher,s)}},st=function(e,r,t){var n=r[e]||(r[e]=[]);return n.push(t),function(){var o=n.indexOf(t);o>=0&&(n[o]=n[n.length-1],n.pop())}},ke={dedupe:!0},Ir=function(e,r,t){var n=t.cache,o=t.compare,i=t.fallbackData,a=t.suspense,u=t.revalidateOnMount,f=t.refreshInterval,s=t.refreshWhenHidden,l=t.refreshWhenOffline,p=H.get(n),c=p[0],m=p[1],C=p[2],x=p[3],g=pt(e),d=g[0],B=g[1],U=g[2],L=$(!1),E=$(!1),_=$(d),D=$(r),F=$(t),v=function(){return F.current},ce=function(){return v().isVisible()&&v().isOnline()},ne=function(w){return n.set(U,M(n.get(U),w))},$e=n.get(d),Ot=y(i)?t.fallback[d]:i,z=y($e)?Ot:$e,He=n.get(U)||{},j=He.error,Ne=!L.current,Ke=function(){return Ne&&!y(u)?u:v().isPaused()?!1:a?y(z)?!1:t.revalidateIfStale:y(z)||t.revalidateIfStale},Et=function(){return!d||!r?!1:He.isValidating?!0:Ne&&Ke()},de=Et(),fe=Or({data:z,error:j,isValidating:de},E),K=fe[0],pe=fe[1],ie=fe[2],W=Se(function(w){return ct(void 0,void 0,void 0,function(){var T,R,O,X,Y,k,b,P,S,ge,J,G,me;return dt(this,function(q){switch(q.label){case 0:if(T=D.current,!d||!T||E.current||v().isPaused())return[2,!1];X=!0,Y=w||{},k=!x[d]||!Y.dedupe,b=function(){return!E.current&&d===_.current&&L.current},P=function(){var Ge=x[d];Ge&&Ge[1]===O&&delete x[d]},S={isValidating:!1},ge=function(){ne({isValidating:!1}),b()&&ie(S)},ne({isValidating:!0}),ie({isValidating:!0}),q.label=1;case 1:return q.trys.push([1,3,,4]),k&&(te(n,d,K.current.data,K.current.error,!0),t.loadingTimeout&&!n.get(d)&&setTimeout(function(){X&&b()&&v().onLoadingSlow(d,t)},t.loadingTimeout),x[d]=[T.apply(void 0,B),Me()]),me=x[d],R=me[0],O=me[1],[4,R];case 2:return R=q.sent(),k&&setTimeout(P,t.dedupingInterval),!x[d]||x[d][1]!==O?(k&&b()&&v().onDiscarded(d),[2,!1]):(ne({error:h}),S.error=h,J=C[d],!y(J)&&(O<=J[0]||O<=J[1]||J[1]===0)?(ge(),k&&b()&&v().onDiscarded(d),[2,!1]):(o(K.current.data,R)?S.data=K.current.data:S.data=R,o(n.get(d),R)||n.set(d,R),k&&b()&&v().onSuccess(R,d,t),[3,4]));case 3:return G=q.sent(),P(),v().isPaused()||(ne({error:G}),S.error=G,k&&b()&&(v().onError(G,d,t),(typeof t.shouldRetryOnError=="boolean"&&t.shouldRetryOnError||A(t.shouldRetryOnError)&&t.shouldRetryOnError(G))&&ce()&&v().onErrorRetry(G,d,t,W,{retryCount:(Y.retryCount||0)+1,dedupe:!0}))),[3,4];case 4:return X=!1,ge(),b()&&k&&te(n,d,S.data,S.error,!1),[2,!0]}})})},[d]),kt=Se(ht.bind(h,n,function(){return _.current}),[]);if(ee(function(){D.current=r,F.current=t}),ee(function(){if(!!d){var w=d!==_.current,T=W.bind(h,ke),R=function(b,P,S){ie(M({error:P,isValidating:S},o(K.current.data,b)?h:{data:b}))},O=0,X=function(b){if(b==gt){var P=Date.now();v().revalidateOnFocus&&P>O&&ce()&&(O=P+v().focusThrottleInterval,T())}else if(b==mt)v().revalidateOnReconnect&&ce()&&T();else if(b==vt)return W()},Y=st(d,m,R),k=st(d,c,X);return E.current=!1,_.current=d,L.current=!0,w&&ie({data:z,error:j,isValidating:de}),Ke()&&(y(z)||le?T():Cr(T)),function(){E.current=!0,Y(),k()}}},[d,W]),ee(function(){var w;function T(){var O=A(f)?f(z):f;O&&w!==-1&&(w=setTimeout(R,O))}function R(){!K.current.error&&(s||v().isVisible())&&(l||v().isOnline())?W(ke).then(T):T()}return T(),function(){w&&(clearTimeout(w),w=-1)}},[f,s,l,W]),ur(z),a&&y(z)&&d)throw D.current=r,F.current=t,E.current=!1,y(j)?W(ke):j;return{mutate:kt,get data(){return pe.data=!0,z},get error(){return pe.error=!0,j},get isValidating(){return pe.isValidating=!0,de}}},si=Q.defineProperty(wr,"default",{value:xt});var _e=Sr(Ir);var[Lr,N]=V("ClerkInstanceContext"),[zr,Fe]=V("UserContext"),[Mr,Dr]=V("ClientContext"),[Pr,We]=V("SessionContext"),[Ar,Ve]=V("OrganizationContext");var Ur=e=>{let{invitationList:r,membershipList:t}=e||{},{organization:n,lastOrganizationMember:o,lastOrganizationInvitation:i}=Ve(),a=We(),u=N(),f=u.loaded&&a&&n,s=u.loaded?()=>u.organization?.getPendingInvitations(r):()=>[],l=u.loaded?()=>u.organization?.getMemberships(t):()=>[],{data:p,isValidating:c,mutate:m}=_e(f&&r?Rt("invites",n,i,r):null,s),{data:C,isValidating:x,mutate:g}=_e(f&&t?Rt("memberships",n,o,t):null,l);return n===void 0?{isLoaded:!1,organization:void 0,invitationList:void 0,membershipList:void 0,membership:void 0}:n===null?{isLoaded:!0,organization:null,invitationList:null,membershipList:null,membership:null}:!u.loaded&&n?{isLoaded:!0,organization:n,invitationList:void 0,membershipList:void 0,membership:void 0}:{isLoaded:!x&&!c,organization:n,membershipList:C,membership:_r(a.user.organizationMemberships,n.id),invitationList:p,unstable__mutate:()=>{g(),m()}}};function _r(e,r){return e.find(t=>t.organization.id===r)}function Rt(e,r,t,n){return[e,r.id,t?.id,t?.updatedAt,n.offset,n.limit].filter(Boolean).join("-")}var Fr=()=>{let e=N(),r=Fe();return!e.loaded||!r?{isLoaded:!1,organizationList:void 0,createOrganization:void 0,setActive:void 0}:{isLoaded:!0,organizationList:Wr(r.organizationMemberships),setActive:e.setActive,createOrganization:e.createOrganization}};function Wr(e){return e.map(r=>({membership:r,organization:r.organization}))}var Vr=()=>{let e=N();return e.loaded?{isLoaded:!0,createOrganization:e.createOrganization,getOrganizationMemberships:e.getOrganizationMemberships,getOrganization:e.getOrganization}:{isLoaded:!1,createOrganization:void 0,getOrganizationMemberships:void 0,getOrganization:void 0}};import wt from"react";var $r=typeof window<"u"?wt.useLayoutEffect:wt.useEffect;export{Lr as ClerkInstanceContext,Mr as ClientContext,Ze as LocalStorageBroadcastChannel,Ar as OrganizationContext,Kn as Poller,Pr as SessionContext,zr as UserContext,Qn as addClerkPrefix,ln as addYears,it as assertContextExists,It as buildErrorThrower,bn as buildPublishableKey,et as camelToSnake,Wt as colorToSameTypeString,V as createContextAndHook,tn as createCookieHandler,on as createDeferredPromise,xn as createDevOrStagingUrlCache,we as createWorkerTimers,sn as dateTo12HourTime,Pn as deepCamelToSnake,An as deepSnakeToCamel,zt as detectUserAgentRobot,Bt as differenceInCalendarDays,En as extension,un as formatRelative,Sn as handleValueOrFn,jr as hasAlpha,Vt as hexStringToRgbaColor,Lt as inBrowser,Yn as inClientSide,je as isHSLColor,er as isHttpOrHttps,Ln as isIPV4Address,Cn as isLegacyFrontendApiKey,fn as isNetworkError,nt as isProxyUrlRelative,Xt as isPublishableKey,Be as isRGBColor,Rn as isRetinaDisplay,be as isTransparent,dn as isUnauthorizedError,Gr as isValidBrowserOnline,oe as isValidHexString,he as isValidHslaString,Bn as isValidProxyUrl,ve as isValidRgbaString,xe as isomorphicAtob,Z as noop,Ce as normalizeDate,yn as parsePublishableKey,qn as parseSearchParams,ei as pathFromFullPath,jn as proxyUrlToAbsoluteURL,gn as readJSONFile,ri as runWithExponentialBackOff,Qe as snakeToCamel,Jr as stringToHslaColor,qr as stringToSameTypeColor,Zn as stripScheme,zn as titleize,Nr as toSentence,N as useClerkInstanceContext,Dr as useClientContext,Ur as useOrganization,Ve as useOrganizationContext,Fr as useOrganizationList,Vr as useOrganizations,$r as useSafeLayoutEffect,We as useSessionContext,Fe as useUserContext};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
import{c as Z}from"./chunk-GW3MP3TA.js";var St=Object.freeze({InvalidFrontendApiErrorMessage:"The frontendApi passed to Clerk is invalid. You can get your Frontend API key at https://dashboard.clerk.com/last-active?path=api-keys. (key={{key}})",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."});function It({packageName:e,customMessages:r}){let t=e,n={...St,...r};function o(i,a){if(!a)return`${t}: ${i}`;let u=i,f=i.matchAll(/{{([a-zA-Z0-9-_]+)}}/g);for(let s of f){let l=(a[s[1]]||"").toString();u=u.replace(`{{${s[1]}}}`,l)}return`${t}: ${u}`}return{setPackageName({packageName:i}){return typeof i=="string"&&(t=i),this},setMessages({customMessages:i}){return Object.assign(n,i||{}),this},throwInvalidPublishableKeyError(i){throw new Error(o(n.InvalidPublishableKeyErrorMessage,i))},throwInvalidFrontendApiError(i){throw new Error(o(n.InvalidFrontendApiErrorMessage,i))},throwInvalidProxyUrl(i){throw new Error(o(n.InvalidProxyUrlErrorMessage,i))},throwMissingPublishableKeyError(){throw new Error(o(n.MissingPublishableKeyErrorMessage))}}}var Nr=e=>{if(e.length==0)return"";if(e.length==1)return e[0];let r=e.slice(0,-1).join(", ");return r+=`, or ${e.slice(-1)}`,r};function Lt(){return typeof window<"u"}function zt(e){return 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/].map(t=>t.source).join("|"),"i").test(e)}function Gr(){let e=window?.navigator;if(!Lt()||!e)return!1;let r=zt(e?.userAgent),t=e?.webdriver,n=e?.onLine,o=e?.connection?.rtt!==0&&e?.connection?.downlink!==0;return!r&&!t&&o&&n}var Mt=/^#?([A-F0-9]{6}|[A-F0-9]{3})$/i,Dt=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/i,Pt=/^rgba\((\d+),\s*(\d+),\s*(\d+)(,\s*\d+(\.\d+)?)\)$/i,At=/^hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)$/i,Ut=/^hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%(,\s*\d+(\.\d+)?)*\)$/i,oe=e=>!!e.match(Mt),ve=e=>!!(e.match(Dt)||e.match(Pt)),he=e=>!!e.match(At)||!!e.match(Ut),Be=e=>typeof e!="string"&&"r"in e,je=e=>typeof e!="string"&&"h"in e,be=e=>e==="transparent",jr=e=>typeof e!="string"&&e.a!=null&&e.a<1;var _t=/[hsla()]/g,Ft=/[rgba()]/g,Jr=e=>e==="transparent"?{h:0,s:0,l:0,a:0}:oe(e)?Nt(e):he(e)?Je(e):ve(e)?Xe(e):null,qr=e=>(e=e.trim(),oe(e)?e.startsWith("#")?e:`#${e}`:ve(e)?Ye(e):he(e)?Je(e):be(e)?e:""),Wt=e=>typeof e=="string"&&(oe(e)||be(e))?e:Be(e)?$t(e):je(e)?Ht(e):"",Vt=e=>{e=e.replace("#","");let r=parseInt(e.substring(0,2),16),t=parseInt(e.substring(2,4),16),n=parseInt(e.substring(4,6),16);return{r,g:t,b:n}},$t=e=>{let{a:r,b:t,g:n,r:o}=e;return e.a===0?"transparent":e.a!=null?`rgba(${o},${n},${t},${r})`:`rgb(${o},${n},${t})`},Ht=e=>{let{h:r,s:t,l:n,a:o}=e,i=Math.round(t*100),a=Math.round(n*100);return e.a===0?"transparent":e.a!=null?`hsla(${r},${i}%,${a}%,${o})`:`hsl(${r},${i}%,${a}%)`},Nt=e=>{let r=Wt(Vt(e));return Xe(r)},Xe=e=>{let r=Ye(e),t=r.r/255,n=r.g/255,o=r.b/255,i=Math.max(t,n,o),a=Math.min(t,n,o),u,f,s=(i+a)/2;if(i==a)u=f=0;else{let c=i-a;switch(f=s>=.5?c/(2-(i+a)):c/(i+a),i){case t:u=(n-o)/c*60;break;case n:u=((o-t)/c+2)*60;break;default:u=((t-n)/c+4)*60;break}}let l={h:Math.round(u),s:f,l:s},p=r.a;return p!=null&&(l.a=p),l},Ye=e=>{let[r,t,n,o]=e.replace(Ft,"").split(",").map(i=>Number.parseFloat(i));return{r,g:t,b:n,a:o}},Je=e=>{let[r,t,n,o]=e.replace(_t,"").split(",").map(i=>Number.parseFloat(i));return{h:r,s:t/100,l:n/100,a:o}};function ae(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)e[n]=t[n]}return e}var Kt={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function ye(e,r){function t(o,i,a){if(!(typeof document>"u")){a=ae({},r,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var u="";for(var f in a)a[f]&&(u+="; "+f,a[f]!==!0&&(u+="="+a[f].split(";")[0]));return document.cookie=o+"="+e.write(i,o)+u}}function n(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var i=document.cookie?document.cookie.split("; "):[],a={},u=0;u<i.length;u++){var f=i[u].split("="),s=f.slice(1).join("=");try{var l=decodeURIComponent(f[0]);if(a[l]=e.read(s,l),o===l)break}catch{}}return o?a[o]:a}}return Object.create({set:t,get:n,remove:function(o,i){t(o,"",ae({},i,{expires:-1}))},withAttributes:function(o){return ye(this.converter,ae({},this.attributes,o))},withConverter:function(o){return ye(ae({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(e)}})}var Gt=ye(Kt,{path:"/"}),se=Gt;function tn(e){return{get(){return se.get(e)},set(r,t={}){return se.set(e,r,t)},remove(r){se.remove(e,r)}}}var on=()=>{let e=Z,r=Z;return{promise:new Promise((n,o)=>{e=n,r=o}),resolve:e,reject:r}};function sn(e){return e?e.toLocaleString("en-US",{hour:"2-digit",minute:"numeric",hour12:!0}):""}function Bt(e,r,{absolute:t=!0}={}){if(!e||!r)return 0;let n=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),o=Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()),i=Math.floor((o-n)/864e5);return t?Math.abs(i):i}function Ce(e){try{return new Date(e||new Date)}catch{return new Date}}function un(e){let{date:r,relativeTo:t}=e;if(!r||!t)return null;let n=Ce(r),o=Ce(t),i=Bt(o,n,{absolute:!1});return i<-6?{relativeDateCase:"other",date:n}:i<-1?{relativeDateCase:"previous6Days",date:n}:i===-1?{relativeDateCase:"lastDay",date:n}:i===0?{relativeDateCase:"sameDay",date:n}:i===1?{relativeDateCase:"nextDay",date:n}:i<7?{relativeDateCase:"next6Days",date:n}:{relativeDateCase:"other",date:n}}function ln(e,r){let t=Ce(e);return t.setFullYear(t.getFullYear()+r),t}function dn(e){let r=e?.status;return e?.errors?.[0]?.code==="authentication_invalid"&&r===401}function fn(e){return(`${e.message}${e.name}`||"").toLowerCase().replace(/\s+/g,"").includes("networkerror")}function gn(e){return new Promise((r,t)=>{let n=new FileReader;n.addEventListener("load",function(){let o=JSON.parse(n.result);r(o)}),n.addEventListener("error",t),n.readAsText(e)})}var xe=e=>typeof atob<"u"&&typeof atob=="function"?atob(e):typeof global<"u"&&global.Buffer?new global.Buffer(e,"base64").toString():e;var Te="pk_live_",qe="pk_test_",jt=/^(([a-z]+)-){2}([0-9]{1,2})\.clerk\.accounts([a-z.]*)(dev|com)$/i;function bn(e){return`${jt.test(e)?qe:Te}${btoa(`${e}$`)}`}function yn(e){if(e=e||"",!Xt(e))return null;let r=e.startsWith(Te)?"production":"development",t=xe(e.split("_")[2]);return t.endsWith("$")?(t=t.slice(0,-1),{instanceType:r,frontendApi:t}):null}function Xt(e){e=e||"";let r=e.startsWith(Te)||e.startsWith(qe),t=xe(e.split("_")[2]||"").endsWith("$");return r&&t}function Cn(e){return e=e||"",e.startsWith("clerk.")}function xn(){let e=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"],r=new Map;return{isDevOrStagingUrl:t=>{if(!t)return!1;let n=typeof t=="string"?t:t.hostname,o=r.get(n);return o===void 0&&(o=e.some(i=>n.endsWith(i)),r.set(n,o)),o}}}function Rn(){if(!window.matchMedia)return!1;let e=window.matchMedia("only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)");return e&&e.matches||window.devicePixelRatio>1}var Yt="__lsbc__",Ze=class{constructor(r){this.eventTarget=window;this.postMessage=r=>{try{localStorage.setItem(this.channelKey,JSON.stringify(r)),localStorage.removeItem(this.channelKey)}catch{}};this.addEventListener=(r,t)=>{this.eventTarget.addEventListener(this.prefixEventName(r),n=>{t(n)})};this.setupLocalStorageListener=()=>{let r=t=>{if(!(t.key!==this.channelKey||!t.newValue))try{let n=JSON.parse(t.newValue||""),o=new MessageEvent(this.prefixEventName("message"),{data:n});this.eventTarget.dispatchEvent(o)}catch{}};window.addEventListener("storage",r)};this.channelKey=Yt+r,this.setupLocalStorageListener()}prefixEventName(r){return this.channelKey+r}};var Jt=Object.freeze({"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/x-icon":"ico","image/vnd.microsoft.icon":"ico"}),En=e=>Jt[e];function Sn(e,r,t){if(typeof e=="function")return e(r);if(typeof e<"u")return e;if(typeof t<"u")return t}var qt=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;function Ln(e){return qt.test(e||"")}function zn(e){let r=e||"";return r.charAt(0).toUpperCase()+r.slice(1)}function Qe(e){return e?e.replace(/([-_][a-z])/g,r=>r.toUpperCase().replace(/-|_/,"")):""}function et(e){return e?e.replace(/[A-Z]/g,r=>`_${r.toLowerCase()}`):""}var tt=e=>{let r=t=>{if(!t)return t;if(Array.isArray(t))return t.map(i=>typeof i=="object"||Array.isArray(i)?r(i):i);let n={...t},o=Object.keys(n);for(let i of o){let a=e(i.toString());a!==i&&(n[a]=n[i],delete n[i]),typeof n[a]=="object"&&(n[a]=r(n[a]))}return n};return r},Pn=tt(et),An=tt(Qe);var Re=`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}});
`;var rt=(e,r={})=>{if(typeof Worker>"u")return null;try{let t=new Blob([e],{type:"application/javascript; charset=utf-8"}),n=globalThis.URL.createObjectURL(t);return new Worker(n,r)}catch{return console.warn("Clerk: Cannot create worker from blob. Consider adding worker-src blob:; to your CSP"),null}},Qt=()=>{let e=globalThis.setTimeout.bind(globalThis),r=globalThis.setInterval.bind(globalThis),t=globalThis.clearTimeout.bind(globalThis),n=globalThis.clearInterval.bind(globalThis);return{setTimeout:e,setInterval:r,clearTimeout:t,clearInterval:n,cleanup:Z}},we=()=>{let e=0,r=()=>e++,t=new Map,n=(c,m)=>c?.postMessage(m),o=c=>{t.get(c.data.id)?.()},i=rt(Re,{name:"clerk-timers"});if(i?.addEventListener("message",o),!i)return Qt();let a=()=>{i||(i=rt(Re,{name:"clerk-timers"}),i?.addEventListener("message",o))};return{setTimeout:(c,m)=>{a();let C=r();return t.set(C,c),n(i,{type:"setTimeout",id:C,ms:m}),C},setInterval:(c,m)=>{a();let C=r();return t.set(C,c),n(i,{type:"setInterval",id:C,ms:m}),C},clearTimeout:c=>{a(),t.delete(c),n(i,{type:"clearTimeout",id:c})},clearInterval:c=>{a(),t.delete(c),n(i,{type:"clearInterval",id:c})},cleanup:()=>{i&&(i.terminate(),i=null,t.clear())}}};function Kn({delayInMs:e}={delayInMs:1e3}){let r=we(),t,n=!1,o=()=>{t&&(r.clearTimeout(t),r.cleanup()),n=!0},i=async a=>{n=!1,await a(o),!n&&(t=r.setTimeout(()=>{i(a)},e))};return{run:i,stop:o}}function Bn(e){return e?er(e)||nt(e):!0}function er(e){return/^http(s)?:\/\//.test(e||"")}function nt(e){return e.startsWith("/")}function jn(e){return e?nt(e)?new URL(e,window.location.origin).toString():e:""}var Yn=()=>typeof window<"u";function qn(e=""){return e.startsWith("?")&&(e=e.slice(1)),new URLSearchParams(e)}function Zn(e=""){return(e||"").replace(/^.+:\/\//,"")}function Qn(e){if(!e)return"";let r;if(e.match(/^(clerk\.)+\w*$/))r=/(clerk\.)*(?=clerk\.)/;else{if(e.match(/\.clerk.accounts/))return e;r=/^(clerk\.)*/gi}return`clerk.${e.replace(r,"")}`}var ei=e=>e.replace(/CLERK-ROUTER\/(.*?)\//,"");var tr={maxRetries:10,firstDelay:125,maxDelay:0,timeMultiple:2,shouldRetry:()=>!0},rr=async e=>new Promise(r=>setTimeout(r,e)),nr=e=>{let r=0,t=()=>{let n=e.firstDelay,o=e.timeMultiple,i=n*Math.pow(o,r);return Math.min(e.maxDelay||i,i)};return async()=>{await rr(t()),r++}},ri=async(e,r={})=>{let t=0,{maxRetries:n,shouldRetry:o,firstDelay:i,maxDelay:a,timeMultiple:u}={...tr,...r},f=()=>t===n,s=nr({firstDelay:i,maxDelay:a,timeMultiple:u});for(;!f();)try{return await e()}catch(l){if(t++,!o(l,t)||f())throw l;await s()}throw new Error("Something went wrong")};import Oe from"react";function it(e,r){if(!e)throw typeof r=="string"?new Error(r):new Error(`${r.displayName} not found`)}var V=(e,r)=>{let{assertCtxFn:t=it}=r||{},n=Oe.createContext(void 0);return n.displayName=e,[n,()=>{let a=Oe.useContext(n);return t(a,`${e} not found`),a.value},()=>{let a=Oe.useContext(n);return a?a.value:{}}]};import{useEffect as ir,useLayoutEffect as or,createContext as ar,useContext as ut,useState as lt,createElement as sr,useRef as $,useCallback as Se,useDebugValue as ur}from"react";function ct(e,r,t,n){function o(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function u(l){try{s(n.next(l))}catch(p){a(p)}}function f(l){try{s(n.throw(l))}catch(p){a(p)}}function s(l){l.done?i(l.value):o(l.value).then(u,f)}s((n=n.apply(e,r||[])).next())})}function dt(e,r){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(s){return function(l){return f([s,l])}}function f(s){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,o&&(i=s[0]&2?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[s[0]&2,i.value]),s[0]){case 0:case 1:i=s;break;case 4:return t.label++,{value:s[1],done:!1};case 5:t.label++,o=s[1],s=[0];continue;case 7:s=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){t.label=s[1];break}if(s[0]===6&&t.label<i[1]){t.label=i[1],i=s;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(s);break}i[2]&&t.ops.pop(),t.trys.pop();continue}s=r.call(e,t)}catch(l){s=[6,l],o=0}finally{n=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}var I=function(){},h=I(),Q=Object,y=function(e){return e===h},A=function(e){return typeof e=="function"},M=function(e,r){return Q.assign({},e,r)},Pe="undefined",Ae=function(){return typeof window!=Pe},lr=function(){return typeof document!=Pe},cr=function(){return Ae()&&typeof window.requestAnimationFrame!=Pe},ue=new WeakMap,dr=0,re=function(e){var r=typeof e,t=e&&e.constructor,n=t==Date,o,i;if(Q(e)===e&&!n&&t!=RegExp){if(o=ue.get(e),o)return o;if(o=++dr+"~",ue.set(e,o),t==Array){for(o="@",i=0;i<e.length;i++)o+=re(e[i])+",";ue.set(e,o)}if(t==Q){o="#";for(var a=Q.keys(e).sort();!y(i=a.pop());)y(e[i])||(o+=i+":"+re(e[i])+",");ue.set(e,o)}}else o=n?e.toJSON():r=="symbol"?e.toString():r=="string"?JSON.stringify(e):""+e;return o},Ie=!0,fr=function(){return Ie},ft=Ae(),Ue=lr(),Le=ft&&window.addEventListener?window.addEventListener.bind(window):I,pr=Ue?document.addEventListener.bind(document):I,ze=ft&&window.removeEventListener?window.removeEventListener.bind(window):I,gr=Ue?document.removeEventListener.bind(document):I,mr=function(){var e=Ue&&document.visibilityState;return y(e)||e!=="hidden"},vr=function(e){return pr("visibilitychange",e),Le("focus",e),function(){gr("visibilitychange",e),ze("focus",e)}},hr=function(e){var r=function(){Ie=!0,e()},t=function(){Ie=!1};return Le("online",r),Le("offline",t),function(){ze("online",r),ze("offline",t)}},br={isOnline:fr,isVisible:mr},yr={initFocus:vr,initReconnect:hr},le=!Ae()||"Deno"in window,Cr=function(e){return cr()?window.requestAnimationFrame(e):setTimeout(e,1)},ee=le?ir:or,Ee=typeof navigator<"u"&&navigator.connection,ot=!le&&Ee&&(["slow-2g","2g"].includes(Ee.effectiveType)||Ee.saveData),pt=function(e){if(A(e))try{e=e()}catch{e=""}var r=[].concat(e);e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?re(e):"";var t=e?"$swr$"+e:"";return[e,r,t]},H=new WeakMap,gt=0,mt=1,vt=2,te=function(e,r,t,n,o,i,a){a===void 0&&(a=!0);var u=H.get(e),f=u[0],s=u[1],l=u[3],p=f[r],c=s[r];if(a&&c)for(var m=0;m<c.length;++m)c[m](t,n,o);return i&&(delete l[r],p&&p[0])?p[0](vt).then(function(){return e.get(r)}):e.get(r)},xr=0,Me=function(){return++xr},ht=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return ct(void 0,void 0,void 0,function(){var t,n,o,i,a,u,f,s,l,p,c,m,C,x,g,d,B,U,L,E,_;return dt(this,function(D){switch(D.label){case 0:if(t=e[0],n=e[1],o=e[2],i=e[3],a=typeof i=="boolean"?{revalidate:i}:i||{},u=y(a.populateCache)?!0:a.populateCache,f=a.revalidate!==!1,s=a.rollbackOnError!==!1,l=a.optimisticData,p=pt(n),c=p[0],m=p[2],!c)return[2];if(C=H.get(t),x=C[2],e.length<3)return[2,te(t,c,t.get(c),h,h,f,!0)];if(g=o,B=Me(),x[c]=[B,0],U=!y(l),L=t.get(c),U&&(E=A(l)?l(L):l,t.set(c,E),te(t,c,E)),A(g))try{g=g(t.get(c))}catch(F){d=F}return g&&A(g.then)?[4,g.catch(function(F){d=F})]:[3,2];case 1:if(g=D.sent(),B!==x[c][0]){if(d)throw d;return[2,g]}else d&&U&&s&&(u=!0,g=L,t.set(c,L));D.label=2;case 2:return u&&(d||(A(u)&&(g=u(g,L)),t.set(c,g)),t.set(m,M(t.get(m),{error:d}))),x[c][1]=Me(),[4,te(t,c,g,d,h,f,!!u)];case 3:if(_=D.sent(),d)throw d;return[2,u?_:g]}})})},at=function(e,r){for(var t in e)e[t][0]&&e[t][0](r)},bt=function(e,r){if(!H.has(e)){var t=M(yr,r),n={},o=ht.bind(h,e),i=I;if(H.set(e,[n,{},{},{},o]),!le){var a=t.initFocus(setTimeout.bind(h,at.bind(h,n,gt))),u=t.initReconnect(setTimeout.bind(h,at.bind(h,n,mt)));i=function(){a&&a(),u&&u(),H.delete(e)}}return[e,o,i]}return[e,H.get(e)[4]]},Tr=function(e,r,t,n,o){var i=t.errorRetryCount,a=o.retryCount,u=~~((Math.random()+.5)*(1<<(a<8?a:8)))*t.errorRetryInterval;!y(i)&&a>i||setTimeout(n,u,o)},yt=bt(new Map),Ct=yt[0],Rr=yt[1],xt=M({onLoadingSlow:I,onSuccess:I,onError:I,onErrorRetry:Tr,onDiscarded:I,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:ot?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:ot?5e3:3e3,compare:function(e,r){return re(e)==re(r)},isPaused:function(){return!1},cache:Ct,mutate:Rr,fallback:{}},br),Tt=function(e,r){var t=M(e,r);if(r){var n=e.use,o=e.fallback,i=r.use,a=r.fallback;n&&i&&(t.use=n.concat(i)),o&&a&&(t.fallback=M(o,a))}return t},De=ar({}),wr=function(e){var r=e.value,t=Tt(ut(De),r),n=r&&r.provider,o=lt(function(){return n?bt(n(t.cache||Ct),r):h})[0];return o&&(t.cache=o[0],t.mutate=o[1]),ee(function(){return o?o[2]:h},[]),sr(De.Provider,M(e,{value:t}))},Or=function(e,r){var t=lt({})[1],n=$(e),o=$({data:!1,error:!1,isValidating:!1}),i=Se(function(a){var u=!1,f=n.current;for(var s in a){var l=s;f[l]!==a[l]&&(f[l]=a[l],o.current[l]&&(u=!0))}u&&!r.current&&t({})},[]);return ee(function(){n.current=e}),[n,o.current,i]},Er=function(e){return A(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}]},kr=function(){return M(xt,ut(De))},Sr=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=kr(),i=Er(t),a=i[0],u=i[1],f=i[2],s=Tt(o,f),l=e,p=s.use;if(p)for(var c=p.length;c-- >0;)l=p[c](l);return l(a,u||s.fetcher,s)}},st=function(e,r,t){var n=r[e]||(r[e]=[]);return n.push(t),function(){var o=n.indexOf(t);o>=0&&(n[o]=n[n.length-1],n.pop())}},ke={dedupe:!0},Ir=function(e,r,t){var n=t.cache,o=t.compare,i=t.fallbackData,a=t.suspense,u=t.revalidateOnMount,f=t.refreshInterval,s=t.refreshWhenHidden,l=t.refreshWhenOffline,p=H.get(n),c=p[0],m=p[1],C=p[2],x=p[3],g=pt(e),d=g[0],B=g[1],U=g[2],L=$(!1),E=$(!1),_=$(d),D=$(r),F=$(t),v=function(){return F.current},ce=function(){return v().isVisible()&&v().isOnline()},ne=function(w){return n.set(U,M(n.get(U),w))},$e=n.get(d),Ot=y(i)?t.fallback[d]:i,z=y($e)?Ot:$e,He=n.get(U)||{},j=He.error,Ne=!L.current,Ke=function(){return Ne&&!y(u)?u:v().isPaused()?!1:a?y(z)?!1:t.revalidateIfStale:y(z)||t.revalidateIfStale},Et=function(){return!d||!r?!1:He.isValidating?!0:Ne&&Ke()},de=Et(),fe=Or({data:z,error:j,isValidating:de},E),K=fe[0],pe=fe[1],ie=fe[2],W=Se(function(w){return ct(void 0,void 0,void 0,function(){var T,R,O,X,Y,k,b,P,S,ge,J,G,me;return dt(this,function(q){switch(q.label){case 0:if(T=D.current,!d||!T||E.current||v().isPaused())return[2,!1];X=!0,Y=w||{},k=!x[d]||!Y.dedupe,b=function(){return!E.current&&d===_.current&&L.current},P=function(){var Ge=x[d];Ge&&Ge[1]===O&&delete x[d]},S={isValidating:!1},ge=function(){ne({isValidating:!1}),b()&&ie(S)},ne({isValidating:!0}),ie({isValidating:!0}),q.label=1;case 1:return q.trys.push([1,3,,4]),k&&(te(n,d,K.current.data,K.current.error,!0),t.loadingTimeout&&!n.get(d)&&setTimeout(function(){X&&b()&&v().onLoadingSlow(d,t)},t.loadingTimeout),x[d]=[T.apply(void 0,B),Me()]),me=x[d],R=me[0],O=me[1],[4,R];case 2:return R=q.sent(),k&&setTimeout(P,t.dedupingInterval),!x[d]||x[d][1]!==O?(k&&b()&&v().onDiscarded(d),[2,!1]):(ne({error:h}),S.error=h,J=C[d],!y(J)&&(O<=J[0]||O<=J[1]||J[1]===0)?(ge(),k&&b()&&v().onDiscarded(d),[2,!1]):(o(K.current.data,R)?S.data=K.current.data:S.data=R,o(n.get(d),R)||n.set(d,R),k&&b()&&v().onSuccess(R,d,t),[3,4]));case 3:return G=q.sent(),P(),v().isPaused()||(ne({error:G}),S.error=G,k&&b()&&(v().onError(G,d,t),(typeof t.shouldRetryOnError=="boolean"&&t.shouldRetryOnError||A(t.shouldRetryOnError)&&t.shouldRetryOnError(G))&&ce()&&v().onErrorRetry(G,d,t,W,{retryCount:(Y.retryCount||0)+1,dedupe:!0}))),[3,4];case 4:return X=!1,ge(),b()&&k&&te(n,d,S.data,S.error,!1),[2,!0]}})})},[d]),kt=Se(ht.bind(h,n,function(){return _.current}),[]);if(ee(function(){D.current=r,F.current=t}),ee(function(){if(d){var w=d!==_.current,T=W.bind(h,ke),R=function(b,P,S){ie(M({error:P,isValidating:S},o(K.current.data,b)?h:{data:b}))},O=0,X=function(b){if(b==gt){var P=Date.now();v().revalidateOnFocus&&P>O&&ce()&&(O=P+v().focusThrottleInterval,T())}else if(b==mt)v().revalidateOnReconnect&&ce()&&T();else if(b==vt)return W()},Y=st(d,m,R),k=st(d,c,X);return E.current=!1,_.current=d,L.current=!0,w&&ie({data:z,error:j,isValidating:de}),Ke()&&(y(z)||le?T():Cr(T)),function(){E.current=!0,Y(),k()}}},[d,W]),ee(function(){var w;function T(){var O=A(f)?f(z):f;O&&w!==-1&&(w=setTimeout(R,O))}function R(){!K.current.error&&(s||v().isVisible())&&(l||v().isOnline())?W(ke).then(T):T()}return T(),function(){w&&(clearTimeout(w),w=-1)}},[f,s,l,W]),ur(z),a&&y(z)&&d)throw D.current=r,F.current=t,E.current=!1,y(j)?W(ke):j;return{mutate:kt,get data(){return pe.data=!0,z},get error(){return pe.error=!0,j},get isValidating(){return pe.isValidating=!0,de}}},si=Q.defineProperty(wr,"default",{value:xt});var _e=Sr(Ir);var[Lr,N]=V("ClerkInstanceContext"),[zr,Fe]=V("UserContext"),[Mr,Dr]=V("ClientContext"),[Pr,We]=V("SessionContext"),[Ar,Ve]=V("OrganizationContext");var Ur=e=>{let{invitationList:r,membershipList:t}=e||{},{organization:n,lastOrganizationMember:o,lastOrganizationInvitation:i}=Ve(),a=We(),u=N(),f=u.loaded&&a&&n,s=u.loaded?()=>u.organization?.getPendingInvitations(r):()=>[],l=u.loaded?()=>u.organization?.getMemberships(t):()=>[],{data:p,isValidating:c,mutate:m}=_e(f&&r?Rt("invites",n,i,r):null,s),{data:C,isValidating:x,mutate:g}=_e(f&&t?Rt("memberships",n,o,t):null,l);return n===void 0?{isLoaded:!1,organization:void 0,invitationList:void 0,membershipList:void 0,membership:void 0}:n===null?{isLoaded:!0,organization:null,invitationList:null,membershipList:null,membership:null}:!u.loaded&&n?{isLoaded:!0,organization:n,invitationList:void 0,membershipList:void 0,membership:void 0}:{isLoaded:!x&&!c,organization:n,membershipList:C,membership:_r(a.user.organizationMemberships,n.id),invitationList:p,unstable__mutate:()=>{g(),m()}}};function _r(e,r){return e.find(t=>t.organization.id===r)}function Rt(e,r,t,n){return[e,r.id,t?.id,t?.updatedAt,n.offset,n.limit].filter(Boolean).join("-")}var Fr=()=>{let e=N(),r=Fe();return!e.loaded||!r?{isLoaded:!1,organizationList:void 0,createOrganization:void 0,setActive:void 0}:{isLoaded:!0,organizationList:Wr(r.organizationMemberships),setActive:e.setActive,createOrganization:e.createOrganization}};function Wr(e){return e.map(r=>({membership:r,organization:r.organization}))}var Vr=()=>{let e=N();return e.loaded?{isLoaded:!0,createOrganization:e.createOrganization,getOrganizationMemberships:e.getOrganizationMemberships,getOrganization:e.getOrganization}:{isLoaded:!1,createOrganization:void 0,getOrganizationMemberships:void 0,getOrganization:void 0}};import wt from"react";var $r=typeof window<"u"?wt.useLayoutEffect:wt.useEffect;export{Lr as ClerkInstanceContext,Mr as ClientContext,Ze as LocalStorageBroadcastChannel,Ar as OrganizationContext,Kn as Poller,Pr as SessionContext,zr as UserContext,Qn as addClerkPrefix,ln as addYears,it as assertContextExists,It as buildErrorThrower,bn as buildPublishableKey,et as camelToSnake,Wt as colorToSameTypeString,V as createContextAndHook,tn as createCookieHandler,on as createDeferredPromise,xn as createDevOrStagingUrlCache,we as createWorkerTimers,sn as dateTo12HourTime,Pn as deepCamelToSnake,An as deepSnakeToCamel,zt as detectUserAgentRobot,Bt as differenceInCalendarDays,En as extension,un as formatRelative,Sn as handleValueOrFn,jr as hasAlpha,Vt as hexStringToRgbaColor,Lt as inBrowser,Yn as inClientSide,je as isHSLColor,er as isHttpOrHttps,Ln as isIPV4Address,Cn as isLegacyFrontendApiKey,fn as isNetworkError,nt as isProxyUrlRelative,Xt as isPublishableKey,Be as isRGBColor,Rn as isRetinaDisplay,be as isTransparent,dn as isUnauthorizedError,Gr as isValidBrowserOnline,oe as isValidHexString,he as isValidHslaString,Bn as isValidProxyUrl,ve as isValidRgbaString,xe as isomorphicAtob,Z as noop,Ce as normalizeDate,yn as parsePublishableKey,qn as parseSearchParams,ei as pathFromFullPath,jn as proxyUrlToAbsoluteURL,gn as readJSONFile,ri as runWithExponentialBackOff,Qe as snakeToCamel,Jr as stringToHslaColor,qr as stringToSameTypeColor,Zn as stripScheme,zn as titleize,Nr as toSentence,N as useClerkInstanceContext,Dr as useClientContext,Ur as useOrganization,Ve as useOrganizationContext,Fr as useOrganizationList,Vr as useOrganizations,$r as useSafeLayoutEffect,We as useSessionContext,Fe as useUserContext};
/*! Bundled license information:
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
js-cookie/dist/js.cookie.mjs:
(*! js-cookie v3.0.1 | MIT *)
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/*! js-cookie v3.0.1 | MIT */
swr/dist/index.mjs:
(*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** *)
*/
//# sourceMappingURL=index.js.map

@@ -1,18 +0,24 @@

"use strict";var Bt=Object.create;var ae=Object.defineProperty;var jt=Object.getOwnPropertyDescriptor;var Xt=Object.getOwnPropertyNames;var Yt=Object.getPrototypeOf,Jt=Object.prototype.hasOwnProperty;var qt=(e,r)=>{for(var t in r)ae(e,t,{get:r[t],enumerable:!0})},et=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Xt(r))!Jt.call(e,o)&&o!==t&&ae(e,o,{get:()=>r[o],enumerable:!(n=jt(r,o))||n.enumerable});return e};var tt=(e,r,t)=>(t=e!=null?Bt(Yt(e)):{},et(r||!e||!e.__esModule?ae(t,"default",{value:e,enumerable:!0}):t,e)),Zt=e=>et(ae({},"__esModule",{value:!0}),e);var wn={};qt(wn,{ClerkInstanceContext:()=>Mt,ClientContext:()=>Pt,LocalStorageBroadcastChannel:()=>ze,OrganizationContext:()=>_t,Poller:()=>Hr,SessionContext:()=>Ut,UserContext:()=>Dt,addClerkPrefix:()=>Xr,addYears:()=>xr,assertContextExists:()=>Ue,buildErrorThrower:()=>rt,buildPublishableKey:()=>Er,camelToSnake:()=>De,colorToSameTypeString:()=>ot,createContextAndHook:()=>U,createCookieHandler:()=>hr,createDeferredPromise:()=>br,createDevOrStagingUrlCache:()=>Ir,createWorkerTimers:()=>ge,dateTo12HourTime:()=>yr,deepCamelToSnake:()=>Fr,deepSnakeToCamel:()=>Wr,detectUserAgentRobot:()=>it,differenceInCalendarDays:()=>ct,extension:()=>Dr,formatRelative:()=>Cr,handleValueOrFn:()=>Pr,hasAlpha:()=>sr,hexStringToRgbaColor:()=>at,inBrowser:()=>nt,inClientSide:()=>Gr,isHSLColor:()=>Se,isHttpOrHttps:()=>mt,isIPV4Address:()=>Ur,isLegacyFrontendApiKey:()=>Sr,isNetworkError:()=>Rr,isProxyUrlRelative:()=>Ae,isPublishableKey:()=>ft,isRGBColor:()=>ke,isRetinaDisplay:()=>Lr,isTransparent:()=>le,isUnauthorizedError:()=>Tr,isValidBrowserOnline:()=>tr,isValidHexString:()=>Q,isValidHslaString:()=>ue,isValidProxyUrl:()=>Nr,isValidRgbaString:()=>se,isomorphicAtob:()=>pe,noop:()=>B,normalizeDate:()=>fe,parsePublishableKey:()=>kr,parseSearchParams:()=>Br,pathFromFullPath:()=>Yr,proxyUrlToAbsoluteURL:()=>Kr,readJSONFile:()=>wr,runWithExponentialBackOff:()=>Qr,snakeToCamel:()=>Me,stringToHslaColor:()=>cr,stringToSameTypeColor:()=>dr,stripScheme:()=>jr,titleize:()=>_r,toSentence:()=>er,useClerkInstanceContext:()=>F,useClientContext:()=>At,useOrganization:()=>Wt,useOrganizationContext:()=>Ce,useOrganizationList:()=>Vt,useOrganizations:()=>$t,useSafeLayoutEffect:()=>Ht,useSessionContext:()=>ye,useUserContext:()=>be});module.exports=Zt(wn);var Qt=Object.freeze({InvalidFrontendApiErrorMessage:"The frontendApi passed to Clerk is invalid. You can get your Frontend API key at https://dashboard.clerk.com/last-active?path=api-keys. (key={{key}})",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."});function rt({packageName:e,customMessages:r}){let t=e,n={...Qt,...r};function o(i,a){if(!a)return`${t}: ${i}`;let u=i,f=i.matchAll(/{{([a-zA-Z0-9-_]+)}}/g);for(let s of f){let l=(a[s[1]]||"").toString();u=u.replace(`{{${s[1]}}}`,l)}return`${t}: ${u}`}return{setPackageName({packageName:i}){return typeof i=="string"&&(t=i),this},setMessages({customMessages:i}){return Object.assign(n,i||{}),this},throwInvalidPublishableKeyError(i){throw new Error(o(n.InvalidPublishableKeyErrorMessage,i))},throwInvalidFrontendApiError(i){throw new Error(o(n.InvalidFrontendApiErrorMessage,i))},throwInvalidProxyUrl(i){throw new Error(o(n.InvalidProxyUrlErrorMessage,i))},throwMissingPublishableKeyError(){throw new Error(o(n.MissingPublishableKeyErrorMessage))}}}var er=e=>{if(e.length==0)return"";if(e.length==1)return e[0];let r=e.slice(0,-1).join(", ");return r+=`, or ${e.slice(-1)}`,r};function nt(){return typeof window<"u"}function it(e){return 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/].map(t=>t.source).join("|"),"i").test(e)}function tr(){let e=window?.navigator;if(!nt()||!e)return!1;let r=it(e?.userAgent),t=e?.webdriver,n=e?.onLine,o=e?.connection?.rtt!==0&&e?.connection?.downlink!==0;return!r&&!t&&o&&n}var rr=/^#?([A-F0-9]{6}|[A-F0-9]{3})$/i,nr=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/i,ir=/^rgba\((\d+),\s*(\d+),\s*(\d+)(,\s*\d+(\.\d+)?)\)$/i,or=/^hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)$/i,ar=/^hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%(,\s*\d+(\.\d+)?)*\)$/i,Q=e=>!!e.match(rr),se=e=>!!(e.match(nr)||e.match(ir)),ue=e=>!!e.match(or)||!!e.match(ar),ke=e=>typeof e!="string"&&"r"in e,Se=e=>typeof e!="string"&&"h"in e,le=e=>e==="transparent",sr=e=>typeof e!="string"&&e.a!=null&&e.a<1;var ur=/[hsla()]/g,lr=/[rgba()]/g,cr=e=>e==="transparent"?{h:0,s:0,l:0,a:0}:Q(e)?gr(e):ue(e)?lt(e):se(e)?st(e):null,dr=e=>(e=e.trim(),Q(e)?e.startsWith("#")?e:`#${e}`:se(e)?ut(e):ue(e)?lt(e):le(e)?e:""),ot=e=>typeof e=="string"&&(Q(e)||le(e))?e:ke(e)?fr(e):Se(e)?pr(e):"",at=e=>{e=e.replace("#","");let r=parseInt(e.substring(0,2),16),t=parseInt(e.substring(2,4),16),n=parseInt(e.substring(4,6),16);return{r,g:t,b:n}},fr=e=>{let{a:r,b:t,g:n,r:o}=e;return e.a===0?"transparent":e.a!=null?`rgba(${o},${n},${t},${r})`:`rgb(${o},${n},${t})`},pr=e=>{let{h:r,s:t,l:n,a:o}=e,i=Math.round(t*100),a=Math.round(n*100);return e.a===0?"transparent":e.a!=null?`hsla(${r},${i}%,${a}%,${o})`:`hsl(${r},${i}%,${a}%)`},gr=e=>{let r=ot(at(e));return st(r)},st=e=>{let r=ut(e),t=r.r/255,n=r.g/255,o=r.b/255,i=Math.max(t,n,o),a=Math.min(t,n,o),u,f,s=(i+a)/2;if(i==a)u=f=0;else{let c=i-a;switch(f=s>=.5?c/(2-(i+a)):c/(i+a),i){case t:u=(n-o)/c*60;break;case n:u=((o-t)/c+2)*60;break;default:u=((t-n)/c+4)*60;break}}let l={h:Math.round(u),s:f,l:s},g=r.a;return g!=null&&(l.a=g),l},ut=e=>{let[r,t,n,o]=e.replace(lr,"").split(",").map(i=>Number.parseFloat(i));return{r,g:t,b:n,a:o}},lt=e=>{let[r,t,n,o]=e.replace(ur,"").split(",").map(i=>Number.parseFloat(i));return{h:r,s:t/100,l:n/100,a:o}};function ce(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)e[n]=t[n]}return e}var mr={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Ie(e,r){function t(o,i,a){if(!(typeof document>"u")){a=ce({},r,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var u="";for(var f in a)!a[f]||(u+="; "+f,a[f]!==!0&&(u+="="+a[f].split(";")[0]));return document.cookie=o+"="+e.write(i,o)+u}}function n(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var i=document.cookie?document.cookie.split("; "):[],a={},u=0;u<i.length;u++){var f=i[u].split("="),s=f.slice(1).join("=");try{var l=decodeURIComponent(f[0]);if(a[l]=e.read(s,l),o===l)break}catch{}}return o?a[o]:a}}return Object.create({set:t,get:n,remove:function(o,i){t(o,"",ce({},i,{expires:-1}))},withAttributes:function(o){return Ie(this.converter,ce({},this.attributes,o))},withConverter:function(o){return Ie(ce({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(e)}})}var vr=Ie(mr,{path:"/"}),de=vr;function hr(e){return{get(){return de.get(e)},set(r,t={}){return de.set(e,r,t)},remove(r){de.remove(e,r)}}}var B=(...e)=>{};var br=()=>{let e=B,r=B;return{promise:new Promise((n,o)=>{e=n,r=o}),resolve:e,reject:r}};function yr(e){return e?e.toLocaleString("en-US",{hour:"2-digit",minute:"numeric",hour12:!0}):""}function ct(e,r,{absolute:t=!0}={}){if(!e||!r)return 0;let n=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),o=Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()),i=Math.floor((o-n)/864e5);return t?Math.abs(i):i}function fe(e){try{return new Date(e||new Date)}catch{return new Date}}function Cr(e){let{date:r,relativeTo:t}=e;if(!r||!t)return null;let n=fe(r),o=fe(t),i=ct(o,n,{absolute:!1});return i<-6?{relativeDateCase:"other",date:n}:i<-1?{relativeDateCase:"previous6Days",date:n}:i===-1?{relativeDateCase:"lastDay",date:n}:i===0?{relativeDateCase:"sameDay",date:n}:i===1?{relativeDateCase:"nextDay",date:n}:i<7?{relativeDateCase:"next6Days",date:n}:{relativeDateCase:"other",date:n}}function xr(e,r){let t=fe(e);return t.setFullYear(t.getFullYear()+r),t}function Tr(e){let r=e?.status;return e?.errors?.[0]?.code==="authentication_invalid"&&r===401}function Rr(e){return(`${e.message}${e.name}`||"").toLowerCase().replace(/\s+/g,"").includes("networkerror")}function wr(e){return new Promise((r,t)=>{let n=new FileReader;n.addEventListener("load",function(){let o=JSON.parse(n.result);r(o)}),n.addEventListener("error",t),n.readAsText(e)})}var pe=e=>typeof atob<"u"&&typeof atob=="function"?atob(e):typeof global<"u"&&global.Buffer?new global.Buffer(e,"base64").toString():e;var Le="pk_live_",dt="pk_test_",Or=/^(([a-z]+)-){2}([0-9]{1,2})\.clerk\.accounts([a-z.]*)(dev|com)$/i;function Er(e){return`${Or.test(e)?dt:Le}${btoa(`${e}$`)}`}function kr(e){if(e=e||"",!ft(e))return null;let r=e.startsWith(Le)?"production":"development",t=pe(e.split("_")[2]);return t.endsWith("$")?(t=t.slice(0,-1),{instanceType:r,frontendApi:t}):null}function ft(e){e=e||"";let r=e.startsWith(Le)||e.startsWith(dt),t=pe(e.split("_")[2]||"").endsWith("$");return r&&t}function Sr(e){return e=e||"",e.startsWith("clerk.")}function Ir(){let e=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"],r=new Map;return{isDevOrStagingUrl:t=>{if(!t)return!1;let n=typeof t=="string"?t:t.hostname,o=r.get(n);return o===void 0&&(o=e.some(i=>n.endsWith(i)),r.set(n,o)),o}}}function Lr(){if(!window.matchMedia)return!1;let e=window.matchMedia("only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)");return e&&e.matches||window.devicePixelRatio>1}var zr="__lsbc__",ze=class{constructor(r){this.eventTarget=window;this.postMessage=r=>{try{localStorage.setItem(this.channelKey,JSON.stringify(r)),localStorage.removeItem(this.channelKey)}catch{}};this.addEventListener=(r,t)=>{this.eventTarget.addEventListener(this.prefixEventName(r),n=>{t(n)})};this.setupLocalStorageListener=()=>{let r=t=>{if(!(t.key!==this.channelKey||!t.newValue))try{let n=JSON.parse(t.newValue||""),o=new MessageEvent(this.prefixEventName("message"),{data:n});this.eventTarget.dispatchEvent(o)}catch{}};window.addEventListener("storage",r)};this.channelKey=zr+r,this.setupLocalStorageListener()}prefixEventName(r){return this.channelKey+r}};var Mr=Object.freeze({"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/x-icon":"ico","image/vnd.microsoft.icon":"ico"}),Dr=e=>Mr[e];function Pr(e,r,t){if(typeof e=="function")return e(r);if(typeof e<"u")return e;if(typeof t<"u")return t}var Ar=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;function Ur(e){return Ar.test(e||"")}function _r(e){let r=e||"";return r.charAt(0).toUpperCase()+r.slice(1)}function Me(e){return e?e.replace(/([-_][a-z])/g,r=>r.toUpperCase().replace(/-|_/,"")):""}function De(e){return e?e.replace(/[A-Z]/g,r=>`_${r.toLowerCase()}`):""}var pt=e=>{let r=t=>{if(!t)return t;if(Array.isArray(t))return t.map(i=>typeof i=="object"||Array.isArray(i)?r(i):i);let n={...t},o=Object.keys(n);for(let i of o){let a=e(i.toString());a!==i&&(n[a]=n[i],delete n[i]),typeof n[a]=="object"&&(n[a]=r(n[a]))}return n};return r},Fr=pt(De),Wr=pt(Me);var Pe=`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}});
`;var gt=(e,r={})=>{if(typeof Worker>"u")return null;try{let t=new Blob([e],{type:"application/javascript; charset=utf-8"}),n=globalThis.URL.createObjectURL(t);return new Worker(n,r)}catch{return console.warn("Clerk: Cannot create worker from blob. Consider adding worker-src blob:; to your CSP"),null}},$r=()=>{let e=globalThis.setTimeout.bind(globalThis),r=globalThis.setInterval.bind(globalThis),t=globalThis.clearTimeout.bind(globalThis),n=globalThis.clearInterval.bind(globalThis);return{setTimeout:e,setInterval:r,clearTimeout:t,clearInterval:n,cleanup:B}},ge=()=>{let e=0,r=()=>e++,t=new Map,n=(c,v)=>c?.postMessage(v),o=c=>{t.get(c.data.id)?.()},i=gt(Pe,{name:"clerk-timers"});if(i?.addEventListener("message",o),!i)return $r();let a=()=>{i||(i=gt(Pe,{name:"clerk-timers"}),i?.addEventListener("message",o))};return{setTimeout:(c,v)=>{a();let x=r();return t.set(x,c),n(i,{type:"setTimeout",id:x,ms:v}),x},setInterval:(c,v)=>{a();let x=r();return t.set(x,c),n(i,{type:"setInterval",id:x,ms:v}),x},clearTimeout:c=>{a(),t.delete(c),n(i,{type:"clearTimeout",id:c})},clearInterval:c=>{a(),t.delete(c),n(i,{type:"clearInterval",id:c})},cleanup:()=>{i&&(i.terminate(),i=null,t.clear())}}};function Hr({delayInMs:e}={delayInMs:1e3}){let r=ge(),t,n=!1,o=()=>{t&&(r.clearTimeout(t),r.cleanup()),n=!0},i=async a=>{n=!1,await a(o),!n&&(t=r.setTimeout(()=>{i(a)},e))};return{run:i,stop:o}}function Nr(e){return e?mt(e)||Ae(e):!0}function mt(e){return/^http(s)?:\/\//.test(e||"")}function Ae(e){return e.startsWith("/")}function Kr(e){return e?Ae(e)?new URL(e,window.location.origin).toString():e:""}var Gr=()=>typeof window<"u";function Br(e=""){return e.startsWith("?")&&(e=e.slice(1)),new URLSearchParams(e)}function jr(e=""){return(e||"").replace(/^.+:\/\//,"")}function Xr(e){if(!e)return"";let r;if(e.match(/^(clerk\.)+\w*$/))r=/(clerk\.)*(?=clerk\.)/;else{if(e.match(/\.clerk.accounts/))return e;r=/^(clerk\.)*/gi}return`clerk.${e.replace(r,"")}`}var Yr=e=>e.replace(/CLERK-ROUTER\/(.*?)\//,"");var Jr={maxRetries:10,firstDelay:125,maxDelay:0,timeMultiple:2,shouldRetry:()=>!0},qr=async e=>new Promise(r=>setTimeout(r,e)),Zr=e=>{let r=0,t=()=>{let n=e.firstDelay,o=e.timeMultiple,i=n*Math.pow(o,r);return Math.min(e.maxDelay||i,i)};return async()=>{await qr(t()),r++}},Qr=async(e,r={})=>{let t=0,{maxRetries:n,shouldRetry:o,firstDelay:i,maxDelay:a,timeMultiple:u}={...Jr,...r},f=()=>t===n,s=Zr({firstDelay:i,maxDelay:a,timeMultiple:u});for(;!f();)try{return await e()}catch(l){if(t++,!o(l,t)||f())throw l;await s()}throw new Error("Something went wrong")};var me=tt(require("react"));function Ue(e,r){if(!e)throw typeof r=="string"?new Error(r):new Error(`${r.displayName} not found`)}var U=(e,r)=>{let{assertCtxFn:t=Ue}=r||{},n=me.default.createContext(void 0);return n.displayName=e,[n,()=>{let a=me.default.useContext(n);return t(a,`${e} not found`),a.value},()=>{let a=me.default.useContext(n);return a?a.value:{}}]};var p=require("react");function yt(e,r,t,n){function o(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function u(l){try{s(n.next(l))}catch(g){a(g)}}function f(l){try{s(n.throw(l))}catch(g){a(g)}}function s(l){l.done?i(l.value):o(l.value).then(u,f)}s((n=n.apply(e,r||[])).next())})}function Ct(e,r){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(s){return function(l){return f([s,l])}}function f(s){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,o&&(i=s[0]&2?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[s[0]&2,i.value]),s[0]){case 0:case 1:i=s;break;case 4:return t.label++,{value:s[1],done:!1};case 5:t.label++,o=s[1],s=[0];continue;case 7:s=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){t.label=s[1];break}if(s[0]===6&&t.label<i[1]){t.label=i[1],i=s;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(s);break}i[2]&&t.ops.pop(),t.trys.pop();continue}s=r.call(e,t)}catch(l){s=[6,l],o=0}finally{n=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}var L=function(){},b=L(),ee=Object,C=function(e){return e===b},_=function(e){return typeof e=="function"},D=function(e,r){return ee.assign({},e,r)},Ke="undefined",Ge=function(){return typeof window!=Ke},en=function(){return typeof document!=Ke},tn=function(){return Ge()&&typeof window.requestAnimationFrame!=Ke},ve=new WeakMap,rn=0,ne=function(e){var r=typeof e,t=e&&e.constructor,n=t==Date,o,i;if(ee(e)===e&&!n&&t!=RegExp){if(o=ve.get(e),o)return o;if(o=++rn+"~",ve.set(e,o),t==Array){for(o="@",i=0;i<e.length;i++)o+=ne(e[i])+",";ve.set(e,o)}if(t==ee){o="#";for(var a=ee.keys(e).sort();!C(i=a.pop());)C(e[i])||(o+=i+":"+ne(e[i])+",");ve.set(e,o)}}else o=n?e.toJSON():r=="symbol"?e.toString():r=="string"?JSON.stringify(e):""+e;return o},We=!0,nn=function(){return We},xt=Ge(),Be=en(),Ve=xt&&window.addEventListener?window.addEventListener.bind(window):L,on=Be?document.addEventListener.bind(document):L,$e=xt&&window.removeEventListener?window.removeEventListener.bind(window):L,an=Be?document.removeEventListener.bind(document):L,sn=function(){var e=Be&&document.visibilityState;return C(e)||e!=="hidden"},un=function(e){return on("visibilitychange",e),Ve("focus",e),function(){an("visibilitychange",e),$e("focus",e)}},ln=function(e){var r=function(){We=!0,e()},t=function(){We=!1};return Ve("online",r),Ve("offline",t),function(){$e("online",r),$e("offline",t)}},cn={isOnline:nn,isVisible:sn},dn={initFocus:un,initReconnect:ln},he=!Ge()||"Deno"in window,fn=function(e){return tn()?window.requestAnimationFrame(e):setTimeout(e,1)},te=he?p.useEffect:p.useLayoutEffect,_e=typeof navigator<"u"&&navigator.connection,vt=!he&&_e&&(["slow-2g","2g"].includes(_e.effectiveType)||_e.saveData),Tt=function(e){if(_(e))try{e=e()}catch{e=""}var r=[].concat(e);e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?ne(e):"";var t=e?"$swr$"+e:"";return[e,r,t]},N=new WeakMap,Rt=0,wt=1,Ot=2,re=function(e,r,t,n,o,i,a){a===void 0&&(a=!0);var u=N.get(e),f=u[0],s=u[1],l=u[3],g=f[r],c=s[r];if(a&&c)for(var v=0;v<c.length;++v)c[v](t,n,o);return i&&(delete l[r],g&&g[0])?g[0](Ot).then(function(){return e.get(r)}):e.get(r)},pn=0,He=function(){return++pn},Et=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return yt(void 0,void 0,void 0,function(){var t,n,o,i,a,u,f,s,l,g,c,v,x,T,m,d,j,W,z,k,V;return Ct(this,function(P){switch(P.label){case 0:if(t=e[0],n=e[1],o=e[2],i=e[3],a=typeof i=="boolean"?{revalidate:i}:i||{},u=C(a.populateCache)?!0:a.populateCache,f=a.revalidate!==!1,s=a.rollbackOnError!==!1,l=a.optimisticData,g=Tt(n),c=g[0],v=g[2],!c)return[2];if(x=N.get(t),T=x[2],e.length<3)return[2,re(t,c,t.get(c),b,b,f,!0)];if(m=o,j=He(),T[c]=[j,0],W=!C(l),z=t.get(c),W&&(k=_(l)?l(z):l,t.set(c,k),re(t,c,k)),_(m))try{m=m(t.get(c))}catch($){d=$}return m&&_(m.then)?[4,m.catch(function($){d=$})]:[3,2];case 1:if(m=P.sent(),j!==T[c][0]){if(d)throw d;return[2,m]}else d&&W&&s&&(u=!0,m=z,t.set(c,z));P.label=2;case 2:return u&&(d||(_(u)&&(m=u(m,z)),t.set(c,m)),t.set(v,D(t.get(v),{error:d}))),T[c][1]=He(),[4,re(t,c,m,d,b,f,!!u)];case 3:if(V=P.sent(),d)throw d;return[2,u?V:m]}})})},ht=function(e,r){for(var t in e)e[t][0]&&e[t][0](r)},kt=function(e,r){if(!N.has(e)){var t=D(dn,r),n={},o=Et.bind(b,e),i=L;if(N.set(e,[n,{},{},{},o]),!he){var a=t.initFocus(setTimeout.bind(b,ht.bind(b,n,Rt))),u=t.initReconnect(setTimeout.bind(b,ht.bind(b,n,wt)));i=function(){a&&a(),u&&u(),N.delete(e)}}return[e,o,i]}return[e,N.get(e)[4]]},gn=function(e,r,t,n,o){var i=t.errorRetryCount,a=o.retryCount,u=~~((Math.random()+.5)*(1<<(a<8?a:8)))*t.errorRetryInterval;!C(i)&&a>i||setTimeout(n,u,o)},St=kt(new Map),It=St[0],mn=St[1],Lt=D({onLoadingSlow:L,onSuccess:L,onError:L,onErrorRetry:gn,onDiscarded:L,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:vt?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:vt?5e3:3e3,compare:function(e,r){return ne(e)==ne(r)},isPaused:function(){return!1},cache:It,mutate:mn,fallback:{}},cn),zt=function(e,r){var t=D(e,r);if(r){var n=e.use,o=e.fallback,i=r.use,a=r.fallback;n&&i&&(t.use=n.concat(i)),o&&a&&(t.fallback=D(o,a))}return t},Ne=(0,p.createContext)({}),vn=function(e){var r=e.value,t=zt((0,p.useContext)(Ne),r),n=r&&r.provider,o=(0,p.useState)(function(){return n?kt(n(t.cache||It),r):b})[0];return o&&(t.cache=o[0],t.mutate=o[1]),te(function(){return o?o[2]:b},[]),(0,p.createElement)(Ne.Provider,D(e,{value:t}))},hn=function(e,r){var t=(0,p.useState)({})[1],n=(0,p.useRef)(e),o=(0,p.useRef)({data:!1,error:!1,isValidating:!1}),i=(0,p.useCallback)(function(a){var u=!1,f=n.current;for(var s in a){var l=s;f[l]!==a[l]&&(f[l]=a[l],o.current[l]&&(u=!0))}u&&!r.current&&t({})},[]);return te(function(){n.current=e}),[n,o.current,i]},bn=function(e){return _(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}]},yn=function(){return D(Lt,(0,p.useContext)(Ne))},Cn=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=yn(),i=bn(t),a=i[0],u=i[1],f=i[2],s=zt(o,f),l=e,g=s.use;if(g)for(var c=g.length;c-- >0;)l=g[c](l);return l(a,u||s.fetcher,s)}},bt=function(e,r,t){var n=r[e]||(r[e]=[]);return n.push(t),function(){var o=n.indexOf(t);o>=0&&(n[o]=n[n.length-1],n.pop())}},Fe={dedupe:!0},xn=function(e,r,t){var n=t.cache,o=t.compare,i=t.fallbackData,a=t.suspense,u=t.revalidateOnMount,f=t.refreshInterval,s=t.refreshWhenHidden,l=t.refreshWhenOffline,g=N.get(n),c=g[0],v=g[1],x=g[2],T=g[3],m=Tt(e),d=m[0],j=m[1],W=m[2],z=(0,p.useRef)(!1),k=(0,p.useRef)(!1),V=(0,p.useRef)(d),P=(0,p.useRef)(r),$=(0,p.useRef)(t),h=function(){return $.current},xe=function(){return h().isVisible()&&h().isOnline()},ie=function(O){return n.set(W,D(n.get(W),O))},Ye=n.get(d),Nt=C(i)?t.fallback[d]:i,M=C(Ye)?Nt:Ye,Je=n.get(W)||{},X=Je.error,qe=!z.current,Ze=function(){return qe&&!C(u)?u:h().isPaused()?!1:a?C(M)?!1:t.revalidateIfStale:C(M)||t.revalidateIfStale},Kt=function(){return!d||!r?!1:Je.isValidating?!0:qe&&Ze()},Te=Kt(),Re=hn({data:M,error:X,isValidating:Te},k),K=Re[0],we=Re[1],oe=Re[2],H=(0,p.useCallback)(function(O){return yt(void 0,void 0,void 0,function(){var R,w,E,Y,J,S,y,A,I,Oe,q,G,Ee;return Ct(this,function(Z){switch(Z.label){case 0:if(R=P.current,!d||!R||k.current||h().isPaused())return[2,!1];Y=!0,J=O||{},S=!T[d]||!J.dedupe,y=function(){return!k.current&&d===V.current&&z.current},A=function(){var Qe=T[d];Qe&&Qe[1]===E&&delete T[d]},I={isValidating:!1},Oe=function(){ie({isValidating:!1}),y()&&oe(I)},ie({isValidating:!0}),oe({isValidating:!0}),Z.label=1;case 1:return Z.trys.push([1,3,,4]),S&&(re(n,d,K.current.data,K.current.error,!0),t.loadingTimeout&&!n.get(d)&&setTimeout(function(){Y&&y()&&h().onLoadingSlow(d,t)},t.loadingTimeout),T[d]=[R.apply(void 0,j),He()]),Ee=T[d],w=Ee[0],E=Ee[1],[4,w];case 2:return w=Z.sent(),S&&setTimeout(A,t.dedupingInterval),!T[d]||T[d][1]!==E?(S&&y()&&h().onDiscarded(d),[2,!1]):(ie({error:b}),I.error=b,q=x[d],!C(q)&&(E<=q[0]||E<=q[1]||q[1]===0)?(Oe(),S&&y()&&h().onDiscarded(d),[2,!1]):(o(K.current.data,w)?I.data=K.current.data:I.data=w,o(n.get(d),w)||n.set(d,w),S&&y()&&h().onSuccess(w,d,t),[3,4]));case 3:return G=Z.sent(),A(),h().isPaused()||(ie({error:G}),I.error=G,S&&y()&&(h().onError(G,d,t),(typeof t.shouldRetryOnError=="boolean"&&t.shouldRetryOnError||_(t.shouldRetryOnError)&&t.shouldRetryOnError(G))&&xe()&&h().onErrorRetry(G,d,t,H,{retryCount:(J.retryCount||0)+1,dedupe:!0}))),[3,4];case 4:return Y=!1,Oe(),y()&&S&&re(n,d,I.data,I.error,!1),[2,!0]}})})},[d]),Gt=(0,p.useCallback)(Et.bind(b,n,function(){return V.current}),[]);if(te(function(){P.current=r,$.current=t}),te(function(){if(!!d){var O=d!==V.current,R=H.bind(b,Fe),w=function(y,A,I){oe(D({error:A,isValidating:I},o(K.current.data,y)?b:{data:y}))},E=0,Y=function(y){if(y==Rt){var A=Date.now();h().revalidateOnFocus&&A>E&&xe()&&(E=A+h().focusThrottleInterval,R())}else if(y==wt)h().revalidateOnReconnect&&xe()&&R();else if(y==Ot)return H()},J=bt(d,v,w),S=bt(d,c,Y);return k.current=!1,V.current=d,z.current=!0,O&&oe({data:M,error:X,isValidating:Te}),Ze()&&(C(M)||he?R():fn(R)),function(){k.current=!0,J(),S()}}},[d,H]),te(function(){var O;function R(){var E=_(f)?f(M):f;E&&O!==-1&&(O=setTimeout(w,E))}function w(){!K.current.error&&(s||h().isVisible())&&(l||h().isOnline())?H(Fe).then(R):R()}return R(),function(){O&&(clearTimeout(O),O=-1)}},[f,s,l,H]),(0,p.useDebugValue)(M),a&&C(M)&&d)throw P.current=r,$.current=t,k.current=!1,C(X)?H(Fe):X;return{mutate:Gt,get data(){return we.data=!0,M},get error(){return we.error=!0,X},get isValidating(){return we.isValidating=!0,Te}}},ci=ee.defineProperty(vn,"default",{value:Lt});var je=Cn(xn);var[Mt,F]=U("ClerkInstanceContext"),[Dt,be]=U("UserContext"),[Pt,At]=U("ClientContext"),[Ut,ye]=U("SessionContext"),[_t,Ce]=U("OrganizationContext");var Wt=e=>{let{invitationList:r,membershipList:t}=e||{},{organization:n,lastOrganizationMember:o,lastOrganizationInvitation:i}=Ce(),a=ye(),u=F(),f=u.loaded&&a&&n,s=u.loaded?()=>u.organization?.getPendingInvitations(r):()=>[],l=u.loaded?()=>u.organization?.getMemberships(t):()=>[],{data:g,isValidating:c,mutate:v}=je(f&&r?Ft("invites",n,i,r):null,s),{data:x,isValidating:T,mutate:m}=je(f&&t?Ft("memberships",n,o,t):null,l);return n===void 0?{isLoaded:!1,organization:void 0,invitationList:void 0,membershipList:void 0,membership:void 0}:n===null?{isLoaded:!0,organization:null,invitationList:null,membershipList:null,membership:null}:!u.loaded&&n?{isLoaded:!0,organization:n,invitationList:void 0,membershipList:void 0,membership:void 0}:{isLoaded:!T&&!c,organization:n,membershipList:x,membership:Tn(a.user.organizationMemberships,n.id),invitationList:g,unstable__mutate:()=>{m(),v()}}};function Tn(e,r){return e.find(t=>t.organization.id===r)}function Ft(e,r,t,n){return[e,r.id,t?.id,t?.updatedAt,n.offset,n.limit].filter(Boolean).join("-")}var Vt=()=>{let e=F(),r=be();return!e.loaded||!r?{isLoaded:!1,organizationList:void 0,createOrganization:void 0,setActive:void 0}:{isLoaded:!0,organizationList:Rn(r.organizationMemberships),setActive:e.setActive,createOrganization:e.createOrganization}};function Rn(e){return e.map(r=>({membership:r,organization:r.organization}))}var $t=()=>{let e=F();return e.loaded?{isLoaded:!0,createOrganization:e.createOrganization,getOrganizationMemberships:e.getOrganizationMemberships,getOrganization:e.getOrganization}:{isLoaded:!1,createOrganization:void 0,getOrganizationMemberships:void 0,getOrganization:void 0}};var Xe=tt(require("react")),Ht=typeof window<"u"?Xe.default.useLayoutEffect:Xe.default.useEffect;0&&(module.exports={ClerkInstanceContext,ClientContext,LocalStorageBroadcastChannel,OrganizationContext,Poller,SessionContext,UserContext,addClerkPrefix,addYears,assertContextExists,buildErrorThrower,buildPublishableKey,camelToSnake,colorToSameTypeString,createContextAndHook,createCookieHandler,createDeferredPromise,createDevOrStagingUrlCache,createWorkerTimers,dateTo12HourTime,deepCamelToSnake,deepSnakeToCamel,detectUserAgentRobot,differenceInCalendarDays,extension,formatRelative,handleValueOrFn,hasAlpha,hexStringToRgbaColor,inBrowser,inClientSide,isHSLColor,isHttpOrHttps,isIPV4Address,isLegacyFrontendApiKey,isNetworkError,isProxyUrlRelative,isPublishableKey,isRGBColor,isRetinaDisplay,isTransparent,isUnauthorizedError,isValidBrowserOnline,isValidHexString,isValidHslaString,isValidProxyUrl,isValidRgbaString,isomorphicAtob,noop,normalizeDate,parsePublishableKey,parseSearchParams,pathFromFullPath,proxyUrlToAbsoluteURL,readJSONFile,runWithExponentialBackOff,snakeToCamel,stringToHslaColor,stringToSameTypeColor,stripScheme,titleize,toSentence,useClerkInstanceContext,useClientContext,useOrganization,useOrganizationContext,useOrganizationList,useOrganizations,useSafeLayoutEffect,useSessionContext,useUserContext});
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
"use strict";var Bt=Object.create;var ae=Object.defineProperty;var jt=Object.getOwnPropertyDescriptor;var Xt=Object.getOwnPropertyNames;var Yt=Object.getPrototypeOf,Jt=Object.prototype.hasOwnProperty;var qt=(e,r)=>{for(var t in r)ae(e,t,{get:r[t],enumerable:!0})},et=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Xt(r))!Jt.call(e,o)&&o!==t&&ae(e,o,{get:()=>r[o],enumerable:!(n=jt(r,o))||n.enumerable});return e};var tt=(e,r,t)=>(t=e!=null?Bt(Yt(e)):{},et(r||!e||!e.__esModule?ae(t,"default",{value:e,enumerable:!0}):t,e)),Zt=e=>et(ae({},"__esModule",{value:!0}),e);var wn={};qt(wn,{ClerkInstanceContext:()=>Mt,ClientContext:()=>Pt,LocalStorageBroadcastChannel:()=>ze,OrganizationContext:()=>_t,Poller:()=>Hr,SessionContext:()=>Ut,UserContext:()=>Dt,addClerkPrefix:()=>Xr,addYears:()=>xr,assertContextExists:()=>Ue,buildErrorThrower:()=>rt,buildPublishableKey:()=>Er,camelToSnake:()=>De,colorToSameTypeString:()=>ot,createContextAndHook:()=>U,createCookieHandler:()=>hr,createDeferredPromise:()=>br,createDevOrStagingUrlCache:()=>Ir,createWorkerTimers:()=>ge,dateTo12HourTime:()=>yr,deepCamelToSnake:()=>Fr,deepSnakeToCamel:()=>Wr,detectUserAgentRobot:()=>it,differenceInCalendarDays:()=>ct,extension:()=>Dr,formatRelative:()=>Cr,handleValueOrFn:()=>Pr,hasAlpha:()=>sr,hexStringToRgbaColor:()=>at,inBrowser:()=>nt,inClientSide:()=>Gr,isHSLColor:()=>Se,isHttpOrHttps:()=>mt,isIPV4Address:()=>Ur,isLegacyFrontendApiKey:()=>Sr,isNetworkError:()=>Rr,isProxyUrlRelative:()=>Ae,isPublishableKey:()=>ft,isRGBColor:()=>ke,isRetinaDisplay:()=>Lr,isTransparent:()=>le,isUnauthorizedError:()=>Tr,isValidBrowserOnline:()=>tr,isValidHexString:()=>Q,isValidHslaString:()=>ue,isValidProxyUrl:()=>Nr,isValidRgbaString:()=>se,isomorphicAtob:()=>pe,noop:()=>B,normalizeDate:()=>fe,parsePublishableKey:()=>kr,parseSearchParams:()=>Br,pathFromFullPath:()=>Yr,proxyUrlToAbsoluteURL:()=>Kr,readJSONFile:()=>wr,runWithExponentialBackOff:()=>Qr,snakeToCamel:()=>Me,stringToHslaColor:()=>cr,stringToSameTypeColor:()=>dr,stripScheme:()=>jr,titleize:()=>_r,toSentence:()=>er,useClerkInstanceContext:()=>F,useClientContext:()=>At,useOrganization:()=>Wt,useOrganizationContext:()=>Ce,useOrganizationList:()=>Vt,useOrganizations:()=>$t,useSafeLayoutEffect:()=>Ht,useSessionContext:()=>ye,useUserContext:()=>be});module.exports=Zt(wn);var Qt=Object.freeze({InvalidFrontendApiErrorMessage:"The frontendApi passed to Clerk is invalid. You can get your Frontend API key at https://dashboard.clerk.com/last-active?path=api-keys. (key={{key}})",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."});function rt({packageName:e,customMessages:r}){let t=e,n={...Qt,...r};function o(i,a){if(!a)return`${t}: ${i}`;let u=i,f=i.matchAll(/{{([a-zA-Z0-9-_]+)}}/g);for(let s of f){let l=(a[s[1]]||"").toString();u=u.replace(`{{${s[1]}}}`,l)}return`${t}: ${u}`}return{setPackageName({packageName:i}){return typeof i=="string"&&(t=i),this},setMessages({customMessages:i}){return Object.assign(n,i||{}),this},throwInvalidPublishableKeyError(i){throw new Error(o(n.InvalidPublishableKeyErrorMessage,i))},throwInvalidFrontendApiError(i){throw new Error(o(n.InvalidFrontendApiErrorMessage,i))},throwInvalidProxyUrl(i){throw new Error(o(n.InvalidProxyUrlErrorMessage,i))},throwMissingPublishableKeyError(){throw new Error(o(n.MissingPublishableKeyErrorMessage))}}}var er=e=>{if(e.length==0)return"";if(e.length==1)return e[0];let r=e.slice(0,-1).join(", ");return r+=`, or ${e.slice(-1)}`,r};function nt(){return typeof window<"u"}function it(e){return 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/].map(t=>t.source).join("|"),"i").test(e)}function tr(){let e=window?.navigator;if(!nt()||!e)return!1;let r=it(e?.userAgent),t=e?.webdriver,n=e?.onLine,o=e?.connection?.rtt!==0&&e?.connection?.downlink!==0;return!r&&!t&&o&&n}var rr=/^#?([A-F0-9]{6}|[A-F0-9]{3})$/i,nr=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/i,ir=/^rgba\((\d+),\s*(\d+),\s*(\d+)(,\s*\d+(\.\d+)?)\)$/i,or=/^hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)$/i,ar=/^hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%(,\s*\d+(\.\d+)?)*\)$/i,Q=e=>!!e.match(rr),se=e=>!!(e.match(nr)||e.match(ir)),ue=e=>!!e.match(or)||!!e.match(ar),ke=e=>typeof e!="string"&&"r"in e,Se=e=>typeof e!="string"&&"h"in e,le=e=>e==="transparent",sr=e=>typeof e!="string"&&e.a!=null&&e.a<1;var ur=/[hsla()]/g,lr=/[rgba()]/g,cr=e=>e==="transparent"?{h:0,s:0,l:0,a:0}:Q(e)?gr(e):ue(e)?lt(e):se(e)?st(e):null,dr=e=>(e=e.trim(),Q(e)?e.startsWith("#")?e:`#${e}`:se(e)?ut(e):ue(e)?lt(e):le(e)?e:""),ot=e=>typeof e=="string"&&(Q(e)||le(e))?e:ke(e)?fr(e):Se(e)?pr(e):"",at=e=>{e=e.replace("#","");let r=parseInt(e.substring(0,2),16),t=parseInt(e.substring(2,4),16),n=parseInt(e.substring(4,6),16);return{r,g:t,b:n}},fr=e=>{let{a:r,b:t,g:n,r:o}=e;return e.a===0?"transparent":e.a!=null?`rgba(${o},${n},${t},${r})`:`rgb(${o},${n},${t})`},pr=e=>{let{h:r,s:t,l:n,a:o}=e,i=Math.round(t*100),a=Math.round(n*100);return e.a===0?"transparent":e.a!=null?`hsla(${r},${i}%,${a}%,${o})`:`hsl(${r},${i}%,${a}%)`},gr=e=>{let r=ot(at(e));return st(r)},st=e=>{let r=ut(e),t=r.r/255,n=r.g/255,o=r.b/255,i=Math.max(t,n,o),a=Math.min(t,n,o),u,f,s=(i+a)/2;if(i==a)u=f=0;else{let c=i-a;switch(f=s>=.5?c/(2-(i+a)):c/(i+a),i){case t:u=(n-o)/c*60;break;case n:u=((o-t)/c+2)*60;break;default:u=((t-n)/c+4)*60;break}}let l={h:Math.round(u),s:f,l:s},g=r.a;return g!=null&&(l.a=g),l},ut=e=>{let[r,t,n,o]=e.replace(lr,"").split(",").map(i=>Number.parseFloat(i));return{r,g:t,b:n,a:o}},lt=e=>{let[r,t,n,o]=e.replace(ur,"").split(",").map(i=>Number.parseFloat(i));return{h:r,s:t/100,l:n/100,a:o}};function ce(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)e[n]=t[n]}return e}var mr={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Ie(e,r){function t(o,i,a){if(!(typeof document>"u")){a=ce({},r,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var u="";for(var f in a)a[f]&&(u+="; "+f,a[f]!==!0&&(u+="="+a[f].split(";")[0]));return document.cookie=o+"="+e.write(i,o)+u}}function n(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var i=document.cookie?document.cookie.split("; "):[],a={},u=0;u<i.length;u++){var f=i[u].split("="),s=f.slice(1).join("=");try{var l=decodeURIComponent(f[0]);if(a[l]=e.read(s,l),o===l)break}catch{}}return o?a[o]:a}}return Object.create({set:t,get:n,remove:function(o,i){t(o,"",ce({},i,{expires:-1}))},withAttributes:function(o){return Ie(this.converter,ce({},this.attributes,o))},withConverter:function(o){return Ie(ce({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(e)}})}var vr=Ie(mr,{path:"/"}),de=vr;function hr(e){return{get(){return de.get(e)},set(r,t={}){return de.set(e,r,t)},remove(r){de.remove(e,r)}}}var B=(...e)=>{};var br=()=>{let e=B,r=B;return{promise:new Promise((n,o)=>{e=n,r=o}),resolve:e,reject:r}};function yr(e){return e?e.toLocaleString("en-US",{hour:"2-digit",minute:"numeric",hour12:!0}):""}function ct(e,r,{absolute:t=!0}={}){if(!e||!r)return 0;let n=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),o=Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()),i=Math.floor((o-n)/864e5);return t?Math.abs(i):i}function fe(e){try{return new Date(e||new Date)}catch{return new Date}}function Cr(e){let{date:r,relativeTo:t}=e;if(!r||!t)return null;let n=fe(r),o=fe(t),i=ct(o,n,{absolute:!1});return i<-6?{relativeDateCase:"other",date:n}:i<-1?{relativeDateCase:"previous6Days",date:n}:i===-1?{relativeDateCase:"lastDay",date:n}:i===0?{relativeDateCase:"sameDay",date:n}:i===1?{relativeDateCase:"nextDay",date:n}:i<7?{relativeDateCase:"next6Days",date:n}:{relativeDateCase:"other",date:n}}function xr(e,r){let t=fe(e);return t.setFullYear(t.getFullYear()+r),t}function Tr(e){let r=e?.status;return e?.errors?.[0]?.code==="authentication_invalid"&&r===401}function Rr(e){return(`${e.message}${e.name}`||"").toLowerCase().replace(/\s+/g,"").includes("networkerror")}function wr(e){return new Promise((r,t)=>{let n=new FileReader;n.addEventListener("load",function(){let o=JSON.parse(n.result);r(o)}),n.addEventListener("error",t),n.readAsText(e)})}var pe=e=>typeof atob<"u"&&typeof atob=="function"?atob(e):typeof global<"u"&&global.Buffer?new global.Buffer(e,"base64").toString():e;var Le="pk_live_",dt="pk_test_",Or=/^(([a-z]+)-){2}([0-9]{1,2})\.clerk\.accounts([a-z.]*)(dev|com)$/i;function Er(e){return`${Or.test(e)?dt:Le}${btoa(`${e}$`)}`}function kr(e){if(e=e||"",!ft(e))return null;let r=e.startsWith(Le)?"production":"development",t=pe(e.split("_")[2]);return t.endsWith("$")?(t=t.slice(0,-1),{instanceType:r,frontendApi:t}):null}function ft(e){e=e||"";let r=e.startsWith(Le)||e.startsWith(dt),t=pe(e.split("_")[2]||"").endsWith("$");return r&&t}function Sr(e){return e=e||"",e.startsWith("clerk.")}function Ir(){let e=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"],r=new Map;return{isDevOrStagingUrl:t=>{if(!t)return!1;let n=typeof t=="string"?t:t.hostname,o=r.get(n);return o===void 0&&(o=e.some(i=>n.endsWith(i)),r.set(n,o)),o}}}function Lr(){if(!window.matchMedia)return!1;let e=window.matchMedia("only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)");return e&&e.matches||window.devicePixelRatio>1}var zr="__lsbc__",ze=class{constructor(r){this.eventTarget=window;this.postMessage=r=>{try{localStorage.setItem(this.channelKey,JSON.stringify(r)),localStorage.removeItem(this.channelKey)}catch{}};this.addEventListener=(r,t)=>{this.eventTarget.addEventListener(this.prefixEventName(r),n=>{t(n)})};this.setupLocalStorageListener=()=>{let r=t=>{if(!(t.key!==this.channelKey||!t.newValue))try{let n=JSON.parse(t.newValue||""),o=new MessageEvent(this.prefixEventName("message"),{data:n});this.eventTarget.dispatchEvent(o)}catch{}};window.addEventListener("storage",r)};this.channelKey=zr+r,this.setupLocalStorageListener()}prefixEventName(r){return this.channelKey+r}};var Mr=Object.freeze({"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/x-icon":"ico","image/vnd.microsoft.icon":"ico"}),Dr=e=>Mr[e];function Pr(e,r,t){if(typeof e=="function")return e(r);if(typeof e<"u")return e;if(typeof t<"u")return t}var Ar=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;function Ur(e){return Ar.test(e||"")}function _r(e){let r=e||"";return r.charAt(0).toUpperCase()+r.slice(1)}function Me(e){return e?e.replace(/([-_][a-z])/g,r=>r.toUpperCase().replace(/-|_/,"")):""}function De(e){return e?e.replace(/[A-Z]/g,r=>`_${r.toLowerCase()}`):""}var pt=e=>{let r=t=>{if(!t)return t;if(Array.isArray(t))return t.map(i=>typeof i=="object"||Array.isArray(i)?r(i):i);let n={...t},o=Object.keys(n);for(let i of o){let a=e(i.toString());a!==i&&(n[a]=n[i],delete n[i]),typeof n[a]=="object"&&(n[a]=r(n[a]))}return n};return r},Fr=pt(De),Wr=pt(Me);var Pe=`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}});
`;var gt=(e,r={})=>{if(typeof Worker>"u")return null;try{let t=new Blob([e],{type:"application/javascript; charset=utf-8"}),n=globalThis.URL.createObjectURL(t);return new Worker(n,r)}catch{return console.warn("Clerk: Cannot create worker from blob. Consider adding worker-src blob:; to your CSP"),null}},$r=()=>{let e=globalThis.setTimeout.bind(globalThis),r=globalThis.setInterval.bind(globalThis),t=globalThis.clearTimeout.bind(globalThis),n=globalThis.clearInterval.bind(globalThis);return{setTimeout:e,setInterval:r,clearTimeout:t,clearInterval:n,cleanup:B}},ge=()=>{let e=0,r=()=>e++,t=new Map,n=(c,v)=>c?.postMessage(v),o=c=>{t.get(c.data.id)?.()},i=gt(Pe,{name:"clerk-timers"});if(i?.addEventListener("message",o),!i)return $r();let a=()=>{i||(i=gt(Pe,{name:"clerk-timers"}),i?.addEventListener("message",o))};return{setTimeout:(c,v)=>{a();let x=r();return t.set(x,c),n(i,{type:"setTimeout",id:x,ms:v}),x},setInterval:(c,v)=>{a();let x=r();return t.set(x,c),n(i,{type:"setInterval",id:x,ms:v}),x},clearTimeout:c=>{a(),t.delete(c),n(i,{type:"clearTimeout",id:c})},clearInterval:c=>{a(),t.delete(c),n(i,{type:"clearInterval",id:c})},cleanup:()=>{i&&(i.terminate(),i=null,t.clear())}}};function Hr({delayInMs:e}={delayInMs:1e3}){let r=ge(),t,n=!1,o=()=>{t&&(r.clearTimeout(t),r.cleanup()),n=!0},i=async a=>{n=!1,await a(o),!n&&(t=r.setTimeout(()=>{i(a)},e))};return{run:i,stop:o}}function Nr(e){return e?mt(e)||Ae(e):!0}function mt(e){return/^http(s)?:\/\//.test(e||"")}function Ae(e){return e.startsWith("/")}function Kr(e){return e?Ae(e)?new URL(e,window.location.origin).toString():e:""}var Gr=()=>typeof window<"u";function Br(e=""){return e.startsWith("?")&&(e=e.slice(1)),new URLSearchParams(e)}function jr(e=""){return(e||"").replace(/^.+:\/\//,"")}function Xr(e){if(!e)return"";let r;if(e.match(/^(clerk\.)+\w*$/))r=/(clerk\.)*(?=clerk\.)/;else{if(e.match(/\.clerk.accounts/))return e;r=/^(clerk\.)*/gi}return`clerk.${e.replace(r,"")}`}var Yr=e=>e.replace(/CLERK-ROUTER\/(.*?)\//,"");var Jr={maxRetries:10,firstDelay:125,maxDelay:0,timeMultiple:2,shouldRetry:()=>!0},qr=async e=>new Promise(r=>setTimeout(r,e)),Zr=e=>{let r=0,t=()=>{let n=e.firstDelay,o=e.timeMultiple,i=n*Math.pow(o,r);return Math.min(e.maxDelay||i,i)};return async()=>{await qr(t()),r++}},Qr=async(e,r={})=>{let t=0,{maxRetries:n,shouldRetry:o,firstDelay:i,maxDelay:a,timeMultiple:u}={...Jr,...r},f=()=>t===n,s=Zr({firstDelay:i,maxDelay:a,timeMultiple:u});for(;!f();)try{return await e()}catch(l){if(t++,!o(l,t)||f())throw l;await s()}throw new Error("Something went wrong")};var me=tt(require("react"));function Ue(e,r){if(!e)throw typeof r=="string"?new Error(r):new Error(`${r.displayName} not found`)}var U=(e,r)=>{let{assertCtxFn:t=Ue}=r||{},n=me.default.createContext(void 0);return n.displayName=e,[n,()=>{let a=me.default.useContext(n);return t(a,`${e} not found`),a.value},()=>{let a=me.default.useContext(n);return a?a.value:{}}]};var p=require("react");function yt(e,r,t,n){function o(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function u(l){try{s(n.next(l))}catch(g){a(g)}}function f(l){try{s(n.throw(l))}catch(g){a(g)}}function s(l){l.done?i(l.value):o(l.value).then(u,f)}s((n=n.apply(e,r||[])).next())})}function Ct(e,r){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(s){return function(l){return f([s,l])}}function f(s){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,o&&(i=s[0]&2?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[s[0]&2,i.value]),s[0]){case 0:case 1:i=s;break;case 4:return t.label++,{value:s[1],done:!1};case 5:t.label++,o=s[1],s=[0];continue;case 7:s=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){t.label=s[1];break}if(s[0]===6&&t.label<i[1]){t.label=i[1],i=s;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(s);break}i[2]&&t.ops.pop(),t.trys.pop();continue}s=r.call(e,t)}catch(l){s=[6,l],o=0}finally{n=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}var L=function(){},b=L(),ee=Object,C=function(e){return e===b},_=function(e){return typeof e=="function"},D=function(e,r){return ee.assign({},e,r)},Ke="undefined",Ge=function(){return typeof window!=Ke},en=function(){return typeof document!=Ke},tn=function(){return Ge()&&typeof window.requestAnimationFrame!=Ke},ve=new WeakMap,rn=0,ne=function(e){var r=typeof e,t=e&&e.constructor,n=t==Date,o,i;if(ee(e)===e&&!n&&t!=RegExp){if(o=ve.get(e),o)return o;if(o=++rn+"~",ve.set(e,o),t==Array){for(o="@",i=0;i<e.length;i++)o+=ne(e[i])+",";ve.set(e,o)}if(t==ee){o="#";for(var a=ee.keys(e).sort();!C(i=a.pop());)C(e[i])||(o+=i+":"+ne(e[i])+",");ve.set(e,o)}}else o=n?e.toJSON():r=="symbol"?e.toString():r=="string"?JSON.stringify(e):""+e;return o},We=!0,nn=function(){return We},xt=Ge(),Be=en(),Ve=xt&&window.addEventListener?window.addEventListener.bind(window):L,on=Be?document.addEventListener.bind(document):L,$e=xt&&window.removeEventListener?window.removeEventListener.bind(window):L,an=Be?document.removeEventListener.bind(document):L,sn=function(){var e=Be&&document.visibilityState;return C(e)||e!=="hidden"},un=function(e){return on("visibilitychange",e),Ve("focus",e),function(){an("visibilitychange",e),$e("focus",e)}},ln=function(e){var r=function(){We=!0,e()},t=function(){We=!1};return Ve("online",r),Ve("offline",t),function(){$e("online",r),$e("offline",t)}},cn={isOnline:nn,isVisible:sn},dn={initFocus:un,initReconnect:ln},he=!Ge()||"Deno"in window,fn=function(e){return tn()?window.requestAnimationFrame(e):setTimeout(e,1)},te=he?p.useEffect:p.useLayoutEffect,_e=typeof navigator<"u"&&navigator.connection,vt=!he&&_e&&(["slow-2g","2g"].includes(_e.effectiveType)||_e.saveData),Tt=function(e){if(_(e))try{e=e()}catch{e=""}var r=[].concat(e);e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?ne(e):"";var t=e?"$swr$"+e:"";return[e,r,t]},N=new WeakMap,Rt=0,wt=1,Ot=2,re=function(e,r,t,n,o,i,a){a===void 0&&(a=!0);var u=N.get(e),f=u[0],s=u[1],l=u[3],g=f[r],c=s[r];if(a&&c)for(var v=0;v<c.length;++v)c[v](t,n,o);return i&&(delete l[r],g&&g[0])?g[0](Ot).then(function(){return e.get(r)}):e.get(r)},pn=0,He=function(){return++pn},Et=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return yt(void 0,void 0,void 0,function(){var t,n,o,i,a,u,f,s,l,g,c,v,x,T,m,d,j,W,z,k,V;return Ct(this,function(P){switch(P.label){case 0:if(t=e[0],n=e[1],o=e[2],i=e[3],a=typeof i=="boolean"?{revalidate:i}:i||{},u=C(a.populateCache)?!0:a.populateCache,f=a.revalidate!==!1,s=a.rollbackOnError!==!1,l=a.optimisticData,g=Tt(n),c=g[0],v=g[2],!c)return[2];if(x=N.get(t),T=x[2],e.length<3)return[2,re(t,c,t.get(c),b,b,f,!0)];if(m=o,j=He(),T[c]=[j,0],W=!C(l),z=t.get(c),W&&(k=_(l)?l(z):l,t.set(c,k),re(t,c,k)),_(m))try{m=m(t.get(c))}catch($){d=$}return m&&_(m.then)?[4,m.catch(function($){d=$})]:[3,2];case 1:if(m=P.sent(),j!==T[c][0]){if(d)throw d;return[2,m]}else d&&W&&s&&(u=!0,m=z,t.set(c,z));P.label=2;case 2:return u&&(d||(_(u)&&(m=u(m,z)),t.set(c,m)),t.set(v,D(t.get(v),{error:d}))),T[c][1]=He(),[4,re(t,c,m,d,b,f,!!u)];case 3:if(V=P.sent(),d)throw d;return[2,u?V:m]}})})},ht=function(e,r){for(var t in e)e[t][0]&&e[t][0](r)},kt=function(e,r){if(!N.has(e)){var t=D(dn,r),n={},o=Et.bind(b,e),i=L;if(N.set(e,[n,{},{},{},o]),!he){var a=t.initFocus(setTimeout.bind(b,ht.bind(b,n,Rt))),u=t.initReconnect(setTimeout.bind(b,ht.bind(b,n,wt)));i=function(){a&&a(),u&&u(),N.delete(e)}}return[e,o,i]}return[e,N.get(e)[4]]},gn=function(e,r,t,n,o){var i=t.errorRetryCount,a=o.retryCount,u=~~((Math.random()+.5)*(1<<(a<8?a:8)))*t.errorRetryInterval;!C(i)&&a>i||setTimeout(n,u,o)},St=kt(new Map),It=St[0],mn=St[1],Lt=D({onLoadingSlow:L,onSuccess:L,onError:L,onErrorRetry:gn,onDiscarded:L,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:vt?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:vt?5e3:3e3,compare:function(e,r){return ne(e)==ne(r)},isPaused:function(){return!1},cache:It,mutate:mn,fallback:{}},cn),zt=function(e,r){var t=D(e,r);if(r){var n=e.use,o=e.fallback,i=r.use,a=r.fallback;n&&i&&(t.use=n.concat(i)),o&&a&&(t.fallback=D(o,a))}return t},Ne=(0,p.createContext)({}),vn=function(e){var r=e.value,t=zt((0,p.useContext)(Ne),r),n=r&&r.provider,o=(0,p.useState)(function(){return n?kt(n(t.cache||It),r):b})[0];return o&&(t.cache=o[0],t.mutate=o[1]),te(function(){return o?o[2]:b},[]),(0,p.createElement)(Ne.Provider,D(e,{value:t}))},hn=function(e,r){var t=(0,p.useState)({})[1],n=(0,p.useRef)(e),o=(0,p.useRef)({data:!1,error:!1,isValidating:!1}),i=(0,p.useCallback)(function(a){var u=!1,f=n.current;for(var s in a){var l=s;f[l]!==a[l]&&(f[l]=a[l],o.current[l]&&(u=!0))}u&&!r.current&&t({})},[]);return te(function(){n.current=e}),[n,o.current,i]},bn=function(e){return _(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}]},yn=function(){return D(Lt,(0,p.useContext)(Ne))},Cn=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=yn(),i=bn(t),a=i[0],u=i[1],f=i[2],s=zt(o,f),l=e,g=s.use;if(g)for(var c=g.length;c-- >0;)l=g[c](l);return l(a,u||s.fetcher,s)}},bt=function(e,r,t){var n=r[e]||(r[e]=[]);return n.push(t),function(){var o=n.indexOf(t);o>=0&&(n[o]=n[n.length-1],n.pop())}},Fe={dedupe:!0},xn=function(e,r,t){var n=t.cache,o=t.compare,i=t.fallbackData,a=t.suspense,u=t.revalidateOnMount,f=t.refreshInterval,s=t.refreshWhenHidden,l=t.refreshWhenOffline,g=N.get(n),c=g[0],v=g[1],x=g[2],T=g[3],m=Tt(e),d=m[0],j=m[1],W=m[2],z=(0,p.useRef)(!1),k=(0,p.useRef)(!1),V=(0,p.useRef)(d),P=(0,p.useRef)(r),$=(0,p.useRef)(t),h=function(){return $.current},xe=function(){return h().isVisible()&&h().isOnline()},ie=function(O){return n.set(W,D(n.get(W),O))},Ye=n.get(d),Nt=C(i)?t.fallback[d]:i,M=C(Ye)?Nt:Ye,Je=n.get(W)||{},X=Je.error,qe=!z.current,Ze=function(){return qe&&!C(u)?u:h().isPaused()?!1:a?C(M)?!1:t.revalidateIfStale:C(M)||t.revalidateIfStale},Kt=function(){return!d||!r?!1:Je.isValidating?!0:qe&&Ze()},Te=Kt(),Re=hn({data:M,error:X,isValidating:Te},k),K=Re[0],we=Re[1],oe=Re[2],H=(0,p.useCallback)(function(O){return yt(void 0,void 0,void 0,function(){var R,w,E,Y,J,S,y,A,I,Oe,q,G,Ee;return Ct(this,function(Z){switch(Z.label){case 0:if(R=P.current,!d||!R||k.current||h().isPaused())return[2,!1];Y=!0,J=O||{},S=!T[d]||!J.dedupe,y=function(){return!k.current&&d===V.current&&z.current},A=function(){var Qe=T[d];Qe&&Qe[1]===E&&delete T[d]},I={isValidating:!1},Oe=function(){ie({isValidating:!1}),y()&&oe(I)},ie({isValidating:!0}),oe({isValidating:!0}),Z.label=1;case 1:return Z.trys.push([1,3,,4]),S&&(re(n,d,K.current.data,K.current.error,!0),t.loadingTimeout&&!n.get(d)&&setTimeout(function(){Y&&y()&&h().onLoadingSlow(d,t)},t.loadingTimeout),T[d]=[R.apply(void 0,j),He()]),Ee=T[d],w=Ee[0],E=Ee[1],[4,w];case 2:return w=Z.sent(),S&&setTimeout(A,t.dedupingInterval),!T[d]||T[d][1]!==E?(S&&y()&&h().onDiscarded(d),[2,!1]):(ie({error:b}),I.error=b,q=x[d],!C(q)&&(E<=q[0]||E<=q[1]||q[1]===0)?(Oe(),S&&y()&&h().onDiscarded(d),[2,!1]):(o(K.current.data,w)?I.data=K.current.data:I.data=w,o(n.get(d),w)||n.set(d,w),S&&y()&&h().onSuccess(w,d,t),[3,4]));case 3:return G=Z.sent(),A(),h().isPaused()||(ie({error:G}),I.error=G,S&&y()&&(h().onError(G,d,t),(typeof t.shouldRetryOnError=="boolean"&&t.shouldRetryOnError||_(t.shouldRetryOnError)&&t.shouldRetryOnError(G))&&xe()&&h().onErrorRetry(G,d,t,H,{retryCount:(J.retryCount||0)+1,dedupe:!0}))),[3,4];case 4:return Y=!1,Oe(),y()&&S&&re(n,d,I.data,I.error,!1),[2,!0]}})})},[d]),Gt=(0,p.useCallback)(Et.bind(b,n,function(){return V.current}),[]);if(te(function(){P.current=r,$.current=t}),te(function(){if(d){var O=d!==V.current,R=H.bind(b,Fe),w=function(y,A,I){oe(D({error:A,isValidating:I},o(K.current.data,y)?b:{data:y}))},E=0,Y=function(y){if(y==Rt){var A=Date.now();h().revalidateOnFocus&&A>E&&xe()&&(E=A+h().focusThrottleInterval,R())}else if(y==wt)h().revalidateOnReconnect&&xe()&&R();else if(y==Ot)return H()},J=bt(d,v,w),S=bt(d,c,Y);return k.current=!1,V.current=d,z.current=!0,O&&oe({data:M,error:X,isValidating:Te}),Ze()&&(C(M)||he?R():fn(R)),function(){k.current=!0,J(),S()}}},[d,H]),te(function(){var O;function R(){var E=_(f)?f(M):f;E&&O!==-1&&(O=setTimeout(w,E))}function w(){!K.current.error&&(s||h().isVisible())&&(l||h().isOnline())?H(Fe).then(R):R()}return R(),function(){O&&(clearTimeout(O),O=-1)}},[f,s,l,H]),(0,p.useDebugValue)(M),a&&C(M)&&d)throw P.current=r,$.current=t,k.current=!1,C(X)?H(Fe):X;return{mutate:Gt,get data(){return we.data=!0,M},get error(){return we.error=!0,X},get isValidating(){return we.isValidating=!0,Te}}},ci=ee.defineProperty(vn,"default",{value:Lt});var je=Cn(xn);var[Mt,F]=U("ClerkInstanceContext"),[Dt,be]=U("UserContext"),[Pt,At]=U("ClientContext"),[Ut,ye]=U("SessionContext"),[_t,Ce]=U("OrganizationContext");var Wt=e=>{let{invitationList:r,membershipList:t}=e||{},{organization:n,lastOrganizationMember:o,lastOrganizationInvitation:i}=Ce(),a=ye(),u=F(),f=u.loaded&&a&&n,s=u.loaded?()=>u.organization?.getPendingInvitations(r):()=>[],l=u.loaded?()=>u.organization?.getMemberships(t):()=>[],{data:g,isValidating:c,mutate:v}=je(f&&r?Ft("invites",n,i,r):null,s),{data:x,isValidating:T,mutate:m}=je(f&&t?Ft("memberships",n,o,t):null,l);return n===void 0?{isLoaded:!1,organization:void 0,invitationList:void 0,membershipList:void 0,membership:void 0}:n===null?{isLoaded:!0,organization:null,invitationList:null,membershipList:null,membership:null}:!u.loaded&&n?{isLoaded:!0,organization:n,invitationList:void 0,membershipList:void 0,membership:void 0}:{isLoaded:!T&&!c,organization:n,membershipList:x,membership:Tn(a.user.organizationMemberships,n.id),invitationList:g,unstable__mutate:()=>{m(),v()}}};function Tn(e,r){return e.find(t=>t.organization.id===r)}function Ft(e,r,t,n){return[e,r.id,t?.id,t?.updatedAt,n.offset,n.limit].filter(Boolean).join("-")}var Vt=()=>{let e=F(),r=be();return!e.loaded||!r?{isLoaded:!1,organizationList:void 0,createOrganization:void 0,setActive:void 0}:{isLoaded:!0,organizationList:Rn(r.organizationMemberships),setActive:e.setActive,createOrganization:e.createOrganization}};function Rn(e){return e.map(r=>({membership:r,organization:r.organization}))}var $t=()=>{let e=F();return e.loaded?{isLoaded:!0,createOrganization:e.createOrganization,getOrganizationMemberships:e.getOrganizationMemberships,getOrganization:e.getOrganization}:{isLoaded:!1,createOrganization:void 0,getOrganizationMemberships:void 0,getOrganization:void 0}};var Xe=tt(require("react")),Ht=typeof window<"u"?Xe.default.useLayoutEffect:Xe.default.useEffect;0&&(module.exports={ClerkInstanceContext,ClientContext,LocalStorageBroadcastChannel,OrganizationContext,Poller,SessionContext,UserContext,addClerkPrefix,addYears,assertContextExists,buildErrorThrower,buildPublishableKey,camelToSnake,colorToSameTypeString,createContextAndHook,createCookieHandler,createDeferredPromise,createDevOrStagingUrlCache,createWorkerTimers,dateTo12HourTime,deepCamelToSnake,deepSnakeToCamel,detectUserAgentRobot,differenceInCalendarDays,extension,formatRelative,handleValueOrFn,hasAlpha,hexStringToRgbaColor,inBrowser,inClientSide,isHSLColor,isHttpOrHttps,isIPV4Address,isLegacyFrontendApiKey,isNetworkError,isProxyUrlRelative,isPublishableKey,isRGBColor,isRetinaDisplay,isTransparent,isUnauthorizedError,isValidBrowserOnline,isValidHexString,isValidHslaString,isValidProxyUrl,isValidRgbaString,isomorphicAtob,noop,normalizeDate,parsePublishableKey,parseSearchParams,pathFromFullPath,proxyUrlToAbsoluteURL,readJSONFile,runWithExponentialBackOff,snakeToCamel,stringToHslaColor,stringToSameTypeColor,stripScheme,titleize,toSentence,useClerkInstanceContext,useClientContext,useOrganization,useOrganizationContext,useOrganizationList,useOrganizations,useSafeLayoutEffect,useSessionContext,useUserContext});
/*! Bundled license information:
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
js-cookie/dist/js.cookie.mjs:
(*! js-cookie v3.0.1 | MIT *)
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/*! js-cookie v3.0.1 | MIT */
swr/dist/index.mjs:
(*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** *)
*/
//# sourceMappingURL=index.js.map
{
"name": "@clerk/shared",
"version": "0.15.2-staging.0",
"version": "0.15.2",
"description": "Internal package utils used by the Clerk SDKs",

@@ -22,3 +22,3 @@ "types": "./dist/types/index.d.ts",

"devDependencies": {
"@clerk/types": "^3.34.0-staging.0",
"@clerk/types": "^3.34.0",
"@testing-library/dom": "8.19.0",

@@ -42,3 +42,3 @@ "@testing-library/jest-dom": "5.16.5",

"license": "ISC",
"gitHead": "743e51c374b4e261e82c5f87953eb7947f062e87",
"gitHead": "ecf62461f8dae30d0678ebbe089036467663a297",
"publishConfig": {

@@ -45,0 +45,0 @@ "access": "public"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc