(function(){function e(s){return s.replace(/\s+\n/g,`
`).replace(/[ \t]+/g," ").replace(/\n{3,}/g,`

`).trim()}function t(s){return s?s.innerText??s.textContent??"":""}function u(s){let i;for(const c of s){const r=e(t(c));if(r.length<200)continue;const l=/岗位职责|任职要求|职位描述|工作职责|工作内容|工作描述|职责描述|主要职责|岗位描述|岗位要求|技能要求|工作要求|能力要求|职位要求|任职条件|你将负责|我们需要|Responsibilities|Requirements|What you will do|What you.ll do|Qualifications|Job Description|Key Responsibilities|Essential Duties|About the Role|About the Job|Required Skills|Preferred Qualifications|Minimum Qualifications|Duties and Responsibilities|You will be responsible|Must.Have|Nice.to.Have/i.test(r)?300:0,p=r.length+l;(!i||p>i.score)&&(i={el:c,score:p,text:r})}return i?.text??""}function C(){const s=location.href,i=location.hostname.replace(/^www\./,""),c={url:s,domain:i,title:document.title?.slice(0,120)};if(/zhipin\.com$/.test(i)){const d=/\/web\/geek\/jobs/.test(location.pathname);if(/\/gongsi\/job\//.test(location.pathname)){const q=e(t(document.querySelector('.job-title, .position-name, .job-name, h1, [class*="job-title"], [class*="job-name"], [class*="position-name"]'))),k=e(t(document.querySelector('.company-name, [class*="company-name"], .sidebar-company-name')))||void 0,h=e(t(document.querySelector('[class*="job-detail"]')))||e(t(document.querySelector("#content")))||e(t(document.querySelector('[class*="detail"], [class*="description"], [class*="job-desc"], [class*="job-detail"], [class*="position-info"], [class*="job-info"]')))||(()=>{const T=Array.from(document.querySelectorAll('.job-sec-text, .job-sec .text, [class*="job-sec"]'));return T.length>0?e(T.map(y=>t(y)).join(`

`)):""})()||(()=>{let y=document.querySelector('.job-title, .position-name, .job-name, h1, [class*="job-title"], [class*="position-name"]')??null;for(let x=0;x<10&&(y=y?.parentElement??null,!!y);x++){const A=e(t(y));if(A.length>=300)return A}return""})()||u(Array.from(document.querySelectorAll("main, article, section, div"))),g=q||c.title,E=g?`职位：${g}

${h}`:h;return{...c,title:g,company:k,jdText:E,source:"boss-zhipin",confidence:h.length>500?.9:h.length>200?.7:.4}}const o=(d?document.querySelector('.job-detail-box, .detail-box, .job-detail-card, [class*="job-detail"][class*="box"], .recommend-job-detail, .detail-main, .job-detail-main'):null)??document,a=e(t(o.querySelector('.job-title, .position-name, .job-name, [class*="job-name"], [class*="job-title"], [class*="position-name"]')))||e(t(document.querySelector("h1"))),f=e(t(o.querySelector('.company-name, .company-info a, [class*="company-name"]')))||void 0,j=Array.from(o.querySelectorAll(".job-sec-text, .job-sec .text")),b=j.length>0?e(j.map(q=>t(q)).join(`

`)):e(t(o.querySelector(".job-sec-text, .job-detail-section, .desc")))||u(Array.from(o.querySelectorAll(".job-sec, .detail-section, main, article"))),S=a||c.title,_=S?`职位：${S}

${b}`:b;return{...c,title:S,company:f,jdText:_,source:"boss-zhipin",confidence:b.length>500?.9:b.length>200?.7:.4}}if(/xiaoyuan\.zhaopin\.com$/.test(i)){const d=e(t(document.querySelector('h1,[class*="job-title"],[class*="position-name"]'))),m=e(t(document.querySelector('[class*="company-name"],[class*="company"] a,a[href*="company"]')))||void 0,n=Array.from(document.querySelectorAll(".job-info__desc")),o=n.length>0?e(n.map(j=>t(j)).join(`

`)):e(t(document.querySelector('.main-body__block, [class*="job-info"], [class*="job-desc"]')))||u(Array.from(document.querySelectorAll("main, article, section"))),a=d||c.title,f=a?`职位：${a}

${o}`:o;return{...c,title:a,company:m,jdText:f,source:"zhaopin",confidence:o.length>500?.9:o.length>200?.7:.4}}if(/zhaopin\.com$/.test(i)){const d=e(t(document.querySelector("h1")))||e(t(document.querySelector('[class*="jobName"],[class*="job-name"]'))),m=e(t(document.querySelector('[class*="company"],[class*="Company"],a[href*="company"]')))||void 0,n=e(t(document.querySelector('[class*="jobDetail"],[class*="job-detail"],[class*="detail-content"],main,article')))||u(Array.from(document.querySelectorAll('main, article, section, [class*="detail"]'))),o=d||c.title,a=o?`职位：${o}

${n}`:n;return{...c,title:o,company:m,jdText:a,source:"zhaopin",confidence:n.length>500?.9:n.length>200?.7:.4}}if(/51job\.com$/.test(i)){const d=e(t(document.querySelector("h1")))||e(t(document.querySelector('[class*="job-title"],[id*="jobname"]'))),m=e(t(document.querySelector('[class*="company"] a')))||e(t(document.querySelector('a[href*="company"]')))||void 0,n=e(t(document.querySelector('[class*="job_msg"],[class*="bmsg"],main,article')))||u(Array.from(document.querySelectorAll('[class*="job"],[class*="msg"],main,article,section'))),o=d||c.title,a=o?`职位：${o}

${n}`:n;return{...c,title:o,company:m,jdText:a,source:"51job",confidence:n.length>500?.9:n.length>200?.7:.4}}if(/linkedin\.com$/.test(i)&&/\/jobs\//.test(location.pathname)){const d=e(t(document.querySelector("h1")))||e(t(document.querySelector('[class*="job-details-jobs-unified-top-card__job-title"]'))),m=e(t(document.querySelector('[class*="job-details-jobs-unified-top-card__company-name"]')))||e(t(document.querySelector('a[href*="/company/"]')))||void 0,n=e(t(document.querySelector('[class*="jobs-description"],[class*="jobs-details"]')))||e(t(document.querySelector('[data-sdui-screen*="SemanticJobDetails"]')))||e(t(document.querySelector('[class*="show-more-less-html"]')))||e(t(document.querySelector("main, article")))||u(Array.from(document.querySelectorAll("main, article, section"))),o=d||c.title,a=o?`职位：${o}

${n}`:n;return{...c,title:o,company:m,jdText:a,source:"linkedin",confidence:n.length>600?.9:n.length>250?.7:.4}}if(/indeed\.com$/.test(i)){const d=e(t(document.querySelector('h2,[class*="title"]'))),m=e(t(document.querySelector('[class*="jobsearch-InlineCompanyRating"] a, [class*="jobsearch-CompanyInfoContainer"] a, [data-testid="inlineHeader-companyName"], [data-company-name]')))||void 0,n=e(t(document.querySelector('[class*="jobsearch-JobComponent-description"]')))||e(t(document.querySelector('[id^="jobDescriptionText"], [class*="jobsearch-jobDescriptionText"], [data-testid="jobDescription"], [class*="job-description"]')))||u(Array.from(document.querySelectorAll("main, article, section"))),o=d||c.title,a=o?`职位：${o}

${n}`:n;return{...c,title:o,company:m,jdText:a,source:"generic",confidence:n.length>500?.9:n.length>200?.7:.4}}const r=Array.from(document.querySelectorAll('main, article, [role="main"], section, .content, #content, [id*="content"], [class*="content"], [class*="detail"], [id*="detail"], [class*="description"], [class*="desc"], [id*="description"], [class*="job"], [id*="job"], [class*="position"], [id*="position"], [class*="jd"], [id*="jd"], [class*="requirement"], [class*="responsibility"], [class*="pageMain"], [class*="page-main"], [class*="main-content"]')),l=u(r),p=c.title||"",$=p?`职位：${p}

${l}`:l;return{...c,jdText:$,source:"generic",confidence:l.length>800?.75:l.length>250?.55:.2}}chrome.runtime.onMessage.addListener((s,i,c)=>{if(!s||typeof s!="object"||!("type"in s))return;const r=l=>c(l);if(s.type==="PING")return r({ok:!0,type:"PONG"}),!0;if(s.type==="JD_EXTRACT_REQUEST"){try{const l=C();r({ok:!0,type:"JD_EXTRACT_RESPONSE",job:l})}catch(l){r({ok:!1,error:l instanceof Error?l.message:"extract failed"})}return!0}return r({ok:!1,error:"Unsupported message type (content)."}),!0});
})()
