https://app.everhealth.ai/_next/static/chunks/app/%5Blocale%5D/(auth)/login/page-f3f4b9a55eee5fd8.js
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[132,4958],{33382:function(e,t,r){Promise.resolve().then(r.bind(r,28234)),Promise.resolve().then(r.bind(r,4477)),Promise.resolve().then(r.bind(r,33802)),Promise.resolve().then(r.bind(r,83105)),Promise.resolve().then(r.t.bind(r,38173,23))},32498:function(e,t,r){"use strict";r.d(t,{ApiError:function(){return o}});class o extends Error{constructor(e,t,r){super(r),this.name="ApiError",this.url=t.url,this.status=t.status,this.statusText=t.statusText,this.body=t.body,this.request=e}}},20854:function(e,t,r){"use strict";r.d(t,{O:function(){return f}});var o=r(52396),n=r(49994),i=r(93936);class a extends Error{get isCancelled(){return!0}constructor(e){super(e),this.name="CancelError"}}var s=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,p=new WeakMap,m=new WeakMap;let h=Symbol.toStringTag;class f{get[h](){return"Cancellable Promise"}then(e,t){return(0,o._)(this,d).then(e,t)}catch(e){return(0,o._)(this,d).catch(e)}finally(e){return(0,o._)(this,d).finally(e)}cancel(){var e;if(!((0,o._)(this,s)||(0,o._)(this,l)||(0,o._)(this,c))){if((0,i._)(this,c,!0),(0,o._)(this,u).length)try{for(let e of(0,o._)(this,u))e()}catch(e){console.warn("Cancellation threw an error",e);return}(0,o._)(this,u).length=0,null===(e=(0,o._)(this,m))||void 0===e||e.call(this,new a("Request aborted"))}}get isCancelled(){return(0,o._)(this,c)}constructor(e){var t,r,a,h;(0,n._)(this,s,{writable:!0,value:void 0}),(0,n._)(this,l,{writable:!0,value:void 0}),(0,n._)(this,c,{writable:!0,value:void 0}),(0,n._)(this,u,{writable:!0,value:void 0}),(0,n._)(this,d,{writable:!0,value:void 0}),(0,n._)(this,p,{writable:!0,value:void 0}),(0,n._)(this,m,{writable:!0,value:void 0}),(0,i._)(this,s,!1),(0,i._)(this,l,!1),(0,i._)(this,c,!1),(0,i._)(this,u,[]),(0,i._)(this,d,new Promise((n,d)=>{(0,i._)(this,p,n),(0,i._)(this,m,d);let f=e=>{(0,o._)(this,s)||(0,o._)(this,l)||(0,o._)(this,c)||(0,o._)(this,u).push(e)};return Object.defineProperty(f,"isResolved",{get:()=>(0,o._)(this,s)}),Object.defineProperty(f,"isRejected",{get:()=>(0,o._)(this,l)}),Object.defineProperty(f,"isCancelled",{get:()=>(0,o._)(this,c)}),e(e=>{(0,o._)(this,s)||(0,o._)(this,l)||(0,o._)(this,c)||((0,i._)(this,s,!0),null===(t=(0,o._)(r=this,p))||void 0===t||t.call(r,e))},e=>{(0,o._)(this,s)||(0,o._)(this,l)||(0,o._)(this,c)||((0,i._)(this,l,!0),null===(a=(0,o._)(h=this,m))||void 0===a||a.call(h,e))},f)}))}}},4157:function(e,t,r){"use strict";r.d(t,{f:function(){return i}});var o=r(54436),n=r(98788);let i={get BASE(){return(0,n.b)()},VERSION:"1",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:async e=>{var t;return null!==(t=await (0,o.b)())&&void 0!==t?t:""},USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0}},98856:function(e,t,r){"use strict";r.d(t,{W:function(){return k}});var o=r(30998),n=r(32498),i=r(20854),a=r(56271),s=r(86300).Buffer;let l=e=>null!=e,c=e=>"string"==typeof e,u=e=>c(e)&&""!==e,d=e=>"object"==typeof e&&"string"==typeof e.type&&"function"==typeof e.stream&&"function"==typeof e.arrayBuffer&&"function"==typeof e.constructor&&"string"==typeof e.constructor.name&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag]),p=e=>e instanceof FormData,m=e=>{try{return btoa(e)}catch(t){return s.from(e).toString("base64")}},h=e=>{let t=[],r=(e,r)=>{t.push("".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(String(r))))},o=(e,t)=>{l(t)&&(Array.isArray(t)?t.forEach(t=>{o(e,t)}):"object"==typeof t?Object.entries(t).forEach(t=>{let[r,n]=t;o("".concat(e,"[").concat(r,"]"),n)}):r(e,t))};return(Object.entries(e).forEach(e=>{let[t,r]=e;o(t,r)}),t.length>0)?"?".concat(t.join("&")):""},f=(e,t)=>{let r=e.ENCODE_PATH||encodeURI,o=t.url.replace("{api-version}",e.VERSION).replace(/{(.*?)}/g,(e,o)=>{var n;return(null===(n=t.path)||void 0===n?void 0:n.hasOwnProperty(o))?r(String(t.path[o])):e}),n="".concat(e.BASE).concat(o);return t.query?"".concat(n).concat(h(t.query)):n},g=e=>{if(e.formData){let t=new FormData,r=(e,r)=>{c(r)||d(r)?t.append(e,r):t.append(e,JSON.stringify(r))};return Object.entries(e.formData).filter(e=>{let[t,r]=e;return l(r)}
1).forEach(e=>{let[t,o]=e;Array.isArray(o)?o.forEach(e=>r(t,e)):r(t,o)}),t}},v=async(e,t)=>"function"==typeof t?t(e):t,y=async(e,t)=>{let r=await v(t,e.TOKEN),o=await v(t,e.USERNAME),n=await v(t,e.PASSWORD),i=Object.entries({Accept:"application/json",...await v(t,e.HEADERS),...t.headers}).filter(e=>{let[t,r]=e;return l(r)}).reduce((e,t)=>{let[r,o]=t;return{...e,[r]:String(o)}},{});if(u(r)&&(i.Authorization="Bearer ".concat(r)),u(o)&&u(n)){let e=m("".concat(o,":").concat(n));i.Authorization="Basic ".concat(e)}return t.body&&(t.mediaType&&!p(t.body)?i["Content-Type"]=t.mediaType:d(t.body)?i["Content-Type"]=t.body.type||"application/octet-stream":c(t.body)?i["Content-Type"]="text/plain":p(t.body)||(i["Content-Type"]="application/json")),new Headers(i)},w=e=>{if(void 0!==e.body){var t;return(null===(t=e.mediaType)||void 0===t?void 0:t.includes("/json"))?JSON.stringify(e.body):c(e.body)||d(e.body)||p(e.body)?e.body:JSON.stringify(e.body)}},x=async(e,t,r,o,n,i,a)=>{let s;let l=new AbortController,c={headers:i,body:null!=o?o:n,method:t.method,signal:l.signal};e.WITH_CREDENTIALS&&(c.credentials=e.CREDENTIALS),a(()=>l.abort()),t.timeout&&t.timeout>0&&(s=setTimeout(()=>{l.abort()},t.timeout));try{let e=await fetch(r,c);return s&&clearTimeout(s),e}catch(e){throw s&&clearTimeout(s),e}},b=(e,t)=>{if(t){let r=e.headers.get(t);if(c(r))return r}},j=async e=>{if(204!==e.status)try{let t=e.headers.get("Content-Type");if(t){if(["application/json","application/problem+json"].some(e=>t.toLowerCase().startsWith(e)))return await e.json();return await e.text()}}catch(e){console.error(e)}},P=()=>{let e=window.location.pathname.match(/^\/(en|de)(?=\/|$)/),t=e?e[1]:"en";return"/".concat(t,"/login")},T=async(e,t)=>{let r={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...e.errors}[t.status];if(r){if(401===t.status||"Unauthorized"===r){var i;if(console.log("Authentication error detected in API response:",{status:t.status,error:r,body:t.body,url:t.url}),await a.APISessionManager.handleAPIError({response:{status:t.status},message:(null===(i=t.body)||void 0===i?void 0:i.error)||r,url:t.url}),!a.APISessionManager.isPublicApiEndpoint({url:t.url})){let e=sessionStorage.getItem("ever.logoutReason"),t=new URLSearchParams(window.location.search).get("reason"),r=P();(0,o.signOut)({callbackUrl:"idle"===e||"idle"===t?"".concat(r,"?reason=idle"):"".concat(r,"?tokenExpired=true"),redirect:!0});return}}throw new n.ApiError(e,t,r)}if(!t.ok)throw new n.ApiError(e,t,"Generic Error")},k=(e,t)=>new i.O(async(r,o,n)=>{try{let o=f(e,t),i=g(t),a=w(t),s=await y(e,t);if(!n.isCancelled){let l=await x(e,t,o,a,i,s,n),c=await j(l),u=b(l,t.responseHeader),d={url:o,ok:l.ok,status:l.status,statusText:l.statusText,body:null!=u?u:c};await T(t,d),r(d.body)}}catch(e){o(e)}})},69146:function(e,t,r){"use strict";r.d(t,{e:function(){return a}});var o=r(20854),n=r(4157),i=r(98856);class a{static login(e){return(0,i.W)(n.f,{method:"POST",url:"/auth/login",body:e,mediaType:"application/json"})}static logout(){return(0,i.W)(n.f,{method:"POST",url:"/auth/logout"})}static dismissTherapistPricingAnnouncement(e){return(0,i.W)(n.f,{method:"POST",url:"/auth/therapist-pricing-announcement/dismiss",headers:e?{Authorization:"Bearer ".concat(e)}:void 0})}static registerTherapist(e){return(0,i.W)(n.f,{method:"POST",url:"/auth/register",body:e,mediaType:"application/json"})}static sendVerificationCode(e){return(0,i.W)(n.f,{method:"POST",url:"/auth/send-confirmation-code",body:e,mediaType:"application/json"})}static verifyEmailCode(e){return(0,i.W)(n.f,{method:"POST",url:"/auth/verify-confirmation-code",body:e,mediaType:"application/json"})}static resendVerificationCode(e){return(0,i.W)(n.f,{method:"POST",url:"/auth/resend-verification-code",body:e,mediaType:"application/json"})}static forgotPassword(e){return(0,i.W)(n.f,{method:"POST",url:"/auth/forgot-password",body:e,mediaType:"application/json"})}static validateResetToken(e){return new o.O((t,r,o)=>{(0,i.W)(n.f,{method:"POST",url:"/auth/validate-reset-token",body:e,mediaType:"application/json"}).then(e=>{console.log("AuthService.validateResetToken raw response:",JSON.stringify(e,null,2)),e&&(e.message&&"string"==typeof e.message&&e.message.toLowerCase().includes("token is valid")&&void 0===e.valid&&(console.log('Found "token is valid" message, explicitly setting valid=true'),e.valid=!0),!0===e.success&&void 0===e.valid&&(console.log("Found success=true, explicitly setting valid=true"),e.valid=!0)),t(e)}).catch(e=>{r(e)})})}static resetPassword(e){return(0,i.W)(n.f,{method:"POST",url:"/auth/reset-password",body:e,mediaType:"application/json"})}}},94117:function(e,t,r){"use strict";r.d(t,{d:function(){return i}});var o=r(4157),n=r(98856);
1class i{static createProtocol(e){return(0,n.W)(o.f,{method:"POST",url:"/protocol",body:e,mediaType:"application/json"})}static updateProtocol(e){return(0,n.W)(o.f,{method:"PATCH",url:"/protocol/".concat(null==e?void 0:e.id),body:e,mediaType:"application/json"})}static updateProtocolProductIntakes(e){return(0,n.W)(o.f,{method:"PATCH",url:"/protocol/".concat(e.protocolId,"/productIntakes"),body:e,mediaType:"application/json"})}static updateProtocolProductReason(e){return(0,n.W)(o.f,{method:"PATCH",url:"/protocol/".concat(e.protocolId,"/product/").concat(e.productId,"/reason"),body:e,mediaType:"application/json"})}static updateProtocolSymptoms(e,t){return(0,n.W)(o.f,{method:"PATCH",url:"/protocol/".concat(e,"/symptoms"),body:{symptoms:t},mediaType:"application/json"})}static deleteProtocolProduct(e,t){return(0,n.W)(o.f,{method:"DELETE",url:"/protocol/".concat(e,"/product/").concat(t),mediaType:"application/json"})}static updateProtocolProductRequestIntakes(e){let{productRequestId:t,intakeIds:r,durationType:i,durationValue:a,durationUnit:s}=e;if(!t||!r)throw Error("productRequestId and intakeIds are required");return(0,n.W)(o.f,{method:"PATCH",url:"/productRequest/".concat(t,"/intakes"),body:{intakeIds:r,...void 0!==i&&{durationType:i},...void 0!==a&&{durationValue:a},...void 0!==s&&{durationUnit:s}},mediaType:"application/json"})}static async getPatientProtocols(e){var t;let r=await (0,n.W)(o.f,{method:"GET",url:"/protocol/patient/".concat(e),mediaType:"application/json"});return null!==(t=null==r?void 0:r.data)&&void 0!==t?t:{patientOnProtocols:[],hasProductRequests:!1}}static deletePatientProtocol(e){return(0,n.W)(o.f,{method:"DELETE",url:"/protocol/patient/".concat(e),mediaType:"application/json"})}static async getProtocolById(e){var t;let r=await (0,n.W)(o.f,{method:"GET",url:"/protocol/".concat(e),mediaType:"application/json"});return null!==(t=null==r?void 0:r.data)&&void 0!==t?t:null}static getProtocolCost(e){return(0,n.W)(o.f,{method:"GET",url:"/protocol/protocolCost/".concat(e),mediaType:"application/json"})}static getProtocolsCosts(e){return(0,n.W)(o.f,{method:"GET",url:"/protocol/protocolsCosts/patient/".concat(e),mediaType:"application/json"})}static async getMonthlyPacks(e){var t;let r=await (0,n.W)(o.f,{method:"GET",url:"/protocol/monthly-packs/patient/".concat(e),mediaType:"application/json"});return null!==(t=null==r?void 0:r.data)&&void 0!==t?t:{packs:[],monthlySummary:{totalCapsules:0,totalDistinctProducts:0,baseProductCost:0,packagingSurcharge:0,processingFee:0,finalTotalPrice:0}}}static setProtocolAsTemplate(e){return(0,n.W)(o.f,{method:"POST",url:"/protocol/set-as-template",body:{protocolId:e},mediaType:"application/json"})}static updateProtocolProductDuration(e){return(0,n.W)(o.f,{method:"PATCH",url:"/protocol/product/duration",body:e,mediaType:"application/json"})}static updatePatientProtocolState(e){let{id:t,state:r}=e;return(0,n.W)(o.f,{method:"PATCH",url:"/protocol/patient/state",body:{id:t,state:r}})}static async getNutrientOverview(e){var t;let r=await (0,n.W)(o.f,{method:"GET",url:"/protocol/nutrient-overview/".concat(e),mediaType:"application/json"});return null!==(t=null==r?void 0:r.data)&&void 0!==t?t:[]}static deleteProtocol(e){return(0,n.W)(o.f,{method:"DELETE",url:"/protocol/".concat(e),mediaType:"application/json"})}static getProtocolTemplates(e){var t;let r={...null!=e?e:{}},i=e=>{if(null==e)return;let t=Number(e);return Number.isFinite(t)?t:void 0},a=i(null!==(t=r.pageSize)&&void 0!==t?t:r.take),s=i(r.page);return a&&!r.take&&(r.take=a),a&&s&&!r.skip&&s>0&&(r.skip=(s-1)*a),"string"!=typeof r.searchQuery||r.name||(r.name=r.searchQuery),(0,n.W)(o.f,{method:"GET",url:"/protocol/templates",query:r,mediaType:"application/json"})}static getProtocolTemplatesByCategory(e){let t={...null!=e?e:{}};return void 0!==t.expertOnly&&(t.expertOnly=!0===t.expertOnly||"true"===t.expertOnly?"true":"false"),(0,n.W)(o.f,{method:"GET",url:"/protocol/templates/by-category",query:t,mediaType:"application/json"})}static clonePublicProtocol(e){return(0,n.W)(o.f,{method:"PATCH",url:"/protocol/clone",body:e})}static checkDuplicateProducts(e){return(0,n.W)(o.f,{method:"POST",url:"/protocol/check-duplicates",body:e,mediaType:"application/json"})}static setProtocolCategory(e){return(0,n.W)(o.f,{method:"POST",url:"/protocol/category/set",body:e,mediaType:"application/json"})}static unsetProtocolCategory(e){return(0,n.W)(o.f,{method:"POST",url:"/protocol/category/unset",body:e,mediaType:"application/json"})}static recommendProtocols(e){return(0,n.W)(o.f,{method:"POST",url:"/protocol/recommendations",body:e,mediaType:"application/json"})}static generatePublicLink(e,t){return(0,n.W)(o.f,{method:"POST",url:"/protocol/".concat(e,"/public-link?locale=").concat(t),mediaType:"application/json"})}static async getProtocolByPublicUrl(e){var t;let r=await (0,n.W)(o.f,{method:"GET",url:"/protocol/public/".concat(e),mediaType:"application/json"});return null!==(t=null==r?void 0:r.data)&&void 0!==t?t:null}static getProtocolCreatorTherapist(e,t){return(0,n.W)(o.f,{method:"GET",url:"/protocol/".concat(e,"/creator-therapist"),query:t,mediaType:"application/json"})}}},15342:function(e,t,r){"use strict";r.d(t,{I:function(){return i}});var o=r(4157),n=r(98856);
1class i{static async lookupTherapistByEmail(e){let t=await (0,n.W)(o.f,{method:"POST",url:"/therapistShare/lookup-email",body:{email:e}});if(t.error)throw Error(t.error);return t.data}static async shareWithTherapist(e){let t=await (0,n.W)(o.f,{method:"POST",url:"/therapistShare",body:e});if(t.error)throw Error(t.error);return t.data}static async getTherapistShares(e,t){let r=await (0,n.W)(o.f,{method:"GET",url:"/therapistShare",query:{patientId:e,therapistId:t}});if(r.error)throw Error(r.error);return r.data}static async validateInvitationToken(e){let t=await (0,n.W)(o.f,{method:"GET",url:"/therapistShare/validate/".concat(e)});if(t.error)throw Error(t.error);return t.data}static async acceptShare(e){let t=await (0,n.W)(o.f,{method:"POST",url:"/therapistShare/accept",body:{shareId:e}});if(t.error)throw Error(t.error);return t.data}static async rejectShare(e){let t=await (0,n.W)(o.f,{method:"POST",url:"/therapistShare/reject",body:{shareId:e}});if(t.error)throw Error(t.error);return t.data}static async revokeShare(e){let t=await (0,n.W)(o.f,{method:"POST",url:"/therapistShare/revoke",body:{shareId:e}});if(t.error)throw Error(t.error);return t.data}static async acceptInvitation(e,t){let r=await (0,n.W)(o.f,{method:"POST",url:"/therapistShare/acceptInvitation",body:{invitationToken:e,therapistId:t}});if(console.log("sdfsdfsdfsd ",r),r.error)throw Error(r.error);return r.data}}},28234:function(e,t,r){"use strict";r.d(t,{default:function(){return a}});var o=r(57437),n=r(18087),i=r(93082);function a(){let e=(0,n.useTranslations)("footer");return(0,o.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-x-4 gap-y-2 mb-4 px-4",children:[(0,o.jsx)(i.rU,{className:"font-normal text-black hover:text-[#4d4d4d] active:text-[#999999] underline hover:underline active:underline",href:"https://www.everhealth.ai/impressum",target:"_blank",rel:"noopener noreferrer",children:e("imprint")}),(0,o.jsx)(i.rU,{className:"font-normal text-black hover:text-[#4d4d4d] active:text-[#999999] underline hover:underline active:underline",href:"https://www.everhealth.ai/datenschutz-app",target:"_blank",rel:"noopener noreferrer",children:e("privacy")}),(0,o.jsx)("button",{type:"button",className:"js-cookie-settings font-normal text-black hover:text-[#4d4d4d] active:text-[#999999] underline hover:underline active:underline bg-transparent border-0 p-0 cursor-pointer",children:e("cookieSettings")})]})}},26765:function(e,t,r){"use strict";var o=r(57437),n=r(63556),i=r(9257),a=r(44722),s=r(58028),l=r(41936),c=r(2265),u=r(18087),d=r(25524),p=r(69146),m=r(50098);t.Z=e=>{let{isOpen:t,onClose:r}=e,h=(0,u.useTranslations)("forgotPassword"),f=(0,u.useLocale)(),[g]=n.Z.useForm(),[v,y]=(0,c.useState)(!1),[w,x]=(0,c.useState)(null),[b,j]=(0,c.useState)(!1);(0,m.l)();let P=(0,d.useMutation)({mutationFn:p.e.forgotPassword,onSuccess:()=>{j(!0),y(!1)},onError:e=>{var t,r;console.error("Forgot password error:",e),x((null==e?void 0:null===(r=e.response)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:t.error)||e.message||h("unexpectedError")),y(!1)}}),T=async e=>{x(null),y(!0);let t=window.location.origin,r="".concat(t,"/").concat(f,"/reset-password");P.mutate({email:e.email,frontendUrl:r,locale:f})},k=()=>{j(!1),x(null),g.resetFields(),r()};return(0,o.jsx)(i.Z,{title:h("title"),open:t,onCancel:k,footer:null,destroyOnClose:!0,children:b?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(a.Z,{message:h("emailSentTitle"),description:h("emailSentDescription"),type:"success",showIcon:!0,className:"mb-4"}),(0,o.jsx)("div",{className:"flex justify-end mt-4",children:(0,o.jsx)(l.ZP,{onClick:k,children:h("close")})})]}):(0,o.jsxs)(o.Fragment,{children:[w&&(0,o.jsx)(a.Z,{message:w,type:"error",showIcon:!0,className:"mb-4",closable:!0,onClose:()=>x(null)}),(0,o.jsx)("p",{className:"mb-4",children:h("description")}),(0,o.jsxs)(n.Z,{form:g,layout:"vertical",onFinish:T,requiredMark:!1,children:[(0,o.jsx)(n.Z.Item,{name:"email",label:h("emailLabel"),rules:[{required:!0,message:h("emailRequired")},{type:"email",message:h("emailInvalid")}],children:(0,o.jsx)(s.default,{placeholder:h("emailPlaceholder")})}),(0,o.jsxs)("div",{className:"flex justify-end gap-2 mt-4",children:[(0,o.jsx)(l.ZP,{onClick:k,children:h("cancel")}),(0,o.jsx)(l.ZP,{type:"primary",htmlType:"submit",loading:v,className:"bg-[#8C4C3E] hover:bg-[#7a4236]",children:h("submit")})]})]})]})})}},4477:function(e,t,r){"use strict";r.d(t,{default:function(){return j}});var o=r(57437),n=r(30998),i=r(2265),a=r(18087),s=r(16970),l=r(93122),c=r(18357),u=r(41936),d=r(78421),p=r(66648),m=r(16463),h=r(26765),f=r(32291),g=r(93191),v=r(25524),y=r(15342),w=r(94117),x=r(71692);let b="ever.logoutReason";function j(e){let{invitationToken:t,fa:r,protocolId:j,connect:P,therapistInvite:T,therapistId:k,requiredRole:E,redirectTo:S}=e,[C,N]=(0,i.useState)({email:"",password:""}),[A,_]=(0,i.useState)(""),[L,I]=(0,i.useState)(!1),[W,O]=(0,i.useState)(!1),[R,M]=(0,i.useState)({email:"",password:""}),[Z,D]=(0,i.useState)(!1),[B,H]=(0,i.useState)(!1),q=(0,a.useTranslations)("loginForm"),F=(0,a.useLocale)(),U=(0,m.useSearchParams)(),G=U.get("tokenExpired"),z=U.get("reason"),V=(0,i.useRef)(!1);(0,i.useRef)(!1);let[J,$]=(0,i.useState)(!1),Q=(0,g.useQueryClient)(),X=(0,v.useMutation)({mutationFn:e=>{let{protocolId:t,patientId:r}=e;return w.d.clonePublicProtocol({protocolId:t,patientId:r,to:"patient"})},onSuccess:(e,t)=>{l.ZP.success(q("activated")),t.patientId&&Q.invalidateQueries({queryKey:["therapist","patient",t.patientId,"routine"]})},onError:e=>{l.ZP.error(q("activateError")),console.error("Error assigning protocol:",e)}}),K=(0,v.useMutation)({mutationFn:e=>{let{invitationToken:t,therapistId:r}=e;return y.I.acceptInvitation(t,r)},onSuccess:()=>console.log("inviteAccepted: "),onError:()=>console.error("inviteAcceptFailed")}),{data:Y,status:ee}
1=(0,n.useSession)(),et=(0,i.useRef)(!1),er=(0,i.useRef)(!1);(0,i.useEffect)(()=>{"unauthenticated"===ee&&sessionStorage.removeItem("therapistPricingAnnouncementModalShown")},[ee]),(0,i.useEffect)(()=>{var e;let o=async()=>{"authenticated"===ee&&(null==Y?void 0:Y.user)&&r&&j&&"PATIENT"===Y.user.role.name&&!et.current&&(et.current=!0,X.mutate({protocolId:j,patientId:Y.user.id}))};if("authenticated"!==ee||!(null==Y?void 0:Y.user)||!W)return;let i=null===(e=Y.user.role)||void 0===e?void 0:e.name;if(E&&i!==E){er.current||(er.current=!0,l.ZP.info("Please sign in with a therapist account to continue."),(0,n.signOut)({redirect:!1}));return}let a=Y.user.role,s=Y.user.pendingStatus||(null==a?void 0:a.name)==="THERAPIST"&&(null==a?void 0:a.status)==="PENDING";if("THERAPIST"===i&&s){D(!0),(0,n.signOut)({redirect:!1});return}t&&Y.user.id&&K.mutate({invitationToken:t}),o();let c=e=>{let t=e.replace(/^\/(en|de)(?=\/|$)/,"");window.location.href="/".concat(F).concat(t)};if(T&&k&&"PATIENT"===i){c("/expert/invite?therapistInvite=1&therapistId=".concat(encodeURIComponent(k)));return}if(P&&"PATIENT"===i){c("/expert-consent?connect=".concat(P));return}if(S){c(S||"/");return}c("ADMIN"===i?"/admin/data":"PATIENT"===i?"/patient/home":"/therapist/home")},[ee,Y,F,E,S,P,T,k,t,W]);let eo=()=>{let e={email:"",password:""},t=!1;return C.email.trim()?/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(C.email)||(e.email=q("invalidEmailFormat"),t=!0):(e.email=q("emailRequired"),t=!0),C.password.trim()||(e.password=q("passwordRequired"),t=!0),M(e),!t},en=async e=>{if(e.preventDefault(),_(""),M({email:"",password:""}),!eo())return;I(!0),O(!1);let t=await (0,n.signIn)("credentials",{email:C.email,password:C.password,redirect:!1});(null==t?void 0:t.ok)?((0,x.EX)(),O(!0),l.ZP.success(q("loginSuccess"))):(_(q("invalidCredentials")),l.ZP.error(q("invalidCredentials"))),I(!1)},ei=e=>{let{name:t,value:r}=e.target;N(e=>({...e,[t]:r})),R[t]&&M(e=>({...e,[t]:""}))};return(0,i.useEffect)(()=>{let e=sessionStorage.getItem(b);"idle"!==z&&"idle"!==e||V.current?G&&!V.current&&(V.current=!0,l.ZP.warning(q("tokenExpired"))):(V.current=!0,l.ZP.info(q("idleLogout")),sessionStorage.removeItem(b))},[G,z,q]),(0,o.jsxs)(o.Fragment,{children:[Z&&(0,o.jsx)(f.Z,{onClose:()=>D(!1)}),(0,o.jsxs)(c.Z,{className:"w-[600px] max-w-[95vw]",styles:{body:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"space-around",padding:"2rem",gap:"2rem"}},children:[(0,o.jsx)(p.default,{className:"mt-4",src:"/assets/ever-logo/ever_with_gradient.jpg",alt:"Login",width:200,height:200}),(0,o.jsxs)("div",{className:"flex flex-col w-full items-center",children:[(0,o.jsx)("h1",{className:"text-2xl font-semibold text-therapist-brown",children:q("heading")}),(0,o.jsx)("p",{className:"text-center text-gray-600 mt-2",children:q("description")})]}),(0,o.jsxs)("form",{onSubmit:en,className:"w-full",noValidate:!0,children:[(0,o.jsxs)("div",{className:"mb-4",children:[(0,o.jsx)("input",{tabIndex:1,placeholder:q("email"),name:"email",onChange:ei,id:"email",type:"email",value:C.email,disabled:L,className:"block w-full mt-1 p-3 border rounded-md ".concat(A||R.email?"border-red-500":"border-gray-300"," focus:outline-slate-950 disabled:bg-gray-100 disabled:cursor-not-allowed")}),R.email&&(0,o.jsx)("p",{className:"mt-1 text-sm text-red-500",children:R.email})]}),(0,o.jsxs)("div",{className:"mb-6",children:[(0,o.jsxs)("div",{className:"relative",children:[(0,o.jsx)("input",{id:"password",name:"password",tabIndex:2,placeholder:q("password"),type:B?"text":"password",value:C.password,onChange:ei,disabled:L,className:"block w-full mt-1 p-3 pr-8 border rounded-md ".concat(A||R.password?"border-red-500":"border-gray-300"," focus:outline-slate-950 disabled:bg-gray-100 disabled:cursor-not-allowed")}),(0,o.jsx)("button",{type:"button",tabIndex:3,onClick:()=>H(!B),disabled:L,className:"absolute inset-y-0 top-0 flex items-center text-gray-500 right-2 disabled:opacity-50 disabled:cursor-not-allowed","aria-label":q("togglePasswordVisibility"),children:B?(0,o.jsx)(s.tE,{className:"size-5"}):(0,o.jsx)(s.kZ,{className:"size-5"})})]}),R.password&&(0,o.jsx)("p",{className:"mt-1 text-sm text-red-500",children:R.password}),(0,o.jsx)("div",{className:"flex justify-end mt-1",children:(0,o.jsx)(u.ZP,{htmlType:"button",type:"link",className:"hover:underline",onClick:()=>$(!0),children:q("forgotPassword")})})]}),(0,o.jsx)(u.ZP,{tabIndex:4,htmlType:"submit",type:"primary",disabled:L,className:"!w-full",children:L?(0,o.jsxs)("div",{className:"flex items-center justify-center",children:[(0,o.jsx)(d.Z,{size:"small",className:"mr-2"}),q("loading")]}):q("submit")})]}),(0,o.jsx)(h.Z,{isOpen:J,onClose:()=>$(!1)})]})]})}},50098:function(e,t,r){"use strict";r.d(t,{NotificationProvider:function(){return l},l:function(){return s}});var o=r(57437),n=r(2265),i=r(45637);let a=(0,n.createContext)(null),s=()=>{let e=(0,n.useContext)(a);if(!e)throw Error("useNotification must be used within NotificationProvider");return e.notify},l=e=>{let{children:t}=e,[r,s]=i.ZP.useNotification(),l=e=>{r.open(e)},c=(0,n.useMemo)(()=>({notify:l}),[l]);return(0,o.jsxs)(a.Provider,{value:c,children:[s,t]})}},16970:function(e,t,r){"use strict";r.d(t,{G7:function(){return s},I8:function(){return a},NJ:function(){return p},ZP:function(){return l},gq:function(){return m},kZ:function(){return d},rF:function(){return n},tB:function(){return c},tE:function(){return u},v3:function(){return i}});var o=r(57437);function n(e){let{className:t,onClick:r}=e;return(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:t,onClick:r,children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"})})}function i(e){let{className:t,onClick:r}=e;return(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:t,onClick:r,children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v6m3-3H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}function a(e){let{className:t,onClick:r}=e;return(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:t,onClick:r,children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10"})})}function s(e){let{className:t,onClick:r}=e;return(0,o.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:t,onClick:r,children:[(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})]})}function l(e){let{className:t,onClick:r}=e;return(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:t,onClick:r,children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18
118 6M6 6l12 12"})})}function c(e){let{className:t,onClick:r}=e;return(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:t,onClick:r,children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z"})})}function u(e){let{className:t,onClick:r}=e;return(0,o.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:t,onClick:r,children:[(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})]})}function d(e){let{className:t,onClick:r}=e;return(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:t,onClick:r,children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"})})}function p(e){let{className:t,onClick:r}=e;return(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:t,onClick:r,children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.72 13.829c-.24.03-.48.062-.72.096m.72-.096a42.415 42.415 0 0 1 10.56 0m-10.56 0L6.34 18m10.94-4.171c.24.03.48.062.72.096m-.72-.096L17.66 18m0 0 .229 2.523a1.125 1.125 0 0 1-1.12 1.227H7.231c-.662 0-1.18-.568-1.12-1.227L6.34 18m11.318 0h1.091A2.25 2.25 0 0 0 21 15.75V9.456c0-1.081-.768-2.015-1.837-2.175a48.055 48.055 0 0 0-1.913-.247M6.34 18H5.25A2.25 2.25 0 0 1 3 15.75V9.456c0-1.081.768-2.015 1.837-2.175a48.041 48.041 0 0 1 1.913-.247m10.5 0a48.536 48.536 0 0 0-10.5 0m10.5 0V3.375c0-.621-.504-1.125-1.125-1.125h-8.25c-.621 0-1.125.504-1.125 1.125v3.659M18 10.5h.008v.008H18V10.5Zm-3 0h.008v.008H15V10.5Z"})})}let m=e=>(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",...e,children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"})})},32291:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});var o=r(57437),n=r(18087);function i(e){let{onClose:t}=e,r=(0,n.useTranslations)("therapistPendingModal");return(0,o.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-70",children:(0,o.jsxs)("div",{className:"relative max-w-md p-6 mx-auto bg-white rounded-lg shadow-xl border border-gray-200 animate-fadeIn",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,o.jsxs)("div",{className:"flex items-center",children:[(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"text-primary size-6 mr-2",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})}),(0,o.jsxs)("h2",{className:"font-bold text-lg text-primary",children:["\uD83C\uDF89 ",r("title")]})]}),(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"text-gray-500 size-6 hover:text-primary cursor-pointer",onClick:t,children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18
118 6M6 6l12 12"})})]}),(0,o.jsx)("p",{className:"mb-4 text-gray-800 font-medium leading-relaxed",children:r("message")}),(0,o.jsx)("p",{className:"mb-6 text-gray-700 leading-relaxed",children:r("emailInfo")}),(0,o.jsx)("div",{className:"flex justify-center",children:(0,o.jsx)("button",{className:"px-6 py-2.5 bg-primary text-white rounded-md hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-opacity-50 font-medium text-base shadow-md transition-all duration-200 ease-in-out transform hover:scale-105",onClick:t,children:r("understand")})})]})})}},93082:function(e,t,r){"use strict";r.d(t,{rU:function(){return a},tv:function(){return c}});var o=r(63019),n=r(5758);let i=(0,o.R)({locales:["en","de"],defaultLocale:"en"}),{Link:a,redirect:s,usePathname:l,useRouter:c,getPathname:u}=(0,n.os)(i)},56271:function(e,t,r){"use strict";r.r(t),r.d(t,{APISessionManager:function(){return n}});var o=r(30998);class n{static getLocalizedLoginPath(){let e=window.location.pathname.match(/^\/(en|de)(?=\/|$)/),t=e?e[1]:"en";return"/".concat(t,"/login")}static async handleAPIError(e,t){!(this.isLoggingOut||this.isPublicApiEndpoint(e))&&this.isAuthenticationError(e)&&(console.log("Authentication error detected in API response:",e),await this.forceLogout(t))}static isPublicApiEndpoint(e){var t,r,o,n;let i;if(null==e?void 0:null===(t=e.config)||void 0===t?void 0:t.url)i=e.config.url;else if(null==e?void 0:null===(o=e.response)||void 0===o?void 0:null===(r=o.config)||void 0===r?void 0:r.url)i=e.response.config.url;else if(null==e?void 0:e.url)i=e.url;else if(null==e?void 0:null===(n=e.request)||void 0===n?void 0:n.url)i=e.request.url;else if(null==e?void 0:e.message){let t=e.message.match(/https?:\/\/[^\s]+|\/api\/[^\s]+/i);t&&(i=t[0])}if(!i)return!1;let a=i.split("?")[0].split("#")[0];return this.publicApiPatterns.some(e=>a.includes(e.trim()))}static isAuthenticationError(e){var t,r,o;if((null==e?void 0:null===(t=e.response)||void 0===t?void 0:t.status)===401||(null==e?void 0:e.status)===401)return!0;let n=(null==e?void 0:e.message)||(null==e?void 0:null===(o=e.response)||void 0===o?void 0:null===(r=o.data)||void 0===r?void 0:r.message)||"";return["unauthorized","invalid token","token expired","authentication failed","session expired","invalid session"].some(e=>n.toLowerCase().includes(e.toLowerCase()))}static async forceLogout(e){if(!this.isLoggingOut){this.isLoggingOut=!0,console.log("Force logout triggered by API authentication error");try{{document.cookie.split(";").forEach(e=>{let t=e.indexOf("="),r=t>-1?e.substring(0,t).trim():e.trim();if(r){let e=new Date(0).toUTCString();if(document.cookie="".concat(r,"=; expires=").concat(e,"; path=/; max-age=0"),document.cookie="".concat(r,"=; expires=").concat(e,"; path=/; domain=").concat(window.location.hostname,"; max-age=0"),window.location.hostname.includes(".")){let t=window.location.hostname.split(".").slice(-2).join(".");document.cookie="".concat(r,"=; expires=").concat(e,"; path=/; domain=.").concat(t,"; max-age=0")}}});let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r&&r.startsWith("ever.onboarding.tour.v1")){let t=localStorage.getItem(r);null!==t&&e.push([r,t])}}localStorage.clear(),e.forEach(e=>{let[t,r]=e;return localStorage.setItem(t,r)}),sessionStorage.clear()}await (0,o.signOut)({redirect:!1});let t=this.getLocalizedLoginPath();e?(e.push(t),e.refresh()):window.location.href=t}catch(e){console.error("Error during API-triggered logout:",e),window.location.href=this.getLocalizedLoginPath()}finally{setTimeout(()=>{this.isLoggingOut=!1},2e3)}}}static isLogoutInProgress(){return this.isLoggingOut}}n.isLoggingOut=!1,n.publicApiPatterns=["/api/auth","/api/protocol/public/","/api/protocol/templates","/api/protocol/templates/by-category","/api/therapist-finder/expert/","/api/therapist-finder/profile/public","/api/therapist-finder/categories","/api/therapist-finder/languages","/api/therapist-finder/all","/api/enduser-categories "],t.default=n},14178:function(e,t,r){"use strict";r.d(t,{ZG:function(){return a},d5:function(){return i},tA:function(){return n}});var o=r(60183);function n(){try{let e=localStorage.getItem(o.Dq);
1if(!e)return null;let t=JSON.parse(e);if(!(null==t?void 0:t.timestamp))return null;if(Date.now()-new Date(t.timestamp).getTime()>o.E5)return localStorage.removeItem(o.Dq),null;return t}catch(e){return null}}function i(){let e=n();return(null==e?void 0:e.statistics)===!0}function a(e,t){let r={necessary:!0,statistics:e,marketing:t,timestamp:new Date().toISOString(),version:o.bA};try{localStorage.setItem(o.Dq,JSON.stringify(r))}catch(e){}return r}},60183:function(e,t,r){"use strict";var o;r.d(t,{B_:function(){return c},Dq:function(){return i},E5:function(){return s},Qk:function(){return n},bA:function(){return a}});let n=null!==(o=r(20357).env.NEXT_PUBLIC_GA4_MEASUREMENT_ID)&&void 0!==o?o:"G-BJH4GLGHF1",i="ever_cookie_consent",a="1.0",s=31560192e3,l=/^\/(en|de)\/(login|register|user-register)\/?$/;function c(e){return l.test(e)}},71692:function(e,t,r){"use strict";r.d(t,{EX:function(){return d},Ve:function(){return s},_k:function(){return c},je:function(){return u},yY:function(){return l}});var o=r(60183),n=r(14178);let i=!1;function a(){var e;return window.dataLayer=null!==(e=window.dataLayer)&&void 0!==e?e:[],window.gtag||(window.gtag=function(){for(var e,t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];null===(e=window.dataLayer)||void 0===e||e.push(r)}),window.gtag}function s(){if(i)return;let e=a();if(e){if(e("consent","default",{ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",analytics_storage:"denied",functionality_storage:"granted",security_storage:"granted",wait_for_update:500}),!document.querySelector('script[src*="googletagmanager.com/gtag/js"]')){let e=document.createElement("script");e.async=!0,e.src="https://www.googletagmanager.com/gtag/js?id=".concat(o.Qk),document.head.appendChild(e)}e("js",new Date),e("config",o.Qk,{anonymize_ip:!0}),i=!0}}function l(e){var t;let r=a();r&&(r("consent","update",{analytics_storage:e.statistics?"granted":"denied",ad_storage:e.marketing?"granted":"denied",ad_user_data:e.marketing?"granted":"denied",ad_personalization:e.marketing?"granted":"denied"}),window.dataLayer=null!==(t=window.dataLayer)&&void 0!==t?t:[],window.dataLayer.push({event:"consent_update",consent_necessary:!0,consent_statistics:e.statistics,consent_marketing:e.marketing}))}function c(e,t){if(!(0,n.d5)())return;let r=window.gtag;"function"==typeof r&&r("event",e,t)}function u(e){c("sign_up",{method:e})}function d(){c("login",{method:"password"})}},54436:function(e,t,r){"use strict";r.d(t,{b:function(){return a}});var o=r(60902),n=r(98788),i=r(69146);async function a(){{var e,t;let{getSession:o}=await Promise.resolve().then(r.t.bind(r,30998,23)),n=await o();return null!==(t=null==n?void 0:null===(e=n.user)||void 0===e?void 0:e.token)&&void 0!==t?t:null}}r(20357).env.NEXTAUTH_SECRET,(0,o.Z)({name:"Credentials",credentials:{email:{label:"Email",type:"text"},password:{label:"Password",type:"password"}},async authorize(e,t){try{var r,o,a,s;if(console.log("NextAuth authorize called with:",{email:null==e?void 0:e.email,hasPassword:!!(null==e?void 0:e.password)}),!(null==e?void 0:e.email)||!(null==e?void 0:e.password))return console.log("Missing credentials"),null;let t=(0,n.b)();console.log("Attempting API login at:","".concat(t,"auth/login"));let l=await i.e.login({email:null==e?void 0:e.email,password:null==e?void 0:e.password});if(console.log("API login response:",{success:!!l.user,userRole:null===(o=l.user)||void 0===o?void 0:null===(r=o.role)||void 0===r?void 0:r.name}),!l.user)return console.log("No user in response"),null;return(null===(a=l.user.role)||void 0===a?void 0:a.name)==="THERAPIST"&&(null===(s=l.user.role)||void 0===s?void 0:s.status)==="PENDING"&&(l.user.pendingStatus=!0,console.log("Therapist with PENDING status login attempt")),console.log("Login successful, returning user"),l.user}catch(e){return console.error("Error logging in:",e),e instanceof Error&&console.error("Error details:",e.message,e.stack),null}}})},98788:function(e,t,r){"use strict";r.d(t,{b:function(){return n}});var o=r(20357);function n(){let e=(o.env.API_URL||"https://api.everhealth.ai/api").trim();return e?e.replace(/\/+$/,""):(console.error("[getApiBaseUrl] No API_URL / NEXT_PUBLIC_API_URL set â backend calls will fail."),"http://localhost:4000/api")}}},function(e){e.O(0,[733,8087,3417,1936,998,6498,4373,7017,2484,3742,8421,6588,4317,3122,3357,8625,5705,7701,
11818,5892,3556,7149,7138,8028,5064,7880,2971,7023,1744],function(){return e(e.s=33382)}),_N_E=e.O()}]);
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.