import{r as g,j as e,u as E,aI as A,c as $,aJ as k,aK as _,v as L,aL as B,a2 as w,aM as F,aN as N,aO as R,aP as M}from"./index-DAC_nvu_.js";import{g as O,a as P,b as D,c as H,d as W,e as V}from"./selectors-BzGTQ3YA.js";import{S as q}from"./SearchBar-Dc7XFObO.js";import{B as z}from"./BreadcrumbNav-CEt_qco_.js";import{S as G}from"./Skeleton-B9qjVT1Z.js";import{S as J}from"./plus_icon-nnEyrxG2.js";import{S as K}from"./close_icon-white-D_v-eEIO.js";import{S as Q}from"./arrow_icon-Cwhu6PSR.js";import{S as U}from"./arrow_icon-right-black-DuzSSLn6.js";import{E as X}from"./ErrorTooltip-CSGzOk8l.js";import{s as r}from"./blogPage.module-BGz_ymqn.js";import{a as Y,c as Z,e as ee,p as se,s as ae,b as te}from"./skills_icon-DNdLw3P0.js";const ne="_container_v8y63_1",oe="_card_v8y63_8",ce="_nav_v8y63_18",re="_navItem_v8y63_25",le="_navItemContent_v8y63_41",ie="_closeIcon_v8y63_51",de="_plusIcon_v8y63_55",ge="_active_v8y63_59",me="_icon_v8y63_63",he="_label_v8y63_69",ve="_categoryChevron_v8y63_74",ue="_cardTags_v8y63_84",_e="_tagsList_v8y63_91",xe="_tagItem_v8y63_97",pe="_tagSelected_v8y63_111",be="_expandButton_v8y63_121",ye="_expandIcon_v8y63_132",Ie="_rotated_v8y63_138",fe="_categoryChevronRotated_v8y63_148",Ce="_fallbackFirst_v8y63_175",je="_cardCategoriesExpanded_v8y63_182",t={container:ne,card:oe,nav:ce,navItem:re,navItemContent:le,closeIcon:ie,plusIcon:de,active:ge,icon:me,label:he,categoryChevron:ve,cardTags:ue,tagsList:_e,tagItem:xe,tagSelected:pe,expandButton:be,expandIcon:ye,rotated:Ie,categoryChevronRotated:fe,fallbackFirst:Ce,cardCategoriesExpanded:je},Se=({categories:c,activeCategory:l,onCategoryChange:n,tags:o,selectedTags:y,onTagToggle:m,isLoading:x=!1})=>{const[i,I]=g.useState(!1),[h,v]=g.useState(!1),u=6,f=i?o:o.slice(0,u),C=[110,85,130,90,120,100],p=x&&o.length===0,b=c.some(a=>a.id===l),j=a=>{var s;window.innerWidth<=768?a===l||!b&&a===((s=c[0])==null?void 0:s.id)?v(!h):(n(a),v(!1)):n(a)};return e.jsxs("aside",{className:t.container,children:[e.jsx("div",{className:`${t.card} ${h?t.cardCategoriesExpanded:""}`,children:e.jsx("nav",{className:t.nav,children:c.map((a,s)=>{const d=l===a.id,S=!b&&s===0,T=d||S;return e.jsxs("button",{type:"button",onClick:()=>j(a.id),className:`${t.navItem} ${d?t.active:""} ${S?t.fallbackFirst:""}`,children:[e.jsxs("div",{className:t.navItemContent,children:[a.icon&&e.jsx("img",{src:a.icon,alt:"",className:t.icon}),e.jsx("span",{className:`body-1 ${t.label}`,children:a.label})]}),T&&e.jsx(U,{className:`${t.categoryChevron} ${h?t.categoryChevronRotated:""}`})]},a.id)})})}),(o.length>0||p)&&e.jsxs("div",{className:t.cardTags,children:[e.jsx("div",{className:t.tagsList,children:p?e.jsx(e.Fragment,{children:C.map((a,s)=>e.jsx(G,{width:a,height:38,style:{borderRadius:"32px"}},s))}):e.jsx(e.Fragment,{children:f.map(a=>{const s=y.includes(a.id);return e.jsxs("button",{type:"button",onClick:()=>m(a.id),className:`body-3 ${t.tagItem} ${s?t.tagSelected:""}`,children:[a.label,s?e.jsx(K,{className:t.closeIcon}):e.jsx(J,{className:t.plusIcon})]},a.id)})})}),!p&&o.length>u&&e.jsxs("button",{className:t.expandButton,onClick:()=>I(!i),children:[e.jsx("span",{className:`body-1 ${t.expandText}`,children:i?"Свернуть":"Развернуть"}),e.jsx(Q,{className:`${t.expandIcon} ${i?t.rotated:""}`})]})]})]})},Ne=[{id:"all",label:"Р’СЃРµ категории",icon:Y},{id:"career",label:"Карьера Рё работа",icon:Z},{id:"training",label:"Обучение Рё траектории",icon:ee},{id:"hiring",label:"Найм Рё команды",icon:se},{id:"research",label:"Рсследования",icon:ae},{id:"skills",label:"Навыки Рё развитие",icon:te}],Pe=()=>{E();const c=A(),l=$(),n=k("/blog/:id"),o=_(O),y=_(P),m=_(D),x=_(H),i=_(W),I=_(V),[h,v]=g.useState(o.search),u=L(h,400);g.useEffect(()=>{m.length===0&&c(B())},[c,m.length]),g.useEffect(()=>{v(o.search)},[o.search]);const f=g.useMemo(()=>{if(u.trim().length<2)return[];const s=u.toLowerCase();return m.filter(d=>d.title.toLowerCase().includes(s)).slice(0,6).map(d=>({label:d.title,value:d.title}))},[u,m]),C=s=>{c(N(s)),n&&l("/blog")},p=s=>{v(s.label),c(N(s.label)),n&&l("/blog")},b=s=>{c(M(s)),n&&l("/blog")},j=s=>{c(R(s)),n&&l("/blog")},a=g.useMemo(()=>{if(!n)return[];const s=[{label:"Р’СЃРµ статьи",href:"/blog"}];return i?[...s,{label:e.jsx(w,{size:"small"}),isCurrent:!0}]:x?[...s,{label:x.title,isCurrent:!0}]:s},[x,n,i]);return e.jsxs("div",{className:r.pageContainer,children:[!n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:r.pageHeader,children:[e.jsx("h1",{className:r.pageHeaderTitle,children:"Блог Рѕ карьере, работе Рё развитии"}),e.jsx("p",{className:`${r.pageHeaderText} body-1`,children:"Профессиональная среда размышления РІРѕРєСЂСѓРі карьеры Рё работы. Разборы, исследования, практики."})]}),e.jsx("div",{className:r.searchContainer,children:e.jsx(q,{placeholder:"РџРѕРёСЃРє РїРѕ статьям",type:"forward",filter:"none",value:h,suggestions:f,onInputValueChange:v,onSearch:C,onSuggestionSelect:p,allowClear:!0})})]}),n&&e.jsx("div",{children:e.jsx(z,{className:r.blogBreadcrumbNav,items:a,mobile:!0})}),e.jsxs("div",{className:`${r.layout} ${n?r.articleMode:""}`,children:[e.jsx("main",{className:r.mainCol,children:I&&!n?e.jsx("div",{children:e.jsx(X,{title:"Ошибка загрузки",message:"РќРµ удалось загрузить СЃРїРёСЃРѕРє статей. Попробуйте обновить страницу."})}):e.jsx(F,{})}),e.jsx("aside",{className:r.asideCol,children:e.jsx(Se,{categories:Ne,activeCategory:o.category,onCategoryChange:b,tags:y,selectedTags:o.tags,onTagToggle:j,isLoading:i})})]})]})};export{Pe as BlogPage};