1import{r as s,j as t,L as ot,e as Je,u as at,i as it}from"./react-vendor-zfhxSVDm.js";import{S as ke}from"./skeleton-C0_sVelb.js";import{g as lt}from"./groupImage-u-SDYXHN.js";import{c as ct}from"./imageThumbs-B8jHQgqV.js";import{G as Ee,g as Ne,a as ut,b as dt}from"./groupConstants-PDs7t9hY.js";import{s as $e,C as Fe,a as mt,u as Be,b as Ie,c as pt,d as ft,I as ht,l as bt,e as _,r as gt,g as Ce,m as xt}from"./index-BV0-2aDl.js";import{H as z,a as ae}from"./HomeJobsSection-DVdRST2e.js";import{u as yt,H as Ae,a as Ue,b as jt}from"./useEndlessTrigger-B5k33DzW.js";import{E as Ge}from"./EventCard-HKBTjq7Z.js";import{C as De}from"./CourseCard-idJn-HOn.js";import{L as wt}from"./lightbulb-DORjwZtU.js";import{S as Te}from"./send-CNsMpYOM.js";import{g as ye,a as St,b as vt,c as _t}from"./jobsService-DxZhVRTW.js";import{b as kt,h as Et,J as Nt}from"./filterJobs-C1jj_qIv.js";import{E as Ct}from"./ErrorCard-Cb-8uOfJ.js";import{u as Tt}from"./useSurveyFeed-DVNPjtPd.js";import{g as Rt,a as Lt,b as Pt}from"./homePageService-D_deg9i5.js";import{g as Ot}from"./coursesService-DIwZWpd4.js";import{c as Mt}from"./contentViews-PjccoFGo.js";import{p as Jt}from"./design-BFzSJeXH.js";import"./supabase-vendor-DqO-ystM.js";import"./ui-vendor-DS2gWKbO.js";import"./animation-vendor-DuSTuolt.js";import"./dedupeCardImages-ClSpsP0-.js";import"./JobRailCard-HgzWx1uQ.js";import"./ThreeBandCard-B7U6-c0l.js";import"./jobCardHelpers-BSRlqQ_4.js";import"./namedDay-C32HNmBp.js";import"./jobValidUntil--RUMSZUD.js";import"./date-DhoqQ65y.js";import"./date-vendor-DEheAXb3.js";import"./TeaserCard-D5yL11fm.js";import"./eye-jjFD0sxf.js";import"./play-DoO3SBf8.js";import"./pause-B032eWcv.js";import"./SeekerPostCard-C0ehKC-9.js";import"./campaignsService-TF9ozaAF.js";import"./ListFilterBar-VAfsnyxu.js";import"./select-C0KLRRB0.js";import"./ShareButton-g8BhoStb.js";import"./shortLinksService-Rv3Tfxr1.js";import"./share-2-BWE_HBO-.js";import"./copy-D68MLBv-.js";import"./message-circle-DYvwzFmS.js";import"./circle-alert-kCrBuxxG.js";import"./arrow-right-DrRnfN_u.js";const $t=async(o,a=10)=>{const{data:l,error:x}=await $e.rpc("find_recommended_jobs_for_candidate",{p_user_id:o,p_limit:a});if(x)throw x;return l||[]},Ft=new Set(["recruiters"]);function Bt({groups:o,jobCounts:a={},isLoading:l=!1}){const x=s.useRef(null),[j,w]=s.useState({start:!0,end:!1}),T=s.useMemo(()=>{const p=(Array.isArray(o)?o:[]).filter(i=>i?.is_internal&&i.slug&&i.slug!=="main"&&!Ft.has(i.slug)).map(i=>({group:i,count:a[i.id]||0})).filter(i=>i.count>0).sort((i,R)=>{const L=Ee.indexOf(Ne(i.group.name)),g=Ee.indexOf(Ne(R.group.name));return L!==g?(L===-1?99:L)-(g===-1?99:g):R.count-i.count}),y=(Array.isArray(o)?o:[]).find(i=>i?.is_internal&&i.slug==="main");return y&&p.unshift({group:y,count:null}),p},[o,a]),S=s.useCallback(()=>{const p=x.current;if(!p)return;const y=Math.abs(p.scrollLeft),i=p.scrollWidth-p.clientWidth;w({start:y>4,end:y<i-4})},[]);if(s.useEffect(()=>{const p=x.current;if(p)return S(),p.addEventListener("scroll",S,{passive:!0}),window.addEventListener("resize",S),()=>{p.removeEventListener("scroll",S),window.removeEventListener("resize",S)}},[S,T.length,l]),l)return t.jsx("div",{className:"flex gap-4 overflow-hidden py-1",children:Array(9).fill(0).map((p,y)=>t.jsxs("div",{className:"flex w-20 shrink-0 flex-col items-center gap-1.5",children:[t.jsx(ke,{className:"h-20 w-20 rounded-full"}),t.jsx(ke,{className:"h-3 w-14 rounded"})]},y))});if(T.length===0)return null;const J=p=>{const y=x.current;y&&y.scrollBy({left:p*Math.round(y.clientWidth*.6),behavior:"smooth"})};return t.jsxs("div",{className:"relative",children:[t.jsx("nav",{ref:x,"aria-label":"××§××צ×ת ש×× ×",className:"hide-scrollbar flex items-start gap-4 overflow-x-auto px-1 py-1",children:T.map(({group:p})=>{const y=ut[p.name]||"from-brand-navy to-brand-navy-light",i=p.slug==="main",R=i?"/assets/dark-logo.png":lt(p);return t.jsxs(ot,{to:`/groups/${p.slug}`,className:"group/tile flex w-20 shrink-0 flex-col items-center gap-1.5 text-center",children:[t.jsx("span",{className:`block h-20 w-20 overflow-hidden rounded-full bg-gradient-to-br shadow-sm ring-2 ring-white transition-transform group-hover/tile:scale-105 ${y}`,children:R&&t.jsx("img",{src:i?R:ct(R,{width:320,quality:60}),alt:"",loading:"lazy",className:`h-full w-full object-cover ${i?"":"scale-[1.65]"}`})}),t.jsx("span",{className:"w-full text-xs font-bold leading-tight text-slate-700 line-clamp-2 transition-colors group-hover/tile:text-brand-navy",children:dt(p.name)})]}
1,p.id)})}),j.start&&t.jsx("button",{type:"button","aria-label":"×××ר×",onClick:()=>J(1),className:"absolute start-0 top-10 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full border border-slate-200 bg-white/95 text-slate-600 shadow-md transition-colors hover:text-brand-navy",children:t.jsx(Fe,{className:"h-4 w-4"})}),j.end&&t.jsx("button",{type:"button","aria-label":"×¢×× ×§××צ×ת",onClick:()=>J(-1),className:"absolute end-0 top-10 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full border border-slate-200 bg-white/95 text-slate-600 shadow-md transition-colors hover:text-brand-navy",children:t.jsx(mt,{className:"h-4 w-4"})})]})}const Re=[{key:"register",roles:[],title:"ר××¦× ×ש××ר ×שר×ת ×××¢×§×× ×××¨× ×××ש×ת?",action:"××רש×× ×××פש/ת ×¢××××",to:"/register"},{key:"recruiter",roles:["recruiter"],title:"××××ס/ת? ×× ×××§×× ××¤×¨×¡× ×שר×",action:"×פרס×× ×שר×",openType:"job"},{key:"seeker",roles:["candidate"],title:"××פש/ת ×¢××××? ×× ×××§×× ×פרס×",action:"×פרס×× ××פ×ש ×¢××××",openType:"job_seeker_post"},{key:"expert-content",roles:["expert"],title:"×××××/×ת? ×× ×××§×× ××¤×¨×¡× ×ª××× ×קצ××¢×",action:"×פרס×× ×ª×××",openType:"content"},{key:"experts",roles:[],title:"×××¢×¥/ת קר××ר×? ×× ×××§×× ×פת×× ×¤×¨×פ××",action:"×פר×פ×× ×××××",to:"/register"}],He=o=>o?Re.filter(a=>a.roles.includes(o)):Re;function It({index:o=0}){const a=Je(),{currentUser:l}=Be(),{openCreateModal:x}=Ie(),j=He(l?.main_role||null),w=j[o%j.length];if(!w?.title||!w?.action)return null;const T=()=>{if(w.openType){x(w.openType);return}a(w.to)};return t.jsxs("button",{type:"button",onClick:T,"aria-label":`${w.title} ${w.action}`,className:"feed-cta group mt-4 flex w-full cursor-pointer flex-col items-start gap-4 roun
1ded-2xl bg-brand-navy p-5 text-start transition-colors hover:bg-brand-navy-light md:flex-row md:items-center md:justify-center md:gap-6 md:p-6",children:[t.jsx("span",{className:"text-base font-extrabold text-white md:text-lg",children:w.title}),t.jsx("span",{className:"shrink-0 whitespace-nowrap rounded-lg bg-brand-amber px-5 py-2.5 text-sm font-extrabold text-brand-navy transition-colors group-hover:bg-brand-amber/90",children:w.action})]})}function je({fact:o}){return o?t.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-brand-navy/15 bg-brand-navy/5 px-4 py-3",children:[t.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 rounded-full bg-brand-navy px-2.5 py-0.5 text-[11px] font-bold text-white",children:[t.jsx(wt,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"×××עת?"]}),t.jsx("span",{className:"min-w-0 flex-1 text-sm font-semibold text-brand-navy",children:o})]}):null}const At=o=>Array.isArray(o)?o:[];function Ve({question:o,canGoBack:a=!1,disabled:l=!1,onSubmit:x,onSkip:j,onBack:w}){const T=o?.question_type,[S,J]=s.useState([]),[p,y]=s.useState("");if(s.useEffect(()=>{J([]),y("")},[o?.question_id]),!o)return null;const i=At(o.options),R=g=>`rounded-full border px-3 py-1.5 text-xs font-semibold transition-colors ${g?"border-brand-navy bg-brand-navy text-white":"border-brand-amber/50 bg-white text-brand-navy hover:border-brand-navy hover:bg-brand-navy hover:text-white"}`,L=g=>J(k=>k.includes(g)?k.filter(D=>D!==g):[...k,g]);return t.jsxs("div",{className:"rounded-xl border border-brand-amber/40 bg-brand-amber/10 px-4 py-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 rounded-full bg-brand-amber px-2.5 py-0.5 text-[11px] font-bold text-brand-navy",children:[t.jsx(pt,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"× ×©×× ××עת"]}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-bold text-brand-navy",children:o.question_title}),a&&t.jsxs("button",{type:"button",onClick:w,disabled:l,className:"flex shrink-0 items-center gap-0.5 text-[11px] font-semibold text-brand-navy/60 hover:text-brand-navy",children:[t.jsx(Fe,{className:"h-3 w-3"}),"××ר×"]}),t.jsx("button",{type:"button",onClick:j,disabled:l,className:"shrink-0 text-[11px] font-semibold text-brand-navy/60 hover:text-brand-navy",children:"×××××"})]}),t.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[T==="single_choice"&&i.map(g=>t.jsx("button",{type:"button",disabled:l,onClick:()=>x(g),className:R(!1),children:g},g)),T==="multi_choice"&&t.jsxs(t.Fragment,{children:[i.map(g=>{const k=S.includes(g);return t.jsxs("button",{type:"button",disabled:l,"aria-pressed":k,onClick:()=>L(g),className:R(k),children:[k&&t.jsx(ft,{className:"me-1 inline h-3 w-3"}),g]},g)}),S.length>0&&t.jsxs("button",{type:"button",disabled:l,onClick:()=>x(S),className:"flex items-center gap-1 rounded-full bg-brand-navy px-3.5 py-1.5 text-xs font-bold text-white transition-colors hover:bg-brand-navy/90",children:[t.jsx(Te,{className:"h-3 w-3"}),"ש××××"]})]}),(T==="text"||T==="long_text")&&t.jsxs("form",{className:"flex w-full items-center gap-1.5",onSubmit:g=>{g.preventDefault(),p.trim()&&x(p.trim())},children:[t.jsx(ht,{value:p,onChange:g=>y(g.target.value),placeholder:o.question_helper||"×תש××× ×©××...",disabled:l,className:"h-8 flex-1 border-brand-amber/50 bg-white text-sm"}),t.jsxs("button",{type:"submit",disabled:l||!p.trim(),className:"flex items-center gap-1 rounded-full bg-brand-navy px-3.5 py-1.5 text-xs font-bold text-white transition-colors hover:bg-brand-navy/90 disabled:opacity-40",children:[t.jsx(Te,{className:"h-3 w-3"}),"ש××××"]})]})]})]})}const Ut=(o,{limit:a=60,isTestUser:l=!1}={})=>bt(o,{limit:a,isTestUser:l,upcoming:!0}),xe=16,ee=[_.POST,_.EVENT,_.COURSE,_.JOB_SEEKER_POST],Le=new Set(["main","recruiters"]),Gt=2,Pe=600,Oe=3,Dt=["cta","survey","fact"],Me=o=>{const a=[...o];for(let l=a.length-1;l>0;l--){const x=Math.floor(Math.random()*(l+1));[a[l],a[x]]=[a[x],a[l]]}return a};function Ht({groups:o=[],jobCounts:a={},groupsById:l={},userId:x=null,isTestUser:j=!1,excludeJobIds:w=null,excludePostIds:T=null,excludeEventIds:S=null,excludeCourseIds:J=null,excludeSeekerIds:p=null,facts:y=[],survey:i=null,userRole:R=null}){const[L,g]=s.useState([]),[k,D]=s.useState(!1),P=s.useRef({plan:null,index:0,buckets:null,
1shownJobs:new Set,recommended:new Set,loading:!1}),K=s.useRef(()=>{}),N=o.length>0,te=yt({active:N&&!k,onNear:()=>K.current(),margin:Pe}),Y=async()=>{const n=P.current,u=o.filter(f=>f?.is_internal&&f.slug&&!Le.has(f.slug)&&(a[f.id]||0)>0);let d=null,h=[];if(x)try{const f=await $t(x,200);if(f?.length){n.recommended=new Set(f.map(E=>E.id));const v={};for(const E of f)for(const G of E.target_groups||[])v[G]=(v[G]||0)+1;const I=u.filter(E=>v[E.id]>0).sort((E,G)=>v[G.id]-v[E.id]);I.length&&(d=I,h=Me(u.filter(E=>!v[E.id])))}}catch{}d||(d=Me(u),h=[]);const c=[];let m=0,b=0;for(;b<d.length;){const f=1+Math.floor(Math.random()*3);for(let v=0;v<f&&b<d.length;v++)c.push({kind:"jobs",group:d[b++]});b<d.length&&c.push({kind:"break",rotation:m++})}for(const f of h)c.push({kind:"jobs",group:f});n.plan=c,n.index=0},ie=async()=>{const n=P.current;if(n.buckets)return;const u={[_.POST]:T,[_.EVENT]:S,[_.COURSE]:J,[_.JOB_SEEKER_POST]:p},d=await Promise.all(ee.map(c=>Ut(c,{isTestUser:j}).catch(()=>[]))),h={};ee.forEach((c,m)=>{const b=new Map;for(const f of d[m]||[]){if(u[c]?.has(f.id))continue;const v=(f.target_groups||[]).find(I=>{const E=l[I];return E?.is_internal&&E.slug&&!Le.has(E.slug)});v&&(b.has(v)||b.set(v,[]),b.get(v).push(f))}h[c]=b}),n.buckets=h},le=async()=>{const n=P.current;for(;n.index<n.plan.length;){const u=n.plan[n.index++];if(u.kind==="jobs")try{const h=(await ye({limit:xe+8,groupId:u.group.id,isTestUser:j})||[]).filter(m=>!n.shownJobs.has(m.id)&&!w?.has(m.id));n.recommended.size&&h.sort((m,b)=>(n.recommended.has(b.id)?1:0)-(n.recommended.has(m.id)?1:0));const c=h.slice(0,xe);if(!c.length)continue;return c.forEach(m=>n.shownJobs.add(m.id)),{kind:"jobs",group:u.group,items:c,key:`jobs-${u.group.id}`}}catch{continue}await ie();for(let d=0;d<ee.length;d++){const h=ee[(u.rotation+d)%ee.length],c=n.buckets[h];if(!c||c.size===0)continue;let m=null;for(const[v,I]of c)(!m||I.length>c.get(m).length)&&(m=v);const b=l[m],f=c.get(m).slice(0,xe);if(c.delete(m),!(!b||!f.length))return{kind:h,group:b,items:f,key:`${h}-${m}`}}}return null},C=async()=>{const n=P.current;if(!(n.loading||k||!N)){n.loading=!0;try{n.plan||await Y();const u=[];for(;u.length<Gt;){const d=await le();if(!d){D(!0);break}u.push(d)}u.length&&g(d=>[...d,...u])}finally{n.loading=!1}}};if(K.current=C,s.useEffect(()=>{if(k||!N)return;const n=te.current;n&&n.getBoundingClientRect().top<window.innerHeight+Pe&&K.current()},[L,k,N]),!N)return null;const se=(()=>{const n=He(R).length,u={cta:0,fact:0,survey:0},d={cta:()=>u.cta<n,fact:()=>u.fact<y.length,survey:()=>u.survey<1&&!!i?.question},h=new Map,c=Math.floor(L.length/Oe);for(let m=0;m<c;m++){const b=Dt.find(f=>d[f]());if(!b)break;h.set((m+1)*Oe-1,{kind:b,nth:u[b]}),u[b]+=1}return h})(),ce=n=>{const u=se.get(n);if(!u)return null;const{kind:d,nth:h}=u;if(d==="cta")return t.jsx(It,{index:h},`cta-${h}`);if(d==="fact"){const c=y[h];return c?t.jsx("section",{className:"py-2",children:t.jsx(je,{fact:c})},`fact-${h}`):null}return h>0||!i?.question?null:t.jsx("section",{className:"py-2",children:t.jsx(Ve,{question:i.question,canGoBack:i.canGoBack,disabled:i.isLoading,onSubmit:c=>i.submit(i.question,c,"feed"),onSkip:()=>i.skip(i.question,"feed"),onBack:i.goBack})},"survey")};return t.jsxs(t.Fragment,{children:[L.map((n,u)=>{const d=n.group.name,h=`/groups/${n.group.slug}`,c=ce(u),m=b=>c?t.jsxs("div",{children:[b,c]},n.key):b;return n.kind==="jobs"?m(t.jsx(z,{title:`×שר×ת ××§××צת ${d}`,jobs:n.items,moreTo:`${h}?type=job`,groupsById:l},n.key)):n.kind===_.POST?m(t.jsx(Ae,{title:`ת×× ×× ××§××צת ${d}`,posts:n.items,moreTo:`${h}?type=post`,groupsById:l},n.key)):n.kind===_.JOB_SEEKER_POST?m(t.jsx(Ue,{title:`×××¤×©× ×¢×××× ××§××צת ${d}`,posts:n.items,moreTo:`${h}?type=job_seeker`,groupsById:l},n.key)):n.kind===_.EVENT?m(t.jsx(ae,{title:`××ר××¢×× ××§××צת ${d}`,moreTo:`${h}?type=event`,moreLabel:"××× ×××ר××¢××",children:n.items.map((b,f)=>t.jsx(Ge,{event:b,index:f,layout:"rail"},b.id))},n.key)):m(t.jsx(ae,{title:`××שר×ת ××§××צת ${d}`,moreTo:`${h}?type=course`,moreLabel:"××× ×××שר×ת",children:n.items.map((b,f)=>t.jsx(De,{course:b,index:f,layout:"rail"},b.id))},n.key))}),!k&&t.jsx("div",{ref:te,"aria-hidden":"true",className:"h-1"})]})}let oe=null;const Vt=async()=>(oe||(oe=$e.rpc("get_site_facts").then(({data:o,error:a})=>{if(a)throw a;return o||[]}).catch(o=>{throw oe=null,o})),oe),qt=async({axisGroup:o=null}={})=>{try{const a=await Vt(),l=a.filter(j=>!j.scope_group_id);return o?.id?[...a.filter(j=>j.scope_group_id===o.id),...l].map(j=>j.text):l.map(j=>j.text)}catch{return[]}},B=16;function Is(){const o=at(),[a,l]=s.useState({groups:[]}),[x,j]=s.useState(0),[w,T]=s.useState({jobs:null,recruiters:null,groups:null,week:null}),[S,J]=s.useState({}),[p,y]=s.useState([]),[i,R]=s.useState([]),[L,g]=s.useState([]),[k,D]=s.useState([]),[P,
1K]=s.useState(null),[N,te]=s.useState([]),[Y]=s.useState(()=>Math.floor(Math.random()*1e3)),[ie,le]=s.useState([]),[C,se]=s.useState(null),[ce,n]=s.useState([]),[u,d]=s.useState([]),[h,c]=s.useState([]),[m,b]=s.useState([]),[f,v]=s.useState(!0),[I,E]=s.useState(!1),G=Je(),[qe]=it(),ue=qe.get("axis");s.useEffect(()=>{ue&&G(`/groups/${ue}`,{replace:!0})},[ue,G]);const{currentUser:O,isLoadingUser:we}=Be(),$=s.useMemo(()=>kt(new URLSearchParams(o.search)),[o.search]),[de,ze]=s.useState({categories:[],employmentTypes:[],regions:[]});s.useEffect(()=>{St({isTestUser:!!O?.is_test_user}).then(ze).catch(()=>{})},[O?.is_test_user]),s.useEffect(()=>{let e=!0;return Ot({isTestUser:!!O?.is_test_user,limit:B}).then(r=>{e&&c(r||[])}).catch(r=>{e&&c([])}),()=>{e=!1}},[O?.is_test_user]);const[Ke,me]=s.useState([]);s.useEffect(()=>{if(!$.location){me([]);return}let e=!0;return Promise.all(String($.location).split(",").map(r=>r.trim()).filter(Boolean).map(r=>gt(r).catch(()=>[]))).then(r=>{e&&me([...new Set(r.flat())])}).catch(()=>{e&&me([])}),()=>{e=!1}},[$.location]);const F=s.useMemo(()=>Et(new URLSearchParams(o.search)),[o.search]),A=s.useMemo(()=>Object.fromEntries((a.groups||[]).map(e=>[e.id,e])),[a.groups]),W=e=>{const r=ce[e];return!r||F?null:t.jsx(z,{title:`××שר×ת ×©× ${r.name}`,jobs:r.jobs||[],moreTo:`/jobs?organization=${r.organization_id}`,moreLabel:`×× ${Number(r.total).toLocaleString("he-IL")} ××שר×ת`,groupsById:A},r.organization_id)};s.useMemo(()=>(a.groups||[]).find(e=>e?.is_internal&&e.slug==="main")||null,[a.groups]);const Ye=s.useMemo(()=>{const e=(a.groups||[]).reduce((r,H)=>r+(Number(H?.members_count)||0),0);return e>0?e:null},[a.groups]),{openCreateModal:We}=Ie(),M=Tt(),Xe=!we&&O?.main_role==="recruiter",{railSoon:pe,railFresh:X,railViewed:Z,railSalary:fe}=s.useMemo(()=>{const e=U=>!!(U?.package_type&&U.package_type!=="free"),r=U=>[...U].sort((q,Q)=>(e(Q)?1:0)-(e(q)?1:0)),H=new Set,V=U=>{const q=[];for(const Q of U||[])H.has(Q.id)||(H.add(Q.id),q.push(Q));return r(q).slice(0,B)};return{railSoon:V(k),railFresh:V(p),railViewed:V(i),railSalary:V(L)}},[k,p,i,L]),Se=async()=>{v(!0),E(!1);try{const e=await Rt();Lt().then(n).catch(r=>{}),l({groups:e.groups||[]}),J(e.group_job_counts||{}),T({jobs:e.stats?.jobs??null,week:e.stats?.week??null,groups:e.stats?.groups??null}),j(e.stats?.community_groups||0),e.network&&se(e.network),le(e.posts||[]),d((e.events||[]).slice(0,3)),b(e.seekers||[]),K({fresh:e.rail_fresh||[],viewed:e.rail_viewed||[],salary:e.rail_salary||[],soon:e.rail_soon||[]})}catch{l({groups:[]}),E(!0)}v(!1)};s.useEffect(()=>{Se()},[o.state?.refresh]),s.useEffect(()=>{const e=()=>{document.visibilityState==="visible"&&Pt().then(r=>{r&&se(r)}).catch(()=>{})};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),s.useEffect(()=>{if(f)return;let e=!0;return qt().then(r=>{e&&te(r||[])}),()=>{e=!1}},[f]);const he=e=>N.length?N[(Y+e)%N.length]:null,ve=N.length>1?he(1):null;s.useEffect(()=>{let e=!0;const r=!!O?.is_test_user;if(!F&&!r){P&&(y(P.fresh),R(P.viewed),g(P.salary),D(P.soon||[]));return}return Promise.all([ye({limit:B+8,isTestUser:r,filters:F?$:null}),vt({limit:B+8,isTestUser:r,filters:F?$:null}).catch(()=>[]),ye({limit:B+8,isTestUser:r,withSalary:!0,filters:F?$:null}).catch(()=>[]),_t({limit:B+8,isTestUser:r,filters:F?$:null}).catch(()=>[])]).then(([H,V,U,q])=>{e&&(y(H||[]),R(V||[]),g(U||[]),D(q||[]))}).catch(()=>{}),()=>{e=!1}},[O?.is_test_user,F,$,P]);const ne=e=>r=>xt(e,r,$,Ke),be=m.filter(ne(_.JOB_SEEKER_POST)).slice(0,B),_e=e=>({id:e.id,title:e.title,to:Ce(_.JOB,e.id)}),Ze=s.useMemo(()=>({fresh:X.filter(e=>e?.id&&e?.title).slice(0,12).map(_e),viewed:Z.filter(e=>e?.id&&e?.title&&Mt(e)>0).slice(0,12).map(_e),groups:(a.groups||[]).filter(e=>e?.id&&e?.name&&e?.slug&&e.is_internal&&(S[e.id]||0)>0).sort((e,r)=>(S[r.id]||0)-(S[e.id]||0)).slice(0,12).map(e=>({id:e.id,title:e.name,to:`/groups/${e.slug}`})),seekers:m.filter(e=>e?.id&&e?.title).slice(0,12).map(e=>({id:e.id,title:e.title,to:Ce(_.JOB_SEEKER_POST,e.id)}))}),[X,Z,a.groups,S,m]),ge=ie.filter(ne(_.POST)).slice(0,B),re=[...h.filter(ne(_.COURSE))].sort((e,r)=>!e.start_date&&!r.start_date?0:e.start_date?r.start_date?new Date(e.start_date)-new Date(r.start_date):-1:1).slice(0,B),Qe=s.useMemo(()=>new Set([...pe,...X,...Z,...fe].map(e=>e.id)),[pe,X,Z,fe]),et=s.useMemo(()=>new Set(ge.map(e=>e.id)),[ge]),tt=s.useMemo(()=>new Set(be.map(e=>e.id)),[be]),st=s.useMemo(()=>new Set(u.map(e=>e.id)),[u]),nt=s.useMemo(()=>new Set(re.map(e=>e.id)),[re]),rt=s.useMemo(()=>N.length?N.map((e,r)=>N[(Y+r)%N.length]).slice(2):[],[N,Y]);return w.groups??(x||a.groups.length),w.jobs,w.week,t.jsxs("div",{className:Jt.brand,dir:"rtl",children:[t.jsx(jt,{isRecruiter:Xe,onPublish:()=>
1We("job"),stats:{jobPostsWeek:C?.job_posts_7d??null,jobPostsMonth:C?.job_posts_30d??null,distinctJobs:C?.distinct_jobs_30d??null,members:Ye,publishers:C?.publishers_all??null,posts:C?.posts_all??null,reachFloor:C?.reach_all_floor??null,activeContent:C?.active_content_30d??null,openJobs:C?.active_jobs??null,employers:C?.employers_hiring??null,openTitles:C?.open_titles??null,brands:C?.site_brands??[],pulse:C?.pulse_30d??null},pulseItems:Ze}),t.jsxs("main",{className:"max-w-5xl mx-auto px-4 md:px-6 pb-10",children:[I&&!f&&t.jsx("div",{className:"py-8",children:t.jsx(Ct,{title:"×× ×צ××× × ×××¢×× ×ת ×ת×××",message:"××ת×× ×©×ש ××¢×× ××× ×ת. × ×¡× ××¨×¢× × ×ת ×××£.",onRetry:Se})}),t.jsx("section",{id:"section-groups",className:"pt-5",children:t.jsx(Bt,{groups:a.groups,jobCounts:S,isLoading:f})}),t.jsx("section",{className:"pt-3",children:t.jsx(Nt,{categoryOptions:de.categories,employmentTypeOptions:de.employmentTypes,regionOptions:de.regions,total:C?.active_content_30d??null,totalLabel:"פ×ס××× ××תר"})}),t.jsx(z,{title:"×שר×ת ××ש×ת",jobs:X,moreTo:F?`/jobs${(()=>{const e=new URLSearchParams(o.search);e.delete("axis");const r=e.toString();return r?`?${r}`:""})()}`:"/jobs",moreLabel:"××× ××שר×ת",groupsById:A}),t.jsx(z,{title:"×¢×××× ××××× ×קר××××",jobs:pe,groupsById:A}),W(0),he(0)&&t.jsx("section",{className:"py-2",children:t.jsx(je,{fact:he(0)})}),M.question&&t.jsx("section",{className:"py-2",children:t.jsx(Ve,{question:M.question,canGoBack:M.canGoBack,disabled:M.isLoading,onSubmit:e=>M.submit(M.question,e,"feed"),onSkip:()=>M.skip(M.question,"feed"),onBack:M.goBack})}),t.jsx(z,{title:"×× ×¦×¤×ת ×××תר",jobs:Z,groupsById:A}),t.jsx(z,{title:"×¢× ×©×ר ××××",jobs:fe,groupsById:A}),W(1),t.jsx(Ue,{posts:be,groupsById:A}),ve&&t.jsx("section",{className:"py-2",children:t.jsx(je,{fact:ve})}),W(2),t.jsx(Ae,{posts:ge,groupsById:A}),W(3),u.length>0&&t.jsx(ae,{title:"××ר××¢×× ×§×¨××××",moreTo:"/events",moreLabel:"××× ×××ר××¢××",children:u.filter(ne(_.EVENT)).map((e,r)=>t.jsx(Ge,{event:e,index:r,layout:"rail"},e.id))}),re.length>0&&t.jsx(ae,{title:"×§×רס×× ×××שר×ת",moreTo:"/courses",moreLabel:"××× ×××שר×ת",children:re.map((e,r)=>t.jsx(De,{course:e,index:r,layout:"rail"},e.id))}),W(4),!F&&!f&&!we&&t.jsx(Ht,{groups:a.groups,jobCounts:S,groupsById:A,userId:O?.id||null,isTestUser:!!O?.is_test_user,excludeJobIds:Qe,excludePostIds:et,excludeEventIds:st,excludeCourseIds:nt,excludeSeekerIds:tt,facts:rt,survey:M,userRole:O?.main_role||null})]})]})}export{Is as default};
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.