1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4391],{4391:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>N});var s=a(95155),l=a(12115),r=a(56929),i=a(88907),n=a(80095),o=a(39200),c=a(84014),d=a(50467),u=a(44382),m=a(79436),p=a(12097);a(26907);var h=a(53878),g=a(30518),v=a(73520),f=a(69784);a(25434),a(91034);var x=a(99759);a(98060);let b=(0,r.default)(()=>Promise.all([a.e(2320),a.e(7125),a.e(576)]).then(a.bind(a,70576)),{loadableGenerated:{webpack:()=>[require.resolveWeak("../components/otpCommon")]},ssr:!1}),y=(0,r.default)(()=>Promise.all([a.e(6613),a.e(2238)]).then(a.bind(a,2238)),{loadableGenerated:{webpack:()=>[require.resolveWeak("../loading")]},ssr:!1}),S=(0,r.default)(()=>Promise.all([a.e(5327),a.e(3792),a.e(3351),a.e(9451),a.e(4897),a.e(9809),a.e(1444),a.e(2150),a.e(2651),a.e(6961),a.e(4911)]).then(a.bind(a,89566)),{loadableGenerated:{webpack:()=>[require.resolveWeak("../helper/common/commonDropDown")]},ssr:!1}),j=(0,r.default)(()=>Promise.all([a.e(3792),a.e(9451),a.e(9809),a.e(3444)]).then(a.bind(a,48846)),{loadableGenerated:{webpack:()=>[require.resolveWeak("@mui/material/Checkbox")]},ssr:!1}),_=(0,r.default)(()=>Promise.all([a.e(4813),a.e(3792),a.e(3351),a.e(9451),a.e(4897),a.e(9809),a.e(1444),a.e(2150),a.e(8427),a.e(859),a.e(7822)]).then(a.bind(a,11729)),{loadableGenerated:{webpack:()=>[require.resolveWeak("../common/countryPicker")]}}),N=e=>{var t;let{setSign:a,setOpen:r}=e,N=l.useRef(null),[I,k]=(0,l.useState)(""),[w,C]=(0,l.useState)(""),[A,D]=(0,l.useState)(""),[E,P]=(0,l.useState)(""),[O,R]=(0,l.useState)(""),[U,W]=(0,l.useState)([]),[q,L]=(0,l.useState)(!1),[T,G]=(0,l.useState)(null),[M,B]=(0,l.useState)(null),[F,K]=(0,l.useState)(!1),[H,z]=(0,l.useState)(!1),[J,V]=(0,l.useState)(""),[Y,Z]=(0,l.useState)({}),[$,Q]=(0,l.useState)(null),[X,ee]=(0,l.useState)(!1),[et,ea]=(0,l.useState)(""),[es,el]=(0,l.useState)(!1),[er,ei]=(0,l.useState)(""),[en,eo]=(0,l.useState)(!1),[ec,ed]=(0,l.useState)(""),[eu,em]=(0,l.useState)(""),[ep,eh]=(0,l.useState)(""),[eg,ev]=(0,l.useState)(""),[ef,ex]=(0,l.useState)(""),[eb,ey]=(0,l.useState)([]),[eS,ej]=(0,l.useState)(""),e_=x.find(e=>"+91"===e.dial_code),[eN,eI]=(0,l.useState)(e_),[ek,ew]=(0,l.useState)(59),eC=(null==(t=localStorage)?void 0:t.getItem("institution"))||"medsy",[eA,eD]=(0,l.useState)([{name:"",email:"",uid:"",linkedin_id:""}]),[eE,eP]=(0,l.useState)(""),eO=(0,o.useRouter)(),eR=(0,o.useSearchParams)().get("test"),eU=(0,o.usePathname)(),eW=new v.HF;new v.Dt,new v.sk;let[eq,eL]=(0,l.useState)(""),eT=(e=>{if(!e||!e.code)return"UNKNOWN";let t=e.code;return"IN"===t?"IND":t})(eN);(0,l.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get("referral_code");e&&ev(e)},[]);let eG=e=>(null==e?void 0:e.dial_code)?e.dial_code:"",eM=e=>{e.target.value=e.target.value.replace(/[^A-Za-z ]/g,"");let t=e.target.value||"";" "!==t[0]&&t.length<=25&&C(t),!/^[A-Za-z ]+$/.test(t)||""===t.trim()||t.trim().length<3?P("Required !"):P("")},eB=e=>{let t;ej(""),(t=e?e.target.value:"")&&""!==t?t&&R(""):R("Required !"),V(t)},eF=async e=>{e.preventDefault();try{if(!A&&!E&&!O&&w&&I&&eN&&J&&eS){let e;K(!0),Z({username:w,phone:I,course:J,year:eS}),e=eg?{phone:I,country_code:eG(eN),refered_by:eg}:eR&&"true"===eR?{phone:I,country_code:eG(eN),test:!0}:{phone:I,country_code:eG(eN)};let t=await (0,g.Af)(e),a=await t.json();t.ok?(null==a?void 0:a.userexists)||(null==a?void 0:a.already_linked)?(eo(!0),ex(""),ew(59)):(L(!0),ei("whatsapp"),ew((null==a?void 0:a.remaining_seconds)||59)):(null==a?void 0:a.referral_code)||(ex("Invalid Code!"),eo(!1),ew(59))}else(!w||E)&&eM(),(!J||O)&&eB(),I&&(0,h.isValidPhoneNumber)(I)&&!A||handlePhoneChange(I)}catch(e){return e}finally{K(!1)}},eK=async(e,t)=>{e.preventDefault(),K(!0);try{var a;let e=await (0,v.df)(f.k,t);console.log("result",e);let s=e.user;localStorage.setItem("sso_uid",s.uid),localStorage.setItem("sso_email",s.email||""),localStorage.setItem("sso_name",s.displayName||""),localStorage.setItem("sso_method",t instanceof v.HF?"google":t instanceof v.sk?"facebook":"github"),G(s);let l=t instanceof v.HF?"google":t instanceof v.sk?"facebook":"github";ea(l);let r={uid:s.uid,email:s.email,login_method:l},i=await (0,g.Ab)(r),n=await i.json();if(null==(a=n[0])?void 0:a.token){let{token:e,username:t,course:a,institution:s,role:l,university:r}=n[0],i=(null==s?void 0:s[0])||"medsy";if(c.A.set("token",e),localStorage.setItem("token",e),localStorage.setItem("course",a),localStorage.setItem("name",JSON.stringify(t)),localStorage.setItem("institution",i),localStorage.setItem("role",l),"superadmin"===l){localStorage.setItem("universityArray",JSON.stringify(r)),localStorage.setItem("institutionArray",JSON.stringify(s)),window.location.href="/universities";return}eO.replace("/".concat(i,"/dashboard"));return}N.current=l,eV(l,s)}catch(e){console.log("Google signup/login error:",e)}finally{K(!1)}},eH=async()=>{K(!0);try{let e=await (0,g.S9)(),t=await e.json();return W(t),t}catch(e){return e}finally{K(!1)}},ez=async e=>{try{let t=await (0,g.ki)(e),a=await t.json();return ey(a),a}catch(e){return e}finally{}};(0,l.useEffect)(()=>{eH()},[]),(0,l.useEffect)(()=>{J&&ez(J)},[J]);let eJ=async e=>{try{var t,a,s,l,i;K(!0);let n=await (0,g.JF)(e),o=await n.json();if(n.ok||(null==(t=o[0])?void 0:t.token)){let e=null==(a=o[0])?void 0:a.token,t=null==(s=o[0])?void 0:s.username,n=null==(l=o[0])?void 0:l.course,d=null==(i=o[0])?void 0:i.newuser;eU.includes("/signUp")?(localStorage.setItem("token",e),localStorage.setItem("course",n),localStorage.setItem("newuser",d),localStorage.setItem("name",JSON.stringify(t))):(c.A.set("token",e),c.A.set("course",n),c.A.set("newuser",d),c.A.set("name",JSON.stringify(t))),eU.includes("/learn")?(r(!1),window.location.reload()):eO.push("/".concat(eC,"/dashboard")).then(()=>{window.location.reload()})}return K(!1),o}catch(e){return e}finally{K(!1)}},eV=(e,t)=>{var a,s,l,r;ee(!0),ei(e),ea(e),C(t.displayName||(null==t||null==(s=t.providerData)||null==(a=s[0])?void 0:a.displayName)||""),B(t.email||(null==t||null==(r=t.providerData)||null==(l=r[0])?void 0:l.email)||"".concat(t.uid,"@facebook.com")),eD([{email:t.email,name:t.displayName,uid:t.uid,profile:t.photoURL}])},eY=async e=>{e.preventDefault();try{J&&"Select"!==J&&w?eJ({username:w,phone_no:I,course:J,login_method:"whatsapp"}):(w||P("Required !"),J&&"Select"!==J||R("Required !"))}catch(e){return e}finally{K(!1)}},eZ=async()=>{var e,t,a,s;let l=er||localStorage.getItem("sso_method"),r=(null==eA||null==(e=eA[0])?void 0:e.uid)||localStorage.getItem("sso_uid"),i=M||localStorage.getItem("sso_email");if(!r||!l)return void console.log("Missing SSO data after OTP");let n={username:w,email:i,uid:r,phone_no:I,country_code:eG(eN),phone_country:eT,course:J,year:eS,login_method:l,...eg&&{refered_by:eg}},o=await (0,g._1)(n),c=await o.json();if(null==c||null==(t=c[0])?void 0:t.token){let e=c[0];if(localStorage.setItem("token",e.token),localStorage.setItem("course",e.course),localStorage.setItem("name",JSON.stringify(e.username)),localStorage.setItem("institution",(null==(a=e.institution)?void 0:a[0])||"medsy"),localStorage.setItem("role",e.role),localStorage.removeItem("sso_uid"),localStorage.removeItem("sso_email"),localStorage.removeItem("sso_name"),localStorage.removeItem("sso_method"),"superadmin"===e.role){window.location.href="/universities";return}window.location.href="/".concat((null==(s=e.institution)?void 0:s[0])||"medsy","/dashboard")}};(0,l.useEffect)(()=>{T&&(C((null==T?void 0:T.providerData[0].displayName)||(null==T?void 0:T.displayName)),B((null==T?void 0:T.providerData[0].email)||(null==T?void 0:T.email)),eD([{email:(null==T?void 0:T.providerData[0].email)||T.email,name:(null==T?void 0:T.providerData[0].displayName)||T.displayName,uid:T.uid,profile:T.photoURL||(null==T?void 0:T.providerData[0].photoURL)}]))},[T]),(0,l.useEffect)(()=>{$&&L(!0)},[$]),(0,l.useEffect)(()=>{let e=localStorage.getItem("number");e&&(k(e),el(!0),localStorage.removeItem("number"))},[]),(0,l.useEffect)(()=>{let e=localStorage.getItem("sso_method");e&&(ei(e),B(localStorage.getItem("sso_email")||""),C(localStorage.getItem("sso_name")||""),eD([{uid:localStorage.getItem("sso_uid"),email:localStorage.getItem("sso_email"),name:localStorage.getItem("sso_name"),profile:""}]))},[]),(0,l.useEffect)(()=>{let e=localStorage.getItem("sso_uid"),t=localStorage.getItem("sso_email"),a=localStorage.getItem("sso_name"),s=localStorage.getItem("sso_method");e&&s&&(ei(s),ea(s),ee(!0),C(a||""),B(t||""),eD([{uid:e,email:t,name:a,profile:""}]))},[]),(0,l.useEffect)(()=>{var e=c.A.get("create_new");if(e){ea(e);var t=c.A.get("user_data_name"),a=c.A.get("user_data_email");ee(!0),"linkedin"!==e?t&&a&&(C(t),B(a),ee(!0),eD([{name:t,email:a,uid:c.A.get("user_data_uid"),profile:c.A.get("user_data_photo")}])):(C(t),B(a),eD([{name:t,email:a,profile:c.A.get("user_data_photo"),linkedin_id:c.A.get("user_data_linkedin_id")}]))}},[]),(0,l.useEffect)(()=>{k(""),eL(""),eo(!1),ed("")},[eN]);let e$=async e=>{if(e.preventDefault(),!I||eq)return void eL("Mobile number is required");if("facebook"===er&&!M)return void D("Email is required for Facebook signup");let t={phone:I,country_code:eG(eN)},a=await (0,g.Af)(t);if(a.ok){let e=await a.json();L(!0),ew((null==e?void 0:e.remaining_seconds)||59)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"header-medsy-icon",children:(0,s.jsx)("div",{className:"medsy-icon",children:(0,s.jsx)(i.default,{alt:"",src:u.A})})}),(0,s.jsx)("div",{className:"sign-up-main-page d-flex-col",children:q?(0,s.jsx)(b,{sigup:!0,userOtp:$,number:I,countryCode:eG(eN),name:w,selectedCourse:J,loginMethod:er,referralCode:eg,selectedYear:eS,setOpen:r,seconds:ek,setSeconds:ew,onOtpSuccess:eZ,phoneCountry:eT}):(0,s.jsx)("div",{className:"sig-up-container d-flex-col",children:(0,s.jsx)("div",{className:"signup-forms-container",children:(0,s.jsxs)("div",{className:"mobile-sign-up d-flex-col",children:[(0,s.jsxs)("div",{className:"mobile-medsy-icon",children:[(0,s.jsx)(i.default,{alt:"",src:m.A}),(0,s.jsxs)("div",{className:"mobile-medsy-text",children:[(0,s.jsxs)("div",{children:["Medical",(0,s.jsx)("span",{children:" Education"})]}),(0,s.jsxs)("div",{children:["Made",(0,s.jsx)("span",{children:" Easy"})]})]})]}),(0,s.jsx)("p",{className:"sign-up-text",children:"Sign-up"}),(0,s.jsxs)("form",{className:"form-control d-flex-col",onSubmit:X||es?es?eY:e$:eF,children:[(0,s.jsxs)("div",{className:"input-sections",children:[(0,s.jsx)("p",{className:"label-text",children:"Name*"}),(0,s.jsx)("input",{type:"text",value:w,className:"number-input",placeholder:"Enter Name",style:{border:E?"1px solid var(--deleteButtonText)":null},onInput:e=>eM(e)}),(0,s.jsx)("p",{className:"error-text",children:E})]}),X&&(0,s.jsxs)("div",{className:"input-sections",children:[(0,s.jsx)("p",{className:"label-text",children:"Email"}),(0,s.jsx)("input",{type:"email",value:M,className:"number-input",placeholder:"Enter email",readOnly:"google"===er,onChange:e=>{let t=e.target.value;B(t),/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)?D(""):D("Please enter a valid email address")}}),(0,s.jsx)("p",{className:"error-text",children:A})]}),(0,s.jsxs)("div",{className:"input-sections-mobile",children:[(0,s.jsx)("p",{className:"label-text",children:"Mobile Number*"}),(0,s.jsxs)("div",{className:"country-sigup",children:[(0,s.jsx)(_,{defaultCountryCode:null==eN?void 0:eN.dial_co
1de,placeholder:"Enter Mobile Number",onChangeInput:e=>{let t=e.target.value.replace(/\D/g,"");if(!eN)return void k(t);if(!(null==eN?void 0:eN.validation))return;let{minLength:a,maxLength:s}=eN.validation;t.length>s||(k(t),eo(!1),ed(""),eL(((e,t)=>{if(!t||!t.validation)return"Required!";let{validFirstDigits:a,restrictedPrefixes:s,firstDigitError:l,minLength:r,maxLength:i}=t.validation;if(!e)return"Required!";if(e.length<r||e.length>i)return"Phone number must be ".concat(r," digits");if(null==a?void 0:a.length){let t=e.charAt(0);if(!a.includes(t))return l||"Invalid phone number"}if(null==s?void 0:s.length){for(let t of s)if(e.startsWith(t))return"Phone number cannot start with this number"}return""})(t,eN)))},onSelect:eI,selectedValue:eN,inputValue:I,className:"country-sigup",singup:!0}),(0,s.jsx)("p",{className:"error-text",children:eq})]})]}),(0,s.jsxs)("div",{className:"input-sections",children:[(0,s.jsx)("p",{className:"label-text",children:"Course*"}),(0,s.jsx)(S,{options:U,onChange:eB,value:J,name:"course",placeholder:"Select your Course",optionLabelKey:"name",optionValueKey:"key",className:"select-input"}),(0,s.jsx)("p",{className:"error-text",children:O})]}),(0,s.jsxs)("div",{className:"input-sections",children:[(0,s.jsx)("p",{className:"label-text",children:"Year*"}),(0,s.jsx)(S,{options:eb,onChange:e=>{let t;(t=e?e.target.value:"")&&""!==t?t&&eP(""):eP("Required !"),ej(t)},value:eS,name:"year",placeholder:"Please select year",optionLabelKey:"name",optionValueKey:"key",className:"select-input"}),(0,s.jsx)("p",{className:"error-text",children:eE})]}),(0,s.jsxs)("div",{className:"input-sections",children:[(0,s.jsx)("p",{className:"label-text",children:"Referral Code (Optional)"}),(0,s.jsx)("input",{type:"text",value:eg||"",className:"number-input",maxLength:"9",style:{border:ef?"1px solid var(--deleteButtonText)":null},onInput:e=>(e=>{let t;(t=e?e.target.value:"").length<9?(ex("code must contain 9 digits"),eo(!1)):ex(""),ev(t.toUpperCase())})(e)}),(0,s.jsx)("p",{className:"error-text",children:ef})]}),(0,s.jsxs)("div",{className:"checkbox d-flex-al gap-8",children:[(0,s.jsx)(j,{size:"small",checked:H,onChange:()=>{z(e=>!e)},inputProps:{"aria-label":"I agree to the Terms and Conditions"},sx:{"& .MuiSvgIcon-root":{fill:"var(--primaryButtonTextColor)"}}}),(0,s.jsxs)("div",{className:"label-text-terms",children:["I agree to the"," ",(0,s.jsxs)("span",{children:[" ",(0,s.jsxs)(n,{href:"/terms-and-conditions",target:"_blank",children:["Terms & Conditions"," "]})]})]})]}),en&&(0,s.jsx)("div",{className:"error-box",children:"User Already Exists!"}),(0,s.jsx)("div",{className:"sign-up-btn-container",children:(0,s.jsx)("button",{type:"submit",className:"sign-up-btn cursor-ptr",disabled:(!H||!w||!!E||!J||!!O||!I||!!eq||!!A||!!X&&!M)&&!0,style:{backgroundColor:H&&w&&!E&&J&&!O&&eS&&I&&!eq&&!A&&(!X||M)?"var(--primaryButtonTextColor)":"var(--background-color)",color:H&&w&&!E&&J&&eS&&!O&&I&&!eq&&!A&&(!X||M)?"var(--background-color)":"var(--secondaryTextColor)"},children:(0,s.jsxs)("div",{className:"sign-up-btn-text d-flex",children:[(0,s.jsx)("span",{children:(0,s.jsx)(i.default,{alt:"",src:p.A})}),(0,s.jsx)("span",{children:"Get OTP via Whatsapp"})]})})})]}),(0,s.jsx)("div",{className:"sign-in-navigation-div",children:(0,s.jsxs)("div",{className:"new-to-medsy",children:["Already have an account?"," ",(0,s.jsxs)("span",{children:[" ",(0,s.jsx)(n,{href:"/signIn",children:"Login"})]})]})}),(0,s.jsxs)("div",{className:"signup-sso",children:[(0,s.jsx)("div",{className:"sign-up-other-login",children:(0,s.jsx)("p",{children:"Or"})}),(0,s.jsx)("div",{className:"sign-in-sso-login",children:(0,s.jsx)("button",{className:"email-sign-in-btn cursor-ptr",onClick:e=>eK(e,eW),children:(0,s.jsx)(i.default,{src:d.A,alt:"email",height:25,width:24})})}),(0,s.jsxs)("div",{className:"sign-in-terms-conditions",children:["By signing Up, you agree to",(0,s.jsxs)("span",{children:[" ",(0,s.jsxs)(n,{href:"/terms-and-conditions",target:"_blank",children:[" ","Terms & Conditions"," "]})]})," ","and",(0,s.jsxs)("span",{children:[" ",(0,s.jsx)(n,{href:"/privacy-policy",target:"_blank",children:"Privacy Policy"})]})," ","of Medsy.Ai"]})]})]})})})}),F&&(0,s.jsx)(y,{})]})}},12097:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s={src:"/_next/static/media/whatappLogo.85025e81.svg",height:22,width:22,blurWidth:0,blurHeight:0}},25434:()=>{},26907:()=>{},44382:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s={src:"/_next/static/media/medsyLogin.eaf3a15c.svg",height:575,width:306,blurWidth:0,blurHeight:0}},50467:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s={src:"/_next/static/media/emailGoogleLogo.3ae2df20.svg",height:25,width:24,blurWidth:0,blurHeight:0}},55298:(e,t,a)=>{"use strict";a.d(t,{Wp:()=>s.Wp});var s=a(23378);(0,s.KO)("firebase","11.10.0","app")},69784:(e,t,a)=>{"use strict";a.d(t,{k:()=>r});var s=a(73520);let l=(0,a(55298).Wp)({apiKey:"AIzaSyA5d58SW192q0d6i7OzG-oPY75K1jDHx5A",authDomain:"medsyai.firebaseapp.com",projectId:"medsyai",storageBucket:"medsyai.firebasestorage.app",messagingSenderId:"597947567694",appId:"1:597947567694:web:25e51b332ca4b99276fd1f",measurementId:"G-MZYTK8P95G"}),r=(0,s.xI)(l)},79436:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s={src:"/_next/static/media/mobileMedsyIcon.1230743a.svg",height:112,width:142,blurWidth:0,blurHeight:0}},84014:(e,t,a)=>{"use strict";function s(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)"__proto__"!==s&&(e[s]=a[s])}return e}a.d(t,{A:()=>l});var l=function e(t,a){function l(e,l,r){if("undefined"!=typeof document){"number"==typeof(r=s({},a,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decode
vendor: 1,018 bytes, line 1
1URIComponent).replace(/[()]/g,escape);var i="";for(var n in r)r[n]&&(i+="; "+n,!0!==r[n]&&(i+="="+r[n].split(";")[0]));return document.cookie=e+"="+t.write(l,e)+i}}return Object.create({set:l,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var a=document.cookie?document.cookie.split("; "):[],s={},l=0;l<a.length;l++){var r=a[l].split("="),i=r.slice(1).join("=");try{var n=decodeURIComponent(r[0]);if(n in s||(s[n]=t.read(i,n)),e===n)break}catch(e){}}return e?s[e]:s}},remove:function(e,t){l(e,"",s({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,s({},this.attributes,t))},withConverter:function(t){return e(s({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(a)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})}}]);
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.