import{a as e,n as t,t as n}from"./jsx-runtime-CutOxEx1.js";import{l as r,r as i}from"./chunk-6CSD65Y2-BjfinoX-.js";import{a,n as o,o as s,r as c,s as l,t as u}from"./runtimeTheme-Cf77mCZn.js";import{r as d}from"./authSession-Dulxhbeq.js";var f=e(t(),1),p=n(),m=[{to:`/tools/resume-heatmap`,label:`AI求职`},{to:`/business`,label:`AI招聘`}],h=({variant:e=`cream`,centerSlot:t,rightSlot:n,hideCta:h=!1,hideThemeToggle:g=!1,openLinksInNewTab:_=!1})=>{let v=c(),y=r(),[b,x]=(0,f.useState)(`light`),[S,C]=(0,f.useState)(`light`),[w,T]=(0,f.useState)(!1),[E,D]=(0,f.useState)(`unknown`);(0,f.useEffect)(()=>{let e=a(),t=u(e);C(e),x(t);let n=l(({mode:e,theme:t})=>{C(e),x(t)});return()=>n()},[]),(0,f.useEffect)(()=>{let e=!1,t=async()=>{try{let t=await d();if(!e){let e=!!t?.token;T(e),D(e?String(t?.user?.identityRole||`unknown`):`unknown`)}}catch{e||(T(!1),D(`unknown`))}};t();let n=e=>{String(e?.key||``)===`offer_lens_auth_session_v1`&&t()},r=()=>{t()};return window.addEventListener(`storage`,n),window.addEventListener(`AUTH_SESSION_UPDATED_WEB`,r),window.addEventListener(`focus`,r),window.addEventListener(`pageshow`,r),()=>{e=!0,window.removeEventListener(`storage`,n),window.removeEventListener(`AUTH_SESSION_UPDATED_WEB`,r),window.removeEventListener(`focus`,r),window.removeEventListener(`pageshow`,r)}},[]);let O=()=>{if(v){x(`light`),C(`light`),u(`light`);return}let e=s(o(S));C(e.mode),x(e.theme)},k=()=>{if(w){window.open(`/me`,`_blank`,`noopener,noreferrer`);return}y(`/auth`)},A=`site-header site-header--${e}`,j=w&&E===`recruiter`;return(0,p.jsx)(`header`,{className:A,"aria-label":`主导航`,children:(0,p.jsxs)(`div`,{className:`site-header-inner`,children:[_?(0,p.jsx)(`a`,{className:`site-header-logo`,href:`/`,target:`_blank`,rel:`noopener noreferrer`,children:(0,p.jsxs)(`span`,{className:`site-header-wordmark`,children:[`职引 `,(0,p.jsx)(`em`,{children:`HireEdge`})]})}):(0,p.jsx)(i,{className:`site-header-logo`,to:`/`,children:(0,p.jsxs)(`span`,{className:`site-header-wordmark`,children:[`职引 `,(0,p.jsx)(`em`,{children:`HireEdge`})]})}),t?(0,p.jsx)(`div`,{className:`site-header-center`,children:t}):null,(0,p.jsxs)(`div`,{className:`site-header-links`,children:[m.map(e=>_?(0,p.jsx)(`a`,{href:e.to,target:`_blank`,rel:`noopener noreferrer`,children:e.label},e.to):(0,p.jsx)(i,{to:e.to,children:e.label},e.to)),n,!h&&j?_?(0,p.jsx)(`a`,{className:`site-header-cta site-header-workbench`,href:`/hr`,target:`_blank`,rel:`noopener noreferrer`,children:`HR工作台`}):(0,p.jsx)(i,{className:`site-header-cta site-header-workbench`,to:`/hr`,children:`HR工作台`}):null,h?null:(0,p.jsx)(`button`,{type:`button`,className:`site-header-cta`,onClick:k,children:w?`用户中心`:`注册 / 登录`}),!g&&!v?(0,p.jsx)(`button`,{type:`button`,className:`site-header-theme`,onClick:O,"aria-label":b===`dark`?`切换到浅色主题`:`切换到深色主题`,"aria-pressed":b===`dark`,children:(0,p.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,children:[(0,p.jsx)(`path`,{d:`M9 21h6`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`}),(0,p.jsx)(`path`,{d:`M10 17h4`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`}),(0,p.jsx)(`path`,{d:`M12 2a7 7 0 0 0-4 12c.6.5 1 1.2 1.1 2h5.8c.1-.8.5-1.5 1.1-2A7 7 0 0 0 12 2Z`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinejoin:`round`})]})}):null]})]})})};export{h as t};