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

@clerk/backend

Package Overview
Dependencies
Maintainers
9
Versions
2411
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clerk/backend - npm Package Compare versions

Comparing version 0.16.2 to 0.17.0-staging.0

dist/types/api/resources/Webhooks.d.ts

6

dist/esm/index.js

@@ -1,2 +0,2 @@

var m=class{constructor(e){this.request=e}requireId(e){if(!e)throw new Error("A valid resource ID is required.")}};var Ue="/",zt=new RegExp(Ue+"{1,}","g");function a(...t){return t.filter(e=>e).join(Ue).replace(zt,Ue)}var Ce="/allowlist_identifiers",de=class extends m{async getAllowlistIdentifierList(){return this.request({method:"GET",path:Ce})}async createAllowlistIdentifier(e){return this.request({method:"POST",path:Ce,bodyParams:e})}async deleteAllowlistIdentifier(e){return this.requireId(e),this.request({method:"DELETE",path:a(Ce,e)})}};var Ee="/clients",ce=class extends m{async getClientList(){return this.request({method:"GET",path:Ee})}async getClient(e){return this.requireId(e),this.request({method:"GET",path:a(Ee,e)})}verifyClient(e){return this.request({method:"POST",path:a(Ee,"verify"),bodyParams:{token:e}})}};var pe="/email_addresses",me=class extends m{async getEmailAddress(e){return this.requireId(e),this.request({method:"GET",path:a(pe,e)})}async createEmailAddress(e){return this.request({method:"POST",path:pe,bodyParams:e})}async updateEmailAddress(e,r={}){return this.requireId(e),this.request({method:"PATCH",path:a(pe,e),bodyParams:r})}async deleteEmailAddress(e){return this.requireId(e),this.request({method:"DELETE",path:a(pe,e)})}};var jt="/emails",ge=class extends m{async createEmail(e){return this.request({method:"POST",path:jt,bodyParams:e})}};var fe=class extends m{async getInterstitial(){return this.request({path:"internal/interstitial",method:"GET",headerParams:{"Content-Type":"text/html"}})}};var qe="/invitations",ye=class extends m{async getInvitationList(){return this.request({method:"GET",path:qe})}async createInvitation(e){return this.request({method:"POST",path:qe,bodyParams:e})}async revokeInvitation(e){return this.requireId(e),this.request({method:"POST",path:a(qe,e,"revoke")})}};var w="/organizations",he=class extends m{async getOrganizationList(e){return this.request({method:"GET",path:w,queryParams:e})}async createOrganization(e){return this.request({method:"POST",path:w,bodyParams:e})}async getOrganization(e){let r="organizationId"in e?e.organizationId:e.slug;return this.requireId(r),this.request({method:"GET",path:a(w,r)})}async updateOrganization(e,r){return this.requireId(e),this.request({method:"PATCH",path:a(w,e),bodyParams:r})}async updateOrganizationMetadata(e,r){return this.requireId(e),this.request({method:"PATCH",path:a(w,e,"metadata"),bodyParams:r})}async deleteOrganization(e){return this.request({method:"DELETE",path:a(w,e)})}async getOrganizationMembershipList(e){let{organizationId:r,limit:n,offset:i}=e;return this.requireId(r),this.request({method:"GET",path:a(w,r,"memberships"),queryParams:{limit:n,offset:i}})}async createOrganizationMembership(e){let{organizationId:r,userId:n,role:i}=e;return this.requireId(r),this.request({method:"POST",path:a(w,r,"memberships"),bodyParams:{userId:n,role:i}})}async updateOrganizationMembership(e){let{organizationId:r,userId:n,role:i}=e;return this.requireId(r),this.request({method:"PATCH",path:a(w,r,"memberships",n),bodyParams:{role:i}})}async updateOrganizationMembershipMetadata(e){let{organizationId:r,userId:n,publicMetadata:i,privateMetadata:s}=e;return this.request({method:"PATCH",path:a(w,r,"memberships",n,"metadata"),bodyParams:{publicMetadata:i,privateMetadata:s}})}async deleteOrganizationMembership(e){let{organizationId:r,userId:n}=e;return this.requireId(r),this.request({method:"DELETE",path:a(w,r,"memberships",n)})}async getPendingOrganizationInvitationList(e){let{organizationId:r,limit:n,offset:i}=e;return this.requireId(r),this.request({method:"GET",path:a(w,r,"invitations","pending"),queryParams:{limit:n,offset:i}})}async createOrganizationInvitation(e){let{organizationId:r,...n}=e;return this.requireId(r),this.request({method:"POST",path:a(w,r,"invitations"),bodyParams:{...n}})}async revokeOrganizationInvitation(e){let{organizationId:r,invitationId:n,requestingUserId:i}=e;return this.requireId(r),this.request({method:"POST",path:a(w,r,"invitations",n,"revoke"),bodyParams:{requestingUserId:i}})}};var be="/phone_numbers",Se=class extends m{async getPhoneNumber(e){return this.requireId(e),this.request({method:"GET",path:a(be,e)})}async createPhoneNumber(e){return this.request({method:"POST",path:be,bodyParams:e})}async updatePhoneNumber(e,r={}){return this.requireId(e),this.request({method:"PATCH",path:a(be,e),bodyParams:r})}async deletePhoneNumber(e){return this.requireId(e),this.request({method:"DELETE",path:a(be,e)})}};var Oe="/redirect_urls",ke=class extends m{async getRedirectUrlList(){return this.request({method:"GET",path:Oe})}async getRedirectUrl(e){return this.requireId(e),this.request({method:"GET",path:a(Oe,e)})}async createRedirectUrl(e){return this.request({method:"POST",path:Oe,bodyParams:e})}async deleteRedirectUrl(e){return this.requireId(e),this.request({method:"DELETE",path:a(Oe,e)})}};var se="/sessions",_e=class extends m{async getSessionList(e){return this.request({method:"GET",path:se,queryParams:e})}async getSession(e){return this.requireId(e),this.request({method:"GET",path:a(se,e)})}async revokeSession(e){return this.requireId(e),this.request({method:"POST",path:a(se,e,"revoke")})}async verifySession(e,r){return this.requireId(e),this.request({method:"POST",path:a(se,e,"verify"),bodyParams:{token:r}})}async getToken(e,r){return this.requireId(e),(await this.request({method:"POST",path:a(se,e,"tokens",r||"")})).jwt}};var Ye="/sign_in_tokens",Ie=class extends m{async createSignInToken(e){return this.request({method:"POST",path:Ye,bodyParams:e})}async revokeSignInToken(e){return this.requireId(e),this.request({method:"POST",path:a(Ye,e,"revoke")})}};var Wt="/sms_messages",Ae=class extends m{async createSMSMessage(e){return this.request({method:"POST",path:Wt,bodyParams:e})}};var T="/users",we=class extends m{async getUserList(e={}){return this.request({method:"GET",path:T,queryParams:e})}async getUser(e){return this.requireId(e),this.request({method:"GET",path:a(T,e)})}async createUser(e){return this.request({method:"POST",path:T,bodyParams:e})}async updateUser(e,r={}){return this.requireId(e),this.request({method:"PATCH",path:a(T,e),bodyParams:r})}async updateUserMetadata(e,r){return this.requireId(e),this.request({method:"PATCH",path:a(T,e,"metadata"),bodyParams:r})}async deleteUser(e){return this.requireId(e),this.request({method:"DELETE",path:a(T,e)})}async getCount(e={}){return this.request({method:"GET",path:a(T,"count"),queryParams:e})}async getUserOauthAccessToken(e,r){return this.requireId(e),this.request({method:"GET",path:a(T,e,"oauth_access_tokens",r)})}async disableUserMFA(e){return this.requireId(e),this.request({method:"DELETE",path:a(T,e,"mfa")})}async getOrganizationMembershipList(e){let{userId:r,limit:n,offset:i}=e;return this.requireId(r),this.request({method:"GET",path:a(T,r,"organization_memberships"),queryParams:{limit:n,offset:i}})}async verifyPassword(e){let{userId:r,password:n}=e;return this.requireId(r),this.request({method:"POST",path:a(T,r,"verify_password"),bodyParams:{password:n}})}async verifyTOTP(e){let{userId:r,code:n}=e;return this.requireId(r),this.request({method:"POST",path:a(T,r,"verify_totp"),bodyParams:{code:n}})}};import Zt from"deepmerge";import tt from"snakecase-keys";var C="https://api.clerk.dev",J="v1",Xe="@clerk/backend";var Lt={AuthStatus:"__clerkAuthStatus",AuthReason:"__clerkAuthReason",AuthMessage:"__clerkAuthMessage"},Dt={Session:"__session",ClientUat:"__client_uat"},Qe={AuthStatus:"x-clerk-auth-status",AuthReason:"x-clerk-auth-reason",AuthMessage:"x-clerk-auth-message",Authorization:"authorization",ForwardedPort:"x-forwarded-port",ForwardedHost:"x-forwarded-host",Referrer:"referer",UserAgent:"user-agent",Origin:"origin",Host:"host",ContentType:"content-type"},Ft={AuthStatus:Qe.AuthStatus},Vt={Json:"application/json"},$t={Attributes:Lt,Cookies:Dt,Headers:Qe,SearchParams:Ft,ContentTypes:Vt};import Gt from"#crypto";import Bt from"#fetch";var Ht=Bt.bind(globalThis),Yt={crypto:Gt,fetch:Ht},N=Yt;function Pe(t){if(!t||typeof t!="string")throw Error("Missing Clerk Secret Key or API Key. Go to https://dashboard.clerk.com and get your key for your instance.")}var L=class{constructor(e,r,n,i,s){this.id=e;this.identifier=r;this.createdAt=n;this.updatedAt=i;this.invitationId=s}static fromJSON(e){return new L(e.id,e.identifier,e.created_at,e.updated_at,e.invitation_id)}};var E=class{constructor(e,r,n,i,s,o,u,l,d){this.id=e;this.clientId=r;this.userId=n;this.status=i;this.lastActiveAt=s;this.expireAt=o;this.abandonAt=u;this.createdAt=l;this.updatedAt=d}static fromJSON(e){return new E(e.id,e.client_id,e.user_id,e.status,e.last_active_at,e.expire_at,e.abandon_at,e.created_at,e.updated_at)}};var D=class{constructor(e,r,n,i,s,o,u,l){this.id=e;this.sessionIds=r;this.sessions=n;this.signInId=i;this.signUpId=s;this.lastActiveSessionId=o;this.createdAt=u;this.updatedAt=l}static fromJSON(e){return new D(e.id,e.session_ids,e.sessions.map(r=>E.fromJSON(r)),e.sign_in_id,e.sign_up_id,e.last_active_session_id,e.created_at,e.updated_at)}};var F=class{constructor(e,r,n,i){this.object=e;this.id=r;this.slug=n;this.deleted=i}static fromJSON(e){return new F(e.object,e.id||null,e.slug||null,e.deleted)}};var V=class{constructor(e,r,n,i,s,o,u){this.id=e;this.fromEmailName=r;this.emailAddressId=n;this.toEmailAddress=i;this.subject=s;this.body=o;this.status=u}static fromJSON(e){return new V(e.id,e.from_email_name,e.email_address_id,e.to_email_address,e.subject,e.body,e.status)}};var q=class{constructor(e,r){this.id=e;this.type=r}static fromJSON(e){return new q(e.id,e.type)}};var R=class{constructor(e,r,n=null,i=null,s=null,o=null){this.status=e;this.strategy=r;this.externalVerificationRedirectURL=n;this.attempts=i;this.expireAt=s;this.nonce=o}static fromJSON(e){return new R(e.status,e.strategy,e.external_verification_redirect_url?new URL(e.external_verification_redirect_url):null,e.attempts,e.expire_at,e.nonce)}};var M=class{constructor(e,r,n,i){this.id=e;this.emailAddress=r;this.verification=n;this.linkedTo=i}static fromJSON(e){return new M(e.id,e.email_address,e.verification&&R.fromJSON(e.verification),e.linked_to.map(r=>q.fromJSON(r)))}};var $=class{constructor(e,r,n,i,s,o,u,l,d,g,f={},b,y){this.id=e;this.provider=r;this.identificationId=n;this.externalId=i;this.approvedScopes=s;this.emailAddress=o;this.firstName=u;this.lastName=l;this.picture=d;this.username=g;this.publicMetadata=f;this.label=b;this.verification=y}static fromJSON(e){return new $(e.id,e.provider,e.identification_id,e.provider_user_id,e.approved_scopes,e.email_address,e.first_name,e.last_name,e.avatar_url,e.username,e.public_metadata,e.label,e.verification&&R.fromJSON(e.verification))}};var G=class{constructor(e,r,n,i,s,o,u){this.id=e;this.emailAddress=r;this.publicMetadata=n;this.createdAt=i;this.updatedAt=s;this.status=o;this.revoked=u}static fromJSON(e){return new G(e.id,e.email_address,e.public_metadata,e.created_at,e.updated_at,e.status,e.revoked)}};var Ze=(p=>(p.AllowlistIdentifier="allowlist_identifier",p.Client="client",p.Email="email",p.EmailAddress="email_address",p.ExternalAccount="external_account",p.FacebookAccount="facebook_account",p.GoogleAccount="google_account",p.Invitation="invitation",p.OauthAccessToken="oauth_access_token",p.Organization="organization",p.OrganizationInvitation="organization_invitation",p.OrganizationMembership="organization_membership",p.PhoneNumber="phone_number",p.RedirectUrl="redirect_url",p.Session="session",p.SignInAttempt="sign_in_attempt",p.SignInToken="sign_in_token",p.SignUpAttempt="sign_up_attempt",p.SmsMessage="sms_message",p.User="user",p.Web3Wallet="web3_wallet",p.Token="token",p.TotalCount="total_count",p))(Ze||{});var B=class{constructor(e,r,n={},i,s,o){this.provider=e;this.token=r;this.publicMetadata=n;this.label=i;this.scopes=s;this.tokenSecret=o}static fromJSON(e){return new B(e.provider,e.token,e.public_metadata,e.label,e.scopes,e.token_secret)}};var K=class{constructor(e,r,n,i,s,o,u,l,d={},g={},f){this.id=e;this.name=r;this.slug=n;this.logoUrl=i;this.imageUrl=s;this.createdBy=o;this.createdAt=u;this.updatedAt=l;this.publicMetadata=d;this.privateMetadata=g;this.maxAllowedMemberships=f}static fromJSON(e){return new K(e.id,e.name,e.slug,e.logo_url,e.image_url,e.created_by,e.created_at,e.updated_at,e.public_metadata,e.private_metadata,e.max_allowed_memberships)}};var H=class{constructor(e,r,n,i,s,o,u,l={}){this.id=e;this.emailAddress=r;this.role=n;this.organizationId=i;this.createdAt=s;this.updatedAt=o;this.status=u;this.publicMetadata=l}static fromJSON(e){return new H(e.id,e.email_address,e.role,e.organization_id,e.created_at,e.updated_at,e.status,e.public_metadata)}};var Y=class{constructor(e,r,n={},i={},s,o,u,l){this.id=e;this.role=r;this.publicMetadata=n;this.privateMetadata=i;this.createdAt=s;this.updatedAt=o;this.organization=u;this.publicUserData=l}static fromJSON(e){return new Y(e.id,e.role,e.public_metadata,e.private_metadata,e.created_at,e.updated_at,K.fromJSON(e.organization),oe.fromJSON(e.public_user_data))}},oe=class{constructor(e,r,n,i,s,o){this.identifier=e;this.firstName=r;this.lastName=n;this.profileImageUrl=i;this.imageUrl=s;this.userId=o}static fromJSON(e){return new oe(e.identifier,e.first_name,e.last_name,e.profile_image_url,e.image_url,e.user_id)}};var z=class{constructor(e,r,n,i,s,o){this.id=e;this.phoneNumber=r;this.reservedForSecondFactor=n;this.defaultSecondFactor=i;this.verification=s;this.linkedTo=o}static fromJSON(e){return new z(e.id,e.phone_number,e.reserved_for_second_factor,e.default_second_factor,e.verification&&R.fromJSON(e.verification),e.linked_to.map(r=>q.fromJSON(r)))}};var X=class{constructor(e,r,n,i){this.id=e;this.url=r;this.createdAt=n;this.updatedAt=i}static fromJSON(e){return new X(e.id,e.url,e.created_at,e.updated_at)}};var Q=class{constructor(e,r,n,i,s,o,u){this.id=e;this.userId=r;this.token=n;this.status=i;this.url=s;this.createdAt=o;this.updatedAt=u}static fromJSON(e){return new Q(e.id,e.user_id,e.token,e.status,e.url,e.created_at,e.updated_at)}};var Z=class{constructor(e,r,n,i,s,o){this.id=e;this.fromPhoneNumber=r;this.toPhoneNumber=n;this.message=i;this.status=s;this.phoneNumberId=o}static fromJSON(e){return new Z(e.id,e.from_phone_number,e.to_phone_number,e.message,e.status,e.phone_number_id)}};var ee=class{constructor(e){this.jwt=e}static fromJSON(e){return new ee(e.jwt)}};var te=class{constructor(e,r,n){this.id=e;this.web3Wallet=r;this.verification=n}static fromJSON(e){return new te(e.id,e.web3_wallet,e.verification&&R.fromJSON(e.verification))}};var re=class{constructor(e,r,n,i,s,o,u,l,d,g,f,b,y,S,P,x,O,k,I,A,_={},h={},p={},W=[],ue=[],ve=[],Mt=[]){this.id=e;this.passwordEnabled=r;this.totpEnabled=n;this.backupCodeEnabled=i;this.twoFactorEnabled=s;this.banned=o;this.createdAt=u;this.updatedAt=l;this.profileImageUrl=d;this.imageUrl=g;this.gender=f;this.birthday=b;this.primaryEmailAddressId=y;this.primaryPhoneNumberId=S;this.primaryWeb3WalletId=P;this.lastSignInAt=x;this.externalId=O;this.username=k;this.firstName=I;this.lastName=A;this.publicMetadata=_;this.privateMetadata=h;this.unsafeMetadata=p;this.emailAddresses=W;this.phoneNumbers=ue;this.web3Wallets=ve;this.externalAccounts=Mt}static fromJSON(e){return new re(e.id,e.password_enabled,e.totp_enabled,e.backup_code_enabled,e.two_factor_enabled,e.banned,e.created_at,e.updated_at,e.profile_image_url,e.image_url,e.gender,e.birthday,e.primary_email_address_id,e.primary_phone_number_id,e.primary_web3_wallet_id,e.last_sign_in_at,e.external_id,e.username,e.first_name,e.last_name,e.public_metadata,e.private_metadata,e.unsafe_metadata,(e.email_addresses||[]).map(r=>M.fromJSON(r)),(e.phone_numbers||[]).map(r=>z.fromJSON(r)),(e.web3_wallets||[]).map(r=>te.fromJSON(r)),(e.external_accounts||[]).map(r=>$.fromJSON(r)))}};function et(t){return Array.isArray(t)?t.map(e=>Me(e)):Xt(t)?t.data.map(e=>Me(e)):Me(t)}function Xt(t){return t.data!==void 0}function Qt(t){return t.total_count}function Me(t){if(typeof t!="string"&&"object"in t&&"deleted"in t)return F.fromJSON(t);switch(t.object){case"allowlist_identifier":return L.fromJSON(t);case"client":return D.fromJSON(t);case"email_address":return M.fromJSON(t);case"email":return V.fromJSON(t);case"invitation":return G.fromJSON(t);case"oauth_access_token":return B.fromJSON(t);case"organization":return K.fromJSON(t);case"organization_invitation":return H.fromJSON(t);case"organization_membership":return Y.fromJSON(t);case"phone_number":return z.fromJSON(t);case"redirect_url":return X.fromJSON(t);case"sign_in_token":return Q.fromJSON(t);case"session":return E.fromJSON(t);case"sms_message":return Z.fromJSON(t);case"token":return ee.fromJSON(t);case"total_count":return Qt(t);case"user":return re.fromJSON(t);default:return t}}var er=t=>async(...e)=>{let{data:r,errors:n,status:i,statusText:s}=await t(...e);if(n===null)return r;throw new ae(s||"",{data:n,status:i||""})};function rt(t){return er(async r=>{let{apiKey:n,secretKey:i,apiUrl:s=C,apiVersion:o=J,userAgent:u=Xe,httpOptions:l={}}=t,{path:d,method:g,queryParams:f,headerParams:b,bodyParams:y}=r,S=i||n;Pe(S);let P=a(s,o,d),x=new URL(P);if(f){let _=tt({...f});for(let[h,p]of Object.entries(_))p&&[p].flat().forEach(W=>x.searchParams.append(h,W))}let O={Authorization:`Bearer ${S}`,"Content-Type":"application/json","Clerk-Backend-SDK":u,...b},I=g!=="GET"&&y&&Object.keys(y).length>0?{body:JSON.stringify(tt(y,{deep:!1}))}:null,A;try{A=await N.fetch(x.href,Zt(l,{method:g,headers:O,...I}));let h=await(O&&O["Content-Type"]==="application/json"?A.json():A.text());if(!A.ok)throw h;return{data:et(h),errors:null}}catch(_){return _ instanceof Error?{data:null,errors:[{code:"unexpected_error",message:_.message||"Unexpected error"}]}:{data:null,errors:tr(_),status:A?.status,statusText:A?.statusText}}})}function tr(t){if(t&&typeof t=="object"&&"errors"in t){let e=t.errors;return e.length>0?e.map(rr):[]}return[]}function rr(t){return{code:t.code,message:t.message,longMessage:t.long_message,meta:{paramName:t?.meta?.param_name,sessionId:t?.meta?.session_id}}}var ae=class extends Error{constructor(r,{data:n,status:i}){super(r);Object.setPrototypeOf(this,ae.prototype),this.clerkError=!0,this.message=r,this.status=i,this.errors=n}};function ne(t){let e=rt(t);return{allowlistIdentifiers:new de(e),clients:new ce(e),emailAddresses:new me(e),emails:new ge(e),interstitial:new fe(e),invitations:new ye(e),organizations:new he(e),phoneNumbers:new Se(e),redirectUrls:new ke(e),sessions:new _e(e),signInTokens:new Ie(e),smsMessages:new Ae(e),users:new we(e)}}var it=t=>()=>{let e={...t};return e.apiKey=(e.apiKey||"").substring(0,7),e.secretKey=(e.secretKey||"").substring(0,7),e.jwtKey=(e.jwtKey||"").substring(0,7),{...e}};function st(t,e,r){let{act:n,sid:i,org_id:s,org_role:o,org_slug:u,sub:l}=t,{apiKey:d,secretKey:g,apiUrl:f,apiVersion:b,token:y,session:S,user:P,organization:x}=e,{sessions:O}=ne({apiKey:d,secretKey:g,apiUrl:f,apiVersion:b}),k=nr({sessionId:i,sessionToken:y,fetcher:(...I)=>O.getToken(...I)});return{actor:n,sessionClaims:t,sessionId:i,session:S,userId:l,user:P,orgId:s,orgRole:o,orgSlug:u,organization:x,getToken:k,debug:it({...e,...r})}}function ot(t){return{sessionClaims:null,sessionId:null,session:null,userId:null,user:null,actor:null,orgId:null,orgRole:null,orgSlug:null,organization:null,getToken:()=>Promise.resolve(null),debug:it(t)}}function nt(t){return t&&(delete t.privateMetadata,delete t.private_metadata),t}function is(t){let e=t.user?{...t.user}:t.user,r=t.organization?{...t.organization}:t.organization;return nt(e),nt(r),{...t,user:e,organization:r}}var ss=t=>{let{debug:e,getToken:r,...n}=t;return n},nr=t=>{let{fetcher:e,sessionToken:r,sessionId:n}=t||{};return async(i={})=>n?i.template?e(n,i.template):r:null};function ir(t){return new Promise(e=>setTimeout(e,t))}var sr=5;async function le(t,e=1,r=sr){try{return await t()}catch(n){if(e>=r)throw n;return await ir(2**e*100),le(t,e+1)}}function j(t){return t.startsWith("test_")||t.startsWith("sk_test_")}function at(t){return t.startsWith("live_")||t.startsWith("sk_live_")}function lt(t){return t.endsWith(".lclstage.dev")||t.endsWith(".stgstage.dev")||t.endsWith(".clerkstage.dev")||t.endsWith(".accountsstage.dev")}function or(){let t=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"],e=new Map;return{isDevOrStagingUrl:r=>{if(!r)return!1;let n=typeof r=="string"?r:r.hostname,i=e.get(n);return i===void 0&&(i=t.some(s=>n.endsWith(s)),e.set(n,i)),i}}}var{isDevOrStagingUrl:Ke}=or();var ut="pk_live_",ar="pk_test_";function ie(t){if(t=t||"",!lr(t))return null;let e=t.startsWith(ut)?"production":"development",r=dt(t.split("_")[2]);return r.endsWith("$")?(r=r.slice(0,-1),{instanceType:e,frontendApi:r}):null}function lr(t){t=t||"";let e=t.startsWith(ut)||t.startsWith(ar),r=dt(t.split("_")[2]||"").endsWith("$");return e&&r}var dt=t=>typeof atob<"u"&&typeof atob=="function"?atob(t):typeof globalThis<"u"&&globalThis.Buffer?new globalThis.Buffer(t,"base64").toString():t;var c=class extends Error{constructor({action:r,message:n,reason:i}){super(n);Object.setPrototypeOf(this,c.prototype),this.reason=i,this.message=n,this.action=r}getFullMessage(){return`${[this.message,this.action].filter(r=>r).join(" ")} (reason=${this.reason}, token-carrier=${this.tokenCarrier})`}};function ur(t){if(!t)return"";let e;if(t.match(/^(clerk\.)+\w*$/))e=/(clerk\.)*(?=clerk\.)/;else{if(t.match(/\.clerk.accounts/))return t;e=/^(clerk\.)*/gi}return`clerk.${t.replace(e,"")}`}function je(t){t.frontendApi=ie(t.publishableKey)?.frontendApi||t.frontendApi||"";let e=Ke(t.frontendApi)?"":ur(t.domain),{debugData:r,frontendApi:n,pkgVersion:i,publishableKey:s,proxyUrl:o,isSatellite:u=!1,domain:l,signInUrl:d}=t;return`
var m=class{constructor(e){this.request=e}requireId(e){if(!e)throw new Error("A valid resource ID is required.")}};var Ce="/",Kt=new RegExp(Ce+"{1,}","g");function a(...t){return t.filter(e=>e).join(Ce).replace(Kt,Ce)}var Ue="/allowlist_identifiers",de=class extends m{async getAllowlistIdentifierList(){return this.request({method:"GET",path:Ue})}async createAllowlistIdentifier(e){return this.request({method:"POST",path:Ue,bodyParams:e})}async deleteAllowlistIdentifier(e){return this.requireId(e),this.request({method:"DELETE",path:a(Ue,e)})}};var Ee="/clients",ce=class extends m{async getClientList(){return this.request({method:"GET",path:Ee})}async getClient(e){return this.requireId(e),this.request({method:"GET",path:a(Ee,e)})}verifyClient(e){return this.request({method:"POST",path:a(Ee,"verify"),bodyParams:{token:e}})}};var pe="/email_addresses",me=class extends m{async getEmailAddress(e){return this.requireId(e),this.request({method:"GET",path:a(pe,e)})}async createEmailAddress(e){return this.request({method:"POST",path:pe,bodyParams:e})}async updateEmailAddress(e,r={}){return this.requireId(e),this.request({method:"PATCH",path:a(pe,e),bodyParams:r})}async deleteEmailAddress(e){return this.requireId(e),this.request({method:"DELETE",path:a(pe,e)})}};var zt="/emails",ge=class extends m{async createEmail(e){return this.request({method:"POST",path:zt,bodyParams:e})}};var fe=class extends m{async getInterstitial(){return this.request({path:"internal/interstitial",method:"GET",headerParams:{"Content-Type":"text/html"}})}};var qe="/invitations",ye=class extends m{async getInvitationList(){return this.request({method:"GET",path:qe})}async createInvitation(e){return this.request({method:"POST",path:qe,bodyParams:e})}async revokeInvitation(e){return this.requireId(e),this.request({method:"POST",path:a(qe,e,"revoke")})}};var w="/organizations",he=class extends m{async getOrganizationList(e){return this.request({method:"GET",path:w,queryParams:e})}async createOrganization(e){return this.request({method:"POST",path:w,bodyParams:e})}async getOrganization(e){let r="organizationId"in e?e.organizationId:e.slug;return this.requireId(r),this.request({method:"GET",path:a(w,r)})}async updateOrganization(e,r){return this.requireId(e),this.request({method:"PATCH",path:a(w,e),bodyParams:r})}async updateOrganizationMetadata(e,r){return this.requireId(e),this.request({method:"PATCH",path:a(w,e,"metadata"),bodyParams:r})}async deleteOrganization(e){return this.request({method:"DELETE",path:a(w,e)})}async getOrganizationMembershipList(e){let{organizationId:r,limit:n,offset:i}=e;return this.requireId(r),this.request({method:"GET",path:a(w,r,"memberships"),queryParams:{limit:n,offset:i}})}async createOrganizationMembership(e){let{organizationId:r,userId:n,role:i}=e;return this.requireId(r),this.request({method:"POST",path:a(w,r,"memberships"),bodyParams:{userId:n,role:i}})}async updateOrganizationMembership(e){let{organizationId:r,userId:n,role:i}=e;return this.requireId(r),this.request({method:"PATCH",path:a(w,r,"memberships",n),bodyParams:{role:i}})}async updateOrganizationMembershipMetadata(e){let{organizationId:r,userId:n,publicMetadata:i,privateMetadata:s}=e;return this.request({method:"PATCH",path:a(w,r,"memberships",n,"metadata"),bodyParams:{publicMetadata:i,privateMetadata:s}})}async deleteOrganizationMembership(e){let{organizationId:r,userId:n}=e;return this.requireId(r),this.request({method:"DELETE",path:a(w,r,"memberships",n)})}async getPendingOrganizationInvitationList(e){let{organizationId:r,limit:n,offset:i}=e;return this.requireId(r),this.request({method:"GET",path:a(w,r,"invitations","pending"),queryParams:{limit:n,offset:i}})}async createOrganizationInvitation(e){let{organizationId:r,...n}=e;return this.requireId(r),this.request({method:"POST",path:a(w,r,"invitations"),bodyParams:{...n}})}async revokeOrganizationInvitation(e){let{organizationId:r,invitationId:n,requestingUserId:i}=e;return this.requireId(r),this.request({method:"POST",path:a(w,r,"invitations",n,"revoke"),bodyParams:{requestingUserId:i}})}};var be="/phone_numbers",Se=class extends m{async getPhoneNumber(e){return this.requireId(e),this.request({method:"GET",path:a(be,e)})}async createPhoneNumber(e){return this.request({method:"POST",path:be,bodyParams:e})}async updatePhoneNumber(e,r={}){return this.requireId(e),this.request({method:"PATCH",path:a(be,e),bodyParams:r})}async deletePhoneNumber(e){return this.requireId(e),this.request({method:"DELETE",path:a(be,e)})}};var Oe="/redirect_urls",ke=class extends m{async getRedirectUrlList(){return this.request({method:"GET",path:Oe})}async getRedirectUrl(e){return this.requireId(e),this.request({method:"GET",path:a(Oe,e)})}async createRedirectUrl(e){return this.request({method:"POST",path:Oe,bodyParams:e})}async deleteRedirectUrl(e){return this.requireId(e),this.request({method:"DELETE",path:a(Oe,e)})}};var se="/sessions",_e=class extends m{async getSessionList(e){return this.request({method:"GET",path:se,queryParams:e})}async getSession(e){return this.requireId(e),this.request({method:"GET",path:a(se,e)})}async revokeSession(e){return this.requireId(e),this.request({method:"POST",path:a(se,e,"revoke")})}async verifySession(e,r){return this.requireId(e),this.request({method:"POST",path:a(se,e,"verify"),bodyParams:{token:r}})}async getToken(e,r){return this.requireId(e),(await this.request({method:"POST",path:a(se,e,"tokens",r||"")})).jwt}};var Ye="/sign_in_tokens",Ie=class extends m{async createSignInToken(e){return this.request({method:"POST",path:Ye,bodyParams:e})}async revokeSignInToken(e){return this.requireId(e),this.request({method:"POST",path:a(Ye,e,"revoke")})}};var jt="/sms_messages",Ae=class extends m{async createSMSMessage(e){return this.request({method:"POST",path:jt,bodyParams:e})}};var T="/users",we=class extends m{async getUserList(e={}){return this.request({method:"GET",path:T,queryParams:e})}async getUser(e){return this.requireId(e),this.request({method:"GET",path:a(T,e)})}async createUser(e){return this.request({method:"POST",path:T,bodyParams:e})}async updateUser(e,r={}){return this.requireId(e),this.request({method:"PATCH",path:a(T,e),bodyParams:r})}async updateUserMetadata(e,r){return this.requireId(e),this.request({method:"PATCH",path:a(T,e,"metadata"),bodyParams:r})}async deleteUser(e){return this.requireId(e),this.request({method:"DELETE",path:a(T,e)})}async getCount(e={}){return this.request({method:"GET",path:a(T,"count"),queryParams:e})}async getUserOauthAccessToken(e,r){return this.requireId(e),this.request({method:"GET",path:a(T,e,"oauth_access_tokens",r)})}async disableUserMFA(e){return this.requireId(e),this.request({method:"DELETE",path:a(T,e,"mfa")})}async getOrganizationMembershipList(e){let{userId:r,limit:n,offset:i}=e;return this.requireId(r),this.request({method:"GET",path:a(T,r,"organization_memberships"),queryParams:{limit:n,offset:i}})}async verifyPassword(e){let{userId:r,password:n}=e;return this.requireId(r),this.request({method:"POST",path:a(T,r,"verify_password"),bodyParams:{password:n}})}async verifyTOTP(e){let{userId:r,code:n}=e;return this.requireId(r),this.request({method:"POST",path:a(T,r,"verify_totp"),bodyParams:{code:n}})}};import Qt from"deepmerge";import tt from"snakecase-keys";var U="https://api.clerk.dev",J="v1",Xe="@clerk/backend";var Wt={AuthStatus:"__clerkAuthStatus",AuthReason:"__clerkAuthReason",AuthMessage:"__clerkAuthMessage"},Lt={Session:"__session",ClientUat:"__client_uat"},Qe={AuthStatus:"x-clerk-auth-status",AuthReason:"x-clerk-auth-reason",AuthMessage:"x-clerk-auth-message",Authorization:"authorization",ForwardedPort:"x-forwarded-port",ForwardedHost:"x-forwarded-host",Referrer:"referer",UserAgent:"user-agent",Origin:"origin",Host:"host",ContentType:"content-type"},Dt={AuthStatus:Qe.AuthStatus},Ft={Json:"application/json"},Vt={Attributes:Wt,Cookies:Lt,Headers:Qe,SearchParams:Dt,ContentTypes:Ft};import $t from"#crypto";import Gt from"#fetch";var Bt=Gt.bind(globalThis),Ht={crypto:$t,fetch:Bt},N=Ht;function Pe(t){if(!t||typeof t!="string")throw Error("Missing Clerk Secret Key or API Key. Go to https://dashboard.clerk.com and get your key for your instance.")}var L=class{constructor(e,r,n,i,s){this.id=e;this.identifier=r;this.createdAt=n;this.updatedAt=i;this.invitationId=s}static fromJSON(e){return new L(e.id,e.identifier,e.created_at,e.updated_at,e.invitation_id)}};var E=class{constructor(e,r,n,i,s,o,u,l,d){this.id=e;this.clientId=r;this.userId=n;this.status=i;this.lastActiveAt=s;this.expireAt=o;this.abandonAt=u;this.createdAt=l;this.updatedAt=d}static fromJSON(e){return new E(e.id,e.client_id,e.user_id,e.status,e.last_active_at,e.expire_at,e.abandon_at,e.created_at,e.updated_at)}};var D=class{constructor(e,r,n,i,s,o,u,l){this.id=e;this.sessionIds=r;this.sessions=n;this.signInId=i;this.signUpId=s;this.lastActiveSessionId=o;this.createdAt=u;this.updatedAt=l}static fromJSON(e){return new D(e.id,e.session_ids,e.sessions.map(r=>E.fromJSON(r)),e.sign_in_id,e.sign_up_id,e.last_active_session_id,e.created_at,e.updated_at)}};var F=class{constructor(e,r,n,i){this.object=e;this.id=r;this.slug=n;this.deleted=i}static fromJSON(e){return new F(e.object,e.id||null,e.slug||null,e.deleted)}};var V=class{constructor(e,r,n,i,s,o,u){this.id=e;this.fromEmailName=r;this.emailAddressId=n;this.toEmailAddress=i;this.subject=s;this.body=o;this.status=u}static fromJSON(e){return new V(e.id,e.from_email_name,e.email_address_id,e.to_email_address,e.subject,e.body,e.status)}};var q=class{constructor(e,r){this.id=e;this.type=r}static fromJSON(e){return new q(e.id,e.type)}};var R=class{constructor(e,r,n=null,i=null,s=null,o=null){this.status=e;this.strategy=r;this.externalVerificationRedirectURL=n;this.attempts=i;this.expireAt=s;this.nonce=o}static fromJSON(e){return new R(e.status,e.strategy,e.external_verification_redirect_url?new URL(e.external_verification_redirect_url):null,e.attempts,e.expire_at,e.nonce)}};var M=class{constructor(e,r,n,i){this.id=e;this.emailAddress=r;this.verification=n;this.linkedTo=i}static fromJSON(e){return new M(e.id,e.email_address,e.verification&&R.fromJSON(e.verification),e.linked_to.map(r=>q.fromJSON(r)))}};var $=class{constructor(e,r,n,i,s,o,u,l,d,g,y={},b,f){this.id=e;this.provider=r;this.identificationId=n;this.externalId=i;this.approvedScopes=s;this.emailAddress=o;this.firstName=u;this.lastName=l;this.picture=d;this.username=g;this.publicMetadata=y;this.label=b;this.verification=f}static fromJSON(e){return new $(e.id,e.provider,e.identification_id,e.provider_user_id,e.approved_scopes,e.email_address,e.first_name,e.last_name,e.avatar_url,e.username,e.public_metadata,e.label,e.verification&&R.fromJSON(e.verification))}};var G=class{constructor(e,r,n,i,s,o,u){this.id=e;this.emailAddress=r;this.publicMetadata=n;this.createdAt=i;this.updatedAt=s;this.status=o;this.revoked=u}static fromJSON(e){return new G(e.id,e.email_address,e.public_metadata,e.created_at,e.updated_at,e.status,e.revoked)}};var Ze=(p=>(p.AllowlistIdentifier="allowlist_identifier",p.Client="client",p.Email="email",p.EmailAddress="email_address",p.ExternalAccount="external_account",p.FacebookAccount="facebook_account",p.GoogleAccount="google_account",p.Invitation="invitation",p.OauthAccessToken="oauth_access_token",p.Organization="organization",p.OrganizationInvitation="organization_invitation",p.OrganizationMembership="organization_membership",p.PhoneNumber="phone_number",p.RedirectUrl="redirect_url",p.Session="session",p.SignInAttempt="sign_in_attempt",p.SignInToken="sign_in_token",p.SignUpAttempt="sign_up_attempt",p.SmsMessage="sms_message",p.User="user",p.Web3Wallet="web3_wallet",p.Token="token",p.TotalCount="total_count",p))(Ze||{});var B=class{constructor(e,r,n={},i,s,o){this.provider=e;this.token=r;this.publicMetadata=n;this.label=i;this.scopes=s;this.tokenSecret=o}static fromJSON(e){return new B(e.provider,e.token,e.public_metadata,e.label,e.scopes,e.token_secret)}};var K=class{constructor(e,r,n,i,s,o,u,l={},d={},g){this.id=e;this.name=r;this.slug=n;this.logoUrl=i;this.createdBy=s;this.createdAt=o;this.updatedAt=u;this.publicMetadata=l;this.privateMetadata=d;this.maxAllowedMemberships=g}static fromJSON(e){return new K(e.id,e.name,e.slug,e.logo_url,e.created_by,e.created_at,e.updated_at,e.public_metadata,e.private_metadata,e.max_allowed_memberships)}};var H=class{constructor(e,r,n,i,s,o,u,l={}){this.id=e;this.emailAddress=r;this.role=n;this.organizationId=i;this.createdAt=s;this.updatedAt=o;this.status=u;this.publicMetadata=l}static fromJSON(e){return new H(e.id,e.email_address,e.role,e.organization_id,e.created_at,e.updated_at,e.status,e.public_metadata)}};var Y=class{constructor(e,r,n={},i={},s,o,u,l){this.id=e;this.role=r;this.publicMetadata=n;this.privateMetadata=i;this.createdAt=s;this.updatedAt=o;this.organization=u;this.publicUserData=l}static fromJSON(e){return new Y(e.id,e.role,e.public_metadata,e.private_metadata,e.created_at,e.updated_at,K.fromJSON(e.organization),oe.fromJSON(e.public_user_data))}},oe=class{constructor(e,r,n,i,s){this.identifier=e;this.firstName=r;this.lastName=n;this.profileImageUrl=i;this.userId=s}static fromJSON(e){return new oe(e.identifier,e.first_name,e.last_name,e.profile_image_url,e.user_id)}};var z=class{constructor(e,r,n,i,s,o){this.id=e;this.phoneNumber=r;this.reservedForSecondFactor=n;this.defaultSecondFactor=i;this.verification=s;this.linkedTo=o}static fromJSON(e){return new z(e.id,e.phone_number,e.reserved_for_second_factor,e.default_second_factor,e.verification&&R.fromJSON(e.verification),e.linked_to.map(r=>q.fromJSON(r)))}};var X=class{constructor(e,r,n,i){this.id=e;this.url=r;this.createdAt=n;this.updatedAt=i}static fromJSON(e){return new X(e.id,e.url,e.created_at,e.updated_at)}};var Q=class{constructor(e,r,n,i,s,o,u){this.id=e;this.userId=r;this.token=n;this.status=i;this.url=s;this.createdAt=o;this.updatedAt=u}static fromJSON(e){return new Q(e.id,e.user_id,e.token,e.status,e.url,e.created_at,e.updated_at)}};var Z=class{constructor(e,r,n,i,s,o){this.id=e;this.fromPhoneNumber=r;this.toPhoneNumber=n;this.message=i;this.status=s;this.phoneNumberId=o}static fromJSON(e){return new Z(e.id,e.from_phone_number,e.to_phone_number,e.message,e.status,e.phone_number_id)}};var ee=class{constructor(e){this.jwt=e}static fromJSON(e){return new ee(e.jwt)}};var te=class{constructor(e,r,n){this.id=e;this.web3Wallet=r;this.verification=n}static fromJSON(e){return new te(e.id,e.web3_wallet,e.verification&&R.fromJSON(e.verification))}};var re=class{constructor(e,r,n,i,s,o,u,l,d,g,y,b,f,S,P,x,O,k,I,A={},_={},h={},p=[],W=[],ue=[],ve=[]){this.id=e;this.passwordEnabled=r;this.totpEnabled=n;this.backupCodeEnabled=i;this.twoFactorEnabled=s;this.banned=o;this.createdAt=u;this.updatedAt=l;this.profileImageUrl=d;this.gender=g;this.birthday=y;this.primaryEmailAddressId=b;this.primaryPhoneNumberId=f;this.primaryWeb3WalletId=S;this.lastSignInAt=P;this.externalId=x;this.username=O;this.firstName=k;this.lastName=I;this.publicMetadata=A;this.privateMetadata=_;this.unsafeMetadata=h;this.emailAddresses=p;this.phoneNumbers=W;this.web3Wallets=ue;this.externalAccounts=ve}static fromJSON(e){return new re(e.id,e.password_enabled,e.totp_enabled,e.backup_code_enabled,e.two_factor_enabled,e.banned,e.created_at,e.updated_at,e.profile_image_url,e.gender,e.birthday,e.primary_email_address_id,e.primary_phone_number_id,e.primary_web3_wallet_id,e.last_sign_in_at,e.external_id,e.username,e.first_name,e.last_name,e.public_metadata,e.private_metadata,e.unsafe_metadata,(e.email_addresses||[]).map(r=>M.fromJSON(r)),(e.phone_numbers||[]).map(r=>z.fromJSON(r)),(e.web3_wallets||[]).map(r=>te.fromJSON(r)),(e.external_accounts||[]).map(r=>$.fromJSON(r)))}};function et(t){return Array.isArray(t)?t.map(e=>Me(e)):Yt(t)?t.data.map(e=>Me(e)):Me(t)}function Yt(t){return t.data!==void 0}function Xt(t){return t.total_count}function Me(t){if(typeof t!="string"&&"object"in t&&"deleted"in t)return F.fromJSON(t);switch(t.object){case"allowlist_identifier":return L.fromJSON(t);case"client":return D.fromJSON(t);case"email_address":return M.fromJSON(t);case"email":return V.fromJSON(t);case"invitation":return G.fromJSON(t);case"oauth_access_token":return B.fromJSON(t);case"organization":return K.fromJSON(t);case"organization_invitation":return H.fromJSON(t);case"organization_membership":return Y.fromJSON(t);case"phone_number":return z.fromJSON(t);case"redirect_url":return X.fromJSON(t);case"sign_in_token":return Q.fromJSON(t);case"session":return E.fromJSON(t);case"sms_message":return Z.fromJSON(t);case"token":return ee.fromJSON(t);case"total_count":return Xt(t);case"user":return re.fromJSON(t);default:return t}}var Zt=t=>async(...e)=>{let{data:r,errors:n,status:i,statusText:s}=await t(...e);if(n===null)return r;throw new ae(s||"",{data:n,status:i||""})};function rt(t){return Zt(async r=>{let{apiKey:n,secretKey:i,apiUrl:s=U,apiVersion:o=J,userAgent:u=Xe,httpOptions:l={}}=t,{path:d,method:g,queryParams:y,headerParams:b,bodyParams:f}=r,S=i||n;Pe(S);let P=a(s,o,d),x=new URL(P);if(y){let _=tt({...y});for(let[h,p]of Object.entries(_))p&&[p].flat().forEach(W=>x.searchParams.append(h,W))}let O={Authorization:`Bearer ${S}`,"Content-Type":"application/json","Clerk-Backend-SDK":u,...b},I=g!=="GET"&&f&&Object.keys(f).length>0?{body:JSON.stringify(tt(f,{deep:!1}))}:null,A;try{A=await N.fetch(x.href,Qt(l,{method:g,headers:O,...I}));let h=await(O&&O["Content-Type"]==="application/json"?A.json():A.text());if(!A.ok)throw h;return{data:et(h),errors:null}}catch(_){return _ instanceof Error?{data:null,errors:[{code:"unexpected_error",message:_.message||"Unexpected error"}]}:{data:null,errors:er(_),status:A?.status,statusText:A?.statusText}}})}function er(t){if(t&&typeof t=="object"&&"errors"in t){let e=t.errors;return e.length>0?e.map(tr):[]}return[]}function tr(t){return{code:t.code,message:t.message,longMessage:t.long_message,meta:{paramName:t?.meta?.param_name,sessionId:t?.meta?.session_id}}}var ae=class extends Error{constructor(r,{data:n,status:i}){super(r);Object.setPrototypeOf(this,ae.prototype),this.clerkError=!0,this.message=r,this.status=i,this.errors=n}};function ne(t){let e=rt(t);return{allowlistIdentifiers:new de(e),clients:new ce(e),emailAddresses:new me(e),emails:new ge(e),interstitial:new fe(e),invitations:new ye(e),organizations:new he(e),phoneNumbers:new Se(e),redirectUrls:new ke(e),sessions:new _e(e),signInTokens:new Ie(e),smsMessages:new Ae(e),users:new we(e)}}var it=t=>()=>{let e={...t};return e.apiKey=(e.apiKey||"").substring(0,7),e.secretKey=(e.secretKey||"").substring(0,7),e.jwtKey=(e.jwtKey||"").substring(0,7),{...e}};function st(t,e,r){let{act:n,sid:i,org_id:s,org_role:o,org_slug:u,sub:l}=t,{apiKey:d,secretKey:g,apiUrl:y,apiVersion:b,token:f,session:S,user:P,organization:x}=e,{sessions:O}=ne({apiKey:d,secretKey:g,apiUrl:y,apiVersion:b}),k=rr({sessionId:i,sessionToken:f,fetcher:(...I)=>O.getToken(...I)});return{actor:n,sessionClaims:t,sessionId:i,session:S,userId:l,user:P,orgId:s,orgRole:o,orgSlug:u,organization:x,getToken:k,debug:it({...e,...r})}}function ot(t){return{sessionClaims:null,sessionId:null,session:null,userId:null,user:null,actor:null,orgId:null,orgRole:null,orgSlug:null,organization:null,getToken:()=>Promise.resolve(null),debug:it(t)}}function nt(t){return t&&(delete t.privateMetadata,delete t.private_metadata),t}function is(t){let e=t.user?{...t.user}:t.user,r=t.organization?{...t.organization}:t.organization;return nt(e),nt(r),{...t,user:e,organization:r}}var ss=t=>{let{debug:e,getToken:r,...n}=t;return n},rr=t=>{let{fetcher:e,sessionToken:r,sessionId:n}=t||{};return async(i={})=>n?i.template?e(n,i.template):r:null};function nr(t){return new Promise(e=>setTimeout(e,t))}var ir=5;async function le(t,e=1,r=ir){try{return await t()}catch(n){if(e>=r)throw n;return await nr(2**e*100),le(t,e+1)}}function j(t){return t.startsWith("test_")||t.startsWith("sk_test_")}function at(t){return t.startsWith("live_")||t.startsWith("sk_live_")}function lt(t){return t.endsWith(".lclstage.dev")||t.endsWith(".stgstage.dev")||t.endsWith(".clerkstage.dev")||t.endsWith(".accountsstage.dev")}function sr(){let t=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"],e=new Map;return{isDevOrStagingUrl:r=>{if(!r)return!1;let n=typeof r=="string"?r:r.hostname,i=e.get(n);return i===void 0&&(i=t.some(s=>n.endsWith(s)),e.set(n,i)),i}}}var{isDevOrStagingUrl:Ke}=sr();var ut="pk_live_",or="pk_test_";function ie(t){if(t=t||"",!ar(t))return null;let e=t.startsWith(ut)?"production":"development",r=dt(t.split("_")[2]);return r.endsWith("$")?(r=r.slice(0,-1),{instanceType:e,frontendApi:r}):null}function ar(t){t=t||"";let e=t.startsWith(ut)||t.startsWith(or),r=dt(t.split("_")[2]||"").endsWith("$");return e&&r}var dt=t=>typeof atob<"u"&&typeof atob=="function"?atob(t):typeof globalThis<"u"&&globalThis.Buffer?new globalThis.Buffer(t,"base64").toString():t;var c=class extends Error{constructor({action:r,message:n,reason:i}){super(n);Object.setPrototypeOf(this,c.prototype),this.reason=i,this.message=n,this.action=r}getFullMessage(){return`${[this.message,this.action].filter(r=>r).join(" ")} (reason=${this.reason}, token-carrier=${this.tokenCarrier})`}};function lr(t){if(!t)return"";let e;if(t.match(/^(clerk\.)+\w*$/))e=/(clerk\.)*(?=clerk\.)/;else{if(t.match(/\.clerk.accounts/))return t;e=/^(clerk\.)*/gi}return`clerk.${t.replace(e,"")}`}function je(t){t.frontendApi=ie(t.publishableKey)?.frontendApi||t.frontendApi||"";let e=Ke(t.frontendApi)?"":lr(t.domain),{debugData:r,frontendApi:n,pkgVersion:i,publishableKey:s,proxyUrl:o,isSatellite:u=!1,domain:l,signInUrl:d}=t;return`
<head>

@@ -57,3 +57,3 @@ <meta charset="UTF-8" />

script.async = true;
script.src = '${dr(o||e||n,i)}';
script.src = '${ur(o||e||n,i)}';
script.crossOrigin = 'anonymous';

@@ -65,3 +65,3 @@ script.addEventListener('load', startClerk);

</body>
`}async function ct(t){t.frontendApi=ie(t.publishableKey)?.frontendApi||t.frontendApi||"";let e=xe(t),r=await le(()=>N.fetch(xe(t)));if(!r.ok)throw new c({action:"Contact support@clerk.com",message:`Error loading Clerk Interstitial from ${e} with code=${r.status}`,reason:"interstitial-remote-failed-to-load"});return r.text()}function xe(t){t.frontendApi=ie(t.publishableKey)?.frontendApi||t.frontendApi||"";let{apiUrl:e,frontendApi:r,pkgVersion:n,publishableKey:i,proxyUrl:s,isSatellite:o,domain:u,signInUrl:l}=t,d=new URL(e);return d.pathname=a(d.pathname,J,"/public/interstitial"),d.searchParams.append("clerk_js_version",pt(r,n)),i?d.searchParams.append("publishable_key",i):d.searchParams.append("frontend_api",r),s&&d.searchParams.append("proxy_url",s),o&&d.searchParams.append("is_satellite","true"),d.searchParams.append("sign_in_url",l||""),Ke(t.frontendApi)||d.searchParams.append("use_domain_for_script","true"),u&&d.searchParams.append("domain",u),d.href}var pt=(t,e)=>!e&&lt(t)?"staging":e?e.includes("next")?"next":e.split(".")[0]||"latest":"latest",dr=(t,e)=>{let r=t.replace(/http(s)?:\/\//,""),n=pt(t,e);return`https://${r}/npm/@clerk/clerk-js@${n}/dist/clerk.browser.js`};var mt=(i=>(i.SignedIn="signed-in",i.SignedOut="signed-out",i.Interstitial="interstitial",i.Unknown="unknown",i))(mt||{});async function We(t,e){let{apiKey:r,secretKey:n,apiUrl:i,apiVersion:s,cookieToken:o,frontendApi:u,proxyUrl:l,publishableKey:d,domain:g,isSatellite:f,headerToken:b,loadSession:y,loadUser:S,loadOrganization:P,signInUrl:x}=t,{sid:O,org_id:k,sub:I}=e,{sessions:A,users:_,organizations:h}=ne({apiKey:r,secretKey:n,apiUrl:i,apiVersion:s}),[p,W,ue]=await Promise.all([y?A.getSession(O):Promise.resolve(void 0),S?_.getUser(I):Promise.resolve(void 0),P&&k?h.getOrganization({organizationId:k}):Promise.resolve(void 0)]),Kt=st(e,{secretKey:n,apiKey:r,apiUrl:i,apiVersion:s,token:o||b||"",session:p,user:W,organization:ue},{...t,status:"signed-in"});return{status:"signed-in",reason:null,message:null,frontendApi:u,proxyUrl:l,publishableKey:d,domain:g,isSatellite:f,signInUrl:x,isSignedIn:!0,isInterstitial:!1,isUnknown:!1,toAuth:()=>Kt}}function v(t,e,r=""){let{frontendApi:n,publishableKey:i,proxyUrl:s,isSatellite:o,domain:u,signInUrl:l}=t;return{status:"signed-out",reason:e,message:r,frontendApi:n,proxyUrl:s,publishableKey:i,isSatellite:o,domain:u,signInUrl:l,isSignedIn:!1,isInterstitial:!1,isUnknown:!1,toAuth:()=>ot({...t,status:"signed-out",reason:e,message:r})}}function U(t,e,r=""){let{frontendApi:n,publishableKey:i,proxyUrl:s,isSatellite:o,domain:u,signInUrl:l}=t;return{status:"interstitial",reason:e,message:r,frontendApi:n,publishableKey:i,isSatellite:o,domain:u,proxyUrl:s,signInUrl:l,isSignedIn:!1,isInterstitial:!0,isUnknown:!1,toAuth:()=>null}}function gt(t,e,r=""){let{frontendApi:n,publishableKey:i,isSatellite:s,domain:o,signInUrl:u}=t;return{status:"unknown",reason:e,message:r,frontendApi:n,publishableKey:i,isSatellite:s,domain:o,signInUrl:u,isSignedIn:!1,isInterstitial:!1,isUnknown:!0,toAuth:()=>null}}function Le({originURL:t,host:e,forwardedHost:r,forwardedPort:n,forwardedProto:i}){if(i&&i!==t.protocol)return!0;let s=cr(r||e);return s.port=n||s.port,s.port!==t.port||s.hostname!==t.hostname}function cr(t){return new URL(`https://${t}`)}var Re={parse(t,e){return pr(t,ft,e)},stringify(t,e){return mr(t,ft,e)}},ft={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bits:6};function pr(t,e,r={}){if(!e.codes){e.codes={};for(let l=0;l<e.chars.length;++l)e.codes[e.chars[l]]=l}if(!r.loose&&t.length*e.bits&7)throw new SyntaxError("Invalid padding");let n=t.length;for(;t[n-1]==="=";)if(--n,!r.loose&&!((t.length-n)*e.bits&7))throw new SyntaxError("Invalid padding");let i=new(r.out??Uint8Array)(n*e.bits/8|0),s=0,o=0,u=0;for(let l=0;l<n;++l){let d=e.codes[t[l]];if(d===void 0)throw new SyntaxError("Invalid character "+t[l]);o=o<<e.bits|d,s+=e.bits,s>=8&&(s-=8,i[u++]=255&o>>s)}if(s>=e.bits||255&o<<8-s)throw new SyntaxError("Unexpected end of data");return i}function mr(t,e,r={}){let{pad:n=!0}=r,i=(1<<e.bits)-1,s="",o=0,u=0;for(let l=0;l<t.length;++l)for(u=u<<8|255&t[l],o+=8;o>e.bits;)o-=e.bits,s+=e.chars[i&u>>o];if(o&&(s+=e.chars[i&u<<e.bits-o]),n)for(;s.length*e.bits&7;)s+="=";return s}var gr=2*1e3,Ve={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512",ES256:"SHA-256",ES384:"SHA-384",ES512:"SHA-512"},De="RSASSA-PKCS1-v1_5",Fe="ECDSA",fr={RS256:De,RS384:De,RS512:De,ES256:Fe,ES384:Fe,ES512:Fe},yr=Object.keys(Ve);async function hr(t,e){let{header:r,signature:n,raw:i}=t,o=new TextEncoder().encode([i.header,i.payload].join(".")),u=await N.crypto.subtle.importKey("jwk",e,{name:fr[r.alg],hash:Ve[r.alg]},!1,["verify"]);return N.crypto.subtle.verify("RSASSA-PKCS1-v1_5",u,n,o)}function $e(t){let e=(t||"").toString().split(".");if(e.length!==3)throw new c({reason:"token-invalid",message:"Invalid JWT form. A JWT consists of three parts separated by dots."});let[r,n,i]=e,s=new TextDecoder,o=JSON.parse(s.decode(Re.parse(r,{loose:!0}))),u=JSON.parse(s.decode(Re.parse(n,{loose:!0}))),l=Re.parse(i,{loose:!0});return{header:o,payload:u,signature:l,raw:{header:r,payload:n,signature:i,text:t}}}async function yt(t,{audience:e,authorizedParties:r,clockSkewInSeconds:n=gr,issuer:i,key:s}){let o=$e(t),{header:u,payload:l}=o,{typ:d,alg:g}=u;if(typeof d<"u"&&d!=="JWT")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-invalid",message:`Invalid JWT type ${JSON.stringify(d)}. Expected "JWT".`});if(!Ve[g])throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-invalid-algorithm",message:`Invalid JWT algorithm ${JSON.stringify(g)}. Supported: ${yr}.`});let{azp:f,sub:b,aud:y,iss:S,iat:P,exp:x,nbf:O}=l;if(typeof b!="string")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Subject claim (sub) is required and must be a string. Received ${JSON.stringify(b)}.`});if(typeof y=="string"){if(y!==e)throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT audience claim (aud) ${JSON.stringify(y)}. Expected "${e}".`})}else if(Array.isArray(y)&&y.length>0&&y.every(h=>typeof h=="string")&&!y.includes(e))throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT audience claim array (aud) ${JSON.stringify(y)}. Does not include "${e}".`});if(f&&r&&r.length>0&&!r.includes(f))throw new c({reason:"token-invalid-authorized-parties",message:`Invalid JWT Authorized party claim (azp) ${JSON.stringify(f)}. Expected "${r}".`});if(typeof i=="function"&&!i(S))throw new c({reason:"token-invalid-issuer",message:"Failed JWT issuer resolver. Make sure that the resolver returns a truthy value."});if(typeof i=="string"&&S&&S!==i)throw new c({reason:"token-invalid-issuer",message:`Invalid JWT issuer claim (iss) ${JSON.stringify(o.payload.iss)}. Expected "${i}".`});if(typeof x!="number")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT expiry date claim (exp) ${JSON.stringify(x)}. Expected number.`});let k=new Date(Date.now()),I=new Date(0);if(I.setUTCSeconds(x),I.getTime()<=k.getTime()-n)throw new c({reason:"token-expired",message:`JWT is expired. Expiry date: ${I}, Current date: ${k}.`});if(O!==void 0){if(typeof O!="number")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT not before date claim (nbf) ${JSON.stringify(O)}. Expected number.`});let h=new Date(0);if(h.setUTCSeconds(O),h.getTime()>k.getTime()+n)throw new c({reason:"token-not-active-yet",message:`JWT cannot be used prior to not before date claim (nbf). Not before date: ${h}; Current date: ${k};`})}if(P!==void 0){if(typeof P!="number")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT issued at date claim (iat) ${JSON.stringify(P)}. Expected number.`});let h=new Date(0);if(h.setUTCSeconds(P),h.getTime()>k.getTime()+n)throw new c({reason:"token-not-active-yet",message:`JWT issued at date claim (iat) is in the future. Issued at date: ${h}; Current date: ${k};`})}let _;try{_=await hr(o,s)}catch(h){throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Error verifying JWT signature. ${h}`})}if(!_)throw new c({reason:"token-invalid-signature",message:"JWT signature is invalid."});return l}var Je={},bt=0;function Ne(t){return Je[t]}function St(t,e=1e3*60*60){Je[t.kid]=t,bt=Date.now(),e>=0&&setTimeout(()=>{t?delete Je[t.kid]:Je={}},e)}var ht="local",Sr="-----BEGIN PUBLIC KEY-----",Or="-----END PUBLIC KEY-----",kr="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA",_r="IDAQAB";function Ot(t){if(!Ne(ht)){if(!t)throw new c({action:"Set the CLERK_JWT_KEY environment variable.",message:"Missing local JWK.",reason:"jwk-local-missing"});let e=t.replace(/(\r\n|\n|\r)/gm,"").replace(Sr,"").replace(Or,"").replace(kr,"").replace(_r,"").replace(/\+/g,"-").replace(/\//g,"_");St({kid:"local",kty:"RSA",alg:"RS256",n:e,e:"AQAB"},-1)}return Ne(ht)}async function Ge({apiKey:t,secretKey:e,apiUrl:r=C,apiVersion:n=J,issuer:i,kid:s,jwksCacheTtlInMs:o=1e3*60*60,skipJwksCache:u}){let l=!Ne(s)&&wr();if(u||l){let g,f=e||t;if(f)g=()=>Ar(r,f,n);else if(i)g=()=>Ir(i);else throw new c({action:"Contact support@clerk.com",message:"Failed to load JWKS from Clerk Backend or Frontend API.",reason:"jwk-remote-failed-to-load"});let{keys:b}=await le(g);if(!b||!b.length)throw new c({action:"Contact support@clerk.com",message:"The JWKS endpoint did not contain any signing keys. Contact support@clerk.com.",reason:"jwk-remote-failed-to-load"});b.forEach(y=>St(y,o))}let d=Ne(s);if(!d)throw new c({action:"Contact support@clerk.com",message:`Unable to find a signing key in JWKS that matches kid='${s}'.`,reason:"jwk-remote-missing"});return d}async function Ir(t){let e=new URL(t);e.pathname=a(e.pathname,".well-known/jwks.json");let r=await N.fetch(e.href);if(!r.ok)throw new c({action:"Contact support@clerk.com",message:`Error loading Clerk JWKS from ${e.href} with code=${r.status}`,reason:"jwk-remote-failed-to-load"});return r.json()}async function Ar(t,e,r){if(!e)throw new c({action:"Set the CLERK_SECRET_KEY or CLERK_API_KEY environment variable.",message:"Missing Clerk Secret Key or API Key. Go to https://dashboard.clerk.com and get your key for your instance.",reason:"jwk-remote-failed-to-load"});let n=new URL(t);n.pathname=a(n.pathname,r,"/jwks");let i=await N.fetch(n.href,{headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok)throw new c({action:"Contact support@clerk.com",message:`Error loading Clerk JWKS from ${n.href} with code=${i.status}`,reason:"jwk-remote-failed-to-load"});return i.json()}function wr(){return Date.now()-bt>=300*1e3}async function kt(t,e){let{apiKey:r,secretKey:n,apiUrl:i,apiVersion:s,authorizedParties:o,clockSkewInSeconds:u,issuer:l,jwksCacheTtlInMs:d,jwtKey:g,skipJwksCache:f}=e,{header:b}=$e(t),{kid:y}=b,S;if(g)S=Ot(g);else if(typeof l=="string")S=await Ge({issuer:l,kid:y,jwksCacheTtlInMs:d,skipJwksCache:f});else if(r||n)S=await Ge({apiKey:r,secretKey:n,apiUrl:i,apiVersion:s,kid:y,jwksCacheTtlInMs:d,skipJwksCache:f});else throw new c({action:"Set the CLERK_JWT_KEY environment variable.",message:"Failed to resolve JWK during verification.",reason:"jwk-failed-to-resolve"});return await yt(t,{authorizedParties:o,clockSkewInSeconds:u,key:S,issuer:l})}var xr=t=>!!t?.get("__clerk_satellite_url"),_t=t=>t?.get("__clerk_synced")==="true",It=t=>{let{apiKey:e,secretKey:r,userAgent:n}=t;if(j(r||e)&&!n?.startsWith("Mozilla/"))return v(t,"header-missing-non-browser")},At=t=>{let{origin:e,host:r,forwardedHost:n,forwardedPort:i,forwardedProto:s}=t;if(e&&Le({originURL:new URL(e),host:r,forwardedHost:n,forwardedPort:i,forwardedProto:s}))return v(t,"header-missing-cors")},wt=t=>{let{apiKey:e,secretKey:r,isSatellite:n,searchParams:i}=t;if(j(r||e)&&!n&&xr(i))return U(t,"primary-responds-to-syncing")},Pt=t=>{let{apiKey:e,secretKey:r,clientUat:n}=t;if(j(r||e)&&!n)return U(t,"uat-missing")},xt=t=>{let{apiKey:e,secretKey:r,referrer:n,host:i,forwardedHost:s,forwardedPort:o,forwardedProto:u,isSatellite:l,searchParams:d}=t,g=n&&Le({originURL:new URL(n),host:i,forwardedHost:s,forwardedPort:o,forwardedProto:u}),f=r||e;if(!l&&!_t(d)&&j(f)&&g)return U(t,"cross-origin-referrer")},Tt=t=>{let{apiKey:e,secretKey:r,clientUat:n,cookieToken:i}=t;if(at(r||e)&&!n&&!i)return v(t,"cookie-and-uat-missing")},Rt=t=>{let{clientUat:e}=t;if(e==="0")return v(t,"standard-signed-out")},Jt=t=>{let{clientUat:e,cookieToken:r}=t;if(e&&Number.parseInt(e)>0&&!r)return U(t,"cookie-missing")},Nt=async t=>{let{headerToken:e}=t,r=await Ut(t,e);return await We(t,r)},vt=async t=>{let{cookieToken:e,clientUat:r}=t,n=await Ut(t,e),i=await We(t,n),o=i.toAuth().sessionClaims.iat<Number.parseInt(r);return!r||o?U(t,"cookie-outdated"):i};async function Be(t,e){for(let r of e){let n=await r(t);if(n)return n}return v(t,"unexpected-error")}async function Ut(t,e){let{isSatellite:r,proxyUrl:n}=t,i;return r?i=null:n?i=n:i=s=>s.startsWith("https://clerk.")||s.includes(".clerk.accounts"),kt(e,{...t,issuer:i})}var Ct=t=>{let{clientUat:e,isSatellite:r,searchParams:n,secretKey:i,apiKey:s}=t,u=j(i||s);if(r&&(!e||e==="0")&&!_t(n)&&!u)return U(t,"satellite-needs-syncing")};function Tr(t,e){if(!t&&j(e))throw new Error("Missing signInUrl. Pass a signInUrl for dev instances if an app is satellite")}function Rr(t){if(!t)throw new Error("Missing domain and proxyUrl. A satellite application needs to specify a domain or a proxyUrl")}async function Et(t){t.frontendApi=ie(t.publishableKey)?.frontendApi||t.frontendApi||"",t.apiUrl=t.apiUrl||C,t.apiVersion=t.apiVersion||J,Pe(t.secretKey||t.apiKey),t.isSatellite&&(Tr(t.signInUrl,t.secretKey||t.apiKey),Rr(t.proxyUrl||t.domain));async function e(){try{return await Be(t,[Nt])}catch(i){return n(i,"header")}}async function r(){try{return await Be(t,[At,It,Ct,wt,Tt,Pt,xt,Jt,Rt,vt])}catch(i){return n(i,"cookie")}}function n(i,s){return i instanceof c?(i.tokenCarrier=s,["token-expired","token-not-active-yet"].includes(i.reason)?s==="header"?gt(t,i.reason,i.getFullMessage()):U(t,i.reason,i.getFullMessage()):v(t,i.reason,i.getFullMessage())):v(t,"unexpected-error",i.message)}return t.headerToken?e():r()}var He=t=>{let{frontendApi:e,isSignedIn:r,proxyUrl:n,isInterstitial:i,reason:s,message:o,publishableKey:u,isSatellite:l,domain:d}=t;return{frontendApi:e,isSignedIn:r,proxyUrl:n,isInterstitial:i,reason:s,message:o,publishableKey:u,isSatellite:l,domain:d}};function qt(t){let{apiClient:e}=t,{apiKey:r="",secretKey:n="",jwtKey:i="",apiUrl:s=C,apiVersion:o=J,frontendApi:u="",proxyUrl:l="",publishableKey:d="",isSatellite:g=!1,domain:f=""}=t.options;return{authenticateRequest:({apiKey:O,secretKey:k,frontendApi:I,proxyUrl:A,publishableKey:_,jwtKey:h,isSatellite:p,domain:W,searchParams:ue,...ve})=>Et({...ve,apiKey:O||r,secretKey:k||n,apiUrl:s,apiVersion:o,frontendApi:I||u,proxyUrl:A||l,publishableKey:_||d,isSatellite:p||g,domain:W||f,jwtKey:h||i,searchParams:ue}),localInterstitial:je,remotePublicInterstitial:({frontendApi:O,publishableKey:k,proxyUrl:I,isSatellite:A,domain:_,...h})=>ct({...h,apiUrl:s,frontendApi:O||u,publishableKey:k||d,proxyUrl:I||l,isSatellite:A||g,domain:_||f}),remotePrivateInterstitial:()=>e.interstitial.getInterstitial(),remotePublicInterstitialUrl:xe,debugRequestState:He}}function yo(t){let e={...t},r=ne(e),n=qt({options:e,apiClient:r});return{...r,...n,__unstable_options:e}}export{L as AllowlistIdentifier,mt as AuthStatus,yo as Clerk,D as Client,F as DeletedObject,V as Email,M as EmailAddress,$ as ExternalAccount,q as IdentificationLink,G as Invitation,B as OauthAccessToken,Ze as ObjectType,K as Organization,H as OrganizationInvitation,Y as OrganizationMembership,oe as OrganizationMembershipPublicUserData,z as PhoneNumber,X as RedirectUrl,Z as SMSMessage,E as Session,Q as SignInToken,ee as Token,re as User,R as Verification,$t as constants,qt as createAuthenticateRequest,He as debugRequestState,$e as decodeJwt,et as deserialize,hr as hasValidSignature,je as loadInterstitialFromLocal,ss as makeAuthObjectSerializable,nt as prunePrivateMetadata,is as sanitizeAuthObject,st as signedInAuthObject,ot as signedOutAuthObject,yt as verifyJwt,kt as verifyToken};
`}async function ct(t){t.frontendApi=ie(t.publishableKey)?.frontendApi||t.frontendApi||"";let e=xe(t),r=await le(()=>N.fetch(xe(t)));if(!r.ok)throw new c({action:"Contact support@clerk.com",message:`Error loading Clerk Interstitial from ${e} with code=${r.status}`,reason:"interstitial-remote-failed-to-load"});return r.text()}function xe(t){t.frontendApi=ie(t.publishableKey)?.frontendApi||t.frontendApi||"";let{apiUrl:e,frontendApi:r,pkgVersion:n,publishableKey:i,proxyUrl:s,isSatellite:o,domain:u,signInUrl:l}=t,d=new URL(e);return d.pathname=a(d.pathname,J,"/public/interstitial"),d.searchParams.append("clerk_js_version",pt(r,n)),i?d.searchParams.append("publishable_key",i):d.searchParams.append("frontend_api",r),s&&d.searchParams.append("proxy_url",s),o&&d.searchParams.append("is_satellite","true"),d.searchParams.append("sign_in_url",l||""),Ke(t.frontendApi)||d.searchParams.append("use_domain_for_script","true"),u&&d.searchParams.append("domain",u),d.href}var pt=(t,e)=>!e&&lt(t)?"staging":e?e.includes("next")?"next":e.split(".")[0]||"latest":"latest",ur=(t,e)=>{let r=t.replace(/http(s)?:\/\//,""),n=pt(t,e);return`https://${r}/npm/@clerk/clerk-js@${n}/dist/clerk.browser.js`};var mt=(i=>(i.SignedIn="signed-in",i.SignedOut="signed-out",i.Interstitial="interstitial",i.Unknown="unknown",i))(mt||{});async function We(t,e){let{apiKey:r,secretKey:n,apiUrl:i,apiVersion:s,cookieToken:o,frontendApi:u,proxyUrl:l,publishableKey:d,domain:g,isSatellite:y,headerToken:b,loadSession:f,loadUser:S,loadOrganization:P,signInUrl:x}=t,{sid:O,org_id:k,sub:I}=e,{sessions:A,users:_,organizations:h}=ne({apiKey:r,secretKey:n,apiUrl:i,apiVersion:s}),[p,W,ue]=await Promise.all([f?A.getSession(O):Promise.resolve(void 0),S?_.getUser(I):Promise.resolve(void 0),P&&k?h.getOrganization({organizationId:k}):Promise.resolve(void 0)]),Mt=st(e,{secretKey:n,apiKey:r,apiUrl:i,apiVersion:s,token:o||b||"",session:p,user:W,organization:ue},{...t,status:"signed-in"});return{status:"signed-in",reason:null,message:null,frontendApi:u,proxyUrl:l,publishableKey:d,domain:g,isSatellite:y,signInUrl:x,isSignedIn:!0,isInterstitial:!1,isUnknown:!1,toAuth:()=>Mt}}function v(t,e,r=""){let{frontendApi:n,publishableKey:i,proxyUrl:s,isSatellite:o,domain:u,signInUrl:l}=t;return{status:"signed-out",reason:e,message:r,frontendApi:n,proxyUrl:s,publishableKey:i,isSatellite:o,domain:u,signInUrl:l,isSignedIn:!1,isInterstitial:!1,isUnknown:!1,toAuth:()=>ot({...t,status:"signed-out",reason:e,message:r})}}function C(t,e,r=""){let{frontendApi:n,publishableKey:i,proxyUrl:s,isSatellite:o,domain:u,signInUrl:l}=t;return{status:"interstitial",reason:e,message:r,frontendApi:n,publishableKey:i,isSatellite:o,domain:u,proxyUrl:s,signInUrl:l,isSignedIn:!1,isInterstitial:!0,isUnknown:!1,toAuth:()=>null}}function gt(t,e,r=""){let{frontendApi:n,publishableKey:i,isSatellite:s,domain:o,signInUrl:u}=t;return{status:"unknown",reason:e,message:r,frontendApi:n,publishableKey:i,isSatellite:s,domain:o,signInUrl:u,isSignedIn:!1,isInterstitial:!1,isUnknown:!0,toAuth:()=>null}}function Le({originURL:t,host:e,forwardedHost:r,forwardedPort:n,forwardedProto:i}){if(i&&i!==t.protocol)return!0;let s=dr(r||e);return s.port=n||s.port,s.port!==t.port||s.hostname!==t.hostname}function dr(t){return new URL(`https://${t}`)}var Re={parse(t,e){return cr(t,ft,e)},stringify(t,e){return pr(t,ft,e)}},ft={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bits:6};function cr(t,e,r={}){if(!e.codes){e.codes={};for(let l=0;l<e.chars.length;++l)e.codes[e.chars[l]]=l}if(!r.loose&&t.length*e.bits&7)throw new SyntaxError("Invalid padding");let n=t.length;for(;t[n-1]==="=";)if(--n,!r.loose&&!((t.length-n)*e.bits&7))throw new SyntaxError("Invalid padding");let i=new(r.out??Uint8Array)(n*e.bits/8|0),s=0,o=0,u=0;for(let l=0;l<n;++l){let d=e.codes[t[l]];if(d===void 0)throw new SyntaxError("Invalid character "+t[l]);o=o<<e.bits|d,s+=e.bits,s>=8&&(s-=8,i[u++]=255&o>>s)}if(s>=e.bits||255&o<<8-s)throw new SyntaxError("Unexpected end of data");return i}function pr(t,e,r={}){let{pad:n=!0}=r,i=(1<<e.bits)-1,s="",o=0,u=0;for(let l=0;l<t.length;++l)for(u=u<<8|255&t[l],o+=8;o>e.bits;)o-=e.bits,s+=e.chars[i&u>>o];if(o&&(s+=e.chars[i&u<<e.bits-o]),n)for(;s.length*e.bits&7;)s+="=";return s}var mr=2*1e3,Ve={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512",ES256:"SHA-256",ES384:"SHA-384",ES512:"SHA-512"},De="RSASSA-PKCS1-v1_5",Fe="ECDSA",gr={RS256:De,RS384:De,RS512:De,ES256:Fe,ES384:Fe,ES512:Fe},fr=Object.keys(Ve);async function yr(t,e){let{header:r,signature:n,raw:i}=t,o=new TextEncoder().encode([i.header,i.payload].join(".")),u=await N.crypto.subtle.importKey("jwk",e,{name:gr[r.alg],hash:Ve[r.alg]},!1,["verify"]);return N.crypto.subtle.verify("RSASSA-PKCS1-v1_5",u,n,o)}function $e(t){let e=(t||"").toString().split(".");if(e.length!==3)throw new c({reason:"token-invalid",message:"Invalid JWT form. A JWT consists of three parts separated by dots."});let[r,n,i]=e,s=new TextDecoder,o=JSON.parse(s.decode(Re.parse(r,{loose:!0}))),u=JSON.parse(s.decode(Re.parse(n,{loose:!0}))),l=Re.parse(i,{loose:!0});return{header:o,payload:u,signature:l,raw:{header:r,payload:n,signature:i,text:t}}}async function yt(t,{audience:e,authorizedParties:r,clockSkewInSeconds:n=mr,issuer:i,key:s}){let o=$e(t),{header:u,payload:l}=o,{typ:d,alg:g}=u;if(typeof d<"u"&&d!=="JWT")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-invalid",message:`Invalid JWT type ${JSON.stringify(d)}. Expected "JWT".`});if(!Ve[g])throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-invalid-algorithm",message:`Invalid JWT algorithm ${JSON.stringify(g)}. Supported: ${fr}.`});let{azp:y,sub:b,aud:f,iss:S,iat:P,exp:x,nbf:O}=l;if(typeof b!="string")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Subject claim (sub) is required and must be a string. Received ${JSON.stringify(b)}.`});if(typeof f=="string"){if(f!==e)throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT audience claim (aud) ${JSON.stringify(f)}. Expected "${e}".`})}else if(Array.isArray(f)&&f.length>0&&f.every(h=>typeof h=="string")&&!f.includes(e))throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT audience claim array (aud) ${JSON.stringify(f)}. Does not include "${e}".`});if(y&&r&&r.length>0&&!r.includes(y))throw new c({reason:"token-invalid-authorized-parties",message:`Invalid JWT Authorized party claim (azp) ${JSON.stringify(y)}. Expected "${r}".`});if(typeof i=="function"&&!i(S))throw new c({reason:"token-invalid-issuer",message:"Failed JWT issuer resolver. Make sure that the resolver returns a truthy value."});if(typeof i=="string"&&S&&S!==i)throw new c({reason:"token-invalid-issuer",message:`Invalid JWT issuer claim (iss) ${JSON.stringify(o.payload.iss)}. Expected "${i}".`});if(typeof x!="number")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT expiry date claim (exp) ${JSON.stringify(x)}. Expected number.`});let k=new Date(Date.now()),I=new Date(0);if(I.setUTCSeconds(x),I.getTime()<=k.getTime()-n)throw new c({reason:"token-expired",message:`JWT is expired. Expiry date: ${I}, Current date: ${k}.`});if(O!==void 0){if(typeof O!="number")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT not before date claim (nbf) ${JSON.stringify(O)}. Expected number.`});let h=new Date(0);if(h.setUTCSeconds(O),h.getTime()>k.getTime()+n)throw new c({reason:"token-not-active-yet",message:`JWT cannot be used prior to not before date claim (nbf). Not before date: ${h}; Current date: ${k};`})}if(P!==void 0){if(typeof P!="number")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT issued at date claim (iat) ${JSON.stringify(P)}. Expected number.`});let h=new Date(0);if(h.setUTCSeconds(P),h.getTime()>k.getTime()+n)throw new c({reason:"token-not-active-yet",message:`JWT issued at date claim (iat) is in the future. Issued at date: ${h}; Current date: ${k};`})}let _;try{_=await yr(o,s)}catch(h){throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Error verifying JWT signature. ${h}`})}if(!_)throw new c({reason:"token-invalid-signature",message:"JWT signature is invalid."});return l}var Je={},bt=0;function Ne(t){return Je[t]}function St(t,e=1e3*60*60){Je[t.kid]=t,bt=Date.now(),e>=0&&setTimeout(()=>{t?delete Je[t.kid]:Je={}},e)}var ht="local",br="-----BEGIN PUBLIC KEY-----",Sr="-----END PUBLIC KEY-----",Or="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA",kr="IDAQAB";function Ot(t){if(!Ne(ht)){if(!t)throw new c({action:"Set the CLERK_JWT_KEY environment variable.",message:"Missing local JWK.",reason:"jwk-local-missing"});let e=t.replace(/(\r\n|\n|\r)/gm,"").replace(br,"").replace(Sr,"").replace(Or,"").replace(kr,"").replace(/\+/g,"-").replace(/\//g,"_");St({kid:"local",kty:"RSA",alg:"RS256",n:e,e:"AQAB"},-1)}return Ne(ht)}async function Ge({apiKey:t,secretKey:e,apiUrl:r=U,apiVersion:n=J,issuer:i,kid:s,jwksCacheTtlInMs:o=1e3*60*60,skipJwksCache:u}){let l=!Ne(s)&&Ar();if(u||l){let g,y=e||t;if(y)g=()=>Ir(r,y,n);else if(i)g=()=>_r(i);else throw new c({action:"Contact support@clerk.com",message:"Failed to load JWKS from Clerk Backend or Frontend API.",reason:"jwk-remote-failed-to-load"});let{keys:b}=await le(g);if(!b||!b.length)throw new c({action:"Contact support@clerk.com",message:"The JWKS endpoint did not contain any signing keys. Contact support@clerk.com.",reason:"jwk-remote-failed-to-load"});b.forEach(f=>St(f,o))}let d=Ne(s);if(!d)throw new c({action:"Contact support@clerk.com",message:`Unable to find a signing key in JWKS that matches kid='${s}'.`,reason:"jwk-remote-missing"});return d}async function _r(t){let e=new URL(t);e.pathname=a(e.pathname,".well-known/jwks.json");let r=await N.fetch(e.href);if(!r.ok)throw new c({action:"Contact support@clerk.com",message:`Error loading Clerk JWKS from ${e.href} with code=${r.status}`,reason:"jwk-remote-failed-to-load"});return r.json()}async function Ir(t,e,r){if(!e)throw new c({action:"Set the CLERK_SECRET_KEY or CLERK_API_KEY environment variable.",message:"Missing Clerk Secret Key or API Key. Go to https://dashboard.clerk.com and get your key for your instance.",reason:"jwk-remote-failed-to-load"});let n=new URL(t);n.pathname=a(n.pathname,r,"/jwks");let i=await N.fetch(n.href,{headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}});if(!i.ok)throw new c({action:"Contact support@clerk.com",message:`Error loading Clerk JWKS from ${n.href} with code=${i.status}`,reason:"jwk-remote-failed-to-load"});return i.json()}function Ar(){return Date.now()-bt>=300*1e3}async function kt(t,e){let{apiKey:r,secretKey:n,apiUrl:i,apiVersion:s,authorizedParties:o,clockSkewInSeconds:u,issuer:l,jwksCacheTtlInMs:d,jwtKey:g,skipJwksCache:y}=e,{header:b}=$e(t),{kid:f}=b,S;if(g)S=Ot(g);else if(typeof l=="string")S=await Ge({issuer:l,kid:f,jwksCacheTtlInMs:d,skipJwksCache:y});else if(r||n)S=await Ge({apiKey:r,secretKey:n,apiUrl:i,apiVersion:s,kid:f,jwksCacheTtlInMs:d,skipJwksCache:y});else throw new c({action:"Set the CLERK_JWT_KEY environment variable.",message:"Failed to resolve JWK during verification.",reason:"jwk-failed-to-resolve"});return await yt(t,{authorizedParties:o,clockSkewInSeconds:u,key:S,issuer:l})}var Pr=t=>!!t?.get("__clerk_satellite_url"),_t=t=>t?.get("__clerk_synced")==="true",It=t=>{let{apiKey:e,secretKey:r,userAgent:n}=t;if(j(r||e)&&!n?.startsWith("Mozilla/"))return v(t,"header-missing-non-browser")},At=t=>{let{origin:e,host:r,forwardedHost:n,forwardedPort:i,forwardedProto:s}=t;if(e&&Le({originURL:new URL(e),host:r,forwardedHost:n,forwardedPort:i,forwardedProto:s}))return v(t,"header-missing-cors")},wt=t=>{let{apiKey:e,secretKey:r,isSatellite:n,searchParams:i}=t;if(j(r||e)&&!n&&Pr(i))return C(t,"primary-responds-to-syncing")},Pt=t=>{let{apiKey:e,secretKey:r,clientUat:n}=t;if(j(r||e)&&!n)return C(t,"uat-missing")},xt=t=>{let{apiKey:e,secretKey:r,referrer:n,host:i,forwardedHost:s,forwardedPort:o,forwardedProto:u,isSatellite:l,searchParams:d}=t,g=n&&Le({originURL:new URL(n),host:i,forwardedHost:s,forwardedPort:o,forwardedProto:u}),y=r||e;if(!l&&!_t(d)&&j(y)&&g)return C(t,"cross-origin-referrer")},Tt=t=>{let{apiKey:e,secretKey:r,clientUat:n,cookieToken:i}=t;if(at(r||e)&&!n&&!i)return v(t,"cookie-and-uat-missing")},Rt=t=>{let{clientUat:e}=t;if(e==="0")return v(t,"standard-signed-out")},Jt=t=>{let{clientUat:e,cookieToken:r}=t;if(e&&Number.parseInt(e)>0&&!r)return C(t,"cookie-missing")},Nt=async t=>{let{headerToken:e}=t,r=await Ct(t,e);return await We(t,r)},vt=async t=>{let{cookieToken:e,clientUat:r}=t,n=await Ct(t,e),i=await We(t,n),o=i.toAuth().sessionClaims.iat<Number.parseInt(r);return!r||o?C(t,"cookie-outdated"):i};async function Be(t,e){for(let r of e){let n=await r(t);if(n)return n}return v(t,"unexpected-error")}async function Ct(t,e){let{isSatellite:r,proxyUrl:n}=t,i;return r?i=null:n?i=n:i=s=>s.startsWith("https://clerk.")||s.includes(".clerk.accounts"),kt(e,{...t,issuer:i})}var Ut=t=>{let{clientUat:e,isSatellite:r,searchParams:n,secretKey:i,apiKey:s}=t,u=j(i||s);if(r&&(!e||e==="0")&&!_t(n)&&!u)return C(t,"satellite-needs-syncing")};function xr(t,e){if(!t&&j(e))throw new Error("Missing signInUrl. Pass a signInUrl for dev instances if an app is satellite")}function Tr(t){if(!t)throw new Error("Missing domain and proxyUrl. A satellite application needs to specify a domain or a proxyUrl")}async function Et(t){t.frontendApi=ie(t.publishableKey)?.frontendApi||t.frontendApi||"",t.apiUrl=t.apiUrl||U,t.apiVersion=t.apiVersion||J,Pe(t.secretKey||t.apiKey),t.isSatellite&&(xr(t.signInUrl,t.secretKey||t.apiKey),Tr(t.proxyUrl||t.domain));async function e(){try{return await Be(t,[Nt])}catch(i){return n(i,"header")}}async function r(){try{return await Be(t,[At,It,Ut,wt,Tt,Pt,xt,Jt,Rt,vt])}catch(i){return n(i,"cookie")}}function n(i,s){return i instanceof c?(i.tokenCarrier=s,["token-expired","token-not-active-yet"].includes(i.reason)?s==="header"?gt(t,i.reason,i.getFullMessage()):C(t,i.reason,i.getFullMessage()):v(t,i.reason,i.getFullMessage())):v(t,"unexpected-error",i.message)}return t.headerToken?e():r()}var He=t=>{let{frontendApi:e,isSignedIn:r,proxyUrl:n,isInterstitial:i,reason:s,message:o,publishableKey:u,isSatellite:l,domain:d}=t;return{frontendApi:e,isSignedIn:r,proxyUrl:n,isInterstitial:i,reason:s,message:o,publishableKey:u,isSatellite:l,domain:d}};function qt(t){let{apiClient:e}=t,{apiKey:r="",secretKey:n="",jwtKey:i="",apiUrl:s=U,apiVersion:o=J,frontendApi:u="",proxyUrl:l="",publishableKey:d="",isSatellite:g=!1,domain:y=""}=t.options;return{authenticateRequest:({apiKey:O,secretKey:k,frontendApi:I,proxyUrl:A,publishableKey:_,jwtKey:h,isSatellite:p,domain:W,searchParams:ue,...ve})=>Et({...ve,apiKey:O||r,secretKey:k||n,apiUrl:s,apiVersion:o,frontendApi:I||u,proxyUrl:A||l,publishableKey:_||d,isSatellite:p||g,domain:W||y,jwtKey:h||i,searchParams:ue}),localInterstitial:je,remotePublicInterstitial:({frontendApi:O,publishableKey:k,proxyUrl:I,isSatellite:A,domain:_,...h})=>ct({...h,apiUrl:s,frontendApi:O||u,publishableKey:k||d,proxyUrl:I||l,isSatellite:A||g,domain:_||y}),remotePrivateInterstitial:()=>e.interstitial.getInterstitial(),remotePublicInterstitialUrl:xe,debugRequestState:He}}function yo(t){let e={...t},r=ne(e),n=qt({options:e,apiClient:r});return{...r,...n,__unstable_options:e}}export{L as AllowlistIdentifier,mt as AuthStatus,yo as Clerk,D as Client,F as DeletedObject,V as Email,M as EmailAddress,$ as ExternalAccount,q as IdentificationLink,G as Invitation,B as OauthAccessToken,Ze as ObjectType,K as Organization,H as OrganizationInvitation,Y as OrganizationMembership,oe as OrganizationMembershipPublicUserData,z as PhoneNumber,X as RedirectUrl,Z as SMSMessage,E as Session,Q as SignInToken,ee as Token,re as User,R as Verification,Vt as constants,qt as createAuthenticateRequest,He as debugRequestState,$e as decodeJwt,et as deserialize,yr as hasValidSignature,je as loadInterstitialFromLocal,ss as makeAuthObjectSerializable,nt as prunePrivateMetadata,is as sanitizeAuthObject,st as signedInAuthObject,ot as signedOutAuthObject,yt as verifyJwt,kt as verifyToken};
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

"use strict";var Gt=Object.create;var de=Object.defineProperty;var Bt=Object.getOwnPropertyDescriptor;var Ht=Object.getOwnPropertyNames;var Yt=Object.getPrototypeOf,Xt=Object.prototype.hasOwnProperty;var Qt=(t,e)=>{for(var r in e)de(t,r,{get:e[r],enumerable:!0})},lt=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ht(e))!Xt.call(t,n)&&n!==r&&de(t,n,{get:()=>e[n],enumerable:!(i=Bt(e,n))||i.enumerable});return t};var ce=(t,e,r)=>(r=t!=null?Gt(Yt(t)):{},lt(e||!t||!t.__esModule?de(r,"default",{value:t,enumerable:!0}):r,t)),Zt=t=>lt(de({},"__esModule",{value:!0}),t);var Dr={};Qt(Dr,{AllowlistIdentifier:()=>W,AuthStatus:()=>Xe,Clerk:()=>Lr,Client:()=>L,DeletedObject:()=>D,Email:()=>F,EmailAddress:()=>C,ExternalAccount:()=>V,IdentificationLink:()=>U,Invitation:()=>$,OauthAccessToken:()=>G,ObjectType:()=>Le,Organization:()=>E,OrganizationInvitation:()=>B,OrganizationMembership:()=>H,OrganizationMembershipPublicUserData:()=>re,PhoneNumber:()=>q,RedirectUrl:()=>Y,SMSMessage:()=>Q,Session:()=>v,SignInToken:()=>X,Token:()=>Z,User:()=>ee,Verification:()=>P,constants:()=>pt,createAuthenticateRequest:()=>at,debugRequestState:()=>qe,decodeJwt:()=>Ue,deserialize:()=>Fe,hasValidSignature:()=>Pt,loadInterstitialFromLocal:()=>Ne,makeAuthObjectSerializable:()=>fr,prunePrivateMetadata:()=>$e,sanitizeAuthObject:()=>gr,signedInAuthObject:()=>Ge,signedOutAuthObject:()=>Be,verifyJwt:()=>nt,verifyToken:()=>st});module.exports=Zt(Dr);var m=class{constructor(e){this.request=e}requireId(e){if(!e)throw new Error("A valid resource ID is required.")}};var Ke="/",er=new RegExp(Ke+"{1,}","g");function a(...t){return t.filter(e=>e).join(Ke).replace(er,Ke)}var ze="/allowlist_identifiers",pe=class extends m{async getAllowlistIdentifierList(){return this.request({method:"GET",path:ze})}async createAllowlistIdentifier(e){return this.request({method:"POST",path:ze,bodyParams:e})}async deleteAllowlistIdentifier(e){return this.requireId(e),this.request({method:"DELETE",path:a(ze,e)})}};var je="/clients",me=class extends m{async getClientList(){return this.request({method:"GET",path:je})}async getClient(e){return this.requireId(e),this.request({method:"GET",path:a(je,e)})}verifyClient(e){return this.request({method:"POST",path:a(je,"verify"),bodyParams:{token:e}})}};var ge="/email_addresses",fe=class extends m{async getEmailAddress(e){return this.requireId(e),this.request({method:"GET",path:a(ge,e)})}async createEmailAddress(e){return this.request({method:"POST",path:ge,bodyParams:e})}async updateEmailAddress(e,r={}){return this.requireId(e),this.request({method:"PATCH",path:a(ge,e),bodyParams:r})}async deleteEmailAddress(e){return this.requireId(e),this.request({method:"DELETE",path:a(ge,e)})}};var tr="/emails",ye=class extends m{async createEmail(e){return this.request({method:"POST",path:tr,bodyParams:e})}};var he=class extends m{async getInterstitial(){return this.request({path:"internal/interstitial",method:"GET",headerParams:{"Content-Type":"text/html"}})}};var We="/invitations",be=class extends m{async getInvitationList(){return this.request({method:"GET",path:We})}async createInvitation(e){return this.request({method:"POST",path:We,bodyParams:e})}async revokeInvitation(e){return this.requireId(e),this.request({method:"POST",path:a(We,e,"revoke")})}};var w="/organizations",Se=class extends m{async getOrganizationList(e){return this.request({method:"GET",path:w,queryParams:e})}async createOrganization(e){return this.request({method:"POST",path:w,bodyParams:e})}async getOrganization(e){let r="organizationId"in e?e.organizationId:e.slug;return this.requireId(r),this.request({method:"GET",path:a(w,r)})}async updateOrganization(e,r){return this.requireId(e),this.request({method:"PATCH",path:a(w,e),bodyParams:r})}async updateOrganizationMetadata(e,r){return this.requireId(e),this.request({method:"PATCH",path:a(w,e,"metadata"),bodyParams:r})}async deleteOrganization(e){return this.request({method:"DELETE",path:a(w,e)})}async getOrganizationMembershipList(e){let{organizationId:r,limit:i,offset:n}=e;return this.requireId(r),this.request({method:"GET",path:a(w,r,"memberships"),queryParams:{limit:i,offset:n}})}async createOrganizationMembership(e){let{organizationId:r,userId:i,role:n}=e;return this.requireId(r),this.request({method:"POST",path:a(w,r,"memberships"),bodyParams:{userId:i,role:n}})}async updateOrganizationMembership(e){let{organizationId:r,userId:i,role:n}=e;return this.requireId(r),this.request({method:"PATCH",path:a(w,r,"memberships",i),bodyParams:{role:n}})}async updateOrganizationMembershipMetadata(e){let{organizationId:r,userId:i,publicMetadata:n,privateMetadata:s}=e;return this.request({method:"PATCH",path:a(w,r,"memberships",i,"metadata"),bodyParams:{publicMetadata:n,privateMetadata:s}})}async deleteOrganizationMembership(e){let{organizationId:r,userId:i}=e;return this.requireId(r),this.request({method:"DELETE",path:a(w,r,"memberships",i)})}async getPendingOrganizationInvitationList(e){let{organizationId:r,limit:i,offset:n}=e;return this.requireId(r),this.request({method:"GET",path:a(w,r,"invitations","pending"),queryParams:{limit:i,offset:n}})}async createOrganizationInvitation(e){let{organizationId:r,...i}=e;return this.requireId(r),this.request({method:"POST",path:a(w,r,"invitations"),bodyParams:{...i}})}async revokeOrganizationInvitation(e){let{organizationId:r,invitationId:i,requestingUserId:n}=e;return this.requireId(r),this.request({method:"POST",path:a(w,r,"invitations",i,"revoke"),bodyParams:{requestingUserId:n}})}};var Oe="/phone_numbers",ke=class extends m{async getPhoneNumber(e){return this.requireId(e),this.request({method:"GET",path:a(Oe,e)})}async createPhoneNumber(e){return this.request({method:"POST",path:Oe,bodyParams:e})}async updatePhoneNumber(e,r={}){return this.requireId(e),this.request({method:"PATCH",path:a(Oe,e),bodyParams:r})}async deletePhoneNumber(e){return this.requireId(e),this.request({method:"DELETE",path:a(Oe,e)})}};var _e="/redirect_urls",Ie=class extends m{async getRedirectUrlList(){return this.request({method:"GET",path:_e})}async getRedirectUrl(e){return this.requireId(e),this.request({method:"GET",path:a(_e,e)})}async createRedirectUrl(e){return this.request({method:"POST",path:_e,bodyParams:e})}async deleteRedirectUrl(e){return this.requireId(e),this.request({method:"DELETE",path:a(_e,e)})}};var oe="/sessions",Ae=class extends m{async getSessionList(e){return this.request({method:"GET",path:oe,queryParams:e})}async getSession(e){return this.requireId(e),this.request({method:"GET",path:a(oe,e)})}async revokeSession(e){return this.requireId(e),this.request({method:"POST",path:a(oe,e,"revoke")})}async verifySession(e,r){return this.requireId(e),this.request({method:"POST",path:a(oe,e,"verify"),bodyParams:{token:r}})}async getToken(e,r){return this.requireId(e),(await this.request({method:"POST",path:a(oe,e,"tokens",r||"")})).jwt}};var ut="/sign_in_tokens",we=class extends m{async createSignInToken(e){return this.request({method:"POST",path:ut,bodyParams:e})}async revokeSignInToken(e){return this.requireId(e),this.request({method:"POST",path:a(ut,e,"revoke")})}};var rr="/sms_messages",Pe=class extends m{async createSMSMessage(e){return this.request({method:"POST",path:rr,bodyParams:e})}};var R="/users",xe=class extends m{async getUserList(e={}){return this.request({method:"GET",path:R,queryParams:e})}async getUser(e){return this.requireId(e),this.request({method:"GET",path:a(R,e)})}async createUser(e){return this.request({method:"POST",path:R,bodyParams:e})}async updateUser(e,r={}){return this.requireId(e),this.request({method:"PATCH",path:a(R,e),bodyParams:r})}async updateUserMetadata(e,r){return this.requireId(e),this.request({method:"PATCH",path:a(R,e,"metadata"),bodyParams:r})}async deleteUser(e){return this.requireId(e),this.request({method:"DELETE",path:a(R,e)})}async getCount(e={}){return this.request({method:"GET",path:a(R,"count"),queryParams:e})}async getUserOauthAccessToken(e,r){return this.requireId(e),this.request({method:"GET",path:a(R,e,"oauth_access_tokens",r)})}async disableUserMFA(e){return this.requireId(e),this.request({method:"DELETE",path:a(R,e,"mfa")})}async getOrganizationMembershipList(e){let{userId:r,limit:i,offset:n}=e;return this.requireId(r),this.request({method:"GET",path:a(R,r,"organization_memberships"),queryParams:{limit:i,offset:n}})}async verifyPassword(e){let{userId:r,password:i}=e;return this.requireId(r),this.request({method:"POST",path:a(R,r,"verify_password"),bodyParams:{password:i}})}async verifyTOTP(e){let{userId:r,code:i}=e;return this.requireId(r),this.request({method:"POST",path:a(R,r,"verify_totp"),bodyParams:{code:i}})}};var ft=ce(require("deepmerge")),Ve=ce(require("snakecase-keys"));var z="https://api.clerk.dev",J="v1",dt="@clerk/backend";var nr={AuthStatus:"__clerkAuthStatus",AuthReason:"__clerkAuthReason",AuthMessage:"__clerkAuthMessage"},ir={Session:"__session",ClientUat:"__client_uat"},ct={AuthStatus:"x-clerk-auth-status",AuthReason:"x-clerk-auth-reason",AuthMessage:"x-clerk-auth-message",Authorization:"authorization",ForwardedPort:"x-forwarded-port",ForwardedHost:"x-forwarded-host",Referrer:"referer",UserAgent:"user-agent",Origin:"origin",Host:"host",ContentType:"content-type"},sr={AuthStatus:ct.AuthStatus},or={Json:"application/json"},pt={Attributes:nr,Cookies:ir,Headers:ct,SearchParams:sr,ContentTypes:or};var mt=ce(require("#crypto")),gt=ce(require("#fetch")),ar=gt.default.bind(globalThis),lr={crypto:mt.default,fetch:ar},N=lr;function Te(t){if(!t||typeof t!="string")throw Error("Missing Clerk Secret Key or API Key. Go to https://dashboard.clerk.com and get your key for your instance.")}var W=class{constructor(e,r,i,n,s){this.id=e;this.identifier=r;this.createdAt=i;this.updatedAt=n;this.invitationId=s}static fromJSON(e){return new W(e.id,e.identifier,e.created_at,e.updated_at,e.invitation_id)}};var v=class{constructor(e,r,i,n,s,o,u,l,d){this.id=e;this.clientId=r;this.userId=i;this.status=n;this.lastActiveAt=s;this.expireAt=o;this.abandonAt=u;this.createdAt=l;this.updatedAt=d}static fromJSON(e){return new v(e.id,e.client_id,e.user_id,e.status,e.last_active_at,e.expire_at,e.abandon_at,e.created_at,e.updated_at)}};var L=class{constructor(e,r,i,n,s,o,u,l){this.id=e;this.sessionIds=r;this.sessions=i;this.signInId=n;this.signUpId=s;this.lastActiveSessionId=o;this.createdAt=u;this.updatedAt=l}static fromJSON(e){return new L(e.id,e.session_ids,e.sessions.map(r=>v.fromJSON(r)),e.sign_in_id,e.sign_up_id,e.last_active_session_id,e.created_at,e.updated_at)}};var D=class{constructor(e,r,i,n){this.object=e;this.id=r;this.slug=i;this.deleted=n}static fromJSON(e){return new D(e.object,e.id||null,e.slug||null,e.deleted)}};var F=class{constructor(e,r,i,n,s,o,u){this.id=e;this.fromEmailName=r;this.emailAddressId=i;this.toEmailAddress=n;this.subject=s;this.body=o;this.status=u}static fromJSON(e){return new F(e.id,e.from_email_name,e.email_address_id,e.to_email_address,e.subject,e.body,e.status)}};var U=class{constructor(e,r){this.id=e;this.type=r}static fromJSON(e){return new U(e.id,e.type)}};var P=class{constructor(e,r,i=null,n=null,s=null,o=null){this.status=e;this.strategy=r;this.externalVerificationRedirectURL=i;this.attempts=n;this.expireAt=s;this.nonce=o}static fromJSON(e){return new P(e.status,e.strategy,e.external_verification_redirect_url?new URL(e.external_verification_redirect_url):null,e.attempts,e.expire_at,e.nonce)}};var C=class{constructor(e,r,i,n){this.id=e;this.emailAddress=r;this.verification=i;this.linkedTo=n}static fromJSON(e){return new C(e.id,e.email_address,e.verification&&P.fromJSON(e.verification),e.linked_to.map(r=>U.fromJSON(r)))}};var V=class{constructor(e,r,i,n,s,o,u,l,d,g,f={},b,y){this.id=e;this.provider=r;this.identificationId=i;this.externalId=n;this.approvedScopes=s;this.emailAddress=o;this.firstName=u;this.lastName=l;this.picture=d;this.username=g;this.publicMetadata=f;this.label=b;this.verification=y}static fromJSON(e){return new V(e.id,e.provider,e.identification_id,e.provider_user_id,e.approved_scopes,e.email_address,e.first_name,e.last_name,e.avatar_url,e.username,e.public_metadata,e.label,e.verification&&P.fromJSON(e.verification))}};var $=class{constructor(e,r,i,n,s,o,u){this.id=e;this.emailAddress=r;this.publicMetadata=i;this.createdAt=n;this.updatedAt=s;this.status=o;this.revoked=u}static fromJSON(e){return new $(e.id,e.email_address,e.public_metadata,e.created_at,e.updated_at,e.status,e.revoked)}};var Le=(p=>(p.AllowlistIdentifier="allowlist_identifier",p.Client="client",p.Email="email",p.EmailAddress="email_address",p.ExternalAccount="external_account",p.FacebookAccount="facebook_account",p.GoogleAccount="google_account",p.Invitation="invitation",p.OauthAccessToken="oauth_access_token",p.Organization="organization",p.OrganizationInvitation="organization_invitation",p.OrganizationMembership="organization_membership",p.PhoneNumber="phone_number",p.RedirectUrl="redirect_url",p.Session="session",p.SignInAttempt="sign_in_attempt",p.SignInToken="sign_in_token",p.SignUpAttempt="sign_up_attempt",p.SmsMessage="sms_message",p.User="user",p.Web3Wallet="web3_wallet",p.Token="token",p.TotalCount="total_count",p))(Le||{});var G=class{constructor(e,r,i={},n,s,o){this.provider=e;this.token=r;this.publicMetadata=i;this.label=n;this.scopes=s;this.tokenSecret=o}static fromJSON(e){return new G(e.provider,e.token,e.public_metadata,e.label,e.scopes,e.token_secret)}};var E=class{constructor(e,r,i,n,s,o,u,l,d={},g={},f){this.id=e;this.name=r;this.slug=i;this.logoUrl=n;this.imageUrl=s;this.createdBy=o;this.createdAt=u;this.updatedAt=l;this.publicMetadata=d;this.privateMetadata=g;this.maxAllowedMemberships=f}static fromJSON(e){return new E(e.id,e.name,e.slug,e.logo_url,e.image_url,e.created_by,e.created_at,e.updated_at,e.public_metadata,e.private_metadata,e.max_allowed_memberships)}};var B=class{constructor(e,r,i,n,s,o,u,l={}){this.id=e;this.emailAddress=r;this.role=i;this.organizationId=n;this.createdAt=s;this.updatedAt=o;this.status=u;this.publicMetadata=l}static fromJSON(e){return new B(e.id,e.email_address,e.role,e.organization_id,e.created_at,e.updated_at,e.status,e.public_metadata)}};var H=class{constructor(e,r,i={},n={},s,o,u,l){this.id=e;this.role=r;this.publicMetadata=i;this.privateMetadata=n;this.createdAt=s;this.updatedAt=o;this.organization=u;this.publicUserData=l}static fromJSON(e){return new H(e.id,e.role,e.public_metadata,e.private_metadata,e.created_at,e.updated_at,E.fromJSON(e.organization),re.fromJSON(e.public_user_data))}},re=class{constructor(e,r,i,n,s,o){this.identifier=e;this.firstName=r;this.lastName=i;this.profileImageUrl=n;this.imageUrl=s;this.userId=o}static fromJSON(e){return new re(e.identifier,e.first_name,e.last_name,e.profile_image_url,e.image_url,e.user_id)}};var q=class{constructor(e,r,i,n,s,o){this.id=e;this.phoneNumber=r;this.reservedForSecondFactor=i;this.defaultSecondFactor=n;this.verification=s;this.linkedTo=o}static fromJSON(e){return new q(e.id,e.phone_number,e.reserved_for_second_factor,e.default_second_factor,e.verification&&P.fromJSON(e.verification),e.linked_to.map(r=>U.fromJSON(r)))}};var Y=class{constructor(e,r,i,n){this.id=e;this.url=r;this.createdAt=i;this.updatedAt=n}static fromJSON(e){return new Y(e.id,e.url,e.created_at,e.updated_at)}};var X=class{constructor(e,r,i,n,s,o,u){this.id=e;this.userId=r;this.token=i;this.status=n;this.url=s;this.createdAt=o;this.updatedAt=u}static fromJSON(e){return new X(e.id,e.user_id,e.token,e.status,e.url,e.created_at,e.updated_at)}};var Q=class{constructor(e,r,i,n,s,o){this.id=e;this.fromPhoneNumber=r;this.toPhoneNumber=i;this.message=n;this.status=s;this.phoneNumberId=o}static fromJSON(e){return new Q(e.id,e.from_phone_number,e.to_phone_number,e.message,e.status,e.phone_number_id)}};var Z=class{constructor(e){this.jwt=e}static fromJSON(e){return new Z(e.jwt)}};var ne=class{constructor(e,r,i){this.id=e;this.web3Wallet=r;this.verification=i}static fromJSON(e){return new ne(e.id,e.web3_wallet,e.verification&&P.fromJSON(e.verification))}};var ee=class{constructor(e,r,i,n,s,o,u,l,d,g,f,b,y,S,x,T,O,k,I,A,_={},h={},p={},te=[],ue=[],Me=[],Vt=[]){this.id=e;this.passwordEnabled=r;this.totpEnabled=i;this.backupCodeEnabled=n;this.twoFactorEnabled=s;this.banned=o;this.createdAt=u;this.updatedAt=l;this.profileImageUrl=d;this.imageUrl=g;this.gender=f;this.birthday=b;this.primaryEmailAddressId=y;this.primaryPhoneNumberId=S;this.primaryWeb3WalletId=x;this.lastSignInAt=T;this.externalId=O;this.username=k;this.firstName=I;this.lastName=A;this.publicMetadata=_;this.privateMetadata=h;this.unsafeMetadata=p;this.emailAddresses=te;this.phoneNumbers=ue;this.web3Wallets=Me;this.externalAccounts=Vt}static fromJSON(e){return new ee(e.id,e.password_enabled,e.totp_enabled,e.backup_code_enabled,e.two_factor_enabled,e.banned,e.created_at,e.updated_at,e.profile_image_url,e.image_url,e.gender,e.birthday,e.primary_email_address_id,e.primary_phone_number_id,e.primary_web3_wallet_id,e.last_sign_in_at,e.external_id,e.username,e.first_name,e.last_name,e.public_metadata,e.private_metadata,e.unsafe_metadata,(e.email_addresses||[]).map(r=>C.fromJSON(r)),(e.phone_numbers||[]).map(r=>q.fromJSON(r)),(e.web3_wallets||[]).map(r=>ne.fromJSON(r)),(e.external_accounts||[]).map(r=>V.fromJSON(r)))}};function Fe(t){return Array.isArray(t)?t.map(e=>De(e)):ur(t)?t.data.map(e=>De(e)):De(t)}function ur(t){return t.data!==void 0}function dr(t){return t.total_count}function De(t){if(typeof t!="string"&&"object"in t&&"deleted"in t)return D.fromJSON(t);switch(t.object){case"allowlist_identifier":return W.fromJSON(t);case"client":return L.fromJSON(t);case"email_address":return C.fromJSON(t);case"email":return F.fromJSON(t);case"invitation":return $.fromJSON(t);case"oauth_access_token":return G.fromJSON(t);case"organization":return E.fromJSON(t);case"organization_invitation":return B.fromJSON(t);case"organization_membership":return H.fromJSON(t);case"phone_number":return q.fromJSON(t);case"redirect_url":return Y.fromJSON(t);case"sign_in_token":return X.fromJSON(t);case"session":return v.fromJSON(t);case"sms_message":return Q.fromJSON(t);case"token":return Z.fromJSON(t);case"total_count":return dr(t);case"user":return ee.fromJSON(t);default:return t}}var cr=t=>async(...e)=>{let{data:r,errors:i,status:n,statusText:s}=await t(...e);if(i===null)return r;throw new ae(s||"",{data:i,status:n||""})};function yt(t){return cr(async r=>{let{apiKey:i,secretKey:n,apiUrl:s=z,apiVersion:o=J,userAgent:u=dt,httpOptions:l={}}=t,{path:d,method:g,queryParams:f,headerParams:b,bodyParams:y}=r,S=n||i;Te(S);let x=a(s,o,d),T=new URL(x);if(f){let _=(0,Ve.default)({...f});for(let[h,p]of Object.entries(_))p&&[p].flat().forEach(te=>T.searchParams.append(h,te))}let O={Authorization:`Bearer ${S}`,"Content-Type":"application/json","Clerk-Backend-SDK":u,...b},I=g!=="GET"&&y&&Object.keys(y).length>0?{body:JSON.stringify((0,Ve.default)(y,{deep:!1}))}:null,A;try{A=await N.fetch(T.href,(0,ft.default)(l,{method:g,headers:O,...I}));let h=await(O&&O["Content-Type"]==="application/json"?A.json():A.text());if(!A.ok)throw h;return{data:Fe(h),errors:null}}catch(_){return _ instanceof Error?{data:null,errors:[{code:"unexpected_error",message:_.message||"Unexpected error"}]}:{data:null,errors:pr(_),status:A?.status,statusText:A?.statusText}}})}function pr(t){if(t&&typeof t=="object"&&"errors"in t){let e=t.errors;return e.length>0?e.map(mr):[]}return[]}function mr(t){return{code:t.code,message:t.message,longMessage:t.long_message,meta:{paramName:t?.meta?.param_name,sessionId:t?.meta?.session_id}}}var ae=class extends Error{constructor(r,{data:i,status:n}){super(r);Object.setPrototypeOf(this,ae.prototype),this.clerkError=!0,this.message=r,this.status=n,this.errors=i}};function ie(t){let e=yt(t);return{allowlistIdentifiers:new pe(e),clients:new me(e),emailAddresses:new fe(e),emails:new ye(e),interstitial:new he(e),invitations:new be(e),organizations:new Se(e),phoneNumbers:new ke(e),redirectUrls:new Ie(e),sessions:new Ae(e),signInTokens:new we(e),smsMessages:new Pe(e),users:new xe(e)}}var ht=t=>()=>{let e={...t};return e.apiKey=(e.apiKey||"").substring(0,7),e.secretKey=(e.secretKey||"").substring(0,7),e.jwtKey=(e.jwtKey||"").substring(0,7),{...e}};function Ge(t,e,r){let{act:i,sid:n,org_id:s,org_role:o,org_slug:u,sub:l}=t,{apiKey:d,secretKey:g,apiUrl:f,apiVersion:b,token:y,session:S,user:x,organization:T}=e,{sessions:O}=ie({apiKey:d,secretKey:g,apiUrl:f,apiVersion:b}),k=yr({sessionId:n,sessionToken:y,fetcher:(...I)=>O.getToken(...I)});return{actor:i,sessionClaims:t,sessionId:n,session:S,userId:l,user:x,orgId:s,orgRole:o,orgSlug:u,organization:T,getToken:k,debug:ht({...e,...r})}}function Be(t){return{sessionClaims:null,sessionId:null,session:null,userId:null,user:null,actor:null,orgId:null,orgRole:null,orgSlug:null,organization:null,getToken:()=>Promise.resolve(null),debug:ht(t)}}function $e(t){return t&&(delete t.privateMetadata,delete t.private_metadata),t}function gr(t){let e=t.user?{...t.user}:t.user,r=t.organization?{...t.organization}:t.organization;return $e(e),$e(r),{...t,user:e,organization:r}}var fr=t=>{let{debug:e,getToken:r,...i}=t;return i},yr=t=>{let{fetcher:e,sessionToken:r,sessionId:i}=t||{};return async(n={})=>i?n.template?e(i,n.template):r:null};function hr(t){return new Promise(e=>setTimeout(e,t))}var br=5;async function le(t,e=1,r=br){try{return await t()}catch(i){if(e>=r)throw i;return await hr(2**e*100),le(t,e+1)}}function j(t){return t.startsWith("test_")||t.startsWith("sk_test_")}function bt(t){return t.startsWith("live_")||t.startsWith("sk_live_")}function St(t){return t.endsWith(".lclstage.dev")||t.endsWith(".stgstage.dev")||t.endsWith(".clerkstage.dev")||t.endsWith(".accountsstage.dev")}function Sr(){let t=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"],e=new Map;return{isDevOrStagingUrl:r=>{if(!r)return!1;let i=typeof r=="string"?r:r.hostname,n=e.get(i);return n===void 0&&(n=t.some(s=>i.endsWith(s)),e.set(i,n)),n}}}var{isDevOrStagingUrl:He}=Sr();var Ot="pk_live_",Or="pk_test_";function se(t){if(t=t||"",!kr(t))return null;let e=t.startsWith(Ot)?"production":"development",r=kt(t.split("_")[2]);return r.endsWith("$")?(r=r.slice(0,-1),{instanceType:e,frontendApi:r}):null}function kr(t){t=t||"";let e=t.startsWith(Ot)||t.startsWith(Or),r=kt(t.split("_")[2]||"").endsWith("$");return e&&r}var kt=t=>typeof atob<"u"&&typeof atob=="function"?atob(t):typeof globalThis<"u"&&globalThis.Buffer?new globalThis.Buffer(t,"base64").toString():t;var c=class extends Error{constructor({action:r,message:i,reason:n}){super(i);Object.setPrototypeOf(this,c.prototype),this.reason=n,this.message=i,this.action=r}getFullMessage(){return`${[this.message,this.action].filter(r=>r).join(" ")} (reason=${this.reason}, token-carrier=${this.tokenCarrier})`}};function _r(t){if(!t)return"";let e;if(t.match(/^(clerk\.)+\w*$/))e=/(clerk\.)*(?=clerk\.)/;else{if(t.match(/\.clerk.accounts/))return t;e=/^(clerk\.)*/gi}return`clerk.${t.replace(e,"")}`}function Ne(t){t.frontendApi=se(t.publishableKey)?.frontendApi||t.frontendApi||"";let e=He(t.frontendApi)?"":_r(t.domain),{debugData:r,frontendApi:i,pkgVersion:n,publishableKey:s,proxyUrl:o,isSatellite:u=!1,domain:l,signInUrl:d}=t;return`
"use strict";var $t=Object.create;var de=Object.defineProperty;var Gt=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames;var Ht=Object.getPrototypeOf,Yt=Object.prototype.hasOwnProperty;var Xt=(t,e)=>{for(var r in e)de(t,r,{get:e[r],enumerable:!0})},lt=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Bt(e))!Yt.call(t,n)&&n!==r&&de(t,n,{get:()=>e[n],enumerable:!(i=Gt(e,n))||i.enumerable});return t};var ce=(t,e,r)=>(r=t!=null?$t(Ht(t)):{},lt(e||!t||!t.__esModule?de(r,"default",{value:t,enumerable:!0}):r,t)),Qt=t=>lt(de({},"__esModule",{value:!0}),t);var Lr={};Xt(Lr,{AllowlistIdentifier:()=>W,AuthStatus:()=>Xe,Clerk:()=>Wr,Client:()=>L,DeletedObject:()=>D,Email:()=>F,EmailAddress:()=>U,ExternalAccount:()=>V,IdentificationLink:()=>C,Invitation:()=>$,OauthAccessToken:()=>G,ObjectType:()=>Le,Organization:()=>E,OrganizationInvitation:()=>B,OrganizationMembership:()=>H,OrganizationMembershipPublicUserData:()=>re,PhoneNumber:()=>q,RedirectUrl:()=>Y,SMSMessage:()=>Q,Session:()=>v,SignInToken:()=>X,Token:()=>Z,User:()=>ee,Verification:()=>P,constants:()=>pt,createAuthenticateRequest:()=>at,debugRequestState:()=>qe,decodeJwt:()=>Ce,deserialize:()=>Fe,hasValidSignature:()=>Pt,loadInterstitialFromLocal:()=>Ne,makeAuthObjectSerializable:()=>gr,prunePrivateMetadata:()=>$e,sanitizeAuthObject:()=>mr,signedInAuthObject:()=>Ge,signedOutAuthObject:()=>Be,verifyJwt:()=>nt,verifyToken:()=>st});module.exports=Qt(Lr);var m=class{constructor(e){this.request=e}requireId(e){if(!e)throw new Error("A valid resource ID is required.")}};var Ke="/",Zt=new RegExp(Ke+"{1,}","g");function a(...t){return t.filter(e=>e).join(Ke).replace(Zt,Ke)}var ze="/allowlist_identifiers",pe=class extends m{async getAllowlistIdentifierList(){return this.request({method:"GET",path:ze})}async createAllowlistIdentifier(e){return this.request({method:"POST",path:ze,bodyParams:e})}async deleteAllowlistIdentifier(e){return this.requireId(e),this.request({method:"DELETE",path:a(ze,e)})}};var je="/clients",me=class extends m{async getClientList(){return this.request({method:"GET",path:je})}async getClient(e){return this.requireId(e),this.request({method:"GET",path:a(je,e)})}verifyClient(e){return this.request({method:"POST",path:a(je,"verify"),bodyParams:{token:e}})}};var ge="/email_addresses",fe=class extends m{async getEmailAddress(e){return this.requireId(e),this.request({method:"GET",path:a(ge,e)})}async createEmailAddress(e){return this.request({method:"POST",path:ge,bodyParams:e})}async updateEmailAddress(e,r={}){return this.requireId(e),this.request({method:"PATCH",path:a(ge,e),bodyParams:r})}async deleteEmailAddress(e){return this.requireId(e),this.request({method:"DELETE",path:a(ge,e)})}};var er="/emails",ye=class extends m{async createEmail(e){return this.request({method:"POST",path:er,bodyParams:e})}};var he=class extends m{async getInterstitial(){return this.request({path:"internal/interstitial",method:"GET",headerParams:{"Content-Type":"text/html"}})}};var We="/invitations",be=class extends m{async getInvitationList(){return this.request({method:"GET",path:We})}async createInvitation(e){return this.request({method:"POST",path:We,bodyParams:e})}async revokeInvitation(e){return this.requireId(e),this.request({method:"POST",path:a(We,e,"revoke")})}};var w="/organizations",Se=class extends m{async getOrganizationList(e){return this.request({method:"GET",path:w,queryParams:e})}async createOrganization(e){return this.request({method:"POST",path:w,bodyParams:e})}async getOrganization(e){let r="organizationId"in e?e.organizationId:e.slug;return this.requireId(r),this.request({method:"GET",path:a(w,r)})}async updateOrganization(e,r){return this.requireId(e),this.request({method:"PATCH",path:a(w,e),bodyParams:r})}async updateOrganizationMetadata(e,r){return this.requireId(e),this.request({method:"PATCH",path:a(w,e,"metadata"),bodyParams:r})}async deleteOrganization(e){return this.request({method:"DELETE",path:a(w,e)})}async getOrganizationMembershipList(e){let{organizationId:r,limit:i,offset:n}=e;return this.requireId(r),this.request({method:"GET",path:a(w,r,"memberships"),queryParams:{limit:i,offset:n}})}async createOrganizationMembership(e){let{organizationId:r,userId:i,role:n}=e;return this.requireId(r),this.request({method:"POST",path:a(w,r,"memberships"),bodyParams:{userId:i,role:n}})}async updateOrganizationMembership(e){let{organizationId:r,userId:i,role:n}=e;return this.requireId(r),this.request({method:"PATCH",path:a(w,r,"memberships",i),bodyParams:{role:n}})}async updateOrganizationMembershipMetadata(e){let{organizationId:r,userId:i,publicMetadata:n,privateMetadata:s}=e;return this.request({method:"PATCH",path:a(w,r,"memberships",i,"metadata"),bodyParams:{publicMetadata:n,privateMetadata:s}})}async deleteOrganizationMembership(e){let{organizationId:r,userId:i}=e;return this.requireId(r),this.request({method:"DELETE",path:a(w,r,"memberships",i)})}async getPendingOrganizationInvitationList(e){let{organizationId:r,limit:i,offset:n}=e;return this.requireId(r),this.request({method:"GET",path:a(w,r,"invitations","pending"),queryParams:{limit:i,offset:n}})}async createOrganizationInvitation(e){let{organizationId:r,...i}=e;return this.requireId(r),this.request({method:"POST",path:a(w,r,"invitations"),bodyParams:{...i}})}async revokeOrganizationInvitation(e){let{organizationId:r,invitationId:i,requestingUserId:n}=e;return this.requireId(r),this.request({method:"POST",path:a(w,r,"invitations",i,"revoke"),bodyParams:{requestingUserId:n}})}};var Oe="/phone_numbers",ke=class extends m{async getPhoneNumber(e){return this.requireId(e),this.request({method:"GET",path:a(Oe,e)})}async createPhoneNumber(e){return this.request({method:"POST",path:Oe,bodyParams:e})}async updatePhoneNumber(e,r={}){return this.requireId(e),this.request({method:"PATCH",path:a(Oe,e),bodyParams:r})}async deletePhoneNumber(e){return this.requireId(e),this.request({method:"DELETE",path:a(Oe,e)})}};var _e="/redirect_urls",Ie=class extends m{async getRedirectUrlList(){return this.request({method:"GET",path:_e})}async getRedirectUrl(e){return this.requireId(e),this.request({method:"GET",path:a(_e,e)})}async createRedirectUrl(e){return this.request({method:"POST",path:_e,bodyParams:e})}async deleteRedirectUrl(e){return this.requireId(e),this.request({method:"DELETE",path:a(_e,e)})}};var oe="/sessions",Ae=class extends m{async getSessionList(e){return this.request({method:"GET",path:oe,queryParams:e})}async getSession(e){return this.requireId(e),this.request({method:"GET",path:a(oe,e)})}async revokeSession(e){return this.requireId(e),this.request({method:"POST",path:a(oe,e,"revoke")})}async verifySession(e,r){return this.requireId(e),this.request({method:"POST",path:a(oe,e,"verify"),bodyParams:{token:r}})}async getToken(e,r){return this.requireId(e),(await this.request({method:"POST",path:a(oe,e,"tokens",r||"")})).jwt}};var ut="/sign_in_tokens",we=class extends m{async createSignInToken(e){return this.request({method:"POST",path:ut,bodyParams:e})}async revokeSignInToken(e){return this.requireId(e),this.request({method:"POST",path:a(ut,e,"revoke")})}};var tr="/sms_messages",Pe=class extends m{async createSMSMessage(e){return this.request({method:"POST",path:tr,bodyParams:e})}};var R="/users",xe=class extends m{async getUserList(e={}){return this.request({method:"GET",path:R,queryParams:e})}async getUser(e){return this.requireId(e),this.request({method:"GET",path:a(R,e)})}async createUser(e){return this.request({method:"POST",path:R,bodyParams:e})}async updateUser(e,r={}){return this.requireId(e),this.request({method:"PATCH",path:a(R,e),bodyParams:r})}async updateUserMetadata(e,r){return this.requireId(e),this.request({method:"PATCH",path:a(R,e,"metadata"),bodyParams:r})}async deleteUser(e){return this.requireId(e),this.request({method:"DELETE",path:a(R,e)})}async getCount(e={}){return this.request({method:"GET",path:a(R,"count"),queryParams:e})}async getUserOauthAccessToken(e,r){return this.requireId(e),this.request({method:"GET",path:a(R,e,"oauth_access_tokens",r)})}async disableUserMFA(e){return this.requireId(e),this.request({method:"DELETE",path:a(R,e,"mfa")})}async getOrganizationMembershipList(e){let{userId:r,limit:i,offset:n}=e;return this.requireId(r),this.request({method:"GET",path:a(R,r,"organization_memberships"),queryParams:{limit:i,offset:n}})}async verifyPassword(e){let{userId:r,password:i}=e;return this.requireId(r),this.request({method:"POST",path:a(R,r,"verify_password"),bodyParams:{password:i}})}async verifyTOTP(e){let{userId:r,code:i}=e;return this.requireId(r),this.request({method:"POST",path:a(R,r,"verify_totp"),bodyParams:{code:i}})}};var ft=ce(require("deepmerge")),Ve=ce(require("snakecase-keys"));var z="https://api.clerk.dev",J="v1",dt="@clerk/backend";var rr={AuthStatus:"__clerkAuthStatus",AuthReason:"__clerkAuthReason",AuthMessage:"__clerkAuthMessage"},nr={Session:"__session",ClientUat:"__client_uat"},ct={AuthStatus:"x-clerk-auth-status",AuthReason:"x-clerk-auth-reason",AuthMessage:"x-clerk-auth-message",Authorization:"authorization",ForwardedPort:"x-forwarded-port",ForwardedHost:"x-forwarded-host",Referrer:"referer",UserAgent:"user-agent",Origin:"origin",Host:"host",ContentType:"content-type"},ir={AuthStatus:ct.AuthStatus},sr={Json:"application/json"},pt={Attributes:rr,Cookies:nr,Headers:ct,SearchParams:ir,ContentTypes:sr};var mt=ce(require("#crypto")),gt=ce(require("#fetch")),or=gt.default.bind(globalThis),ar={crypto:mt.default,fetch:or},N=ar;function Te(t){if(!t||typeof t!="string")throw Error("Missing Clerk Secret Key or API Key. Go to https://dashboard.clerk.com and get your key for your instance.")}var W=class{constructor(e,r,i,n,s){this.id=e;this.identifier=r;this.createdAt=i;this.updatedAt=n;this.invitationId=s}static fromJSON(e){return new W(e.id,e.identifier,e.created_at,e.updated_at,e.invitation_id)}};var v=class{constructor(e,r,i,n,s,o,u,l,d){this.id=e;this.clientId=r;this.userId=i;this.status=n;this.lastActiveAt=s;this.expireAt=o;this.abandonAt=u;this.createdAt=l;this.updatedAt=d}static fromJSON(e){return new v(e.id,e.client_id,e.user_id,e.status,e.last_active_at,e.expire_at,e.abandon_at,e.created_at,e.updated_at)}};var L=class{constructor(e,r,i,n,s,o,u,l){this.id=e;this.sessionIds=r;this.sessions=i;this.signInId=n;this.signUpId=s;this.lastActiveSessionId=o;this.createdAt=u;this.updatedAt=l}static fromJSON(e){return new L(e.id,e.session_ids,e.sessions.map(r=>v.fromJSON(r)),e.sign_in_id,e.sign_up_id,e.last_active_session_id,e.created_at,e.updated_at)}};var D=class{constructor(e,r,i,n){this.object=e;this.id=r;this.slug=i;this.deleted=n}static fromJSON(e){return new D(e.object,e.id||null,e.slug||null,e.deleted)}};var F=class{constructor(e,r,i,n,s,o,u){this.id=e;this.fromEmailName=r;this.emailAddressId=i;this.toEmailAddress=n;this.subject=s;this.body=o;this.status=u}static fromJSON(e){return new F(e.id,e.from_email_name,e.email_address_id,e.to_email_address,e.subject,e.body,e.status)}};var C=class{constructor(e,r){this.id=e;this.type=r}static fromJSON(e){return new C(e.id,e.type)}};var P=class{constructor(e,r,i=null,n=null,s=null,o=null){this.status=e;this.strategy=r;this.externalVerificationRedirectURL=i;this.attempts=n;this.expireAt=s;this.nonce=o}static fromJSON(e){return new P(e.status,e.strategy,e.external_verification_redirect_url?new URL(e.external_verification_redirect_url):null,e.attempts,e.expire_at,e.nonce)}};var U=class{constructor(e,r,i,n){this.id=e;this.emailAddress=r;this.verification=i;this.linkedTo=n}static fromJSON(e){return new U(e.id,e.email_address,e.verification&&P.fromJSON(e.verification),e.linked_to.map(r=>C.fromJSON(r)))}};var V=class{constructor(e,r,i,n,s,o,u,l,d,g,y={},b,f){this.id=e;this.provider=r;this.identificationId=i;this.externalId=n;this.approvedScopes=s;this.emailAddress=o;this.firstName=u;this.lastName=l;this.picture=d;this.username=g;this.publicMetadata=y;this.label=b;this.verification=f}static fromJSON(e){return new V(e.id,e.provider,e.identification_id,e.provider_user_id,e.approved_scopes,e.email_address,e.first_name,e.last_name,e.avatar_url,e.username,e.public_metadata,e.label,e.verification&&P.fromJSON(e.verification))}};var $=class{constructor(e,r,i,n,s,o,u){this.id=e;this.emailAddress=r;this.publicMetadata=i;this.createdAt=n;this.updatedAt=s;this.status=o;this.revoked=u}static fromJSON(e){return new $(e.id,e.email_address,e.public_metadata,e.created_at,e.updated_at,e.status,e.revoked)}};var Le=(p=>(p.AllowlistIdentifier="allowlist_identifier",p.Client="client",p.Email="email",p.EmailAddress="email_address",p.ExternalAccount="external_account",p.FacebookAccount="facebook_account",p.GoogleAccount="google_account",p.Invitation="invitation",p.OauthAccessToken="oauth_access_token",p.Organization="organization",p.OrganizationInvitation="organization_invitation",p.OrganizationMembership="organization_membership",p.PhoneNumber="phone_number",p.RedirectUrl="redirect_url",p.Session="session",p.SignInAttempt="sign_in_attempt",p.SignInToken="sign_in_token",p.SignUpAttempt="sign_up_attempt",p.SmsMessage="sms_message",p.User="user",p.Web3Wallet="web3_wallet",p.Token="token",p.TotalCount="total_count",p))(Le||{});var G=class{constructor(e,r,i={},n,s,o){this.provider=e;this.token=r;this.publicMetadata=i;this.label=n;this.scopes=s;this.tokenSecret=o}static fromJSON(e){return new G(e.provider,e.token,e.public_metadata,e.label,e.scopes,e.token_secret)}};var E=class{constructor(e,r,i,n,s,o,u,l={},d={},g){this.id=e;this.name=r;this.slug=i;this.logoUrl=n;this.createdBy=s;this.createdAt=o;this.updatedAt=u;this.publicMetadata=l;this.privateMetadata=d;this.maxAllowedMemberships=g}static fromJSON(e){return new E(e.id,e.name,e.slug,e.logo_url,e.created_by,e.created_at,e.updated_at,e.public_metadata,e.private_metadata,e.max_allowed_memberships)}};var B=class{constructor(e,r,i,n,s,o,u,l={}){this.id=e;this.emailAddress=r;this.role=i;this.organizationId=n;this.createdAt=s;this.updatedAt=o;this.status=u;this.publicMetadata=l}static fromJSON(e){return new B(e.id,e.email_address,e.role,e.organization_id,e.created_at,e.updated_at,e.status,e.public_metadata)}};var H=class{constructor(e,r,i={},n={},s,o,u,l){this.id=e;this.role=r;this.publicMetadata=i;this.privateMetadata=n;this.createdAt=s;this.updatedAt=o;this.organization=u;this.publicUserData=l}static fromJSON(e){return new H(e.id,e.role,e.public_metadata,e.private_metadata,e.created_at,e.updated_at,E.fromJSON(e.organization),re.fromJSON(e.public_user_data))}},re=class{constructor(e,r,i,n,s){this.identifier=e;this.firstName=r;this.lastName=i;this.profileImageUrl=n;this.userId=s}static fromJSON(e){return new re(e.identifier,e.first_name,e.last_name,e.profile_image_url,e.user_id)}};var q=class{constructor(e,r,i,n,s,o){this.id=e;this.phoneNumber=r;this.reservedForSecondFactor=i;this.defaultSecondFactor=n;this.verification=s;this.linkedTo=o}static fromJSON(e){return new q(e.id,e.phone_number,e.reserved_for_second_factor,e.default_second_factor,e.verification&&P.fromJSON(e.verification),e.linked_to.map(r=>C.fromJSON(r)))}};var Y=class{constructor(e,r,i,n){this.id=e;this.url=r;this.createdAt=i;this.updatedAt=n}static fromJSON(e){return new Y(e.id,e.url,e.created_at,e.updated_at)}};var X=class{constructor(e,r,i,n,s,o,u){this.id=e;this.userId=r;this.token=i;this.status=n;this.url=s;this.createdAt=o;this.updatedAt=u}static fromJSON(e){return new X(e.id,e.user_id,e.token,e.status,e.url,e.created_at,e.updated_at)}};var Q=class{constructor(e,r,i,n,s,o){this.id=e;this.fromPhoneNumber=r;this.toPhoneNumber=i;this.message=n;this.status=s;this.phoneNumberId=o}static fromJSON(e){return new Q(e.id,e.from_phone_number,e.to_phone_number,e.message,e.status,e.phone_number_id)}};var Z=class{constructor(e){this.jwt=e}static fromJSON(e){return new Z(e.jwt)}};var ne=class{constructor(e,r,i){this.id=e;this.web3Wallet=r;this.verification=i}static fromJSON(e){return new ne(e.id,e.web3_wallet,e.verification&&P.fromJSON(e.verification))}};var ee=class{constructor(e,r,i,n,s,o,u,l,d,g,y,b,f,S,x,T,O,k,I,A={},_={},h={},p=[],te=[],ue=[],Me=[]){this.id=e;this.passwordEnabled=r;this.totpEnabled=i;this.backupCodeEnabled=n;this.twoFactorEnabled=s;this.banned=o;this.createdAt=u;this.updatedAt=l;this.profileImageUrl=d;this.gender=g;this.birthday=y;this.primaryEmailAddressId=b;this.primaryPhoneNumberId=f;this.primaryWeb3WalletId=S;this.lastSignInAt=x;this.externalId=T;this.username=O;this.firstName=k;this.lastName=I;this.publicMetadata=A;this.privateMetadata=_;this.unsafeMetadata=h;this.emailAddresses=p;this.phoneNumbers=te;this.web3Wallets=ue;this.externalAccounts=Me}static fromJSON(e){return new ee(e.id,e.password_enabled,e.totp_enabled,e.backup_code_enabled,e.two_factor_enabled,e.banned,e.created_at,e.updated_at,e.profile_image_url,e.gender,e.birthday,e.primary_email_address_id,e.primary_phone_number_id,e.primary_web3_wallet_id,e.last_sign_in_at,e.external_id,e.username,e.first_name,e.last_name,e.public_metadata,e.private_metadata,e.unsafe_metadata,(e.email_addresses||[]).map(r=>U.fromJSON(r)),(e.phone_numbers||[]).map(r=>q.fromJSON(r)),(e.web3_wallets||[]).map(r=>ne.fromJSON(r)),(e.external_accounts||[]).map(r=>V.fromJSON(r)))}};function Fe(t){return Array.isArray(t)?t.map(e=>De(e)):lr(t)?t.data.map(e=>De(e)):De(t)}function lr(t){return t.data!==void 0}function ur(t){return t.total_count}function De(t){if(typeof t!="string"&&"object"in t&&"deleted"in t)return D.fromJSON(t);switch(t.object){case"allowlist_identifier":return W.fromJSON(t);case"client":return L.fromJSON(t);case"email_address":return U.fromJSON(t);case"email":return F.fromJSON(t);case"invitation":return $.fromJSON(t);case"oauth_access_token":return G.fromJSON(t);case"organization":return E.fromJSON(t);case"organization_invitation":return B.fromJSON(t);case"organization_membership":return H.fromJSON(t);case"phone_number":return q.fromJSON(t);case"redirect_url":return Y.fromJSON(t);case"sign_in_token":return X.fromJSON(t);case"session":return v.fromJSON(t);case"sms_message":return Q.fromJSON(t);case"token":return Z.fromJSON(t);case"total_count":return ur(t);case"user":return ee.fromJSON(t);default:return t}}var dr=t=>async(...e)=>{let{data:r,errors:i,status:n,statusText:s}=await t(...e);if(i===null)return r;throw new ae(s||"",{data:i,status:n||""})};function yt(t){return dr(async r=>{let{apiKey:i,secretKey:n,apiUrl:s=z,apiVersion:o=J,userAgent:u=dt,httpOptions:l={}}=t,{path:d,method:g,queryParams:y,headerParams:b,bodyParams:f}=r,S=n||i;Te(S);let x=a(s,o,d),T=new URL(x);if(y){let _=(0,Ve.default)({...y});for(let[h,p]of Object.entries(_))p&&[p].flat().forEach(te=>T.searchParams.append(h,te))}let O={Authorization:`Bearer ${S}`,"Content-Type":"application/json","Clerk-Backend-SDK":u,...b},I=g!=="GET"&&f&&Object.keys(f).length>0?{body:JSON.stringify((0,Ve.default)(f,{deep:!1}))}:null,A;try{A=await N.fetch(T.href,(0,ft.default)(l,{method:g,headers:O,...I}));let h=await(O&&O["Content-Type"]==="application/json"?A.json():A.text());if(!A.ok)throw h;return{data:Fe(h),errors:null}}catch(_){return _ instanceof Error?{data:null,errors:[{code:"unexpected_error",message:_.message||"Unexpected error"}]}:{data:null,errors:cr(_),status:A?.status,statusText:A?.statusText}}})}function cr(t){if(t&&typeof t=="object"&&"errors"in t){let e=t.errors;return e.length>0?e.map(pr):[]}return[]}function pr(t){return{code:t.code,message:t.message,longMessage:t.long_message,meta:{paramName:t?.meta?.param_name,sessionId:t?.meta?.session_id}}}var ae=class extends Error{constructor(r,{data:i,status:n}){super(r);Object.setPrototypeOf(this,ae.prototype),this.clerkError=!0,this.message=r,this.status=n,this.errors=i}};function ie(t){let e=yt(t);return{allowlistIdentifiers:new pe(e),clients:new me(e),emailAddresses:new fe(e),emails:new ye(e),interstitial:new he(e),invitations:new be(e),organizations:new Se(e),phoneNumbers:new ke(e),redirectUrls:new Ie(e),sessions:new Ae(e),signInTokens:new we(e),smsMessages:new Pe(e),users:new xe(e)}}var ht=t=>()=>{let e={...t};return e.apiKey=(e.apiKey||"").substring(0,7),e.secretKey=(e.secretKey||"").substring(0,7),e.jwtKey=(e.jwtKey||"").substring(0,7),{...e}};function Ge(t,e,r){let{act:i,sid:n,org_id:s,org_role:o,org_slug:u,sub:l}=t,{apiKey:d,secretKey:g,apiUrl:y,apiVersion:b,token:f,session:S,user:x,organization:T}=e,{sessions:O}=ie({apiKey:d,secretKey:g,apiUrl:y,apiVersion:b}),k=fr({sessionId:n,sessionToken:f,fetcher:(...I)=>O.getToken(...I)});return{actor:i,sessionClaims:t,sessionId:n,session:S,userId:l,user:x,orgId:s,orgRole:o,orgSlug:u,organization:T,getToken:k,debug:ht({...e,...r})}}function Be(t){return{sessionClaims:null,sessionId:null,session:null,userId:null,user:null,actor:null,orgId:null,orgRole:null,orgSlug:null,organization:null,getToken:()=>Promise.resolve(null),debug:ht(t)}}function $e(t){return t&&(delete t.privateMetadata,delete t.private_metadata),t}function mr(t){let e=t.user?{...t.user}:t.user,r=t.organization?{...t.organization}:t.organization;return $e(e),$e(r),{...t,user:e,organization:r}}var gr=t=>{let{debug:e,getToken:r,...i}=t;return i},fr=t=>{let{fetcher:e,sessionToken:r,sessionId:i}=t||{};return async(n={})=>i?n.template?e(i,n.template):r:null};function yr(t){return new Promise(e=>setTimeout(e,t))}var hr=5;async function le(t,e=1,r=hr){try{return await t()}catch(i){if(e>=r)throw i;return await yr(2**e*100),le(t,e+1)}}function j(t){return t.startsWith("test_")||t.startsWith("sk_test_")}function bt(t){return t.startsWith("live_")||t.startsWith("sk_live_")}function St(t){return t.endsWith(".lclstage.dev")||t.endsWith(".stgstage.dev")||t.endsWith(".clerkstage.dev")||t.endsWith(".accountsstage.dev")}function br(){let t=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"],e=new Map;return{isDevOrStagingUrl:r=>{if(!r)return!1;let i=typeof r=="string"?r:r.hostname,n=e.get(i);return n===void 0&&(n=t.some(s=>i.endsWith(s)),e.set(i,n)),n}}}var{isDevOrStagingUrl:He}=br();var Ot="pk_live_",Sr="pk_test_";function se(t){if(t=t||"",!Or(t))return null;let e=t.startsWith(Ot)?"production":"development",r=kt(t.split("_")[2]);return r.endsWith("$")?(r=r.slice(0,-1),{instanceType:e,frontendApi:r}):null}function Or(t){t=t||"";let e=t.startsWith(Ot)||t.startsWith(Sr),r=kt(t.split("_")[2]||"").endsWith("$");return e&&r}var kt=t=>typeof atob<"u"&&typeof atob=="function"?atob(t):typeof globalThis<"u"&&globalThis.Buffer?new globalThis.Buffer(t,"base64").toString():t;var c=class extends Error{constructor({action:r,message:i,reason:n}){super(i);Object.setPrototypeOf(this,c.prototype),this.reason=n,this.message=i,this.action=r}getFullMessage(){return`${[this.message,this.action].filter(r=>r).join(" ")} (reason=${this.reason}, token-carrier=${this.tokenCarrier})`}};function kr(t){if(!t)return"";let e;if(t.match(/^(clerk\.)+\w*$/))e=/(clerk\.)*(?=clerk\.)/;else{if(t.match(/\.clerk.accounts/))return t;e=/^(clerk\.)*/gi}return`clerk.${t.replace(e,"")}`}function Ne(t){t.frontendApi=se(t.publishableKey)?.frontendApi||t.frontendApi||"";let e=He(t.frontendApi)?"":kr(t.domain),{debugData:r,frontendApi:i,pkgVersion:n,publishableKey:s,proxyUrl:o,isSatellite:u=!1,domain:l,signInUrl:d}=t;return`
<head>

@@ -57,3 +57,3 @@ <meta charset="UTF-8" />

script.async = true;
script.src = '${Ir(o||e||i,n)}';
script.src = '${_r(o||e||i,n)}';
script.crossOrigin = 'anonymous';

@@ -65,3 +65,3 @@ script.addEventListener('load', startClerk);

</body>
`}async function _t(t){t.frontendApi=se(t.publishableKey)?.frontendApi||t.frontendApi||"";let e=Re(t),r=await le(()=>N.fetch(Re(t)));if(!r.ok)throw new c({action:"Contact support@clerk.com",message:`Error loading Clerk Interstitial from ${e} with code=${r.status}`,reason:"interstitial-remote-failed-to-load"});return r.text()}function Re(t){t.frontendApi=se(t.publishableKey)?.frontendApi||t.frontendApi||"";let{apiUrl:e,frontendApi:r,pkgVersion:i,publishableKey:n,proxyUrl:s,isSatellite:o,domain:u,signInUrl:l}=t,d=new URL(e);return d.pathname=a(d.pathname,J,"/public/interstitial"),d.searchParams.append("clerk_js_version",It(r,i)),n?d.searchParams.append("publishable_key",n):d.searchParams.append("frontend_api",r),s&&d.searchParams.append("proxy_url",s),o&&d.searchParams.append("is_satellite","true"),d.searchParams.append("sign_in_url",l||""),He(t.frontendApi)||d.searchParams.append("use_domain_for_script","true"),u&&d.searchParams.append("domain",u),d.href}var It=(t,e)=>!e&&St(t)?"staging":e?e.includes("next")?"next":e.split(".")[0]||"latest":"latest",Ir=(t,e)=>{let r=t.replace(/http(s)?:\/\//,""),i=It(t,e);return`https://${r}/npm/@clerk/clerk-js@${i}/dist/clerk.browser.js`};var Xe=(n=>(n.SignedIn="signed-in",n.SignedOut="signed-out",n.Interstitial="interstitial",n.Unknown="unknown",n))(Xe||{});async function Qe(t,e){let{apiKey:r,secretKey:i,apiUrl:n,apiVersion:s,cookieToken:o,frontendApi:u,proxyUrl:l,publishableKey:d,domain:g,isSatellite:f,headerToken:b,loadSession:y,loadUser:S,loadOrganization:x,signInUrl:T}=t,{sid:O,org_id:k,sub:I}=e,{sessions:A,users:_,organizations:h}=ie({apiKey:r,secretKey:i,apiUrl:n,apiVersion:s}),[p,te,ue]=await Promise.all([y?A.getSession(O):Promise.resolve(void 0),S?_.getUser(I):Promise.resolve(void 0),x&&k?h.getOrganization({organizationId:k}):Promise.resolve(void 0)]),$t=Ge(e,{secretKey:i,apiKey:r,apiUrl:n,apiVersion:s,token:o||b||"",session:p,user:te,organization:ue},{...t,status:"signed-in"});return{status:"signed-in",reason:null,message:null,frontendApi:u,proxyUrl:l,publishableKey:d,domain:g,isSatellite:f,signInUrl:T,isSignedIn:!0,isInterstitial:!1,isUnknown:!1,toAuth:()=>$t}}function M(t,e,r=""){let{frontendApi:i,publishableKey:n,proxyUrl:s,isSatellite:o,domain:u,signInUrl:l}=t;return{status:"signed-out",reason:e,message:r,frontendApi:i,proxyUrl:s,publishableKey:n,isSatellite:o,domain:u,signInUrl:l,isSignedIn:!1,isInterstitial:!1,isUnknown:!1,toAuth:()=>Be({...t,status:"signed-out",reason:e,message:r})}}function K(t,e,r=""){let{frontendApi:i,publishableKey:n,proxyUrl:s,isSatellite:o,domain:u,signInUrl:l}=t;return{status:"interstitial",reason:e,message:r,frontendApi:i,publishableKey:n,isSatellite:o,domain:u,proxyUrl:s,signInUrl:l,isSignedIn:!1,isInterstitial:!0,isUnknown:!1,toAuth:()=>null}}function At(t,e,r=""){let{frontendApi:i,publishableKey:n,isSatellite:s,domain:o,signInUrl:u}=t;return{status:"unknown",reason:e,message:r,frontendApi:i,publishableKey:n,isSatellite:s,domain:o,signInUrl:u,isSignedIn:!1,isInterstitial:!1,isUnknown:!0,toAuth:()=>null}}function Ze({originURL:t,host:e,forwardedHost:r,forwardedPort:i,forwardedProto:n}){if(n&&n!==t.protocol)return!0;let s=Ar(r||e);return s.port=i||s.port,s.port!==t.port||s.hostname!==t.hostname}function Ar(t){return new URL(`https://${t}`)}var ve={parse(t,e){return wr(t,wt,e)},stringify(t,e){return Pr(t,wt,e)}},wt={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bits:6};function wr(t,e,r={}){if(!e.codes){e.codes={};for(let l=0;l<e.chars.length;++l)e.codes[e.chars[l]]=l}if(!r.loose&&t.length*e.bits&7)throw new SyntaxError("Invalid padding");let i=t.length;for(;t[i-1]==="=";)if(--i,!r.loose&&!((t.length-i)*e.bits&7))throw new SyntaxError("Invalid padding");let n=new(r.out??Uint8Array)(i*e.bits/8|0),s=0,o=0,u=0;for(let l=0;l<i;++l){let d=e.codes[t[l]];if(d===void 0)throw new SyntaxError("Invalid character "+t[l]);o=o<<e.bits|d,s+=e.bits,s>=8&&(s-=8,n[u++]=255&o>>s)}if(s>=e.bits||255&o<<8-s)throw new SyntaxError("Unexpected end of data");return n}function Pr(t,e,r={}){let{pad:i=!0}=r,n=(1<<e.bits)-1,s="",o=0,u=0;for(let l=0;l<t.length;++l)for(u=u<<8|255&t[l],o+=8;o>e.bits;)o-=e.bits,s+=e.chars[n&u>>o];if(o&&(s+=e.chars[n&u<<e.bits-o]),i)for(;s.length*e.bits&7;)s+="=";return s}var xr=2*1e3,rt={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512",ES256:"SHA-256",ES384:"SHA-384",ES512:"SHA-512"},et="RSASSA-PKCS1-v1_5",tt="ECDSA",Tr={RS256:et,RS384:et,RS512:et,ES256:tt,ES384:tt,ES512:tt},Rr=Object.keys(rt);async function Pt(t,e){let{header:r,signature:i,raw:n}=t,o=new TextEncoder().encode([n.header,n.payload].join(".")),u=await N.crypto.subtle.importKey("jwk",e,{name:Tr[r.alg],hash:rt[r.alg]},!1,["verify"]);return N.crypto.subtle.verify("RSASSA-PKCS1-v1_5",u,i,o)}function Ue(t){let e=(t||"").toString().split(".");if(e.length!==3)throw new c({reason:"token-invalid",message:"Invalid JWT form. A JWT consists of three parts separated by dots."});let[r,i,n]=e,s=new TextDecoder,o=JSON.parse(s.decode(ve.parse(r,{loose:!0}))),u=JSON.parse(s.decode(ve.parse(i,{loose:!0}))),l=ve.parse(n,{loose:!0});return{header:o,payload:u,signature:l,raw:{header:r,payload:i,signature:n,text:t}}}async function nt(t,{audience:e,authorizedParties:r,clockSkewInSeconds:i=xr,issuer:n,key:s}){let o=Ue(t),{header:u,payload:l}=o,{typ:d,alg:g}=u;if(typeof d<"u"&&d!=="JWT")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-invalid",message:`Invalid JWT type ${JSON.stringify(d)}. Expected "JWT".`});if(!rt[g])throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-invalid-algorithm",message:`Invalid JWT algorithm ${JSON.stringify(g)}. Supported: ${Rr}.`});let{azp:f,sub:b,aud:y,iss:S,iat:x,exp:T,nbf:O}=l;if(typeof b!="string")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Subject claim (sub) is required and must be a string. Received ${JSON.stringify(b)}.`});if(typeof y=="string"){if(y!==e)throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT audience claim (aud) ${JSON.stringify(y)}. Expected "${e}".`})}else if(Array.isArray(y)&&y.length>0&&y.every(h=>typeof h=="string")&&!y.includes(e))throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT audience claim array (aud) ${JSON.stringify(y)}. Does not include "${e}".`});if(f&&r&&r.length>0&&!r.includes(f))throw new c({reason:"token-invalid-authorized-parties",message:`Invalid JWT Authorized party claim (azp) ${JSON.stringify(f)}. Expected "${r}".`});if(typeof n=="function"&&!n(S))throw new c({reason:"token-invalid-issuer",message:"Failed JWT issuer resolver. Make sure that the resolver returns a truthy value."});if(typeof n=="string"&&S&&S!==n)throw new c({reason:"token-invalid-issuer",message:`Invalid JWT issuer claim (iss) ${JSON.stringify(o.payload.iss)}. Expected "${n}".`});if(typeof T!="number")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT expiry date claim (exp) ${JSON.stringify(T)}. Expected number.`});let k=new Date(Date.now()),I=new Date(0);if(I.setUTCSeconds(T),I.getTime()<=k.getTime()-i)throw new c({reason:"token-expired",message:`JWT is expired. Expiry date: ${I}, Current date: ${k}.`});if(O!==void 0){if(typeof O!="number")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT not before date claim (nbf) ${JSON.stringify(O)}. Expected number.`});let h=new Date(0);if(h.setUTCSeconds(O),h.getTime()>k.getTime()+i)throw new c({reason:"token-not-active-yet",message:`JWT cannot be used prior to not before date claim (nbf). Not before date: ${h}; Current date: ${k};`})}if(x!==void 0){if(typeof x!="number")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT issued at date claim (iat) ${JSON.stringify(x)}. Expected number.`});let h=new Date(0);if(h.setUTCSeconds(x),h.getTime()>k.getTime()+i)throw new c({reason:"token-not-active-yet",message:`JWT issued at date claim (iat) is in the future. Issued at date: ${h}; Current date: ${k};`})}let _;try{_=await Pt(o,s)}catch(h){throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Error verifying JWT signature. ${h}`})}if(!_)throw new c({reason:"token-invalid-signature",message:"JWT signature is invalid."});return l}var Ce={},Tt=0;function Ee(t){return Ce[t]}function Rt(t,e=1e3*60*60){Ce[t.kid]=t,Tt=Date.now(),e>=0&&setTimeout(()=>{t?delete Ce[t.kid]:Ce={}},e)}var xt="local",Nr="-----BEGIN PUBLIC KEY-----",vr="-----END PUBLIC KEY-----",Ur="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA",Cr="IDAQAB";function Jt(t){if(!Ee(xt)){if(!t)throw new c({action:"Set the CLERK_JWT_KEY environment variable.",message:"Missing local JWK.",reason:"jwk-local-missing"});let e=t.replace(/(\r\n|\n|\r)/gm,"").replace(Nr,"").replace(vr,"").replace(Ur,"").replace(Cr,"").replace(/\+/g,"-").replace(/\//g,"_");Rt({kid:"local",kty:"RSA",alg:"RS256",n:e,e:"AQAB"},-1)}return Ee(xt)}async function it({apiKey:t,secretKey:e,apiUrl:r=z,apiVersion:i=J,issuer:n,kid:s,jwksCacheTtlInMs:o=1e3*60*60,skipJwksCache:u}){let l=!Ee(s)&&Mr();if(u||l){let g,f=e||t;if(f)g=()=>qr(r,f,i);else if(n)g=()=>Er(n);else throw new c({action:"Contact support@clerk.com",message:"Failed to load JWKS from Clerk Backend or Frontend API.",reason:"jwk-remote-failed-to-load"});let{keys:b}=await le(g);if(!b||!b.length)throw new c({action:"Contact support@clerk.com",message:"The JWKS endpoint did not contain any signing keys. Contact support@clerk.com.",reason:"jwk-remote-failed-to-load"});b.forEach(y=>Rt(y,o))}let d=Ee(s);if(!d)throw new c({action:"Contact support@clerk.com",message:`Unable to find a signing key in JWKS that matches kid='${s}'.`,reason:"jwk-remote-missing"});return d}async function Er(t){let e=new URL(t);e.pathname=a(e.pathname,".well-known/jwks.json");let r=await N.fetch(e.href);if(!r.ok)throw new c({action:"Contact support@clerk.com",message:`Error loading Clerk JWKS from ${e.href} with code=${r.status}`,reason:"jwk-remote-failed-to-load"});return r.json()}async function qr(t,e,r){if(!e)throw new c({action:"Set the CLERK_SECRET_KEY or CLERK_API_KEY environment variable.",message:"Missing Clerk Secret Key or API Key. Go to https://dashboard.clerk.com and get your key for your instance.",reason:"jwk-remote-failed-to-load"});let i=new URL(t);i.pathname=a(i.pathname,r,"/jwks");let n=await N.fetch(i.href,{headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok)throw new c({action:"Contact support@clerk.com",message:`Error loading Clerk JWKS from ${i.href} with code=${n.status}`,reason:"jwk-remote-failed-to-load"});return n.json()}function Mr(){return Date.now()-Tt>=300*1e3}async function st(t,e){let{apiKey:r,secretKey:i,apiUrl:n,apiVersion:s,authorizedParties:o,clockSkewInSeconds:u,issuer:l,jwksCacheTtlInMs:d,jwtKey:g,skipJwksCache:f}=e,{header:b}=Ue(t),{kid:y}=b,S;if(g)S=Jt(g);else if(typeof l=="string")S=await it({issuer:l,kid:y,jwksCacheTtlInMs:d,skipJwksCache:f});else if(r||i)S=await it({apiKey:r,secretKey:i,apiUrl:n,apiVersion:s,kid:y,jwksCacheTtlInMs:d,skipJwksCache:f});else throw new c({action:"Set the CLERK_JWT_KEY environment variable.",message:"Failed to resolve JWK during verification.",reason:"jwk-failed-to-resolve"});return await nt(t,{authorizedParties:o,clockSkewInSeconds:u,key:S,issuer:l})}var zr=t=>!!t?.get("__clerk_satellite_url"),Nt=t=>t?.get("__clerk_synced")==="true",vt=t=>{let{apiKey:e,secretKey:r,userAgent:i}=t;if(j(r||e)&&!i?.startsWith("Mozilla/"))return M(t,"header-missing-non-browser")},Ut=t=>{let{origin:e,host:r,forwardedHost:i,forwardedPort:n,forwardedProto:s}=t;if(e&&Ze({originURL:new URL(e),host:r,forwardedHost:i,forwardedPort:n,forwardedProto:s}))return M(t,"header-missing-cors")},Ct=t=>{let{apiKey:e,secretKey:r,isSatellite:i,searchParams:n}=t;if(j(r||e)&&!i&&zr(n))return K(t,"primary-responds-to-syncing")},Et=t=>{let{apiKey:e,secretKey:r,clientUat:i}=t;if(j(r||e)&&!i)return K(t,"uat-missing")},qt=t=>{let{apiKey:e,secretKey:r,referrer:i,host:n,forwardedHost:s,forwardedPort:o,forwardedProto:u,isSatellite:l,searchParams:d}=t,g=i&&Ze({originURL:new URL(i),host:n,forwardedHost:s,forwardedPort:o,forwardedProto:u}),f=r||e;if(!l&&!Nt(d)&&j(f)&&g)return K(t,"cross-origin-referrer")},Mt=t=>{let{apiKey:e,secretKey:r,clientUat:i,cookieToken:n}=t;if(bt(r||e)&&!i&&!n)return M(t,"cookie-and-uat-missing")},Kt=t=>{let{clientUat:e}=t;if(e==="0")return M(t,"standard-signed-out")},zt=t=>{let{clientUat:e,cookieToken:r}=t;if(e&&Number.parseInt(e)>0&&!r)return K(t,"cookie-missing")},jt=async t=>{let{headerToken:e}=t,r=await Lt(t,e);return await Qe(t,r)},Wt=async t=>{let{cookieToken:e,clientUat:r}=t,i=await Lt(t,e),n=await Qe(t,i),o=n.toAuth().sessionClaims.iat<Number.parseInt(r);return!r||o?K(t,"cookie-outdated"):n};async function ot(t,e){for(let r of e){let i=await r(t);if(i)return i}return M(t,"unexpected-error")}async function Lt(t,e){let{isSatellite:r,proxyUrl:i}=t,n;return r?n=null:i?n=i:n=s=>s.startsWith("https://clerk.")||s.includes(".clerk.accounts"),st(e,{...t,issuer:n})}var Dt=t=>{let{clientUat:e,isSatellite:r,searchParams:i,secretKey:n,apiKey:s}=t,u=j(n||s);if(r&&(!e||e==="0")&&!Nt(i)&&!u)return K(t,"satellite-needs-syncing")};function jr(t,e){if(!t&&j(e))throw new Error("Missing signInUrl. Pass a signInUrl for dev instances if an app is satellite")}function Wr(t){if(!t)throw new Error("Missing domain and proxyUrl. A satellite application needs to specify a domain or a proxyUrl")}async function Ft(t){t.frontendApi=se(t.publishableKey)?.frontendApi||t.frontendApi||"",t.apiUrl=t.apiUrl||z,t.apiVersion=t.apiVersion||J,Te(t.secretKey||t.apiKey),t.isSatellite&&(jr(t.signInUrl,t.secretKey||t.apiKey),Wr(t.proxyUrl||t.domain));async function e(){try{return await ot(t,[jt])}catch(n){return i(n,"header")}}async function r(){try{return await ot(t,[Ut,vt,Dt,Ct,Mt,Et,qt,zt,Kt,Wt])}catch(n){return i(n,"cookie")}}function i(n,s){return n instanceof c?(n.tokenCarrier=s,["token-expired","token-not-active-yet"].includes(n.reason)?s==="header"?At(t,n.reason,n.getFullMessage()):K(t,n.reason,n.getFullMessage()):M(t,n.reason,n.getFullMessage())):M(t,"unexpected-error",n.message)}return t.headerToken?e():r()}var qe=t=>{let{frontendApi:e,isSignedIn:r,proxyUrl:i,isInterstitial:n,reason:s,message:o,publishableKey:u,isSatellite:l,domain:d}=t;return{frontendApi:e,isSignedIn:r,proxyUrl:i,isInterstitial:n,reason:s,message:o,publishableKey:u,isSatellite:l,domain:d}};function at(t){let{apiClient:e}=t,{apiKey:r="",secretKey:i="",jwtKey:n="",apiUrl:s=z,apiVersion:o=J,frontendApi:u="",proxyUrl:l="",publishableKey:d="",isSatellite:g=!1,domain:f=""}=t.options;return{authenticateRequest:({apiKey:O,secretKey:k,frontendApi:I,proxyUrl:A,publishableKey:_,jwtKey:h,isSatellite:p,domain:te,searchParams:ue,...Me})=>Ft({...Me,apiKey:O||r,secretKey:k||i,apiUrl:s,apiVersion:o,frontendApi:I||u,proxyUrl:A||l,publishableKey:_||d,isSatellite:p||g,domain:te||f,jwtKey:h||n,searchParams:ue}),localInterstitial:Ne,remotePublicInterstitial:({frontendApi:O,publishableKey:k,proxyUrl:I,isSatellite:A,domain:_,...h})=>_t({...h,apiUrl:s,frontendApi:O||u,publishableKey:k||d,proxyUrl:I||l,isSatellite:A||g,domain:_||f}),remotePrivateInterstitial:()=>e.interstitial.getInterstitial(),remotePublicInterstitialUrl:Re,debugRequestState:qe}}function Lr(t){let e={...t},r=ie(e),i=at({options:e,apiClient:r});return{...r,...i,__unstable_options:e}}0&&(module.exports={AllowlistIdentifier,AuthStatus,Clerk,Client,DeletedObject,Email,EmailAddress,ExternalAccount,IdentificationLink,Invitation,OauthAccessToken,ObjectType,Organization,OrganizationInvitation,OrganizationMembership,OrganizationMembershipPublicUserData,PhoneNumber,RedirectUrl,SMSMessage,Session,SignInToken,Token,User,Verification,constants,createAuthenticateRequest,debugRequestState,decodeJwt,deserialize,hasValidSignature,loadInterstitialFromLocal,makeAuthObjectSerializable,prunePrivateMetadata,sanitizeAuthObject,signedInAuthObject,signedOutAuthObject,verifyJwt,verifyToken});
`}async function _t(t){t.frontendApi=se(t.publishableKey)?.frontendApi||t.frontendApi||"";let e=Re(t),r=await le(()=>N.fetch(Re(t)));if(!r.ok)throw new c({action:"Contact support@clerk.com",message:`Error loading Clerk Interstitial from ${e} with code=${r.status}`,reason:"interstitial-remote-failed-to-load"});return r.text()}function Re(t){t.frontendApi=se(t.publishableKey)?.frontendApi||t.frontendApi||"";let{apiUrl:e,frontendApi:r,pkgVersion:i,publishableKey:n,proxyUrl:s,isSatellite:o,domain:u,signInUrl:l}=t,d=new URL(e);return d.pathname=a(d.pathname,J,"/public/interstitial"),d.searchParams.append("clerk_js_version",It(r,i)),n?d.searchParams.append("publishable_key",n):d.searchParams.append("frontend_api",r),s&&d.searchParams.append("proxy_url",s),o&&d.searchParams.append("is_satellite","true"),d.searchParams.append("sign_in_url",l||""),He(t.frontendApi)||d.searchParams.append("use_domain_for_script","true"),u&&d.searchParams.append("domain",u),d.href}var It=(t,e)=>!e&&St(t)?"staging":e?e.includes("next")?"next":e.split(".")[0]||"latest":"latest",_r=(t,e)=>{let r=t.replace(/http(s)?:\/\//,""),i=It(t,e);return`https://${r}/npm/@clerk/clerk-js@${i}/dist/clerk.browser.js`};var Xe=(n=>(n.SignedIn="signed-in",n.SignedOut="signed-out",n.Interstitial="interstitial",n.Unknown="unknown",n))(Xe||{});async function Qe(t,e){let{apiKey:r,secretKey:i,apiUrl:n,apiVersion:s,cookieToken:o,frontendApi:u,proxyUrl:l,publishableKey:d,domain:g,isSatellite:y,headerToken:b,loadSession:f,loadUser:S,loadOrganization:x,signInUrl:T}=t,{sid:O,org_id:k,sub:I}=e,{sessions:A,users:_,organizations:h}=ie({apiKey:r,secretKey:i,apiUrl:n,apiVersion:s}),[p,te,ue]=await Promise.all([f?A.getSession(O):Promise.resolve(void 0),S?_.getUser(I):Promise.resolve(void 0),x&&k?h.getOrganization({organizationId:k}):Promise.resolve(void 0)]),Vt=Ge(e,{secretKey:i,apiKey:r,apiUrl:n,apiVersion:s,token:o||b||"",session:p,user:te,organization:ue},{...t,status:"signed-in"});return{status:"signed-in",reason:null,message:null,frontendApi:u,proxyUrl:l,publishableKey:d,domain:g,isSatellite:y,signInUrl:T,isSignedIn:!0,isInterstitial:!1,isUnknown:!1,toAuth:()=>Vt}}function M(t,e,r=""){let{frontendApi:i,publishableKey:n,proxyUrl:s,isSatellite:o,domain:u,signInUrl:l}=t;return{status:"signed-out",reason:e,message:r,frontendApi:i,proxyUrl:s,publishableKey:n,isSatellite:o,domain:u,signInUrl:l,isSignedIn:!1,isInterstitial:!1,isUnknown:!1,toAuth:()=>Be({...t,status:"signed-out",reason:e,message:r})}}function K(t,e,r=""){let{frontendApi:i,publishableKey:n,proxyUrl:s,isSatellite:o,domain:u,signInUrl:l}=t;return{status:"interstitial",reason:e,message:r,frontendApi:i,publishableKey:n,isSatellite:o,domain:u,proxyUrl:s,signInUrl:l,isSignedIn:!1,isInterstitial:!0,isUnknown:!1,toAuth:()=>null}}function At(t,e,r=""){let{frontendApi:i,publishableKey:n,isSatellite:s,domain:o,signInUrl:u}=t;return{status:"unknown",reason:e,message:r,frontendApi:i,publishableKey:n,isSatellite:s,domain:o,signInUrl:u,isSignedIn:!1,isInterstitial:!1,isUnknown:!0,toAuth:()=>null}}function Ze({originURL:t,host:e,forwardedHost:r,forwardedPort:i,forwardedProto:n}){if(n&&n!==t.protocol)return!0;let s=Ir(r||e);return s.port=i||s.port,s.port!==t.port||s.hostname!==t.hostname}function Ir(t){return new URL(`https://${t}`)}var ve={parse(t,e){return Ar(t,wt,e)},stringify(t,e){return wr(t,wt,e)}},wt={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bits:6};function Ar(t,e,r={}){if(!e.codes){e.codes={};for(let l=0;l<e.chars.length;++l)e.codes[e.chars[l]]=l}if(!r.loose&&t.length*e.bits&7)throw new SyntaxError("Invalid padding");let i=t.length;for(;t[i-1]==="=";)if(--i,!r.loose&&!((t.length-i)*e.bits&7))throw new SyntaxError("Invalid padding");let n=new(r.out??Uint8Array)(i*e.bits/8|0),s=0,o=0,u=0;for(let l=0;l<i;++l){let d=e.codes[t[l]];if(d===void 0)throw new SyntaxError("Invalid character "+t[l]);o=o<<e.bits|d,s+=e.bits,s>=8&&(s-=8,n[u++]=255&o>>s)}if(s>=e.bits||255&o<<8-s)throw new SyntaxError("Unexpected end of data");return n}function wr(t,e,r={}){let{pad:i=!0}=r,n=(1<<e.bits)-1,s="",o=0,u=0;for(let l=0;l<t.length;++l)for(u=u<<8|255&t[l],o+=8;o>e.bits;)o-=e.bits,s+=e.chars[n&u>>o];if(o&&(s+=e.chars[n&u<<e.bits-o]),i)for(;s.length*e.bits&7;)s+="=";return s}var Pr=2*1e3,rt={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512",ES256:"SHA-256",ES384:"SHA-384",ES512:"SHA-512"},et="RSASSA-PKCS1-v1_5",tt="ECDSA",xr={RS256:et,RS384:et,RS512:et,ES256:tt,ES384:tt,ES512:tt},Tr=Object.keys(rt);async function Pt(t,e){let{header:r,signature:i,raw:n}=t,o=new TextEncoder().encode([n.header,n.payload].join(".")),u=await N.crypto.subtle.importKey("jwk",e,{name:xr[r.alg],hash:rt[r.alg]},!1,["verify"]);return N.crypto.subtle.verify("RSASSA-PKCS1-v1_5",u,i,o)}function Ce(t){let e=(t||"").toString().split(".");if(e.length!==3)throw new c({reason:"token-invalid",message:"Invalid JWT form. A JWT consists of three parts separated by dots."});let[r,i,n]=e,s=new TextDecoder,o=JSON.parse(s.decode(ve.parse(r,{loose:!0}))),u=JSON.parse(s.decode(ve.parse(i,{loose:!0}))),l=ve.parse(n,{loose:!0});return{header:o,payload:u,signature:l,raw:{header:r,payload:i,signature:n,text:t}}}async function nt(t,{audience:e,authorizedParties:r,clockSkewInSeconds:i=Pr,issuer:n,key:s}){let o=Ce(t),{header:u,payload:l}=o,{typ:d,alg:g}=u;if(typeof d<"u"&&d!=="JWT")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-invalid",message:`Invalid JWT type ${JSON.stringify(d)}. Expected "JWT".`});if(!rt[g])throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-invalid-algorithm",message:`Invalid JWT algorithm ${JSON.stringify(g)}. Supported: ${Tr}.`});let{azp:y,sub:b,aud:f,iss:S,iat:x,exp:T,nbf:O}=l;if(typeof b!="string")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Subject claim (sub) is required and must be a string. Received ${JSON.stringify(b)}.`});if(typeof f=="string"){if(f!==e)throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT audience claim (aud) ${JSON.stringify(f)}. Expected "${e}".`})}else if(Array.isArray(f)&&f.length>0&&f.every(h=>typeof h=="string")&&!f.includes(e))throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT audience claim array (aud) ${JSON.stringify(f)}. Does not include "${e}".`});if(y&&r&&r.length>0&&!r.includes(y))throw new c({reason:"token-invalid-authorized-parties",message:`Invalid JWT Authorized party claim (azp) ${JSON.stringify(y)}. Expected "${r}".`});if(typeof n=="function"&&!n(S))throw new c({reason:"token-invalid-issuer",message:"Failed JWT issuer resolver. Make sure that the resolver returns a truthy value."});if(typeof n=="string"&&S&&S!==n)throw new c({reason:"token-invalid-issuer",message:`Invalid JWT issuer claim (iss) ${JSON.stringify(o.payload.iss)}. Expected "${n}".`});if(typeof T!="number")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT expiry date claim (exp) ${JSON.stringify(T)}. Expected number.`});let k=new Date(Date.now()),I=new Date(0);if(I.setUTCSeconds(T),I.getTime()<=k.getTime()-i)throw new c({reason:"token-expired",message:`JWT is expired. Expiry date: ${I}, Current date: ${k}.`});if(O!==void 0){if(typeof O!="number")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT not before date claim (nbf) ${JSON.stringify(O)}. Expected number.`});let h=new Date(0);if(h.setUTCSeconds(O),h.getTime()>k.getTime()+i)throw new c({reason:"token-not-active-yet",message:`JWT cannot be used prior to not before date claim (nbf). Not before date: ${h}; Current date: ${k};`})}if(x!==void 0){if(typeof x!="number")throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Invalid JWT issued at date claim (iat) ${JSON.stringify(x)}. Expected number.`});let h=new Date(0);if(h.setUTCSeconds(x),h.getTime()>k.getTime()+i)throw new c({reason:"token-not-active-yet",message:`JWT issued at date claim (iat) is in the future. Issued at date: ${h}; Current date: ${k};`})}let _;try{_=await Pt(o,s)}catch(h){throw new c({action:"Make sure that this is a valid Clerk generate JWT.",reason:"token-verification-failed",message:`Error verifying JWT signature. ${h}`})}if(!_)throw new c({reason:"token-invalid-signature",message:"JWT signature is invalid."});return l}var Ue={},Tt=0;function Ee(t){return Ue[t]}function Rt(t,e=1e3*60*60){Ue[t.kid]=t,Tt=Date.now(),e>=0&&setTimeout(()=>{t?delete Ue[t.kid]:Ue={}},e)}var xt="local",Jr="-----BEGIN PUBLIC KEY-----",Nr="-----END PUBLIC KEY-----",vr="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA",Cr="IDAQAB";function Jt(t){if(!Ee(xt)){if(!t)throw new c({action:"Set the CLERK_JWT_KEY environment variable.",message:"Missing local JWK.",reason:"jwk-local-missing"});let e=t.replace(/(\r\n|\n|\r)/gm,"").replace(Jr,"").replace(Nr,"").replace(vr,"").replace(Cr,"").replace(/\+/g,"-").replace(/\//g,"_");Rt({kid:"local",kty:"RSA",alg:"RS256",n:e,e:"AQAB"},-1)}return Ee(xt)}async function it({apiKey:t,secretKey:e,apiUrl:r=z,apiVersion:i=J,issuer:n,kid:s,jwksCacheTtlInMs:o=1e3*60*60,skipJwksCache:u}){let l=!Ee(s)&&qr();if(u||l){let g,y=e||t;if(y)g=()=>Er(r,y,i);else if(n)g=()=>Ur(n);else throw new c({action:"Contact support@clerk.com",message:"Failed to load JWKS from Clerk Backend or Frontend API.",reason:"jwk-remote-failed-to-load"});let{keys:b}=await le(g);if(!b||!b.length)throw new c({action:"Contact support@clerk.com",message:"The JWKS endpoint did not contain any signing keys. Contact support@clerk.com.",reason:"jwk-remote-failed-to-load"});b.forEach(f=>Rt(f,o))}let d=Ee(s);if(!d)throw new c({action:"Contact support@clerk.com",message:`Unable to find a signing key in JWKS that matches kid='${s}'.`,reason:"jwk-remote-missing"});return d}async function Ur(t){let e=new URL(t);e.pathname=a(e.pathname,".well-known/jwks.json");let r=await N.fetch(e.href);if(!r.ok)throw new c({action:"Contact support@clerk.com",message:`Error loading Clerk JWKS from ${e.href} with code=${r.status}`,reason:"jwk-remote-failed-to-load"});return r.json()}async function Er(t,e,r){if(!e)throw new c({action:"Set the CLERK_SECRET_KEY or CLERK_API_KEY environment variable.",message:"Missing Clerk Secret Key or API Key. Go to https://dashboard.clerk.com and get your key for your instance.",reason:"jwk-remote-failed-to-load"});let i=new URL(t);i.pathname=a(i.pathname,r,"/jwks");let n=await N.fetch(i.href,{headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok)throw new c({action:"Contact support@clerk.com",message:`Error loading Clerk JWKS from ${i.href} with code=${n.status}`,reason:"jwk-remote-failed-to-load"});return n.json()}function qr(){return Date.now()-Tt>=300*1e3}async function st(t,e){let{apiKey:r,secretKey:i,apiUrl:n,apiVersion:s,authorizedParties:o,clockSkewInSeconds:u,issuer:l,jwksCacheTtlInMs:d,jwtKey:g,skipJwksCache:y}=e,{header:b}=Ce(t),{kid:f}=b,S;if(g)S=Jt(g);else if(typeof l=="string")S=await it({issuer:l,kid:f,jwksCacheTtlInMs:d,skipJwksCache:y});else if(r||i)S=await it({apiKey:r,secretKey:i,apiUrl:n,apiVersion:s,kid:f,jwksCacheTtlInMs:d,skipJwksCache:y});else throw new c({action:"Set the CLERK_JWT_KEY environment variable.",message:"Failed to resolve JWK during verification.",reason:"jwk-failed-to-resolve"});return await nt(t,{authorizedParties:o,clockSkewInSeconds:u,key:S,issuer:l})}var Kr=t=>!!t?.get("__clerk_satellite_url"),Nt=t=>t?.get("__clerk_synced")==="true",vt=t=>{let{apiKey:e,secretKey:r,userAgent:i}=t;if(j(r||e)&&!i?.startsWith("Mozilla/"))return M(t,"header-missing-non-browser")},Ct=t=>{let{origin:e,host:r,forwardedHost:i,forwardedPort:n,forwardedProto:s}=t;if(e&&Ze({originURL:new URL(e),host:r,forwardedHost:i,forwardedPort:n,forwardedProto:s}))return M(t,"header-missing-cors")},Ut=t=>{let{apiKey:e,secretKey:r,isSatellite:i,searchParams:n}=t;if(j(r||e)&&!i&&Kr(n))return K(t,"primary-responds-to-syncing")},Et=t=>{let{apiKey:e,secretKey:r,clientUat:i}=t;if(j(r||e)&&!i)return K(t,"uat-missing")},qt=t=>{let{apiKey:e,secretKey:r,referrer:i,host:n,forwardedHost:s,forwardedPort:o,forwardedProto:u,isSatellite:l,searchParams:d}=t,g=i&&Ze({originURL:new URL(i),host:n,forwardedHost:s,forwardedPort:o,forwardedProto:u}),y=r||e;if(!l&&!Nt(d)&&j(y)&&g)return K(t,"cross-origin-referrer")},Mt=t=>{let{apiKey:e,secretKey:r,clientUat:i,cookieToken:n}=t;if(bt(r||e)&&!i&&!n)return M(t,"cookie-and-uat-missing")},Kt=t=>{let{clientUat:e}=t;if(e==="0")return M(t,"standard-signed-out")},zt=t=>{let{clientUat:e,cookieToken:r}=t;if(e&&Number.parseInt(e)>0&&!r)return K(t,"cookie-missing")},jt=async t=>{let{headerToken:e}=t,r=await Lt(t,e);return await Qe(t,r)},Wt=async t=>{let{cookieToken:e,clientUat:r}=t,i=await Lt(t,e),n=await Qe(t,i),o=n.toAuth().sessionClaims.iat<Number.parseInt(r);return!r||o?K(t,"cookie-outdated"):n};async function ot(t,e){for(let r of e){let i=await r(t);if(i)return i}return M(t,"unexpected-error")}async function Lt(t,e){let{isSatellite:r,proxyUrl:i}=t,n;return r?n=null:i?n=i:n=s=>s.startsWith("https://clerk.")||s.includes(".clerk.accounts"),st(e,{...t,issuer:n})}var Dt=t=>{let{clientUat:e,isSatellite:r,searchParams:i,secretKey:n,apiKey:s}=t,u=j(n||s);if(r&&(!e||e==="0")&&!Nt(i)&&!u)return K(t,"satellite-needs-syncing")};function zr(t,e){if(!t&&j(e))throw new Error("Missing signInUrl. Pass a signInUrl for dev instances if an app is satellite")}function jr(t){if(!t)throw new Error("Missing domain and proxyUrl. A satellite application needs to specify a domain or a proxyUrl")}async function Ft(t){t.frontendApi=se(t.publishableKey)?.frontendApi||t.frontendApi||"",t.apiUrl=t.apiUrl||z,t.apiVersion=t.apiVersion||J,Te(t.secretKey||t.apiKey),t.isSatellite&&(zr(t.signInUrl,t.secretKey||t.apiKey),jr(t.proxyUrl||t.domain));async function e(){try{return await ot(t,[jt])}catch(n){return i(n,"header")}}async function r(){try{return await ot(t,[Ct,vt,Dt,Ut,Mt,Et,qt,zt,Kt,Wt])}catch(n){return i(n,"cookie")}}function i(n,s){return n instanceof c?(n.tokenCarrier=s,["token-expired","token-not-active-yet"].includes(n.reason)?s==="header"?At(t,n.reason,n.getFullMessage()):K(t,n.reason,n.getFullMessage()):M(t,n.reason,n.getFullMessage())):M(t,"unexpected-error",n.message)}return t.headerToken?e():r()}var qe=t=>{let{frontendApi:e,isSignedIn:r,proxyUrl:i,isInterstitial:n,reason:s,message:o,publishableKey:u,isSatellite:l,domain:d}=t;return{frontendApi:e,isSignedIn:r,proxyUrl:i,isInterstitial:n,reason:s,message:o,publishableKey:u,isSatellite:l,domain:d}};function at(t){let{apiClient:e}=t,{apiKey:r="",secretKey:i="",jwtKey:n="",apiUrl:s=z,apiVersion:o=J,frontendApi:u="",proxyUrl:l="",publishableKey:d="",isSatellite:g=!1,domain:y=""}=t.options;return{authenticateRequest:({apiKey:O,secretKey:k,frontendApi:I,proxyUrl:A,publishableKey:_,jwtKey:h,isSatellite:p,domain:te,searchParams:ue,...Me})=>Ft({...Me,apiKey:O||r,secretKey:k||i,apiUrl:s,apiVersion:o,frontendApi:I||u,proxyUrl:A||l,publishableKey:_||d,isSatellite:p||g,domain:te||y,jwtKey:h||n,searchParams:ue}),localInterstitial:Ne,remotePublicInterstitial:({frontendApi:O,publishableKey:k,proxyUrl:I,isSatellite:A,domain:_,...h})=>_t({...h,apiUrl:s,frontendApi:O||u,publishableKey:k||d,proxyUrl:I||l,isSatellite:A||g,domain:_||y}),remotePrivateInterstitial:()=>e.interstitial.getInterstitial(),remotePublicInterstitialUrl:Re,debugRequestState:qe}}function Wr(t){let e={...t},r=ie(e),i=at({options:e,apiClient:r});return{...r,...i,__unstable_options:e}}0&&(module.exports={AllowlistIdentifier,AuthStatus,Clerk,Client,DeletedObject,Email,EmailAddress,ExternalAccount,IdentificationLink,Invitation,OauthAccessToken,ObjectType,Organization,OrganizationInvitation,OrganizationMembership,OrganizationMembershipPublicUserData,PhoneNumber,RedirectUrl,SMSMessage,Session,SignInToken,Token,User,Verification,constants,createAuthenticateRequest,debugRequestState,decodeJwt,deserialize,hasValidSignature,loadInterstitialFromLocal,makeAuthObjectSerializable,prunePrivateMetadata,sanitizeAuthObject,signedInAuthObject,signedOutAuthObject,verifyJwt,verifyToken});
//# sourceMappingURL=index.js.map

@@ -46,2 +46,4 @@ import type { OAuthProvider } from '@clerk/types';

password?: string;
skipPasswordChecks?: boolean;
signOutOfOtherSessions?: boolean;
primaryEmailAddressID?: string;

@@ -48,0 +50,0 @@ primaryPhoneNumberID?: string;

@@ -108,3 +108,2 @@ import type { InvitationStatus, OrganizationInvitationStatus, OrganizationMembershipRole, SignInFactorStrategy, SignInIdentifier, SignInStatus, SignUpAttributeRequirements, SignUpIdentificationRequirements, SignUpStatus } from './Enums';

logo_url: string | null;
image_url: string;
public_metadata: Record<string, unknown> | null;

@@ -141,3 +140,2 @@ private_metadata?: Record<string, unknown>;

profile_image_url: string;
image_url: string;
user_id: string;

@@ -225,3 +223,2 @@ }

