1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="8e02fc27-491e-6546-a7ad-d4a8720f6ef1")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,300750,e=>{"use strict";e.s(["default",0,{removeItem:e=>localStorage.removeItem(e),clear:()=>localStorage.clear(),setItem:(e,t,r)=>{if(!r){let r="object"==typeof t?JSON.stringify(t):`${t}`;localStorage.setItem(e,r);return}localStorage.setItem(e,JSON.stringify({item:t,expiryDate:new Date(new Date().getTime()+1e3*r).toISOString()}))},getItem:e=>{let t,r,n=localStorage.getItem(e);if(!n)return null;try{let e=JSON.parse(n);t="object"==typeof e&&e.item&&void 0!==e.expiryDate?e.item:e,r=e.expiryDate}catch(e){t=n}return r&&new Date(r).getTime()<new Date().getTime()?(localStorage.removeItem(e),null):t}}])},753970,e=>{"use strict";var t=e.i(85848),r=e.i(300750);e.s(["deleteAuthenticationFromStorage",0,()=>{let e=r.default.getItem("deviceId");r.default.clear(),e&&r.default.setItem("deviceId",e)},"getTokenDataFromStorage",0,()=>{let e=r.default.getItem("refresh_token")??"",t=r.default.getItem("access_token")??"";return[e,r.default.getItem("username")??"",t]},"handleLocalStorageAfterAuthentication",0,(e,n,a)=>{let i=(0,t.jwtDecode)(n);r.default.setItem("userId",i.user_id),e&&r.default.setItem("refresh_token",e),null===e&&r.default.removeItem("refresh_token"),r.default.setItem("access_token",n),a&&r.default.setItem("username",a)}])},480896,e=>{"use strict";e.s(["queryOptions",0,function(e){return e}])},893930,790796,540784,636277,268082,122967,273340,e=>{"use strict";let t;var r=e.i(285700),n=e.i(191788);let a=n.createContext(!1),i=()=>n.useContext(a);a.Provider,e.s(["useIsRestoring",0,i],790796),e.i(391398);let o=n.createContext((t=!1,{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t})),s=()=>n.useContext(o);e.s(["useQueryErrorResetBoundary",0,s],540784);var l=e.i(456298);let u=(e,t,r)=>{let n=r?.state.error&&"function"==typeof e.throwOnError?(0,l.shouldThrowError)(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||n)&&!t.isReset()&&(e.retryOnMount=!1)},c=e=>{n.useEffect(()=>{e.clearReset()},[e])},d=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(a&&void 0===e.data||(0,l.shouldThrowError)(r,[e.error,n]));e.s(["ensurePreventErrorBoundaryRetry",0,u,"getHasError",0,d,"useClearResetErrorBoundary",0,c],636277);let f=e=>{if(e.suspense){let t=e=>"static"===e?e:Math.max(e??1e3,1e3),r=e.staleTime;e.staleTime="function"==typeof r?(...e)=>t(r(...e)):t(r),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,1e3))}},h=(e,t)=>e?.suspense&&t.isPending,p=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});e.s(["defaultThrowOnError",0,(e,t)=>void 0===t.state.data,"ensureSuspenseTimers",0,f,"fetchOptimistic",0,p,"shouldSuspend",0,h],268082);var g=e.i(465235);function m(e,t,a){let o=i(),m=s(),v=(0,r.useQueryClient)(a),y=v.defaultQueryOptions(e),b=v.getQueryCache().get(y.queryHash),E=!1!==e.subscribed;y._optimisticResults=o?"isRestoring":E?"optimistic":void 0,f(y),u(y,m,b),c(m);let[w]=n.useState(()=>new t(v,y)),T=w.getOptimisticResult(y),S=!o&&E;if(n.useSyncExternalStore(n.useCallback(e=>{let t=S?w.subscribe(g.notifyManager.batchCalls(e)):l.noop;return w.updateResult(),t},[w,S]),()=>w.getCurrentResult(),()=>w.getCurrentResult()),n.useEffect(()=>{w.setOptions(y)},[y,w]),h(y,T))throw p(y,w,m);if(d({result:T,errorResetBoundary:m,throwOnError:y.throwOnError,query:b,suspense:y.suspense}))throw T.error;return y.notifyOnChangeProps?T:w.trackResult(T)}e.s(["useBaseQuery",0,m],122967);var v=e.i(974233),y=e.i(60123),b=e.i(895564),E=e.i(879971),w=e.i(84813),T=class extends b.Subscribable{#e;#t=void 0;#r=void 0;#n=void 0;#a;#i;#o;#s;#l;#u;#c;#d;#f;#h=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#t.addObserver(this),S(this.#t,this.options)?this.#p():this.updateResult(),this.#g())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return R(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return R(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#m(),this.#v(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,r=this.#t;if(this.options=this.#e.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,l.resolveQueryValue)(this.options.enabled,this.#t))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#y(),this.#t.setOptions(this.options),t._defaulted&&!(0,l.shallowEqualObjects)(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});let n=this.hasListeners();n&&O(this.#t,r,this.options,t)&&this.#p(),this.updateResult(),n&&(this.#t!==r||(0,l.resolveQueryValue)(this.options.enabled,this.#t)!==(0,l.resolveQueryValue)(t.enabled,this.#t)||(0,l.resolveQueryValue)(this.options.staleTime,this.#t)!==(0,l.resolveQueryValue)(t.staleTime,this.#t))&&this.#b();let a=this.#E();n&&(this.#t!==r||(0,l.resolveQueryValue)(this.options.enabled,this.#t)!==(0,l.resolveQueryValue)(t.enabled,this.#t)||a!==this.#f)&&this.#w(a)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(t,e);return(0,l.shallowEqualObjects)(this.getCurrentResult(),r)||(this.#n=r,this.#i=this.options,this.#a=this.#t.state),r}getCurrentResult(){return this.#n}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),Reflect.get(e,r))})}trackProp(e){this.#h.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t,r=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,r),a=()=>{},i=new Promise(e=>{t=e,a=this.#e.getQueryCache().subscribe(t=>{"updated"===t.type&&t.query.queryHash===n.queryHash&&void 0!==n.state.data&&(a(),e(this.createResult(n,r)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,r);return t?.(e),e}).finally(()=>{a()}),i])}fetch(e){return this.#p({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#p(e){this.#y();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(l.noop)),t}#T(e){return!(0,y.isServer)()&&!1!==(0,l.resolveQueryValue)(this.options.enabled,this.#t)&&(0,l.isValidTimeout)(e)}#b(){this.#m();let e=(0,l.resolveQueryValue)(this.options.staleTime,this.#t);if(this.#n.isStale||!this.#T(e))return;let t=(0,l.timeUntilStale)(this.#n.dataUpdatedAt,e)+1;this.#c=v.timeoutManager.setTimeout(()=>{this.#n.isStale||this.updateResult()},t)}#E(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#w(e){this.#v(),this.#f=e,0!==this.#f&&this.#T(this.#f)&&(this.#d=v.timeoutManager.setInterval(()=>
2{(this.options.refetchIntervalInBackground||E.focusManager.isFocused())&&this.#p()},this.#f))}#g(){this.#b(),this.#w(this.#E())}#m(){void 0!==this.#c&&(v.timeoutManager.clearTimeout(this.#c),this.#c=void 0)}#v(){void 0!==this.#d&&(v.timeoutManager.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let r,n=this.#t,a=this.options,i=this.#n,o=this.#a,s=this.#i,u=e!==n?e.state:this.#r,{state:c}=e,d={...c},f=!1;if(t._optimisticResults){let r=this.hasListeners(),i=!r&&S(e,t),o=r&&O(e,n,t,a);(i||o)&&(d={...d,...(0,w.fetchState)(c.data,e.options)}),"isRestoring"===t._optimisticResults&&(d.fetchStatus="idle")}let{error:h,errorUpdatedAt:p,status:g}=d;r=d.data;let m=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===g){let e;i?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(e=i.data,m=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,void 0!==e&&(g="success",r=(0,l.replaceData)(i?.data,e,t),f=!0)}if(t.select&&void 0!==r&&!m)if(i&&r===o?.data&&t.select===this.#s)r=this.#l;else try{this.#s=t.select,r=t.select(r),r=(0,l.replaceData)(i?.data,r,t),this.#l=r,this.#o=null}catch(e){this.#o=e}else void 0===r&&(this.#o=null);this.#o&&(h=this.#o,r=this.#l,p=Date.now(),g="error",f=!1);let v="fetching"===d.fetchStatus,y="pending"===g,b="error"===g,E=y&&v,T=void 0!==r;return{status:g,fetchStatus:d.fetchStatus,isPending:y,isSuccess:"success"===g,isError:b,isInitialLoading:E,isLoading:E,data:r,dataUpdatedAt:d.dataUpdatedAt,error:h,errorUpdatedAt:p,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:d.dataUpdateCount>u.dataUpdateCount||d.errorUpdateCount>u.errorUpdateCount,isFetching:v,isRefetching:v&&!y,isLoadingError:b&&!T,isPaused:"paused"===d.fetchStatus,isPlaceholderData:f,isRefetchError:b&&T,isStale:I(e,t),refetch:this.refetch,isEnabled:!1!==(0,l.resolveQueryValue)(t.enabled,e)}}updateResult(){let e=this.#n,t=this.createResult(this.#t,this.options);if(this.#a=this.#t.state,this.#i=this.options,void 0!==this.#a.data&&(this.#u=this.#t),(0,l.shallowEqualObjects)(t,e))return;this.#n=t;let r=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#h.size)return!0;let n=new Set(r??this.#h);return this.options.throwOnError&&n.add("error"),Object.keys(this.#n).some(t=>this.#n[t]!==e[t]&&n.has(t))})();g.notifyManager.batch(()=>{r&&this.listeners.forEach(e=>{e(this.#n)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#y(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#r=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#g()}};function S(e,t){return!1!==(0,l.resolveQueryValue)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==(0,l.resolveQueryValue)(t.retryOnMount,e))||void 0!==e.state.data&&R(e,t,t.refetchOnMount)}function R(e,t,r){if(!1!==(0,l.resolveQueryValue)(t.enabled,e)&&"static"!==(0,l.resolveQueryValue)(t.staleTime,e)){let n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&I(e,t)}return!1}function O(e,t,r,n){return(e!==t||!1===(0,l.resolveQueryValue)(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&I(e,r)}function I(e,t){return!1!==(0,l.resolveQueryValue)(t.enabled,e)&&e.isStaleByTime((0,l.resolveQueryValue)(t.staleTime,e))}e.s(["QueryObserver",0,T],273340),e.s(["useQuery",0,function(e,t){return m(e,T,t)}],893930)},928653,645370,773417,543268,e=>{"use strict";var t,r,n=e.i(350461);let a=Object.create(null),i=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?a:globalThis),o=new Proxy(a,{get:(e,t)=>i()[t]??a[t],has:(e,t)=>t in i()||t in a,set:(e,t,r)=>(i(!0)[t]=r,!0),deleteProperty(e,t){if(!t)return!1;let r=i(!0);return delete r[t],!0},ownKeys:()=>Object.keys(i(!0))});function s(e,t){return void 0!==n.default&&n.default.env?n.default.env[e]??t:"u">typeof Deno?Deno.env.get(e)??t:"u">typeof Bun?Bun.env[e]??t:t}function l(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]))}o.NODE_ENV,Object.freeze({get BETTER_AUTH_SECRET(){return s("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return s("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return s("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return s("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return s("NODE_ENV","development")}
2,get PACKAGE_VERSION(){return s("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return s("BETTER_AUTH_TELEMETRY_ENDPOINT","")}}),l({USER_NOT_FOUND:"User not found",FAILED_TO_CREATE_USER:"Failed to create user",FAILED_TO_CREATE_SESSION:"Failed to create session",FAILED_TO_UPDATE_USER:"Failed to update user",FAILED_TO_GET_SESSION:"Failed to get session",INVALID_PASSWORD:"Invalid password",INVALID_EMAIL:"Invalid email",INVALID_EMAIL_OR_PASSWORD:"Invalid email or password",INVALID_USER:"Invalid user",SOCIAL_ACCOUNT_ALREADY_LINKED:"Social account already linked",PROVIDER_NOT_FOUND:"Provider not found",INVALID_TOKEN:"Invalid token",TOKEN_EXPIRED:"Token expired",ID_TOKEN_NOT_SUPPORTED:"id_token not supported",FAILED_TO_GET_USER_INFO:"Failed to get user info",USER_EMAIL_NOT_FOUND:"User email not found",EMAIL_NOT_VERIFIED:"Email not verified",PASSWORD_TOO_SHORT:"Password too short",PASSWORD_TOO_LONG:"Password too long",USER_ALREADY_EXISTS:"User already exists.",USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:"User already exists. Use another email.",EMAIL_CAN_NOT_BE_UPDATED:"Email can not be updated",CHANGE_EMAIL_DISABLED:"Change email is disabled",CREDENTIAL_ACCOUNT_NOT_FOUND:"Credential account not found",SESSION_EXPIRED:"Session expired. Re-authenticate to perform this action.",FAILED_TO_UNLINK_LAST_ACCOUNT:"You can't unlink your last account",ACCOUNT_NOT_FOUND:"Account not found",USER_ALREADY_HAS_PASSWORD:"User already has a password. Provide that to delete the account.",CROSS_SITE_NAVIGATION_LOGIN_BLOCKED:"Cross-site navigation login blocked. This request appears to be a CSRF attack.",VERIFICATION_EMAIL_NOT_ENABLED:"Verification email isn't enabled",EMAIL_ALREADY_VERIFIED:"Email is already verified",EMAIL_MISMATCH:"Email mismatch",SESSION_NOT_FRESH:"Session is not fresh",LINKED_ACCOUNT_ALREADY_EXISTS:"Linked account already exists",INVALID_ORIGIN:"Invalid origin",INVALID_CALLBACK_URL:"Invalid callbackURL",INVALID_REDIRECT_URL:"Invalid redirectURL",INVALID_ERROR_CALLBACK_URL:"Invalid errorCallbackURL",INVALID_
2NEW_USER_CALLBACK_URL:"Invalid newUserCallbackURL",MISSING_OR_NULL_ORIGIN:"Missing or null Origin",CALLBACK_URL_REQUIRED:"callbackURL is required",FAILED_TO_CREATE_VERIFICATION:"Unable to create verification",FIELD_NOT_ALLOWED:"Field not allowed to be set",ASYNC_VALIDATION_NOT_SUPPORTED:"Async validation is not supported",VALIDATION_ERROR:"Validation Error",MISSING_FIELD:"Field is required",METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED:"POST method requires deferSessionRefresh to be enabled in session config",BODY_MUST_BE_AN_OBJECT:"Body must be an object",PASSWORD_ALREADY_SET:"User already has a password set"});let u={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511};var c=class extends Error{status;body;headers;statusCode;constructor(e="INTERNAL_SERVER_ERROR",t,r={},n="number"==typeof e?e:u[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=r,this.statusCode=n,this.name="APIError",this.status=e,this.headers=r,this.statusCode=n,this.body=t}};Symbol.for("better-call:api-error-headers"),t=c,r=Error,Object.defineProperty((class e extends t{#S;constructor(...e){if(function(){let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return void 0===e?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,"writable")?e.writable:void 0!==e.set}()){const t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);const t=Error().stack;t&&(this.#S=function(e){let t=e.split("\n at ");return t.length<=1?e:(t.splice(1,1),t.join("\n at "))}(t.replace(/^Error/,this.name)))}get errorStack(){return this.#S}}).prototype,"constructor",{get:()=>r,enumerable:!1,configurable:!0});var d=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}};function f(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t--;return t===e.length?e:e.slice(0,t)}function h(e,t="/api/auth"){try{let t=new URL(e);if("http:"!==t.protocol&&"https:"!==t.protocol)throw new d(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){if(t instanceof d)throw t;throw new d(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}if(function(e){try{return"/"!==(f(new URL(e).pathname)||"/")}catch{throw new d(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}(e))return e;let r=f(e);return t&&"/"!==t?(t=t.startsWith("/")?t:`/${t}`,`${r}${t}`):r}let p={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},g=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,m={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},v=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/,y=["javascript:","data:","vbscript:"],b={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&function(e){let t;try{t=new URL(e)}catch{return!0}return!y.includes(t.protocol)}(e.data.url)&&"u">typeof window&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},E=(e,t,r,n)=>(e.events=e.events||{},e.events[r+10]||(e.events[r+10]=n(t=>{e.events[r].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[r]=e.events[r]||[],e.events[r].push(t),()=>{let n=e.events[r],a=n.indexOf(t);~a&&(n.splice(a,1),n.length||(e.events[r+10](),delete e.events[r+10]))});function w(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function T(e,t){if(e===t)return!0;
2if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!T(e[r],t[r]))return!1;return!0}if(w(e)&&w(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r)if(!(n in t)||!T(e[n],t[n]))return!1;return!0}return!1}let S=Symbol.for("better-auth:broadcast-channel");var R=class{listeners=new Set;name;constructor(e="better-auth.message"){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if("u">typeof window)try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:Math.floor(Date.now()/1e3)}))}catch{}}setup(){if("u"<typeof window||void 0===window.addEventListener)return()=>{};let e=e=>{if(e.key!==this.name)return;let t=JSON.parse(e.newValue??"{}");t?.event==="session"&&t?.data&&this.listeners.forEach(e=>e(t))};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}};function O(e="better-auth.message"){return globalThis[S]||(globalThis[S]=new R(e)),globalThis[S]}let I=Symbol.for("better-auth:focus-manager");var _=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if("u"<typeof window||"u"<typeof document||void 0===window.addEventListener)return()=>{};let e=()=>{"visible"===document.visibilityState&&this.setFocused(!0)};return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e,!1)}}};function A(){return globalThis[I]||(globalThis[I]=new _),globalThis[I]}let x=Symbol.for("better-auth:online-manager");var N=class{listeners=new Set;isOnline="u"<typeof navigator||navigator.onLine;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if("u"<typeof window||void 0===window.addEventListener)return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",t,!1),()=>{window.removeEventListener("online",e,!1),window.removeEventListener("offline",t,!1)}}};function C(){return globalThis[x]||(globalThis[x]=new N),globalThis[x]}let k=()=>Math.floor(Date.now()/1e3),P=[],L=0,D=globalThis.nanostoresGlobal||={epoch:0},U=e=>{let t=[],r={eq:Object.is,get:()=>(r.lc||r.listen(()=>{})(),r.value),init:e,lc:0,listen:e=>(r.lc=t.push(e),()=>{for(let t=L;t<P.length;)P[t]===e?P.splice(t,4):t+=4;let n=t.indexOf(e);~n&&(t.splice(n,1),--r.lc||r.off())}),notify(e,n){D.epoch++;let a=!P.length;for(let a of t)P.push(a,r,e,n);a&&(()=>{let e,t;for(;L<P.length;){t=L,L+=4;try{P[t](P[t+1].value,P[t+2],P[t+3])}catch(t){e=t}}if(P.length=L=0,e)throw e})()},off(){},set(e){let t=r.value;r.eq(t,e)||(r.value=e,r.notify(t))},subscribe(e){let t=r.listen(e);return e(r.value),t},value:e};return r};function j(e){return"object"==typeof e&&null!==e&&"data"in e&&"error"in e?e:{data:e,error:null}}function M(e,t){return T(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function F(e){if(null===e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.iterator in e)&&(!(Symbol.toStringTag in e)||"[object Module]"===Object.prototype.toString.call(e))}function B(e){return(...t)=>t.reduce((t,r)=>(function e(t,r,n=".",a){if(!F(r))return e(t,{},n,a);let i={...r};for(let r of Object.keys(t)){if("__proto__"===r||"constructor"===r)continue;let o=t[r];null!=o&&(a&&a(i,r,o,n)||(Array.isArray(o)&&Array.isArray(i[r])?i[r]=[...o,...i[r]]:F(o)&&F(i[r])?i[r]=e(o,i[r],(n?`${n}.`:"")+r.toString(),a):i[r]=o))}return i})(t,r,"",e),{})}let Q=B();B((e,t,r)=>{if(void 0!==e[t]&&"function"==typeof r)return e[t]=r(e[t]),!0}),B((e,t,r)=>{if(Array.isArray(e[t])&&"function"==typeof r)return e[t]=r(e[t]),!0});var V=Object.defineProperty,$=Object.defineProperties,H=Object.getOwnPropertyDescriptors,q=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,z=(e,t,r)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,G=(e,t)=>{for(var r in t||(t={}))Y.call(t,r)&&z(e,r,t[r]);if(q)for(var r of q(t))W.call(t,r)&&z(e,r,t[r]);return e},K=(e,t)=>
2$(e,H(t)),X=class extends Error{constructor(e,t,r){super(t||e.toString(),{cause:r}),this.status=e,this.statusText=t,this.error=r,Error.captureStackTrace(this,this.constructor)}},J=async(e,t)=>{var r,n,a,i,o,s;let l=t||{},u={onRequest:[null==t?void 0:t.onRequest],onResponse:[null==t?void 0:t.onResponse],onSuccess:[null==t?void 0:t.onSuccess],onError:[null==t?void 0:t.onError],onRetry:[null==t?void 0:t.onRetry]};if(!t||!(null==t?void 0:t.plugins))return{url:e,options:l,hooks:u};for(let c of(null==t?void 0:t.plugins)||[]){if(c.init){let n=await (null==(r=c.init)?void 0:r.call(c,e.toString(),t));l=n.options||l,e=n.url}u.onRequest.push(null==(n=c.hooks)?void 0:n.onRequest),u.onResponse.push(null==(a=c.hooks)?void 0:a.onResponse),u.onSuccess.push(null==(i=c.hooks)?void 0:i.onSuccess),u.onError.push(null==(o=c.hooks)?void 0:o.onError),u.onRetry.push(null==(s=c.hooks)?void 0:s.onRetry)}return{url:e,options:l,hooks:u}},Z=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},ee=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}},et=async e=>{let t={},r=async e=>"function"==typeof e?await e():e;if(null==e?void 0:e.auth){if("Bearer"===e.auth.type){let n=await r(e.auth.token);if(!n)return t;t.authorization=`Bearer ${n}`}else if("Basic"===e.auth.type){let[n,a]=await Promise.all([r(e.auth.username),r(e.auth.password)]);if(!n||!a)return t;t.authorization=`Basic ${btoa(`${n}:${a}`)}`}else if("Custom"===e.auth.type){let[n,a]=await Promise.all([r(e.auth.prefix),r(e.auth.value)]);if(!a)return t;t.authorization=`${null!=n?n:""} ${a}`}}return t},er=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function en(e){if(void 0===e)return!1;let t=typeof e;return"string"===t||"number"===t||"boolean"===t||null===t||"object"===t&&(!!Array.isArray(e)||!e.buffer&&(e.constructor&&"Object"===e.constructor.name||"function"==typeof e.toJSON))}function ea(e){try{return JSON.parse(e)}catch(t){return e}}function ei(e){return"function"==typeof e}function eo(...e){let t={};for(let r of e)if(r)if(r instanceof Headers)r.forEach((e,r)=>{t[r]=e});else for(let[e,n]of Array.isArray(r)?r:Object.entries(r))null!=n&&(t[e]=n);return t}async function es(e){let t=new Headers(eo(null==e?void 0:e.headers,await et(e)));if(!t.has("content-type")){let r=en(null==e?void 0:e.body)?"application/json":null;r&&t.set("content-type",r)}return t}var el=class e extends Error{constructor(t,r){super(r||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function eu(e,t){let r=await e["~standard"].validate(t);if(r.issues)throw new el(r.issues);return r.value}var ec=["get","post","put","patch","delete"],ed=async(e,t)=>{var r,n,a,i,o,s,l,u;let c,{hooks:d,url:f,options:h}=await J(e,t),p=function(e){if(null==e?void 0:e.customFetchImpl)return e.customFetchImpl;if("u">typeof globalThis&&ei(globalThis.fetch))return globalThis.fetch;if("u">typeof window&&ei(window.fetch))return window.fetch;throw Error("No fetch implementation found")}(h),g=new AbortController,m=null!=(r=h.signal)?r:g.signal,v=function(e,t){let{baseURL:r,params:n,query:a}=t||{query:{},params:{},baseURL:""},i=e.startsWith("http")?e.split("/").slice(0,3).join("/"):r||"";if(e.startsWith("@")){let t=e.toString().split("@")[1].split("/")[0];ec.includes(t)&&(e=e.replace(`@${t}/`,"/"))}i.endsWith("/")||(i+="/");let[o,s]=e.replace(i,"").split("?"),l=new URLSearchParams(s);for(let[e,t]of Object.entries(a||{})){let r;if(null!=t){if("string"==typeof t)r=t;else if(Array.isArray(t)){for(let r of t)l.append(e,r);continue}else r=JSON.stringify(t);l.set(e,r)}}let u=new Map;if(n)if(Array.isArray(n))for(let[e,t]of o.split("/").filter(e=>e.startsWith(":")).entries()){let r=n[e];u.set(t,String(r))}else for(let[e,t]of Object.entries(n))u.set(`:${e}`,String(t));o=(o=o.split("/").map(e=>(function(e,t){let r,n=e;for(let[e,r]of t)n=n.replace(e,r);if("."===(r=n)||".."===r)throw TypeError("Path parameters cannot be reserved path segments");return encodeURIComponent(n)})(e,u)).join("/")).replace(/^\/+/,"");let c=l.toString();return(c=c.length>0?`?${c}`.replace(/\+/g,"%20"):"",i.startsWith("http"))?new URL(`${o}${c}`,i):`${i}${o}${c}`}(f,h),y=await es(h),b=function(e,t){let r,{body:n}=e;return n?en(n)&&"string"!=typeof n?"application/x-www-form-urlencoded"===((r=t.get("content-type"))?r.split(";")[0].trim().toLowerCase():null)?new URLSearchParams(n).toString():JSON.stringify(n):n:null}(h,y),E=function(e,t){var r;if(null==t?void 0:t.method)return t.method.toUpperCase();if(e.startsWith("@")){let n=null==(r=e.split("@")[1])?void 0:r.split("/")[0];return ec.includes(n)?n.toUpperCase():(null==t?void 0:t.body)?"POST":"GET"}return(null==t?void 0:t.body)?"POST":"GET"}(f,h),w=K(G({},h),{url:v,headers:y,body:b,method:E,signal:m});for(let e of d.onRequest)if(e){let t=await e(w);"object"==typeof t&&null!==t&&Object.assign(w,t)}("pipeTo"in w&&"function"==typeof w.pipeTo||"function"==typeof(null==(n=null==t?void 0:t.body)?void 0:n.pi
2pe))&&!("duplex"in w)&&(w.duplex="half");let{clearTimeout:T}=(!(null==h?void 0:h.signal)&&(null==h?void 0:h.timeout)&&(c=setTimeout(()=>null==g?void 0:g.abort(),null==h?void 0:h.timeout)),{abortTimeout:c,clearTimeout:()=>{c&&clearTimeout(c)}}),S=await p(w.url,w);T();let R={response:S,request:w};for(let e of d.onResponse)if(e){let r=await e(K(G({},R),{response:(null==(a=null==t?void 0:t.hookOptions)?void 0:a.cloneResponse)?S.clone():S}));r instanceof Response?S=r:"object"==typeof r&&null!==r&&(S=r.response)}if(S.ok){if("HEAD"===w.method)return{data:"",error:null};let e=function(e){let t=e.headers.get("content-type"),r=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";let n=t.split(";").shift()||"";return er.test(n)?"json":r.has(n)||n.startsWith("text/")?"text":"blob"}(S),r={data:null,response:S,request:w};if("json"===e||"text"===e){let e=await S.text(),t=null!=(i=w.jsonParser)?i:ea;r.data=await t(e)}else r.data=await S[e]();for(let e of((null==w?void 0:w.output)&&w.output&&!w.disableValidation&&(r.data=await eu(w.output,r.data)),d.onSuccess))e&&await e(K(G({},r),{response:(null==(o=null==t?void 0:t.hookOptions)?void 0:o.cloneResponse)?S.clone():S}));return(null==t?void 0:t.throw)?r.data:{data:r.data,error:null}}let O=null!=(s=null==t?void 0:t.jsonParser)?s:ea,I=await S.text(),_=function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(I),A=_?await O(I):null,x={response:S,responseText:I,request:w,error:K(G({},A),{status:S.status,statusText:S.statusText})};for(let e of d.onError)e&&await e(K(G({},x),{response:(null==(l=null==t?void 0:t.hookOptions)?void 0:l.cloneResponse)?S.clone():S}));if(null==t?void 0:t.retry){let r=function(e){if("number"==typeof e)return new Z({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new Z(e);case"exponential":return new ee(e);default:throw Error("Invalid retry strategy")}}(t.retry),n=null!=(u=t.retryAttempt)?u:0;if(await r.shouldAttemptRetry(n,S)){for(let e of d.onRetry)e&&await e(R);let a=r.getDelay(n);return await new Promise(e=>setTimeout(e,a)),await ed(e,K(G({},t),{retryAttempt:n+1}))}}if(null==t?void 0:t.throw)throw new X(S.status,S.statusText,_?A:I);return{data:null,error:K(G({},A),{status:S.status,statusText:S.statusText})}};let ef=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,eh=/['\u2019]/g;function ep(e){return(e.replace(eh,"").match(ef)??[]).map(e=>e.toLowerCase()).join("-")}function eg(e,t){let r=t.split(".").flatMap(e=>(function e(t){if(em.test(t)){let[,r,n]=t.match(em);return[...e(r),n]}return[t]})(e)),n=e;for(let e of r){if(null==n)return;n=n[e]}return n}let em=/(.*)\[(\d+)\]/;var ev=e.i(191788);e.s(["createAuthClient",0,function(e){var t;let{pluginPathMethods:r,pluginsActions:a,pluginsAtoms:i,hydrateSession:s,$fetch:l,$store:u,atomListeners:c}=(e=>{var t,r;let a,i,s,l,u,c,f,y,w,S="credentials"in Request.prototype,R=function(e,t,r,n){if(e)return h(e,t);if(!1!==n){let e=o.BETTER_AUTH_URL||o.NEXT_PUBLIC_BETTER_AUTH_URL||o.PUBLIC_BETTER_AUTH_URL||o.NUXT_PUBLIC_BETTER_AUTH_URL||o.NUXT_PUBLIC_AUTH_URL||("/"!==o.BASE_URL?o.BASE_URL:void 0);if(e)return h(e,t)}r?.headers.get("x-forwarded-host"),r?.headers.get("x-forwarded-proto");if(r){let e=function(e){try{let t=new URL(e);return"null"===t.origin?null:t.origin}catch{return null}}(r.url);if(!e)throw new d("Could not get origin from request. Please provide a valid base URL.");return h(e,t)}if("u">typeof window&&window.location)return h(window.location.origin,t)}(e?.baseURL,e?.basePath,void 0,void 0)??(e=>{if(void 0!==n.default){if(n.default.env.NEXT_PUBLIC_AUTH_URL)return n.default.env.NEXT_PUBLIC_AUTH_URL;if("u"<typeof window){if(n.default.env.NEXTAUTH_URL)try{return n.default.env.NEXTAUTH_URL}catch{}if(n.default.env.VERCEL_URL)try{let t=n.default.env.VERCEL_URL.startsWith("http")?"":"https://";return`${new URL(`${t}${n.default.env.VERCEL_URL}`).origin}${e??"/api/auth"}`}catch{}}}})(e?.basePath)??"/api/auth",I=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>void 0!==e)||[],_={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:x,onError:N,onRequest:P,onResponse:L,...D}=e?.fetchOptions||{},F=(t={baseURL:R,...S?{credentials:"include"}:{},method:"GET",jsonParser:e=>e?function(e,t={strict:!0}){return function(e,t={}){let{strict:r=!1,warnings:n=!1,reviver:a,parseDates:i=!0}=t;if("string"!=typeof e)return e;let o=e.trim(),s=o.toLowerCase();if(s.length<=9&&s in m)return m[s];if(!g.test(o)){if(r)throw SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(p).some(([e,t])=>{let r=t.test(o);return r&&n&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),r})&&r)throw Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(o,(e,t)=>{if("__proto__"===e||"constructor"===e&&t&&"object"==typeof t&&"prototype"in t){n&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(i&&"string"==typeof t){let e=function(e){let t=v.exec(e);if(!t)return null;let[,r,n,a,i,o,s,l,u,c,d]=t,f=new Date(Date.UTC(parseInt(r,10),parseInt(n,10)-1,parseInt(a,10),parseInt(i,10),parseInt(o,10),parseInt(s,10),l?parseInt(l.padEnd(3,"0"),10):0));if(u){let e=(60*parseInt(c,10)+parseInt(d,10))*("+"===u?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return f instanceof Date&&!isNaN(f.getTime())?f:null}(t);if(e)return e}return a?a(e,t):t})}catch(t){if(r)throw t;return e}}(e,t)}(e,{strict:!1}):null,customFetchImpl:fetch,...D,plugins:[_,...D.plugins||[],...e?.disableDefaultFetchPlugins?[]:[b],...I]},async function(e,r){let n,a=K(G(G({},t),r),{headers:eo(null==t?void 0:t.headers,null==r?void 0:r.headers),plugins:[...(null==t?void 0:t.plugins)||[],(n=t||{},{id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(e,t){var r,a,i,o;let s=(null==(a=null==(r=n.plugins)?void 0:r.find(t=>{var r;return null!=(r=t.schema)&&!!r.config&&(e.startsWith(t.schema.config.baseURL||"")||e.startsWith(t.schema.config.prefix||""))}))?void 0:a.schema)||n.schema;if(s){let r=e;(null==(i=s.config)?void 0:i.prefix)&&r.startsWith(s.config.prefix)&&(r=r.replace(s.config.prefix,""),s.config.baseURL&&(e=e.replace(s.config.prefix,s.config.baseURL))),(null==(o=s.config)?void 0:o.baseURL)&&r.startsWith(s.config.baseURL)&&(r=r.replace(s.config.baseURL,"")),r.startsWith("/")&&"@"===r.charAt(1)&&(r=r.substring(1));let n=s.schema[r];if(n){let r=null==t?void 0:t.headers;if(n.headers&&!(null==t?void 0:t.disableValidation)){let e={};if(null==t?void 0:t.headers){if(t.headers instanceof Headers)t.headers.forEac
2h((t,r)=>{e[r.toLowerCase()]=t});else if("object"==typeof t.headers)for(let[r,n]of Object.entries(t.headers))null!=n&&(e[r.toLowerCase()]=n)}let a=await eu(n.headers,e),i={};for(let[e,t]of Object.entries(a))i[e.toLowerCase()]=t;r=i}let a=K(G({},t),{method:n.method,output:n.output,headers:r});return(null==t?void 0:t.disableValidation)||(a=K(G({},a),{body:n.input?await eu(n.input,null==t?void 0:t.body):null==t?void 0:t.body,params:n.params?await eu(n.params,null==t?void 0:t.params):null==t?void 0:t.params,query:n.query?await eu(n.query,null==t?void 0:t.query):null==t?void 0:t.query})),{url:e,options:a}}}return{url:e,options:t}}}),...(null==r?void 0:r.plugins)||[]]});if(null==t?void 0:t.catchAllError)try{return await ed(e,a)}catch(e){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:e}}}return await ed(e,a)}),{$sessionSignal:B,session:V,broadcastSessionUpdate:$}=(i=U(!1),s=0,l=0,i.listen(()=>{l++,s=0}),c=U({data:null,error:null,isPending:!0,isRefetching:!1,refetch:u=e=>y(e)}),E(c,({newValue:e,abort:t})=>{M(c.value,e)&&t()},2,e=>{let t=c.set,r=c.setKey;return c.setKey&&(c.setKey=(t,n)=>{let a;if(e({abort:()=>{a=!0},changed:t,newValue:{...c.value,[t]:n}}),!a)return r(t,n)}),c.set=r=>{let n;if(e({abort:()=>{n=!0},newValue:r}),!n)return t(r)},()=>{c.set=t,c.setKey=r}}),f=async(e,t)=>{let r=c.value;if(c.set({...r,isPending:null===r.data,isRefetching:!0,error:null,refetch:u}),e.aborted)return"aborted";try{var n;let r=await F("/get-session",{method:"GET",query:t?.query,signal:e});if(e.aborted)return"aborted";let{data:a,error:i}=j(r),o="fresh";if(a?.needsRefresh)try{let t=await F("/get-session",{method:"POST",signal:e});if(e.aborted)return"aborted";({data:a,error:i}=j(t))}catch{if(e.aborted)return"aborted";o="stale"}if(i){let e=c.value,t=i?.status===401;return c.set({data:t?null:e.data,error:i,isPending:!1,isRefetching:!1,refetch:u}),"failed"}let s=(n=a)&&(null!==n.session||null!==n.user)?n:null,l=c.value,d=null!=l.data&&null!=s&&T(l.data,s)?l.data:s;return c.set({data:d,error:null,isPending:!1,isRefetching:!1,refetch:u}),o}catch(r){if(e.aborted)return"aborted";let t=c.value;return c.set({data:t.data,error:r,isPending:!1,isRefetching:!1,refetch:u}),"failed"}},y=e=>{s=0,a?.cancel();let t=new AbortController,r={cancel:()=>t.abort(),promise:Promise.resolve().then(()=>t.signal.aborted?"aborted":f(t.signal,e)),revision:l};a=r;let n=e=>{if(a===r){let t,n;a=void 0,"fresh"===e&&r.revision===l&&(n=(t=c.value.data?.session?.expiresAt)instanceof Date?t.getTime():1/0,s=Math.min(Date.now()+1e3,n))}};return r.promise.then(n,()=>n("failed")),r.promise.then(()=>void 0)},w=()=>{},r=()=>{let t;"u"<typeof window||(t=setTimeout(()=>{a?.revision===l?a.promise.then(()=>void 0):Date.now()<s?Promise.resolve():y()},0));let r=function(e){let{fetchSession:t,shouldPollSession:r=()=>!0,sessionSignal:n,options:a={}}=e,i=a.sessionOptions?.refetchInterval??0,o=a.sessionOptions?.refetchOnWindowFocus??!0,s=a.sessionOptions?.refetchWhenOffline??!1,l={isInitialized:!1,lastSessionRequest:0},u=e=>{if(s||C().isOnline){if(e?.event==="storage")return void t();if(e?.event==="poll"){l.lastSessionRequest=k(),t();return}if(e?.event==="visibilitychange"){if(k()-l.lastSessionRequest<5)return;l.lastSessionRequest=k(),t();return}t()}};return{init:()=>{l.isInitialized||(l.isInitialized=!0,i&&i>0&&(l.pollInterval=setInterval(()=>{r()&&u({event:"poll"})},1e3*i)),l.unsubscribeBroadcast=O().subscribe(()=>{u({event:"storage"})}),o&&(l.unsubscribeFocus=A().subscribe(()=>{u({event:"visibilitychange"})})),l.unsubscribeOnline=C().subscribe(e=>{e&&u({event:"visibilitychange"})}),l.unsubscribeSignal=n.listen(()=>{t()}),l.cleanupBroadcastSetup=O().setup(),l.cleanupFocusSetup=A().setup(),l.cleanupOnlineSetup=C().setup())},cleanup:()=>{l.isInitialized&&(l.pollInterval&&(clearInterval(l.pollInterval),l.pollInterval=void 0),l.unsubscribeBroadcast&&(l.unsubscribeBroadcast(),l.unsubscribeBroadcast=void 0),l.unsubscribeFocus&&(l.unsubscribeFocus(),l.unsubscribeFocus=void 0),l.unsubscribeOnline&&(l.unsubscribeOnline(),l.unsubscribeOnline=void 0),l.unsubscribeSignal&&(l.unsubscribeSignal(),l.unsubscribeSignal=void 0),l.cleanupBroadcastSetup&&(l.cleanupBroadcastSetup(),l.cleanupBroadcastSetup=void 0),l.cleanupFocusSetup&&(l.cleanupFocusSetup(),l.cleanupFocusSetup=void 0),l.cleanupOnlineSetup&&(l.cleanupOnlineSetup(),l.cleanupOnlineSetup=void 0),l.isInitialized=!1,l.lastSessionRequest=0)},triggerRefetch:u,broadcastSessionUpdate:e=>{O().post({event:"session",data:{trigger:e},clientId:Math.random().toString(36).substring(7)})}}}({fetchSession:y,shouldPollSession:()=>null!=c.value.data,sessionSignal:i,options:e});return r.init(),w=r.broadcastSessionUpdate,()=>{t&&clearTimeout(t),r.cleanup()}},E(c,e=>{let t=r();t&&c.events[6].push(t)},5,e=>{let t=c.listen;c.listen=(...r)=>(c.lc||c.active||(c.active=!0,e()),t(...r));let r=c.off;return c.events[6]=[],c.off=()=>{r(),setTimeout(()=>{if(c.active&&!c.lc){for(let e of(c.active=!1,c.events[6]))e();c.events[6]=[]}},1e3)},()=>{c.listen=t,c.off=r}}),{session:c,$sessionSignal:i,broadcastSessionUpdate:e=>w(e)}),H=!1,q=e?.plugins||[],Y={},W={$sessionSignal:B,session:V}
2,z={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},X=[{signal:"$sessionSignal",matcher:e=>"/sign-out"===e||"/update-user"===e||"/update-session"===e||"/sign-up/email"===e||"/sign-in/email"===e||"/delete-user"===e||"/verify-email"===e||"/revoke-sessions"===e||"/revoke-session"===e||"/revoke-other-sessions"===e||"/change-email"===e||"/change-password"===e,callback(e){"/sign-out"===e?$("signout"):("/update-user"===e||"/update-session"===e)&&$("updateUser")}}];for(let e of q)e.getAtoms&&Object.assign(W,e.getAtoms?.(F)),e.pathMethods&&Object.assign(z,e.pathMethods),e.atomListeners&&X.push(...e.atomListeners);let J={notify:e=>{W[e].set(!W[e].get())},listen:(e,t)=>{W[e].subscribe(t)},atoms:W};for(let t of q)t.getActions&&(Y=Q(t.getActions?.(F,J,e)??{},Y));return{get baseURL(){return R},pluginsActions:Y,pluginsAtoms:W,pluginPathMethods:z,atomListeners:X,hydrateSession:e=>{H||null===e||(H=!0,function(e,t){if("u"<typeof window)return;let r=e.get();null===r.data&&null!==t&&e.set({...r,data:t,error:null,isPending:!1})}(V,e))},$sessionSignal:B,$fetch:F,$store:J}})(e),f={};for(let[e,t]of Object.entries(i))f[function(e){return`use${e.charAt(0).toUpperCase()+e.slice(1)}`}(e)]=()=>(function(e,t={}){let r=(0,ev.useRef)(e.get()),{keys:n,deps:a=[e,n]}=t,i=(0,ev.useCallback)(t=>{let a=e=>{r.current!==e&&(r.current=e,t())};if(a(e.value),n?.length){let t;return t=new Set(n),e.listen((e,r,i)=>{(void 0===i?n.some(t=>void 0===r||e[t]!==r[t]||eg(e,t)!==eg(r,t)):t.has(i)||t.has(i.split(/\.|\[/)[0]))&&a(e)})}return e.listen(a)},a),o=()=>r.current;return(0,ev.useSyncExternalStore)(i,o,o)})(t);return t={...a,...f,hydrateSession:s,$fetch:l,$store:u},function e(n=[]){return new Proxy(function(){},{get(r,a){var i;if("string"!=typeof a||"then"===a||"catch"===a||"finally"===a)return;let o=[...n,a],s=t;for(let e of o)if(s&&"object"==typeof s&&e in s)s=s[e];else{s=void 0;break}return"function"==typeof s?s:"object"==typeof(i=s)&&null!==i&&"get"in i&&"function"==typeof i.get&&"lc"in i&&"number"==typeof i.lc?s:e(o)},apply:async(e,t,a)=>{let o="/"+n.map(ep).join("/"),s=a[0]||{},u=a[1]||{},{query:d,fetchOptions:f,...h}=s,p={...u,...f},g=function(e,t,r){let n=t[e],{fetchOptions:a,query:i,...o}=r||{};return n||(a?.method?a.method:o&&Object.keys(o).length>0?"POST":"GET")}(o,r,s);return await l(o,{...p,body:"GET"===g?void 0:{...h,...p?.body||{}},query:d||p?.query,method:g,async onSuccess(e){if(await p?.onSuccess?.(e),!c||p.disableSignal)return;let t=c.filter(e=>e.matcher(o));if(!t.length)return;let r=new Set;for(let e of t){let t=i[e.signal];if(!t)return;if(r.has(e.signal))continue;r.add(e.signal);let n=t.get();setTimeout(()=>{t.set(!n)},10),e.callback?.(o)}}})}})}()}],928653);let ey="1.7.4";e.s(["magicLinkClient",0,()=>({id:"magic-link",version:ey,$InferServerPlugin:{}})],645370);let eb=l({OTP_EXPIRED:"OTP expired",INVALID_OTP:"Invalid OTP",TOO_MANY_ATTEMPTS:"Too many attempts"});e.s(["emailOTPClient",0,()=>({id:"email-otp",version:ey,$InferServerPlugin:{},atomListeners:[{matcher:e=>"/email-otp/verify-email"===e||"/sign-in/email-otp"===e||"/email-otp/request-email-change"===e,signal:"$sessionSignal"}],$ERROR_CODES:eb})],773417),e.s(["jwtClient",0,e=>{let t=e?.jwks?.jwksPath??"/jwks";return{id:"better-auth-client",version:ey,$InferServerPlugin:{},pathMethods:{[t]:"GET"},getActions:(e,r,n)=>({jwks:async r=>await e(t,{method:"GET",...r})})}}],543268)},85848,e=>{"use strict";class t extends Error{}t.prototype.name="InvalidTokenError",e.s(["jwtDecode",0,function(e,r){let n;if("string"!=typeof e)throw new t("Invalid token specified: must be a string");r||(r={});let a=+(!0!==r.header),i=e.split(".")[a];if("string"!=typeof i)throw new t(`Invalid token specified: missing part #${a+1}`);try{n=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw Error("base64 string is not of the correct length")}try{var r;
2return r=t,decodeURIComponent(atob(r).replace(/(.)/g,(e,t)=>{let r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}catch(e){return atob(t)}}(i)}catch(e){throw new t(`Invalid token specified: invalid base64 for part #${a+1} (${e.message})`)}try{return JSON.parse(n)}catch(e){throw new t(`Invalid token specified: invalid json for part #${a+1} (${e.message})`)}}])},679935,e=>{"use strict";var t=e.i(191788),r=e.i(730943);let n=Array(12).fill(0),a=({visible:e,className:r})=>t.default.createElement("div",{className:["sonner-loading-wrapper",r].filter(Boolean).join(" "),"data-visible":e},t.default.createElement("div",{className:"sonner-spinner"},n.map((e,r)=>t.default.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),i=t.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},t.default.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),o=t.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},t.default.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),s=t.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},t.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),l=t.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},t.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),u=t.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},t.default.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.default.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),c=1,d=e=>{var t;return"number"==typeof(null==e?void 0:e.id)||(null==e||null==(t=e.id)?void 0:t.length)>0?e.id:c++},f=new class{constructor(){this.subscribe=e=>
2(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-100;e<=0||(this.toasts=this.toasts.filter(t=>!(e>0&&this.dismissedToasts.has(t.id))||(this.dismissedToasts.delete(t.id),e--,!1)))},this.create=e=>{let{message:t,...r}=e,n=d(e),a=this.pendingDismissals.get(n);void 0!==a&&(cancelAnimationFrame(a),this.pendingDismissals.delete(n),this.dismissedToasts.delete(n));let i=this.dismissedToasts.has(n),o=void 0===e.dismissible||e.dismissible;return i&&(this.dismissedToasts.delete(n),this.toasts=this.toasts.filter(e=>e.id!==n)),(i?void 0:this.toasts.find(e=>e.id===n))?this.toasts=this.toasts.map(r=>r.id===n?(this.publish({...r,...e,id:n,title:t}),{...r,...e,id:n,dismissible:o,title:t}):r):this.addToast({title:t,...r,dismissible:o,id:n}),n},this.dismiss=e=>{if(null==e)return this.getActiveToasts().forEac
2h(e=>{this.dismissedToasts.add(e.id),this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);let t=this.pendingDismissals.get(e);return void 0!==t&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(t=>t({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,r)=>{let n,a;if(!r)return;void 0!==r.loading&&(a=this.create({...r,promise:e,type:"loading",message:r.loading,description:"function"!=typeof r.description?r.description:void 0}));let i=Promise.resolve(e instanceof Function?e():e),o=void 0!==a,s=i.then(async e=>{if(n=["resolve",e],t.default.isValidElement(e))o=!1,this.create({id:a,type:"default",message:e});else if(h(e)&&!e.ok){o=!1;let n="function"==typeof r.error?await r.error(`HTTP error! status: ${e.status}`):r.error,i="function"==typeof r.description?await r.description(`HTTP error! status: ${e.status}`):r.description,s="object"!=typeof n||t.default.isValidElement(n)?{message:n}:n;this.create({id:a,type:"error",description:i,...s})}else if(e instanceof Error){o=!1;let n="function"==typeof r.error?await r.error(e):r.error,i="function"==typeof r.description?await r.description(e):r.description,s="object"!=typeof n||t.default.isValidElement(n)?{message:n}:n;this.create({id:a,type:"error",description:i,...s})}else if(void 0!==r.success){o=!1;let n="function"==typeof r.success?await r.success(e):r.success,i="function"==typeof r.description?await r.description(e):r.description,s="object"!=typeof n||t.default.isValidElement(n)?{message:n}:n;this.create({id:a,type:"success",description:i,...s})}}).catch(async e=>{if(n=["reject",e],void 0!==r.error){o=!1;let n="function"==typeof r.error?await r.error(e):r.error,i="function"==typeof r.description?await r.description(e):r.description,s="object"!=typeof n||t.default.isValidElement(n)?{message:n}:n;this.create({id:a,type:"error",description:i,...s})}}).finally(()=>{o&&(this.dismiss(a),a=void 0),null==r.finally||r.finally.call(r)}),l=()=>new Promise((e,t)=>s.then(()=>"reject"===n[0]?t(n[1]):e(n[1])).catch(t));return"string"!=typeof a&&"number"!=typeof a?{unwrap:l}:Object.assign(a,{unwrap:l})},this.custom=(e,t)=>{let r=d(t);return this.create({...t,jsx:e(r),id:r,type:void 0}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},h=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,p=Object.assign((e,t)=>f.message(e,t),{success:f.success,info:f.info,warning:f.warning,error:f.error,custom:f.custom,message:f.message,promise:f.promise,dismiss:f.dismiss,loading:f.loading},{getHistory:()=>f.toasts,getToasts:()=>f.getActiveToasts()});function g(e){return void 0!==e.label}function m(...e){return e.filter(Boolean).join(" ")}!function(e){if(!e||"u"<typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}
vendor: 14,921 bytes, line 2
2("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
2let v=e=>{var r,n,c,d,f,h,p,v,y,b,E;let{invert:w,toast:T,unstyled:S,interacting:R,setHeights:O,visibleToasts:I,heights:_,index:A,toasts:x,expanded:N,removeToast:C,defaultRichColors:k,closeButton:P,style:L,cancelButtonStyle:D,actionButtonStyle:U,className:j="",descriptionClassName:M="",duration:F,position:B,gap:Q,expandByDefault:V,classNames:$,icons:H,closeButtonAriaLabel:q="Close toast"}=e,[Y,W]=t.default.useState(null),[z,G]=t.default.useState(null),[K,X]=t.default.useState(!1),[J,Z]=t.default.useState(!1),[ee,et]=t.default.useState(!1),[er,en]=t.default.useState(!1),[ea,ei]=t.default.useState(!1),[eo,es]=t.default.useState(0),[el,eu]=t.default.useState(0),ec=t.default.useRef(T.duration||F||4e3),ed=t.default.useRef(null),ef=t.default.useRef(null),eh=0===A,ep=A+1<=I,eg=T.type,em=null!=eg?eg:"default",ev=!1!==T.dismissible,ey=T.className||"",eb=T.descriptionClassName||"",eE=t.default.useMemo(()=>_.findIndex(e=>e.toastId===T.id)||0,[_,T.id]),ew=t.default.useMemo(()=>{var e;return null!=(e=T.closeButton)?e:P},[T.closeButton,P]),eT=t.default.useMemo(()=>T.duration||F||4e3,[T.duration,F]),eS=t.default.useRef(0),eR=t.default.useRef(0),eO=t.default.useRef(0),eI=t.default.useRef(null),[e_,eA]=B.split("-"),ex=t.default.useMemo(()=>_.reduce((e,t,r)=>r>=eE?e:e+t.height,0),[_,eE]),eN=(()=>{let[e,r]=t.default.useState(document.hidden);return t.default.useEffect(()=>{let e=()=>{r(document.hidden)};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),e})(),eC=t.default.useMemo(()=>{var t;return null!=(t=e.swipeDirections)?t:function(e){let[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}(B)},[e.swipeDirections,B]),ek=T.invert||w,eP="loading"===eg;eR.current=t.default.useMemo(()=>eE*Q+ex,[eE,ex]),t.default.useEffect(()=>{ec.current=eT},[eT]),t.default.useEffect(()=>{X(!0)},[]),t.default.useEffect(()=>{let e=ef.current;if(e){let t=e.getBoundingClientRect().height;return eu(t),O(e=>[{toastId:T.id,height:t,position:T.position},...e]),()=>O(e=>e.filter(e=>e.toastId!==T.id))}},[O,T.id]),t.default.useLayoutEffect(()=>{if(!K)return;let e=ef.current,t=e.style.height;e.style.height="auto";let r=e.getBoundingClientRect().height;e.style.height=t,eu(r),O(e=>e.find(e=>e.toastId===T.id)?e.map(e=>e.toastId===T.id?{...e,height:r}:e):[{toastId:T.id,height:r,position:T.position},...e])},[K,T.title,T.description,O,T.id,T.jsx,T.action,T.cancel]);let eL=t.default.useCallback(()=>{Z(!0),es(eR.current),O(e=>e.filter(e=>e.toastId!==T.id)),setTimeout(()=>{C(T)},200)},[T,C,O,eR]);function eD(){var e,r;return(null==H?void 0:H.loading)?t.default.createElement("div",{className:m(null==$?void 0:$.loader,null==T||null==(r=T.classNames)?void 0:r.loader,"sonner-loader"),"data-visible":"loading"===eg},H.loading):t.default.createElement(a,{className:m(null==$?void 0:$.loader,null==T||null==(e=T.classNames)?void 0:e.loader),visible:"loading"===eg})}t.default.useEffect(()=>{let e;if((!T.promise||"loading"!==eg)&&T.duration!==1/0&&"loading"!==T.type){if(N||R||eN){if(eO.current<eS.current){let e=new Date().getTime()-eS.current;ec.current=ec.current-e}eO.current=new Date().getTime()}else ec.current!==1/0&&(eS.current=new Date().getTime(),e=setTimeout(()=>{null==T.onAutoClose||T.onAutoClose.call(T,T),eL()},ec.current));return()=>clearTimeout(e)}},[N,R,T,eg,eN,eL]),t.default.useEffect(()=>{T.delete&&(eL(),null==T.onDismiss||T.onDismiss.call(T,T))},[eL,T.delete]);let eU=T.icon||(null==H?void 0:H[eg])||(e=>{switch(e){case"success":return i;case"info":return s;case"warning":return o;case"error":return l;default:return null}})(eg);return t.default.createElement("li",{tabIndex:0,ref:ef,className:m(j,ey,null==$?void 0:$.toast,null==T||null==(r=T.classNames)?void 0:r.toast,null==$?void 0:$[em],null==T||null==(n=T.classNames)?void 0:n[em]),"data-sonner-toast":"","data-rich-colors":null!=(b=T.richColors)?b:k,"data-styled":!(T.jsx||T.unstyled||S),"data-mounted":K,"data-promise":!!T.promise,"data-swiped":ea,"data-removed":J,"data-visible":ep,"data-y-position":e_,"data-x-position":eA,"data-index":A,"data-front":eh,"data-swiping":ee,"data-dismissible":ev,"data-type":eg,"data-invert":ek,"data-swipe-out":er,"data-swipe-direction":z,"data-expanded":!!(N||V&&K),"data-testid":T.testId,style:{"--index":A,"--toasts-before":A,"--z-index":
2x.length-A,"--offset":`${J?eo:eR.current}px`,"--initial-height":V?"auto":`${el}px`,...L,...T.style},onDragEnd:()=>{et(!1),W(null),eI.current=null},onPointerDown:e=>{2===e.button||eP||!ev||(ed.current=new Date,es(eR.current),e.target.setPointerCapture(e.pointerId),"BUTTON"!==e.target.tagName&&(et(!0),eI.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e,t,r,n,a;if(er||!ev)return;eI.current=null;let i=Number((null==(e=ef.current)?void 0:e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),o=Number((null==(t=ef.current)?void 0:t.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),s=new Date().getTime()-(null==(r=ed.current)?void 0:r.getTime()),l="x"===Y?i:o,u=Math.abs(l)/s;if(("x"===Y?eC.includes(i>0?"right":"left"):eC.includes(o>0?"bottom":"top"))&&(Math.abs(l)>=45||u>.11)){es(eR.current),null==T.onDismiss||T.onDismiss.call(T,T),"x"===Y?G(i>0?"right":"left"):G(o>0?"down":"up"),eL(),en(!0);return}null==(n=ef.current)||n.style.setProperty("--swipe-amount-x","0px"),null==(a=ef.current)||a.style.setProperty("--swipe-amount-y","0px"),ei(!1),et(!1),W(null)},onPointerMove:e=>{var t,r,n;if(!eI.current||!ev||(null==(t=window.getSelection())?void 0:t.toString().length)>0)return;let a=e.clientY-eI.current.y,i=e.clientX-eI.current.x;!Y&&(Math.abs(i)>1||Math.abs(a)>1)&&W(Math.abs(i)>Math.abs(a)?"x":"y");let o={x:0,y:0},s=e=>1/(1.5+Math.abs(e)/20);if("y"===Y){if(eC.includes("top")||eC.includes("bottom"))if(eC.includes("top")&&a<0||eC.includes("bottom")&&a>0)o.y=a;else{let e=a*s(a);o.y=Math.abs(e)<Math.abs(a)?e:a}}else if("x"===Y&&(eC.includes("left")||eC.includes("right")))if(eC.includes("left")&&i<0||e
2C.includes("right")&&i>0)o.x=i;else{let e=i*s(i);o.x=Math.abs(e)<Math.abs(i)?e:i}(Math.abs(o.x)>0||Math.abs(o.y)>0)&&ei(!0),null==(r=ef.current)||r.style.setProperty("--swipe-amount-x",`${o.x}px`),null==(n=ef.current)||n.style.setProperty("--swipe-amount-y",`${o.y}px`)}},ew&&!T.jsx&&"loading"!==eg?t.default.createElement("button",{"aria-label":q,"data-disabled":eP,"data-close-button":!0,onClick:eP||!ev?()=>{}:()=>{eL(),null==T.onDismiss||T.onDismiss.call(T,T)},className:m(null==$?void 0:$.closeButton,null==T||null==(c=T.classNames)?void 0:c.closeButton)},null!=(E=null==H?void 0:H.close)?E:u):null,(eg||T.icon||T.promise)&&null!==T.icon&&((null==H?void 0:H[eg])!==null||T.icon)?t.default.createElement("div",{"data-icon":"",className:m(null==$?void 0:$.icon,null==T||null==(d=T.classNames)?void 0:d.icon)},"loading"===eg?T.icon||eD():T.promise?eD():null,"loading"!==eg?eU:null):null,t.default.createElement("div",{"data-content":"",className:m(null==$?void 0:$.content,null==T||null==(f=T.classNames)?void 0:f.content)},t.default.createElement("div",{"data-title":"",className:m(null==$?void 0:$.title,null==T||null==(h=T.classNames)?void 0:h.title)},T.jsx?T.jsx:"function"==typeof T.title?T.title():T.title),T.description?t.default.createElement("div",{"data-description":"",className:m(M,eb,null==$?void 0:$.description,null==T||null==(p=T.classNames)?void 0:p.description)},"function"==typeof T.description?T.description():T.description):null),t.default.isValidElement(T.cancel)?T.cancel:T.cancel&&g(T.cancel)?t.default.createElement("button",{"data-button":!0,"data-cancel":!0,style:T.cancelButtonStyle||D,onClick:e=>{!g(T.cancel)||ev&&(null==T.cancel.onClick||T.cancel.onClick.call(T.cancel,e),eL())},className:m(null==$?void 0:$.cancelButton,null==T||null==(v=T.classNames)?void 0:v.cancelButton)},T.cancel.label):null,t.default.isValidElement(T.action)?T.action:T.action&&g(T.action)?t.default.createElement("button",{"data-button":!0,"data-action":!0,style:T.actionButtonStyle||U,onClick:e=>{!g(T.action)||(null==T.action.onClick||T.action.onClick.call(T.action,e),e.defaultPrevented||eL())},className:m(null==$?void 0:$.actionButton,null==T||null==(y=T.classNames)?void 0:y.actionButton)},T.action.label):null)};function y(){if("u"<typeof window||"u"<typeof document)return"ltr";let e=document.documentElement.getAttribute("dir");return"auto"!==e&&e?e:window.getComputedStyle(document.documentElement).direction}let b=t.default.forwardRef(function(e,n){let{id:a,invert:i,position:o="bottom-right",hotkey:s=["altKey","KeyT"],expand:l,closeButton:u,className:c,offset:d,mobileOffset:h,theme:p="light",richColors:g,duration:m,style:b,visibleToasts:E=3,toastOptions:w,dir:T=y(),gap:S=14,icons:R,customAriaLabel:O,containerAriaLabel:I="Notifications"}=e,[_,A]=t.default.useState([]),x=t.default.useMemo(()=>a?_.filter(e=>e.toasterId===a):_.filter(e=>!e.toasterId),[_,a]),N=t.default.useMemo(()=>Array.from(new Set([o].concat(x.filter(e=>e.position).map(e=>e.position)))),[x,o]),[C,k]=t.default.useState([]),[P,L]=t.default.useState(!1),[D,U]=t.default.useState(!1),[j,M]=t.default.useState("system"!==p?p:"u">typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),F=t.default.useRef(null),B=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),Q=t.default.useRef(null),V=t.default.useRef(!1),$=t.default.useCallback(e=>{A(t=>{var r;return(null==(r=t.find(t=>t.id===e.id))?void 0:r.delete)||f.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return t.default.useEffect(()=>f.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{A(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{r.default.flushSync(()=>{A(t=>{let r=t.findIndex(t=>t.id===e.id);return -1!==r?[...t.slice(0,r),{...t[r],...e},...t.slice(r+1)]:[e,...t]})})})}),[]),t.default.useEffect(()=>{if("system"!==p)return void M(p);if("system"===p&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?M("dark"):M("light")),"u"<typeof window)return;let e=window.matchMedia("(prefers-color-scheme: dark)");try{e.addEventListener("change",({matches:e})=>{e?M("dark"):M("light")})}catch(t){e.addListener(({matches:e})=>{try{e?M("dark"):M("light")}catch(e){console.error(e)}})}},[p]),t.default.useEffect(()=>{_.length<=1&&L(!1)},[_]),t.default.useEffect(()=>{let e=e=>{var t,r;s.length>0&&s.every(t=>e[t]||e.code===t)&&(L(!0),null==(r=F.current)||r.focus()),"Escape"===e.code&&(document.activeElement===F.current||(null==(t=F.current)?void 0:t.contains(document.activeElement)))&&L(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[s]),t.default.useEffect(()=>{if(F.current)return()=>{Q.current&&(Q.current.focus({preventScroll:!0}),Q.current=null,V.current=!1)}},[F.current]),t.default.createElement("section",{ref:n,"aria-label":null!=O?O:`${I}
2 ${B}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},N.map((r,n)=>{var a;let o,[s,f]=r.split("-");return x.length?t.default.createElement("ol",{key:r,dir:"auto"===T?y():T,tabIndex:-1,ref:F,className:c,"data-sonner-toaster":!0,"data-sonner-theme":j,"data-y-position":s,"data-x-position":f,style:{"--front-toast-height":`${(null==(a=C[0])?void 0:a.height)||0}px`,"--width":"356px","--gap":`${S}px`,...b,...(o={},[d,h].forEach((e,t)=>{let r=1===t,n=r?"--mobile-offset":"--offset",a=r?"16px":"24px";function i(e){["top","right","bottom","left"].forEach(t=>{o[`${n}-${t}`]="number"==typeof e?`${e}px`:e})}"number"==typeof e||"string"==typeof e?i(e):"object"==typeof e?["top","right","bottom","left"].forEach(t=>{void 0===e[t]?o[`${n}-${t}`]=a:o[`${n}-${t}`]="number"==typeof e[t]?`${e[t]}px`:e[t]}):i(a)}),o)},onBlur:e=>{V.current&&!e.currentTarget.contains(e.relatedTarget)&&(V.current=!1,Q.current&&(Q.current.focus({preventScroll:!0}),Q.current=null))},onFocus:e=>{!(e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible)&&(V.current||(V.current=!0,Q.current=e.relatedTarget))},onMouseEnter:()=>L(!0),onMouseMove:()=>L(!0),onMouseLeave:()=>{D||L(!1)},onDragEnd:()=>L(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||U(!0)},onPointerUp:()=>U(!1)},x.filter(e=>!e.position&&0===n||e.position===r).map((n,a)=>{var o,s;return t.default.createElement(v,{key:n.id,icons:R,index:a,toast:n,defaultRichColors:g,duration:null!=(o=null==w?void 0:w.duration)?o:m,className:null==w?void 0:w.className,descriptionClassName:null==w?void 0:w.descriptionClassName,invert:i,visibleToasts:E,closeButton:null!=(s=null==w?void 0:w.closeButton)?s:u,interacting:D,position:r,style:null==w?void 0:w.style,unstyled:null==w?void 0:w.unstyled,classNames:null==w?void 0:w.classNames,cancelButtonStyle:null==w?void 0:w.cancelButtonStyle,actionButtonStyle:null==w?void 0:w.actionButtonStyle,closeButtonAriaLabel:null==w?void 0:w.closeButtonAriaLabel,removeToast:$,toasts:x.filter(e=>e.position==n.position),heights:C.filter(e=>e.position==n.position),setHeights:k,expandByDefault:l,gap:S,expanded:P,swipeDirections:e.swipeDirections})})):null}))});e.s(["Toaster",0,b,"toast",0,p])},58195,408832,339533,684275,449180,369370,449420,e=>{"use strict";var t="1.13.8",r="object"==typeof self&&self.self===self&&self||e.g.global===e.g&&e.g||Function("return this")()||{},n=Array.prototype,a=Object.prototype,i="u">typeof Symbol?Symbol.prototype:null,o=n.push,s=n.slice,l=a.toString,u=a.hasOwnProperty,c="u">typeof ArrayBuffer,d="u">typeof DataView,f=Array.isArray,h=Object.keys,p=Object.create,g=c&&ArrayBuffer.isView,m=isNaN,v=isFinite,y=!({toString:null}).propertyIsEnumerable("toString"),b=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];function E(e){return!0===e||!1===e||"[object Boolean]"===l.call(e)}function w(e){var t="[object "+e+"]";return function(e){return l.call(e)===t}}let T=w("String"),S=w("Number");e.s(["default",0,S],408832);let R=w("Date"),O=w("RegExp"),I=w("Error"),_=w("Symbol"),A=w("ArrayBuffer");var x=w("Function"),N=r.document&&r.document.childNodes;"function"!=typeof/./&&"object"!=typeof Int8Array&&"function"!=typeof N&&(x=function(e){return"function"==typeof e});let C=x,k=w("Object");var P=d&&(!/\[native code\]/.test(String(DataView))||k(new DataView(new ArrayBuffer(8)))),L="u">typeof Map&&k(new Map),D=w("DataView");let U=P?function(e){return null!=e&&C(e.getInt8)&&A(e.buffer)}:D,j=f||w("Array");function M(e,t){return null!=e&&u.call(e,t)}var F=w("Arguments");!function(){F(arguments)||(F=function(e){return M(e,"callee")})}();let B=F;function Q(e){return S(e)&&m(e)}function V(e){return function(){return e}}function $(e){return function(t){var r=e(t);return"number"==typeof r&&r>=0&&r<=0x1fffffffffffff}}function H(e){return function(t){return null==t?void 0:t[e]}}let q=H("byteLength"),Y=$(q);var W=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;let z=c?function(e){return g?g(e)&&!U(e):Y(e)&&W.test(l.call(e))}:V(!1),G=H("length");function K(e){var t=typeof e;return"function"===t||"object"===t&&!!e}
2function X(e,t){t=function(e){for(var t={},r=e.length,n=0;n<r;++n)t[e[n]]=!0;return{contains:function(e){return!0===t[e]},push:function(r){return t[r]=!0,e.push(r)}}}(t);var r=b.length,n=e.constructor,i=C(n)&&n.prototype||a,o="constructor";for(M(e,o)&&!t.contains(o)&&t.push(o);r--;)(o=b[r])in e&&e[o]!==i[o]&&!t.contains(o)&&t.push(o)}function J(e){if(!K(e))return[];if(h)return h(e);var t=[];for(var r in e)M(e,r)&&t.push(r);return y&&X(e,t),t}function Z(e,t){var r=J(t),n=r.length;if(null==e)return!n;for(var a=Object(e),i=0;i<n;i++){var o=r[i];if(t[o]!==a[o]||!(o in a))return!1}return!0}function ee(e){return e instanceof ee?e:this instanceof ee?void(this._wrapped=e):new ee(e)}function et(e){return new Uint8Array(e.buffer||e,e.byteOffset||0,q(e))}ee.VERSION=t,ee.prototype.value=function(){return this._wrapped},ee.prototype.valueOf=ee.prototype.toJSON=ee.prototype.value,ee.prototype.toString=function(){return String(this._wrapped)};var er="[object DataView]";function en(e){if(!K(e))return[];var t=[];for(var r in e)t.push(r);return y&&X(e,t),t}function ea(e){var t=G(e);return function(r){if(null==r||G(en(r)))return!1;for(var n=0;n<t;n++)if(!C(r[e[n]]))return!1;return e!==eu||!C(r[ei])}}var ei="forEach",eo=["clear","delete"],es=["get","has","set"],el=eo.concat(ei,es),eu=eo.concat(es),ec=["add"].concat(eo,ei,"has");let ed=L?ea(el):w("Map"),ef=L?ea(eu):w("WeakMap"),eh=L?ea(ec):w("Set"),ep=w("WeakSet");function eg(e){for(var t=J(e),r=t.length,n=Array(r),a=0;a<r;a++)n[a]=e[t[a]];return n}function em(e){for(var t={},r=J(e),n=0,a=r.length;n<a;n++)t[e[r[n]]]=r[n];return t}function ev(e){var t=[];for(var r in e)C(e[r])&&t.push(r);return t.sort()}function ey(e,t){return function(r){var n=arguments.length;if(t&&(r=Object(r)),n<2||null==r)return r;for(var a=1;a<n;a++)for(var i=arguments[a],o=e(i),s=o.length,l=0;l<s;l++){var u=o[l];t&&void 0!==r[u]||(r[u]=i[u])}return r}}let eb=ey(en),eE=ey(J),ew=ey(en,!0);function eT(e){if(!K(e))return{};if(p)return p(e);var t=function(){};t.prototype=e;var r=new t;return t.prototype=null,r}function eS(e){return j(e)?e:[e]}function eR(e){return ee.toPath(e)}function eO(e,t){for(var r=t.length,n=0;n<r;n++){if(null==e)return;e=e[t[n]]}return r?e:void 0}function eI(e){return void 0===e}function e_(e,t,r){var n=eO(e,eR(t));return eI(n)?r:n}function eA(e){return e}function ex(e){return e=eE({},e),function(t){return Z(t,e)}}function eN(e){return e=eR(e),function(t){return eO(t,e)}}function eC(e,t,r){if(void 0===t)return e;switch(null==r?3:r){case 1:return function(r){return e.call(t,r)};case 3:return function(r,n,a){return e.call(t,r,n,a)};case 4:return function(r,n,a,i){return e.call(t,r,n,a,i)}}return function(){return e.apply(t,arguments)}}function ek(e,t,r){return null==e?eA:C(e)?eC(e,t,r):K(e)&&!j(e)?ex(e):eN(e)}function eP(e,t){return ek(e,t,1/0)}function eL(e,t,r){return ee.iteratee!==eP?ee.iteratee(e,t):ek(e,t,r)}function eD(){}function eU(e){var t=function(t){return e[t]},r="(?:"+J(e).join("|")+")",n=RegExp(r),a=RegExp(r,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(a,t):e}}ee.toPath=eS,ee.iteratee=eP;let ej={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},eM=eU(ej),eF=eU(em(ej)),eB=ee.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var eQ=/(.)^/,eV={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},e$=/\\|'|\r|\n|\u2028|\u2029/g;function eH(e){return"\\"+eV[e]}var eq=/^\s*(\w|\$)+\s*$/;function eY(e,t){return t=null==t?e.length-1:+t,function(){for(var r=Math.max(arguments.length-t,0),n=Array(r),a=0;a<r;a++)n[a]=arguments[a+t];switch(t){case 0:return e.call(this,n);case 1:return e.call(this,arguments[0],n);case 2:return e.call(this,arguments[0],arguments[1],n)}var i=Array(t+1);for(a=0;a<t;a++)i[a]=arguments[a];return i[t]=n,e.apply(this,i)}}function eW(e,t,r,n,a){if(!(n instanceof t))return e.apply(r,a);var i=eT(e.prototype),o=e.apply(i,a);return K(o)?o:i}var ez=eY(function(e,t){var r=ez.placeholder,n=function(){for(var a=0,i=t.length,o=Array(i),s=0;s<i;s++)o[s]=t[s]===r?arguments[a++]:t[s];for(;a<arguments.length;)o.push(arguments[a++]);return eW(e,n,this,this,o)};return n});ez.placeholder=ee;let eG=eY(function(e,t,r){if(!C(e))throw TypeError("Bind must be called on a function");var n=eY(function(a){return eW(e,n,t,this,r.concat(a))});return n}),eK=$(G);function eX(e,t,r){t||0===t||(t=1/0);for(var n=[],a=0,i=0,o=G(e)||0,s=[];;){if(i>
2=o){if(!s.length)break;var l=s.pop();i=l.i,o=G(e=l.v);continue}var u=e[i++];s.length>=t?n[a++]=u:eK(u)&&(j(u)||B(u))?(s.push({i:i,v:e}),i=0,o=G(e=u)):r||(n[a++]=u)}return n}let eJ=eY(function(e,t){var r=(t=eX(t,!1,!1)).length;if(r<1)throw Error("bindAll must be passed function names");for(;r--;){var n=t[r];e[n]=eG(e[n],e)}return e}),eZ=eY(function(e,t,r){return setTimeout(function(){return e.apply(null,r)},t)}),e0=ez(eZ,ee,1);function e1(e,t){var r;return function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=null),r}}let e2=ez(e1,2);function e5(e,t,r){t=eL(t,r);for(var n,a=J(e),i=0,o=a.length;i<o;i++)if(t(e[n=a[i]],n,e))return n}function e4(e){return function(t,r,n){r=eL(r,n);for(var a=G(t),i=e>0?0:a-1;i>=0&&i<a;i+=e)if(r(t[i],i,t))return i;return -1}}let e3=e4(1),e7=e4(-1);function e8(e,t,r,n){for(var a=(r=eL(r,n,1))(t),i=0,o=G(e);i<o;){var s=Math.floor((i+o)/2);r(e[s])<a?i=s+1:o=s}return i}function e6(e,t,r){return function(n,a,i){var o=0,l=G(n);if("number"==typeof i)e>0?o=i>=0?i:Math.max(i+l,o):l=i>=0?Math.min(i+1,l):i+l+1;else if(r&&i&&l)return i=r(n,a),n[i]===a?i:-1;if(a!=a)return(i=t(s.call(n,o,l),Q))>=0?i+o:-1;for(i=e>0?o:l-1;i>=0&&i<l;i+=e)if(n[i]===a)return i;return -1}}let e9=e6(1,e3,e8),te=e6(-1,e7);function tt(e,t,r){var n=(eK(e)?e3:e5)(e,t,r);if(void 0!==n&&-1!==n)return e[n]}function tr(e,t,r){if(t=eC(t,r),eK(e))for(n=0,a=e.length;n<a;n++)t(e[n],n,e);else{var n,a,i=J(e);for(n=0,a=i.length;n<a;n++)t(e[i[n]],i[n],e)}return e}function tn(e,t,r){t=eL(t,r);for(var n=!eK(e)&&J(e),a=(n||e).length,i=Array(a),o=0;o<a;o++){var s=n?n[o]:o;i[o]=t(e[s],s,e)}return i}function ta(e){var t=function(t,r,n,a){var i=!eK(t)&&J(t),o=(i||t).length,s=e>0?0:o-1;for(a||(n=t[i?i[s]:s],s+=e);s>=0&&s<o;s+=e){var l=i?i[s]:s;n=r(n,t[l],l,t)}return n};return function(e,r,n,a){var i=arguments.length>=3;return t(e,eC(r,a,4),n,i)}}let ti=ta(1),to=ta(-1);function ts(e,t,r){var n=[];return t=eL(t,r),tr(e,function(e,r,a){t(e,r,a)&&n.push(e)}),n}function tl(e){return function(){return!e.apply(this,arguments)}}function tu(e,t,r){t=eL(t,r);for(var n=!eK(e)&&J(e),a=(n||e).length,i=0;i<a;i++){var o=n?n[i]:i;if(!t(e[o],o,e))return!1}return!0}function tc(e,t,r){t=eL(t,r);for(var n=!eK(e)&&J(e),a=(n||e).length,i=0;i<a;i++){var o=n?n[i]:i;if(t(e[o],o,e))return!0}return!1}function td(e,t,r,n){return eK(e)||(e=eg(e)),("number"!=typeof r||n)&&(r=0),e9(e,t,r)>=0}let tf=eY(function(e,t,r){var n,a;return C(t)?a=t:(n=(t=eR(t)).slice(0,-1),t=t[t.length-1]),tn(e,function(e){var i=a;if(!i){if(n&&n.length&&(e=eO(e,n)),null==e)return;i=e[t]}return null==i?i:i.apply(e,r)})});function th(e,t){return tn(e,eN(t))}function tp(e,t,r){var n,a,i=-1/0,o=-1/0;if(null==t||"number"==typeof t&&"object"!=typeof e[0]&&null!=e){e=eK(e)?e:eg(e);for(var s=0,l=e.length;s<l;s++)null!=(n=e[s])&&n>i&&(i=n)}else t=eL(t,r),tr(e,function(e,r,n){((a=t(e,r,n))>o||a===-1/0&&i===-1/0)&&(i=e,o=a)});return i}function tg(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))}var tm=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;function tv(e){return e?j(e)?s.call(e):T(e)?e.match(tm):eK(e)?tn(e,eA):eg(e):[]}function ty(e,t,r){if(null==t||r)return eK(e)||(e=eg(e)),e[tg(e.length-1)];var n=tv(e),a=G(n);t=Math.max(Math.min(t,a),0);for(var i=a-1,o=0;o<t;o++){var s=tg(o,i),l=n[o];n[o]=n[s],n[s]=l}return n.slice(0,t)}function tb(e,t){return function(r,n,a){var i=t?[[],[]]:{};return n=eL(n,a),tr(r,function(t,a){var o=n(t,a,r);e(i,t,o)}),i}}let tE=tb(function(e,t,r){M(e,r)?e[r].push(t):e[r]=[t]}),tw=tb(function(e,t,r){e[r]=t}),tT=tb(function(e,t,r){M(e,r)?e[r]++:e[r]=1}),tS=tb(function(e,t,r){e[+!r].push(t)},!0);function tR(e,t,r){return t in r}let tO=eY(function(e,t){var r={},n=t[0];if(null==e)return r;C(n)?(t.length>1&&(n=eC(n,t[1])),t=en(e)):(n=tR,t=eX(t,!1,!1),e=Object(e));for(var a=0,i=t.length;a<i;a++){var o=t[a],s=e[o];n(s,o,e)&&(r[o]=s)}return r}),tI=eY(function(e,t){var r,n=t[0];return C(n)?(n=tl(n),t.length>1&&(r=t[1])):(t=tn(eX(t,!1,!1),String),n=function(e,r){return!td(t,r)}),tO(e,n,r)});function t_(e,t,r){return s.call(e,0,Math.max(0,e.length-(null==t||r?1:t)))}function tA(e,t,r){return null==e||e.length<1?null==t||r?void 0:[]:null==t||r?e[0]:t_(e,e.length-t)}function tx(e,t,r){return s.call(e,null==t||r?1:t)}e.s(["default",0,tI],339533);let tN=eY(function(e,t){return t=eX(t,!0,!0),ts(e,function(e){return!td(t,e)})});e.s(["default",0,tN],684275);let tC=eY(function(e,t){return tN(e,t)});function tk(e,t,r,n){E(t)||(n=r,r=t,t=!1),null!=r&&(r=eL(r,n));for(var a=[],i=[],o=0,s=G(e);o<s;o++){var l=e[o],u=r?r(l,o,e):l;t&&!r?(o&&i===u||a.push(l),i=u):r?td(i,u)||(i.push(u),a.push(l)):td(a,l)||a.push(l)}return a}e.s(["default",0,tk],449180);let tP=eY(function(e){return tk(eX(e,!0,!0))});function tL(e){for(var t=e&&tp(e,G).length||0,r=Array(t),n=0;n<t;n++)r[n]=th(e,n);return r}let tD=eY(tL);function tU(e,t){return e._chain?ee(t).chain():t}function tj(e){return tr(ev(e),function(t){var r=ee[t]=e[t];ee.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),tU(this,r.apply(ee,e))}}),ee}tr(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=n[e];ee.prototype[e]=function(){var r=this._wrapped;return null!=r&&(t.apply(r,arguments),("shift"===e||"splice"===e)&&0===r.length&&delete r[0]),tU(this,r)}}),tr(["concat","join","slice"],function(e){var t=n[e];ee.prototype[e]=function(){var e=this._wrapped;return null!=e&&(e=t.apply(e,arguments)),tU(this,e)}}),e.s([],827604),e.i(827604);let tM=Date.now||function(){return new Date().getTime()};var tF=0;function tB(e,t,r){var n,a,i,o,s,l=function(){var u=tM()-a;t>u?n=setTimeout(l,t-u):(n=null,r||(o=e.apply(s,i)),n||(i=s=null))},u=eY(function(u){return s=this,i=u,a=tM(),!n&&(n=setTimeout(l,t),r&&(
2o=e.apply(s,i))),o});return u.cancel=function(){clearTimeout(n),n=i=s=null},u}e.s(["default",0,tB],369370),e.s(["VERSION",0,t,"after",0,function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},"all",0,tu,"allKeys",0,en,"any",0,tc,"assign",0,eE,"before",0,e1,"bind",0,eG,"bindAll",0,eJ,"chain",0,function(e){var t=ee(e);return t._chain=!0,t},"chunk",0,function(e,t){if(null==t||t<1)return[];for(var r=[],n=0,a=e.length;n<a;)r.push(s.call(e,n,n+=t));return r},"clone",0,function(e){return K(e)?j(e)?e.slice():eb({},e):e},"collect",0,tn,"compact",0,function(e){return ts(e,Boolean)},"compose",0,function(){var e=arguments,t=e.length-1;return function(){for(var r=t,n=e[t].apply(this,arguments);r--;)n=e[r].call(this,n);return n}},"constant",0,V,"contains",0,td,"countBy",0,tT,"create",0,function(e,t){var r=eT(e);return t&&eE(r,t),r},"debounce",0,tB,"default",0,ee,"defaults",0,ew,"defer",0,e0,"delay",0,eZ,"detect",0,tt,"difference",0,tN,"drop",0,tx,"each",0,tr,"escape",0,eM,"every",0,tu,"extend",0,eb,"extendOwn",0,eE,"filter",0,ts,"find",0,tt,"findIndex",0,e3,"findKey",0,e5,"findLastIndex",0,e7,"findWhere",0,function(e,t){return tt(e,ex(t))},"first",0,tA,"flatten",0,function(e,t){return eX(e,t,!1)},"foldl",0,ti,"foldr",0,to,"forEach",0,tr,"functions",0,ev,"get",0,e_,"groupBy",0,tE,"has",0,function(e,t){for(var r=(t=eR(t)).length,n=0;n<r;n++){var a=t[n];if(!M(e,a))return!1;e=e[a]}return!!r},"head",0,tA,"identity",0,eA,"include",0,td,"includes",0,td,"indexBy",0,tw,"indexOf",0,e9,"initial",0,t_,"inject",0,ti,"intersection",0,function(e){for(var t=[],r=arguments.length,n=0,a=G(e);n<a;n++){var i,o=e[n];if(!td(t,o)){for(i=1;i<r&&td(arguments[i],o);i++);i===r&&t.push(o)}}return t},"invert",0,em,"invoke",0,tf,"isArguments",0,B,"isArray",0,j,"isArrayBuffer",0,A,"isBoolean",0,E,"isDataView",0,U,"isDate",0,R,"isElement",0,function(e){return!!(e&&1===e.nodeType)},"isEmpty",0,function(e){if(null==e)return!0;var t=G(e);return"number"==typeof t&&(j(e)||T(e)||B(e))?0===t:0===G(J(e))},"isEqual",0,function(e,t){for(var r=[{a:e,b:t}],n=[],a=[];r.length;){var o=r.pop();if(!0===o){n.pop(),a.pop();continue}if((e=o.a)===(t=o.b)){if(0!==e||1/e==1/t)continue;return!1}if(null==e||null==t)return!1;if(e!=e){if(t!=t)continue;return!1}var s=typeof e;if("function"!==s&&"object"!==s&&"object"!=typeof t)return!1;e instanceof ee&&(e=e._wrapped),t instanceof ee&&(t=t._wrapped);var u=l.call(e);if(u!==l.call(t))return!1;if(P&&"[object Object]"==u&&U(e)){if(!U(t))return!1;u=er}switch(u){case"[object RegExp]":case"[object String]":if(""+e==""+t)continue;return!1;case"[object Number]":r.push({a:+e,b:+t});continue;case"[object Date]":case"[object Boolean]":if(+e==+t)continue;return!1;case"[object Symbol]":if(i.valueOf.call(e)===i.valueOf.call(t))continue;return!1;case"[object ArrayBuffer]":case er:r.push({a:et(e),b:et(t)});continue}var c="[object Array]"===u;if(!c&&z(e)){if(q(e)!==q(t))return!1;if(e.buffer===t.buffer&&e.byteOffset===t.byteOffset)continue;c=!0}if(!c){if("object"!=typeof e||"object"!=typeof t)return!1;var d=e.constructor,f=t.constructor;if(d!==f&&!(C(d)&&d instanceof d&&C(f)&&f instanceof f)&&"constructor"in e&&"constructor"in t)return!1}for(var h=n.length;h--;)if(n[h]===e){if(a[h]===t)break;return!1}if(!(h>=0))if(n.push(e),a.push(t),r.push(!0),c){if((h=e.length)!==t.length)return!1;for(;h--;)r.push({a:e[h],b:t[h]})}else{var p,g=J(e);if(h=g.length,J(t).length!==h)return!1;for(;h--;){if(!M(t,p=g[h]))return!1;r.push({a:e[p],b:t[p]})}}}return!0},"isError",0,I,"isFinite",0,function(e){return!_(e)&&v(e)&&!isNaN(parseFloat(e))},"isFunction",0,C,"isMap",0,ed,"isMatch",0,Z,"isNaN",0,Q,"isNull",0,function(e){return null===e},"isNumber",0,S,"isObject",0,K,"isRegExp",0,O,"isSet",0,eh,"isString",0,T,"isSymbol",0,_,"isTypedArray",0,z,"isUndefined",0,eI,"isWeakMap",0,ef,"isWeakSet",0,ep,"iteratee",0,eP,"keys",0,J,"last",0,function(e,t,r){return null==e||e.length<1?null==t||r?void 0:[]:null==t||r?e[e.length-1]:tx(e,Math.max(0,e.length-t))},"lastIndexOf",0,te,"map",0,tn,"mapObject",0,function(e,t,r){t=eL(t,r);for(var n=J(e),a=n.length,i={},o=0;o<a;o++){var s=n[o];i[s]=t(e[s],s,e)}return i},"matcher",0,ex,"matches",0,ex,"max",0,tp,"memoize",0,function(e,t){var r=function(n){var a=r.cache,i=""+(t?t.apply(this,arguments):n);return M(a,i)||(a[i]=e.apply(this,arguments)),a[i]};return r.cache={},r},"methods",0,ev,"min",0,function(e,t,r){var n,a,i=1/0,o=1/0;
2if(null==t||"number"==typeof t&&"object"!=typeof e[0]&&null!=e){e=eK(e)?e:eg(e);for(var s=0,l=e.length;s<l;s++)null!=(n=e[s])&&n<i&&(i=n)}else t=eL(t,r),tr(e,function(e,r,n){((a=t(e,r,n))<o||a===1/0&&i===1/0)&&(i=e,o=a)});return i},"mixin",0,tj,"negate",0,tl,"noop",0,eD,"now",0,tM,"object",0,function(e,t){for(var r={},n=0,a=G(e);n<a;n++)t?r[e[n]]=t[n]:r[e[n][0]]=e[n][1];return r},"omit",0,tI,"once",0,e2,"pairs",0,function(e){for(var t=J(e),r=t.length,n=Array(r),a=0;a<r;a++)n[a]=[t[a],e[t[a]]];return n},"partial",0,ez,"partition",0,tS,"pick",0,tO,"pluck",0,th,"property",0,eN,"propertyOf",0,function(e){return null==e?eD:function(t){return e_(e,t)}},"random",0,tg,"range",0,function(e,t,r){null==t&&(t=e||0,e=0),r||(r=t<e?-1:1);for(var n=Math.max(Math.ceil((t-e)/r),0),a=Array(n),i=0;i<n;i++,e+=r)a[i]=e;return a},"reduce",0,ti,"reduceRight",0,to,"reject",0,function(e,t,r){return ts(e,tl(eL(t)),r)},"rest",0,tx,"restArguments",0,eY,"result",0,function(e,t,r){var n=(t=eR(t)).length;if(!n)return C(r)?r.call(e):r;for(var a=0;a<n;a++){var i=null==e?void 0:e[t[a]];void 0===i&&(i=r,a=n),e=C(i)?i.call(e):i}return e},"sample",0,ty,"select",0,ts,"shuffle",0,function(e){return ty(e,1/0)},"size",0,function(e){return null==e?0:eK(e)?e.length:J(e).length},"some",0,tc,"sortBy",0,function(e,t,r){var n=0;return t=eL(t,r),th(tn(e,function(e,r,a){return{value:e,index:n++,criteria:t(e,r,a)}}).sort(function(e,t){var r=e.criteria,n=t.criteria;if(r!==n){if(r>n||void 0===r)return 1;if(r<n||void 0===n)return -1}return e.index-t.index}),"value")},"sortedIndex",0,e8,"tail",0,tx,"take",0,tA,"tap",0,function(e,t){return t(e),e},"template",0,function(e,t,r){!t&&r&&(t=r);var n,a=RegExp([((t=ew({},t,ee.templateSettings)).escape||eQ).source,(t.interpolate||eQ).source,(t.evaluate||eQ).source].join("|")+"|$","g"),i=0,o="__p+='";e.replace(a,function(t,r,n,a,s){return o+=e.slice(i,s).replace(e$,eH),i=s+t.length,r?o+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":n?o+="'+\n((__t=("+n+"))==null?'':__t)+\n'":a&&(o+="';\n"+a+"\n__p+='"),t}),o+="';\n";var s=t.variable;if(s){if(!eq.test(s))throw Error("variable is not a bare identifier: "+s)}else o="with(obj||{}){\n"+o+"}\n",s="obj";o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{n=Function(s,"_",o)}catch(e){throw e.source=o,e}var l=function(e){return n.call(this,e,ee)};return l.source="function("+s+"){\n"+o+"}",l},"templateSettings",0,eB,"throttle",0,function(e,t,r){var n,a,i,o,s=0;r||(r={});var l=function(){s=!1===r.leading?0:tM(),n=null,o=e.apply(a,i),n||(a=i=null)},u=function(){var u=tM();s||!1!==r.leading||(s=u);var c=t-(u-s);return a=this,i=arguments,c<=0||c>t?(n&&(clearTimeout(n),n=null),s=u,o=e.apply(a,i),n||(a=i=null)):n||!1===r.trailing||(n=setTimeout(l,c)),o};return u.cancel=function(){clearTimeout(n),s=0,n=a=i=null},u},"times",0,function(e,t,r){var n=Array(Math.max(0,e));t=eC(t,r,1);for(var a=0;a<e;a++)n[a]=t(a);return n},"toArray",0,tv,"toPath",0,eS,"transpose",0,tL,"unescape",0,eF,"union",0,tP,"uniq",0,tk,"unique",0,tk,"uniqueId",0,function(e){var t=++tF+"";return e?e+t:t},"unzip",0,tL,"values",0,eg,"where",0,function(e,t){return ts(e,ex(t))},"without",0,tC,"wrap",0,function(e,t){return ez(t,e)},"zip",0,tD],227212);var tQ=tj(e.i(227212));tQ._=tQ,e.s(["default",0,tQ],449420),e.s([],58195)},715572,e=>{"use strict";e.s(["getConfigQueryOptions",()=>c,"useConfig",()=>d],715572);var t=e.i(480896),r=e.i(893930),n=e.i(693645),a=e.i(78888),i=e.i(482941),o=e.i(347245),s=e.i(430505);async function l(){return document.cookie.split("; ").find(e=>e.startsWith("bundleId="))?.split("=")[1]}let u=async()=>{let e=await (0,i.getServerOrigin)()??window.location.origin,t=await (0,o.getServerHost)()??(0,s.getClientHost)(),r=await l();return n.api.get(a.CONFIG_ENDPOINT,{headers:{host:t,origin:e,bundleid:r,"bundle-id":r,"app-id":r},cache:"default",next:{tags:["config",r??e],revalidate:600}})},c=()=>(0,t.queryOptions)({queryKey:["config"],queryFn:async()=>{try{return await u()}catch(e){if(e&&"object"==typeof e&&"statusCode"in e&&404===e.statusCode)return null;throw e}},staleTime:6e5,retry:!1}),d=()=>(0,r.useQuery)({...c()})},78888,e=>{"use strict";e.s(["CONFIG_ENDPOINT",0,"/v3/websites/config"])},448936,e=>{"use strict";e.s(["getWebsiteSettingsQueryOptions",()=>o]);var t=e.i(480896),r=e.i(693645),n=e.i(351567);async function a({previewWebsiteId:e,previewAuth:t}){let i=e||(0,n.getWebsiteIdFromHost)(await (0,n.resolveHost)());if(!i)throw Error("No website id available");return r.api.get(`/v3/pharmacist/plus-websites/${i}/preview`,{params:{userId:t.userId,expiresAt:String(t.expiresAt),signature:t.signature}})}async function i(){let e=(0,n.getWebsiteIdFromHost)(await (0,n.resolveHost)());if(!e)throw Error("No website id available");return r.api.get(`/v3/plus-websites/${e}`)}function o({auth:e,previewWebsiteId:r}={}){let n=e?{scope:"preview",websiteId:r??null}:{scope:"public",websiteId:null};return(0,t.queryOptions)({queryKey:["website-settings",n],queryFn:async()=>{try{if(e)return await a({previewAuth:e,previewWebsiteId:r});return await i()}catch(e){if(e&&"object"==typeof e&&"statusCode"in e&&404===e.statusCode)return null;throw e}},retry:!1,staleTime:6e5,...e?{staleTime:0}:{}})}},273828,664307,e=>{"use strict";e.s(["afterClaimAnonymousUser",()=>c,"claimAnonymousUser",()=>u,"isAnonymousUser",()=>s],273828);var t,r=e.i(693645),n=e.i(780751),a=((t={}).ANONYMOUS="anonymous",t.PATIENT="patient",t);e.s(["APPOINTMENTS_ENDPOINTS",0,{GET_APPOINTMENT_BY_ID:"/v3/appointments/:id",GET_APPOINTMENTS:"/v3/appointments",APPOINTMENT_AVAILABILITY:"/v3/services/:id/availability",RESERVE_APPOINTMENT_SLOT:"/v3/appointments/:id/reserve-slot",SET_PATIENT:"/v3/appointments/:id/set-patient",SET_PAYMENT_METHOD:"/v3/appointments/:id/set-payment-method",GET_PATIENTS:"/v4/patients",CONFIRM_APPOINTMENT:"/v3/appointments/:id/confirm-booking",CANCEL_APPOINTMENT:"/v3/appointments/:id/cancel"},"BASKET_ENDPOINTS",0,{GET_ORDER_SESSIONS:"/v3/order-sessions"},"CLINIC_ENDPOINTS",0,{AFFORDANCE:"/v3/affordances",GET_CLINIC_CONDITION:"/clinic-conditions/:id",GET_CONDITION_MASTER_PRODUCTS:"/clinic-conditions/:id/master-products",GET_MASTER_PRODUCT_INFO:"/clinic-master-products/:id/marketable-products",CREATE_CLINIC_ASSESSMENT:"/clinic-conditions/:id/assessments",REQUEST_PHOTO_UPLOAD_RETARGETING:"/v3/clinics/photo-upload-retargeting"},"EVENT_ENDPOINTS",0,{WEB_EVENT:"/events/web"},"USER_ENDPOINTS",0,{USER_DETAILS:"/v3/users/:id/user-details",PASSWORD:"/v3/users/:id/password",CARD_AUTH:"/users/:id/card_auth",PAYMENT_METHODS:"/users/:id/payment_methods",PAYMENT_METHOD:"/users/:id/payment_methods/:pmId",ADDRESS:"/v3/users/:id/address",CUSTOMER_SESSION:"/users/:id/customer-session"},"UserRole",()=>
2a],664307);var i=e.i(85848),o=e.i(79864);e.i(568547);let s=()=>{let e,t=n.localStorageProxy.getItem("access_token");if(t){try{e=(0,i.jwtDecode)(t)}catch{return}if(Array.isArray(e?.roles))return e.roles.some(e=>e.toLowerCase()===a.ANONYMOUS)}},l=async()=>{let e=await (0,o.getCurrentSession)();return!!e?.user},u=async()=>{let e=n.localStorageProxy.getItem("refresh_token");if(!e)return;let t=await (0,o.getCurrentSession)(),a=await r.api.post("/v3/auth/anonymous/claim-with-user",{token:e,username:t?.user?.email});return await c(),a},c=async()=>{let e=n.localStorageProxy.getItem("refresh_token");if(await l())n.localStorageProxy.removeItem("refresh_token");else if(e)try{let t=(0,i.jwtDecode)(e);t?.roles?.some(e=>e.toLowerCase()===a.ANONYMOUS)&&n.localStorageProxy.removeItem("refresh_token")}catch{n.localStorageProxy.removeItem("refresh_token")}}},693645,e=>{"use strict";e.s(["api",()=>m,"defaultAPIHeaders",()=>h]);var t=e.i(222522),r=e.i(347108),n=e.i(672915),a=e.i(79864),i=e.i(753970),o=e.i(440467),s=e.i(410927),l=e.i(780751),u=e.i(482941),c=e.i(347245),d=e.i(273828),f=e.i(430505);let h={"Content-Type":"application/json",Accept:"application/json","client-id":"RqPzYXQQHWrQEVZ"};async function p(e,t,u,c){let f=await e.json().catch(()=>null),h=401===e.status||f?.error?.code==="4001";if(c>=1||!h)throw"object"==typeof f&&null!==f?{...f,statusCode:e.status}:{message:e.statusText,statusCode:e.status};let{accessToken:p}=(0,o.getTokenDataFromStorageNamed)(),m=!!p&&!0!==(0,d.isAnonymousUser)();if(s.default){let e=await s.default.requestToken();return l.localStorageProxy.setItem("access_token",e),g(t,{...u,retryCount:c+1})}try{try{let e=await (0,n.getAuthClient)(),{data:r}=await e().token();if(r?.token)return(0,i.handleLocalStorageAfterAuthentication)(null,r.token),g(t,{...u,retryCount:c+1})}catch{}if(await r.tokenRefreshQueue.getValidToken(t,!0))return g(t,{...u,retryCount:c+1})}catch{}throw m&&await (0,a.handleExpiredSession)(f),"object"==typeof f&&null!==f?{...f,statusCode:e.status}:{message:e.statusText,statusCode:e.status}}async function g(e,r={}){let{method:n="GET",headers:a={},body:i,cookie:s,params:l,cache:d="no-store",next:m,retryCount:v=0,credentials:y}=r,b=await (0,u.getServerOrigin)(),E=await (0,c.getServerHost)(),w=(0,f.getClientHost)(),T=function(e,t){if(!t)return e;let r=Object.fromEntries(Object.entries(t).filter(([,e])=>null!=e));if(0===Object.keys(r).length)return e;let n=new URLSearchParams(r).toString();return`${e}?${n}`}(`${b??""}/api${e}`,l),S=await (0,t.getHeadersFromConfig)(T),{accessToken:R}=(0,o.getTokenDataFromStorageNamed)(),O={};R&&(O.Token=R,O.Authorization=`Bearer ${R}`);let I=Object.fromEntries(Object.entries({...a}).filter(([e,t])=>void 0!==t)),_=await fetch(T,{method:n,headers:{...h,...S,...I,...b?{origin:b}:{},...s?{Cookie:s}:{},...E||w?{"x-tenant-host":E||w}:{},...O},body:i?JSON.stringify(i):void 0,credentials:y||"include",cache:d,next:m});if(!_.ok)return p(_,e,r,v);let A=await _.text();if(!A||204===_.status)return null;try{return JSON.parse(A)}catch{throw Error("Invalid response format")}}let m={get:(e,t)=>g(e,{...t,method:"GET"}),post:(e,t,r)=>g(e,{...r,method:"POST",body:t}),put:(e,t,r)=>g(e,{...r,method:"PUT",body:t}),patch:(e,t,r)=>g(e,{...r,method:"PATCH",body:t}),delete:(e,t)=>g(e,{...t,method:"DELETE"})}},672915,e=>{"use strict";let t;e.s(["getAuthClient",()=>c],672915);var r=e.i(928653),n=e.i(645370),a=e.i(773417),i=e.i(543268),o=e.i(222522),s=e.i(693645);e.i(58195);var l=e.i(339533),l=l;let u=[(0,n.magicLinkClient)(),(0,a.emailOTPClient)(),(0,i.jwtClient)()],c=async()=>{let e=await (0,o.getHeadersFromConfig)(),n={...(0,l.default)(s.defaultAPIHeaders,"Content-Type"),...e};return t||(t=(0,r.createAuthClient)({basePath:"/api/v4/auth",fetchOptions:{headers:n},plugins:u})),()=>t}},79864,395288,123091,387907,880748,440467,410927,e=>{"use strict";e.s(["getCurrentSession",()=>L,"handleExpiredSession",()=>j,"logOutAndRedirect",()=>U],79864);var t=e.i(391398),r=e.i(672915),n=e.i(780751),a=e.i(679935),i=e.i(753970),o=e.i(568547),s=e.i(217837),l=e.i(766788);let u=()=>
2{let e=(0,s.usePathname)(),t=(0,s.useSearchParams)(),r=t?.toString();return e?(0,l.withBasePath)(`${e}${r?`?${r}`:""}`):(0,l.withBasePath)("/")};e.s(["useOnSuccessUrl",0,u],395288);let c=()=>{let e=u();return()=>{if(!(0,o.isCARegion)()&&"u">typeof localStorage){let t=e.length>1?e.replace(/\/$/,""):e;localStorage.setItem("login_redirect_link",t)}}};e.s(["useLegacyLoginRedirectHandler",0,c],123091);let d=e=>{let t=(0,o.isCARegion)()?"/auth":"/login";return`${t}?onSuccessUrl=${encodeURIComponent((0,l.withBasePath)(e))}`};e.s(["getLoginUrl",0,d],387907);let f=()=>{let e=(0,s.useRouter)(),r=u(),n=c(),a=d(r);return(0,t.jsxs)("button",{type:"button","data-button":"true","data-action":"true",onClick:()=>{n(),e.push(a)},children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"Login"}),(0,t.jsx)("span",{className:"sr-only",children:"Log in to continue"})]})};var h=e.i(191788);let p=e=>{let t,r=new Set,n=(e,n)=>{let a="function"==typeof e?e(t):e;if(!Object.is(a,t)){let e=t;t=(null!=n?n:"object"!=typeof a||null===a)?a:Object.assign({},t,a),r.forEach(r=>r(t,e))}},a=()=>t,i={setState:n,getState:a,getInitialState:()=>o,subscribe:e=>(r.add(e),()=>r.delete(e))},o=t=e(n,a,i);return i},g=e=>{let t=e?p(e):p,r=e=>(function(e,t=e=>e){let r=h.default.useSyncExternalStore(e.subscribe,h.default.useCallback(()=>t(e.getState()),[e,t]),h.default.useCallback(()=>t(e.getInitialState()),[e,t]));return h.default.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},m=e=>e?g(e):g;function v(e,t){let r;try{r=e()}catch(e){return}return{getItem:e=>{var n;let a=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),i=null!=(n=r.getItem(e))?n:null;return i instanceof Promise?i.then(a):a(i)},setItem:(e,n)=>r.setItem(e,JSON.stringify(n,null==t?void 0:t.replacer)),removeItem:e=>r.removeItem(e)}}let y=e=>t=>{try{let r=e(t);if(r instanceof Promise)return r;return{then:e=>y(e)(r),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>y(t)(e)}}},b=(e,t)=>(r,n,a)=>{let i,o={storage:v(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},s=!1,l=0,u=new Set,c=new Set,d=o.storage;if(!d)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...e)},n,a);let f=()=>{let e=o.partialize({...n()});return d.setItem(o.name,{state:e,version:o.version})},h=a.setState;a.setState=(e,t)=>(h(e,t),f());let p=e((...e)=>(r(...e),f()),n,a);a.getInitialState=()=>p;let g=()=>{var e,t;if(!d)return;let a=++l;s=!1,u.forEach(e=>{var t;return e(null!=(t=n())?t:p)});let h=(null==(t=o.onRehydrateStorage)?void 0:t.call(o,null!=(e=n())?e:p))||void 0;return y(d.getItem.bind(d))(o.name).then(e=>{if(e)if("number"!=typeof e.version||e.version===o.version)return[!1,e.state];else{if(o.migrate){let t=o.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;if(a!==l)return;let[s,u]=e;if(r(i=o.merge(u,null!=(t=n())?t:p),!0),s)return f()}).then(()=>{a===l&&(null==h||h(n(),void 0),i=n(),s=!0,c.forEach(e=>e(i)))}).catch(e=>{a===l&&(null==h||h(void 0,e))})};return a.persist={setOptions:e=>{o={...o,...e},e.storage&&(d=e.storage)},clearStorage:()=>{++l,null==d||d.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>g(),hasHydrated:()=>s,onHydrate:e=>(u.add(e),()=>{u.delete(e)}),onFinishHydration:e=>(c.add(e),()=>{c.delete(e)})},o.skipHydration||g(),i||p},E=(e,t)=>{let{[t]:r,...n}=e;return n},w=m()(b(e=>({byPharmacy:{},select:(t,r)=>e(e=>({byPharmacy:"main"===r.type?E(e.byPharmacy,t):{...e.byPharmacy,[t]:r}})),clear:t=>e(e=>({byPharmacy:E(e.byPharmacy,t)})),clearAll:()=>e({byPharmacy:{}})}),{name:"active-patient",storage:v(()=>window.sessionStorage),partialize:e=>({byPharmacy:e.byPharmacy})}));function T(){w.getState().clearAll()}function S(){try{Object.keys(window.sessionStorage).filter(e=>e.startsWith("refill-order-draft:")).forEach(e=>window.sessionStorage.removeItem(e)),window.sessionStorage.removeItem("refill-order-confirmation")}catch{}}let R=m()(b(e=>({draft:null,set:t=>e({draft:t}),clear:()=>e({draft:null})}),{name:"add-medication-draft",storage:v(()=>window.sessionStorage),partialize:e=>({draft:e.draft})}));function O(){R.getState().clear()}let I=({pharmacyId:e,patientId:t})=>`${e}:${t}`,_={selectedProductIds:[]},A=m()(b(e=>({drafts:{},update:(t,r)=>e(e=>({drafts:{...e.drafts,[I(t)]:{...e.drafts[I(t)]??_,...r}}})),clear:t=>e(e=>{let{[I(t)]:r,...n}=e.drafts;return{drafts:n}}),clearAll:()=>e({drafts:{}})}),{name:"order-draft",storage:v(()=>window.sessionStorage),partialize:e=>({drafts:e.drafts}),version:1,migrate:()=>({drafts:{}})}));function x(){A.getState().clearAll()}var N=e.i(3483);async function C(){return null}async function k(e,t){try{let r=await C();r?.track(e,t)}catch(e){console.error("Failed to track Mixpanel event:",e)}}async function P(){try{let e=await C();e?.reset()}catch(e){console.error("Failed to reset Mixpanel user:",e)}}e.s(["resetMixpanelUser",0,P,"trackMixpanelEvent",0,k],880748);let L=async()=>{try{let e=(await (0,r.getAuthClient)())(),t=await e.getSession();return t?.data||null}catch{return null}},D=async()=>{try{let e=await (0,r.getAuthClient)();await e().signOut()}finally{(0,i.deleteAuthenticationFromStorage)(),S(),O(),x(),T(),await P(),(0,N.getQueryClient)().resetQueries()}},U=async()=>{try{await D(),window.location.href="".startsWith("/")&&!"".startsWith("//")?"":"/"}catch{a.toast.error("Failed to log out")}};async function j(e){try{let e=await (0,r.getAuthClient)();await e().signOut()}catch(e){console.warn("Failed to sign out from better-auth:",e)}(0,i.deleteAuthenticationFromStorage)(),S(),O(),x(),T();let n=(0,N.getQueryClient)();n.resetQueries({queryKey:["user"]}),n.resetQueries({queryKey:["basket"]}),n.resetQueries({queryKey:["otc-basket"]}),n.resetQueries({queryKey:["pharmacy-patients"]}),n.resetQueries({queryKey:["patient-medicines"]}
2),a.toast.error("Session Expired",{description:e?.error?.message||"Your session has expired. Please log in again to continue.",action:(0,t.jsx)(f,{}),duration:1/0,id:"session-expired",closeButton:!0})}e.i(85848),e.s(["getTokenDataFromStorageNamed",0,()=>({refreshToken:n.localStorageProxy.getItem("refresh_token"),username:n.localStorageProxy.getItem("username"),accessToken:n.localStorageProxy.getItem("access_token")})],440467);class M{initialized=!1;inFlightPromises=new Map;resolvers=new Map;constructor(){this.init()}init(){this.initialized||(window.handleMobileClientMessage=this.handleMessage.bind(this),this.initialized=!0)}handleMessage(e){try{let t=JSON.parse(e);console.warn("[MobileClientBridge] Received:",t);let{action:r}=t;if("string"!=typeof r)return void console.warn("[MobileClientBridge] Invalid message action:",r);let n=this.resolvers.get(r);n?(n(t),this.resolvers.delete(r),this.inFlightPromises.delete(r)):console.warn(`[MobileClientBridge] No resolver found for action: ${r}`)}catch(e){console.error("[MobileClientBridge] Error parsing message:",e)}}sendToMobileClient(e){window.MobileClient?.postMessage?(window.MobileClient.postMessage(JSON.stringify(e)),console.warn("[MobileClientBridge] Sent:",e)):console.warn("[MobileClientBridge] MobileClient channel not available")}emit(e){this.sendToMobileClient({action:e})}emitAssessmentFailedContinue(){this.emit("assessment_failed_continue")}emitAssessmentCompleteContinue(){this.emit("assessment_complete_continue")}emitAssessmentStartError(){this.emit("assessment_start_error")}request(e){if(this.inFlightPromises.has(e.wait))return this.inFlightPromises.get(e.wait);let t=new Promise(t=>{this.resolvers.set(e.wait,t),this.sendToMobileClient({action:e.emit})});return this.inFlightPromises.set(e.wait,t),t}requestToken(){return this.request(M.events.token).then(e=>{if("object"==typeof e&&null!==e&&"access_token"in e&&"string"==typeof e.access_token)return e.access_token;throw Error("Invalid access token data received")})}static events={token:{emit:"request_access_token",wait:"receive_access_token"}}}let F=void 0!==window.MobileClient?new M:null;e.s(["default",0,F],410927)},766788,e=>{"use strict";e.s(["withBasePath",0,function(e){1;return e},"withoutBasePath",0,function(e){1;return e}])},222522,e=>{"use strict";e.s(["getHeadersFromConfig",()=>l]);var t=e.i(715572),r=e.i(78888),n=e.i(448936),a=e.i(3483),i=e.i(277232);let o=[r.CONFIG_ENDPOINT,"/_health","/plus-websites/"];function s(e,t){return(0,i.identifiesByBundle)(e,t)?{"app-id":t,bundleid:t,"app-platform":"web-app"}:e?{"organisation-id":e,organisation_id:e,"app-platform":"web-app-plus"}:{"app-platform":"web-app"}}async function l(e){if(e&&o.some(t=>e.includes(t)))return s(null,null);let{organisationId:t,bundleId:r}=await u(),n=s(t,r);return e?.includes("/affordances")&&t&&r&&(n["organisation-id"]=t,n.organisation_id=t),n}async function u(){let e=(0,a.getQueryClient)();try{let t=await e.fetchQuery((0,n.getWebsiteSettingsQueryOptions)());if(t)return{organisationId:t.organisationId??null,bundleId:t.bundleId??null}}catch{}try{let r=await e.fetchQuery((0,t.getConfigQueryOptions)());if(!r)return{organisationId:null,bundleId:null};return{organisationId:r.organisationId,bundleId:r.bundleId}}catch{return{organisationId:null,bundleId:null}}}},482941,e=>{"use strict";async function t(){}e.s(["getServerOrigin",0,t])},568547,e=>{"use strict";let t=e=>e.uk;e.s(["byRegion",0,t,"getRegionCountryCode",0,()=>t({uk:"GB",ca:"CA"}),"getRegionCurrency",0,()=>t({uk:"gbp",ca:"cad"}),"isCARegion",0,()=>!1])},347108,780751,e=>{"use strict";e.s(["tokenRefreshQueue",()=>l],347108);var t=e.i(672915),r=e.i(753970),n=e.i(693645);let a="/v3/auth/refresh-token",i=async e=>await n.api.post(a,{refreshToken:e}),o="4001",s="4002",l=(class e{static instance;isRefreshing;pendingQueue;constructor(){this.isRefreshing=!1,this.pendingQueue=[]}static getInstance(){return this.instance||(this.instance=new e),this.instance}processQueue(e,t){this.pendingQueue.forEach(({resolve:r,reject:n})=>{e?n(e):r(t)}),this.pendingQueue=[]}async getTokenFromSession(){try{let e=await (0,t.getAuthClient)(),{data:n}=await e().getSession();if(n?.session?.token)return(0,r.handleLocalStorageAfterAuthentication)(null,n.session.token),n.session.token;return null}catch(e){return null}}async attemptTokenRetrieval(e){try{let t=await this.getTokenFromSession();if(t)return{token:t};if(e)try{let t=await this.getTokenFromRefresh(e);if(t)return{token:t}}
2catch(e){if(e instanceof Error&&(e.code===s||e.code===o)){let e=await this.getTokenFromSession();if(e)return{token:e}}throw e}return{token:null}}catch(e){return{token:null,error:e instanceof Error?e:Error("Token retrieval failed")}}}async getTokenFromRefresh(e){try{let t=await i(e);if(t.tokens){let e=t.tokens.accessToken;return(0,r.handleLocalStorageAfterAuthentication)(null,e),e}}catch(e){throw(0,r.deleteAuthenticationFromStorage)(),Error(e||"Token refresh failed")}return null}async getValidToken(e,t=!1){if(e?.includes("/v4/auth/token")||e?.includes(a))return null;let[n,,i]=(0,r.getTokenDataFromStorage)();if(!t)return i||null;if(this.isRefreshing)return new Promise((e,t)=>{this.pendingQueue.push({resolve:e,reject:t})});this.isRefreshing=!0;try{let e=await this.attemptTokenRetrieval(n);if(e.error)return this.processQueue(e.error,null),null;if(e.token)return this.processQueue(null,e.token),e.token;return this.processQueue(null,null),null}catch(e){return e instanceof Error&&("AuthenticationError"===e.name||"TokenError"===e.name||e.code===s||e.code===o)&&(0,r.deleteAuthenticationFromStorage)(),this.processQueue(e,null),null}finally{this.isRefreshing=!1}}isRefreshInProgress(){return this.isRefreshing}}).getInstance();e.s(["localStorageProxy",0,{removeItem:e=>localStorage.removeItem(e),clear:()=>localStorage.clear(),setItem:(e,t)=>{localStorage.setItem(e,JSON.stringify(t))},getItem:e=>{let t=localStorage.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return t}}}],780751)},277232,e=>{"use strict";let t=["com.healthera.healtheraapp","com.healthera.healtheraappdev","com.healthera.healtheraapp.dev","com.healthera.healtheraappuat","com.healthera.healtheraapp.uat"],r=["com.healthera.healtheraapp.alphegadev","com.healthera.healtheraapp.alphegauat","com.healthera.healtheraapp.alphega"];e.s(["identifiesByBundle",0,(e,n)=>!!n&&(!e||[...t,...r].includes(n)),"isHealthera",0,(e,r)=>!e&&!!r&&t.includes(r)],277232)}]); 3 4//# debugId=8e02fc27-491e-6546-a7ad-d4a8720f6ef1
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.