PageSourceSearch

https://careerdiary.io/assets/JobSearchPage-CyZU0MSZ.js

js careerdiary.io collected 2026-09-24 15:03:36 UTC 58,671 bytes, 16 lines download raw bytes

1import{j as t,r as u,R as be}from"./animation-CddyXVCz.js";import{bD as Ke,B as z,X as Ge,az as Qt,bc as Zt,bE as es,T as ts,aA as ve,bd as ss,be as yt,bF as as,bG as Ae,a as rs,ay as ns,aM as pe,s as os,bH as He,bI as is,bJ as Mt,bK as ls,D as Ct,u as Ye,bL as Ve,bM as ze,y as bt,l as vt,S as wt,h as cs,bN as ds,bO as us,aN as We,bP as ms,bQ as hs,bR as ps,m as gs,p as fs}from"./index-CGKNpi9E.js";import{J as xs}from"./JobCard-DLJHd_A6.js";import{J as At}from"./JobDetailPanel-CXiO4exJ.js";import{d as Xe}from"./htmlEntities-97NJt3YN.js";import{d as ys,P as bs}from"./PersonalizedEmptyState-DHLu2vFE.js";import{P as vs}from"./PageWrapper-BunOBjUW.js";import{u as ws}from"./wittyMessages-DNDNm0CC.js";import"./react-vendor-CbN3pvl2.js";import"./supabase-iKSPld20.js";import"./docgen-Bp8WKBAE.js";import"./query-DPqpbKNH.js";import"./scoreSeverity-CZDyLV63.js";import"./handoffSuggestions-raELPsOv.js";const Ss=40,ks=.6,St={enabled:!0,fallbackThreshold:Ss,semanticWeight:ks,batchSize:20},he=({className:e="",style:a})=>t.jsx("div",{className:`skeleton animate-shimmer ${e}`,style:a,"aria-label":"Loading...",role:"status"}),js=({className:e="",index:a=0})=>t.jsx("div",{className:`iconic-surface-soft rounded-2xl p-5 ${e}`,style:{animationDelay:`${a*100}ms`,animation:"skeleton-fade-in 0.4s ease-out both"},children:t.jsxs("div",{className:"flex gap-4 items-start",children:[t.jsx(he,{className:"w-16 h-16 rounded-xl flex-shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0 space-y-2.5",children:[t.jsx(he,{className:"h-5 w-3/5 rounded-md"}),t.jsx(he,{className:"h-4 w-2/5 rounded-md"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(he,{className:"h-3.5 w-28 rounded-md"}),t.jsx(he,{className:"h-5 w-14 rounded-full"})]}),t.jsx(he,{className:"h-3 w-20 rounded-md"})]})]})}),Ns=({count:e=5,className:a=""})=>t.jsx("div",{className:`space-y-3 ${a}`,children:Array.from({length:e}).map((s,r)=>t.jsx(js,{index:r},r))}),Ts=({job:e,isOpen:a,onClose:s,onTailor:r,searchQuery:n})=>{const i=u.useRef(null),l=u.useRef(null),[m,p]=u.useState(!1),h=Ke(Xe(e.title||""));if(u.useEffect(()=>{const g=()=>{p(window.innerWidth<1024)};return g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[]),u.useEffect(()=>{const g=L=>{L.key==="Escape"&&a&&m&&s()};return a&&m&&(document.addEventListener("keydown",g),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",g),document.body.style.overflow="unset"}},[a,s,m]),!a||!m)return null;const c=g=>{g.target===l.current&&s()};return t.jsx("div",{ref:l,className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-0 sm:p-4 animate-fade-in",onClick:c,role:"dialog","aria-modal":"true","aria-labelledby":"job-modal-title",children:t.jsxs("div",{ref:i,className:"relative w-full h-full sm:w-[95vw] sm:h-[90vh] sm:max-w-4xl bg-white dark:bg-slate-900 rounded-none sm:rounded-2xl shadow-2xl flex flex-col overflow-hidden animate-zoom-in",onClick:g=>g.stopPropagation(),children:[t.jsxs("div",{className:"flex-shrink-0 border-b border-gray-200 dark:border-slate-700 p-4 sm:p-6 flex items-center justify-between bg-white dark:bg-slate-900 rounded-t-2xl",children:[t.jsx("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h2",{id:"job-modal-title",className:"font-sans text-lg sm:text-xl font-bold text-gray-900 dark:text-white truncate",children:h}),t.jsxs("p",{className:"text-sm text-gray-500 dark:text-slate-400 mt-1 truncate",children:[e.company," ",e.locationText?`• ${e.locationText}`:""]})]})}),t.jsx(z,{onClick:s,variant:"ghost",size:"sm",className:"flex-shrink-0 p-2 hover:bg-gray-100 dark:hover:bg-slate-800 rounded-lg transition-colors group ml-3 h-auto","aria-label":"Close job details",children:t.jsx(Ge,{className:"h-6 w-6 text-gray-500 dark:text-slate-400 group-hover:text-gray-700 dark:group-hover:text-slate-200"})})]}),t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden bg-white dark:bg-slate-900",children:t.jsx(At,{job:e,onTailor:r,searchQuery:n})})]})})},Ms=280,Cs=({keyword:e,location:a,isGuest:s})=>{const{openSlidePanel:r}=Qt(),[n,i]=u.useState([]),[l,m]=u.useState(3),[p,h]=u.useState(!1),[c,g]=u.useState(!1),[L,C]=u.useState(""),[S,A]=u.useState(!1),[P,$]=u.useState(null),W=e.trim(),se=a.trim()||"Remote",d=u.useCallback(async()=>{try{const b=await Zt();i(b.watches),m(b.max)}catch{i([])}finally{h(!0)}},[]);u.useEffect(()=>{if(s){h(!0);return}d()},[s,d]);const w=n.length>=l,N=n.some(b=>b.title.trim().toLowerCase()===W.toLowerCase()&&b.location.trim().toLowerCase()===se.toLowerCase()),F=()=>
1{if(s){ve("watch_search_guest_prompt",{keyword:W}),r({contextMessage:"Create a free account to watch this search — we’ll email you the new jobs that match your profile each week.",triggerId:"watch_search_attempt"});return}$(null),g(b=>!b)},M=async()=>{A(!0),$(null);try{const b=await ss({title:W,location:se,intentText:L.trim()||null});i(O=>[...O,b]),C(""),g(!1),$({tone:"ok",message:"Watching. Your first digest arrives Wednesday."}),ve("watch_created",{watch_id:b.id,has_intent:!!b.intentText,watch_count:n.length+1})}catch(b){const O=b instanceof yt?b.message:"Could not save that watch. Please try again.";$({tone:"error",message:O}),b instanceof yt&&b.code!=="unknown"&&d()}finally{A(!1)}},X=async b=>{const O=n;i(G=>G.filter(oe=>oe.id!==b));try{await as(b),ve("watch_deleted",{watch_id:b})}catch{i(O),$({tone:"error",message:"Could not remove that watch. Please try again."})}};if(!W)return null;const ee=!s&&(w||N),J=N?"Watching this search":"Watch this search";return t.jsxs("div",{className:"space-y-3","data-testid":"watch-search-panel",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx(z,{type:"button",onClick:F,variant:"secondary",size:"sm",disabled:ee,"data-testid":"watch-search-button",leftIcon:t.jsx(es,{className:"h-4 w-4"}),title:w&&!N?`You can watch up to ${l} searches. Remove one to add another.`:void 0,children:J}),!s&&p&&t.jsxs("span",{className:"text-sm text-gray-500 dark:text-slate-400",children:[n.length," of ",l," watched",w&&!N?" — remove one to add another":""]})]}),P&&t.jsx("p",{role:"status",className:`text-sm ${P.tone==="ok"?"text-[var(--color-accent)]":"text-red-600 dark:text-red-400"}`,children:P.message}),c&&!ee&&t.jsxs("div",{className:"rounded-2xl border border-[var(--color-border)] bg-[var(--color-surface)] p-4 space-y-3",children:[t.jsxs("div",{children:[t.jsxs("p",{className:"text-sm font-semibold text-gray-800 dark:text-slate-100",children:["Watch “",W,"” in ",se]}),t.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 mt-1",children:"Every Wednesday we re-run this search and email you only the jobs that are new since last time, scored against your profile."})]}),t.jsxs("label",{className:"block",children:[t.jsxs("span",{className:"text-sm font-medium text-gray-700 dark:text-slate-200",children:["Anything specific? ",t.jsx("span",{className:"font-normal text-gray-500",children:"(optional)"})]}),t.jsx("input",{type:"text",value:L,maxLength:Ms,onChange:b=>C(b.target.value),placeholder:"e.g. organization has no profit motive",className:"mt-1 w-full rounded-lg border border-[var(--color-border)] bg-[var(--color-bg)] px-3 py-2 text-sm","data-testid":"watch-intent-input"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(z,{type:"button",onClick:M,size:"sm",disabled:S,children:S?"Saving…":"Start watching"}),t.jsx(z,{type:"button",onClick:()=>g(!1),variant:"ghost",size:"sm",children:"Cancel"})]})]}),!s&&n.length>0&&t.jsxs("div",{className:"rounded-2xl border border-[var(--color-border)] p-3",children:[t.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-[var(--color-accent)] mb-2",children:"Your watched searches"}),t.jsx("ul",{className:"space-y-1",children:n.map(b=>t.jsxs("li",{className:"flex items-start justify-between gap-3 text-sm",children:[t.jsxs("span",{className:"text-gray-700 dark:text-slate-200",children:[b.title," · ",b.location,b.intentText&&t.jsx("span",{className:"block text-xs text-gray-500 dark:text-slate-400",children:b.intentText})]}),t.jsx("button",{type:"button",onClick:()=>X(b.id),"aria-label":`Stop watching ${b.title} in ${b.location}`,className:"shrink-0 rounded p-1 text-gray-400 hover:text-red-600 dark:hover:text-red-400",children:t.jsx(ts,{className:"h-4 w-4"})})]},b.id))})]})]})},Lt=2,As=async(e,a={})=>{const s=e.trim();if(s.length<Lt)return[];const r=new URLSearchParams({q:s});a.limit&&r.set("limit",String(a.limit));try{const n=await fetch(`${Ae}/api/geo/suggest?${r}`,{signal:a.signal});if(!n.ok)return[];const i=await n.json();return Array.isArray(i.suggestions)?i.suggestions:[]}catch{return[]}},Ls=async(e,a)=>{try{const s=new URLSearchParams({lat:String(e),lng:String(a)}),r=await fetch(`${Ae}/api/geo/reverse?${s}`);return r.ok?(await r.json()).place??null:null}catch{return null}};
1class Dt extends Error{}const Ds=async()=>{if(typeof navigator>"u"||!navigator.geolocation)throw new Dt("This browser cannot share your location.");const e=await new Promise((s,r)=>{navigator.geolocation.getCurrentPosition(s,r,{enableHighAccuracy:!1,timeout:1e4,maximumAge:300*1e3})}),a=await Ls(e.coords.latitude,e.coords.longitude);return(a==null?void 0:a.label)??null},Es=200,Rs=({value:e,onChange:a,onSelect:s,id:r="location-typeahead",name:n,placeholder:i="City, state or ZIP",className:l="",disabled:m=!1,showUseMyLocation:p=!1,onEnterWithoutSelection:h,...c})=>{const[g,L]=u.useState([]),[C,S]=u.useState(!1),[A,P]=u.useState(-1),[$,W]=u.useState(!1),[se,d]=u.useState(null),w=u.useRef(null),N=u.useRef(null),F=u.useRef(null),M=u.useRef(!1);rs(w,()=>S(!1)),u.useEffect(()=>()=>{var x;F.current&&clearTimeout(F.current),(x=N.current)==null||x.abort()},[]);const X=u.useCallback(x=>{var I;if(F.current&&clearTimeout(F.current),(I=N.current)==null||I.abort(),x.trim().length<Lt){L([]),S(!1);return}F.current=setTimeout(async()=>{const D=new AbortController;N.current=D;const ge=await As(x,{signal:D.signal});D.signal.aborted||(L(ge),P(-1),S(ge.length>0))},Es)},[]),ee=x=>{M.current=!1,d(null),a(x),X(x)},J=x=>{var I;M.current=!0,F.current&&clearTimeout(F.current),(I=N.current)==null||I.abort(),a(x.label),s==null||s(x),L([]),S(!1),P(-1)},b=()=>{if(M.current)return;const x=pe(e);x&&x!==e&&a(x)},O=x=>{if(x.key==="ArrowDown"||x.key==="ArrowUp"){if(!C&&g.length>0){S(!0);return}if(g.length===0)return;x.preventDefault();const I=x.key==="ArrowDown"?1:-1;P(D=>(D+I+g.length)%g.length);return}if(x.key==="Enter"){if(C&&A>=0&&g[A]){x.preventDefault(),J(g[A]);return}b(),h==null||h();return}x.key==="Escape"&&C&&(x.preventDefault(),S(!1),P(-1))},G=async()=>{d(null),W(!0);try{const x=await Ds();x?(M.current=!0,a(x),L([]),S(!1)):d("We couldn't find a city near you — type one instead.")}catch(x){d(x instanceof Dt?"This browser cannot share your location.":"Location access is off. Type a city instead.")}finally{W(!1)}},oe=`${r}-listbox`;return t.jsxs("div",{className:"relative",ref:w,children:[t.jsxs("div",{className:"relative",children:[t.jsx("input",{type:"text",id:r,name:n,value:e,disabled:m,placeholder:i,className:`w-full pr-8 ${l}`,onChange:x=>ee(x.target.value),onKeyDown:O,onBlur:b,onFocus:()=>{g.length>0&&S(!0)},role:"combobox","aria-expanded":C,"aria-controls":oe,"aria-autocomplete":"list","aria-activedescendant":C&&A>=0?`${r}-option-${A}`:void 0,autoComplete:"off",autoCorrect:"off",spellCheck:!1,enterKeyHint:"search",...c}),t.jsx(ns,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--text-secondary)]/40 pointer-events-none"})]}),C&&g.length>0&&t.jsx("ul",{id:oe,role:"listbox","aria-label":"Location suggestions",className:"absolute z-50 w-full mt-1 bg-white dark:bg-slate-800 border border-gray-200 dark:border-slate-700 rounded-md shadow-lg max-h-60 overflow-auto",children:g.map((x,I)=>t.jsx("li",{id:`${r}-option-${I}`,role:"option","aria-selected":I===A,onMouseDown:D=>{D.preventDefault(),J(x)},onMouseEnter:()=>P(I),className:`px-4 py-2 cursor-pointer text-sm text-gray-700 dark:text-gray-200 ${I===A?"bg-gray-100 dark:bg-slate-700":""}`,"data-testid":"location-suggestion",children:x.label},`${x.label}-${x.lat}`))}),p&&!m&&t.jsx("button",{type:"button",onClick:G,disabled:$,className:"mt-1 text-xs text-[var(--accent)] hover:underline disabled:opacity-60","data-testid":"use-my-location",children:$?"Finding your city…":"Use my location"}),se&&t.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-slate-400",children:se})]})},Et="cd_last_job_search_v1",Ps=30,Is=e=>{if(!e)return!0;const a=Date.now()-new Date(e).getTime();return Number.isFinite(a)&&a>=0&&a<=Ps*24*60*60*1e3},_s=e=>{if(!e)return null;try{const a=JSON.parse(e);return!a||typeof a!="object"||!Is(a.savedAt)?null:a}catch{return null}},Os=()=>{try{return _s(window.localStorage.getItem(Et))}catch{return null}},$s=e=>{try{window.localStorage.setItem(Et,JSON.stringify({...e,savedAt:new Date().toISOString()}))}catch{}},Fs=e=>{var r,n;const a=(n=(r=e==null?void 0:e.jobPreferences)==null?void 0:r.preferredLocations)==null?void 0:n.find(i=>i==null?void 0:i.trim());if(!a)return null;const s=a.trim();return pe(s)??s},kt=({profile:e,lastSearchLocation:a,baseLocation:s})=>{const r=[Fs(e),a,s];for(const n of r){const i=n==null?void 0:n.trim();if(i)return pe(i)??i}return""},Rt=[{value:"relevance",label:"Best Match"},{value:"date-desc",label:"Newest First"},{value:"date-asc",label:"Oldest First"},{value:"salary-desc",label:"Highest Salary"},{value:"salary-asc",label:"Lowest Salary"},{value:"company",label:"Company A-Z"}];function Js(e,a){const s=[...e];switch(a){case"relevance":return s.sort((r,n)=>{const i=r.matchScore??0,l=n.matchScore??0;if(l!==i)return l-i;const m=r.postedAt?new Date(r.postedAt).getTime():0;return(n.postedAt?new Date(n.postedAt).getTime():0)-m});case"date-desc":return s.sort((r,n)=>{const i=r.postedAt?new Date(r.postedAt).getTime():0;return(n.postedAt?new Date(n.postedAt).getTime():0)-i}
1);case"date-asc":return s.sort((r,n)=>{const i=r.postedAt?new Date(r.postedAt).getTime():0,l=n.postedAt?new Date(n.postedAt).getTime():0;return i-l});case"salary-desc":return s.sort((r,n)=>{const i=r.salaryMax??r.salaryMin??0;return(n.salaryMax??n.salaryMin??0)-i});case"salary-asc":return s.sort((r,n)=>{const i=r.salaryMin??r.salaryMax??0,l=n.salaryMin??n.salaryMax??0;return i===0&&l>0?1:l===0&&i>0?-1:i-l});case"company":return s.sort((r,n)=>{const i=r.company.toLowerCase(),l=n.company.toLowerCase();return i.localeCompare(l)});default:return s}}function qs(e,a,s){var i;const r=e===1?"job":"jobs",n=((i=Rt.find(l=>l.value===s))==null?void 0:i.label)||"Best Match";return`Showing ${e} ${r}, sorted by ${n}`}const Bs=e=>e!=null&&e!==""&&!(Array.isArray(e)&&e.length===0);function Pt(e){const a=s=>e.some(r=>Bs(s(r)));return{closingDate:a(s=>s.daysUntilClose),requiresPublic:a(s=>s.whoMayApply),securityClearance:a(s=>s.securityClearance),travelMax:a(s=>s.travelPercentage),positionTypes:a(s=>s.employmentType||s.positionType),grade:a(s=>s.gradeLevel),multipleOpenings:a(s=>s.totalOpenings),onlyConfirmedSalary:a(s=>typeof s.salaryIsPredicted=="boolean"?!0:void 0)}}function It(e,a){const s={...e};return a.closingDate||(s.closingDate="any"),a.requiresPublic||(s.requiresPublic=void 0),a.securityClearance||(s.requiresNoSecurityClearance=void 0,s.allowsSecurityClearance=void 0),a.travelMax||(s.travelMax=void 0),a.positionTypes||(s.positionTypes=[]),a.grade||(s.gradeMin=void 0,s.gradeMax=void 0),a.multipleOpenings||(s.multipleOpenings=void 0),a.onlyConfirmedSalary||(s.onlyConfirmedSalary=void 0),s}function zs(e,a){const s=a&&It(a,Pt(e));return!s||(s.closingDate==="any"||!s.closingDate)&&!s.requiresPublic&&!s.requiresNoSecurityClearance&&s.travelMax===void 0&&(!s.positionTypes||s.positionTypes.length===0)&&s.gradeMin===void 0&&s.gradeMax===void 0&&!s.multipleOpenings&&!s.onlyConfirmedSalary?e:e.filter(r=>{if(s.closingDate&&s.closingDate!=="any"&&r.daysUntilClose!==void 0&&r.daysUntilClose!==null){const n=r.daysUntilClose;if(s.closingDate==="today"&&n!==0||s.closingDate==="this-week"&&n>7||s.closingDate==="this-month"&&n>30)return!1}if(s.requiresPublic&&!(Array.isArray(r.whoMayApply)?r.whoMayApply:r.whoMayApply?[r.whoMayApply]:[]).some(i=>i.toLowerCase().includes("public"))||s.requiresNoSecurityClearance&&r.securityClearance&&r.securityClearance!=="None"&&r.securityClearance!=="Not Required"||s.allowsSecurityClearance===!1&&r.securityClearance&&r.securityClearance!=="None"&&r.securityClearance!=="Not Required")return!1;if(s.travelMax!==void 0&&r.travelPercentage){const n=typeof r.travelPercentage=="string"?parseInt(r.travelPercentage):r.travelPercentage;if(!isNaN(n)&&n>s.travelMax)return!1}if(s.positionTypes&&s.positionTypes.length>0){const n={"full-time":["fulltime","full-time","full_time","permanent"],"part-time":["parttime","part-time","part_time"],contract:["contractor","contract","temporary"],internship:["intern","internship"]},i=(r.employmentType||r.positionType||"").toLowerCase();if(i&&!s.positionTypes.some(m=>(n[m.toLowerCase()]||[m.toLowerCase()]).some(h=>i.includes(h))))return!1}if(s.gradeMin!==void 0||s.gradeMax!==void 0){if(!r.gradeLevel)return!1;const n=r.gradeLevel.match(/GS[- ]?(\d+)/i);if(!n)return!1;const i=parseInt(n[1]);if(s.gradeMin&&i<s.gradeMin||s.gradeMax&&i>s.gradeMax)return!1}return!(s.multipleOpenings&&(!r.totalOpenings||r.totalOpenings<2)||s.onlyConfirmedSalary&&r.salaryIsPredicted)})}function Ws(e){let a=0;return e.closingDate&&e.closingDate!=="any"&&a++,e.requiresPublic&&a++,e.requiresNoSecurityClearance&&a++,e.travelMax!==void 0&&a++,e.positionTypes&&e.positionTypes.length>0&&a++,e.gradeMin!==void 0&&a++,e.gradeMax!==void 0&&a++,e.multipleOpenings&&a++,e.onlyConfirmedSalary&&a++,a}function Us(e){const a=[];if(e.closingDate&&e.closingDate!=="any"){const s={today:"Closes today","this-week":"Closes this week","this-month":"Closes this month"};a.push(s[e.closingDate])}return e.requiresPublic&&a.push("Open to public"),e.requiresNoSecurityClearance&&a.push("No clearance"),e.travelMax!==void 0&&a.push(`≤${e.travelMax}% travel`),e.positionTypes&&e.positionTypes.length>0&&a.push(...e.positionTypes),e.gradeMin!==void 0&&a.push(`GS-${e.gradeMin}+`),e.multipleOpenings&&a.push("Multiple openings"),e.onlyConfirmedSalary&&a.push("Confirmed salary only"),a}const Ks={product:["Product Manager","Product Owner","Product Designer","Technical Product Manager","Senior Product Manager","Associate Product Manager"],engineer:["Software Engineer","DevOps Engineer","Data 
1Engineer","Machine Learning Engineer","Frontend Engineer","Backend Engineer","Full Stack Engineer"],designer:["Product Designer","UX Designer","UI Designer","Graphic Designer","Visual Designer"],manager:["Product Manager","Engineering Manager","Project Manager","Program Manager","General Manager","Operations Manager"],developer:["Software Developer","Full Stack Developer","Frontend Developer","Backend Developer","Mobile Developer"],analyst:["Data Analyst","Business Analyst","Product Analyst","Financial Analyst"],director:["Product Director","Engineering Director","Product Management Director"],lead:["Tech Lead","Engineering Lead","Product Lead","Technical Lead"],architect:["Software Architect","Solution Architect","System Architect"],scientist:["Data Scientist","Research Scientist","Machine Learning Scientist"]};function Gs(e){var i;if(!e)return{currentTitle:null,allTitles:[],skills:[],industries:[]};const a=((i=e.experience)==null?void 0:i.map(l=>l.jobTitle).filter(Boolean))||[],s=a[0]||null,r=e.skills||[];return{currentTitle:s,allTitles:a,skills:r,industries:[]}}function Hs(e){const a=e.allTitles.map(c=>c.toLowerCase()),s=e.skills.map(c=>c.toLowerCase()),r=[...a,...s].join(" "),n=a.some(c=>c.includes("engineer")||c.includes("developer")||c.includes("programmer")||c.includes("technical")||c.includes("architect"))||s.some(c=>c.includes("software")||c.includes("programming")||c.includes("code")||c.includes("java")||c.includes("python")||c.includes("javascript")),i=a.some(c=>c.includes("designer")||c.includes("design"))||s.some(c=>c.includes("design")||c.includes("ux")||c.includes("ui")||c.includes("figma")||c.includes("sketch")),l=a.some(c=>c.includes("manager")||c.includes("director")||c.includes("lead")||c.includes("head"))||r.includes("management")||r.includes("leadership"),m=a.some(c=>c.includes("analyst")||c.includes("scientist")||c.includes("data"))||s.some(c=>c.includes("data")||c.includes("sql")||c.includes("analytics")||c.includes("machine learning")),p=a.some(c=>c.includes("product"))||s.some(c=>c.includes("product")||c.includes("roadmap")||c.includes("strategy")),h=[];return n&&h.push("technical","engineering","software","development"),i&&h.push("design","ux","ui"),l&&h.push("management","lead","director"),m&&h.push("data","analytics","science"),p&&h.push("product","strategy"),{isTechnical:n,isDesign:i,isManagement:l,isData:m,isProduct:p,domainKeywords:h}}function Ys(e,a,s){const r=e.toLowerCase();let n=0;return s.currentTitle&&r.includes(s.currentTitle.toLowerCase())&&(n+=100),a.domainKeywords.forEach(i=>{r.includes(i)&&(n+=20)}),s.skills.forEach(i=>{r.includes(i.toLowerCase())&&(n+=15)}),a.isTechnical&&(r.includes("technical")||r.includes("engineer")||r.includes("developer"))&&(n+=30),a.isManagement&&(r.includes("manager")||r.includes("director")||r.includes("lead"))&&(n+=25),s.allTitles.length>2&&(r.includes("senior")||r.includes("lead")||r.includes("principal"))&&(n+=10),n}function Vs(e,a){const s=Ks[e.toLowerCase()]||[];if(s.length===0)return[];const r=Hs(a),n=s.map(i=>({expansion:i,score:Ys(i,r,a)}));return n.sort((i,l)=>l.score-i.score),n.map(i=>i.expansion)}function Xs(e,a){var i,l;const s=e.trim();if(s.split(/\s+/).length>=2)return[s];const r=Gs(a),n=Vs(s,r);if(n.length>0)return[...n.slice(0,5),s].filter((p,h,c)=>c.indexOf(p)===h);if((l=(i=a==null?void 0:a.jobPreferences)==null?void 0:i.targetRoles)!=null&&l.length){const m=a.jobPreferences.targetRoles.filter(p=>p.toLowerCase().includes(s.toLowerCase())||s.toLowerCase().includes(p.toLowerCase().split(" ")[0]));if(m.length>0)return[...m,s].filter((p,h,c)=>c.indexOf(p)===h)}return[s]}function Qs(e,a){if(e.length!==a.length||e.length===0)return 0;let s=0,r=0,n=0;for(let l=0;l<e.length;l++)s+=e[l]*a[l],r+=e[l]*e[l],n+=a[l]*a[l];const i=Math.sqrt(r)*Math.sqrt(n);return i===0?0:s/i}function Zs(e){return e<=.45?0:e<=.55?(e-.45)/.1*30:e<=.65?30+(e-.55)/.1*25:e<=.75?55+(e-.65)/.1*20:e<=.85?75+(e-.75)/.1*15:Math.min(100,90+(e-.85)/.15*10)}function ea(e,a){const s=Qs(e,a),r=Math.round(Zs(s)),n=Math.min(8,Math.round(r/100*8));return{score:r,confidence:n,matchMethod:"semantic"}}function ta(e){var s,r;const a=[];if(e.summary&&a.push(e.summary),(s=e.experience)!=null&&s.length){const i=e.experience.slice(0,3).map(l=>l.company?`${l.jobTitle} at ${l.company}`:l.jobTitle);a.push(`Experience: ${i.join("; ")}`)}return(r=e.skills)!=null&&r.length&&a.push(`Skills: ${e.skills.join(", ")}`),a.join(`
2`)}function sa(e){const a=[];return e.company?a.push(`${e.title} at ${e.company}`):a.push(e.title),e.description&&a.push(e.description.substring(0,1500)),a.join(`
3`)}async function _t(){var r,n;const e={"Content-Type":"application/json"},a=await((r=os)==null?void 0:r.auth.getSession()),s=(n=a==null?void 0:a.data.session)==null?void 0:n.access_token;return s&&(e.Authorization=`Bearer ${s}`),e}let jt=null;
3const Nt=new Map;async function aa(e){var a;try{const s=ta({skills:e.skills,experience:(a=e.experience)==null?void 0:a.map(i=>({jobTitle:i.jobTitle??"",company:i.company})),summary:e.summary});if(!s.trim())return null;const r=await fetch(`${Ae}/api/embeddings/embed`,{method:"POST",headers:await _t(),body:JSON.stringify({text:s})});if(!r.ok)return null;const n=await r.json();return!Array.isArray(n.embedding)||n.embedding.length!==768?null:(jt=n.embedding,jt)}catch{return null}}async function ra(e){const a=new Map,s=[];for(const r of e){const n=Nt.get(r.id);if(n)a.set(r.id,n);else{const i=sa({title:r.title??"",company:r.company,description:r.descriptionFull??r.descriptionSnippet});i.trim()&&s.push({job:r,text:i})}}if(s.length===0)return a;try{for(let r=0;r<s.length;r+=20){const n=s.slice(r,r+20),i=await fetch(`${Ae}/api/embeddings/batch`,{method:"POST",headers:await _t(),body:JSON.stringify({texts:n.map(p=>p.text)})});if(!i.ok)continue;const m=(await i.json()).embeddings??[];for(let p=0;p<n.length&&p<m.length;p++){const h=m[p];Array.isArray(h)&&h.length===768&&(Nt.set(n[p].job.id,h),a.set(n[p].job.id,h))}}}catch{}return a}const Ce=new Map;let na=null;function Tt(){Ce.clear()}function Qe(e){const a=e.descriptionFull??e.descriptionSnippet??"",s=e.locationText??(e.location&&typeof e.location=="object"?[e.location.city,e.location.state,e.location.country].filter(Boolean).join(", "):void 0);return{title:e.title??"",description:a,locationText:s??void 0,location:s??void 0,remote:e.remote??!1}}function Ze(e,a){const s=a.toLowerCase().trim(),r=(e.title??"").toLowerCase(),n=(e.company??"").toLowerCase(),i=(e.descriptionFull??e.descriptionSnippet??"").toLowerCase();if(r===s)return 100;if(r.includes(s))return 90;const l=s.split(/\s+/).filter(c=>c.length>=2),m=r.split(/\s+/);if(l.length>0&&l.every(c=>m.some(g=>g.includes(c))))return 80;if(r.startsWith(s))return 75;const p=Mt(s,r);if(p>=80)return p;if(l.length>1&&l.filter(g=>r.includes(g)||i.includes(g)).length>=l.length*.7)return 65;if(n.includes(s))return 60;if(i.includes(s))return 50;const h=l.filter(c=>m.some(g=>g.includes(c))).length;return h>0?30+h/Math.max(l.length,1)*20:l.length===1&&i.includes(l[0])?25:0}function Ot(e,a,s,r){const n=(e.title??"").toLowerCase(),i=a.toLowerCase().trim(),l=i.split(/\s+/).filter(S=>S.length>=2);let m=.6,p=.4;const h=i.length>=2&&n.includes(i),c=h?0:Mt(i,n),g=h||c>=90,L=!g&&(l.length>0&&l.every(S=>n.includes(S))||c>=80);g?(m=.45,p=.55):L&&(m=.5,p=.5);let C=Math.round(s*m+r*p);return g?C=Math.max(C,65):L&&(C=Math.max(C,55)),Math.min(C,100)}function oa(e){return ls(e.title??"")}function ia(e,a,s){const r=`${e.id}-${a}-${(s==null?void 0:s.id)??"none"}`,n=Ce.get(r);if(n!==void 0)return n;let i;if(s){const l=Qe(e),p=He(s,l).score,h=Ze(e,a);i=Ot(e,a,p,h)}else oa(e)?i=0:i=Math.round(Ze(e,a));return Ce.set(r,i),i}function Ue(e,a,s){const n=e.map(l=>{const m=ia(l,a,s);return{...l,matchScore:m}}),i=n.filter(l=>(l.matchScore??0)>=10);return i.length<n.length,i.sort((l,m)=>{const p=l.matchScore??0,h=m.matchScore??0;if(h!==p)return h-p;const c=l.postedAt&&new Date(l.postedAt).getTime()||0;return(m.postedAt&&new Date(m.postedAt).getTime()||0)-c})}let et=null;function la(e){et=e}async function ca(e,a,s){const r=[];for(const n of e){const i=Qe(n);He(s,i).breakdown.skillsMatch<St.fallbackThreshold&&r.push(n)}if(r.length!==0)try{const n=await aa(s);if(!n)return;const i=await ra(r),l=new Map;for(const m of r){const p=i.get(m.id);if(!p||p.length===0)continue;const h=ea(n,p),c=Qe(m),g=He(s,c,void 0,na??void 0),L=is(g,h.score,St),C=Ze(m,a),S=Ot(m,a,L.score,C),A=`${m.id}-${a}-${s.id??"none"}`;Ce.set(A,S),l.set(m.id,S)}l.size>0&&et&&et(l)}catch(n){console.warn("[HybridScoring] Semantic enhancement failed, using synonym-only scores:",n)}}const da=/\s[-–—|]\s/,$t=e=>{const a=(e??"").trim();return a?a.split(da)[0].trim()||a:""},ua=[[["pmp","project management","project management professional"],["Project Manager","IT Project Manager","Technical Project Manager"]],[["program management","pmi-acp"],["Program Manager","Technical Program Manager"]],[["scrum","csm","certified scrum master"],["Scrum Master","Agile Coach"]],[["
3safe","scaled agile"],["SAFe Agilist","Release Train Engineer","Agile Program Manager"]],[["itil","it service management","itsm"],["IT Manager","IT Service Manager","IT Operations Manager"]],[["change management","change enablement"],["Change Manager","Organizational Change Manager"]],[["product management"],["Product Manager","Product Owner"]],[["leadership","people management","team management"],["Engineering Manager","Team Lead","Director"]],[["react","javascript","typescript"],["Frontend Engineer","Full Stack Developer","React Developer"]],[["python","machine learning","data science"],["Data Scientist","ML Engineer","Python Developer"]],[["aws","docker","kubernetes"],["DevOps Engineer","Cloud Engineer","SRE"]],[["sql","data analysis","business intelligence"],["Data Analyst","Business Analyst","BI Developer"]],[["cybersecurity","information security"],["Security Engineer","Security Analyst","CISO"]]];function ma(e){var l;const a=[],s=new Set,r=(e.skills??[]).map(m=>m.toLowerCase()),n=(m,p)=>{const h=m.trim().toLowerCase();!h||s.has(h)||(a.push({query:m.trim(),reason:p}),s.add(h))};for(const m of((l=e.jobPreferences)==null?void 0:l.targetRoles)??[])n(m,"From your target roles");for(const m of(e.experience??[]).slice(0,3))m.jobTitle&&n($t(m.jobTitle),"From your experience");if(a.length<4)for(const[m,p]of ua){const h=m.filter(c=>r.some(g=>g.includes(c)||c.includes(g)));if(h.length){for(const c of p)n(c,`Based on your ${h.slice(0,2).join(", ")} skills`);if(a.length>=6)break}}return a.slice(0,6)}const Me=e=>(e==null?void 0:e.trim())??"",ha=e=>{var n,i,l;const a=(i=(n=e==null?void 0:e.jobPreferences)==null?void 0:n.preferredLocations)==null?void 0:i.find(m=>Me(m));if(a)return a.trim();const s=Me(e==null?void 0:e.location);if(s)return s;const r=Me((l=e==null?void 0:e.contactDetails)==null?void 0:l.location);return r||"Remote"},pa=e=>{var s;const a=(s=e==null?void 0:e.experience)==null?void 0:s[0];return $t((a==null?void 0:a.jobTitle)??(a==null?void 0:a.title))},ga=(e,a=3)=>{var l;if(!e)return[];const s=new Set,r=ha(e),n=[];for(const m of((l=e.jobPreferences)==null?void 0:l.targetRoles)??[]){const p=Me(m);if(!p)continue;const h=p.toLowerCase();if(!s.has(h)&&(n.push({query:p,location:r}),s.add(h),n.length>=a))return n}const i=pa(e);return i&&!s.has(i.toLowerCase())&&n.push({query:i,location:r}),n.slice(0,a)},Ft="cd.jobsearch.protip.dismissed",Jt=()=>{try{return window.localStorage}catch{return null}},fa=(e=Jt())=>{try{return(e==null?void 0:e.getItem(Ft))==="1"}catch{return!1}},xa=(e=Jt())=>{try{e==null||e.setItem(Ft,"1")}catch{}},ya=({session:e,isGuest:a})=>{var ht;const s=Ct(),{state:r}=Ye(),{location:n,zipcode:i,profile:l}=r,{dispatch:m}=Ye(),p=u.useMemo(()=>{var o,f,k;return ys({lastTailoredRole:(o=r.lastTailoredInfo)==null?void 0:o.jobTitle,trackedRole:(k=(f=r.appliedJobs)==null?void 0:f[0])==null?void 0:k.job_title,profile:r.profile})},[(ht=r.lastTailoredInfo)==null?void 0:ht.jobTitle,r.appliedJobs,r.profile]),h="jobSearch_results",c="jobSearch_params",g="jobSearch_state",[L,C]=u.useState(()=>fa()),[S,A]=u.useState({}),P=be.useRef(null),$=be.useRef(!1),W=be.useRef(null),d=(()=>{try{const o=sessionStorage.getItem(h),f=sessionStorage.getItem(c),k=sessionStorage.getItem(g),y=f?JSON.parse(f):null,j=k?JSON.parse(k):null;if(o){const B=JSON.parse(o);return{jobs:Array.isArray(B.jobs)?B.jobs.map(U=>({...U,title:Ke(Xe(U.title||""))})):[],hasSearched:B.hasSearched||!1,failedSources:B.failedSources||[],page:B.page||1,hasMore:B.hasMore!==void 0?B.hasMore:!0,keyword:(y==null?void 0:y.keyword)||"",location:typeof(y==null?void 0:y.location)=="string"?y.location:void 0,remoteOnly:(y==null?void 0:y.remoteOnly)||!1,selectedSources:(y==null?void 0:y.selectedSources)||["jsearch"],postedWithinDays:y==null?void 0:y.postedWithinDays,searchRadius:(y==null?void 0:y.searchRadius)||25,radiusUnit:(y==null?void 0:y.radiusUnit)||"miles",sortBy:(j==null?void 0:j.sortBy)||"relevance",filters:(j==null?void 0:j.filters)||{closingDate:"any",travelMax:void 0,positionTypes:[]},selectedJobId:(j==null?void 0:j.selectedJobId)||null,searchMode:(j==null?void 0:j.searchMode)||null,recommendedQuery:(j==null?void 0:j.recommendedQuery)||null}}}catch(o){console.warn("Failed to restore job search from sessionStorage:",o)}return null})();u.useEffect(()=>{window.location.pathname!=="/app/search"&&(e||a)&&window.history.pushState(null,"","/app/search")},[e,a]);const w=be.useMemo(()=>Os(),[]),[N,F]=u.useState((d==null?void 0:d.keyword)||(w==null?void 0:w.keyword)||""),[M,X]=u.useState(()=>(d==null?void 0:d.location)??kt({profile:l,lastSearchLocation:w==null?void 0:w.location,baseLocation:n||i})),ee=be.useRef(!!(d!=null&&d.location)),[J,b]=u.useState((d==null?void 0:d.remoteOnly)??(w==null?void 0:w.remoteOnly)??!1),[O]=u.useState((d==null?void 0:d.selectedSources)||["jsearch"]),[G,oe]=u.useState(d==null?void 0:d.postedWithinDays),[x,I]=u.useState(()=>{var o;return(d==null?void 0:d.searchRadius)||(w==null?void 0:w.searchRadius)||((o=l==null?void 0:l.jobPreferences)==null?void 0:o.searchRadius)||25}),[D,ge]=u.useState((d==null?void 0:d.radiusUnit)||(w==null?void 0:w.radiusUnit)||"miles"),[q,ie]=u.useState((d==null?void 0:d.jobs)||[]),[te,Le]=u.useState(!1),[De,Ee]=u.useState(null),[tt,st]=u.useState(null),[Q,at]=u.useState((d==null?void 0:d.hasSearched)||!1),[we,rt]=u.useState((d==null?void 0:d.failedSources)||[]),[Re,qt]=u.useState((d==null?void 0:d.searchMode)||null),[le,Pe]=u.useState((d==null?void 0:d.recommendedQuery)||null),Bt=ws("jobSearch",2e3),[nt,zt]=u.useState((d==null?void 0:d.page)||1),[ot,it]=u.useState((d==null?void 0:d.hasMore)!==void 0?d.hasMore:!0),[ae,Wt]=u.useState((d==null?void 0:d.sortBy)||"relevance"),[re,Ie]=u.useState("list");u.useEffect(()=>{let o=!0;return Ve.getItem("jobSearchViewMode").then(f=>{o&&(f==="grid"||f==="list")&&Ie(f)}).catch(()=>{}),()=>{o=!1}},[]),u.useEffect(()=>{Ve.setItem("jobSearchViewMode",re).catch(()=>{})},[re]);const[_e,Ut]=u.useState(!1),[Se,Kt]=u.useState(!1),[T,Z]=u.useState((d==null?void 0:d.filters)||{closingDate:"any",travelMax:void 0,positionTypes:[]}),[H,Oe]=u.useState((d==null?void 0:d.selectedJobId)||null);u.useEffect(()=>{Q&&q.length>0&&ze.setItem(h,JSON.stringify({jobs:q,hasSearched:Q,failedSources:we,page:nt,hasMore:ot})).catch(o=>{console.warn("Failed to save job search results to session storage:",o)})},[q,Q,we,nt,ot]),u.useEffect(()=>{ze.setItem(c,JSON.stringify({keyword:N,location:M,remoteOnly:J,selectedSources:O,postedWithinDays:G,searchR
3adius:x,radiusUnit:D})).catch(o=>{console.warn("Failed to save job search params to session storage:",o)})},[N,M,J,O,G,x,D]),u.useEffect(()=>{ze.setItem(g,JSON.stringify({sortBy:ae,filters:T,selectedJobId:H,searchMode:Re,recommendedQuery:le})).catch(o=>{console.warn("Failed to save job search state to session storage:",o)})},[ae,T,H,Re,le]);const ke=u.useMemo(()=>q.find(o=>o.id===H),[q,H]),Y=u.useMemo(()=>{const o=zs(q,T);return Js(o,ae)},[q,T,ae]);u.useEffect(()=>{Y.length>0&&!H&&window.innerWidth>=1024&&Oe(Y[0].id)},[Y,H]);const E=u.useMemo(()=>Pt(q),[q]),je=u.useMemo(()=>It(T,E),[T,E]),lt=E.requiresPublic||E.securityClearance||E.multipleOpenings||E.onlyConfirmedSalary,Gt=lt||E.closingDate||E.travelMax||E.positionTypes,ct=u.useMemo(()=>Ws(je),[je]),dt=u.useMemo(()=>Us(je),[je]),Ht=u.useMemo(()=>Y.length===0?"":qs(Y.length,O.filter(o=>!we.includes(o)),ae),[Y.length,O,we,ae]),ce=u.useMemo(()=>ga(l),[l]),Ne=u.useMemo(()=>l?ma(l):[],[l]),Yt=u.useMemo(()=>new Set([...ce.map(({query:o})=>o),...Ne.map(({query:o})=>o)].map(o=>o.trim().toLowerCase())),[ce,Ne]),$e=N.trim().length>0&&!Yt.has(N.trim().toLowerCase()),ut=o=>{if(!o)return;const f=o.trim();if(ee.current=!0,We(f)){b(!0),X(pe(f)??"");return}X(pe(f)??f)};u.useEffect(()=>{if(ee.current||M)return;const o=kt({profile:l,lastSearchLocation:w==null?void 0:w.location,baseLocation:n||i});o&&X(o)},[l,n,i,w==null?void 0:w.location,M]);const Fe=async({keywordOverride:o,locationOverride:f,mode:k="manual"}={})=>{var B,Je;const y=(o??N).trim();if(!y){Ee("Please enter a job title, keywords, or skills to search.");return}F(y),qt(k),Pe(k==="recommended"?{query:y,location:(f==null?void 0:f.trim())||M.trim()||"Remote"}:null),P.current&&P.current.abort();const j=new AbortController;P.current=j,Le(!0),Ee(null),st(null),rt([]),zt(1),it(!0),Tt();try{const U=(B=f??M)==null?void 0:B.trim(),de=U?pe(U)??U:"",Te=We(U)||J,pt=Te||!de?void 0:de;de&&de!==M&&!We(U)&&X(de),$s({keyword:y,location:de,remoteOnly:Te,searchRadius:x,radiusUnit:D});const ue=y,fe=Xs(ue,l),xe=[],ye=new Map;let qe=!1,gt=0;for(let v=0;v<fe.length;v++){const K=fe[v];try{if(j.signal.aborted)return;const _=await ms({keyword:K,location:pt,remoteOnly:Te,sources:O,page:1,perPage:25,postedWithinDays:G,radius:x,radiusUnit:D});if(j.signal.aborted)return;if(xe.push(_),gt++,_.jobs.forEach(R=>{ye.has(R.id)||ye.set(R.id,R)}),!qe&&ye.size>=25){const R=Array.from(ye.values()),V=Ue(R,ue,l);ie(V.slice(0,25)),Le(!1),qe=!0}v<fe.length-1&&await new Promise(R=>{const V=setTimeout(R,500);j.signal.addEventListener("abort",()=>{clearTimeout(V),R(null)})})}catch(_){if(_.name==="AbortError")return;console.warn(`[JobSearch] Search failed for keyword "${K}":`,_),xe.push({jobs:[],failedSources:[]})}}if(fe.length>0&&gt===0)throw new Error("All search attempts failed. Please check your connection or try a different keyword.");const ft=Array.from(ye.values()),ne=Ue(ft,ue,l);st(((Je=xe.find(v=>v.upstreamNotice))==null?void 0:Je.upstreamNotice)??null);const Be=xe.flatMap(v=>v.failedSources||[]).filter((v,K,_)=>_.indexOf(v)===K);ve("job_search_performed",{query:ue,enhanced_keywords:fe.join(", "),location:pt,remote_only:Te,sources:O,posted_within_days:G,total_results:ne.length}),ie(ne),it(ne.length>=25),at(!0),Be.length>0&&rt(Be),requestAnimationFrame(()=>{var v;(v=W.current)==null||v.scrollIntoView({behavior:"smooth",block:"start"})}),l&&(la(v=>{ie(K=>K.map(R=>({...R,matchScore:v.get(R.id)??R.matchScore})).sort((R,V)=>(V.matchScore??0)-(R.matchScore??0)))}),ca(ft,ue,l));const xt=ne.filter(v=>(v.descriptionFull??v.descriptionSnippet??"").length<50&&!!v.applyUrl);xt.length>0&&hs(xt.slice(0,10).map(v=>({id:v.id,applyUrl:v.applyUrl||""}))).then(v=>{if(!v.length)return;const K=new Map(v.map(_=>[_.id,_]));ie(_=>{const R=_.map(V=>{const me=K.get(V.id);return me!=null&&me.description?{...V,title:me.title||V.title,descriptionFull:me.description,descriptionSnippet:me.description}:V});return Tt(),Ue(R,ue,l)})}).catch(()=>{});try{const v=xe.reduce((K,_)=>K+_.jobs.length,0);sessionStorage.setItem(h,JSON.stringify({jobs:ne,hasSearched:!0,failedSources:Be||[],page:1,hasMore:v>=25||ne.length>=25}))}catch(v){console.warn("Failed to save job search results to sessionStorage:",v)}}catch(U){if(U.name==="AbortError")return;Ee(U.message||"Failed to search jobs"),ie([]),at(!0)}finally{P.current===j&&(Le(!1),P.current=null)}},Vt=async o=>{o.preventDefault(),await Fe({mode:"manual"})};u.useEffect(()=>{if($.current)return;if(d!=null&&d.hasSearched){$.current=!0;return}if(!l||!ce.length||N.trim()||Q||te)return;$.current=!0;const[o]=ce,f={keyword:!0,location:!0}
3;ut(o.location),A(f);const k=window.setTimeout(()=>A({}),5e3);return Fe({keywordOverride:o.query,locationOverride:o.location,mode:"recommended"}),()=>{window.clearTimeout(k)}},[l,ce,d==null?void 0:d.hasSearched,N,Q,te]);const Xt=o=>{Oe(o.id)},mt=o=>{const f=Ke(Xe(o.title||""));m({type:"START_OVER"}),m({type:"SET_JOB_URL",payload:o.applyUrl}),m({type:"SET_SELECTED_JOB",payload:o}),ve("job_tailor_navigated",{job_title:f,company:o.company,source:o.source,match_score:o.matchScore});const k=`Job Title: ${f}
4Company: ${o.company}
5Location: ${o.locationText}
6${o.remote?"Remote: Yes":""}
7${o.salaryMin||o.salaryMax?`Salary: ${o.salaryMin?`$${o.salaryMin.toLocaleString()}`:""} ${o.salaryMax?`- $${o.salaryMax.toLocaleString()}`:""} ${o.salaryCurrency||"USD"}`:""}
8${o.employmentType?`Employment Type: ${o.employmentType}`:""}
9${o.postedAt?`Posted: ${new Date(o.postedAt).toLocaleDateString()}`:""}
10
11Description:
12${ps(o.descriptionFull||o.descriptionSnippet||"")}`;m({type:"SET_JOB_DESCRIPTION",payload:k}),s("/app/tailor",{state:{jobDescription:k,jobTitle:f,company:o.company}})};return t.jsxs(vs,{maxWidth:"lg",title:"Find Your Next Opportunity",description:"Search thousands of job postings from across the web",children:[t.jsx("form",{onSubmit:Vt,className:"pb-2",children:t.jsx("div",{className:"iconic-surface-soft p-4 md:p-8",children:t.jsxs("div",{className:"space-y-4 md:space-y-6",children:[t.jsxs("div",{className:"flex flex-col md:flex-row gap-2 md:gap-3",children:[t.jsxs("div",{className:"flex-[1.2] min-w-0",children:[t.jsxs("div",{className:"flex items-center justify-between mb-1 md:mb-2",children:[t.jsx("label",{htmlFor:"job-search-query",className:"block text-sm font-semibold text-gray-700 dark:text-slate-300",children:"What job are you looking for?"}),S.keyword&&t.jsxs("span",{className:"text-xs text-blue-600 dark:text-blue-400 font-medium flex items-center gap-1 animate-fade-in",children:[t.jsx("span",{className:"h-1 w-2 rounded-full bg-blue-500 animate-pulse"}),"From Career Diary"]})]}),t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none",children:t.jsx(bt,{className:"h-5 w-5 text-gray-400"})}),t.jsx("input",{id:"job-search-query",name:"job-search-query",type:"text",value:N,onChange:o=>{F(o.target.value),S.keyword&&A(f=>({...f,keyword:!1}))},placeholder:"Job title, keywords, or skills...",autoComplete:"off","data-autocomplete":"off","aria-label":"Job title, keywords, or skills",className:"w-full min-w-0 pl-12 pr-4 py-3 text-base border border-gray-200 dark:border-slate-600 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white/50 dark:bg-slate-800/50 backdrop-blur-sm text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-slate-400 transition-all hover:bg-white dark:hover:bg-slate-800"})]})]}),t.jsxs("div",{className:"flex-[0.9] min-w-0",children:[t.jsxs("div",{className:"flex items-center justify-between mb-1 md:mb-2",children:[t.jsx("label",{htmlFor:"job-location",className:"block text-sm font-semibold text-gray-700 dark:text-slate-300",children:"Where?"}),S.location&&t.jsxs("span",{className:"text-xs text-blue-600 dark:text-blue-400 font-medium flex items-center gap-1 animate-fade-in",children:[t.jsx("span",{className:"h-1 w-2 rounded-full bg-blue-500 animate-pulse"}),"From Career Diary"]})]}),t.jsx(Rs,{value:M,onChange:o=>{ee.current=!0,X(o),S.location&&A(f=>({...f,location:!1}))},placeholder:"City, State, ZIP code, or Remote",id:"job-location",name:"job-location",showUseMyLocation:!0,disabled:J,className:"w-full min-w-0 py-3 text-base border border-gray-200 dark:border-slate-600 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white/50 dark:bg-slate-800/50 backdrop-blur-sm text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-slate-400 transition-all hover:bg-white dark:hover:bg-slate-800"})]}),t.jsx("div",{className:"flex items-end pb-0",children:t.jsx(z,{type:"submit",disabled:te,loading:te,variant:"primary",size:"lg",leftIcon:t.jsx(bt,{className:"h-5 w-5"}),className:"w-full md:w-auto md:shrink-0 min-w-[140px] h-12 text-base font-semibold shadow-lg hover:shadow-xl transition-all",children:te?Bt:"Search Jobs"})})]}),t.jsxs("button",{type:"button",onClick:()=>Kt(!Se),className:"md:hidden flex items-center justify-between w-full text-sm font-semibold text-gray-600 dark:text-slate-300 pt-2","aria-expanded":Se,children:[t.jsxs("span",{children:["Filters",J||G?" • Active":""]}),t.jsx(vt,{className:`h-4 w-4 transition-transform ${Se?"rotate-180":""}`})]}),t.jsxs("div",{className:`${Se?"flex":"hidden"} md:flex flex-wrap items-center gap-4 pt-4 border-t border-gray-200 dark:border-slate-700`,children:[t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",children:[t.jsx("input",{type:"checkbox",checked:J,onChange:o=>b(o.target.checked),className:"w-4 h-4 text-blue-600 border border-gray-300 dark:border-slate-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 cursor-pointer transition-all"}),t.jsx("span",{className:"text-sm font-semibold text-gray-700 dark:text-slate-300 group-hover:text-blue-600 dar
12k:group-hover:text-blue-400 transition-colors whitespace-nowrap",children:"Remote only"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("label",{htmlFor:"posted-within",className:"text-sm font-semibold text-gray-700 dark:text-slate-300 whitespace-nowrap",children:"Posted:"}),t.jsxs("select",{id:"posted-within",value:G||"",onChange:o=>oe(o.target.value?Number(o.target.value):void 0),className:"px-3 py-2 text-sm border border-gray-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all cursor-pointer min-w-[120px]",children:[t.jsx("option",{value:"",children:"Any time"}),t.jsx("option",{value:"1",children:"Last 24 hours"}),t.jsx("option",{value:"7",children:"Last 7 days"}),t.jsx("option",{value:"30",children:"Last 30 days"})]})]}),!J&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("label",{htmlFor:"search-radius",className:"text-sm font-semibold text-gray-700 dark:text-slate-300 whitespace-nowrap",children:"Within:"}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{id:"search-radius",type:"number",min:"0.1",max:"1000",step:"0.1",value:x,onChange:o=>{const f=parseFloat(o.target.value);!isNaN(f)&&f>=.1?I(f):(o.target.value===""||f===0)&&I(.1)},disabled:!M,className:"w-20 px-2 py-2 text-sm border border-gray-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all disabled:opacity-50 disabled:cursor-not-allowed"}),t.jsxs("div",{className:"flex items-center border border-gray-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 overflow-hidden h-9",children:[t.jsx(z,{type:"button",onClick:()=>ge("miles"),disabled:!M,variant:D==="miles"?"primary":"ghost",size:"sm",className:`px-2 py-0 h-full rounded-none font-semibold transition-all border-none ${D==="miles"?"bg-blue-600 text-white hover:bg-blue-700":"text-gray-600 dark:text-slate-300 hover:bg-gray-100 dark:hover:bg-slate-700"}`,children:"mi"}),t.jsx(z,{type:"button",onClick:()=>ge("km"),disabled:!M,variant:D==="km"?"primary":"ghost",size:"sm",className:`px-2 py-0 h-full rounded-none font-semibold transition-all border-l border-gray-300 dark:border-slate-600 border-none ${D==="km"?"bg-blue-600 text-white hover:bg-blue-700":"text-gray-600 dark:text-slate-300 hover:bg-gray-100 dark:hover:bg-slate-700"}`,children:"km"})]})]})]})]}),!L&&t.jsxs("div",{className:"hidden md:flex items-start gap-4 p-5 rounded-xl border transition-all duration-base mt-4",style:{background:"rgba(59, 130, 246, 0.05)",borderColor:"rgba(59, 130, 246, 0.2)"},children:[t.jsx(wt,{className:"w-6 h-6 mt-0.5 shrink-0 text-[var(--color-accent)]"}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-sm font-bold mb-1 text-[var(--color-accent)]",children:"Pro Tip: Raise Your Match Probability"}),t.jsx("p",{className:"text-xs leading-relaxed text-[var(--text-secondary)]",children:"Our AI analyzes your Career Diary and calculates a match probability for each job. Tailoring your resume to each specific role surfaces the most relevant experience and keywords for that posting — so recruiters and ATS see your best-fit case first."})]}),t.jsx("button",{type:"button","aria-label":"Dismiss tip",onClick:()=>{xa(),C(!0)},className:"shrink-0 rounded p-1 text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:t.jsx(Ge,{className:"w-4 h-4"})})]})]})})}),De&&t.jsx("p",{className:"text-red-600 dark:text-red-400 text-center",children:De}),!De&&tt&&t.jsx("p",{className:"text-amber-700 dark:text-amber-400 text-center text-sm",children:tt}),Ne.length>0&&t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"flex items-center justify-between gap-3",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-semibold text-gray-700 dark:text-slate-200",children:$e?"More profile-based searches":"Recommended searches"}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400",children:$e?"These are still based on your profile if you want to switch back.":"Jump between searches built from your target roles and experience."})]})}),t.jsx("div",{className:"flex flex-wrap gap-2",children:Ne.map(o=>{const f=o.query.trim().toLowerCase()===N.trim().toLowerCase(),k=ce.find(({query:y})=>y.trim().toLowerCase()===o.query.trim().toLowerCase());return t.jsxs("button",{type:"button",onClick:()=>{const y=(k==null?void 0:k.location)||M||void 0;y&&ut(y),Fe({keywordOverride:o.query,locationOverride:typeof y=="string"?y:void 0,mode:"recommended"})},title:o.reason,className:`inline-flex shrink-0 items-center gap-1.5 rounded-full border px-3 py-2 text-sm font-medium transition-colors ${f?"border-blue-600 bg-blue-600 text-white shadow-sm":$e?"border-gray-200 bg-white text-gray-600 hover:border-blue-300 hover:text-blue-700 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300 dark:hover:border-blue-500 dark:hover:text-blue-300":"border-blue-200 bg-blue-50 text-blue-700 hover:bg-blue-100 dar
12k:border-blue-800 dark:bg-blue-900/30 dark:text-blue-300 dark:hover:bg-blue-900/40"}`,children:[o.query,(k==null?void 0:k.location)&&t.jsx("span",{className:`text-xs ${f?"text-blue-100":"opacity-60"}`,children:k.location})]},o.query)})})]}),Re==="recommended"&&le&&Q&&q.length>0&&t.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3 rounded-2xl border border-blue-200 bg-blue-50/80 px-4 py-3 text-sm text-blue-900 dark:border-blue-900 dark:bg-blue-950/40 dark:text-blue-100",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(wt,{className:"h-4 w-4 shrink-0"}),t.jsxs("span",{children:["Showing recommended jobs based on your profile for ",t.jsx("strong",{children:le.query}),le.location?` in ${le.location}`:"","."]})]}),t.jsx("button",{type:"button",onClick:()=>Pe(null),className:"text-sm font-semibold text-blue-700 underline underline-offset-2 hover:text-blue-900 dark:text-blue-300 dark:hover:text-blue-100",children:"Dismiss"})]}),Q&&q.length>0&&Gt&&t.jsxs("div",{className:"space-y-3",children:[t.jsxs(z,{onClick:()=>Ut(!_e),variant:"ghost",size:"sm",className:"text-[var(--color-accent)] hover:text-[var(--color-accent-subtle)]",children:[t.jsx("span",{children:"Advanced Filters"}),ct>0&&t.jsx("span",{className:"bg-[var(--color-accent)]/10 text-[var(--color-accent)] px-2 py-0.5 rounded-full text-xs font-bold ml-2",children:ct}),t.jsx(vt,{className:`h-4 w-4 transition-transform ${_e?"rotate-180":""}`})]}),dt.length>0&&t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[dt.map((o,f)=>t.jsxs("span",{className:"inline-flex items-center gap-1 bg-[var(--color-accent)]/10 text-[var(--color-accent)] px-3 py-1 rounded-full text-xs font-medium",children:[o,t.jsx(z,{onClick:()=>{Z({...T,closingDate:"any",travelMax:void 0,positionTypes:[]})},variant:"ghost",size:"sm",className:"hover:bg-[var(--color-accent)]/20 rounded-full p-0.5 h-auto w-auto min-w-0","aria-label":"Remove filter",children:t.jsx(Ge,{className:"h-3 w-3"})})]},`filter-${o}-${f}`)),t.jsx(z,{onClick:()=>Z({closingDate:"any",travelMax:void 0,positionTypes:[]}),variant:"ghost",size:"sm",className:"text-xs underline",children:"Clear all"})]}),_e&&t.jsxs(cs,{variant:"soft",padding:"sm",className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[E.closingDate&&t.jsxs("div",{children:[t.jsx("label",{className:"iconic-input-label",children:"Application Deadline"}),t.jsxs("select",{value:T.closingDate||"any",onChange:o=>Z({...T,closingDate:o.target.value}),className:"iconic-input text-sm",children:[t.jsx("option",{value:"any",children:"Any time"}),t.jsx("option",{value:"today",children:"Closes today"}),t.jsx("option",{value:"this-week",children:"This week (7 days)"}),t.jsx("option",{value:"this-month",children:"This month (30 days)"})]})]}),E.travelMax&&t.jsxs("div",{children:[t.jsx("label",{className:"iconic-input-label",children:"Max Travel"}),t.jsxs("select",{value:T.travelMax??"",onChange:o=>Z({...T,travelMax:o.target.value?Number(o.target.value):void 0}),className:"iconic-input text-sm",children:[t.jsx("option",{value:"",children:"Any"}),t.jsx("option",{value:"0",children:"No travel"}),t.jsx("option",{value:"10",children:"≤ 10%"}),t.jsx("option",{value:"25",children:"≤ 25%"}),t.jsx("option",{value:"50",children:"≤ 50%"})]})]}),E.positionTypes&&t.jsxs("div",{children:[t.jsx("label",{className:"iconic-input-label",children:"Employment Type"}),t.jsx("div",{className:"space-y-2",children:["Full-time","Part-time","Contract","Internship"].map(o=>{var f;return t.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text-primary)]",children:[t.jsx("input",{type:"checkbox",checked:((f=T.positionTypes)==null?void 0:f.includes(o))||!1,onChange:k=>{const y=T.positionTypes||[],j=k.target.checked?[...y,o]:y.filter(B=>B!==o);Z({...T,positionTypes:j})},className:"rounded border-[var(--border-default)] text-[var(--color-accent)] focus:ring-[var(--color-accent)]"}),o]},o)})})]})]}),lt&&t.jsxs("div",{className:"border-t border-[var(--border-default)] pt-4",children:[t.jsx("label",{className:"block text-sm font-semibold text-[var(--text-primary)] mb-3",children:"Eligibility & Requirements"}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[E.requiresPublic&&t.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text-primary)]",children:[t.jsx("input",{type:"checkbox",checked:T.requiresPublic||!1,onChange:o=>Z({...T,requiresPublic:o.target.checked}),className:"rounded border-[var(--border-default)] text-[var(--color-accent)] focu
12s:ring-[var(--color-accent)]"}),"Open to public"]}),E.securityClearance&&t.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text-primary)]",children:[t.jsx("input",{type:"checkbox",checked:T.requiresNoSecurityClearance||!1,onChange:o=>Z({...T,requiresNoSecurityClearance:o.target.checked}),className:"rounded border-[var(--border-default)] text-[var(--color-accent)] focus:ring-[var(--color-accent)]"}),"No security clearance required"]}),E.multipleOpenings&&t.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text-primary)]",children:[t.jsx("input",{type:"checkbox",checked:T.multipleOpenings||!1,onChange:o=>Z({...T,multipleOpenings:o.target.checked}),className:"rounded border-[var(--border-default)] text-[var(--color-accent)] focus:ring-[var(--color-accent)]"}),"Multiple openings (2+)"]}),E.onlyConfirmedSalary&&t.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text-primary)]",children:[t.jsx("input",{type:"checkbox",checked:T.onlyConfirmedSalary||!1,onChange:o=>Z({...T,onlyConfirmedSalary:o.target.checked}),className:"rounded border-[var(--border-default)] text-[var(--color-accent)] focus:ring-[var(--color-accent)]"}),"Confirmed salary only (no estimates)"]})]})]})]})]}),t.jsxs("div",{ref:W,className:"space-y-4 min-h-[200px]",children:[!Q&&!te&&t.jsx(bs,{surface:"job_search",tease:p}),!te&&Q&&q.length===0&&t.jsxs("div",{className:"text-center py-10",children:[t.jsx("p",{className:"font-semibold text-gray-700 dark:text-slate-200",children:"No Jobs Found"}),t.jsx("p",{className:"text-gray-500 dark:text-slate-400",children:"Try broadening your search or removing filters."})]}),Y.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(Cs,{keyword:N,location:M,isGuest:a||!e}),t.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pb-3 border-b dark:border-slate-700",children:[t.jsxs("div",{children:[t.jsxs("h3",{className:"text-xl font-semibold text-gray-800 dark:text-slate-100",children:[Y.length," ",Y.length===1?"Job":"Jobs"," Found"]}),t.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 mt-1",children:Ht})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("select",{value:ae,onChange:o=>Wt(o.target.value),className:"p-2 pr-8 border border-gray-300 dark:border-slate-600 rounded-lg text-sm bg-white dark:bg-slate-700 dark:text-white focus:ring-2 focus:ring-blue-500",children:Rt.map(o=>t.jsx("option",{value:o.value,children:o.label},o.value))}),t.jsxs("div",{className:"flex items-center gap-1 p-1 bg-gray-100 dark:bg-slate-800 rounded-lg h-9",children:[t.jsx(z,{onClick:()=>Ie("list"),variant:"ghost",size:"sm",className:`p-2 rounded transition-colors h-full border-none ${re==="list"?"bg-white dark:bg-slate-700 text-blue-600 dark:text-blue-400 shadow-sm hover:bg-white dark:hover:bg-slate-700":"text-gray-500 dark:text-slate-400 hover:text-gray-700 dark:hover:text-slate-300"}`,title:"List view",children:t.jsx(ds,{className:"h-5 w-5"})}),t.jsx(z,{onClick:()=>Ie("grid"),variant:"ghost",size:"sm",className:`p-2 rounded transition-colors h-full border-none ${re==="grid"?"bg-white dark:bg-slate-700 text-blue-600 dark:text-blue-400 shadow-sm hover:bg-white dark:hover:bg-slate-700":"text-gray-500 dark:text-slate-400 hover:text-gray-700 dark:hover:text-slate-300"}`,title:"Grid view",children:t.jsx(us,{className:"h-5 w-5"})})]})]})]}),t.jsxs("div",{className:"flex flex-col lg:flex-row border-t dark:border-slate-700 mt-4 lg:h-[calc(100vh-200px)] lg:min-h-[400px]",children:[t.jsx("div",{className:`
13                                w-full lg:w-2/5 flex-shrink-0 overflow-y-auto border-r dark:border-slate-700
14                                ${H&&window.innerWidth<1024?"hidden":"block"}
15                                lg:max-h-full max-h-[50vh]
16                            `,children:t.jsx("div",{className:re==="grid"?"grid grid-cols-1 gap-4 p-4":"flex flex-col",children:Y.map((o,f)=>t.jsx(xs,{job:o,onSelect:Xt,viewMode:re,variant:re==="list"?"compact":"default",isSelected:H===o.id},`${o.id}-${f}`))})}),t.jsx("div",{className:"hidden lg:block lg:w-3/5 bg-white dark:bg-slate-900 overflow-y-auto",children:ke?t.jsx(At,{job:ke,onTailor:mt,searchQuery:N}):t.jsx("div",{className:"h-full flex items-center justify-center text-gray-500 dark:text-slate-400",children:t.jsx("p",{children:"Select a job to view details"})})}),H&&ke&&t.jsx(Ts,{job:ke,onClose:()=>Oe(null),onTailor:mt,searchQuery:N,isOpen:!!H})]})]}),te&&t.jsxs("div",{className:"space-y-4",children:[t.jsx("p",{className:"text-center text-lg font-semibold text-[var(--text-primary)] mb-6",children:"Finding the best jobs for you..."}),t.jsx(Ns,{count:5})]})]})]})},Ra=()=>{const e=Ct(),{session:a,isGuest:s}=gs(),{dispatch:r}=Ye();fs({title:"Job Search - Find Jobs | CareerDiary",description:"Search and discover job opportunities. Save listings, track applications, and tailor your resume for every role.",canonical:"https://careerdiary.io/app/search"});const n=()=>{e("/app/tailor")},i=()=>{Ve.removeItem("careerdiary_is_guest").catch(()=>{}),r({type:"SET_GUEST",payload:!1}),e("/")};return t.jsx(ya,{onNavigateToProfile:n,session:a,isGuest:s,onInitiateAuth:i})};export{Ra as JobSearchPage};

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.