profile_image_url: string;
image_url: string;
primary_email_address_id: string;

@@ -228,0 +225,0 @@ primary_phone_number_id: string;

@@ -7,3 +7,2 @@ import type { OrganizationJSON } from './JSON';

readonly logoUrl: string | null;
readonly imageUrl: string | null;
readonly createdBy: string;

@@ -15,5 +14,5 @@ readonly createdAt: number;

readonly maxAllowedMemberships: number;
constructor(id: string, name: string, slug: string | null, logoUrl: string | null, imageUrl: string | null, createdBy: string, createdAt: number, updatedAt: number, publicMetadata: Record<string, unknown> | null, privateMetadata: Record<string, unknown>, maxAllowedMemberships: number);
constructor(id: string, name: string, slug: string | null, logoUrl: string | null, createdBy: string, createdAt: number, updatedAt: number, publicMetadata: Record<string, unknown> | null, privateMetadata: Record<string, unknown>, maxAllowedMemberships: number);
static fromJSON(data: OrganizationJSON): Organization;
}
//# sourceMappingURL=Organization.d.ts.map

@@ -21,7 +21,6 @@ import { Organization } from '../resources';

readonly profileImageUrl: string;
readonly imageUrl: string;
readonly userId: string;
constructor(identifier: string, firstName: string | null, lastName: string | null, profileImageUrl: string, imageUrl: string, userId: string);
constructor(identifier: string, firstName: string | null, lastName: string | null, profileImageUrl: string, userId: string);
static fromJSON(data: OrganizationMembershipPublicUserDataJSON): OrganizationMembershipPublicUserData;
}
//# sourceMappingURL=OrganizationMembership.d.ts.map

