1import{c as y,a as j,b as v,aV as k,aK as C,be as X,r as c,fZ as fe,j as e,B as L,cu as be,eC as ge,bf as h,g9 as ye,dJ as je,N as ve,bP as Ne,bi as Z,fF as O,ga as _e,bz as Se,gb as ke,bx as Ce,bv as we,bw as Ae,am as Pe}from"./main-DmDsGTCr.js";import{u as Ee}from"./useSuspenseQuery-DJyxosyP.js";import{a as Ie,b as Te,c as Oe}from"./PageHeader-BybPPbxT.js";import{B as Re}from"./BecomeMemberButton-BvNe_a0M.js";import{h as De}from"./star-review-Bf1Qa_LE.js";import{t as S}from"./product-events-DE71XA68.js";import{u as Fe}from"./use-membership-Bx2DwdPj.js";import{u as J}from"./useMutation-BXaTcy4a.js";import{S as G}from"./switch-C9fo2Gdy.js";import{u as le}from"./use-feature-flag-C9iVprKR.js";import{b as M,c as Le,P as Me,a as Qe}from"./profile-card-BtR4SrlK.js";import{m as Ke,M as qe}from"./MailReplyModal-D3oZJ15u.js";import{m as Be,d as $e,a as N,s as Ue,S as Ye}from"./StandardAnswersFields-DCxSOh0y.js";import{C as ce}from"./check-7NZig2Tr.js";import{M as ee}from"./mail-C39XquGB.js";import{T as ze}from"./triangle-alert-C4NPl7AO.js";import{C as Ve}from"./copy-Dpj_eCG9.js";import{b as te,d as Je,A as Ge,c as He,u as We,e as Xe,s as Ze}from"./useSaveStandardAnswer-CwHXXTeu.js";import{W as et}from"./wallet-CLVbttkT.js";import{u as tt}from"./use-track-component-viewed-YUSuVzA1.js";import{A as st}from"./anchors-CdYSl11c.js";import"./paywall-context-FiGeElF6.js";import"./lock-CGVUhhnO.js";import"./payload-validation-C-pMPr5Y.js";import"./index-B2BwbHwT.js";import"./DualArcSpinner-D4HRp4ig.js";import"./dialog-CHuX4MUN.js";import"./index-H3pqt8Mq.js";import"./index-BT86mV_3.js";import"./textarea-DJtBLUuE.js";import"./send-DKb2GXmz.js";import"./standard-questions-CVX3_8hm.js";const at=y({method:"POST"}).middleware([j]).handler(v("5aa9685ae910814b4f66cfe1c33297d54e9d8f66cae27d9ee4e8dc714546223c"));y({method:"POST"}).middleware([j]).handler(v("119588876fcd4ee59b519cd39c40e724f07157e8882299e4000c4a41de8efc98"));function rt(t,s,a){if(!t)return t;const r=t.experiences.map(i=>({...i,bullets:i.bullets.map(o=>o.id===s?{...o,...a}:o)}));return{...t,experiences:r}}function nt(){const t=k(),s=C(X()),a=c.useRef(new Set);c.useEffect(()=>{const r=s.data;if(!r)return;const i=r.experiences.flatMap(o=>o.bullets).filter(De);for(const o of i)a.current.has(o.id)||(a.current.add(o.id),at({data:{kind:"base",bulletId:o.id}}).then(n=>{n.updated&&Object.keys(n.patch).length>0&&t.setQueryData(X().queryKey,m=>rt(m,o.id,n.patch))}).catch(n=>{fe(n,{operation:"star_extraction",bulletId:o.id})}).finally(()=>{a.current.delete(o.id)}))},[s.data,t])}const se="<!-- dial-in:v1 -->",ae="<!-- /dial-in:v1 -->",it={focus:"Focus",work_mode:"Work mode",volume:"Volume"};Object.fromEntries(Object.entries(it).map(([t,s])=>[s.toLowerCase(),t]));function ot(t){const s=t.indexOf(se);if(s===-1)return null;const a=s+se.length,r=t.indexOf(ae,a);return r===-1?null:{start:s,bodyStart:a,end:r+ae.length}}function lt(t){const s=ot(t);return s?`${t.slice(0,s.start)}${t.slice(s.end)}`:t}const ct=["alumni-by-company"],dt=["connections-network"];function U(t,s){s==="school"&&t.setQueryData(ct,{}),t.invalidateQueries({queryKey:dt})}function de({switchId:t,label:s,description:a,tone:r="bordered",testId:i,children:o}){return e.jsxs("div",{className:`mt-4 flex items-center justify-between gap-3 rounded-lg px-3 py-2.5 ${r==="raised"?"bg-surface-raised":"border border-hairline"}`,"data-testid":i,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{htmlFor:t,className:"block text-sm font-medium text-text-strong",children:s}),e.jsx("p",{className:"mt-0.5 text-xs text-text-muted",children:a})]}),o]})}const ut={confirmation:"Application received",needs_reply:"Needs a reply",interview_invite:"Interview invite",scheduling:"Scheduling",assessment_request:"Assessment",rejection:"Update",offer:"Offer",recruiter_outreach:"Recruiter outreach",noise:"Other"};function mt(t){const s=new Date(t);return Number.isNaN(s.getTime())?"":s.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function pt({signal:t,onOpen:s}){return e.jsx("li",{className:"rounded-lg border border-hairline bg-surface-raised px-3 py-2.5","data-testid":"inbox-signal-row",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-hairline px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-text-muted",children:ut[t.label]??"Update"}),e.jsx("span",{className:"truncate text-sm font-medium text-text-strong",children:t.companyName??"An employer"}),e.jsx("span",{className:"text-xs text-text-muted",children:mt(t.receivedAt)})]}),t.summary&&e.jsxs("div",{className:"mt-1 text-[12.5px] leading-[1.5] text-text-muted",children:[t.summary,e.jsx("span",{className:"ml-1.5 text-[10.5px] italic",children:t.summaryLabel})]})]}),e.jsxs(L,{type:"button",variant:t.canDraftReply?"agent-outline":"outline",size:"sm",onClick:s,"data-testid":"open-signal-button","data-amp-track-surface":"inbox","data-amp-track-action":"open_signal","data-amp-track-target":"mail_signal",children:[t.canDraftReply&&e.jsx(be,{}),t.canDraftReply?"Review AI reply":"Open"]})]})})}function ht(){const{data:t}=C(Ke()),[s,a]=c.useState(null),r=t??[];return r.length===0?null:e.jsxs("div",{className:"mb-4","data-testid":"inbox-signals-list",children:[e.jsx("div",{className:"mb-2 text-[10.5px] font-bold uppercase tracking-[0.1em] text-text-muted",children:"Replies"}),e.jsx("ul",{className:"space-y-2",children:r.map(i=>e.jsx(pt,{signal:i,onOpen:()=>a(i.id)},i.id))}),s&&e.jsx(qe,{signalId:s,entry:"profile",onClose:()=>a(null)})]})}const re="mail-disconnect",xt="mail-apply-preference",ft=["Employer replies land in your tracker and on Today","An interview invite can move that application forward for you","Replies are drafted for you â nothing sends until you approve it"];function ne({enabled:t}){const s=k(),a=c.useId(),r=J({mutationFn:Ue,onMutate:async i=>{await s.cancelQueries({queryKey:N});const o=s.getQueryData(N);return o&&s.setQueryData(N,{...o,useForApplications:i}),{prior:o}},onError:(i,o,n)=>{n?.prior&&s.setQueryData(N,n.prior),h.error("Couldn't save that â the setting is unchanged.",{id:xt})},onSuccess:(i,o)=>{S("profile_preference_saved",{source:"profile",field:"apply_with_provisioned_email",value:o?"yes":"no"})},onSettled:()=>{s.invalidateQueries({queryKey:N})}});return e.jsx(de,{switchId:a,label:"Use this address when I apply",description:"Autofill and Apply for me put it on your applications instead of your personal email.",testId:"apply-address-preference",children:e.jsx(G,{id:a,checked:t,disabled:r.isPending,onCheckedChange:i=>r.mutate(i),"data-testid":"apply-address-switch","data-amp-track-surface":"profile","data-amp-track-action":"apply_address_toggle","data-amp-track-target":"apply_address_switch"})})}function R(t){const s=new Date(t);return Number.isNaN(s.getTime())?"":s.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function bt({address:t}){const[s,a]=c.useState(!1);return e.jsxs(L,{type:"button",variant:"outline",size:"sm","data-testid":"copy-mail-address-button",onClick:async()=>{try{await navigator.clipboard.writeText(t),a(!0),setTimeout(()=>a(!1),2e3)}catch{h.error("Could not copy â select the address and copy it.")}},children:[s?e.jsx(ce,{}):e.jsx(Ve,{}),s?"Copied":"Copy"]})}function gt(){const t=le(ge)==="on",s=k(),{data:a,isPending:r}=C({...Be(),enabled:t}),i=J({mutationFn:$e,onSuccess:()=>{s.invalidateQueries({queryKey:N}),h.success("Email disconnected",{id:re})},onError:()=>{h.error("Could not disconnect. Also remove Chegg at myaccount.google.com/permissions.",{id:re})}});if(!t)return null;const o=a?.accounts??[],n=o.find(u=>u.provider==="chegg")??null,m=o.filter(u=>u.provider!=="chegg");return e.jsxs("section",{className:`mb-6 ${M}`,"data-testid":"connected-mail-section",children:[e.jsx("div",{className:"text-sm font-semibold text-text-strong",children:"Application email"}),n?.address?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-1 max-w-[52ch] text-xs leading-normal text-text-muted",children:"Put it on your applications as your email."}),e.jsx("ul",{className:"mt-2 space-y-1","data-testid":"mailbox-benefits",children:ft.map(u=>e.jsxs("li",{className:"flex items-start gap-1.5 text-xs text-text-muted",children:[e.jsx(ce,{"aria-hidden":!0,
1className:"mt-0.5 size-3.5 shrink-0 text-success"}),e.jsx("span",{children:u})]},u))}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3 rounded-lg border border-hairline bg-surface-raised px-3 py-2.5","data-testid":"provisioned-mail-card",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{className:"size-3.5 shrink-0 text-text-muted"}),e.jsx("span",{className:"truncate text-sm font-medium text-text-strong","data-testid":"provisioned-mail-address",children:n.address})]}),e.jsxs("div",{className:"mt-0.5 pl-[1.375rem] text-xs text-text-muted",children:["Created ",R(n.connectedAt),n.lastSyncAt?` · last checked ${R(n.lastSyncAt)}`:" · waiting for its first reply"]})]}),e.jsx(bt,{address:n.address})]}),e.jsx(ne,{enabled:a?.useForApplications!==!1}),e.jsx(ht,{})]}):r?e.jsx("p",{className:"mt-1 text-xs leading-normal text-text-muted","data-testid":"provisioned-mail-loading",children:"Checking your application emailâ¦"}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-1 max-w-[52ch] text-xs leading-normal text-text-muted","data-testid":"provisioned-mail-empty",children:"Your address is created the first time you apply â nothing to set up."}),a?.canProvision?e.jsx(ne,{enabled:a.useForApplications!==!1}):null]}),m.length>0&&e.jsx("ul",{className:"mt-4 space-y-2","data-testid":"connected-mail-list",children:m.map(u=>e.jsxs("li",{className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border border-hairline bg-surface-raised px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{className:"size-3.5 shrink-0 text-text-muted"}),e.jsx("span",{className:"truncate text-sm font-medium text-text-strong",children:u.addressMask})]}),e.jsxs("div",{className:"mt-0.5 pl-[1.375rem] text-xs text-text-muted",children:["Connected ",R(u.connectedAt),u.lastSyncAt?` · last checked ${R(u.lastSyncAt)}`:" · not checked yet"]}),u.hasSyncError&&e.jsxs("div",{className:"mt-1 flex items-center gap-1.5 pl-[1.375rem] text-xs text-text-muted",children:[e.jsx(ze,{className:"size-3.5 shrink-0"}),e.jsx("span",{children:"We lost access to this mailbox. Disconnecting is safe â your new application address does not depend on it."})]})]}),e.jsx(L,{type:"button",variant:"outline",size:"sm",disabled:i.isPending,onClick:()=>i.mutate(u.id),"data-testid":"disconnect-legacy-mail-button",children:i.isPending?"Disconnectingâ¦":"Disconnect"})]},u.id))})]})}function yt(){const t=k(),{data:s}=C(te()),a=te().queryKey,r=c.useCallback((i,o)=>{const n=o.trim(),m=n.length===0?null:n;t.setQueryData(a,x=>x&&{...x,[i]:m});const u=Je({data:{[i]:m}});return h.promise(u,{id:`apply-profile-${i}`,loading:"Savingâ¦",success:"Saved.",error:"Couldn't save. Try again."}),u},[t,a]);return e.jsx("div",{className:"flex flex-col gap-3.5",children:Ge.map(i=>{const o=s?.[i.key]??"";return e.jsxs("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[minmax(0,1fr)_240px] sm:items-center sm:gap-4",children:[e.jsx("span",{className:"text-[14.5px] text-text-muted",children:i.label}),e.jsx("div",{className:"sm:w-full",children:e.jsx("input",{type:i.type,defaultValue:o,placeholder:i.placeholder??"â",onBlur:n=>{n.target.value.trim()!==o&&r(i.key,n.target.value)},className:"w-full rounded-md border border-hairline bg-surface-white px-2.5 py-1.5 text-[13px] text-text-strong focus:outline-none focus:ring-2 focus:ring-purple","data-testid":`apply-profile-${i.key}`,"data-amp-track-surface":"auto_apply","data-amp-track-action":"confirm_detail","data-amp-track-field":i.key})})]},i.key)})})}function jt(){const t=le(ye)==="on",{data:s={}}=C({...He(),enabled:t}),a=We("profile");return t?e.jsxs("section",{className:`mb-6 ${M}`,"data-testid":"application-answers-section",children:[e.jsx("div",{className:"mb-1 text-[10.5px] font-bold uppercase tracking-[0.1em] text-text-muted",children:"Application details"}),e.jsx("p",{className:"mb-3.5 max-w-[60ch] text-[12.5px] leading-[1.5] text-text-muted",children:"Confirm these once and Chegg fills them in for you on every application â no more retyping the same details and questions on each form."}),e.jsx("div",{className:"mb-2 text-[10.5px] font-semibold uppercase tracking-[0.08em] text-text-muted",children:"Your details"}),e.jsx(yt,{}),e.jsx("div",{className:"mt-5 mb-2 border-hairline border-t pt-4 text-[10.5px] font-semibold uppercase tracking-[0.08em] text-text-muted",children:"Questions most applications ask"}),e.jsx(Ye,{keys:Xe,answers:s,onCommit:a})]}):null}const vt=y({method:"GET"}).middleware([j]).handler(v("6e4a1d046f7f91d3abb650e3dc9c2c22eb46dba3d904a4ef98ab01c6f639a02b")),Nt=y({method:"POST"}).middleware([j]).handler(v("8d4f349c0cbf5be8d1ac9634f420ea3d4ff8e572c868010054ccb58dd4d51f87")),_t=y({method:"POST"}).middleware([j]).handler(v("b2bcfd83b94d5f1bed0391bb060882ef60822148ad34075dab886d4a86a150e5")),St=y({method:"POST"}).middleware([j]).handler(v("bba2d21400f6a88c02c26ab59c3d483303ce02167c5f75a8fa6eb002b8ce7198")),kt=y({method:"POST"}).middleware([j]).handler(v("18c8ea812433d8fdc59d2b1da0e791294af89d106c8aee5f151e02fc80675040"));function Ct(t){const s=[{text:t.roleText,strong:!0},{text:" internships",strong:!1}];return t.placeText&&(s.push({text:" in ",strong:!1}),s.push({text:t.placeText,strong:!0})),t.remote&&s.push({text:", remote",strong:!1}),s}const _=["job-alert-searches"],wt=()=>je({queryKey:_,queryFn:()=>vt(),staleTime:3e4}),At="job-alerts-save",P="max-w-[52ch] text-xs leading-normal text-text-muted";function D(t,s){S("profile_preference_saved",{source:"profile",field:t,value:s})}function ie({onRetry:t}){return e.jsx("button",{type:"button",className:"font-semibold text-purple hover:underline",onClick:t,"data-amp-track-surface":"profile","data-amp-track-action":"job_alert_list_retry","data-amp-track-target":"job_alert_retry_button",children:"Try again"})}function F(t){const s=k();return J({mutationFn:t.mutationFn,onMutate:async a=>{await s.cancelQueries({queryKey:_});const r=s.getQueryData(_);return r&&t.patch&&s.setQueryData(_,t.patch(r,a)),{prior:r}},onError:(a,r,i)=>{i?.prior&&s.setQueryData(_,i.prior),h.error(t.errorMessage,{id:At})},onSuccess:t.onSuccess,onSettled:()=>{s.invalidateQueries({queryKey:_})}})}function Pt({search:t,onRemoved:s}){const a=c.useId(),r=ve(),i=F({mutationFn:n=>Nt({data:{searchKey:t.searchKey,muted:n}}),errorMessage:"Couldn't save that. The setting is unchanged.",patch:(n,m)=>({...n,searches:n.searches.map(u=>u.searchKey===t.searchKey?{...u,muted:m}:u)}),onSuccess:({changed:n},m)=>{n&&D("search_alert_muted",m?"yes":"no")}}),o=F({mutationFn:n=>_t({data:n}),errorMessage:"Couldn't remove that search. It is still listed.",patch:n=>({...n,searches:n.searches.filter(m=>m.searchKey!==t.searchKey)}),onSuccess:({priorMuted:n,changed:m})=>{m&&(D("search_alert_dismissed","yes"),s(t,n))}});return e.jsxs("li",{className:"flex items-center justify-between gap-3 border-hairline border-b py-3 last:border-0 last:pb-1","data-testid":"job-alert-search-row",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("button",{type:"button",id:a,className:`block text-left text-sm leading-snug hover:underline ${t.muted?"text-text-muted":"text-text"}`,"data-amp-mask":!0,"data-amp-track-surface":"profile","data-amp-track-action":"job_alert_search_open","data-amp-track-target":"job_alert_search_sentence",onClick:()=>{r({to:Ne,search:{roles:t.searchRoles.join(","),...t.searchLocations.length>0?{locations:t.searchLocations.join(",")}:{}}})},children:Ct({roleText:t.roleText,placeText:t.placeText,remote:t.remote}).map((n,m)=>n.strong?e.jsx("span",{className:"font-semibold text-text-strong",children:n.text},m):e.jsx(c.Fragment,{children:n.text},m))}),e.jsxs("div",{className:"mt-0.5 text-xs text-text-muted",children:[e.jsx("span",{children:t.muted?"Alerts off":t.lastSearchedLabel}
1),e.jsx("span",{"aria-hidden":!0,className:"mx-1",children:"·"}),e.jsx("button",{type:"button",className:"font-semibold text-purple hover:underline","aria-describedby":a,disabled:o.isPending,onClick:()=>o.mutate({searchKey:t.searchKey}),"data-amp-track-surface":"profile","data-amp-track-action":"job_alert_search_remove","data-amp-track-target":"job_alert_remove_button",children:"Remove"})]})]}),e.jsx(G,{checked:!t.muted,disabled:i.isPending,onCheckedChange:n=>i.mutate(!n),"aria-label":"Alerts","aria-describedby":a,"data-amp-track-surface":"profile","data-amp-track-action":"job_alert_search_toggle","data-amp-track-target":"job_alert_search_switch"})]})}function Et(){const t=c.useId(),{data:s,isPending:a,isError:r,refetch:i}=C(wt()),o=r&&s===void 0,n=a||o,m=F({mutationFn:p=>kt({data:{enabled:p}}),errorMessage:"Couldn't save that. The setting is unchanged.",patch:(p,g)=>({...p,enabled:g}),onSuccess:({changed:p},g)=>{p&&D("new_listing_alerts_enabled",g?"yes":"no")}}),x=F({mutationFn:p=>St({data:p}),errorMessage:"Couldn't undo that. The search is still removed.",onSuccess:({changed:p})=>{p&&D("search_alert_dismissed","no")}}).mutate,I=c.useCallback((p,g)=>{h(e.jsxs("span",{children:["Removed ",e.jsx("span",{"data-amp-mask":!0,children:p.label}),"."]}),{action:{label:"Undo",onClick:()=>x({searchKey:p.searchKey,muted:g})}})},[x]),b=s?.enabled!==!1,w=s?.searches??[];return e.jsxs("section",{className:`mb-6 ${M}`,"data-testid":"job-alerts-section",children:[e.jsx("div",{className:"text-sm font-semibold text-text-strong",children:"Job alerts"}),e.jsx("p",{className:`mt-1 ${P}`,children:a?"Checking your job alertsâ¦":o?"Couldn't read your job alert settings.":b?"Chegg watches the searches below and tells you when a new internship is a good fit.":"Job alerts are off. Your searches are kept."}),o?e.jsxs("p",{className:`mt-3 ${P}`,"data-testid":"job-alerts-error",children:["Couldn't load your job alerts."," ",e.jsx(ie,{onRetry:()=>{i()}})]}):a?e.jsx("p",{className:`mt-3 ${P}`,"data-testid":"job-alerts-loading",children:"Checking your job alertsâ¦"}):w.length===0?e.jsx("p",{className:`mt-3 ${P}`,"data-testid":"job-alerts-empty",children:"Nothing here yet. Run a search that names a role and Chegg will watch it for new internships."}):e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"mt-3","data-testid":"job-alert-search-list",children:w.map(p=>e.jsx(Pt,{search:p,onRemoved:I},p.searchKey))}),r?e.jsxs("p",{className:`mt-3 ${P}`,"data-testid":"job-alerts-refresh-error",children:["Couldn't refresh. ",e.jsx(ie,{onRetry:()=>{i()}})]}):null]}),e.jsx(de,{switchId:t,label:"Turn off all job alerts",description:"Keeps your searches; Chegg just stops alerting.",tone:"raised",testId:"job-alerts-master",children:e.jsx(G,{id:t,checked:!n&&!b,disabled:n||m.isPending,onCheckedChange:p=>m.mutate(!p),"data-testid":"job-alerts-master-switch","data-amp-track-surface":"profile","data-amp-track-action":"job_alert_master_toggle","data-amp-track-target":"job_alert_master_switch"})})]})}function It(t){return t.enumValues?{}:{"data-amp-mask":""}}function Tt(t){return[{label:"Interests",values:t.interests},{label:"Skills",values:t.skills},{label:"Classes",values:t.classesTaken},{label:"Roles",values:t.internshipPreferences.roles,enumValues:!0},{label:"Locations",values:t.internshipPreferences.locations,enumValues:!0},{label:"Target companies",values:t.internshipPreferences.companies},{label:"Industries",values:t.internshipPreferences.industries,enumValues:!0},{label:"Work modes",values:t.internshipPreferences.workModes,enumValues:!0},{label:"Pay floor",values:t.internshipPreferences.payFloor?[t.internshipPreferences.payFloor]:[],enumValues:!0},{label:"Experience",values:t.experienceHighlights},{label:"Graduation",values:t.graduationDate?[t.graduationDate]:[]},{label:"Personal context",values:t.personalContext}].filter(s=>s.values.length>0)}const oe=3,z=M,V=Le,Y="profile-save-sponsorship",Ot=[{value:"yes",label:"Yes"},{value:"no",label:"No"},{value:"unsure",label:"Unsure"}];function Rt(t){return["inline-block cursor-pointer rounded-md border px-3 py-1 text-xs","peer-focus-visible:ring-2 peer-focus-visible:ring-purple",t?"border-purple bg-purple-04 font-semibold text-text-strong":"border-hairline font-medium text-text-muted hover:bg-purple-04"].join(" ")}function E({label:t,children:s}){return e.jsxs("div",{className:"flex items-center gap-3 border-hairline border-b py-1.5 text-[12.5px] last:border-0",children:[e.jsx("span",{className:"shrink-0 text-text-muted",children:t}),e.jsx("b",{className:"min-w-0 flex-1 text-right font-semibold text-text-strong",children:s})]})}function Dt(){const{isMember:t,tier:s}=Fe();return e.jsxs("section",{className:`mb-6 ${z}`,"data-testid":"profile-membership-section",children:[e.jsx("div",{className:`mb-2.5 ${V}`,children:"Membership"}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold text-text-strong",children:Ce[s]}),e.jsx("p",{className:"mt-0.5 text-[12.5px] text-text-muted",children:t?"Manage billing, change your plan, or cancel anytime.":"Become a member to unlock personalized matching, resume tailoring, and more."})]}),t?e.jsx(L,{asChild:!0,variant:"outline",size:"sm",children:e.jsxs("a",{"data-testid":"profile-manage-subscription-link",...Pe
1({surface:"profile"}),children:[e.jsx(et,{className:"size-4"}),we,e.jsx(Ae,{className:"size-3.5 text-text-muted"})]})}):e.jsx(Re,{feature:"profile_membership"})]})]})}function Ft(){nt();const{data:t}=Ee(Z()),s=k(),a=Z().queryKey,r=t,i=t?.memory_notes??"",o=c.useId(),n=c.useId(),m=c.useId(),u=c.useId(),[x,I]=c.useState(r?.school??""),[b,w]=c.useState(r?.major??""),[p,g]=c.useState(r?.minor??""),Q=c.useRef(!1),K=c.useRef(!1),q=c.useRef(!1),[B,ue]=c.useState(!1);c.useEffect(()=>{Q.current||I(r?.school??"")},[r?.school]),c.useEffect(()=>{K.current||w(r?.major??"")},[r?.major]),c.useEffect(()=>{q.current||g(r?.minor??"")},[r?.minor]);const me=c.useCallback(()=>{if(Q.current=!1,x!==(r?.school??"")){s.setQueryData(a,d=>d&&{...d,school:x});const l=O({data:{school:x}});h.promise(l,{id:"profile-save-school",loading:"Saving schoolâ¦",success:"Saved school.",error:"Couldn't save school. Try again."}),l.then(()=>{s.invalidateQueries({queryKey:a}),U(s,"school")},()=>{}),S("profile_field_saved",{source:"profile",field:"school"})}},[x,r?.school,s,a]),pe=c.useCallback(()=>{if(K.current=!1,b!==(r?.major??"")){s.setQueryData(a,d=>d&&{...d,major:b});const l=O({data:{major:b}});h.promise(l,{id:"profile-save-major",loading:"Saving majorâ¦",success:"Saved major.",error:"Couldn't save major. Try again."}),l.then(()=>{s.invalidateQueries({queryKey:a}),U(s,"major")},()=>{}),S("profile_field_saved",{source:"profile",field:"major"})}},[b,r?.major,s,a]),he=c.useCallback(()=>{if(q.current=!1,p!==(r?.minor??"")){s.setQueryData(a,d=>d&&{...d,minor:p});const l=O({data:{minor:p}});h.promise(l,{id:"profile-save-minor",loading:"Saving minorâ¦",success:"Saved minor.",error:"Couldn't save minor. Try again."}),l.then(()=>{s.invalidateQueries({queryKey:a}),U(s,"minor")},()=>{}),S("profile_field_saved",{source:"profile",field:"minor"})}},[p,r?.minor,s,a]),$=c.useRef(0),H=c.useRef(t?.requires_sponsorship??null),xe=c.useCallback(l=>{if(l===(r?.requires_sponsorship??null))return;const d=++$.current,T=H.current;s.cancelQueries({queryKey:a}),s.setQueryData(a,f=>f&&{...f,requires_sponsorship:l}),h.loading("Saving sponsorshipâ¦",{id:Y}),O({data:{requiresSponsorship:l}}).then(()=>{H.current=l,s.invalidateQueries({queryKey:a}),s.invalidateQueries({queryKey:Ze}),$.current===d&&(h.success("Saved sponsorship.",{id:Y}),S("profile_preference_saved",{source:"profile",field:"requires_sponsorship",value:l}))},()=>{$.current===d&&(h.error("Couldn't save sponsorship. Try again.",{id:Y}),s.setQueryData(a,f=>f&&{...f,requires_sponsorship:T}),s.invalidateQueries({queryKey:a}))})},[r?.requires_sponsorship,s,a]),W=c.useMemo(()=>{const l=_e(lt(i)),d=t?.memory_profile??Se;return ke(l,{graduationDate:d.graduationDate??void 0,interests:d.interests,skills:d.skills,classesTaken:d.classesTaken,internshipPreferences:{roles:d.internshipPreferences.roles,locations:d.internshipPreferences.locations,industries:d.internshipPreferences.industries,workModes:d.internshipPreferences.workModes,companies:d.internshipPreferences.companies,payFloor:d.internshipPreferences.payFloor??void 0},experienceHighlights:d.experienceHighlights,personalContext:d.personalContext})},[t?.memory_profile,i]),A=c.useMemo(()=>Tt(W),[W]);return r?e.jsxs("div",{className:"flex min-h-full flex-col",children:[e.jsx(Ie,{children:"Profile"}),e.jsxs(Te,{className:"pt-2 pb-6",children:[e.jsx(Oe,{className:"mb-1.5",children:"What Chegg knows about you."}),e.jsx("p",{className:"mb-5 max-w-[62ch] text-[14px] leading-[1.55] text-text",children:"Keep this current so recommendations and drafts stay specific."}),e.jsx("div",{className:"mb-6 grid grid-cols-1 gap-3.5 md:grid-cols-1",children:e.jsxs("section",{className:z,children:[e.jsx("div",{className:`mb-2.5 ${V}`,children:"Identity"}),e.jsx(E,{label:"Name",children:r.name??"â"}),e.jsx(E,{label:"Email",children:r.email??"â"}),e.jsxs(E,{label:"School",children:[e.jsx("label",{htmlFor:o,className:"sr-only",children:"School"}),e.jsx("input",{id:o,value:x,onChange:l=>{Q.current=!0,I(l.target.value)},onBlur:me,className:"w-full bg-transparent text-right font-semibold text-text-strong focus:outline-none focus:ring-2 focus:ring-purple","data-amp-track-surface":"profile","data-amp-track-action":"edit","data-amp-track-field":"school"})]}),e.jsxs(E,{label:"Major",children:[e.jsx("label",{htmlFor:n,className:"sr-only",children:"Major"}),e.jsx("input",{id:n,value:b,onChange:l=>{K.current=!0,w(l.target.value)},onBlur:pe,className:"w-full bg-transparent text-right font-semibold text-text-strong focus:outline-none focus:ring-2 focus:ring-purple","data-amp-track-surface":"profile","data-amp-track-action":"edit","data-amp-track-field":"major"})]}),e.jsxs(E,{label:"Minor",children:[e.jsx("label",{htmlFor:m,className:"sr-only",children:"Minor"}),e.jsx("input",{id:m,value:p,onChange:l=>{q.current=!0,g(l.target.value)},onBlur:he,placeholder:"â",className:"w-full bg-transparent text-right font-semibold text-text-strong placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-purple","data-amp-track-surface":"profile","data-amp-track-action":"edit","data-amp-track-field":"minor"})]}),e.jsxs("fieldset",{className:"mt-3 flex flex-col gap-2 border-hairline border-b pb-1.5 last:border-0 last:pb-0",children:[e.jsx("legend",{id:u,className:"mb-2 text-[12.5px] text-text-muted",children:"Need visa sponsorship for U.S. internships?"}),e.jsx("div",{role:"radiogroup","aria-labelledby":u,className:"flex gap-1.5",children:Ot.map(({value:l,label:d})=>{const T=r.requires_sponsorship===l,f=`${u}-${l}`;return e.jsxs("span",{children:[e.jsx("input",{type:"radio",id:f,name:u,value:l,checked:T,onChange:()=>xe(l),className:"peer sr-only","data-testid":`pref-sponsorship-${l}`,"data-amp-track-surface":"profile","data-amp-track-action":"save_preference","data-amp-track-field":"requires_sponsorship","data-amp-track-state":l}),e.jsx("label",{htmlFor:f,className:Rt(T),children:d})]},l)})})]})]})}),e.jsx(Dt,{}),e.jsx(jt,{}),e.jsx(gt,{}),e.jsx(Et,{}),A.length>0&&e.jsxs("section",{className:`mb-6 ${z}`,"data-testid":"profile-signals-section",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[e.jsx("div",{className:V,children:"Profile signals"}),A.length>
1oe&&e.jsx("button",{type:"button",onClick:()=>ue(l=>!l),"aria-expanded":B,"data-testid":"profile-signals-toggle",className:Me,children:B?"Show less":`Show all (${A.length})`})]}),e.jsx("div",{className:"grid grid-cols-[110px_1fr] gap-x-4 gap-y-2.5",children:(B?A:A.slice(0,oe)).map(l=>e.jsxs(c.Fragment,{children:[e.jsx("div",{className:"pt-0.5 text-[10.5px] font-semibold uppercase tracking-[0.08em] text-text-muted",children:l.label}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:l.values.map(d=>e.jsx("span",{className:Qe,...It(l),children:e.jsx("span",{className:"truncate",children:d})},`${l.label}-${d}`))})]},l.label))})]})]})]}):null}function xs(){const t=tt("ProfileTab",{surface:"profile"});return e.jsx("div",{ref:t,"data-testid":"tab-panel-profile","data-anchor":st.tabProfile,className:"h-full",children:e.jsx(Ft,{})})}export{xs as component};
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.