const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/cloudWorkspaceReports-Dmj54Z_p.js","assets/norm-f7iXVy-b.js","assets/appConfig-CDeG57c-.js","assets/jsx-runtime-CutOxEx1.js","assets/cloudWorkspaceClient-CCTm89GG.js","assets/preload-helper-DzyYoeor.js","assets/authSession-Dulxhbeq.js"])))=>i.map(i=>d[i]);
import{t as e}from"./preload-helper-DzyYoeor.js";import{r as t}from"./norm-f7iXVy-b.js";import{t as n}from"./resumeMatchCloudSummary-gxGVeodb.js";var r=`offer_lens_resume_report_session_v1_`,i=`RESUME_REPORT_SESSION_UPDATED_WEB`,a=()=>{try{if(typeof sessionStorage<`u`)return sessionStorage}catch{}try{if(typeof localStorage<`u`)return localStorage}catch{}return null},o=()=>{try{let e=String(globalThis?.location?.protocol||``).toLowerCase();if(!e||e===`chrome-extension:`||e===`moz-extension:`||e===`safari-extension:`)return!1;let t=String(globalThis?.location?.hostname||``).toLowerCase();return t===`127.0.0.1`||t===`localhost`||t===`::1`}catch{return!1}},s=()=>{try{let e=globalThis?.crypto;if(e?.randomUUID)return String(e.randomUUID())}catch{}return`${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`},c=async e=>new Promise(t=>{try{let n=chrome?.storage?.session;if(!n?.get)throw Error(`no_chrome_session_storage`);n.get({[e]:null},n=>t(n?.[e]??null));return}catch{}try{let n=a();if(!n)return t(null);let r=String(n.getItem(e)||``);if(!r)return t(null);t(JSON.parse(r));return}catch{}t(null)}),l=async(e,t)=>new Promise(n=>{try{let r=chrome?.storage?.session;if(!r?.set)throw Error(`no_chrome_session_storage`);r.set({[e]:t},()=>n());try{window.dispatchEvent(new CustomEvent(i,{detail:{key:e}}))}catch{}return}catch{}try{let n=a();n&&n.setItem(e,JSON.stringify(t))}catch{}try{window.dispatchEvent(new CustomEvent(i,{detail:{key:e}}))}catch{}n()}),u=async e=>{let n=Array.from(new Set((e||[]).map(t).filter(Boolean))).slice(0,5);if(n.length<1)throw Error(`need_at_least_1_job`);let i=s();return await l(`${r}${i}`,{type:`resume_match`,ids:n,createdAt:Date.now(),status:`new`,progress:1}),i},d=async(e,n)=>{let i=Array.from(new Set((e||[]).map(t).filter(Boolean))).slice(0,5);if(i.length<1)throw Error(`need_at_least_1_job`);let a=s();return await l(`${r}${a}`,{type:`optimize_resume`,ids:i,createdAt:Date.now(),status:`new`,progress:1,inputResume:String(n||``)}),a},f=async e=>{let t=String(e||``),n=s();return await l(`${r}${n}`,{type:`translate_resume`,ids:[],createdAt:Date.now(),status:`new`,progress:0,inputZh:t,out:{zh:t,to:`en`,text:``}}),n},p=async e=>{let n=t(e);if(!n)return null;let i=await c(`${r}${n}`);return!i||typeof i!=`object`||i.type!==`resume_match`&&i.type!==`optimize_resume`&&i.type!==`translate_resume`?null:(Array.isArray(i.ids)||(i.ids=[]),i)},m=async(i,a)=>{let s=t(i);if(!s)return;let u=`${r}${s}`,d=await c(u),f={...d&&typeof d==`object`?d:{},...a||{}};if(await l(u,f),!o())try{let t=d?.status,r=f?.status;if(r===`done`||r===`failed`||r&&r!==t){let t=f?.type===`optimize_resume`?`optimize_resume`:f?.type===`translate_resume`?`translate_resume`:`resume_match`,i=Array.isArray(f?.ids)?f.ids:[],a=t===`resume_match`?n({result:f?.out||null}):null,{cloudWorkspaceUpsertReport:o}=await e(async()=>{let{cloudWorkspaceUpsertReport:e}=await import(`./cloudWorkspaceReports-Dmj54Z_p.js`);return{cloudWorkspaceUpsertReport:e}},__vite__mapDeps([0,1,2,3,4,5,6]));o({id:s,reportType:t,title:t===`optimize_resume`?`简历优化报告`:t===`translate_resume`?`简历翻译报告`:`岗位匹配报告`,jobIds:i,status:r,progress:f?.progress,error:f?.error,summary:a})}}catch{}};export{i as RESUME_REPORT_SESSION_UPDATED_WEB,u as createResumeMatchReportSession,d as createResumeOptimizeReportSession,f as createResumeTranslateReportSession,p as readResumeReportSession,m as updateResumeReportSession};