@@ -16,3 +16,2 @@ import { EmailAddress } from './EmailAddress';

readonly profileImageUrl: string;
readonly imageUrl: string;
readonly gender: string;

@@ -35,5 +34,5 @@ readonly birthday: string;

readonly externalAccounts: ExternalAccount[];
constructor(id: string, passwordEnabled: boolean, totpEnabled: boolean, backupCodeEnabled: boolean, twoFactorEnabled: boolean, banned: boolean, createdAt: number, updatedAt: number, profileImageUrl: string, imageUrl: string, gender: string, birthday: string, primaryEmailAddressId: string | null, primaryPhoneNumberId: string | null, primaryWeb3WalletId: string | null, lastSignInAt: number | null, externalId: string | null, username: string | null, firstName: string | null, lastName: string | null, publicMetadata?: UserPublicMetadata, privateMetadata?: Record<string, unknown>, unsafeMetadata?: UserUnsafeMetadata, emailAddresses?: EmailAddress[], phoneNumbers?: PhoneNumber[], web3Wallets?: Web3Wallet[], externalAccounts?: ExternalAccount[]);
constructor(id: string, passwordEnabled: boolean, totpEnabled: boolean, backupCodeEnabled: boolean, twoFactorEnabled: boolean, banned: boolean, createdAt: number, updatedAt: number, profileImageUrl: string, gender: string, birthday: string, primaryEmailAddressId: string | null, primaryPhoneNumberId: string | null, primaryWeb3WalletId: string | null, lastSignInAt: number | null, externalId: string | null, username: string | null, firstName: string | null, lastName: string | null, publicMetadata?: UserPublicMetadata, privateMetadata?: Record<string, unknown>, unsafeMetadata?: UserUnsafeMetadata, emailAddresses?: EmailAddress[], phoneNumbers?: PhoneNumber[], web3Wallets?: Web3Wallet[], externalAccounts?: ExternalAccount[]);
static fromJSON(data: UserJSON): User;
}
//# sourceMappingURL=User.d.ts.map
{
"name": "@clerk/backend",
"version": "0.16.2",
"version": "0.17.0-staging.0",
"license": "MIT",

@@ -27,3 +27,3 @@ "description": "Clerk Backend SDK - REST Client for Backend API & JWT verification utilities",

"dependencies": {
"@clerk/types": "^3.35.0",
"@clerk/types": "^3.35.1-staging.0",
"@peculiar/webcrypto": "1.4.1",

@@ -83,3 +83,3 @@ "@types/node": "16.18.6",

},
"gitHead": "e5282d626a1673cceae3cd6c9915f79311eef9ba"
"gitHead": "9fbfbbae70c3dc2d2c8ef53c545778804df7663f"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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