1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/gcsStorageService-CfuPNSR4.js","assets/animation-CddyXVCz.js","assets/react-vendor-CbN3pvl2.js","assets/supabase-iKSPld20.js","assets/docgen-Bp8WKBAE.js","assets/query-DPqpbKNH.js","assets/documentCategorizationService-CgIkAT40.js","assets/portfolioService-BRz6BRcD.js","assets/ResumeTailorPage-CU5guW79.js","assets/tailorOutcome-9inHuXL0.js","assets/TransformationGaugeCompact-DA6af00s.js","assets/WriteBackOfferCard-BUKUjLaL.js","assets/writeBackOffers-CZMm9dHV.js","assets/clipboard-C0L7pyCw.js","assets/resumeFilename-4GdoQ0e6.js","assets/CreditMeter-n_-Z-ajw.js","assets/HandoffCard-Dfq3ahtQ.js","assets/handoffSuggestions-raELPsOv.js","assets/wittyMessages-DNDNm0CC.js","assets/extractTextFromPdf-DixXsE-x.js","assets/extractTextFromDocx-jYOE6Ej-.js","assets/SuccessAnimation-D8qDTGT3.js","assets/PageWrapper-BunOBjUW.js","assets/LocationAutocomplete-BN3Aw_CG.js","assets/JobSearchPage-CyZU0MSZ.js","assets/JobCard-DLJHd_A6.js","assets/JobDetailPanel-CXiO4exJ.js","assets/htmlEntities-97NJt3YN.js","assets/scoreSeverity-CZDyLV63.js","assets/PersonalizedEmptyState-DHLu2vFE.js","assets/CareerDiaryPage-X49wOAd_.js","assets/LocationInput-5wsh_pfJ.js","assets/downWeek-Dfl6cIKw.js","assets/loggedWin-C0wQo753.js","assets/CorpusManager-hyu7sh-i.js","assets/PublicPortfolioPageV2-CLnyVvLL.js","assets/EditorialLandingPage-D8CbLyn1.js","assets/PublicPricing-CgydVBvp.js","assets/billing-WrleG6pM.js","assets/EditorialLandingPage-0ElgHjvU.css","assets/AuthPage-C4zkbYET.js","assets/ReferralLandingPage-5R6E5KlK.js","assets/ApplicationTrackerPage-D1vu9Qb-.js","assets/calendarDate-C5srIsuk.js","assets/ResumeLibraryPage-CPfnc_Gp.js","assets/JobDetailPage-BL2sCZ6Z.js","assets/CoverLetterPage-Ih35fNAU.js","assets/SettingsPage-CkBpfUX7.js","assets/SectionHeader-HhrOkJ88.js","assets/ProfilePage-CZ8R0EDG.js","assets/PortfolioEditorPage-DpbnGrE6.js","assets/PortfolioSettingsPage-B-cJN_cm.js","assets/ProGate-BWEPDFOZ.js","assets/SavedJobsPage-a2vTVdb_.js","assets/index-PGJMoIYN.js","assets/DashboardDemo-q_u31AWG.js","assets/TailorResultPreview-BK65Lq2Z.js","assets/FirstRunPreview-ROWbuAP-.js","assets/NativeAuthPage-BDyBUq_U.js","assets/CareerGPSPage-ZODWO-mQ.js","assets/Tooltip-c3l9LscW.js","assets/ATSSimulatorPage-D2748nfU.js","assets/Progress-D4MzP_N8.js","assets/UsageBillingPage-DOd1h4VP.js","assets/InterviewPrepPage-D_XJhU9H.js","assets/LinkedInPage-ClxI2pYf.js","assets/CareerReadinessPage-DzYQHsDA.js","assets/PublicCareerScorePage-CAlDPROH.js","assets/UserGuidePage-B_EV2KFg.js","assets/ResumeHistoryPage-p60nxP8T.js","assets/PrivacyPolicyPage-3cFZb0Va.js","assets/aiDataFlow-B75SC8b6.js","assets/ExtensionPrivacyPage-BZviVdhm.js","assets/TermsOfServicePage-6nhMP905.js","assets/SupportPage-Bp5o0WmM.js","assets/PricingPage-CRp6m4sL.js","assets/AboutPage-C1FT0lbh.js","assets/AIResumeBuilderPage-BnuzojZi.js","assets/SEOLandingPageTemplate-jokKzSh8.js","assets/TailorResumeToJobPage-DoFxOpyo.js","assets/appSchema-DMOt1yDO.js","assets/ATSResumeCheckerPage-5aEnoKKy.js","assets/AtsScanTool-BqynyfqS.js","assets/ToolShareBlock-B18P20dM.js","assets/GuestWatchCard-Cwp22yth.js","assets/ResumeOrMarketPage-B97G37b5.js","assets/CareerAccomplishmentTrackerPage-DSTX3dkh.js","assets/JobApplicationTrackerPage-DA6bnTcl.js","assets/AICoverLetterGeneratorPage-DUYwmcQA.js","assets/ResumeMatchScorePage-k2ydCV5g.js","assets/CareerDiaryJournalPage-DI6024pZ.js","assets/WatchConfirmPage-Ldjpj-bO.js","assets/FreeResumeTailoringPage-D2cHoOb8.js","assets/JobscanAlternativePage-BaKgzGyL.js","assets/CompetitorAlternativePage-DtNNvLox.js","assets/TealAlternativePage-wojT0gtw.js","assets/ReziAlternativePage-Dl5Cte0J.js","assets/EnhancvAlternativePage-BPaHOzXk.js","assets/AtsCheckerSoftwareEngineerPage-DWCpfw13.js","assets/RoleAtsCheckerPage-Deg4l5UE.js","assets/AtsCheckerDataScientistPage-DRkR7VQz.js","assets/AtsCheckerProductManagerPage-Cr8wHAAO.js","assets/AtsCheckerDevopsEngineerPage-BoJwI8b3.js","assets/AtsCheckerConsultantPage-Dhp7IVxd.js","assets/AtsWorkdayPage-AHt3_zGO.js","assets/AtsSystemGuidePage-Dcw2E2ZQ.js","assets/AtsGreenhousePage-DUcNUYtJ.js","assets/AtsLeverPage-
1Do6g3yU3.js","assets/AtsTaleoPage-PrTSilAG.js","assets/ResumeParsingStudyPage-CoNfwvcT.js","assets/IsMyResumeAtsFriendlyPage-CVAPn9IJ.js","assets/AnswerPageTemplate-BqWkfR5k.js","assets/AtsResumeKeywordsPage-BO0r8K4L.js","assets/ResumeCheckerNoUploadPage-Dt1qqDVc.js","assets/AiResumeNoFakeExperiencePage-ka0TmFG2.js","assets/WhyDoesMyResumeLookWrongPage-D_ipRcUO.js","assets/BragDocumentPage-lzdSnKxY.js","assets/AccomplishmentLogPage-B8tcaafB.js","assets/WhatDoesAnAtsSeePage-DQyHII17.js","assets/ChatGptWroteMyResumePage-qbPFCQcc.js","assets/ResumeCheckerAfterAiRewritePage-DlUPhw4h.js","assets/FreeJobApplicationTrackerPage-BhKU_Pm8.js","assets/JobAlertsMatchedToResumePage-DOlP0bda.js","assets/KickresumeAlternativePage-B69nq6N7.js","assets/ResumeWordedAlternativePage-D6-h3F5t.js","assets/FeaturesHubPage-DpHuvblb.js","assets/ResumeTailoringFeaturePage-DaIXeGdS.js","assets/FeaturePage-BHFxja2O.js","assets/CareerDiaryFeaturePage-4Xfh-zUR.js","assets/ApplicationTrackerFeaturePage-j2tGwpdt.js","assets/CareerGpsFeaturePage-DLRIetDr.js","assets/AtsSimulatorFeaturePage-BpPKo0XA.js","assets/InterviewPrepFeaturePage-D7l5KZu8.js","assets/CareerScoreFeaturePage-CXp5NTpk.js","assets/CoverLettersFeaturePage-CYUG5kqq.js","assets/PortfolioFeaturePage-Dhrhh2Kw.js","assets/AppsFeaturePage-CyMSfF6h.js","assets/FounderDashboardPage-LRDVxbqK.js","assets/ReviewMemoriesModal-DQhYfIxs.js","assets/PendingMemoriesNotification-DR4J-vTK.js"])))=>i.map(i=>d[i]); 2var Lh=Object.defineProperty;var Ph=(e,t,n)=>t in e?Lh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Le=(e,t,n)=>Ph(e,typeof t!="symbol"?t+"":t,n);import{r as f,j as a,R as M}from"./animation-CddyXVCz.js";import{b as Oh,g as Dh}from"./react-vendor-CbN3pvl2.js";import{c as Mh}from"./supabase-iKSPld20.js";import{P as _s,T as xs,F as Uh,a as Fh}from"./docgen-Bp8WKBAE.js";import{Q as $h,a as Bh}from"./query-DPqpbKNH.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();var bs={},ll;function zh(){if(ll)return bs;ll=1;var e=Oh();return bs.createRoot=e.createRoot,bs.hydrateRoot=e.hydrateRoot,bs}var Gh=zh();const Hh=Dh(Gh),q=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,fe=globalThis,gn="10.48.0";function vn(){return Ro(fe),fe}function Ro(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||gn,t[gn]=t[gn]||{}}function qn(e,t,n=fe){const r=n.__SENTRY__=n.__SENTRY__||{},s=r[gn]=r[gn]||{};return s[e]||(s[e]=t())}const Wh=["debug","info","warn","error","log","assert","trace"],Jh="Sentry Logger ",oo={};function Tn(e){if(!("console"in fe))return e();const t=fe.console,n={},r=Object.keys(oo);r.forEach(s=>{const o=oo[s];n[s]=t[s],t[s]=o});try{return e()}finally{r.forEach(s=>{t[s]=n[s]})}}function Vh(){Hi().enabled=!0}function Yh(){Hi().enabled=!1}function $d(){return Hi().enabled}function qh(...e){Gi("log",...e)}function Kh(...e){Gi("warn",...e)}function Xh(...e){Gi("error",...e)}function Gi(e,...t){q&&$d()&&Tn(()=>{fe.console[e](`${Jh}[${e}]:`,...t)})}function Hi(){return q?qn("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const G={enable:Vh,disable:Yh,isEnabled:$d,log:qh,warn:Kh,error:Xh},Bd=50,Sn="?",ul=/\(error: (.*)\)/,dl=/captureMessage|captureException/;function zd(...e){const t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,s=0)=>{const o=[],i=n.split(` 3`);for(let c=r;c<i.length;c++){let l=i[c];l.length>1024&&(l=l.slice(0,1024));const u=ul.test(l)?l.replace(ul,"$1"):l;if(!u.includes("Error: ")){for(const d of t){const p=d(u);if(p){o.push(p);break}}if(o.length>=Bd+s)break}}return Qh(o.slice(s))}}function Zh(e){return Array.isArray(e)?zd(...e):e}function Qh(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(ws(t).function||"")&&t.pop(),t.reverse(),dl.test(ws(t).function||"")&&(t.pop(),dl.test(ws(t).function||"")&&t.pop()),t.slice(0,Bd).map(n=>({...n,filename:n.filename||ws(t).filename,function:n.function||Sn}))}function ws(e){return e[e.length-1]||{}}const ra="<anonymous>";function Dt(e){try{return!e||typeof e!="function"?ra:e.name||ra}catch{return ra}}function pl(e){const t=e.exception;if(t){const n=[];
3try{return t.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}function Gd(e){return"__v_isVNode"in e&&e.__v_isVNode?"[VueVNode]":"[VueViewModel]"}const Ds={},ml={};function nn(e,t){Ds[e]=Ds[e]||[],Ds[e].push(t)}function rn(e,t){if(!ml[e]){ml[e]=!0;try{t()}catch(n){q&&G.error(`Error while instrumenting ${e}`,n)}}}function ct(e,t){const n=e&&Ds[e];if(n)for(const r of n)try{r(t)}catch(s){q&&G.error(`Error while triggering instrumentation handler. 4Type: ${e} 5Name: ${Dt(r)} 6Error:`,s)}}let sa=null;function Hd(e){const t="error";nn(t,e),rn(t,eg)}function eg(){sa=fe.onerror,fe.onerror=function(e,t,n,r,s){return ct("error",{column:r,error:s,line:n,msg:e,url:t}),sa?sa.apply(this,arguments):!1},fe.onerror.__SENTRY_INSTRUMENTED__=!0}let oa=null;function Wd(e){const t="unhandledrejection";nn(t,e),rn(t,tg)}function tg(){oa=fe.onunhandledrejection,fe.onunhandledrejection=function(e){return ct("unhandledrejection",e),oa?oa.apply(this,arguments):!0},fe.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Jd=Object.prototype.toString;function Gr(e){switch(Jd.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Mt(e,Error)}}function Kn(e,t){return Jd.call(e)===`[object ${t}]`}function Vd(e){return Kn(e,"ErrorEvent")}function fl(e){return Kn(e,"DOMError")}function ng(e){return Kn(e,"DOMException")}function Lt(e){return Kn(e,"String")}function Wi(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function zn(e){return e===null||Wi(e)||typeof e!="object"&&typeof e!="function"}function vr(e){return Kn(e,"Object")}function ko(e){return typeof Event<"u"&&Mt(e,Event)}function rg(e){return typeof Element<"u"&&Mt(e,Element)}function sg(e){return Kn(e,"RegExp")}function Hr(e){return!!(e!=null&&e.then&&typeof e.then=="function")}function og(e){return vr(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function Mt(e,t){try{return e instanceof t}catch{return!1}}function Yd(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue||e.__v_isVNode))}function Ji(e){return typeof Request<"u"&&Mt(e,Request)}const Vi=fe,ag=80;function ut(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,s=[];let o=0,i=0;const c=" > ",l=c.length;let u;const d=Array.isArray(t)?t:t.keyAttrs,p=!Array.isArray(t)&&t.maxStringLength||ag;for(;n&&o++<r&&(u=ig(n,d),!(u==="html"||o>1&&i+s.length*l+u.length>=p));)s.push(u),i+=u.length,n=n.parentNode;return s.reverse().join(c)}catch{return"<unknown>"}}function ig(e,t){const n=e,r=[];if(!(n!=null&&n.tagName))return"";if(Vi.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const s=t!=null&&t.length?t.filter(o=>n.getAttribute(o)).map(o=>[o,n.getAttribute(o)]):null;if(s!=null&&s.length)s.forEach(o=>{r.push(`[${o[0]}="${o[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const o=n.className;if(o&&Lt(o)){const i=o.split(/\s+/);for(const c of i)r.push(`.${c}`)}}for(const o of["aria-label","type","name","title","alt"]){const i=n.getAttribute(o);i&&r.push(`[${o}="${i}"]`)}return r.join("")}function Wr(){try{return Vi.document.location.href}catch{return""}}function qd(e){if(!Vi.HTMLElement)return null;let t=e;const n=5;for(let r=0;r<n;r++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null}function tt(e,t,n){if(!(t in e))return;const r=e[t];if(typeof r!="function")return;const s=n(r);typeof s=="function"&&Kd(s,r);try{e[t]=s}catch{q&&G.log(`Failed to replace method "${t}" in object`,e)}}function Ze(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{q&&G.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Kd(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,Ze(e,"__sentry_original__",t)}catch{}}function Yi(e){return e.__sentry_original__}function Xd(e){if(Gr(e))return{message:e.message,name:e.name,stack:e.stack,...gl(e)};if(ko(e)){const t={type:e.type,target:hl(e.target),currentTarget:hl(e.currentTarget),...gl(e)};return typeof CustomEvent<"u"&&Mt(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function hl(e){try{return rg(e)?ut(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}
6function gl(e){return typeof e=="object"&&e!==null?Object.fromEntries(Object.entries(e)):{}}function cg(e){const t=Object.keys(Xd(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}let jn;function Jr(e){if(jn!==void 0)return jn?jn(e):e();const t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=fe;return t in n&&typeof n[t]=="function"?(jn=n[t],jn(e)):(jn=null,e())}function qt(){return Jr(()=>Math.random())}function Vr(){return Jr(()=>Date.now())}function Wa(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function yl(e,t){if(!Array.isArray(e))return"";const n=[];for(let r=0;r<e.length;r++){const s=e[r];try{Yd(s)?n.push(Gd(s)):n.push(String(s))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function Ms(e,t,n=!1){return Lt(e)?sg(t)?t.test(e):Lt(t)?n?e===t:e.includes(t):typeof t=="function"?t(e):!1:!1}function Kt(e,t=[],n=!1){return t.some(r=>Ms(e,r,n))}function lg(){const e=fe;return e.crypto||e.msCrypto}let aa;function ug(){return qt()*16}function lt(e=lg()){try{if(e!=null&&e.randomUUID)return Jr(()=>e.randomUUID()).replace(/-/g,"")}catch{}return aa||(aa="10000000100040008000"+1e11),aa.replace(/[018]/g,t=>(t^(ug()&15)>>t/4).toString(16))}function Zd(e){var t,n;return(n=(t=e.exception)==null?void 0:t.values)==null?void 0:n[0]}function fn(e){const{message:t,event_id:n}=e;if(t)return t;const r=Zd(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Ja(e,t,n){const r=e.exception=e.exception||{},s=r.values=r.values||[],o=s[0]=s[0]||{};o.value||(o.value=t||""),o.type||(o.type="Error")}function Gn(e,t){const n=Zd(e);if(!n)return;const r={type:"generic",handled:!0},s=n.mechanism;if(n.mechanism={...r,...s,...t},t&&"data"in t){const o={...s==null?void 0:s.data,...t.data};n.mechanism.data=o}}function _l(e){if(dg(e))return!0;try{Ze(e,"__sentry_captured__",!0)}catch{}return!1}function dg(e){try{return e.__sentry_captured__}catch{}}const Qd=1e3;function Cn(){return Vr()/Qd}function pg(){const{performance:e}=fe;if(!(e!=null&&e.now)||!e.timeOrigin)return Cn;const t=e.timeOrigin;return()=>(t+Jr(()=>e.now()))/Qd}let xl;function Fe(){return(xl??(xl=pg()))()}let ia=null;function mg(){var i;const{performance:e}=fe;if(!(e!=null&&e.now))return;const t=3e5,n=Jr(()=>e.now()),r=Vr(),s=e.timeOrigin;if(typeof s=="number"&&Math.abs(s+n-r)<t)return s;const o=(i=e.timing)==null?void 0:i.navigationStart;return typeof o=="number"&&Math.abs(o+n-r)<t?o:r-n}function dt(){return ia===null&&(ia=mg()),ia}function fg(e){const t=Fe(),n={sid:lt(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>gg(n)};return e&&Hn(n,e),n}function Hn(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||Fe(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:lt()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{const n=e.timestamp-e.started;e.duration=n>=0?n:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function hg(e,t){let n={};e.status==="ok"&&(n={status:"exited"}),Hn(e,n)}function gg(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did=="number"||typeof e.did=="string"?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}function Yr(e,t,n=2){if(!t||typeof t!="object"||n<=0)return t;if(e&&Object.keys(t).length===0)return e;const r={...e};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=Yr(r[s],t[s],n-1));return r}function Ut(){return lt()}function Pt(){return lt().substring(16)}const Va="_sentrySpan";function Tr(e,t){t?Ze(e,Va,t):delete e[Va]}function ao(e){return e[Va]}const yg=100;class vt{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Ut(),sampleRand:qt()}}clone(){const t=new vt;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,t._conversationId=this._conversationId,Tr(t,ao(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Hn(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(t){return this._conversationId=t||void 0,this._notifyScopeListeners(),this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,n){return this.setTags({[t]:n})}setAttributes(t){return this._attributes={...this._attributes,...t},this._notifyScopeListeners(),this}setAttribute(t,n){return this.setAttributes({[t]:n})}removeAttribute(t){return t in this._attributes&&(delete this._attributes[t],this._notifyScopeListeners()),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,n){return n===null?delete this._contexts[t]:this._contexts[t]=n,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const n=typeof t=="function"?t(this):t,r=n instanceof vt?n.getScopeData():vr(n)?t:void 0,{tags:s,attributes:o,extra:i,user:c,contexts:l,level:u,fingerprint:d=[],propagationContext:p,conversationId:m}=r||{};return this._tags={...this._tags,...s},this._attributes={...this._attributes,...o},this._extra={...this._extra,...i},this._contexts={...this._contexts,...l},c&&Object.keys(c).length&&(this._user=c),u&&(this._level=u),d.length&&(this._fingerprint=d),p&&(this._propagationContext=p),m&&(this._conversationId=m),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Tr(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Ut(),sampleRand:qt()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){var o;const r=typeof n=="number"?n:yg;if(r<=0)return this;const s={timestamp:Cn(),...t,message:t.message?Wa(t.message,2048):t.message};return this._breadcrumbs.push(s),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),(o=this._client)==null||o.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:ao(this),conversationId:this._conversationId}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Yr(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,n){const r=(n==null?void 0:n.event_id)||lt();if(!this._client)return q&&G.warn("No client configured on scope - will not capture exception!"),r;const s=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:s,...n,event_id:r},this),r}captureMessage(t,n,r){const s=(r==null?void 0:r.event_id)||lt();if(!this._client)return q&&G.warn("No client configured on scope - will not capture message!"),s;const o=(r==null?void 0:r.syntheticException)??new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:o,...r,event_id:s},this),s}
6captureEvent(t,n){const r=t.event_id||(n==null?void 0:n.event_id)||lt();return this._client?(this._client.captureEvent(t,{...n,event_id:r},this),r):(q&&G.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}}function _g(){return qn("defaultCurrentScope",()=>new vt)}function xg(){return qn("defaultIsolationScope",()=>new vt)}const bl=e=>e instanceof Promise&&!e[ep],ep=Symbol("chained PromiseLike"),bg=(e,t,n)=>{const r=e.then(s=>(t(s),s),s=>{throw n(s),s});return bl(r)&&bl(e)?r:wg(e,r)},wg=(e,t)=>{let n=!1;for(const r in e){if(r in t)continue;n=!0;const s=e[r];typeof s=="function"?Object.defineProperty(t,r,{value:(...o)=>s.apply(e,o),enumerable:!0,configurable:!0,writable:!0}):t[r]=s}return n&&Object.assign(t,{[ep]:!0}),t};class Sg{constructor(t,n){let r;t?r=t:r=new vt;let s;n?s=n:s=new vt,this._stack=[{scope:r}],this._isolationScope=s}withScope(t){const n=this._pushScope();let r;try{r=t(n)}catch(s){throw this._popScope(),s}return Hr(r)?bg(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Wn(){const e=vn(),t=Ro(e);return t.stack=t.stack||new Sg(_g(),xg())}function Eg(e){return Wn().withScope(e)}function vg(e,t){const n=Wn();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function wl(e){return Wn().withScope(()=>e(Wn().getIsolationScope()))}function Tg(){return{withIsolationScope:wl,withScope:Eg,withSetScope:vg,withSetIsolationScope:(e,t)=>wl(t),getCurrentScope:()=>Wn().getScope(),getIsolationScope:()=>Wn().getIsolationScope()}}function Xn(e){const t=Ro(e);return t.acs?t.acs:Tg()}function Se(){const e=vn();return Xn(e).getCurrentScope()}function st(){const e=vn();return Xn(e).getIsolationScope()}function Cg(){return qn("globalScope",()=>new vt)}function qr(...e){const t=vn(),n=Xn(t);if(e.length===2){const[r,s]=e;return r?n.withSetScope(r,s):n.withScope(s)}return n.withScope(e[0])}function he(){return Se().getClient()}function Ag(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:s}=t,o={trace_id:n,span_id:s||Pt()};return r&&(o.parent_span_id=r),o}const jt="sentry.source",qi="sentry.sample_rate",tp="sentry.previous_trace_sample_rate",Ft="sentry.op",$e="sentry.origin",Cr="sentry.idle_span_finish_reason",Kr="sentry.measurement_unit",Xr="sentry.measurement_value",Sl="sentry.custom_span_name",Ki="sentry.profile_id",Zn="sentry.exclusive_time",Ig="sentry.link.type",Rg="gen_ai.conversation.id",np=0,No=1,Me=2;function kg(e){if(e<400&&e>=100)return{code:No};if(e>=400&&e<500)switch(e){case 401:return{code:Me,message:"unauthenticated"};case 403:return{code:Me,message:"permission_denied"};case 404:return{code:Me,message:"not_found"};case 409:return{code:Me,message:"already_exists"};case 413:return{code:Me,message:"failed_precondition"};case 429:return{code:Me,message:"resource_exhausted"};case 499:return{code:Me,message:"cancelled"};default:return{code:Me,message:"invalid_argument"}}if(e>=500&&e<600)switch(e){case 501:return{code:Me,message:"unimplemented"};case 503:return{code:Me,message:"unavailable"};case 504:return{code:Me,message:"deadline_exceeded"};default:return{code:Me,message:"internal_error"}}return{code:Me,message:"internal_error"}}function rp(e,t){e.setAttribute("http.response.status_code",t);const n=kg(t);n.message!=="unknown_error"&&e.setStatus(n)}const sp="_sentryScope",op="_sentryIsolationScope";function Ng(e){try{const t=fe.WeakRef;if(typeof t=="function")return new t(e)}catch{}return e}function jg(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}function Lg(e,t,n){e&&(Ze(e,op,Ng(n)),Ze(e,sp,t))}function io(e){const t=e;return{scope:t[sp],isolationScope:jg(t[op])}}const co="sentry-",Pg=8192;function ap(e){const t=Dg(e);
6if(!t)return;const n=Object.entries(t).reduce((r,[s,o])=>{if(s.startsWith(co)){const i=s.slice(co.length);r[i]=o}return r},{});if(Object.keys(n).length>0)return n}function Og(e){if(!e)return;const t=Object.entries(e).reduce((n,[r,s])=>(s&&(n[`${co}${r}`]=s),n),{});return Mg(t)}function Dg(e){if(!(!e||!Lt(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,n)=>{const r=El(n);return Object.entries(r).forEach(([s,o])=>{t[s]=o}),t},{}):El(e)}function El(e){return e.split(",").map(t=>{const n=t.indexOf("=");if(n===-1)return[];const r=t.slice(0,n),s=t.slice(n+1);return[r,s].map(o=>{try{return decodeURIComponent(o.trim())}catch{return}})}).reduce((t,[n,r])=>(n&&r&&(t[n]=r),t),{})}function Mg(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((t,[n,r],s)=>{const o=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,i=s===0?o:`${t},${o}`;return i.length>Pg?(q&&G.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),t):i},"")}const Ug=/^o(\d+)\./,Fg=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function $g(e){return e==="http"||e==="https"}function An(e,t=!1){const{host:n,path:r,pass:s,port:o,projectId:i,protocol:c,publicKey:l}=e;return`${c}://${l}${t&&s?`:${s}`:""}@${n}${o?`:${o}`:""}/${r&&`${r}/`}${i}`}function Bg(e){const t=Fg.exec(e);if(!t){Tn(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}const[n,r,s="",o="",i="",c=""]=t.slice(1);let l="",u=c;const d=u.split("/");if(d.length>1&&(l=d.slice(0,-1).join("/"),u=d.pop()),u){const p=u.match(/^\d+/);p&&(u=p[0])}return ip({host:o,pass:s,path:l,projectId:u,port:i,protocol:n,publicKey:r})}function ip(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function zg(e){if(!q)return!0;const{port:t,projectId:n,protocol:r}=e;return["protocol","publicKey","host","projectId"].find(i=>e[i]?!1:(G.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:n.match(/^\d+$/)?$g(r)?t&&isNaN(parseInt(t,10))?(G.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(G.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(G.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Gg(e){const t=e.match(Ug);return t==null?void 0:t[1]}function Hg(e){const t=e.getOptions(),{host:n}=e.getDsn()||{};let r;return t.orgId?r=String(t.orgId):n&&(r=Gg(n)),r}function cp(e){const t=typeof e=="string"?Bg(e):ip(e);if(!(!t||!zg(t)))return t}function Ar(e){if(typeof e=="boolean")return Number(e);const t=typeof e=="string"?parseFloat(e):e;if(!(typeof t!="number"||isNaN(t)||t<0||t>1))return t}const lp=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function Wg(e){if(!e)return;const t=e.match(lp);if(!t)return;let n;return t[3]==="1"?n=!0:t[3]==="0"&&(n=!1),{traceId:t[1],parentSampled:n,parentSpanId:t[2]}}function Jg(e,t){const n=Wg(e),r=ap(t);if(!(n!=null&&n.traceId))return{traceId:Ut(),sampleRand:qt()};const s=Vg(n,r);r&&(r.sample_rand=s.toString());const{traceId:o,parentSpanId:i,parentSampled:c}=n;return{traceId:o,parentSpanId:i,sampled:c,dsc:r||{},sampleRand:s}}function up(e=Ut(),t=Pt(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${e}-${t}${r}`}function dp(e=Ut(),t=Pt(),n){return`00-${e}-${t}-${n?"01":"00"}`}function Vg(e,t){const n=Ar(t==null?void 0:t.sample_rand);if(n!==void 0)return n;const r=Ar(t==null?void 0:t.sample_rate);return r&&(e==null?void 0:e.parentSampled)!==void 0?e.parentSampled?qt()*r:r+qt()*(1-r):qt()}const pp=0,jo=1;let vl=!1;function Yg(e){const{spanId:t,traceId:n}=e.spanContext(),{data:r,op:s,parent_span_id:o,status:i,origin:c,links:l}=ye(e);return{parent_span_id:o,span_id:t,trace_id:n,data:r,op:s,status:i,origin:c,links:l}}function qg(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),s=r?t:ye(e).parent_span_id,o=io(e).scope,i=r?(o==null?void 0:o.getPropagationContext().propagationSpanId)||Pt():t;return{parent_span_id:s,span_id:i,trace_id:n}}function Kg(e){const{traceId:t,spanId:n}=e.spanContext(),r=sn(e);return up(t,n,r)}function Xg(e){const{traceId:t,spanId:n}=e.spanContext(),r=sn(e);return dp(t,n,r)}function mp(e){if(e&&e.length>0)return e.map(({context:{spanId:t,traceId:n,traceFlags:r,...s},attributes:o})=>({span_id:t,trace_id:n,sampled:r===jo,attributes:o,...s}))}function Zg(e){if(e!=null&&e.length)return e.map(({context:{spanId:t,traceId:n,traceFlags:r},attributes:s})=>({span_id:t,trace_id:n,sampled:r===jo,attributes:s}))}function yn(e){return typeof e=="number"?Tl(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Tl(e.getTime()):Fe()}function Tl(e){return e>9999999999?e/1e3:e}function ye(e){if(ty(e))return e.getSpanJSON();const{spanId:t,traceId:n}=e.spanContext();if(ey(e)){const{attributes:r,startTime:s,name:o,endTime:i,status:c,links:l}=e;return{span_id:t,trace_id:n,data:r,description:o,parent_span_id:Qg(e),start_timestamp:yn(s),timestamp:yn(i)||void 0,status:fp(c),op:r[Ft],origin:r[$e],links:mp(l)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Qg(e){var t;return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?(t=e.parentSpanContext)==null?void 0:t.spanId:void 0}function ey(e){const t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function ty(e){return typeof e.getSpanJSON=="function"}function sn(e){const{traceFlags:t}=e.spanContext();return t===jo}function fp(e){if(!(!e||e.code===np))return e.code===No?"ok":e.message||"internal_error"}function ny(e){return!e||e.code===No||e.code===np||e.message==="cancelled"?"ok":"error"}const _n="_sentryChildSpans",Ya="_sentryRootSpan";function hp(e,t){const n=e[Ya]||e;Ze(t,Ya,n),e[_n]?e[_n].add(t):Ze(e,_n,new Set([t]))}function ry(e,t){e[_n]&&e[_n].delete(t)}function Us(e){const t=new Set;function n(r){if(!t.has(r)&&sn(r)){t.add(r);const s=r[_n]?Array.from(r[_n]):[];for(const o of s)n(o)}}return n(e),Array.from(t)}const Ve=sy;function sy(e){return e[Ya]||e}function pt(){const e=vn(),t=Xn(e);return t.getActiveSpan?t.getActiveSpan():ao(Se())}function qa(){vl||(Tn(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),vl=!0)}let Cl=!1;function oy(){if(Cl)return;function e(){const t=pt(),n=t&&Ve(t);if(n){const r="internal_error";q&&G.log(`[Tracing] Root span: ${r} -> Global error occurred`),n.setStatus({code:Me,message:r})}}e.tag="sentry_tracingErrorCallback",Cl=!0,Hd(e),Wd(e)}function yt(e){var n;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const t=e||((n=he())==null?void 0:n.getOptions());return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function Al(e){G.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Ir(e,t){if(!(t!=null&&t.length)||!e.description)return!1;for(const n of t){if(iy(n)){if(Ms(e.description,n))return q&&Al(e),!0;continue}if(!n.name&&!n.op)continue;const r=n.name?Ms(e.description,n.name):!0,s=n.op?e.op&&Ms(e.op,n.op):!0;if(r&&s)return q&&Al(e),!0}return!1}function ay(e,t){const n=t.parent_span_id,r=t.span_id;if(n)for(const s of e)s.parent_span_id===r&&(s.parent_span_id=n)}function iy(e){return typeof e=="string"||e instanceof RegExp}const Xi="production",gp="_frozenDsc";function Fs(e,t){Ze(e,gp,t)}function yp(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},s={environment:n.environment||Xi,release:n.release,public_key:r,trace_id:e,org_id:Hg(t)};return t.emit("createDsc",s),s}function _p(e,t){const n=t.getPropagationContext();return n.dsc||yp(n.traceId,e)}function Qt(e){var _;const t=he();if(!t)return{};const n=Ve(e),r=ye(n),s=r.data,o=n.spanContext().traceState,i=(o==null?void 0:o.get("sentry.sample_rate"))??s[qi]??s[tp];function c(h){return(typeof i=="number"||typeof i=="string")&&(h.sample_rate=`${i}`),h}const l=n[gp];if(l)return c(l);const u=o==null?void 0:o.get("sentry.dsc"),d=u&&ap(u);if(d)return c(d);const p=yp(e.spanContext().traceId,t),m=s[jt]??s["sentry.span.source"],g=r.description;
6return m!=="url"&&g&&(p.transaction=g),yt()&&(p.sampled=String(sn(n)),p.sample_rand=(o==null?void 0:o.get("sentry.sample_rand"))??((_=io(n).scope)==null?void 0:_.getPropagationContext().sampleRand.toString())),c(p),t.emit("createDsc",p,n),p}class Et{constructor(t={}){this._traceId=t.traceId||Ut(),this._spanId=t.spanId||Pt(),this.dropReason=t.dropReason}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:pp}}end(t){}setAttribute(t,n){return this}setAttributes(t){return this}setStatus(t){return this}updateName(t){return this}isRecording(){return!1}addEvent(t,n,r){return this}addLink(t){return this}addLinks(t){return this}recordException(t,n){}}function xp(e){return!!e&&typeof e=="function"&&"_streamed"in e&&!!e._streamed}function Rt(e,t=100,n=1/0){try{return Ka("",e,t,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function bp(e,t=3,n=100*1024){const r=Rt(e,t);return dy(r)>n?bp(e,t-1,n):r}function Ka(e,t,n=1/0,r=1/0,s=py()){const[o,i]=s;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;const c=cy(e,t);if(!c.startsWith("[object "))return c;if(t.__sentry_skip_normalization__)return t;const l=typeof t.__sentry_override_normalization_depth__=="number"?t.__sentry_override_normalization_depth__:n;if(l===0)return c.replace("object ","");if(o(t))return"[Circular ~]";const u=t;if(u&&typeof u.toJSON=="function")try{const g=u.toJSON();return Ka("",g,l-1,r,s)}catch{}const d=Array.isArray(t)?[]:{};let p=0;const m=Xd(t);for(const g in m){if(!Object.prototype.hasOwnProperty.call(m,g))continue;if(p>=r){d[g]="[MaxProperties ~]";break}const _=m[g];d[g]=Ka(g,_,l-1,r,s),p++}return i(t),d}function cy(e,t){try{if(e==="domain"&&t&&typeof t=="object"&&t._events)return"[Domain]";if(e==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&t===global)return"[Global]";if(typeof window<"u"&&t===window)return"[Window]";if(typeof document<"u"&&t===document)return"[Document]";if(Yd(t))return Gd(t);if(og(t))return"[SyntheticEvent]";if(typeof t=="number"&&!Number.isFinite(t))return`[${t}]`;if(typeof t=="function")return`[Function: ${Dt(t)}]`;if(typeof t=="symbol")return`[${String(t)}]`;if(typeof t=="bigint")return`[BigInt: ${String(t)}]`;const n=ly(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function ly(e){const t=Object.getPrototypeOf(e);return t!=null&&t.constructor?t.constructor.name:"null prototype"}function uy(e){return~-encodeURI(e).split(/%..|./).length}function dy(e){return uy(JSON.stringify(e))}function py(){const e=new WeakSet;function t(r){return e.has(r)?!0:(e.add(r),!1)}function n(r){e.delete(r)}return[t,n]}function In(e,t=[]){return[e,t]}function my(e,t){const[n,r]=e;return[n,[...r,t]]}function Xa(e,t){const n=e[1];for(const r of n){const s=r[0].type;if(t(r,s))return!0}return!1}function fy(e,t){return Xa(e,(n,r)=>t.includes(r))}function Za(e){const t=Ro(fe);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function hy(e){const[t,n]=e;let r=JSON.stringify(t);function s(o){typeof r=="string"?r=typeof o=="string"?r+o:[Za(r),o]:r.push(typeof o=="string"?Za(o):o)}for(const o of n){const[i,c]=o;if(s(` 7${JSON.stringify(i)} 8`),typeof c=="string"||c instanceof Uint8Array)s(c);else{let l;try{l=JSON.stringify(c)}catch{l=JSON.stringify(Rt(c))}s(l)}}return typeof r=="string"?r:gy(r)}function gy(e){const t=e.reduce((s,o)=>s+o.length,0),n=new Uint8Array(t);let r=0;for(const s of e)n.set(s,r),r+=s.length;return n}function yy(e){return[{type:"span"},e]}function _y(e){const t=typeof e.data=="string"?Za(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const wp={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function xy(e){return e in wp}function Il(e){return xy(e)?wp[e]:e}function Sp(e){if(!(e!=null&&e.sdk))return;
8const{name:t,version:n}=e.sdk;return{name:t,version:n}}function by(e,t,n,r){var o;const s=(o=e.sdkProcessingMetadata)==null?void 0:o.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date().toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:An(r)},...s&&{trace:s}}}function wy(e,t){var r,s,o,i;if(!t)return e;const n=e.sdk||{};return e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...((r=e.sdk)==null?void 0:r.integrations)||[],...t.integrations||[]],packages:[...((s=e.sdk)==null?void 0:s.packages)||[],...t.packages||[]],settings:(o=e.sdk)!=null&&o.settings||t.settings?{...(i=e.sdk)==null?void 0:i.settings,...t.settings}:void 0},e}function Sy(e,t,n,r){const s=Sp(n),o={sent_at:new Date().toISOString(),...s&&{sdk:s},...!!r&&t&&{dsn:An(t)}},i="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return In(o,[i])}function Ey(e,t,n,r){const s=Sp(n),o=e.type&&e.type!=="replay_event"?e.type:"event";wy(e,n==null?void 0:n.sdk);const i=by(e,s,r,t);return delete e.sdkProcessingMetadata,In(i,[[{type:o},e]])}function vy(e,t){function n(g){return!!g.trace_id&&!!g.public_key}const r=Qt(e[0]),s=t==null?void 0:t.getDsn(),o=t==null?void 0:t.getOptions().tunnel,i={sent_at:new Date().toISOString(),...n(r)&&{trace:r},...!!o&&s&&{dsn:An(s)}},{beforeSendSpan:c,ignoreSpans:l}=(t==null?void 0:t.getOptions())||{},u=l!=null&&l.length?e.filter(g=>!Ir(ye(g),l)):e,d=e.length-u.length;d&&(t==null||t.recordDroppedEvent("before_send","span",d));const p=c?g=>{const _=ye(g),h=xp(c)?_:c(_);return h||(qa(),_)}:ye,m=[];for(const g of u){const _=p(g);_&&m.push(yy(_))}return In(i,m)}function Ty(e){if(!q)return;const{description:t="< unknown name >",op:n="< unknown op >",parent_span_id:r}=ye(e),{spanId:s}=e.spanContext(),o=sn(e),i=Ve(e),c=i===e,l=`[Tracing] Starting ${o?"sampled":"unsampled"} ${c?"root ":""}span`,u=[`op: ${n}`,`name: ${t}`,`ID: ${s}`];if(r&&u.push(`parent ID: ${r}`),!c){const{op:d,description:p}=ye(i);u.push(`root ID: ${i.spanContext().spanId}`),d&&u.push(`root op: ${d}`),p&&u.push(`root description: ${p}`)}G.log(`${l} 9 ${u.join(` 10 `)}`)}function Cy(e){if(!q)return;const{description:t="< unknown name >",op:n="< unknown op >"}=ye(e),{spanId:r}=e.spanContext(),o=Ve(e)===e,i=`[Tracing] Finishing "${n}" ${o?"root ":""}span "${t}" with ID ${r}`;G.log(i)}function Ay(e,t,n,r=pt()){const s=r&&Ve(r);s&&(q&&G.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${n}`),s.addEvent(e,{[Xr]:t,[Kr]:n}))}function Rl(e){if(!e||e.length===0)return;const t={};return e.forEach(n=>{const r=n.attributes||{},s=r[Kr],o=r[Xr];typeof s=="string"&&typeof o=="number"&&(t[n.name]={value:o,unit:s})}),t}function Zr(e){return e.getOptions().traceLifecycle==="stream"}const kl=1e3;class Lo{constructor(t={}){this._traceId=t.traceId||Ut(),this._spanId=t.spanId||Pt(),this._startTime=t.startTimestamp||Fe(),this._links=t.links,this._attributes={},this.setAttributes({[$e]:"manual",[Ft]:t.op,...t.attributes}),this._name=t.name,t.parentSpanId&&(this._parentSpanId=t.parentSpanId),"sampled"in t&&(this._sampled=t.sampled),t.endTimestamp&&(this._endTime=t.endTimestamp),this._events=[],this._isStandaloneSpan=t.isStandalone,this._endTime&&this._onSpanEnded()}addLink(t){return this._links?this._links.push(t):this._links=[t],this}addLinks(t){return this._links?this._links.push(...t):this._links=t,this}recordException(t,n){}spanContext(){const{_spanId:t,_traceId:n,_sampled:r}=this;return{spanId:t,traceId:n,traceFlags:r?jo:pp}}setAttribute(t,n){return n===void 0?delete this._attributes[t]:this._attributes[t]=n,this}setAttributes(t){return Object.keys(t).forEach(n=>this.setAttribute(n,t[n])),this}updateStartTime(t){this._startTime=yn(t)}setStatus(t){return this._status=t,this}updateName(t){return this._name=t,this.setAttribute(jt,"custom"),this}end(t){this._endTime||(this._endTime=yn(t),Cy(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[Ft],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:fp(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[$e],profile_id:this._attributes[Ki],exclusive_time:this._attributes[Zn],measurements:Rl(this._events),is_segment:this._isStandaloneSpan&&Ve(this)===this||void 0,segment_id:this._isStandaloneSpan?Ve(this).spanContext().spanId:void 0,links:mp(this._links)}}getStreamedSpanJSON(){return{name:this._name??"",span_id:this._spanId,trace_id:this._traceId,parent_span_id:this._parentSpanId,start_timestamp:this._startTime,end_timestamp:this._endTime??this._startTime,is_segment:this._isStandaloneSpan||this===Ve(this),status:ny(this._status),attributes:this._attributes,links:Zg(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(t,n,r){q&&G.log("[Tracing] Adding an event to span:",t);const s=Nl(n)?n:r||Fe(),o=Nl(n)?{}:n||{},i={name:t,time:yn(s),attributes:o};return this._events.push(i),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){const t=he();if(t&&(t.emit("spanEnd",this),this._isStandaloneSpan||t.emit("afterSpanEnd",this)),!(this._isStandaloneSpan||this===Ve(this)))return;if(this._isStandaloneSpan){this._sampled?Ry(vy([this],t)):(q&&G.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),t&&t.recordDroppedEvent("sample_rate","span"));return}else if(t&&Zr(t)){t.emit("afterSegmentSpanEnd",this);return}const r=this._convertSpanToTransaction();r&&(io(this).scope||Se()).captureEvent(r)}_convertSpanToTransaction(){var d;if(!jl(ye(this)))return;this._name||(q&&G.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");const{scope:t,isolationScope:n}=io(this),r=(d=t==null?void 0:t.getScopeData().sdkProcessingMetadata)==null?void 0:d.normalizedRequest;if(this._sampled!==!0)return;const o=Us(this).filter(p=>
10p!==this&&!Iy(p)).map(p=>ye(p)).filter(jl),i=this._attributes[jt];delete this._attributes[Sl],o.forEach(p=>{delete p.data[Sl]});const c={contexts:{trace:Yg(this)},spans:o.length>kl?o.sort((p,m)=>p.start_timestamp-m.start_timestamp).slice(0,kl):o,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:t,capturedSpanIsolationScope:n,dynamicSamplingContext:Qt(this)},request:r,...i&&{transaction_info:{source:i}}},l=Rl(this._events);return l&&Object.keys(l).length&&(q&&G.log("[Measurements] Adding measurements to transaction event",JSON.stringify(l,void 0,2)),c.measurements=l),c}}function Nl(e){return e&&typeof e=="number"||e instanceof Date||Array.isArray(e)}function jl(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function Iy(e){return e instanceof Lo&&e.isStandaloneSpan()}function Ry(e){const t=he();if(!t)return;const n=e[1];if(!n||n.length===0){t.recordDroppedEvent("before_send","span");return}t.sendEnvelope(e)}function ky(e,t,n){if(!yt(e))return[!1];let r,s;typeof e.tracesSampler=="function"?(s=e.tracesSampler({...t,inheritOrSampleWith:c=>typeof t.parentSampleRate=="number"?t.parentSampleRate:typeof t.parentSampled=="boolean"?Number(t.parentSampled):c}),r=!0):t.parentSampled!==void 0?s=t.parentSampled:typeof e.tracesSampleRate<"u"&&(s=e.tracesSampleRate,r=!0);const o=Ar(s);if(o===void 0)return q&&G.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(s)} of type ${JSON.stringify(typeof s)}.`),[!1];if(!o)return q&&G.log(`[Tracing] Discarding transaction because ${typeof e.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,o,r];const i=n<o;return i||q&&G.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(s)})`),[i,o,r]}const Ny="__SENTRY_SUPPRESS_TRACING__";function Qn(e){const t=vp();if(t.startInactiveSpan)return t.startInactiveSpan(e);const n=Ly(e),{forceTransaction:r,parentSpan:s}=e;return(e.scope?i=>qr(e.scope,i):s!==void 0?i=>Ep(s,i):i=>i())(()=>{const i=Se(),c=Oy(i,s);return e.onlyIfParent&&!c?new Et:jy({parentSpan:c,spanArguments:n,forceTransaction:r,scope:i})})}function Ep(e,t){const n=vp();return n.withActiveSpan?n.withActiveSpan(e,t):qr(r=>(Tr(r,e||void 0),t(r)))}function jy({parentSpan:e,spanArguments:t,forceTransaction:n,scope:r}){if(!yt()){const c=new Et;if(n||!e){const l={sampled:"false",sample_rate:"0",transaction:t.name,...Qt(c)};Fs(c,l)}return c}const s=he();if(Dy(s,t))return Zi(r)||s==null||s.recordDroppedEvent("ignored","span"),new Et({dropReason:"ignored",traceId:(e==null?void 0:e.spanContext().traceId)??r.getPropagationContext().traceId});const o=st();let i;if(e&&!n)i=Py(e,r,t),hp(e,i);else if(e){const c=Qt(e),{traceId:l,spanId:u}=e.spanContext(),d=sn(e);i=Ll({traceId:l,parentSpanId:u,...t},r,d),Fs(i,c)}else{const{traceId:c,dsc:l,parentSpanId:u,sampled:d}={...o.getPropagationContext(),...r.getPropagationContext()};i=Ll({traceId:c,parentSpanId:u,...t},r,d),l&&Fs(i,l)}return Ty(i),Lg(i,r,o),i}function Ly(e){const n={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){const r={...n};return r.startTimestamp=yn(e.startTime),delete r.startTime,r}return n}function vp(){const e=vn();return Xn(e)}function Ll(e,t,n){var h;const r=he(),s=(r==null?void 0:r.getOptions())||{},{name:o=""}=e,i={spanAttributes:{...e.attributes},spanName:o,parentSampled:n};r==null||r.emit("beforeSampling",i,{decision:!1});const c=i.parentSampled??n,l=i.spanAttributes,u=t.getPropagationContext(),d=Zi(t),[p,m,g]=d?[!1]:ky(s,{name:o,parentSampled:c,attributes:l,parentSampleRate:Ar((h=u.dsc)==null?void 0:h.sample_rate)},u.sampleRand),_=new Lo({...e,attributes:{[jt]:"custom",[qi]:m!==void 0&&g?m:void 0,...l},sampled:p});return!p&&r&&!d&&(q&&G.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),r.recordDroppedEvent("sample_rate",Zr(r)?"span":"transaction")),r&&r.emit("spanStart",_),_}function Py(e,t,n){const{spanId:r,traceId:s}=e.spanContext(),o=Zi(t),i=o?!1:sn(e),c=i?new Lo({...n,parentSpanId:r,traceId:s,sampled:i}):new Et({traceId:s});hp(e,c);const l=he();return l&&(Zr(l)&&c instanceof Et&&(e instanceof Et&&e.dropReason?(c.dropReason=e.dropReason,l.recordDroppedEvent(e.dropReason,"span")):o||(c.dropReason="sample_rate",l.recordDroppedEvent("sample_rate","span"))),l.emit("spanStart",c),n.endTimestamp&&(l.emit("spanEnd",c),l.emit("afterSpanEnd",c))),c}function Oy(e,t){if(t)return t;if(t===null)return;const n=ao(e);if(!n)return;const r=he();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?Ve(n):n}function Dy(e,t){var r;const n=e==null?void 0:e.getOptions().ignoreSpans;
10return!e||!Zr(e)||!(n!=null&&n.length)?!1:Ir({description:t.name||"",op:((r=t.attributes)==null?void 0:r[Ft])||t.op},n)}function Zi(e){return e.getScopeData().sdkProcessingMetadata[Ny]===!0}const $s={idleTimeout:1e3,finalTimeout:3e4,childSpanTimeout:15e3},My="heartbeatFailed",Uy="idleTimeout",Fy="finalTimeout",$y="externalFinish";function Tp(e,t={}){const n=new Map;let r=!1,s,o=$y,i=!t.disableAutoFinish;const c=[],{idleTimeout:l=$s.idleTimeout,finalTimeout:u=$s.finalTimeout,childSpanTimeout:d=$s.childSpanTimeout,beforeSpanEnd:p,trimIdleSpanEndTimestamp:m=!0}=t,g=he();if(!g||!yt()){const S=new Et,A={sample_rate:"0",sampled:"false",...Qt(S)};return Fs(S,A),S}const _=Se(),h=pt(),y=By(e);y.end=new Proxy(y.end,{apply(S,A,R){if(p&&p(y),A instanceof Et)return;const[N,...O]=R,k=N||Fe(),$=yn(k),z=Us(y).filter(me=>me!==y),K=ye(y);if(!z.length||!m)return C($),Reflect.apply(S,A,[$,...O]);const V=g.getOptions().ignoreSpans,ie=z==null?void 0:z.reduce((me,ce)=>{const xe=ye(ce);return!xe.timestamp||V&&Ir(xe,V)?me:me?Math.max(me,xe.timestamp):xe.timestamp},void 0),Q=K.start_timestamp,J=Math.min(Q?Q+u/1e3:1/0,Math.max(Q||-1/0,Math.min($,ie||1/0)));return C(J),Reflect.apply(S,A,[J,...O])}});function b(){s&&(clearTimeout(s),s=void 0)}function x(S){b(),s=setTimeout(()=>{!r&&n.size===0&&i&&(o=Uy,y.end(S))},l)}function w(S){s=setTimeout(()=>{!r&&i&&(o=My,y.end(S))},d)}function E(S){b(),n.set(S,!0);const A=Fe();w(A+d/1e3)}function T(S){if(n.has(S)&&n.delete(S),n.size===0){const A=Fe();x(A+l/1e3)}}function C(S){r=!0,n.clear(),c.forEach(z=>z()),Tr(_,h);const A=ye(y),{start_timestamp:R}=A;if(!R)return;A.data[Cr]||y.setAttribute(Cr,o);const O=A.status;(!O||O==="unknown")&&y.setStatus({code:No}),G.log(`[Tracing] Idle span "${A.op}" finished`);const k=Us(y).filter(z=>z!==y);let $=0;k.forEach(z=>{z.isRecording()&&(z.setStatus({code:Me,message:"cancelled"}),z.end(S),q&&G.log("[Tracing] Cancelling span since span ended early",JSON.stringify(z,void 0,2)));const K=ye(z),{timestamp:V=0,start_timestamp:ie=0}=K,Q=ie<=S,J=(u+l)/1e3,me=V-ie<=J;if(q){const ce=JSON.stringify(z,void 0,2);Q?me||G.log("[Tracing] Discarding span since it finished after idle span final timeout",ce):G.log("[Tracing] Discarding span since it happened after idle span was finished",ce)}(!me||!Q)&&(ry(y,z),$++)}),$>0&&y.setAttribute("sentry.idle_span_discarded_spans",$)}return c.push(g.on("spanStart",S=>{if(r||S===y||ye(S).timestamp||S instanceof Lo&&S.isStandaloneSpan())return;Us(y).includes(S)&&E(S.spanContext().spanId)})),c.push(g.on("spanEnd",S=>{r||T(S.spanContext().spanId)})),c.push(g.on("idleSpanEnableAutoFinish",S=>{S===y&&(i=!0,x(),n.size&&w())})),t.disableAutoFinish||x(),setTimeout(()=>{r||(y.setStatus({code:Me,message:"deadline_exceeded"}),o=Fy,y.end())},u),y}function By(e){const t=Qn(e);return Tr(Se(),t),q&&G.log("[Tracing] Started span is an idle span"),t}function zy(e,t){const{fingerprint:n,span:r,breadcrumbs:s,sdkProcessingMetadata:o}=t;Gy(e,t),r&&Jy(e,r),Vy(e,n),Hy(e,s),Wy(e,o)}function Pl(e,t){const{extra:n,tags:r,attributes:s,user:o,contexts:i,level:c,sdkProcessingMetadata:l,breadcrumbs:u,fingerprint:d,eventProcessors:p,attachments:m,propagationContext:g,transactionName:_,span:h}=t;
10pr(e,"extra",n),pr(e,"tags",r),pr(e,"attributes",s),pr(e,"user",o),pr(e,"contexts",i),e.sdkProcessingMetadata=Yr(e.sdkProcessingMetadata,l,2),c&&(e.level=c),_&&(e.transactionName=_),h&&(e.span=h),u.length&&(e.breadcrumbs=[...e.breadcrumbs,...u]),d.length&&(e.fingerprint=[...e.fingerprint,...d]),p.length&&(e.eventProcessors=[...e.eventProcessors,...p]),m.length&&(e.attachments=[...e.attachments,...m]),e.propagationContext={...e.propagationContext,...g}}function pr(e,t,n){e[t]=Yr(e[t],n,1)}function Cp(e,t){const n=Cg().getScopeData();return e&&Pl(n,e.getScopeData()),t&&Pl(n,t.getScopeData()),n}function Gy(e,t){const{extra:n,tags:r,user:s,contexts:o,level:i,transactionName:c}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(s).length&&(e.user={...s,...e.user}),Object.keys(o).length&&(e.contexts={...o,...e.contexts}),i&&(e.level=i),c&&e.type!=="transaction"&&(e.transaction=c)}function Hy(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Wy(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function Jy(e,t){e.contexts={trace:qg(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Qt(t),...e.sdkProcessingMetadata};const n=Ve(t),r=ye(n).description;r&&!e.transaction&&e.type==="transaction"&&(e.transaction=r)}function Vy(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}const ca=0,Ol=1,Dl=2;function Qr(e){return new Rr(t=>{t(e)})}function Qi(e){return new Rr((t,n)=>{n(e)})}class Rr{constructor(t){this._state=ca,this._handlers=[],this._runExecutor(t)}then(t,n){return new Rr((r,s)=>{this._handlers.push([!1,o=>{if(!t)r(o);else try{r(t(o))}catch(i){s(i)}},o=>{if(!n)s(o);else try{r(n(o))}catch(i){s(i)}}]),this._executeHandlers()})}catch(t){return this.then(n=>n,t)}finally(t){return new Rr((n,r)=>{let s,o;return this.then(i=>{o=!1,s=i,t&&t()},i=>{o=!0,s=i,t&&t()}).then(()=>{if(o){r(s);return}n(s)})})}_executeHandlers(){if(this._state===ca)return;const t=this._handlers.slice();this._handlers=[],t.forEach(n=>{n[0]||(this._state===Ol&&n[1](this._value),this._state===Dl&&n[2](this._value),n[0]=!0)})}_runExecutor(t){const n=(o,i)=>{if(this._state===ca){if(Hr(i)){i.then(r,s);return}this._state=o,this._value=i,this._executeHandlers()}},r=o=>{n(Ol,o)},s=o=>{n(Dl,o)};try{t(r,s)}catch(o){s(o)}}}function Yy(e,t,n,r=0){try{const s=Qa(t,n,e,r);return Hr(s)?s:Qr(s)}catch(s){return Qi(s)}}function Qa(e,t,n,r){const s=n[r];if(!e||!s)return e;const o=s({...e},t);return q&&o===null&&G.log(`Event processor "${s.id||"?"}" dropped event`),Hr(o)?o.then(i=>Qa(i,t,n,r+1)):Qa(o,t,n,r+1)}let At,Ml,Ul,Wt;function qy(e){const t=fe._sentryDebugIds,n=fe._debugIds;if(!t&&!n)return{};const r=t?Object.keys(t):[],s=n?Object.keys(n):[];if(Wt&&r.length===Ml&&s.length===Ul)return Wt;Ml=r.length,Ul=s.length,Wt={},At||(At={});const o=(i,c)=>{for(const l of i){const u=c[l],d=At==null?void 0:At[l];if(d&&Wt&&u)Wt[d[0]]=u,At&&(At[l]=[d[0],u]);else if(u){const p=e(l);for(let m=p.length-1;m>=0;m--){const g=p[m],_=g==null?void 0:g.filename;if(_&&Wt&&At){Wt[_]=u,At[l]=[_,u];break}}}}};return t&&o(r,t),n&&o(s,n),Wt}function Ky(e,t,n,r,s,o){const{normalizeDepth:i=3,normalizeMaxBreadth:c=1e3}=e,l={...t,event_id:t.event_id||n.event_id||lt(),timestamp:t.timestamp||Cn()},u=n.integrations||e.integrations.map(b=>b.name);Xy(l,e),e0(l,u),s&&s.emit("applyFrameMetadata",t),t.type===void 0&&Zy(l,e.stackParser);const d=n0(r,n.captureContext);n.mechanism&&Gn(l,n.mechanism);const p=s?s.getEventProcessors():[],m=Cp(o,d),g=[...n.attachments||[],...m.attachments];g.length&&(n.attachments=g),zy(l,m);const _=[...p,...m.eventProcessors];return(n.data&&n.data.__sentry__===!0?Qr(l):Yy(_,l,n)).then(b=>(b&&Qy(b),typeof i=="number"&&i>0?t0(b,i,c):b))}function Xy(e,t){var c,l;const{environment:n,release:r,dist:s,maxValueLength:o}=t;e.environment=e.environment||n||Xi,!e.release&&r&&(e.release=r),!e.dist&&s&&(e.dist=s);const i=e.request;i!=null&&i.url&&o&&(i.url=Wa(i.url,o)),o&&((l=(c=e.exception)==null?void 0:c.values)==null||l.forEach(u=>{u.value&&(u.value=Wa(u.value,o))}))}function Zy(e,t){var r,s;const n=qy(t);
10(s=(r=e.exception)==null?void 0:r.values)==null||s.forEach(o=>{var i,c;(c=(i=o.stacktrace)==null?void 0:i.frames)==null||c.forEach(l=>{l.filename&&(l.debug_id=n[l.filename])})})}function Qy(e){var r,s;const t={};if((s=(r=e.exception)==null?void 0:r.values)==null||s.forEach(o=>{var i,c;(c=(i=o.stacktrace)==null?void 0:i.frames)==null||c.forEach(l=>{l.debug_id&&(l.abs_path?t[l.abs_path]=l.debug_id:l.filename&&(t[l.filename]=l.debug_id),delete l.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.entries(t).forEach(([o,i])=>{n.push({type:"sourcemap",code_file:o,debug_id:i})})}function e0(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function t0(e,t,n){var s,o;if(!e)return null;const r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(i=>({...i,...i.data&&{data:Rt(i.data,t,n)}}))},...e.user&&{user:Rt(e.user,t,n)},...e.contexts&&{contexts:Rt(e.contexts,t,n)},...e.extra&&{extra:Rt(e.extra,t,n)}};return(s=e.contexts)!=null&&s.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Rt(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(i=>({...i,...i.data&&{data:Rt(i.data,t,n)}}))),(o=e.contexts)!=null&&o.flags&&r.contexts&&(r.contexts.flags=Rt(e.contexts.flags,3,n)),r}function n0(e,t){if(!t)return e;const n=e?e.clone():new vt;return n.update(t),n}function r0(e){if(e)return s0(e)?{captureContext:e}:a0(e)?{captureContext:e}:e}function s0(e){return e instanceof vt||typeof e=="function"}const o0=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function a0(e){return Object.keys(e).some(t=>o0.includes(t))}function Po(e,t){return Se().captureException(e,r0(t))}function Ap(e,t){return Se().captureEvent(e,t)}function ei(e,t){st().setContext(e,t)}function Fl(e,t){st().setTag(e,t)}function $l(e){st().setUser(e)}function i0(){return st().lastEventId()}function c0(){const e=he();return(e==null?void 0:e.getOptions().enabled)!==!1&&!!(e!=null&&e.getTransport())}function Bl(e){const t=st(),{user:n}=Cp(t,Se()),{userAgent:r}=fe.navigator||{},s=fg({user:n,...r&&{userAgent:r},...e}),o=t.getSession();return(o==null?void 0:o.status)==="ok"&&Hn(o,{status:"exited"}),Ip(),t.setSession(s),s}function Ip(){const e=st(),n=Se().getSession()||e.getSession();n&&hg(n),Rp(),e.setSession()}function Rp(){const e=st(),t=he(),n=e.getSession();n&&t&&t.captureSession(n)}function la(e=!1){if(e){Ip();return}Rp()}const l0="7";function kp(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}function u0(e){return`${kp(e)}${e.projectId}/envelope/`}function d0(e,t){const n={sentry_version:l0};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function p0(e,t,n){return t||`${u0(e)}?${d0(e,n)}`}function m0(e,t){const n=cp(e);if(!n)return"";const r=`${kp(n)}embed/error-page/`;let s=`dsn=${An(n)}`;for(const o in t)if(o!=="dsn"&&o!=="onClose")if(o==="user"){const i=t.user;if(!i)continue;i.name&&(s+=`&name=${encodeURIComponent(i.name)}`),i.email&&(s+=`&email=${encodeURIComponent(i.email)}`)}else s+=`&${encodeURIComponent(o)}=${encodeURIComponent(t[o])}`;return`${r}?${s}`}const zl=[];function f0(e){const t={};return e.forEach(n=>{const{name:r}=n,s=t[r];s&&!s.isDefaultInstance&&n.isDefaultInstance||(t[r]=n)}),Object.values(t)}function h0(e){const t=e.defaultIntegrations||[],n=e.integrations;t.forEach(s=>{s.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n=="function"){const s=n(t);r=Array.isArray(s)?s:[s]}else r=t;return f0(r)}function g0(e,t){const n={};return t.forEach(r=>{r!=null&&r.beforeSetup&&r.beforeSetup(e)}),t.forEach(r=>{r&&Np(e,r,n)}),n}function Gl(e,t){for(const n of t)n!=null&&n.afterAllSetup&&n.afterAllSetup(e)}function Np(e,t,n){if(n[t.name]){q&&G.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!zl.includes(t.name)&&typeof t.setupOnce=="function"&&(t.setupOnce(),zl.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),typeof t.preprocessEvent=="function"){const r=t.preprocessEvent.bind(t);e.on("preprocessEvent",(s,o)=>r(s,o,e))}if(typeof t.processEvent=="function"){const r=t.processEvent.bind(t),s=Object.assign((o,i)=>r(o,i,e),{id:t.name});e.addEventProcessor(s)}q&&G.log(`Integration installed: ${t.name}`)}function y0(e){return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{items:e}]}function _0(e,t,n,r){const s={};return t!=null&&t.sdk&&(s.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(s.dsn=An(r)),In(s,[y0(e)])}function ti(e,t){const n=t??x0(e)??[];if(n.length===0)return;const r=e.getOptions(),s=_0(n,r._metadata,r.tunnel,e.getDsn());jp().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(s)}function x0(e){return jp().get(e)}function jp(){return qn("clientToLogBufferMap",()=>new WeakMap)}function b0(e){return[{type:"trace_metric",item_count:e.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:e}]}function w0(e,t,n,r){const s={};return t!=null&&t.sdk&&(s.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(s.dsn=An(r)),In(s,[b0(e)])}function Lp(e,t){const n=t??S0(e)??[];if(n.length===0)return;const r=e.getOptions(),s=w0(n,r._metadata,r.tunnel,e.getDsn());Pp().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(s)}function S0(e){return Pp().get(e)}function Pp(){return qn("clientToMetricBufferMap",()=>new WeakMap)}function Op(e){return typeof e=="object"&&typeof e.unref=="function"&&e.unref(),e}const ec=Symbol.for("SentryBufferFullError");function tc(e=100){const t=new Set;function n(){return t.size<e}function r(i){t.delete(i)}function s(i){if(!n())return Qi(ec);const c=i();return t.add(c),c.then(()=>r(c),()=>r(c)),c}function o(i){if(!t.size)return Qr(!0);const c=Promise.allSettled(Array.from(t)).then(()=>!0);if(!i)return c;const l=[c,new Promise(u=>Op(setTimeout(()=>u(!1),i)))];return Promise.race(l)}return{get $(){return Array.from(t)},add:s,drain:o}}const E0=60*1e3;function v0(e,t=Vr()){const n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;const r=Date.parse(`${e}`);return isNaN(r)?E0:r-t}function T0(e,t){return e[t]||e.all||0}function C0(e,t,n=Vr()){return T0(e,t)>n}function A0(e,{statusCode:t,headers:n},r=Vr()){const s={...e},o=n==null?void 0:n["x-sentry-rate-limits"],i=n==null?void 0:n["retry-after"];if(o)for(const c of o.trim().split(",")){const[l,u,,,d]=c.split(":",5),p=parseInt(l,10),m=(isNaN(p)?60:p)*1e3;if(!u)s.all=r+m;else for(const g of u.split(";"))g==="metric_bucket"?(!d||d.split(";").includes("custom"))&&(s[g]=r+m):s[g]=r+m}else i?s.all=r+v0(i,r):t===429&&(s.all=r+60*1e3);return s}const Dp=64;function I0(e,t,n=tc(e.bufferSize||Dp)){let r={};const s=i=>n.drain(i);function o(i){const c=[];if(Xa(i,(p,m)=>{const g=Il(m);C0(r,g)?e.recordDroppedEvent("ratelimit_backoff",g):c.push(p)}),c.length===0)return Promise.resolve({});const l=In(i[0],c),u=p=>{if(fy(l,["client_report"])){q&&G.warn(`Dropping client report. Will not send outcomes (reason: ${p}).`);return}Xa(l,(m,g)=>{e.recordDroppedEvent(p,Il(g))})},d=()=>t({body:hy(l)}).then(p=>p.statusCode===413?(q&&G.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),u("send_error"),p):(q&&p.statusCode!==void 0&&(p.statusCode<200||p.statusCode>=300)&&G.warn(`Sentry responded with status code ${p.statusCode} to sent event.`),r=A0(r,p),p),p=>{throw u("network_error"),q&&G.error("Encountered error running transport request:",p),p});return n.add(d).then(p=>p,p=>{if(p===ec)return q&&G.error("Skipped sending event because buffer is full."),u("queue_overflow"),Promise.resolve({});throw p})}return{send:o,flush:s}}function R0(e,t,n){const r=[{type:"client_report"},{timestamp:Cn(),discarded_events:e}];return In(t?{dsn:t}:{},[r])}function Mp(e){const t=[];e.message&&t.push(e.message);try{const n=e.exception.values[e.exception.values.length-1];n!=null&&n.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function k0(e){var l;const{trace_id:t,parent_span_id:n,span_id:r,status:s,origin:o,data:i,op:c}=((l=e.contexts)==null?void 0:l.trace)??{};return{data:i??{},description:e.transaction,op:c,parent_span_id:n,span_id:r??"",start_timestamp:e.start_timestamp??0,status:s,timestamp:e.timestamp,trace_id:t??"",origin:o,profile_id:i==null?void 0:i[Ki],exclusive_time:i==null?void 0:i[Zn],measurements:e.measurements,is_segment:!0}}function N0(e){return{type:"transaction",timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{[Ki]:e.profile_id},...e.exclusive_time&&{[Zn]:e.exclusive_time}}}},measurements:e.measurements}}const Hl="Not capturing exception because it's already been captured.",Wl="Discarded session because of missing or non-string release",Up=Symbol.for("SentryInternalError"),Fp=Symbol.for("SentryDoNotSendEventError"),j0=5e3;function Bs(e){return{message:e,[Up]:!0}}function ua(e){return{message:e,[Fp]:!0}}function Jl(e){return!!e&&typeof e=="object"&&Up in e}function Vl(e){return!!e&&typeof e=="object"&&Fp in e}
10function Yl(e,t,n,r,s){let o=0,i,c=!1;e.on(n,()=>{o=0,clearTimeout(i),c=!1}),e.on(t,l=>{o+=r(l),o>=8e5?s(e):c||(c=!0,i=Op(setTimeout(()=>{s(e)},j0)))}),e.on("flush",()=>{s(e)})}class L0{constructor(t){var r,s,o;if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=tc(((r=t.transportOptions)==null?void 0:r.bufferSize)??Dp),t.dsn?this._dsn=cp(t.dsn):q&&G.warn("No DSN provided, client will not send events."),this._dsn){const i=p0(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:i})}this._options.enableLogs=this._options.enableLogs??((s=this._options._experiments)==null?void 0:s.enableLogs),this._options.enableLogs&&Yl(this,"afterCaptureLog","flushLogs",M0,ti),(this._options.enableMetrics??((o=this._options._experiments)==null?void 0:o.enableMetrics)??!0)&&Yl(this,"afterCaptureMetric","flushMetrics",D0,Lp)}captureException(t,n,r){const s=lt();if(_l(t))return q&&G.log(Hl),s;const o={event_id:s,...n};return this._process(()=>this.eventFromException(t,o).then(i=>this._captureEvent(i,o,r)).then(i=>i),"error"),o.event_id}captureMessage(t,n,r,s){const o={event_id:lt(),...r},i=Wi(t)?t:String(t),c=zn(t),l=c?this.eventFromMessage(i,n,o):this.eventFromException(t,o);return this._process(()=>l.then(u=>this._captureEvent(u,o,s)),c?"unknown":"error"),o.event_id}captureEvent(t,n,r){const s=lt();if(n!=null&&n.originalException&&_l(n.originalException))return q&&G.log(Hl),s;const o={event_id:s,...n},i=t.sdkProcessingMetadata||{},c=i.capturedSpanScope,l=i.capturedSpanIsolationScope,u=ql(t.type);return this._process(()=>this._captureEvent(t,o,c||r,l),u),o.event_id}captureSession(t){this.sendSession(t),Hn(t,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(t){const n=this._transport;if(!n)return!0;this.emit("flush");const r=await this._isClientDoneProcessing(t),s=await n.flush(t);return r&&s}async close(t){ti(this);const n=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){(this._isEnabled()||this._options.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){const n=this._integrations[t.name];!n&&t.beforeSetup&&t.beforeSetup(this),Np(this,t,this._integrations),n||Gl(this,[t])}sendEvent(t,n={}){this.emit("beforeSendEvent",t,n);let r=Ey(t,this._dsn,this._options._metadata,this._options.tunnel);for(const s of n.attachments||[])r=my(r,_y(s));this.sendEnvelope(r).then(s=>this.emit("afterSendEvent",t,s))}sendSession(t){const{release:n,environment:r=Xi}=this._options;if("aggregates"in t){const o=t.attrs||{};if(!o.release&&!n){q&&G.warn(Wl);return}o.release=o.release||n,o.environment=o.environment||r,t.attrs=o}else{if(!t.release&&!n){q&&G.warn(Wl);return}t.release=t.release||n,t.environment=t.environment||r}this.emit("beforeSendSession",t);const s=Sy(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(s)}recordDroppedEvent(t,n,r=1){if(this._options.sendClientReports){const s=`${t}:${n}`;q&&G.log(`Recording outcome: "${s}"${r>1?` (${r} times)`:""}`),this._outcomes[s]=(this._outcomes[s]||0)+r}}on(t,n){const r=this._hooks[t]=this._hooks[t]||new Set,s=(...o)=>n(...o);return r.add(s),()=>{r.delete(s)}}emit(t,...n){const r=this._hooks[t];r&&r.forEach(s=>s(...n))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport)try{return await this._transport.send(t)}catch(n){return q&&G.error("Error while sending envelope:",n),{}}return q&&G.error("Transport disabled"),{}}dispose(){}_setupIntegrations(){const{integrations:t}=this._options;this._integrations=g0(this,t),Gl(this,t)}_updateSessionFromEvent(t,n){var l,u;let r=n.level==="fatal",s=!1;const o=(l=n.exception)==null?void 0:l.values;if(o){s=!0,r=!1;for(const d of o)if(((u=d.mechanism)==null?void 0:u.handled)===!1){r=!0;break}}const i=t.status==="ok";(i&&t.errors===0||i&&r)&&(Hn(t,{...r&&{status:"crashed"},errors:t.errors||Number(s||r)}),this.captureSession(t))}async _isClientDoneProcessing(t){let n=0;for(;!t||n<t;){if(await new Promise(r=>setTimeout(r,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,n,r,s){const o=this.getOptions(),i=Object.keys(this._integrations);return!n.integrations&&(i!=null&&i.length)&&(n.integrations=i),this.emit
10("preprocessEvent",t,n),t.type||s.setLastEventId(t.event_id||n.event_id),Ky(o,t,n,r,this,s).then(c=>{var u;if(c===null)return c;this.emit("postprocessEvent",c,n),c.contexts={trace:{...(u=c.contexts)==null?void 0:u.trace,...Ag(r)},...c.contexts};const l=_p(this,r);return c.sdkProcessingMetadata={dynamicSamplingContext:l,...c.sdkProcessingMetadata},c})}_captureEvent(t,n={},r=Se(),s=st()){return q&&ni(t)&&G.log(`Captured error event \`${Mp(t)[0]||"<unknown>"}\``),this._processEvent(t,n,r,s).then(o=>o.event_id,o=>{q&&(Vl(o)?G.log(o.message):Jl(o)?G.warn(o.message):G.warn(o))})}_processEvent(t,n,r,s){const o=this.getOptions(),{sampleRate:i}=o,c=$p(t),l=ni(t),d=`before send for type \`${t.type||"error"}\``,p=typeof i>"u"?void 0:Ar(i);if(l&&typeof p=="number"&&qt()>p)return this.recordDroppedEvent("sample_rate","error"),Qi(ua(`Discarding event because it's not included in the random sample (sampling rate = ${i})`));const m=ql(t.type);return this._prepareEvent(t,n,r,s).then(g=>{var y;if(g===null)throw this.recordDroppedEvent("event_processor",m),ua("An event processor returned `null`, will not send event.");if(((y=n.data)==null?void 0:y.__sentry__)===!0)return g;const h=O0(this,o,g,n);return P0(h,d)}).then(g=>{var y;if(g===null){if(this.recordDroppedEvent("before_send",m),c){const x=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",x)}throw ua(`${d} returned \`null\`, will not send event.`)}const _=r.getSession()||s.getSession();if(l&&_&&this._updateSessionFromEvent(_,g),c){const b=((y=g.sdkProcessingMetadata)==null?void 0:y.spanCountBeforeProcessing)||0,x=g.spans?g.spans.length:0,w=b-x;w>0&&this.recordDroppedEvent("before_send","span",w)}const h=g.transaction_info;if(c&&h&&g.transaction!==t.transaction){const b="custom";g.transaction_info={...h,source:b}}return this.sendEvent(g,n),g}).then(null,g=>{throw Vl(g)||Jl(g)?g:(this.captureException(g,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:g}),Bs(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event. 11Reason: ${g}`))})}_process(t,n){this._numProcessing++,this._promiseBuffer.add(t).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===ec&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){const t=this._outcomes;return this._outcomes={},Object.entries(t).map(([n,r])=>{const[s,o]=n.split(":");return{reason:s,category:o,quantity:r}})}_flushOutcomes(){q&&G.log("Flushing outcomes...");const t=this._clearOutcomes();if(t.length===0){q&&G.log("No outcomes to send");return}if(!this._dsn){q&&G.log("No dsn provided, will not send outcomes");return}q&&G.log("Sending outcomes:",t);const n=R0(t,this._options.tunnel&&An(this._dsn));this.sendEnvelope(n)}}function ql(e){return e==="replay_event"?"replay":e||"error"}function P0(e,t){const n=`${t} must return \`null\` or a valid event.`;if(Hr(e))return e.then(r=>{if(!vr(r)&&r!==null)throw Bs(n);return r},r=>{throw Bs(`${t} rejected with ${r}`)});if(!vr(e)&&e!==null)throw Bs(n);return e}function O0(e,t,n,r){const{beforeSend:s,beforeSendTransaction:o,ignoreSpans:i}=t,c=!xp(t.beforeSendSpan)&&t.beforeSendSpan;let l=n;if(ni(l)&&s)return s(l,r);if($p(l)){if(c||i){const u=k0(l);if(i!=null&&i.length&&Ir(u,i))return null;if(c){const d=c(u);d?l=Yr(n,N0(d)):qa()}if(l.spans){const d=[],p=l.spans;for(const g of p){if(i!=null&&i.length&&Ir(g,i)){ay(p,g);continue}if(c){const _=c(g);_?d.push(_):(qa(),d.push(g))}else d.push(g)}const m=l.spans.length-d.length;m&&e.recordDroppedEvent("before_send","span",m),l.spans=d}}if(o){if(l.spans){const u=l.spans.length;l.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:u}}return o(l,r)}}return l}function ni(e){return e.type===void 0}function $p(e){return e.type==="transaction"}function D0(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+Bp(e.attributes)}function M0(e){let t=0;return e.message&&(t+=e.message.length*2),t+Bp(e.attributes)}function Bp(e){if(!e)return 0;let t=0;return Object.values(e).forEach(n=>{Array.isArray(n)?t+=n.length*Kl(n[0]):zn(n)?t+=Kl(n):t+=100}),t}function Kl(e){return typeof e=="string"?e.length*2:typeof e=="number"?8:typeof e=="boolean"?4:0}function U0(e){return Gr(e)&&"__sentry_fetch_url_host__"in e&&typeof e.__sentry_fetch_url_host__=="string"}function Xl(e){return U0(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function F0(e,t){t.debug===!0&&(q?G.enable():Tn(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Se().update(t.initialScope);const r=new e(t);return $0(r),r.init(),r}function $0(e){Se().setClient(e)}const B0="thismessage:/";function zp(e){return"isRelative"in e}function Gp(e,t){const n=e.indexOf("://")<=0&&e.indexOf("//")!==0,r=n?B0:void 0;try{if("canParse"in URL&&!URL.canParse(e,r))return;const s=new URL(e,r);return n?{isRelative:n,pathname:s.pathname,search:s.search,hash:s.hash}:s}catch{}}function z0(e){if(zp(e))return e.pathname;const t=new URL(e);return t.search="",t.hash="",["80","443"].includes(t.port)&&(t.port=""),t.password&&(t.password="%filtered%"),t.username&&(t.username="%filtered%"),t.toString()}function xn(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function G0(e){return e.split(/[?#]/,1)[0]}
11function Xt(e,t=!0){if(e.startsWith("data:")){const n=e.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",s=e.includes(";base64,"),o=e.indexOf(",");let i="";if(t&&o!==-1){const c=e.slice(o+1);i=c.length>10?`${c.slice(0,10)}... [truncated]`:c}return`data:${r}${s?",base64":""}${i?`,${i}`:""}`}return e}function H0(e){var t;"aggregates"in e?((t=e.attrs)==null?void 0:t.ip_address)===void 0&&(e.attrs={...e.attrs,ip_address:"{{auto}}"}):e.ipAddress===void 0&&(e.ipAddress="{{auto}}")}function Hp(e,t,n=[t],r="npm"){const s=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};s.name||(s.name=`sentry.javascript.${t}`,s.packages=n.map(o=>({name:`${r}:@sentry/${o}`,version:gn})),s.version=gn)}function Wp(e={}){const t=e.client||he();if(!c0()||!t)return{};const n=vn(),r=Xn(n);if(r.getTraceData)return r.getTraceData(e);const s=e.scope||Se(),o=e.span||pt(),i=o?Kg(o):W0(s),c=o?Qt(o):_p(t,s),l=Og(c);if(!lp.test(i))return G.warn("Invalid sentry-trace data. Cannot generate trace data"),{};const d={"sentry-trace":i,baggage:l};return e.propagateTraceparent&&(d.traceparent=o?Xg(o):J0(s)),d}function W0(e){const{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return up(t,r,n)}function J0(e){const{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return dp(t,r,n)}const V0=100;function En(e,t){const n=he(),r=st();if(!n)return;const{beforeBreadcrumb:s=null,maxBreadcrumbs:o=V0}=n.getOptions();if(o<=0)return;const c={timestamp:Cn(),...e},l=s?Tn(()=>s(c,t)):c;l!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",l,t),r.addBreadcrumb(l,o))}let Zl;const Y0="FunctionToString",Ql=new WeakMap,q0=(()=>({name:Y0,setupOnce(){Zl=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=Yi(this),n=Ql.has(he())&&t!==void 0?t:this;return Zl.apply(n,e)}}catch{}},setup(e){Ql.set(e,!0)}})),K0=q0,X0=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],Z0="EventFilters",Q0=(e={})=>{let t;return{name:Z0,setup(n){const r=n.getOptions();t=eu(e,r)},processEvent(n,r,s){if(!t){const o=s.getOptions();t=eu(e,o)}return t_(n,t)?null:n}}},e_=((e={})=>({...Q0(e),name:"InboundFilters"}));function eu(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:X0],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function t_(e,t){if(e.type){if(e.type==="transaction"&&r_(e,t.ignoreTransactions))return q&&G.warn(`Event dropped due to being matched by \`ignoreTransactions\` option. 12Event: ${fn(e)}`),!0}else{if(n_(e,t.ignoreErrors))return q&&G.warn(`Event dropped due to being matched by \`ignoreErrors\` option. 13Event: ${fn(e)}`),!0;if(i_(e))return q&&G.warn(`Event dropped due to not having an error message, error type or stacktrace. 14Event: ${fn(e)}`),!0;if(s_(e,t.denyUrls))return q&&G.warn(`Event dropped due to being matched by \`denyUrls\` option. 15Event: ${fn(e)}. 16Url: ${lo(e)}`),!0;if(!o_(e,t.allowUrls))return q&&G.warn(`Event dropped due to not being matched by \`allowUrls\` option. 17Event: ${fn(e)}. 18Url: ${lo(e)}`),!0}return!1}function n_(e,t){return t!=null&&t.length?Mp(e).some(n=>Kt(n,t)):!1}function r_(e,t){if(!(t!=null&&t.length))return!1;const n=e.transaction;return n?Kt(n,t):!1}function s_(e,t){if(!(t!=null&&t.length))return!1;const n=lo(e);return n?Kt(n,t):!1}function o_(e,t){if(!(t!=null&&t.length))return!0;const n=lo(e);return n?Kt(n,t):!0}function a_(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function lo(e){var t,n;try{const r=[...((t=e.exception)==null?void 0:t.values)??[]].reverse().find(o=>{var i,c,l;return((i=o.mechanism)==null?void 0:i.parent_id)===void 0&&((l=(c=o.stacktrace)==null?void 0:c.frames)==null?void 0:l.length)}),s=(n=r==null?void 0:r.stacktrace)==null?void 0:n.frames;return s?a_(s):null}catch{return q&&G.error(`Cannot extract url for event ${fn(e)}`),null}}function i_(e){var t,n;return(n=(t=e.exception)==null?void 0:t.values)!=null&&n.length?!e.message&&!e.exception.values.some(r=>r.stacktrace||r.type&&r.type!=="Error"||r.value):!1}function c_(e,t,n,r,s,o){var c;if(!((c=s.exception)!=null&&c.values)||!o||!Mt(o.originalException,Error))return;const i=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;i&&(s.exception.values=ri(e,t,r,o.originalException,n,s.exception.values,i,0
18))}function ri(e,t,n,r,s,o,i,c){if(o.length>=n+1)return o;let l=[...o];if(Mt(r[s],Error)){tu(i,c,r);const u=e(t,r[s]),d=l.length;nu(u,s,d,c),l=ri(e,t,n,r[s],s,[u,...l],u,d)}return Jp(r)&&r.errors.forEach((u,d)=>{if(Mt(u,Error)){tu(i,c,r);const p=e(t,u),m=l.length;nu(p,`errors[${d}]`,m,c),l=ri(e,t,n,u,s,[p,...l],p,m)}}),l}function Jp(e){return Array.isArray(e.errors)}function tu(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...Jp(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function nu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function l_(e){const t="console";nn(t,e),rn(t,u_)}function u_(){"console"in fe&&Wh.forEach(function(e){e in fe.console&&tt(fe.console,e,function(t){return oo[e]=t,function(...n){ct("console",{args:n,level:e});const s=oo[e];s==null||s.apply(fe.console,n)}})})}function d_(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}const p_="Dedupe",m_=(()=>{let e;return{name:p_,processEvent(t){if(t.type)return t;try{if(h_(t,e))return q&&G.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}}),f_=m_;function h_(e,t){return t?!!(g_(e,t)||y_(e,t)):!1}function g_(e,t){const n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!Yp(e,t)||!Vp(e,t))}function y_(e,t){const n=ru(t),r=ru(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!Yp(e,t)||!Vp(e,t))}function Vp(e,t){let n=pl(e),r=pl(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let s=0;s<r.length;s++){const o=r[s],i=n[s];if(o.filename!==i.filename||o.lineno!==i.lineno||o.colno!==i.colno||o.function!==i.function)return!1}return!0}function Yp(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function ru(e){var t,n;return(n=(t=e.exception)==null?void 0:t.values)==null?void 0:n[0]}const __="ConversationId",x_=(()=>({name:__,setup(e){e.on("spanStart",t=>{const n=Se().getScopeData(),r=st().getScopeData(),s=n.conversationId||r.conversationId;s&&t.setAttribute(Rg,s)})}})),b_=x_;function w_(e,t,n,r,s){if(!e.fetchData)return;const{method:o,url:i}=e.fetchData,c=yt()&&t(i);if(e.endTimestamp){const g=e.fetchData.__span;if(!g)return;const _=r[g];_&&(c&&(v_(_,e),S_(_,e,s)),delete r[g]);return}const{spanOrigin:l="auto.http.browser",propagateTraceparent:u=!1}=typeof s=="object"?s:{spanOrigin:s},d=!!pt(),p=c&&d?Qn(C_(i,o,l)):new Et;if(e.fetchData.__span=p.spanContext().spanId,r[p.spanContext().spanId]=p,n(e.fetchData.url)){const g=e.args[0],_={...e.args[1]||{}},h=E_(g,_,yt()&&d?p:void 0,u);h&&(e.args[1]=_,_.headers=h)}const m=he();if(m){const g={input:e.args,response:e.response,startTimestamp:e.startTimestamp,endTimestamp:e.endTimestamp};m.emit("beforeOutgoingRequestSpan",p,g)}return p}function S_(e,t,n){var s;const r=typeof n=="object"&&n!==null?n.onRequestSpanEnd:void 0;r==null||r(e,{headers:(s=t.response)==null?void 0:s.headers,error:t.error})}function E_(e,t,n,r){const s=Wp({span:n,propagateTraceparent:r}),o=s["sentry-trace"],i=s.baggage,c=s.traceparent;if(!o)return;const l=t.headers||(Ji(e)?e.headers:void 0);if(l)if(T_(l)){const u=new Headers(l);if(u.get("sentry-trace")||u.set("sentry-trace",o),r&&c&&!u.get("traceparent")&&u.set("traceparent",c),i){const d=u.get("baggage");d?Ss(d)||u.set("baggage",`${d},${i}`):u.set("baggage",i)}return u}else if(Array.isArray(l)){const u=[...l];l.find(p=>p[0]==="sentry-trace")||u.push(["sentry-trace",o]),r&&c&&!l.find(p=>p[0]==="traceparent")&&u.push(["traceparent",c]);const d=l.find(p=>p[0]==="baggage"&&Ss(p[1]));return i&&!d&&u.push(["baggage",i]),u}else{const u="sentry-trace"in l?l["sentry-trace"]:void 0,d="traceparent"in l?l.traceparent:void 0,p="baggage"in l?l.baggage:void 0,m=p?Array.isArray(p)?[...p]:[p]:[],g=p&&(Array.isArray(p)?p.find(h=>Ss(h)):Ss(p));i&&!g&&m.push(i);const _={...l,"sentry-trace":u??o,baggage:m.length>0?m.join(","):void 0};return r&&c&&!d&&(_.traceparent=c),_}else return{...s}}function v_(e,t){var n,r;if(t.response){rp(e,t.response.status);const s=(r=(n=t.response)==null?void 0:n.headers)==null?void 0:r.get("content-length");if(s){const o=parseInt(s);o>0&&e.setAttribute("http.response_content_length",o)}}else t.error&&e.setStatus({code:Me,message:"internal_error"});e.end()}function Ss(e){return e.split(",").some(t=>t.trim().startsWith(co))}function T_(e){return typeof Headers<"u"&&Mt(e,Headers)}function C_(e,t,n){if(e.startsWith("data:")){const o=Xt(e);return{name:`${t} ${o}`,attributes:su(e,void 0,t,n)}}const r=Gp(e),s=r?z0(r):e;return{name:`${t} ${s}`,attributes:su(e,r,t,n)}}function su(e,t,n,r){const s={url:Xt(e),type:"fetch","http.method":n,[$e]:r,[Ft]:"http.client"};return t&&(zp(t)||(s["http.url"]=Xt(t.href),s["server.address"]=t.host),t.search&&(s["http.query"]=t.search),t.hash&&(s["http.fragment"]=t.hash)),s}function qp(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}const kr=fe;
18function A_(){return"history"in kr&&!!kr.history}function I_(){if(!("fetch"in kr))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}function si(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function R_(){var n;if(typeof EdgeRuntime=="string")return!0;if(!I_())return!1;if(si(kr.fetch))return!0;let e=!1;const t=kr.document;if(t&&typeof t.createElement=="function")try{const r=t.createElement("iframe");r.hidden=!0,t.head.appendChild(r),(n=r.contentWindow)!=null&&n.fetch&&(e=si(r.contentWindow.fetch)),t.head.removeChild(r)}catch(r){q&&G.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return e}function Kp(e,t){const n="fetch";nn(n,e),rn(n,()=>Xp(void 0,t))}function k_(e){const t="fetch-body-resolved";nn(t,e),rn(t,()=>Xp(j_))}function Xp(e,t=!1){t&&!R_()||tt(fe,"fetch",function(n){return function(...r){const s=new Error,{method:o,url:i}=L_(r),c={args:r,fetchData:{method:o,url:i},startTimestamp:Fe()*1e3,virtualError:s,headers:P_(r)};return e||ct("fetch",{...c}),n.apply(fe,r).then(async l=>(e?e(l):ct("fetch",{...c,endTimestamp:Fe()*1e3,response:l}),l),l=>{ct("fetch",{...c,endTimestamp:Fe()*1e3,error:l}),Gr(l)&&l.stack===void 0&&(l.stack=s.stack,Ze(l,"framesToPop",1));const u=he(),d=(u==null?void 0:u.getOptions().enhanceFetchErrorMessages)??"always";if(d!==!1&&l instanceof TypeError&&(l.message==="Failed to fetch"||l.message==="Load failed"||l.message==="NetworkError when attempting to fetch resource."))try{const g=new URL(c.fetchData.url).host;d==="always"?l.message=`${l.message} (${g})`:Ze(l,"__sentry_fetch_url_host__",g)}catch{}throw l})}})}async function N_(e,t){if(e!=null&&e.body){const n=e.body,r=n.getReader(),s=setTimeout(()=>{n.cancel().then(null,()=>{})},90*1e3);let o=!0;for(;o;){let i;try{i=setTimeout(()=>{n.cancel().then(null,()=>{})},5e3);const{done:c}=await r.read();clearTimeout(i),c&&(t(),o=!1)}catch{o=!1}finally{clearTimeout(i)}}clearTimeout(s),r.releaseLock(),n.cancel().then(null,()=>{})}}function j_(e){let t;try{t=e.clone()}catch{return}N_(t,()=>{ct("fetch-body-resolved",{endTimestamp:Fe()*1e3,response:e})})}function zs(e,t){return!!e&&typeof e=="object"&&!!e[t]}function ou(e){return typeof e=="string"?e:e?zs(e,"url")?e.url:e.toString?e.toString():"":""}function L_(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){const[n,r]=e;return{url:ou(n),method:zs(r,"method")?String(r.method).toUpperCase():Ji(n)&&zs(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:ou(t),method:zs(t,"method")?String(t.method).toUpperCase():"GET"}}function P_(e){const[t,n]=e;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(Ji(t))return new Headers(t.headers)}catch{}}function O_(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function D_(){return"npm"}function M_(){return!O_()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function U_(){return typeof window<"u"&&(!M_()||F_())}function F_(){const e=fe.process;return(e==null?void 0:e.type)==="renderer"}const ae=fe;let oi=0;function Zp(){return oi>0}function $_(){oi++,setTimeout(()=>{oi--})}function Jn(e,t={}){function n(s){return typeof s=="function"}if(!n(e))return e;try{const s=e.__sentry_wrapped__;if(s)return typeof s=="function"?s:e;if(Yi(e))return e}catch{return e}const r=function(...s){try{const o=s.map(i=>Jn(i,t));return e.apply(this,o)}catch(o){throw $_(),qr(i=>{i.addEventProcessor(c=>(t.mechanism&&(Ja(c,void 0),Gn(c,t.mechanism)),c.extra={...c.extra,arguments:s},c)),Po(o)}),o}};try{for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}catch{}Kd(r,e),Ze(e,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return e.name}})}catch{}return r}function nc(){const e=Wr(),{referrer:t}=ae.document||{},{userAgent:n}=ae.navigator||{},r={...t&&{Referer:t},...n&&{"User-Agent":n}};return{url:e,headers:r}}function rc(e,t){const n=sc(e,t),r={type:W_(t),value:J_(t)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function B_(e,t,n,r){const s=he(),o=s==null?void 0:s.getOptions().normalizeDepth,i=X_(t),c={__serialized__:bp(t,o)};if(i)return{exception:{values:[rc(e,i)]},extra:c};const l={exception:{values:[{type:ko(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:q_(t,{isUnhandledRejection:r})}]},extra:c};if(n){const u=sc(e,n);u.length&&(l.exception.values[0].stacktrace={frames:u})}return l}function da(e,t){return{exception:{values:[rc(e,t)]}}}function sc(e,t){const n=t.stacktrace||t.stack||"",r=G_(t),s=H_(t);try{return e(n,r,s)}catch{}return[]}const z_=/Minified React error #\d+;/i;function G_(e){return e&&z_.test(e.message)?1:0}function H_(e){return typeof e.framesToPop=="number"?e.framesToPop:0}function Qp(e){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?e instanceof WebAssembly.Exception:!1}function W_(e){const t=e==null?void 0:e.name;return!t&&Qp(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:"WebAssembly.Exception":t}function J_(e){const t=e==null?void 0:e.message;return Qp(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:"wasm exception":t?t.error&&typeof t.error.message=="string"?Xl(t.error):Xl(e):"No error message"}function V_(e,t,n,r){const s=(n==null?void 0:n.syntheticException)||void 0,o=oc(e,t,s,r);return Gn(o),o.level="error",n!=null&&n.event_id&&(o.event_id=n.event_id),Qr(o)}function Y_(e,t,n="info",r,s){const o=(r==null?void 0:r.syntheticException)||void 0,i=ai(e,t,o,s);return i.level=n,r!=null&&r.event_id&&(i.event_id=r.event_id),Qr(i)}
18function oc(e,t,n,r,s){let o;if(Vd(t)&&t.error)return da(e,t.error);if(fl(t)||ng(t)){const i=t;if("stack"in t)o=da(e,t);else{const c=i.name||(fl(i)?"DOMError":"DOMException"),l=i.message?`${c}: ${i.message}`:c;o=ai(e,l,n,r),Ja(o,l)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return Gr(t)?da(e,t):vr(t)||ko(t)?(o=B_(e,t,n,s),Gn(o,{synthetic:!0}),o):(o=ai(e,t,n,r),Ja(o,`${t}`),Gn(o,{synthetic:!0}),o)}function ai(e,t,n,r){const s={};if(r&&n){const o=sc(e,n);o.length&&(s.exception={values:[{value:t,stacktrace:{frames:o}}]}),Gn(s,{synthetic:!0})}if(Wi(t)){const{__sentry_template_string__:o,__sentry_template_values__:i}=t;return s.logentry={message:o,params:i},s}return s.message=t,s}function q_(e,{isUnhandledRejection:t}){const n=cg(e),r=t?"promise rejection":"exception";return Vd(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:ko(e)?`Event \`${K_(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function K_(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function X_(e){return Object.values(e).find(t=>t instanceof Error)}class Z_ extends L0{constructor(t){var d;const n=Q_(t),r=ae.SENTRY_SDK_SOURCE||D_();Hp(n,"browser",["browser"],r),(d=n._metadata)!=null&&d.sdk&&(n._metadata.sdk.settings={infer_ip:n.sendDefaultPii?"auto":"never",...n._metadata.sdk.settings}),super(n);const{sendDefaultPii:s,sendClientReports:o,enableLogs:i,_experiments:c,enableMetrics:l}=this._options,u=l??(c==null?void 0:c.enableMetrics)??!0;ae.document&&(o||i||u)&&ae.document.addEventListener("visibilitychange",()=>{ae.document.visibilityState==="hidden"&&(o&&this._flushOutcomes(),i&&ti(this),u&&Lp(this))}),s&&this.on("beforeSendSession",H0)}eventFromException(t,n){return V_(this._options.stackParser,t,n,this._options.attachStacktrace)}eventFromMessage(t,n="info",r){return Y_(this._options.stackParser,t,n,r,this._options.attachStacktrace)}_prepareEvent(t,n,r,s){return t.platform=t.platform||"javascript",super._prepareEvent(t,n,r,s)}}function Q_(e){var t;return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:(t=ae.SENTRY_RELEASE)==null?void 0:t.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}const es=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,ne=fe,ex=(e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good",ts=(e,t,n,r)=>{let s,o;return i=>{t.value>=0&&(i||r)&&(o=t.value-(s??0),(o||s===void 0)&&(s=t.value,t.delta=o,t.rating=ex(t.value,n),e(t)))}},ns=(e=!0)=>{var n,r;const t=(r=(n=ne.performance)==null?void 0:n.getEntriesByType)==null?void 0:r.call(n,"navigation")[0];if(!e||t&&t.responseStart>0&&t.responseStart<performance.now())return t},er=()=>{const e=ns();return(e==null?void 0:e.activationStart)??0};function Zt(e,t,n){ne.document&&ne.addEventListener(e,t,n)}function uo(e,t,n){ne.document&&ne.removeEventListener(e,t,n)}let Fn=-1;const em=new Set,tx=()=>{var e,t;return((e=ne.document)==null?void 0:e.visibilityState)==="hidden"&&!((t=ne.document)!=null&&t.prerendering)?0:1/0},Gs=e=>{if(nx(e)&&Fn>-1){if(e.type==="visibilitychange"||e.type==="pagehide")for(const t of em)t();isFinite(Fn)||(Fn=e.type==="visibilitychange"?e.timeStamp:0,uo("prerenderingchange",Gs,!0))}},rs=()=>{var e;if(ne.document&&Fn<0){const t=er();Fn=(ne.document.prerendering||(e=globalThis.performance.getEntriesByType("visibility-state").filter(r=>r.name==="hidden"&&r.startTime>t)[0])==null?void 0:e.startTime)??tx(),Zt("visibilitychange",Gs,!0),Zt("pagehide",Gs,!0),Zt("prerenderingchange",Gs,!0)}return{get firstHiddenTime(){return Fn},onHidden(t){em.add(t)}}};function nx(e){var t;return e.type==="pagehide"||((t=ne.document)==null?void 0:t.visibilityState)==="hidden"}const rx=()=>`v5-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,ss=(e,t=-1)=>{var o,i;const n=ns();let r="navigate";return n&&((o=ne.document)!=null&&o.prerendering||er()>0?r="prerender":(i=ne.document)!=null&&i.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:rx(),navigationType:r}},pa=new WeakMap;function ac(e,t){try{return pa.get(e)||pa.set(e,new t),pa.get(e)}catch{return new t}}class po{constructor(){po.prototype.__init.call(this),po.prototype.__init2.call(this)}__init(){this._sessionValue=0}__init2(){this._sessionEntries=[]}_processEntry(t){var s;if(t.hadRecentInput)return;const n=this._sessionEntries[0],r=this._sessionEntries[this._sessionEntries.length-1];this._sessionValue&&n&&r&&t.startTime-r.startTime<1e3&&t.startTime-n.startTime<5e3?(this._sessionValue+=t.value,this._sessionEntries.push(t)):(this._sessionValue=t.value,this._sessionEntries=[t]),(s=this._onAfterProcessingUnexpectedShift)==null||s.call(this,t)}}const tr=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const r=new PerformanceObserver(s=>{Promise.resolve().then(()=>{t(s.getEntries())})});return r.observe({type:e,buffered:!0,...n}),r}}catch{}},ic=e=>{let t=!1;return()=>{t||(e(),t=!0)}},Oo=e=>{var t;(t=ne.document)!=null&&t.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},sx=[1800,3e3],ox=(e,t={})=>{Oo(()=>{const n=rs(),r=ss("FCP");let s;const i=tr("paint",c=>{for(const l of c)l.name==="first-contentful-paint"&&(i.disconnect(),l.startTime<n.firstHiddenTime&&(r.value=Math.max(l.startTime-er(),0),r.entries.push(l),s(!0)))});i&&(s=ts(e,r,sx,t.reportAllChanges))})},ax=[.1,.25],ix=(e,t={})=>{ox(ic(()=>{var l;const n=ss("CLS",0);let r;const s=rs(),o=ac(t,po),i=u=>{for(const d of u)o._processEntry(d);o._sessionValue>
18n.value&&(n.value=o._sessionValue,n.entries=o._sessionEntries,r())},c=tr("layout-shift",i);c&&(r=ts(e,n,ax,t.reportAllChanges),s.onHidden(()=>{i(c.takeRecords()),r(!0)}),(l=ne==null?void 0:ne.setTimeout)==null||l.call(ne,r))}))};let tm=0,ma=1/0,Es=0;const cx=e=>{e.forEach(t=>{t.interactionId&&(ma=Math.min(ma,t.interactionId),Es=Math.max(Es,t.interactionId),tm=Es?(Es-ma)/7+1:0)})};let ii;const nm=()=>ii?tm:performance.interactionCount||0,lx=()=>{"interactionCount"in performance||ii||(ii=tr("event",cx,{type:"event",buffered:!0,durationThreshold:0}))},fa=10;let rm=0;const ux=()=>nm()-rm;class mo{constructor(){mo.prototype.__init.call(this),mo.prototype.__init2.call(this)}__init(){this._longestInteractionList=[]}__init2(){this._longestInteractionMap=new Map}_resetInteractions(){rm=nm(),this._longestInteractionList.length=0,this._longestInteractionMap.clear()}_estimateP98LongestInteraction(){const t=Math.min(this._longestInteractionList.length-1,Math.floor(ux()/50));return this._longestInteractionList[t]}_processEntry(t){var s,o;if((s=this._onBeforeProcessingEntry)==null||s.call(this,t),!(t.interactionId||t.entryType==="first-input"))return;const n=this._longestInteractionList.at(-1);let r=this._longestInteractionMap.get(t.interactionId);if(r||this._longestInteractionList.length<fa||t.duration>n._latency){if(r?t.duration>r._latency?(r.entries=[t],r._latency=t.duration):t.duration===r._latency&&t.startTime===r.entries[0].startTime&&r.entries.push(t):(r={id:t.interactionId,entries:[t],_latency:t.duration},this._longestInteractionMap.set(r.id,r),this._longestInteractionList.push(r)),this._longestInteractionList.sort((i,c)=>c._latency-i._latency),this._longestInteractionList.length>fa){const i=this._longestInteractionList.splice(fa);for(const c of i)this._longestInteractionMap.delete(c.id)}(o=this._onAfterProcessingINPCandidate)==null||o.call(this,r)}}}const sm=e=>{var n;const t=ne.requestIdleCallback||ne.setTimeout;((n=ne.document)==null?void 0:n.visibilityState)==="hidden"?e():(e=ic(e),Zt("visibilitychange",e,{once:!0,capture:!0}),Zt("pagehide",e,{once:!0,capture:!0}),t(()=>{e(),uo("visibilitychange",e,{capture:!0}),uo("pagehide",e,{capture:!0})}))},dx=[200,500],px=40,mx=(e,t={})=>{if(!(globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype))return;const n=rs();Oo(()=>{lx();const r=ss("INP");let s;const o=ac(t,mo),i=l=>{sm(()=>{for(const d of l)o._processEntry(d);const u=o._estimateP98LongestInteraction();u&&u._latency!==r.value&&(r.value=u._latency,r.entries=u.entries,s())})},c=tr("event",i,{durationThreshold:t.durationThreshold??px});s=ts(e,r,dx,t.reportAllChanges),c&&(c.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{i(c.takeRecords()),s(!0)}))})};class fx{_processEntry(t){var n;(n=this._onBeforeProcessingEntry)==null||n.call(this,t)}}const hx=[2500,4e3],gx=(e,t={})=>{Oo(()=>{const n=rs(),r=ss("LCP");let s;const o=ac(t,fx),i=l=>{t.reportAllChanges||(l=l.slice(-1));for(const u of l)o._processEntry(u),u.startTime<n.firstHiddenTime&&(r.value=Math.max(u.startTime-er(),0),r.entries=[u],s())},c=tr("largest-contentful-paint",i);if(c){s=ts(e,r,hx,t.reportAllChanges);const l=ic(()=>{i(c.takeRecords()),c.disconnect(),s(!0)}),u=d=>{d.isTrusted&&(sm(l),uo(d.type,u,{capture:!0}))};for(const d of["keydown","click","visibilitychange"])Zt(d,u,{capture:!0})}})},yx=[800,1800],ci=e=>{var t,n;(t=ne.document)!=null&&t.prerendering?Oo(()=>ci(e)):((n=ne.document)==null?void 0:n.readyState)!=="complete"?addEventListener("load",()=>ci(e),!0):setTimeout(e)},_x=(e,t={})=>{const n=ss("TTFB"),r=ts(e,n,yx,t.reportAllChanges);ci(()=>{const s=ns();s&&(n.value=Math.max(s.responseStart-er(),0),n.entries=[s],r(!0))})},br={},fo={};let om,am,im,cm;function lm(e,t=!1){return Do("cls",e,wx,om,t)}function um(e,t=!1){return Do("lcp",e,Sx,am,t)}function xx(e){return Do("ttfb",e,Ex,im)}function bx(e){return Do("inp",e,vx,cm)}function Nr(e,t){return dm(e,t),fo[e]||(Tx(e),fo[e]=!0),pm(e,t)}function os(e,t){const n=br[e];if(n!=null&&n.length)for(const r of n)try{r(t)}catch(s){es&&G.error(`Error while triggering instrumentation handler. 19Type: ${e} 20Name: ${Dt(r)} 21Error:`,s)}}function wx(){return ix(e=>{os("cls",{metric:e}),om=e},{reportAllChanges:!0})}function Sx(){return gx(e=>{os("lcp",{metric:e}),am=e},{reportAllChanges:!0})}function Ex(){return _x(e=>{os("ttfb",{metric:e}),im=e})}function vx(){return mx(e=>{os("inp",{metric:e}),cm=e})}function Do(e,t,n,r,s=!1){dm(e,t);let o;return fo[e]||(o=n(),fo[e]=!0),r&&t({metric:r}),pm(e,t,s?o:void 0)}function Tx(e){const t={};e==="event"&&(t.durationThreshold=0),tr(e,n=>{os(e,{entries:n})},t)}function dm(e,t){br[e]=br[e]||[],br[e].push(t)}function pm(e,t,n){return()=>{n&&n();const r=br[e];
21if(!r)return;const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}function Cx(e){return"duration"in e}const Ax=e=>{const t=n=>{var r;(n.type==="pagehide"||((r=ne.document)==null?void 0:r.visibilityState)==="hidden")&&e(n)};Zt("visibilitychange",t,{capture:!0,once:!0}),Zt("pagehide",t,{capture:!0,once:!0})};function ha(e){return typeof e=="number"&&isFinite(e)}function en(e,t,n,{...r}){const s=ye(e).start_timestamp;return s&&s>t&&typeof e.updateStartTime=="function"&&e.updateStartTime(t),Ep(e,()=>{const o=Qn({startTime:t,...r});return o&&o.end(n),o})}function cc(e){var y;const t=he();if(!t)return;const{name:n,transaction:r,attributes:s,startTime:o}=e,{release:i,environment:c,sendDefaultPii:l}=t.getOptions(),u=t.getIntegrationByName("Replay"),d=u==null?void 0:u.getReplayId(),p=Se(),m=p.getUser(),g=m!==void 0?m.email||m.id||m.ip_address:void 0;let _;try{_=p.getScopeData().contexts.profile.profile_id}catch{}const h={release:i,environment:c,user:g||void 0,profile_id:_||void 0,replay_id:d||void 0,transaction:r,"user_agent.original":(y=ne.navigator)==null?void 0:y.userAgent,"client.address":l?"{{auto}}":void 0,...s};return Qn({name:n,attributes:h,startTime:o,experimental:{standalone:!0}})}function Mo(){return ne.addEventListener&&ne.performance}function Oe(e){return e/1e3}function Ix(e){let t="unknown",n="unknown",r="";for(const s of e){if(s==="/"){[t,n]=e.split("/");break}if(!isNaN(Number(s))){t=r==="h"?"http":r,n=e.split(r)[1];break}r+=s}return r===e&&(t=r),{name:t,version:n}}function mm(e){try{return PerformanceObserver.supportedEntryTypes.includes(e)}catch{return!1}}function fm(e,t){let n,r=!1;function s(c){!r&&n&&t(c,n),r=!0}Ax(()=>{s("pagehide")});const o=e.on("beforeStartNavigationSpan",(c,l)=>{l!=null&&l.isRedirect||(s("navigation"),o(),i())}),i=e.on("afterStartPageLoadSpan",c=>{n=c.spanContext().spanId,i()})}function Rx(e){let t=0,n;if(!mm("layout-shift"))return;const r=lm(({metric:s})=>{const o=s.entries[s.entries.length-1];o&&(t=s.value,n=o)},!0);fm(e,(s,o)=>{kx(t,n,o,s),r()})}function kx(e,t,n,r){var u;es&&G.log(`Sending CLS span (${e})`);const s=t?Oe((dt()||0)+t.startTime):Fe(),o=Se().getScopeData().transactionName,i=t?ut((u=t.sources[0])==null?void 0:u.node):"Layout shift",c={[$e]:"auto.http.browser.cls",[Ft]:"ui.webvital.cls",[Zn]:0,"sentry.pageload.span_id":n,"sentry.report_event":r};t!=null&&t.sources&&t.sources.forEach((d,p)=>{c[`cls.source.${p+1}`]=ut(d.node)});const l=cc({name:i,transaction:o,attributes:c,startTime:s});l&&(l.addEvent("cls",{[Kr]:"",[Xr]:e}),l.end(s))}function Nx(e){let t=0,n;if(!mm("largest-contentful-paint"))return;const r=um(({metric:s})=>{const o=s.entries[s.entries.length-1];o&&(t=s.value,n=o)},!0);fm(e,(s,o)=>{jx(t,n,o,s),r()})}function jx(e,t,n,r){es&&G.log(`Sending LCP span (${e})`);const s=Oe((dt()||0)+((t==null?void 0:t.startTime)||0)),o=Se().getScopeData().transactionName,i=t?ut(t.element):"Largest contentful paint",c={[$e]:"auto.http.browser.lcp",[Ft]:"ui.webvital.lcp",[Zn]:0,"sentry.pageload.span_id":n,"sentry.report_event":r};t&&(t.element&&(c["lcp.element"]=ut(t.element)),t.id&&(c["lcp.id"]=t.id),t.url&&(c["lcp.url"]=t.url),t.loadTime!=null&&(c["lcp.loadTime"]=t.loadTime),t.renderTime!=null&&(c["lcp.renderTime"]=t.renderTime),t.size!=null&&(c["lcp.size"]=t.size));const l=cc({name:i,transaction:o,attributes:c,startTime:s});l&&(l.addEvent("lcp",{[Kr]:"millisecond",[Xr]:e}),l.end(s))}function it(e){return e&&((dt()||performance.timeOrigin)+e)/1e3}function hm(e){var n;const t={};if(e.nextHopProtocol!=null){const{name:r,version:s}=Ix(e.nextHopProtocol);t["network.protocol.version"]=s,t["network.protocol.name"]=r}return dt()||(n=Mo())!=null&&n.timeOrigin?Lx({...t,"http.request.redirect_start":it(e.redirectStart),"http.request.redirect_end":it(e.redirectEnd),"http.request.worker_start":it(e.workerStart),"http.request.fetch_start":it(e.fetchStart),"http.request.domain_lookup_start":it(e.domainLookupStart),"http.request.domain_lookup_end":it(e.domainLookupEnd),"http.request.connect_start":it(e.connectStart),"http.request.secure_connection_start":it(e.secureConnectionStart),"http.request.connection_end":it(e.connectEnd),"http.request.request_start":it(e.requestStart),"http.request.response_start":it(e.responseStart),"http.request.response_end":it(e.responseEnd),"http.request.time_to_first_byte":e.responseStart!=null?e.responseStart/1e3:void 0}):t}function Lx(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null))}const Px=2147483647;let au=0,ft={},Xe,Dn;function Ox({recordClsStandaloneSpans:e,recordLcpStandaloneSpans:t,client:n}){const r=Mo();if(r&&dt()){r.mark&&ne.performance.mark("sentry-tracing-init");const s=t?Nx(n):$x(),o=Bx(),i=e?Rx(n):Fx();return()=>{s==null||s(),o(),i==null||i()}}return()=>{}}function Dx(){Nr("longtask",({entries:e})=>{const t=pt();if(!t)return;const{op:n,start_timestamp:r}=ye(t);for(const s of e){const o=Oe(dt()+s.startTime),i=Oe(s.duration);n==="navigation"&&r&&o<r||en(t,o,o+i,{name:"Main UI thread blocked",op:"ui.long-task",attributes:{[$e]:"auto.ui.browser.metrics"}})}})}function Mx(){new PerformanceObserver(t=>{const n=pt();if(n)for(const r of t.getEntries()){if(!r.scripts[0])continue;const s=Oe(dt()+r.startTime),{start_timestamp:o,op:i}=ye(n);if(i==="navigation"&&o&&s<o)continue;const c=Oe(r.duration),l={[$e]:"auto.ui.browser.metrics"},u=r.scripts[0],{invoker:d,invokerType:p,sourceURL:m,sourceFunctionName:g,sourceCharPosition:_}=u;l["browser.script.invoker"]=d,l["browser.script.invoker_type"]=p,m&&(l["code.filepath"]=m),g&&(l["code.function"]=g),_!==-1&&(l["browser.script.source_char_position"]=_),en(n,s,s+c,{name:"Main UI thread blocked",op:"ui.long-animation-frame",attributes:l})}}).observe({type:"long-animation-frame",buffered:!0})}function Ux(){Nr("event",({entries:e})=>{const t=pt();if(t){for(const n of e)if(n.name==="click"){const r=Oe(dt()+n.startTime),s=Oe(n.duration),o={name:ut(n.target),op:`ui.interaction.${n.name}`,startTime:r,attributes:{[$e]:"auto.ui.browser.metrics"}},i=qd(n.target);i&&(o.attributes["ui.component_name"]=i),en(t,r,r+s,o)}}})}function Fx(){return lm(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(ft.cls={value:e.value,unit:""},Dn=t)},!0)}function $x(){return um(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(ft.lcp={value:e.value,unit:"millisecond"},Xe=t)},!0)}function Bx(){return xx(({metric:e})=>{e.entries[e.entries.length-1]&&(ft.ttfb={value:e.value,unit:"millisecond"})})}function zx(e,t){const n=Mo(),r=dt();if(!(n!=null&&n.getEntries)||!r)return;const s=Oe(r),o=n.getEntries(),{op:i,start_timestamp:c}=ye(e);o.slice(au).forEach(l=>{const u=Oe(l.startTime),d=Oe(Math.max(0,l.duration));if(!(i==="navigation"&&c&&s+u<c))switch(l.entryType){case"navigation":{Jx(e,l,s);break}case"mark":case"paint":case"measure":{Hx(e,l,u,d,s,t.ignorePerformanceApiSpans);const p=rs(),m=l.startTime<p.firstHiddenTime;l.name==="first-paint"&&m&&(ft.fp={value:l.startTime,unit:"millisecond"}),l.name==="first-contentful-paint"&&m&&(ft.fcp={value:l.startTime,unit:"millisecond"});break}case"resource":{qx(e,l,l.name,u,d,s,t.ignoreResourceSpans);break}}}),au=Math.max(o.length-1,0),Kx(e),i==="pageload"&&(Qx(ft),t.recordClsOnPageloadSpan||delete ft.cls,t.recordLcpOnPageloadSpan||delete ft.lcp,Object.entries(ft).forEach(([l,u])=>{Ay(l,u.value,u.unit)}),e.setAttribute("performance.timeOrigin",s),e.setAttribute("performance.activationStart",er()),Xx(e,t)),Xe=void 0,Dn=void 0,ft={}}function Gx(e){if((e==null?void 0:e.entryType)==="measure")try{return e.detail.devtools.track==="Components â"}catch{return}}function Hx(e,t,n,r,s,o){if(Gx(t)||["mark","measure"].includes(t.entryType)&&Kt(t.name,o))return;const i=ns(!1),c=Oe(i?i.requestStart:0),l=s+Math.max(n,c),u=s+n,d=u+r,p={[$e]:"auto.resource.browser.metrics"};l!==u&&(p["sentry.browser.measure_happened_before_request"]=!0,p["sentry.browser.measure_start_time"]=l),Wx(p,t),l<=d&&en(e,l,d,{name:t.name,op:t.entryType,attributes:p})}function Wx(e,t){try{const n=t.detail;if(!n)return;if(typeof n=="object"){for(const[r,s]of Object.entries(n))if(s&&zn(s))e[`sentry.browser.measure.detail.${r}`]=s;else if(s!==void 0)try{e[`sentry.browser.measure.detail.${r}`]=JSON.stringify(s)}catch{}return}if(zn(n)){e["sentry.browser.measure.detail"]=n;return}try{e["sentry.browser.measure.detail"]=JSON.stringify(n)}catch{}}catch{}}function Jx(e,t,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(r=>{vs(e,t,r,n)}),vs(e,t,"secureConnection",n,"TLS/SSL"),vs(e,t,"fetch",n,"cache"),vs(e,t,"domainLookup",n,"DNS"),Yx(e,t,n)}function vs(e,t,n,r,s=n){const o=Vx(n),i=t[o],c=t[`${n}Start`];!c||!i||en(e,r+Oe(c),r+Oe(i),{op:`browser.${s}`,name:t.name,attributes:{[$e]:"auto.ui.browser.metrics",...n==="redirect"&&t.redirectCount!=null?{"http.redirect_count":t.redirectCount}:{}}})}function Vx(e){return e==="secureConnection"?"connectEnd":e==="fetch"?"domainLookupStart":`${e}End`}function Yx(e,t,n){const r=n+Oe(t.requestStart),s=n+Oe(t.responseEnd),o=n+Oe(t.responseStart);t.responseEnd&&(en(e,r,s,{op:"browser.request",name:t.name,attributes:{[$e]:"auto.ui.browser.metrics"}}),en(e,o,s,{op:"browser.response",name:t.name,attributes:{[$e]:"auto.ui.browser.metrics"}}))}function qx(e,t,n,r,s,o,i){if(t.initiatorType==="xmlhttprequest"||t.initiatorType==="fetch")return;const c=t.initiatorType?`resource.${t.initiatorType}`:"resource.other";if(i!=null&&i.includes(c))return;const l={[$e]:"auto.resource.browser.metrics"},u=xn(n);u.protocol&&(l["url.scheme"]=u.protocol.split(":").pop()),u.host&&(l["server.address"]=u.host),l["url.same_origin"]=n.includes(ne.location.origin),Zx(t,l,[["responseStatus","http.response.status_code"],["transferSize","http.response_transfer_size"],["encodedBodySize","http.response_content_length"],["decodedBodySize","http.decoded_response_content_length"],["renderBlockingStatus","resource.render_blocking_status"],["deliveryType","http.response_delivery_type"]]);const d={...l,...hm(t)},p=o+r,m=p+s;en(e,p,m,{name:n.replace(ne.location.origin,""),op:c,attributes:d})}function Kx(e){const t=ne.navigator;if(!t)return;const n=t.connection;n&&(n.effectiveType&&e.setAttribute("effectiveConnectionType",n.effectiveType),n.type&&e.setAttribute("connectionType",n.type),ha(n.rtt)&&(ft["connection.rtt"]={value:n.rtt,unit:"millisecond"})),ha(t.deviceMemory)&&e.setAttribute("deviceMemory",`${t.deviceMemory} GB`),ha(t.hardwareConcurrency)&&e.setAttribute("hardwareConcurrency",String(t.hardwareConcurrency))}function Xx(e,t){Xe&&t.recordLcpOnPageloadSpan&&(Xe.element&&e.setAttribute("lcp.element",ut(Xe.element)),Xe.id&&e.setAttribute("lcp.id",Xe.id),Xe.url&&e.setAttribute("lcp.url",Xe.url.trim().slice(0,200)),Xe.loadTime!=null&&e.setAttribute("lcp.loadTime",Xe.loadTime),Xe.renderTime!=null&&e.setAttribute("lcp.renderTime",Xe.renderTime),e.setAttribute("lcp.size",Xe.size)),Dn!=null&&Dn.sources&&t.recordClsOnPageloadSpan&&Dn.sources.forEac
21h((n,r)=>e.setAttribute(`cls.source.${r+1}`,ut(n.node)))}function Zx(e,t,n){n.forEach(([r,s])=>{const o=e[r];o!=null&&(typeof o=="number"&&o<Px||typeof o=="string")&&(t[s]=o)})}function Qx(e){const t=ns(!1);if(!t)return;const{responseStart:n,requestStart:r}=t;r<=n&&(e["ttfb.requestTime"]={value:n-r,unit:"millisecond"})}const eb=1e3;let iu,li,ui;function tb(e){nn("dom",e),rn("dom",nb)}function nb(){if(!ne.document)return;const e=ct.bind(null,"dom"),t=cu(e,!0);ne.document.addEventListener("click",t,!1),ne.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(n=>{var o,i;const s=(o=ne[n])==null?void 0:o.prototype;(i=s==null?void 0:s.hasOwnProperty)!=null&&i.call(s,"addEventListener")&&(tt(s,"addEventListener",function(c){return function(l,u,d){if(l==="click"||l=="keypress")try{const p=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},m=p[l]=p[l]||{refCount:0};if(!m.handler){const g=cu(e);m.handler=g,c.call(this,l,g,d)}m.refCount++}catch{}return c.call(this,l,u,d)}}),tt(s,"removeEventListener",function(c){return function(l,u,d){if(l==="click"||l=="keypress")try{const p=this.__sentry_instrumentation_handlers__||{},m=p[l];m&&(m.refCount--,m.refCount<=0&&(c.call(this,l,m.handler,d),m.handler=void 0,delete p[l]),Object.keys(p).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return c.call(this,l,u,d)}}))})}function rb(e){if(e.type!==li)return!1;try{if(!e.target||e.target._sentryId!==ui)return!1}catch{}return!0}function sb(e,t){return e!=="keypress"?!1:t!=null&&t.tagName?!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable):!0}function cu(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const r=ob(n);if(sb(n.type,r))return;Ze(n,"_sentryCaptured",!0),r&&!r._sentryId&&Ze(r,"_sentryId",lt());
21const s=n.type==="keypress"?"input":n.type;rb(n)||(e({event:n,name:s,global:t}),li=n.type,ui=r?r._sentryId:void 0),clearTimeout(iu),iu=ne.setTimeout(()=>{ui=void 0,li=void 0},eb)}}function ob(e){try{return e.target}catch{return null}}let Ts;function lc(e){const t="history";nn(t,e),rn(t,ab)}function ab(){if(ne.addEventListener("popstate",()=>{const t=ne.location.href,n=Ts;if(Ts=t,n===t)return;ct("history",{from:n,to:t})}),!A_())return;function e(t){return function(...n){const r=n.length>2?n[2]:void 0;if(r){const s=Ts,o=ib(String(r));if(Ts=o,s===o)return t.apply(this,n);ct("history",{from:s,to:o})}return t.apply(this,n)}}tt(ne.history,"pushState",e),tt(ne.history,"replaceState",e)}function ib(e){try{return new URL(e,ne.location.origin).toString()}catch{return e}}const Hs={};function cb(e){const t=Hs[e];if(t)return t;let n=ne[e];if(si(n))return Hs[e]=n.bind(ne);const r=ne.document;if(r&&typeof r.createElement=="function")try{const s=r.createElement("iframe");s.hidden=!0,r.head.appendChild(s);const o=s.contentWindow;o!=null&&o[e]&&(n=o[e]),r.head.removeChild(s)}catch(s){es&&G.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,s)}return n&&(Hs[e]=n.bind(ne))}function lb(e){Hs[e]=void 0}const Mn="__sentry_xhr_v3__";function gm(e){nn("xhr",e),rn("xhr",ub)}function ub(){if(!ne.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(t,n,r){const s=new Error,o=Fe()*1e3,i=Lt(r[0])?r[0].toUpperCase():void 0,c=db(r[1]);if(!i||!c)return t.apply(n,r);n[Mn]={method:i,url:c,request_headers:{}},i==="POST"&&c.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const l=()=>{const u=n[Mn];if(u&&n.readyState===4){try{u.status_code=n.status}catch{}const d={endTimestamp:Fe()*1e3,startTimestamp:o,xhr:n,virtualError:s};ct("xhr",d)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(u,d,p){return l(),u.apply(d,p)}}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(u,d,p){const[m,g]=p,_=d[Mn];return _&&Lt(m)&&Lt(g)&&(_.request_headers[m.toLowerCase()]=g),u.apply(d,p)}}),t.apply(n,r)}}),e.send=new Proxy(e.send,{apply(t,n,r){const s=n[Mn];if(!s)return t.apply(n,r);r[0]!==void 0&&(s.body=r[0]);const o={startTimestamp:Fe()*1e3,xhr:n};return ct("xhr",o),t.apply(n,r)}})}function db(e){if(Lt(e))return e;try{return e.toString()}catch{}}function pb(e){let t;try{t=e.getAllResponseHeaders()}catch(n){return es&&G.error(n,"Failed to get xhr response headers",e),{}}return t?t.split(`\r 22`).reduce((n,r)=>{const[s,o]=r.split(": ");return o&&(n[s.toLowerCase()]=o),n},{}):{}}const ga=[],Ws=new Map,Ln=new Map,mb=60;function fb(){if(Mo()&&dt()){const t=hb();return()=>{t()}}return()=>{}}const di={click:"click",pointerdown:"click",pointerup:"click",mousedown:"click",mouseup:"click",touchstart:"click",touchend:"click",mouseover:"hover",mouseout:"hover",mouseenter:"hover",mouseleave:"hover",pointerover:"hover",pointerout:"hover",pointerenter:"hover",pointerleave:"hover",dragstart:"drag",dragend:"drag",drag:"drag",dragenter:"drag",dragleave:"drag",dragover:"drag",drop:"drag",keydown:"press",keyup:"press",keypress:"press",input:"press"};function hb(){return bx(gb)}const gb=({metric:e})=>{if(e.value==null)return;const t=Oe(e.value);if(t>mb)return;const n=e.entries.find(_=>_.duration===e.value&&di[_.name]);if(!n)return;const{interactionId:r}=n,s=di[n.name],o=Oe(dt()+n.startTime),i=pt(),c=i?Ve(i):void 0,l=r!=null?Ws.get(r):void 0,u=(l==null?void 0:l.span)||c,d=u?ye(u).description:Se().getScopeData().transactionName,p=(l==null?void 0:l.elementName)||ut(n.target),m={[$e]:"auto.http.browser.inp",[Ft]:`ui.interaction.${s}`,[Zn]:n.duration},g=cc({name:p,transaction:d,attributes:m,startTime:o});g&&(g.addEvent("inp",{[Kr]:"millisecond",[Xr]:e.value}),g.end(o+t))};function yb(){const e=Object.keys(di);U_()&&e.forEach(s=>{ne.addEventListener(s,t,{capture:!0,passive:!0})});function t(s){const o=s.target;if(!o)return;const i=ut(o),c=Math.round(s.timeStamp);if(Ln.set(c,i),Ln.size>50){const l=Ln.keys().next().value;l!==void 0&&Ln.delete(l)}}function n(s){const o=Math.round(s.startTime);let i=Ln.get(o);if(!i)for(let c=-5;c<=5;c++){const l=Ln.get(o+c);if(l){i=l;break}}return i||"<unknown>"}const r=({entries:s})=>{const o=pt(),i=o&&Ve(o);
22s.forEach(c=>{if(!Cx(c))return;const l=c.interactionId;if(l==null||Ws.has(l))return;const u=c.target?ut(c.target):n(c);if(ga.length>10){const d=ga.shift();Ws.delete(d)}ga.push(l),Ws.set(l,{span:i,elementName:u})})};Nr("event",r),Nr("first-input",r)}const _b=40;function xb(e,t=cb("fetch")){let n=0,r=0;async function s(o){const i=o.body.length;n+=i,r++;const c={body:o.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{const l=await t(e.url,c);return{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}}catch(l){throw lb("fetch"),l}finally{n-=i,r--}}return I0(e,s,tc(e.bufferSize||_b))}const Ye=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,bb=30,wb=50;function pi(e,t,n,r){const s={filename:e,function:t==="<anonymous>"?Sn:t,in_app:!0};return n!==void 0&&(s.lineno=n),r!==void 0&&(s.colno=r),s}const Sb=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Eb=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,vb=/\((\S*)(?::(\d+))(?::(\d+))\)/,Tb=/at (.+?) ?\(data:(.+?),/,Cb=e=>{var s;const t=e.match(Tb);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=Sb.exec(e);if(n){const[,o,i,c]=n;return pi(o,Sn,+i,+c)}const r=Eb.exec(e);if(r){if(((s=r[2])==null?void 0:s.indexOf("eval"))===0){const l=vb.exec(r[2]);l&&(r[2]=l[1],r[3]=l[2],r[4]=l[3])}const[i,c]=ym(r[1]||Sn,r[2]);return pi(c,i,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Ab=[bb,Cb],Ib=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Rb=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,kb=e=>{const t=Ib.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const o=Rb.exec(t[3]);o&&(t[1]=t[1]||"eval",t[3]=o[1],t[4]=o[2],t[5]="")}let r=t[3],s=t[1]||Sn;return[s,r]=ym(s,r),pi(r,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Nb=[wb,kb],jb=[Ab,Nb],Lb=zd(...jb),ym=(e,t)=>{const n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:Sn,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Cs=1024,Pb="Breadcrumbs",Ob=((e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:Pb,setup(n){t.console&&l_(Fb(n)),t.dom&&tb(Ub(n,t.dom)),t.xhr&&gm($b(n)),t.fetch&&Kp(Bb(n)),t.history&&lc(zb(n)),t.sentry&&n.on("beforeSendEvent",Mb(n))}}}),Db=Ob;function Mb(e){return function(n){he()===e&&En({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:fn(n)},{event:n})}}function Ub(e,t){return function(r){if(he()!==e)return;let s,o,i=typeof t=="object"?t.serializeAttribute:void 0,c=typeof t=="object"&&typeof t.maxStringLength=="number"?t.maxStringLength:void 0;c&&c>Cs&&(Ye&&G.warn(`\`dom.maxStringLength\` cannot exceed ${Cs}, but a value of ${c} was configured. Sentry will use ${Cs} instead.`),c=Cs),typeof i=="string"&&(i=[i]);try{const u=r.event,d=Gb(u)?u.target:u;s=ut(d,{keyAttrs:i,maxStringLength:c}),o=qd(d)}catch{s="<unknown>"}if(s.length===0)return;const l={category:`ui.${r.name}`,message:s};o&&(l.data={"ui.component_name":o}),En(l,{event:r.event,name:r.name,global:r.global})}}function Fb(e){return function(n){if(he()!==e)return;const r={category:"console",data:{arguments:n.args,logger:"console"},level:d_(n.level),message:yl(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)r.message=`Assertion failed: ${yl(n.args.slice(1)," ")||"console.assert"}`,r.data.arguments=n.args.slice(1);else return;En(r,{input:n.args,level:n.level})}}function $b(e){return function(n){if(he()!==e)return;const{startTimestamp:r,endTimestamp:s}=n,o=n.xhr[Mn];if(!r||!s||!o)return;const{method:i,url:c,status_code:l,body:u}=o,d={method:i,url:c,status_code:l},p={xhr:n.xhr,input:u,startTimestamp:r,endTimestamp:s},m={category:"xhr",data:d,type:"http",level:qp(l)};e.emit("beforeOutgoingRequestBreadcrumb",m,p),En(m,p)}}function Bb(e){return function(n){if(he()!==e)return;const{startTimestamp:r,endTimestamp:s}=n;
22if(s&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.error){const o={data:n.error,input:n.args,startTimestamp:r,endTimestamp:s},i={category:"fetch",data:n.fetchData,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",i,o),En(i,o)}else{const o=n.response,i={...n.fetchData,status_code:o==null?void 0:o.status},c={input:n.args,response:o,startTimestamp:r,endTimestamp:s},l={category:"fetch",data:i,type:"http",level:qp(i.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",l,c),En(l,c)}}}function zb(e){return function(n){if(he()!==e)return;let r=n.from,s=n.to;const o=xn(ae.location.href);let i=r?xn(r):void 0;const c=xn(s);i!=null&&i.path||(i=o),o.protocol===c.protocol&&o.host===c.host&&(s=c.relative),o.protocol===i.protocol&&o.host===i.host&&(r=i.relative),En({category:"navigation",data:{from:r,to:s}})}}function Gb(e){return!!e&&!!e.target}const Hb="EventTarget,Window,Node,ApplicationCache,AudioTrackList,BroadcastChannel,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(","),Wb="BrowserApiErrors",Jb=((e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:Wb,setupOnce(){t.setTimeout&&tt(ae,"setTimeout",lu),t.setInterval&&tt(ae,"setInterval",lu),t.requestAnimationFrame&&tt(ae,"requestAnimationFrame",Yb),t.XMLHttpRequest&&"XMLHttpRequest"in ae&&tt(XMLHttpRequest.prototype,"send",qb);const n=t.eventTarget;n&&(Array.isArray(n)?n:Hb).forEach(s=>Kb(s,t))}}}),Vb=Jb;function lu(e){return function(...t){const n=t[0];return t[0]=Jn(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${Dt(e)}`}}),e.apply(this,t)}}function Yb(e){return function(t){return e.apply(this,[Jn(t,{mechanism:{data:{handler:Dt(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function qb(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(s=>{s in n&&typeof n[s]=="function"&&tt(n,s,function(o){const i={mechanism:{data:{handler:Dt(o)},handled:!1,type:`auto.browser.browserapierrors.xhr.${s}`}},c=Yi(o);return c&&(i.mechanism.data.handler=Dt(c)),Jn(o,i)})}),e.apply(this,t)}}function Kb(e,t){var s,o;const r=(s=ae[e])==null?void 0:s.prototype;(o=r==null?void 0:r.hasOwnProperty)!=null&&o.call(r,"addEventListener")&&(tt(r,"addEventListener",function(i){return function(c,l,u){try{Xb(l)&&(l.handleEvent=Jn(l.handleEvent,{mechanism:{data:{handler:Dt(l),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&Zb(this,c,l),i.apply(this,[c,Jn(l,{mechanism:{data:{handler:Dt(l),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),u])}}),tt(r,"removeEventListener",function(i){return function(c,l,u){try{const d=l.__sentry_wrapped__;d&&i.call(this,c,d,u)}catch{}return i.call(this,c,l,u)}}))}function Xb(e){return typeof e.handleEvent=="function"}function Zb(e,t,n){e&&typeof e=="object"&&"removeEventListener"in e&&typeof e.removeEventListener=="function"&&e.removeEventListener(t,n)}const Qb=(e={})=>{const t=e.lifecycle??"route";return{name:"BrowserSession",setupOnce(){if(typeof ae.document>"u"){Ye&&G.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Bl({ignoreDuration:!0}),la();const n=st();let r=n.getUser();n.addScopeListener(s=>{const o=s.getUser();((r==null?void 0:r.id)!==(o==null?void 0:o.id)||(r==null?void 0:r.ip_address)!==(o==null?void 0:o.ip_address))&&(la(),r=o)}),t==="route"&&lc(({from:s,to:o})=>{s!==o&&(Bl({ignoreDuration:!0}),la())})}}},ew="CultureContext",tw=(()=>({name:ew,preprocessEvent(e){var n;const t=rw();t&&(e.contexts={...e.contexts,culture:{...t,...(n=e.contexts)==null?void 0:n.culture}})}})),nw=tw;function rw(){try{const e=ae.Intl;if(!e)return;const t=e.DateTimeFormat().resolvedOptions();return{locale:t.locale,timezone:t.timeZone,calendar:t.calendar}}catch{return}}const sw="GlobalHandlers",ow=((e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:sw,setupOnce(){Error.stackTraceLimit=50},setup(n){t.onerror&&(iw(n),uu("onerror")),t.onunhandledrejection&&(cw(n),uu("onunhandledrejection"))}}}),aw=ow;function iw(e){Hd(t=>{const{stackParser:n,attachStacktrace:r}=_m();if(he()!==e||Zp())return;const{msg:s,url:o,line:i,column:c,error:l}=t,u=dw(oc(n,l||s,void 0,r,!1),o,i,c);u.level="error",Ap(u,{originalException:l,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function cw(e){Wd(t=>{const{stackParser:n,attachStacktrace:r}=_m();if(he()!==e||Zp())return;const s=lw(t),o=zn(s)?uw(s):oc(n,s,void 0,r,!0);o.level="error",Ap(o,{originalException:s,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function lw(e){if(zn(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}function uw(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function dw(e,t,n,r){const s=e.exception=e.exception||{},o=s.values=s.values||[],i=o[0]=o[0]||{},c=i.stacktrace=i.stacktrace||{},l=c.frames=c.frames||[];return l.length===0&&l.push({colno:r,lineno:n,filename:pw(t)??Wr(),function:Sn,in_app:!0}),e}function uu(e){Ye&&G.log(`Global Handler attached: ${e}`)}function _m(){const e=he();return(e==null?void 0:e.getOptions())||{stackParser:()=>[],attachStacktrace:!1}}function pw(e){if(!(!Lt(e)||e.length===0))return e.startsWith("data:")?`<${Xt(e,!1)}>`:e}const mw=()=>({name:"HttpContext",preprocessEvent(e){var r;if(!ae.navigator&&!ae.location&&!ae.document)return;const t=nc(),n={...t.headers,...(r=e.request)==null?void 0:r.headers};e.request={...t,...e.request,headers:n}}}),fw="cause",hw=5,gw="LinkedErrors",yw=((e={})=>{const t=e.limit||hw,n=e.key||fw;return{name:gw,preprocessEvent(r,s,o){const i=o.getOptions();c_(rc,i.stackParser,n,t,r,s)}}}),_w=yw;function xw(){return bw()?(Ye&&Tn(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function bw(){var s;if(typeof ae.window>"u")return!1;const e=ae;if(e.nw)return!1;const t=e.chrome||e.browser;if(!((s=t==null?void 0:t.runtime)!=null&&s.id))return!1;const n=Wr();return!(ae===ae.top&&/^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\/\//.test(n))}function ww(e){return[e_(),K0(),b_(),Vb(),Db(),aw(),_w(),f_(),mw(),nw(),Qb()]}function Sw(e={}){const t=!e.skipBrowserExtensionCheck&&xw();let n=e.defaultIntegrations==null?ww():e.defaultIntegrations;const r={...e,enabled:t?!1:e.enabled,stackParser:Zh(e.stackParser||Lb),integrations:h0({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||xb};return F0(Z_,r)}function du(e={}){const t=ae.document,n=(t==null?void 0:t.head)||(t==null?void 0:t.body);if(!n){Ye&&G.error("[showReportDialog] Global document not defined");return}const r=Se(),s=he(),o=s==null?void 0:s.getDsn();if(!o){Ye&&G.error("[showReportDialog] DSN not configured");return}const i={...e,user:{...r.getUser(),...e.user},eventId:e.eventId||i0()},c=ae.document.createElement("script");c.async=!0,c.crossOrigin="anonymous",c.src=m0(o,i);const{onLoad:l,onClose:u}=i;if(l&&(c.onload=l),u){const d=p=>{if(p.data==="__sentry_reportdialog_closed__")try{u()}finally{ae.removeEventListener("message",d)}};ae.addEventListener("message",d)}n.appendChild(c)}function Ew(e){return e.split(",").some(t=>t.trim().startsWith("sentry-"))}function xm(e){try{return new URL(e,ae.location.origin).href}catch{return}}function vw(e){return e.entryType==="resource"&&"initiatorType"in e&&typeof e.nextHopProtocol=="string"&&(e.initiatorType==="fetch"||e.
22initiatorType==="xmlhttprequest")}function bm(e){try{return new Headers(e)}catch{return}}const pu=new WeakMap,ya=new Map,wm={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function Tw(e,t){const{traceFetch:n,traceXHR:r,trackFetchStreamPerformance:s,shouldCreateSpanForRequest:o,enableHTTPTimings:i,tracePropagationTargets:c,onRequestSpanStart:l,onRequestSpanEnd:u}={...wm,...t},d=typeof o=="function"?o:_=>!0,p=_=>Aw(_,c),m={},g=e.getOptions().propagateTraceparent;n&&(e.addEventProcessor(_=>(_.type==="transaction"&&_.spans&&_.spans.forEach(h=>{if(h.op==="http.client"){const y=ya.get(h.span_id);y&&(h.timestamp=y/1e3,ya.delete(h.span_id))}}),_)),s&&k_(_=>{if(_.response){const h=pu.get(_.response);h&&_.endTimestamp&&ya.set(h,_.endTimestamp)}}),Kp(_=>{const h=w_(_,d,p,m,{propagateTraceparent:g,onRequestSpanEnd:u});if(_.response&&_.fetchData.__span&&pu.set(_.response,_.fetchData.__span),h){const y=xm(_.fetchData.url),b=y?xn(y).host:void 0;h.setAttributes({"http.url":y?Xt(y):void 0,"server.address":b}),i&&mu(h,e),l==null||l(h,{headers:_.headers})}})),r&&gm(_=>{var y;const h=Iw(_,d,p,m,g,u);h&&(i&&mu(h,e),l==null||l(h,{headers:bm((y=_.xhr.__sentry_xhr_v3__)==null?void 0:y.request_headers)}))})}const Cw=300;function mu(e,t){const{url:n}=ye(e).data;if(!n||typeof n!="string")return;let r=()=>{setTimeout(s)};if(Zr(t)){const o=e.end.bind(e);e.end=i=>{const c=i??Fe();let l=!1;const u=()=>{l||(l=!0,setTimeout(s),o(c),clearTimeout(d))};r=u;const d=setTimeout(u,Cw)}}const s=Nr("resource",({entries:o})=>{o.forEach(i=>{vw(i)&&i.name.endsWith(n)&&(e.setAttributes(hm(i)),r())})})}function Aw(e,t){const n=Wr();if(n){let r,s;try{r=new URL(e,n),s=new URL(n).origin}catch{return!1}const o=r.origin===s;return t?Kt(r.toString(),t)||o&&Kt(r.pathname,t):o}else{const r=!!e.match(/^\/(?!\/)/);return t?Kt(e,t):r}}function Iw(e,t,n,r,s,o){const i=e.xhr,c=i==null?void 0:i[Mn];if(!i||i.__sentry_own_request__||!c)return;const{url:l,method:u}=c,d=yt()&&t(l);if(e.endTimestamp){const b=i.__sentry_xhr_span_id__;if(!b)return;const x=r[b];x&&(d&&c.status_code!==void 0&&(rp(x,c.status_code),x.end(),o==null||o(x,{headers:bm(pb(i)),error:e.error})),delete r[b]);return}const p=xm(l),m=xn(p||l),g=Xt(G0(l)),_=!!pt(),h=d&&_?Qn({name:`${u} ${g}`,attributes:{url:Xt(l),type:"xhr","http.method":u,"http.url":p?Xt(p):void 0,"server.address":m==null?void 0:m.host,[$e]:"auto.http.browser",[Ft]:"http.client",...(m==null?void 0:m.search)&&{"http.query":m==null?void 0:m.search},...(m==null?void 0:m.hash)&&{"http.fragment":m==null?void 0:m.hash}}}):new Et;i.__sentry_xhr_span_id__=h.spanContext().spanId,r[i.__sentry_xhr_span_id__]=h,n(l)&&Rw(i,yt()&&_?h:void 0,s);const y=he();return y&&y.emit("beforeOutgoingRequestSpan",h,e),h}function Rw(e,t,n){const{"sentry-trace":r,baggage:s,traceparent:o}=Wp({span:t,propagateTraceparent:n});r&&kw(e,r,s,o)}function kw(e,t,n,r){var o;const s=(o=e.__sentry_xhr_v3__)==null?void 0:o.request_headers;if(!(s!=null&&s["sentry-trace"]||!e.setRequestHeader))try{if(e.setRequestHeader("sentry-trace",t),r&&!(s!=null&&s.traceparent)&&e.setRequestHeader("traceparent",r),n){const i=s==null?void 0:s.baggage;(!i||!Ew(i))&&e.setRequestHeader("baggage",n)}}catch{}}function Nw(){ae.document?ae.document.addEventListener("visibilitychange",()=>{const e=pt();if(!e)return;const t=Ve(e);if(ae.document.hidden&&t){const n="cancelled",{op:r,status:s}=ye(t);Ye&&G.log(`[Tracing] Transaction: ${n} -> since tab moved to the background, op: ${r}`),s||t.setStatus({code:Me,message:n}),t.setAttribute("sentry.cancellation_reason","document.hidden"),t.end()}}):Ye&&G.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const jw=3600,Sm="sentry_previous_trace",Lw="sentry.previous_trace";function Pw(e,{linkPreviousTrace:t,consistentTraceSampling:n}){const r=t==="session-storage";let s=r?Mw():void 0;e.on("spanStart",i=>{if(Ve(i)!==i)return;const c=Se().getPropagationContext();s=Ow(s,i,c),r&&Dw(s)});let o=!0;n&&e.on("beforeSampling",i=>{if(!s)return;const c=Se(),l=c.getPropagationContext();if(o&&l.parentSpanId){o=!1;return}c.setPropagationContext({...l,dsc:{...l.dsc,sample_rate:String(s.sampleRate),sampled:String(mi(s.spanContext))},sampleRand:s.sampleRand}),i.parentSampled=mi(s.spanContext),i.parentSampleRate=s.sampleRate,i.spanAttributes={...i.spanAttributes,[tp]:s.sampleRate}})}function Ow(e,t,n){const r=ye(t);function s(){var c,l;try{return Number((c=n.dsc)==null?void 0:c.sample_rate)??Number((l=r.data)==null?void 0:l[qi])}catch{return 0}}const o={spanContext:t.spanContext(),startTimestamp:r.start_timestamp,sampleRate:s(),sampleRand:n.sampleRand};if(!e)return o;const i=e.spanContext;return i.traceId===r.trace_id?e:(Date.now()/1e3-e.startTimestamp<=jw&&(Ye&&G.log(`Adding previous_trace \`${JSON.stringify(i)}\` link to span \`${JSON.stringify({op:r.op,...t.spanContext()})}\``),t.addLink({context:i,attributes:{[Ig]:"previous_trace"}}),t.setAttribute(Lw,`${i.traceId}-${i.spanId}-${mi(i)?1:0}`)),o)}function Dw(e){try{ae.sessionStorage.setItem(Sm,JSON.stringify(e))}catch(t){Ye&&G.warn("Could not store previous trace in sessionStorage",t)}}function Mw(){var e;try{const t=(e=ae.sessionStorage)==null?void 0:e.getItem(Sm);return JSON.parse(t)}catch{return}}function mi(e){return e.traceFlags===1}const Uw="BrowserTracing",Fw=/Googlebot|Google-InspectionTool|Storebot-Google|Bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Facebot|facebookexternalhit|LinkedInBot|Twitterbot|Applebot/i;function $w(){const e=ae.navigator;return e!=null&&e.userAgent?Fw.test(e.userAgent):!1}const Bw={...$s,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroun
22dSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,ignoreResourceSpans:[],ignorePerformanceApiSpans:[],detectRedirects:!0,linkPreviousTrace:"in-memory",consistentTraceSampling:!1,enableReportPageLoaded:!1,_experiments:{},...wm},zw=((e={})=>{"enableElementTiming"in e&&Tn(()=>{console.warn("[Sentry] `enableElementTiming` is deprecated and no longer has any effect. Use the standalone `elementTimingIntegration` instead.")});const t={name:void 0,source:void 0},n=ae.document,{enableInp:r,enableLongTask:s,enableLongAnimationFrame:o,_experiments:{enableInteractions:i,enableStandaloneClsSpans:c,enableStandaloneLcpSpans:l},beforeStartSpan:u,idleTimeout:d,finalTimeout:p,childSpanTimeout:m,markBackgroundSpan:g,traceFetch:_,traceXHR:h,trackFetchStreamPerformance:y,shouldCreateSpanForRequest:b,enableHTTPTimings:x,ignoreResourceSpans:w,ignorePerformanceApiSpans:E,instrumentPageLoad:T,instrumentNavigation:C,detectRedirects:S,linkPreviousTrace:A,consistentTraceSampling:R,enableReportPageLoaded:N,onRequestSpanStart:O,onRequestSpanEnd:k}={...Bw,...e},$=$w();let z,K,V;function ie(Q,J,me=!0){const ce=J.op==="pageload",xe=J.name,ve=u?u(J):J,Be=ve.attributes||{};if(xe!==ve.name&&(Be[jt]="custom",ve.attributes=Be),!me){const ge=Cn();Qn({...ve,startTime:ge}).end(ge);return}t.name=ve.name,t.source=Be[jt];const Ge=Tp(ve,{idleTimeout:d,finalTimeout:p,childSpanTimeout:m,disableAutoFinish:ce,beforeSpanEnd:ge=>{z==null||z(),zx(ge,{recordClsOnPageloadSpan:!c,recordLcpOnPageloadSpan:!l,ignoreResourceSpans:w,ignorePerformanceApiSpans:E}),gu(Q,void 0);const He=Se(),Je=He.getPropagationContext();He.setPropagationContext({...Je,traceId:Ge.spanContext().traceId,sampled:sn(Ge),dsc:Qt(ge)}),ce&&(V=void 0)},trimIdleSpanEndTimestamp:!N});ce&&N&&(V=Ge),gu(Q,Ge);function ee(){n&&["interactive","complete"].includes(n.readyState)&&Q.emit("idleSpanEnableAutoFinish",Ge)}ce&&!N&&n&&(n.addEventListener("readystatechange",()=>{ee()}),ee())}return{name:Uw,setup(Q){var me;if($){Ye&&G.log("[Tracing] Skipping browserTracingIntegration setup for bot user agent.");return}if(oy(),z=Ox({recordClsStandaloneSpans:c||!1,recordLcpStandaloneSpans:l||!1,client:Q}),r&&fb(),o&&fe.PerformanceObserver&&((me=PerformanceObserver.supportedEntryTypes)!=null&&me.includes("long-animation-frame"))?Mx():s&&Dx(),i&&Ux(),S&&n){const ce=()=>{K=Fe()};addEventListener("click",ce,{capture:!0}),addEventListener("keydown",ce,{capture:!0,passive:!0})}function J(){const ce=jr(Q);ce&&!ye(ce).timestamp&&(Ye&&G.log(`[Tracing] Finishing current active span with op: ${ye(ce).op}`),ce.setAttribute(Cr,"cancelled"),ce.end())}Q.on("startNavigationSpan",(ce,xe)=>{if(he()!==Q)return;if(xe!=null&&xe.isRedirect){Ye&&G.warn("[Tracing] Detected redirect, navigation span will not be the root span, but a child span."),ie(Q,{op:"navigation.redirect",...ce},!1);return}K=void 0,J(),st().setPropagationContext({traceId:Ut(),sampleRand:Math.random(),propagationSpanId:yt()?void 0:Pt()});const ve=Se();ve.setPropagationContext({traceId:Ut(),sampleRand:Math.random(),propagationSpanId:yt()?void 0:Pt()}),ve.setSDKProcessingMetadata({normalizedRequest:void 0}),ie(Q,{op:"navigation",...ce,parentSpan:null,forceTransaction:!0})}),Q.on("startPageLoadSpan",(ce,xe={})=>{if(he()!==Q)return;J();const ve=xe.sentryTrace||fu("sentry-trace")||hu("sentry-trace"),Be=xe.baggage||fu("baggage")||hu("baggage"),Ge=Jg(ve,Be),ee=Se();ee.setPropagationContext(Ge),yt()||(ee.getPropagationContext().propagationSpanId=Pt()),ee.setSDKProcessingMetadata({normalizedRequest:nc()}),ie(Q,{op:"pageload",...ce})}),Q.on("endPageloadSpan",()=>{N&&V&&(V.setAttribute(Cr,"reportPageLoaded"),V.end())})},afterAllSetup(Q){if($)return;let J=Wr();if(A!=="off"&&Pw(Q,{linkPreviousTrace:A,consistentTraceSampling:R}),ae.location){if(T){const me=dt();Gw(Q,{name:ae.location.pathname,startTime:me?me/1e3:void 0,attributes:{[jt]:"url",[$e]:"auto.pageload.browser"}})}C&&lc(({to:me,from:ce})=>{if(ce===void 0&&(J==null?void 0:J.indexOf(me))!==-1){J=void 0;return}J=void 0;const xe=Gp(me),ve=jr(Q),Be=ve&&S&&Jw(ve,K);Hw(Q,{name:(xe==null?void 0:xe.pathname)||ae.location.pathname,attributes:{[jt]:"url",[$e]:"auto.navigation.browser"}},{url:me,isRedirect:Be})})}g&&Nw(),i&&Ww(Q,d,p,m,t),r&&yb(),Tw(Q,{traceFetch:_,traceXHR:h,trackFetchStreamPerformance:y,tracePropagationTargets:Q.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:b,enableHTTPTimings:x,onRequestSpanStart:O,onRequestSpanEnd:k})}}});function Gw(e,t,n){e.emit("startPageLoadSpan",t,n),Se().setTransactionName(t.name);const r=jr(e);return r&&e.emit("afterStartPageLoadSpan",r),r}function Hw(e,t,n){const{url:r,isRedirect:s}=n||{};e.emit("beforeStartNavigationSpan",t,{isRedirect:s}),e.emit("startNavigationSpan",t,{isRedirect:s});const o=Se();return o.setTransactionName(t.name),r&&!s&&o.setSDKProcessingMetadata({normalizedRequest:{...nc(),url:r}}),jr(e)}function fu(e){const t=ae.document,n=t==null?void 0:t.querySelector(`meta[name=${e}]`);return(n==null?void 0:n.getAttribute("content"))||void 0}function hu(e){var r,s,o;const t=(s=(r=ae.performance)==null?void 0:r.getEntriesByType)==null?void 0:s.call(r,"navigation")[0],n=(o=t==null?void 0:t.serverTiming)==null?void 0:o.find(i=>i.name===e);return n==null?void 0:n.description}
22function Ww(e,t,n,r,s){const o=ae.document;let i;const c=()=>{const l="ui.action.click",u=jr(e);if(u){const d=ye(u).op;if(["navigation","pageload"].includes(d)){Ye&&G.warn(`[Tracing] Did not create ${l} span because a pageload or navigation span is in progress.`);return}}if(i&&(i.setAttribute(Cr,"interactionInterrupted"),i.end(),i=void 0),!s.name){Ye&&G.warn(`[Tracing] Did not create ${l} transaction because _latestRouteName is missing.`);return}i=Tp({name:s.name,op:l,attributes:{[jt]:s.source||"url"}},{idleTimeout:t,finalTimeout:n,childSpanTimeout:r})};o&&addEventListener("click",c,{capture:!0})}const Em="_sentry_idleSpan";function jr(e){return e[Em]}function gu(e,t){Ze(e,Em,t)}const yu=1.5;function Jw(e,t){const n=ye(e),r=Cn(),s=n.start_timestamp;return!(r-s>yu||t&&r-t<=yu)}function Vw(e){const t={...e};return Hp(t,"react"),ei("react",{version:f.version}),Sw(t)}function Yw(e){const t=e.match(/^([^.]+)/);return t!==null&&parseInt(t[0])>=17}function qw(e,t){const n=new WeakSet;function r(s,o){if(!n.has(s)){if(s.cause)return n.add(s),r(s.cause,o);s.cause=o}}r(e,t)}function Kw(e,{componentStack:t},n){if(Yw(f.version)&&Gr(e)&&t){const r=new Error(e.message);r.name=`React ErrorBoundary ${e.name}`,r.stack=t,qw(e,r)}return qr(r=>(r.setContext("react",{componentStack:t}),Po(e,n)))}const Xw=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,_a={componentStack:null,error:null,eventId:null};let Zw=class extends f.Component{constructor(t){super(t),this.state=_a,this._openFallbackReportDialog=!0;const n=he();n&&t.showDialog&&(this._openFallbackReportDialog=!1,this._cleanupHook=n.on("afterSendEvent",r=>{!r.type&&this._lastEventId&&r.event_id===this._lastEventId&&du({...t.dialogOptions,eventId:this._lastEventId})}))}componentDidCatch(t,n){const{componentStack:r}=n,{beforeCapture:s,onError:o,showDialog:i,dialogOptions:c}=this.props;qr(l=>{s&&s(l,t,r);const u=this.props.handled!=null?this.props.handled:!!this.props.fallback,d=Kw(t,n,{mechanism:{handled:u,type:"auto.function.react.error_boundary"}});o&&o(t,r,d),i&&(this._lastEventId=d,this._openFallbackReportDialog&&du({...c,eventId:d})),this.setState({error:t,componentStack:r,eventId:d})})}componentDidMount(){const{onMount:t}=this.props;t&&t()}componentWillUnmount(){const{error:t,componentStack:n,eventId:r}=this.state,{onUnmount:s}=this.props;s&&(this.state===_a?s(null,null,null):s(t,n,r)),this._cleanupHook&&(this._cleanupHook(),this._cleanupHook=void 0)}resetErrorBoundary(){const{onReset:t}=this.props,{error:n,componentStack:r,eventId:s}=this.state;t&&t(n,r,s),this.setState(_a)}render(){const{fallback:t,children:n}=this.props,r=this.state;if(r.componentStack===null)return typeof n=="function"?n():n;const s=typeof t=="function"?f.createElement(t,{error:r.error,componentStack:r.componentStack,resetError:()=>this.resetErrorBoundary(),eventId:r.eventId}):t;return f.isValidElement(s)?s:(t&&Xw&&G.warn("fallback did not produce a valid ReactElement"),null)}};const Qw="modulepreload",eS=function(e){return"/"+e},_u={},D=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let l=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));s=l(n.map(u=>{if(u=eS(u),u in _u)return;_u[u]=!0;const d=u.endsWith(".css"),p=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${p}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":Qw,d||(m.as="script"),m.crossOrigin="",m.href=u,c&&m.setAttribute("nonce",c),document.head.appendChild(m),d)return new Promise((g,_)=>{m.addEventListener("load",g),m.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return s.then(i=>{for(const c of i||[])c.status==="rejected"&&o(c.reason);return t().catch(o)})},vm={javascript:["js","ecmascript","es6","es2015","es2016","es2017","es2018","es2019","es2020","es2021","es2022","es2023"],typescript:["ts"],python:["python3","python 3","python2","py"],java:["java8","java 8","java11","java 11","java17","java 17","java21","java 21","jdk","j2ee","jee"],"c#":["csharp","c sharp","c-sharp","dotnet c#"],"c++":["cpp","cplusplus","c plus plus"],c:["clang"],go:["golang"],rust:["rustlang"],ruby:["rb"],php:["php7","php8","php 7","php 8"],swift:["swiftui"],kotlin:["kt"],scala:["scala3"],r:["rlang","r language","r-lang"],dart:[],elixir:[],haskell:[],perl:[],lua:[],groovy:[],"objective-c":["objc","obj-c","objective c"],shell:["bash","zsh","sh","shell scripting","shell script"],react:["reactjs","react.js","react js"],"react native":["reactnative","react-native","rn"],angular:["angularjs","angular.js","angular 2","angular2"],vue:["vuejs","vue.js","vue js","vue3","vue 3"],svelte:["sveltejs","sveltekit"],"next.js":["nextjs","next js","next"],"nuxt.js":["nuxtjs","nuxt js","nuxt"],express:["expressjs","express.js"],"nest.js":["nestjs","nest"],django:["django rest framework","drf"],flask:[],fastapi:["fast api"],"ruby on rails":["rails","ror"],"spring boot":["springboot","spring-boot","spring framework","spring"],laravel:[],".net":["dotnet","dot net","asp.net","aspnet","asp net",".net core","dotnet core"],jquery:[],tailwind:["tailwindcss","tailwind css"],bootstrap:["bootstrap5","bootstrap 5"],flutter:[],ionic:[],xamarin:[],android:["android sdk"],ios:["ios sdk","ios development"],postgresql:["postgres","psql","pgsql"],mysql:["my sql"],"sql server":["mssql","ms sql","microsoft sql server","ms sql server","tsql","t-sql"],sqlite:["sqlite3"],mongodb:["mongo"],redis:[],elasticsearch:["elastic search","elastic","es"],cassandra:["apache cassandra"],dynamodb:["dynamo db","dynamo","amazon dynamodb"],couchdb:["couch db","apache couchdb"],neo4j:[],oracle:["oracle db","oracle database","plsql","pl/sql"],firebase:["firebase realtime database","firestore","cloud firestore"],supabase:[],"amazon web services":["aws","amazon aws"],"google cloud platform":["gcp","google cloud","gce"],"microsoft azure":["azure","ms azure"],heroku:[],vercel:[],netlify:[],digitalocean:["digital ocean"],cloudflare:["cloudflare workers"],docker:["containerization","containers"],kubernetes:["k8s"],terraform:["tf","hashicorp terraform"],ansible:[],jenkins:[],"ci/cd":["cicd","ci cd","ci-cd","continuous integration","continuous delivery","continuous deployment"],"github actions":["gh actions"],gitlab:["gitlab ci","gitlab-ci"],circleci:["circle ci"],nginx:[],apache:["apache http","httpd"],linux:["unix","rhel","centos","ubuntu","debian"],git:["github","gitlab","bitbucket","version control"],prometheus:[],grafana:[],datadog:[],"new relic":["newrelic"],splunk:[],pulumi:[],"node.js":["nodejs","node js","node"],npm:[],yarn:[],pnpm:[],webpack:[],vite:["vitejs"],esbuild:[],babel:["babeljs"],"machine learning":["ml","machine-learning"],"deep learning":["dl","deep-learning"],"artificial intelligence":["ai","a.i."],"natural language processing":["nlp"],"computer vision":["cv"],tensorflow:["tf","tensor flow"],pytor
22ch:["py torch","torch"],"scikit-learn":["sklearn","scikit learn"],pandas:[],numpy:[],jupyter:["jupyter notebook","jupyter notebooks","ipython"],"apache spark":["spark","pyspark"],hadoop:["apache hadoop","hdfs","mapreduce"],tableau:[],"power bi":["powerbi","power-bi"],"large language models":["llm","llms","large language model"],"generative ai":["genai","gen ai","gen-ai"],langchain:[],huggingface:["hugging face"],"rest api":["rest","restful","restful api","rest apis"],graphql:["graph ql"],grpc:["g-rpc"],websocket:["websockets","ws"],oauth:["oauth2","oauth 2.0","oauth2.0"],openapi:["swagger"],jest:[],mocha:[],cypress:["cypress.io"],playwright:[],selenium:["selenium webdriver"],junit:[],pytest:[],"test driven development":["tdd","test-driven development"],"behavior driven development":["bdd","behavior-driven development"],figma:[],sketch:[],"adobe xd":["xd"],photoshop:["adobe photoshop"],illustrator:["adobe illustrator"],"ui/ux":["ui ux","uiux","ui/ux design","ux design","ux","ui design","ui"],"user research":["ux research","user experience research"],wireframing:["wireframes","wireframe"],prototyping:["prototypes","prototype"],agile:["agile methodology","agile development","agile framework","agile practices"],scrum:["scrum master","scrum methodology","csm","certified scrum master","scrum framework"],kanban:[],jira:["atlassian jira"],confluence:["atlassian confluence"],"project management":["pm","project mgmt","pmp","project management professional","pmi","pmi-acp","prince2","program management"],"product management":["product mgmt"],safe:["safe 5","safe 5 agilist","safe agilist","scaled agile","scaled agile framework","safe framework","safe certified"],itil:["itil 4","itil 4 foundation","itil foundation","itil v4","it service management","itsm"],"change management":["change enablement","organizational change","change leadership","prosci"],"stakeholder management":["stakeholder collaboration","stakeholder engagement","stakeholder communication"],"risk management":["risk assessment","risk mitigation","risk analysis","risk & issue management"],"business analysis":["business analyst","requirements analysis","requirements gathering","ba"],"continuous improvement":["process optimization","process improvement","lean","six sigma","continuous delivery","ci/cd"],"vendor management":["vend
22or relations","third-party management","contract management","procurement"],"budget management":["budgeting","financial management","cost management","p&l"],"it governance":["governance","compliance","governance & compliance","it compliance","regulatory compliance"],leadership:["team leadership","people management","team management","servant leadership"],communication:["written communication","verbal communication","interpersonal skills"],"problem solving":["problem-solving","analytical thinking","critical thinking"],teamwork:["team work","collaboration","cross-functional collaboration"],"time management":["time-management","prioritization"],mentoring:["mentorship","coaching"],"strategic planning":["strategic thinking","strategy"],presentation:["presentations","public speaking"],negotiation:["negotiating"],sql:["structured query language"],"data analysis":["data analytics","data analyst"],"data engineering":["data pipelines","etl","elt"],"data visualization":["data viz"],"business intelligence":["bi"],"a/b testing":["ab testing","a-b testing","split testing"],cybersecurity:["cyber security","infosec","information security"],"penetration testing":["pen testing","pentest","ethical hacking"],soc2:["soc 2","soc2 compliance"],owasp:[],kafka:["apache kafka"],rabbitmq:["rabbit mq","rabbit"],sqs:["amazon sqs"],microservices:["micro services","micro-services","microservice architecture"],serverless:["faas","lambda","aws lambda","cloud functions"],blockchain:["web3","web 3"],solidity:[]},fi=new Map;for(const[e,t]of Object.entries(vm)){const n=e.toLowerCase();fi.set(n,n);for(const r of t)fi.set(r.toLowerCase(),n)}function tS(e){const t=e.trim().toLowerCase();return fi.get(t)??t}function nS(e){const t=tS(e),n=vm[t];return n?[t,...n]:[t]}function hi(e,t){const n=nS(e),r=t.toLowerCase();for(const s of n){const o=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[\\s,;/()\\[\\]|.#&!?'"\`])${o}(?:$|[\\s,;/()\\[\\]|.#&!?'"\`])`,"i").test(` ${r} `))return!0}return!1}const uc={retail:["cashier","checkout clerk","retail associate","sales associate","retail clerk","store associate","merchandiser","stock associate","store clerk","retail sales"],food_service:["cook","line cook","prep cook","dishwasher","busser","barista","fast food worker","food runner","server","host","hostess","kitchen staff","kitchen helper","food service worker","cafeteria worker"],manual_labor:["warehouse associate","warehouse worker","forklift operator","picker","packer","general laborer","construction worker","mover","material handler","assembly line worker","machine operator","factory worker"],custodial:["janitor","custodian","housekeeper","cleaner","maintenance worker","groundskeeper"],transportation:["delivery driver","truck driver","courier","package handler","mail carrier","bus driver","taxi driver","rideshare driver"],beauty_personal:["beauty product clerk","hair stylist","nail technician","esthetician","cosmetologist","massage therapist"],customer_service:["customer service rep","call center agent","telemarketer","receptionist","phone operator","order taker"]};Object.values(uc).flat();const rS=["engineer","manager","director","lead","analyst","specialist","developer","architect","consultant","designer","scientist","researcher","coordinator","administrator","supervisor","strategist","planner"];function sS(e){const t=new Set;for(const n of e){const r=n.toLowerCase();for(const[s,o]of Object.entries(uc))o.some(i=>r.includes(i))&&t.add(s)}return t}function oS(e,t){const n=e.toLowerCase();if(rS.some(r=>n.includes(r)))return!1;for(const[r,s]of Object.entries(uc))if(!(t&&t.toLowerCase()===r)&&s.some(o=>n.includes(o)))return!0;return!1}const aS=[[/\bit\s+manager\b/i,["it governance","vendor management","budget management","leadership","change management","itil","stakeholder management","project management"]],[/\bit\s+director\b/i,["it governance","strategic planning","budget management","leadership","vendor management","change management","itil","stakeholder management"]],[/\bit\s+project\s+manager\b/i,["project management","stakeholder management","risk management","agile","budget management","pmp","change management","itil"]],[/\bprogram\s+manager\b/i,["program management","stakeholder management","agile","safe","risk management","budget management","leadership","strategic planning"]],[/\bproject\s+manager\b/i,["project management","stakeholder management","risk management","agile","budget management","communication","change management"]],[/\btechnical\s+program\s+manager\b/i,["program management","agile","software development","stakeholder management","risk management","ci/cd","leadership"]],[/\bpmo\b/i,["project management","governance","portfolio management","risk management","stakeholder management","budget management"]],[/\bscrum\s+master\b/i,["scrum","agile","safe","continuous improvement","facilitation","coaching","jira"]],[/\bagile\s+coach\b/i,["agile","scrum","safe","kanban","coaching","leadership","continuous improvement"]],[/\bproduct\s+manager\b/i,["product management","stakeholder management","agile","business analysis","data analysis","strategic planning","communication"]],[/\bproduct\s+owner\b/i,["product management","agile","scrum","stakeholder management","business analysis","jira"]],[/\bengineering\s+manager\b/i,["leadership","software development","agile","ci/cd","mentoring","strategic planning","stakeholder management"]],[/\bsoftware\s+(?:development\s+)?manager\b/i,["software development","leadership","agile","ci/cd","mentoring","project management"]],[/\bdevops\s+(?:manager|lead)\b/i,["devops","ci/cd","docker","kubernetes","linux","terraform","leadership"]],[/\boperations\s+manager\b/i,["operations","process optimization","budget management","leadership","vendor management","continuous improvement"]],[/\bdelivery\s+manager\b/i,["project management","agile","stakeholder management","risk management","leadership","continuous improvement"]],[/\bchange\s+manager\b/i,["change management","stakeholder management","communication","leadership","process optimization"]],[/\bsoftware\s+engineer\b/i,["software development","ci/cd","testing","agile","problem solving"]],[/\bfull[- ]?stack\b/i,["javascript","react","node.js","sql","rest api","ci/cd"]],[/\bfrontend\b|front[- ]?end/i,["javascript","react","typescript","html","css","ui/ux"]],[/\bbackend\b|back[- ]?end/i,["node.js","sql","rest api","docker","ci/cd"]],[/\bdevops\s+engineer\b/i,["ci/cd","docker","kubernetes","linux","terraform","aws"]],[/\bsre\b|site\s+reliability/i,["linux","docker","kubernetes","monitoring","ci/cd","python"]],[/\bdata\s+engineer\b/i,["sql","python","data engineering","aws","apache spark"]],[/\bdata\s+analyst\b/i,["data analysis","sql","data visualization","business intelligence","python"]],[/\bdata\s+scientist\b/i,["machine learning","python","sql","data analysis","tensorflow"]],[/\bbusiness\s+analyst\b/i,["business analysis","sql","stakeholder management","data analysis","communication"]],[/\bsecurity\s+(?:engineer|analyst)\b/i,["cybersecurity","linux","networking","penetration testing"]],[/\bciso\b|chief\s+information\s+security/i,["cybersecurity","it governance","risk management","leadership","compliance"]],[/\bmanager\b/i,["leadership","stakeholder management","budget management","communication","strategic planning"]],[/\bdirector\b/i,["leadership","strategic planning","budget management","stakeholder management"]],[/\blead\b/i,["leadership","mentoring","communication"]]];function Tm(e){const t=new Set;for(const[n,r]of aS)if(n.test(e))for(const s of r)t.add(s);return[...t]}const iS=[["it","information technology"],["is","information systems"],["mis","management information systems"],["ict","information and communications technology"],["ai","artificial intelligence"],["ml","machine learning"],["cs","computer science"],["db","database"],["dba","database administrator"],["swe","software engineer"],["sde","software development engineer"],["sre","site reliability engineer"],["qa","quality assurance"],["qe","quality engineer"],["ux","user experience"],["ui","user interface"],["hr","human resources"],["hrbp","human resources business partner"],["pm","project manager"],["tpm","technical program manager"],["pmo","project management office"],["ops","operations"],["biz","business"],["bd","business development"],["pr","public relations"],["ir","investor relations"],["cr","customer relations"],["cx","customer experience"],["cs","customer success"],["am","account manager"],["fp&a","financial planning and analysis"],["ap","accounts payable"],["ar","accounts receivable"],["gl","general ledger"],["cfo","chief financial officer"],["cpa","certified public accountant"],["ceo","chief executive officer"],["cto","chief technology officer"],["cio","chief information officer"],["coo","chief operating officer"],["cmo","chief marketing officer"],["ciso","chief information security officer"],["cpo","chief product officer"],["svp","senior vice president"],["avp","assistant vice president"],["vp","vice president"],["evp","executive vice president"],["gm","general manager"],["ee","electrical engineer"],["me","mechanical engineer"],["r&d","research and development"],["rd","research and development"],["seo","search engine optimization"],["sem","search engine marketing"],["smm","social media marketing"],["crm","customer relationship management"],["gtm","go to market"],["ae","account executive"],["sdr","sales development representative"],["bdr","business development representative"],["rn","registered nurse"],["lpn","licensed practical nurse"],["np","nurse practitioner"],["pa","physician assistant"],["ehr","electronic health records"],["emr","electronic medical records"],["scm","supply chain management"],["aml","anti money laundering"],["kyc","know y
22our customer"],["gdpr","general data protection regulation"]],Js=new Map,Vs=new Map;for(const[e,t]of iS){const n=e.toLowerCase(),r=t.toLowerCase();Js.has(n)||Js.set(n,[]),Js.get(n).push(r),Vs.has(r)||Vs.set(r,[]),Vs.get(r).push(n)}function xu(e){const t=e.toLowerCase().trim(),n=new Set([t]);for(const[r,s]of Js){const o=new RegExp(`\\b${lS(r)}\\b`,"gi");if(o.test(t))for(const i of s)n.add(t.replace(o,i))}for(const[r,s]of Vs)if(t.includes(r))for(const o of s)n.add(t.replace(r,o));return[...n]}function cS(e,t){const n=xu(e),r=xu(t);let s=0;for(const o of n)for(const i of r){if(i===o)return 100;if(i.includes(o))s=Math.max(s,90);else if(o.includes(i))s=Math.max(s,85);else{const c=o.split(/\s+/).filter(l=>l.length>=2);c.length>0&&c.every(l=>i.includes(l))&&(s=Math.max(s,80))}}return s}function lS(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Cm="page_view",Am="engaged",uS="signup_completed",dS="sign_up",pS="login",mS="logout",fS="user_sign_out",hS="signup_bot_blocked",gS="signup_confirmation_resent",yS="confirmation_link_expired",_S="turnstile_unavailable",xS="signup_panel_opened",bS="signup_panel_closed",wS="work_email_detected",SS="prefilled_signup_started",ES="post_signup_activation",vS="continue_as_guest",TS="guest_converted",CS="guest_data_merged",AS="guest_export_gate_shown",IS="profile_updated",RS="profile_merged",kS="profile_replaced",NS="diary_cleared",jS="career_diary_cleared",LS="profile_chat_apply",PS="profile_chat_edit",OS="profile_chat_retry",DS="profile_chat_retry_success",MS="profile_chat_undo",US="memory_accepted",FS="memory_rejected",$S="accomplishments_accepted_from_document",BS="accomplishments_auto_accepted",zS="upload_corpus_file",GS="delete_corpus_file",HS="set_default_resume",WS="resume_uploaded",JS="sample_resume_used",VS="resume_tailored",YS="tailor_resume_error",qS="tailor_keep_original",KS="resume_chat_sent",XS="resume_exported",ZS="calculate_initial_score",QS="fetch_job_description",eE="generate_snippets",tE="sticky_bar_shown",nE="sticky_bar_action_clicked",rE="generate_cover_letter",sE="cover_letter_chat_sent",oE="job_search_performed",aE="search_jobs",iE="job_saved",cE="job_unsaved",lE="job_tailor_navigated",uE="save_application",dE="watch_created",pE="watch_deleted",mE="watch_search_guest_prompt",fE="watch_cta_shown",hE="watch_cta_submitted",gE="watch_confirmed",yE="watch_claimed",_E="digest_sent",xE="digest_clicked",bE="handoff_shown",wE="handoff_clicked",SE="handoff_dismissed",EE="writeback_offered",vE="writeback_accepted",TE="writeback_skipped",Im="score_hub_viewed",Rm="score_segment_clicked",km="recap_shown",Nm="recap_item_clicked",CE="funnel_panel_viewed",AE="enough_today_shown",IE="enough_today_dismissed",RE="rejection_reframe_shown",kE="nudge_shown",NE="nudge_cta_clicked",jE="nudge_dismissed",LE="onboarding_checklist_dismissed",PE="onboarding_checklist_item_clicked",OE="paywall_viewed",DE="pro_gate_shown",ME="quota_modal_shown",UE="quota_modal_cta_clicked",FE="subscription_started",$E="subscription_portal_opened",BE="pro_trial_activated",zE="tool_scan_run",GE="tool_file_parsed",HE="tool_sample_viewed",WE="tool_signup_clicked",JE="tool_signup_completed",VE="tool_cross_link_clicked",YE="tool_share_link_copied",qE="tool_share_image_downloaded",KE="tool_share_native",XE="diag_run",ZE="diag_plan_viewed",QE="diag_signup_clicked",ev="diag_signup_completed",tv="diag_shared",nv="diag_fix_clicked",rv="career_readiness_public_viewed",sv="career_readiness_viewed",ov="career_readiness_computed",av="career_readiness_shared",iv="referral_code_viewed",cv="referral_dashboard_viewed",lv="referral_code_claimed",uv="referral_vanity_code_set",dv="campaign_code_claimed",pv="landing_referral_viewed",mv="landing_campaign_viewed",fv="growth_onboarding_updated",hv="growth_demo_state_updated",gv="portfolio_badge_clicked",yv={PAGE_VIEW:Cm,ENGAGED:Am,SIGNUP_COMPLETED:uS,SIGN_UP:dS,LOGIN:pS,LOGOUT:mS,USER_SIGN_OUT:fS,SIGNUP_BOT_BLOCKED:hS,SIGNUP_CONFIRMATION_RESENT:gS,CONFIRMATION_LINK_EXPIRED:yS,TURNSTILE_UNAVAILABLE:_S,SIGNUP_PANEL_OPENED:xS,SIGNUP_PANEL_CLOSED:bS,WORK_EMAIL_DETECTED:wS,PREFILLED_SIGNUP_STARTED:SS,POST_SIGNUP_ACTIVATION:ES,CONTINUE_AS_GUEST:vS,GUEST_CONVERTED:TS,GUEST_DATA_MERGED:CS,GUEST_EXPORT_GATE_SHOWN:AS,PROFILE_UPDATED:IS,PROFILE_MERGED:RS,PROFILE_REPLACED:kS,DIARY_CLEARED:NS,CAREER_DIARY_CLEARED:jS,PROFILE_CHAT_APPLY:LS,PROFILE_CHAT_EDIT:PS,PROFILE_CHAT_RETRY:OS,PROFILE_CHAT_RETRY_SUCCESS:DS,PROFILE_CHAT_UNDO:MS,MEMORY_ACCEPTED:US,MEMORY_REJECTED:FS,ACCOMPLISHMENTS_ACCEPTED_FROM_DOCUMENT:$S,ACCOMPLISHMENTS_AUTO_ACCEPTED:BS,UPLOAD_CORPUS_FILE:zS,DELETE_CORPUS_FILE:GS,SET_DEFAULT_RESUME:HS,RESUME_UPLOADED:WS,SAMPLE_RESUME_USED:JS,RESUME_TAILORED:VS,TAILOR_RESUME_ERROR:YS,TAILOR_KEEP_ORIGINAL:qS,RESUME_CHAT_SENT:KS,RESUME_EXPORTED:XS,CALCULATE_INITIAL_SCORE:ZS,FETCH_JOB_DESCRIPTION:QS,GENERATE_SNIPPETS:e
22E,STICKY_BAR_SHOWN:tE,STICKY_BAR_ACTION_CLICKED:nE,GENERATE_COVER_LETTER:rE,COVER_LETTER_CHAT_SENT:sE,JOB_SEARCH_PERFORMED:oE,SEARCH_JOBS:aE,JOB_SAVED:iE,JOB_UNSAVED:cE,JOB_TAILOR_NAVIGATED:lE,SAVE_APPLICATION:uE,WATCH_CREATED:dE,WATCH_DELETED:pE,WATCH_SEARCH_GUEST_PROMPT:mE,WATCH_CTA_SHOWN:fE,WATCH_CTA_SUBMITTED:hE,WATCH_CONFIRMED:gE,WATCH_CLAIMED:yE,DIGEST_SENT:_E,DIGEST_CLICKED:xE,HANDOFF_SHOWN:bE,HANDOFF_CLICKED:wE,HANDOFF_DISMISSED:SE,WRITEBACK_OFFERED:EE,WRITEBACK_ACCEPTED:vE,WRITEBACK_SKIPPED:TE,SCORE_HUB_VIEWED:Im,SCORE_SEGMENT_CLICKED:Rm,RECAP_SHOWN:km,RECAP_ITEM_CLICKED:Nm,FUNNEL_PANEL_VIEWED:CE,ENOUGH_TODAY_SHOWN:AE,ENOUGH_TODAY_DISMISSED:IE,REJECTION_REFRAME_SHOWN:RE,NUDGE_SHOWN:kE,NUDGE_CTA_CLICKED:NE,NUDGE_DISMISSED:jE,ONBOARDING_CHECKLIST_DISMISSED:LE,ONBOARDING_CHECKLIST_ITEM_CLICKED:PE,PAYWALL_VIEWED:OE,PRO_GATE_SHOWN:DE,QUOTA_MODAL_SHOWN:ME,QUOTA_MODAL_CTA_CLICKED:UE,SUBSCRIPTION_STARTED:FE,SUBSCRIPTION_PORTAL_OPENED:$E,PRO_TRIAL_ACTIVATED:BE,TOOL_SCAN_RUN:zE,TOOL_FILE_PARSED:GE,TOOL_SAMPLE_VIEWED:HE,TOOL_SIGNUP_CLICKED:WE,TOOL_SIGNUP_COMPLETED:JE,TOOL_CROSS_LINK_CLICKED:VE,TOOL_SHARE_LINK_COPIED:YE,TOOL_SHARE_IMAGE_DOWNLOADED:qE,TOOL_SHARE_NATIVE:KE,DIAG_RUN:XE,DIAG_PLAN_VIEWED:ZE,DIAG_SIGNUP_CLICKED:QE,DIAG_SIGNUP_COMPLETED:ev,DIAG_SHARED:tv,DIAG_FIX_CLICKED:nv,CAREER_READINESS_PUBLIC_VIEWED:rv,CAREER_READINESS_VIEWED:sv,CAREER_READINESS_COMPUTED:ov,CAREER_READINESS_SHARED:av,REFERRAL_CODE_VIEWED:iv,REFERRAL_DASHBOARD_VIEWED:cv,REFERRAL_CODE_CLAIMED:lv,REFERRAL_VANITY_CODE_SET:uv,CAMPAIGN_CODE_CLAIMED:dv,LANDING_REFERRAL_VIEWED:pv,LANDING_CAMPAIGN_VIEWED:mv,GROWTH_ONBOARDING_UPDATED:fv,GROWTH_DEMO_STATE_UPDATED:hv,PORTFOLIO_BADGE_CLICKED:gv},pn={RESUME_TAILOR:"resume_tailor",CAREER_DIARY:"career_diary",APPLICATION_TRACKER:"application_tracker",INTERVIEW_PREP:"interview_prep",PORTFOLIO:"portfolio"},ho=["next_followup_date","interview_dates"],_v=e=>{if(!e||e.code!=="PGRST204"&&e.code!=="42703")return null;const t=e.message??"";return ho.find(n=>t.includes(n))??null},xv=e=>{const t={...e};if("next_followup_date"in t){const n=t.next_followup_date;t.next_followup_date=typeof n=="string"&&n.trim()?n.trim():null}if("interview_dates"in t){const n=t.interview_dates;t.interview_dates=Array.isArray(n)?n.filter(r=>typeof r=="string"&&r.trim().length>0):[]}return t},bv=(e,t)=>{const n={...e};for(const r of t)delete n[r];return n},wv=e=>`${e}, ${ho.join(", ")}`,kt="cd_automation",jm="cd_automation",Sv="X-CD-Automation",Lm="AUTOMATION_BLOCKED",Pm=()=>{var t;return`This browser is marked as automated, so AI features are switched off for it. If you are not running our tests, this was set by mistake â open ${typeof window<"u"?((t=window.location)==null?void 0:t.origin)??"":""}/?${jm}=${Om} to clear it, then try again. It also clears on its own within 12 hours.`},Ev=720*60*1e3,Om="0",bu=(e,t)=>{try{return e?e.getItem(t):null}catch{return null}},xa=(e,t,n)=>{try{e==null||e.setItem(t,n)}catch{}},go=(e,t)=>{try{e==null||e.removeItem(t)}catch{}},ba=e=>JSON.stringify({v:1,exp:e+Ev}),wu=(e,t)=>{if(e===null)return!1;if(e==="1")return!0;try{const n=JSON.parse(e);return typeof(n==null?void 0:n.exp)=="number"&&n.exp>t}catch{return!1}},vv=()=>{typeof window>"u"||(go(window.localStorage,kt),go(window.sessionStorage,kt))},Dm=()=>{var o;const e=Date.now();try{if(typeof window<"u"&&((o=window.location)!=null&&o.search)){const c=new URLSearchParams(window.location.search).get(jm);if(c==="1")return xa(window.localStorage,kt,ba(e)),!0;if(c===Om)return vv(),!1}}catch{}if(typeof window>"u")return!1;const t=bu(window.localStorage,kt),n=bu(window.sessionStorage,kt),r=wu(t,e),s=wu(n,e);return t==="1"&&xa(window.localStorage,kt,ba(e)),n==="1"&&xa(window.sessionStorage,kt,ba(e)),t!==null&&!r&&go(window.localStorage,kt),n!==null&&!s&&go(window.sessionStorage,kt),r||s},Mm=()=>{try{return typeof navigator<"u"&&navigator.webdriver===!0}catch{return!1}};let mr=null;const Rn=()=>{if(mr!==null)return mr;try{mr=Dm()||Mm()}catch{mr=!1}return mr},Tv=()=>{try{return{marker:Dm(),webdriver:Mm()}}catch{return{marker:!1,webdriver:!1}}};let Su=!1;const Cv=()=>{if(Su||typeof window>"u"||typeof window.fetch!="function"||!Rn())return;Su=!0;const e=window.fetch.bind(window);window.fetch=(t,n)=>{try{const r=new Headers((n==null?void 0:n.headers)||(t instanceof Request?t.headers:void 0));return r.set(Sv,"1"),e(t,{...n,headers:r})}catch{return e(t,n)}}}
22,Um="cd_session_v2",dc=1800*1e3,Av="cd_sid",Iv=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],Rv=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Fm=e=>typeof e=="string"&&Rv.test(e),kv=e=>{let t;try{t=new URLSearchParams(e)}catch{return null}const n=Iv.flatMap(r=>{const s=t.get(r);return s?[`${r}=${s}`]:[]});return n.length>0?n.join("&"):null},Ys=()=>{try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})},Nv=(e,t,n)=>{const r=kv(n);return!e||!Fm(e.id)?{id:Ys(),isNew:!0,reason:e?"invalid":"none",utm:r}:!Number.isFinite(e.lastSeenAt)||t-e.lastSeenAt>dc?{id:Ys(),isNew:!0,reason:"idle",utm:r}:r!==null&&r!==e.utm?{id:Ys(),isNew:!0,reason:"utm_landing",utm:r}:{id:e.id,isNew:!1,reason:"reused",utm:e.utm}},Eu=(e,t)=>!e||!Number.isFinite(e.lastSeenAt)||t-e.lastSeenAt>dc,as=()=>{try{if(typeof localStorage>"u")return null;const e=localStorage.getItem(Um);if(!e)return null;const t=JSON.parse(e);return Fm(t.id)?{id:t.id,startedAt:Number(t.startedAt),lastSeenAt:Number(t.lastSeenAt),utm:typeof t.utm=="string"?t.utm:null,registered:t.registered===!0}:null}catch{return null}},Uo=e=>{try{localStorage==null||localStorage.setItem(Um,JSON.stringify(e))}catch{}jv(e.id)},jv=e=>{try{if(typeof document>"u")return;const t=typeof location<"u"&&location.protocol==="https:"?"; Secure":"",n=Math.round(dc*2/1e3);document.cookie=`${Av}=${e}; Max-Age=${n}; Path=/; SameSite=Lax${t}`}catch{}},wa={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_SUPABASE_KEY:"",VITE_SUPABASE_URL:""};let ke=null;async function Lv(){if(ke)return ke;if(typeof window>"u")return null;try{return ke=(await D(()=>import("./analytics-DHnAGbAc.js"),[])).default,ke}catch{return null}}const Fo=(e,t)=>{try{return(wa==null?void 0:wa[e])||t}catch{return t}},Tt=Fo("VITE_PUBLIC_POSTHOG_KEY","phc_UrtvZsedvwoPrnm47mOBV0qJpbVWhgQdr4C5GCESm1U"),Pv=Fo("VITE_PUBLIC_POSTHOG_HOST","https://us.i.posthog.com"),$m=Fo("VITE_ANALYTICS_ENABLED","true")!=="false",$o="/api";function Ov(){if(typeof window>"u")return"development";const e=window.location.hostname;return e==="careerdiary.io"||e==="www.careerdiary.io"?"production":e.includes("vercel.app")||e.includes("preview")?"preview":"development"}const Dv=["[email protected]","[email protected]","[email protected]"];function Mv(e){if(!e)return!1;const t=e.toLowerCase();return!!(Dv.some(n=>n.toLowerCase()===t)||t.includes("careerdiary"))}let yo=!1;const gi="cd_anonymous_id";function Lr(){let e=localStorage.getItem(gi);return e||(e=`anon_${Date.now()}_${Math.random().toString(36).slice(2,11)}`,localStorage.setItem(gi,e)),e}let Vt=null,Bo=Promise.resolve();function zo(){return Vt}const Uv=zo,vu=e=>{const t=as();t&&t.id===Vt&&Uo({...t,lastSeenAt:e})},Bm=e=>{const t=Date.now(),n=as(),r=Nv(n,t,e),s={id:r.id,startedAt:r.isNew?t:(n==null?void 0:n.startedAt)??t,lastSeenAt:t,utm:r.utm,registered:r.isNew?!1:(n==null?void 0:n.registered)===!0};Vt=r.id,Uo(s),(r.isNew||!s.registered)&&(Bo=Gm(r.id).catch(()=>{}))},zm=()=>{if(!Vt){Bm(typeof window<"u"?window.location.search:"");return}const e=Date.now(),t=as();if(t&&t.id!==Vt&&!Eu(t,e)){Vt=t.id,vu(e);return}if(Eu(t,e)){const n=Ys();Vt=n,Uo({id:n,startedAt:e,lastSeenAt:e,utm:(t==null?void 0:t.utm)??null,registered:!1}),Bo=Gm(n).catch(()=>{});return}vu(e)};let qs=!1,pc=null;function Fv(){if(!(qs||!$m)){if(Rn()){qs=!0;return}if(Tt){const e=Ov();Lv().then(t=>{t&&t.init(Tt,{api_host:Pv,capture_pageview:!1,capture_pageleave:!0,autocapture:!0,session_recording:{maskAllInputs:!1,maskInputOptions:{password:!0}},persistence:"localStorage+cookie",loaded:n=>{n.register({environment:e,app_version:Fo("VITE_APP_VERSION","unknown")});const r=Lr();n.get_distinct_id()!==r&&n.identify(r)}})})}Bm(window.location.search),qs=!0}}async function Gm(e){try{const t=new URLSearchParams(window.location.search),n=await fetch(`${$o}/analytics/session/start`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,anonymousId:Lr(),userAgent:navigator.userAgent,referrer:document.referrer,utmSource:t.get("utm_source"),utmMedium:t.get("utm_medium"),utmCampaign:t.get("utm_campaign"),utmTerm:t.get("utm_term"),utmContent:t.get("utm_content"),screenWidth:window.screen.width,screenHeight:window.screen.height,language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone})}),r=await n.json().catch(()=>({}));if(!n.ok||!r.sessionId)return;const s=r.sessionId;s!==e&&(Vt=s);const o=as();(!o||o.id===e||o.id===s)&&Uo({id:s,startedAt:(o==null?void 0:o.startedAt)??Date.now(),lastSeenAt:Date.now(),utm:(o==null?void 0:o.utm)??null,registered:!0})}catch(t){console.warn("Failed to start analytics session:",t)}}function $v(){const e=zo();e&&navigator.sendBeacon(`${$o}/analytics/session/end`,JSON.stringify({sessionId:e}))}function Bv(e,t){if(Rn())return;pc=e;const n=t==null?void 0:t.email;if(yo=Mv(n),yo){console.log("[Analytics] User excluded from tracking:",n),Tt&&ke&&ke.opt_out_capturing();return}if(Tt&&ke){ke.opt_in_capturing(),ke.identify(e,t);const r=Lr();r!==e&&ke.alias(e,r)}zm(),Bo.then(()=>fetch(`${$o}/analytics/identify`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,anonymousId:Lr(),sessionId:zo(),traits:t})}).catch(()=>{}))}function zv(){pc=null,Tt&&ke&&ke.reset(),localStorage.removeItem(gi)}function Gv(e,t){if(yo||Rn())return;const n={name:e||document.title,path:window.location.pathname,url:window.location.href,referrer:document.referrer,...t};Tt&&ke&&ke.capture("$pageview",n),Hm(Cm,n)}function Hv(e,t){if(yo||Rn())return;const n={...t,timestamp:new Date().toISOString()};Tt&&ke&&ke.capture(e,n),Hm(e,n)}async function Hm(e,t){try{zm(),await Promise.race([Bo,new Promise(n=>setTimeout(n,4e3))]),await fetch(`${$o}/analytics/track`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:zo(),userId:pc,anonymousId:Lr(),eventName:e,properties:t,pageUrl:window.location.href,pagePath:window.location.pathname,pageTitle:document.title})})}catch{}}
22function Wv(e){Tt&&ke&&ke.people.set(e)}function Jv(e){Tt&&ke&&ke.register(e)}function Vv(){return $m&&qs}function Yv(){return Tt?ke:null}const Jt={init:Fv,identify:Bv,reset:zv,page:Gv,track:Hv,setUserProperties:Wv,register:Jv,endSession:$v,isEnabled:Vv,getPostHog:Yv,EVENTS:yv};function qv(){var e;return typeof window>"u"?"server-side":Uv()??((e=as())==null?void 0:e.id)??"pre-init"}function Kv(){if(typeof window>"u"||typeof sessionStorage>"u")return{};const e=new URLSearchParams(window.location.search),t={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content"].forEach(r=>{const s=e.get(r);if(s)t[r]=s,sessionStorage.setItem(r,s);else{const o=sessionStorage.getItem(r);o&&(t[r]=o)}}),t}async function Xv(){try{const{supabase:e}=await D(async()=>{const{supabase:n}=await Promise.resolve().then(()=>U1);return{supabase:n}},void 0);if(!e)return;const{data:{user:t}}=await e.auth.getUser();return t==null?void 0:t.id}catch{return}}const Pr=e=>{try{const t=JSON.stringify(e);if(typeof navigator<"u"&&navigator.sendBeacon){const n=new Blob([t],{type:"application/json"});navigator.sendBeacon("/analytics",n);return}fetch("/analytics",{method:"POST",headers:{"Content-Type":"application/json"},body:t,keepalive:!0}).catch(()=>{})}catch(t){console.warn("Failed to queue analytics payload",t)}};let yi=0,Tu=!1;const Zv=()=>{try{typeof window<"u"&&(window.__cdAnalyticsSuppressed=yi)}catch{}},Qv=e=>{if(yi+=1,Zv(),!Tu){Tu=!0;try{const t=Tv();Pr({eventName:"automation_suppressed",eventParams:{automated:!0,firstSuppressedEvent:e,detectedBy:t.marker?t.webdriver?"marker+webdriver":"marker":"webdriver",pageUrl:typeof window<"u"?window.location.href:void 0},timestamp:new Date().toISOString()}),typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("pagehide",()=>
22{try{Pr({eventName:"automation_suppressed_total",eventParams:{automated:!0,suppressedEvents:yi},timestamp:new Date().toISOString()})}catch{}},{once:!0})}catch{}}},is=e=>Rn()?(Qv(e),!0):!1;async function mc(e,t={}){if(!is(e))try{const n={event_name:e,session_id:qv(),timestamp:new Date().toISOString(),properties:t,page_url:typeof window<"u"?window.location.href:void 0,referrer:typeof document<"u"&&document.referrer||void 0,user_agent:typeof navigator<"u"?navigator.userAgent:void 0,...Kv()},r=await Xv();r&&(n.user_id=r),Pr(n)}catch(n){console.error("Analytics tracking failed:",n)}}function eT(e){is("page_view")||(Jt.page(e),mc("page_view",{page_name:e,page_path:typeof window<"u"?window.location.pathname:void 0}))}function nr(e,t={}){is(`conversion:${e}`)||(Jt.track(e,t),mc("conversion_step",{step:e,...t}))}const te=(e,t)=>{is(e)||(Jt.track(e,t),Pr({eventName:e,eventParams:t,timestamp:new Date().toISOString()}))},Go=(e,t,n)=>{const r={errorType:e,message:t instanceof Error?t.message:String(t),stack:t instanceof Error?t.stack:void 0,context:n,url:typeof window<"u"?window.location.href:void 0,userAgent:typeof navigator<"u"?navigator.userAgent:void 0,timestamp:new Date().toISOString()};console.error(`[${e}]`,r),!is(`error:${e}`)&&Pr({eventName:"error_occurred",eventParams:r,timestamp:r.timestamp})},tT=Am,Wm="cd_engaged_v1",nT=1e4,Cu=()=>{try{return typeof sessionStorage<"u"&&sessionStorage.getItem(Wm)==="1"}catch{return!1}},rT=()=>{try{sessionStorage==null||sessionStorage.setItem(Wm,"1")}catch{}};let Sa=!1;const sT=(e,t)=>!e&&!t,oT=()=>{if(typeof window>"u")return()=>{};if(!sT(Rn(),Sa||Cu()))return()=>{};let e,t=!1;const n=c=>{t||Sa||Cu()||(Sa=!0,rT(),te(tT,{trigger:c}),i())},r=()=>n("scroll"),s=()=>n("click"),o=c=>{const l=c.target,u=l==null?void 0:l.tagName;(u==="INPUT"||u==="TEXTAREA"||l!=null&&l.isContentEditable)&&n("focus")};function i(){t||(t=!0,e&&clearTimeout(e),window.removeEventListener("scroll",r),window.removeEventListener("click",s),window.removeEventListener("focusin",o))}return e=setTimeout(()=>n("dwell"),nT),window.addEventListener("scroll",r,{passive:!0,once:!0}),window.addEventListener("click",s,{once:!0}),window.addEventListener("focusin",o),i};var Au="popstate";function aT(e={}){function t(r,s){let{pathname:o,search:i,hash:c}=r.location;return _i("",{pathname:o,search:i,hash:c},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:Or(s)}return cT(t,n,null,e)}function Ae(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function rt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function iT(){return Math.random().toString(36).substring(2,10)}function Iu(e,t){return{usr:e.state,key:e.key,idx:t}}function _i(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?rr(t):t,state:n,key:t&&t.key||r||iT()}}function Or({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function rr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function cT(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:o=!1}=r,i=s.history,c="POP",l=null,u=d();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function d(){return(i.state||{idx:null}).idx}function p(){c="POP";let y=d(),b=y==null?null:y-u;u=y,l&&l({action:c,location:h.location,delta:b})}function m(y,b){c="PUSH";let x=_i(h.location,y,b);u=d()+1;let w=Iu(x,u),E=h.createHref(x);try{i.pushState(w,"",E)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;s.location.assign(E)}o&&l&&l({action:c,location:h.location,delta:1})}function g(y,b){c="REPLACE";let x=_i(h.location,y,b);u=d();let w=Iu(x,u),E=h.createHref(x);i.replaceState(w,"",E),o&&l&&l({action:c,location:h.location,delta:0})}function _(y){return lT(y)}let h={get action(){return c},get location(){return e(s,i)},listen(y){if(l)throw new Error("A history only accepts one active listener");return s.addEventListener(Au,p),l=y,()=>{s.removeEventListener(Au,p),l=null}},createHref(y){return t(s,y)},createURL:_,encodeLocation(y){let b=_(y);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:m,replace:g,go(y){return i.go(y)}};return h}function lT(e,t=!1){let n="http://localhost";
22typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Ae(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Or(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function Jm(e,t,n="/"){return uT(e,t,n,!1)}function uT(e,t,n,r){let s=typeof t=="string"?rr(t):t,o=$t(s.pathname||"/",n);if(o==null)return null;let i=Vm(e);dT(i);let c=null;for(let l=0;c==null&&l<i.length;++l){let u=ST(o);c=bT(i[l],u,r)}return c}function Vm(e,t=[],n=[],r="",s=!1){let o=(i,c,l=s,u)=>{let d={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:c,route:i};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&l)return;Ae(d.relativePath.startsWith(r),`Absolute route path "${d.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(r.length)}let p=Ot([r,d.relativePath]),m=n.concat(d);i.children&&i.children.length>0&&(Ae(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),Vm(i.children,t,m,p,l)),!(i.path==null&&!i.index)&&t.push({path:p,score:_T(p,i.index),routesMeta:m})};return e.forEach((i,c)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))o(i,c);else for(let u of Ym(i.path))o(i,c,!0,u)}),t}function Ym(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return s?[o,""]:[o];let i=Ym(r.join("/")),c=[];return c.push(...i.map(l=>l===""?o:[o,l].join("/"))),s&&c.push(...i),c.map(l=>e.startsWith("/")&&l===""?"/":l)}function dT(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:xT(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var pT=/^:[\w-]+$/,mT=3,fT=2,hT=1,gT=10,yT=-2,Ru=e=>e==="*";function _T(e,t){let n=e.split("/"),r=n.length;return n.some(Ru)&&(r+=yT),t&&(r+=fT),n.filter(s=>!Ru(s)).reduce((s,o)=>s+(pT.test(o)?mT:o===""?hT:gT),r)}function xT(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function bT(e,t,n=!1){let{routesMeta:r}=e,s={},o="/",i=[];for(let c=0;c<r.length;++c){let l=r[c],u=c===r.length-1,d=o==="/"?t:t.slice(o.length)||"/",p=_o({path:l.relativePath,caseSensitive:l.caseSensitive,end:u},d),m=l.route;if(!p&&u&&n&&!r[r.length-1].route.index&&(p=_o({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!p)return null;
22Object.assign(s,p.params),i.push({params:s,pathname:Ot([o,p.pathname]),pathnameBase:CT(Ot([o,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(o=Ot([o,p.pathnameBase]))}return i}function _o(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=wT(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let o=s[0],i=o.replace(/(.)\/+$/,"$1"),c=s.slice(1);return{params:r.reduce((u,{paramName:d,isOptional:p},m)=>{if(d==="*"){let _=c[m]||"";i=o.slice(0,o.length-_.length).replace(/(.)\/+$/,"$1")}const g=c[m];return p&&!g?u[d]=void 0:u[d]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function wT(e,t=!1,n=!0){rt(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,c,l)=>(r.push({paramName:c,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function ST(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return rt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function $t(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var qm=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ET=e=>qm.test(e);function vT(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?rr(e):e,o;if(n)if(ET(n))o=n;else{if(n.includes("//")){let i=n;n=n.replace(/\/\/+/g,"/"),rt(!1,`Pathnames cannot have embedded double slashes - normalizing ${i} -> ${n}`)}n.startsWith("/")?o=ku(n.substring(1),"/"):o=ku(n,t)}else o=t;return{pathname:o,search:AT(r),hash:IT(s)}}function ku(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Ea(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function TT(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function fc(e){let t=TT(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function hc(e,t,n,r=!1){let s;typeof e=="string"?s=rr(e):(s={...e},Ae(!s.pathname||!s.pathname.includes("?"),Ea("?","pathname","search",s)),Ae(!s.pathname||!s.pathname.includes("#"),Ea("#","pathname","hash",s)),Ae(!s.search||!s.search.includes("#"),Ea("#","search","hash",s)));let o=e===""||s.pathname==="",i=o?"/":s.pathname,c;if(i==null)c=n;else{let p=t.length-1;if(!r&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),p-=1;s.pathname=m.join("/")}c=p>=0?t[p]:"/"}let l=vT(s,c),u=i&&i!=="/"&&i.endsWith("/"),d=(o||i===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}var Ot=e=>e.join("/").replace(/\/\/+/g,"/"),CT=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),AT=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,IT=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,RT=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function kT(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function NT(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Km=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Xm(e,t){let n=e;
22if(typeof n!="string"||!qm.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(Km)try{let o=new URL(window.location.href),i=n.startsWith("//")?new URL(o.protocol+n):new URL(n),c=$t(i.pathname,t);i.origin===o.origin&&c!=null?n=c+i.search+i.hash:s=!0}catch{rt(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Zm=["POST","PUT","PATCH","DELETE"];new Set(Zm);var jT=["GET",...Zm];new Set(jT);var sr=f.createContext(null);sr.displayName="DataRouter";var Ho=f.createContext(null);Ho.displayName="DataRouterState";var LT=f.createContext(!1),Qm=f.createContext({isTransitioning:!1});Qm.displayName="ViewTransition";var PT=f.createContext(new Map);PT.displayName="Fetchers";var OT=f.createContext(null);OT.displayName="Await";var ot=f.createContext(null);ot.displayName="Navigation";var cs=f.createContext(null);cs.displayName="Location";var _t=f.createContext({outlet:null,matches:[],isDataRoute:!1});_t.displayName="Route";var gc=f.createContext(null);gc.displayName="RouteError";var ef="REACT_ROUTER_ERROR",DT="REDIRECT",MT="ROUTE_ERROR_RESPONSE";function UT(e){if(e.startsWith(`${ef}:${DT}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function FT(e){if(e.startsWith(`${ef}:${MT}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new RT(t.status,t.statusText,t.data)}catch{}}function $T(e,{relative:t}={}){Ae(or(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=f.useContext(ot),{hash:s,pathname:o,search:i}=ls(e,{relative:t}),c=o;return n!=="/"&&(c=o==="/"?n:Ot([n,o])),r.createHref({pathname:c,search:i,hash:s})}function or(){return f.useContext(cs)!=null}function We(){return Ae(or(),"useLocation() may be used only in the context of a <Router> component."),f.useContext(cs).location}var tf="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nf(e){f.useContext(ot).static||f.useLayoutEffect(e)}function qe(){let{isDataRoute:e}=f.useContext(_t);return e?QT():BT()}function BT(){Ae(or(),"useNavigate() may be used only in the context of a <Router> component.");let e=f.useContext(sr),{basename:t,navigator:n}=f.useContext(ot),{matches:r}=f.useContext(_t),{pathname:s}=We(),o=JSON.stringify(fc(r)),i=f.useRef(!1);return nf(()=>{i.current=!0}),f.useCallback((l,u={})=>{if(rt(i.current,tf),!i.current)return;if(typeof l=="number"){n.go(l);return}let d=hc(l,JSON.parse(o),s,u.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:Ot([t,d.pathname])),(u.replace?n.replace:n.push)(d,u.state,u)},[t,n,o,s,e])}f.createContext(null);function RL(){let{matches:e}=f.useContext(_t),t=e[e.length-1];return t?t.params:{}}function ls(e,{relative:t}={}){let{matches:n}=f.useContext(_t),{pathname:r}=We(),s=JSON.stringify(fc(n));return f.useMemo(()=>hc(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function zT(e,t){return rf(e,t)}function rf(e,t,n,r,s){var x;Ae(or(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=f.useContext(ot),{matches:i}=f.useContext(_t),c=i[i.length-1],l=c?c.params:{},u=c?c.pathname:"/",d=c?c.pathnameBase:"/",p=c&&c.route;{let w=p&&p.path||"";of(u,!p||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. 23 24Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let m=We(),g;if(t){let w=typeof t=="string"?rr(t):t;Ae(d==="/"||((x=w.pathname)==null?void 0:x.startsWith(d)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${w.pathname}" was given in the \`location\` prop.`),g=w}else g=m;let _=g.pathname||"/",h=_;if(d!=="/"){let w=d.replace(/^\//,"").split("/");h="/"+_.replace(/^\//,"").split("/").slice(w.length).join("/")}let y=Jm(e,{pathname:h});rt(p||y!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),rt(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let b=VT(y&&y.map(w=>Object.assign({},w,{params:Object.assign({},l,w.params),pathname:Ot([d,o.encodeLocation?o.encodeLocation(w.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?d:Ot([d,o.encodeLocation?o.encodeLocation(w.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),i,n,r,s);return t&&b?f.createElement(cs.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...g},navigationType:"POP"}},b):b}function GT(){let e=ZT(),t=kT(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},o={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=f.createElement(f.Fragment,null,f.createElement("p",null,"ð¿ Hey developer ð"),f.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",f.createElement("code",{style:o},"ErrorBoundary")," or"," ",f.createElement("code",{style:o},"errorElement")," prop on your route.")),f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application
24Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},t),n?f.createElement("pre",{style:s},n):null,i)}var HT=f.createElement(GT,null),sf=class extends f.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=FT(e.digest);n&&(e=n)}let t=e!==void 0?f.createElement(_t.Provider,{value:this.props.routeContext},f.createElement(gc.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?f.createElement(WT,{error:e},t):t}};sf.contextType=LT;var va=new WeakMap;function WT({children:e,error:t}){let{basename:n}=f.useContext(ot);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=UT(t.digest);if(r){let s=va.get(t);if(s)throw s;let o=Xm(r.location,n);if(Km&&!va.get(t))if(o.isExternal||r.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const i=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:r.replace}));throw va.set(t,i),i}return f.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function JT({routeContext:e,match:t,children:n}){let r=f.useContext(sr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),f.createElement(_t.Provider,{value:e},n)}function VT(e,t=[],n=null,r=null,s=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,i=n==null?void 0:n.errors;if(i!=null){let d=o.findIndex(p=>p.route.id&&(i==null?void 0:i[p.route.id])!==void 0);Ae(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,l=-1;if(n)for(let d=0;d<o.length;d++){let p=o[d];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(l=d),p.route.id){let{loaderData:m,errors:g}=n,_=p.route.loader&&!m.hasOwnProperty(p.route.id)&&(!g||g[p.route.id]===void 0);if(p.route.lazy||_){c=!0,l>=0?o=o.slice(0,l+1):o=[o[0]];break}}}let u=n&&r?(d,p)=>{var m,g;r(d,{location:n.location,params:((g=(m=n.matches)==null?void 0:m[0])==null?void 0:g.params)??{},unstable_pattern:NT(n.matches),errorInfo:p})}:void 0;return o.reduceRight((d,p,m)=>{let g,_=!1,h=null,y=null;n&&(g=i&&p.route.id?i[p.route.id]:void 0,h=p.route.errorElement||HT,c&&(l<0&&m===0?(of("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),_=!0,y=null):l===m&&(_=!0,y=p.route.hydrateFallbackElement||null)));let b=t.concat(o.slice(0,m+1)),x=()=>{let w;return g?w=h:_?w=y:p.route.Component?w=f.createElement(p.route.Component,null):p.route.element?w=p.route.element:w=d,f.createElement(JT,{match:p,routeContext:{outlet:d,matches:b,isDataRoute:n!=null},children:w})};return n&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?f.createElement(sf,{location:n.location,revalidation:n.revalidation,component:h,error:g,children:x(),routeContext:{outlet:null,matches:b,isDataRoute:!0},onError:u}):x()},null)}function yc(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function YT(e){let t=f.useContext(sr);return Ae(t,yc(e)),t}function qT(e){let t=f.useContext(Ho);return Ae(t,yc(e)),t}function KT(e){let t=f.useContext(_t);return Ae(t,yc(e)),t}function _c(e){let t=KT(e),n=t.matches[t.matches.length-1];return Ae(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function XT(){return _c("useRouteId")}function ZT(){var r;let e=f.useContext(gc),t=qT("useRouteError"),n=_c("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function QT(){let{router:e}=YT("useNavigate"),t=_c("useNavigate"),n=f.useRef(!1);return nf(()=>{n.current=!0}),f.useCallback(async(s,o={})=>{rt(n.current,tf),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var Nu={};function of(e,t,n){!t&&!Nu[e]&&(Nu[e]=!0,rt(!1,n))}f.memo(e1);function e1({routes:e,future:t,state:n,onError:r}){return rf(e,void 0,n,r,t)}function Pe({to:e,replace:t,state:n,relative:r}){Ae(or(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=f.useContext(ot);rt(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=f.useContext(_t),{pathname:i}=We(),c=qe(),l=hc(e,fc(o),i,r==="path"),u=JSON.stringify(l);return f.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function P(e){Ae(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function t1({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:o=!1,unstable_useTransitions:i}){Ae(!or(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),l=f.useMemo(()=>({basename:c,navigator:s,static:o,unstable_useTransitions:i,future:{}}),[c,s,o,i]);typeof n=="string"&&(n=rr(n));
24let{pathname:u="/",search:d="",hash:p="",state:m=null,key:g="default"}=n,_=f.useMemo(()=>{let h=$t(u,c);return h==null?null:{location:{pathname:h,search:d,hash:p,state:m,key:g},navigationType:r}},[c,u,d,p,m,g,r]);return rt(_!=null,`<Router basename="${c}"> is not able to match the URL "${u}${d}${p}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:f.createElement(ot.Provider,{value:l},f.createElement(cs.Provider,{children:t,value:_}))}function n1({children:e,location:t}){return zT(xi(e),t)}function xi(e,t=[]){let n=[];return f.Children.forEach(e,(r,s)=>{if(!f.isValidElement(r))return;let o=[...t,s];if(r.type===f.Fragment){n.push.apply(n,xi(r.props.children,o));return}Ae(r.type===P,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ae(!r.props.index||!r.props.children,"An index route cannot have child routes.");let i={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=xi(r.props.children,o)),n.push(i)}),n}var Ks="get",Xs="application/x-www-form-urlencoded";function Wo(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function r1(e){return Wo(e)&&e.tagName.toLowerCase()==="button"}function s1(e){return Wo(e)&&e.tagName.toLowerCase()==="form"}function o1(e){return Wo(e)&&e.tagName.toLowerCase()==="input"}function a1(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function i1(e,t){return e.button===0&&(!t||t==="_self")&&!a1(e)}function bi(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function c1(e,t){let n=bi(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}var As=null;function l1(){if(As===null)try{new FormData(document.createElement("form"),0),As=!1}catch{As=!0}return As}var u1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ta(e){return e!=null&&!u1.has(e)?(rt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Xs}"`),null):e}function d1(e,t){let n,r,s,o,i;if(s1(e)){let c=e.getAttribute("action");r=c?$t(c,t):null,n=e.getAttribute("method")||Ks,s=Ta(e.getAttribute("enctype"))||Xs,o=new FormData(e)}else if(r1(e)||o1(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||c.getAttribute("action");if(r=l?$t(l,t):null,n=e.getAttribute("formmethod")||c.getAttribute("method")||Ks,s=Ta(e.getAttribute("formenctype"))||Ta(c.getAttribute("enctype"))||Xs,o=new FormData(c,e),!l1()){let{name:u,type:d,value:p}=e;if(d==="image"){let m=u?`${u}.`:"";o.append(`${m}x`,"0"),o.append(`${m}y`,"0")}else u&&o.append(u,p)}}else{if(Wo(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Ks,r=null,s=Xs,i=e}return o&&s==="text/plain"&&(i=o,o=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:o,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function xc(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function p1(e,t,n){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname==="/"?r.pathname=`_root.${n}`:t&&$t(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function m1(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.
24isSpaMode,window.location.reload(),new Promise(()=>{})}}function f1(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function h1(e,t,n){let r=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let i=await m1(o,n);return i.links?i.links():[]}return[]}));return x1(r.flat(1).filter(f1).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function ju(e,t,n,r,s,o){let i=(l,u)=>n[u]?l.route.id!==n[u].route.id:!0,c=(l,u)=>{var d;return n[u].pathname!==l.pathname||((d=n[u].route.path)==null?void 0:d.endsWith("*"))&&n[u].params["*"]!==l.params["*"]};return o==="assets"?t.filter((l,u)=>i(l,u)||c(l,u)):o==="data"?t.filter((l,u)=>{var p;let d=r.routes[l.route.id];if(!d||!d.hasLoader)return!1;if(i(l,u)||c(l,u))return!0;if(l.route.shouldRevalidate){let m=l.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((p=n[0])==null?void 0:p.params)||{},nextUrl:new URL(e,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function g1(e,t,{includeHydrateFallback:n}={}){return y1(e.map(r=>{let s=t.routes[r.route.id];if(!s)return[];let o=[s.module];return s.clientActionModule&&(o=o.concat(s.clientActionModule)),s.clientLoaderModule&&(o=o.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(o=o.concat(s.hydrateFallbackModule)),s.imports&&(o=o.concat(s.imports)),o}).flat(1))}function y1(e){return[...new Set(e)]}function _1(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function x1(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let o=JSON.stringify(_1(s));return n.has(o)||(n.add(o),r.push({key:o,link:s})),r},[])}function af(){let e=f.useContext(sr);return xc(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function b1(){let e=f.useContext(Ho);return xc(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var bc=f.createContext(void 0);bc.displayName="FrameworkContext";function cf(){let e=f.useContext(bc);return xc(e,"You must render this element inside a <HydratedRouter> element"),e}function w1(e,t){let n=f.useContext(bc),[r,s]=f.useState(!1),[o,i]=f.useState(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:p}=t,m=f.useRef(null);f.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let h=b=>{b.forEach(x=>{i(x.isIntersecting)})},y=new IntersectionObserver(h,{threshold:.5});return m.current&&y.observe(m.current),()=>{y.disconnect()}}},[e]),f.useEffect(()=>{if(r){let h=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(h)}}},[r]);let g=()=>{s(!0)},_=()=>{s(!1),i(!1)};return n?e!=="intent"?[o,m,{}]:[o,m,{onFocus:fr(c,g),onBlur:fr(l,_),onMouseEnter:fr(u,g),onMouseLeave:fr(d,_),onTouchStart:fr(p,g)}]:[!1,m,{}]}function fr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function S1({page:e,...t}){let{router:n}=af(),r=f.useMemo(()=>Jm(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?f.createElement(v1,{page:e,matches:r,...t}):null}function E1(e){let{manifest:t,routeModules:n}=cf(),[r,s]=f.useState([]);return f.useEffect(()=>{let o=!1;return h1(e,t,n).then(i=>{o||s(i)}),()=>{o=!0}},[e,t,n]),r}function v1({page:e,matches:t,...n}){let r=We(),{manifest:s,routeModules:o}=cf(),{basename:i}=af(),{loaderData:c,matches:l}=b1(),u=f.useMemo(()=>ju(e,t,l,s,r,"data"),[e,t,l,s,r]),d=f.useMemo(()=>ju(e,t,l,s,r,"assets"),[e,t,l,s,r]),p=f.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let _=new Set,h=!1;if(t.forEach(b=>{var w;let x=s.routes[b.route.id];!x||!x.hasLoader||(!u.some(E=>E.route.id===b.route.id)&&b.route.id in c&&((w=o[b.route.id])!=null&&w.shouldRevalidate)||x.hasClientLoader?h=!0:_.add(b.route.id))}),_.size===0)return[];let y=p1(e,i,"data");return h&&_.size>0&&y.searchParams.set("_routes",t.filter(b=>_.has(b.route.id)).map(b=>b.route.id).join(",")),[y.pathname+y.search]},[i,c,r,s,u,t,e,o]),m=f.useMemo(()=>g1(d,s),[d,s]),g=E1(d);return f.createElement(f.Fragment,null,p.map(_=>f.createElement("link",{key:_,rel:"prefetch",as:"fetch",href:_,...n})),m.map(_=>f.createElement("link",{key:_,rel:"modulepreload",href:_,...n})),g.map(({key:_,link:h})=>f.createElement("link",{key:_,nonce:n.nonce,...h})))}function T1(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var C1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{C1&&(window.__reactRouterVersion="7.11.0")}catch{}function A1({basename:e,children:t,unstable_useTransitions:n,window:r}){let s=f.useRef();s.current==null&&(s.current=aT({window:r,v5Compat:!0}));let o=s.current,[i,c]=f.useState({action:o.action,location:o.location}),l=f.useCallback(u=>{n===!1?c(u):f.startTransition(()=>c(u))},[n]);return f.useLayoutEffect(()=>o.listen(l),[o,l]),f.createElement(t1,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:o,unstable_useTransitions:n})}var lf=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bn=f.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:s,reloadDocument:o,replace:i,state:c,target:l,to:u,preventScrollReset:d,viewTransition:p,unstable_defaultShouldRevalidate:m,...g},_){let{basename:h,unstable_useTransitions:y}=f.useContext(ot),b=typeof u=="string"&&lf.test(u),x=Xm(u,h);u=x.to;let w=$T(u,{relative:s}),[E,T,C]=w1(r,g),S=N1(u,{replace:i,state:c,target:l,preventScrollReset:d,relative:s,viewTransition:p,unstable_defaultShouldRevalidate:m,unstable_useTransitions:y});function A(N){t&&t(N),N.defaultPrevented||S(N)}let R=f.createElement("a",{...g,...C,href:x.absoluteURL||w,onClick:x.isExternal||o?t:A,ref:T1(_,T),target:l,"data-discover":!b&&n==="render"?"true":void 0});return E&&!b?f.createElement(f.Fragment,null,R,f.createElement(S1,{page:w})):R});bn.displayName="Link";var I1=f.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:s=!1,style:o,to:i,viewTransition:c,children:l,...u},d){let p=ls(i,{relative:u.relative}),m=We(),g=f.useContext(Ho),{navigator:_,basename:h}=f.useContext(ot),y=g!=null&&D1(p)&&c===!0,b=_.encodeLocation?_.encodeLocation(p).pathname:p.pathname,x=m.pathname,w=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;n||(x=x.toLowerCase(),w=w?w.toLowerCase():null,b=b.toLowerCase()),w&&h&&(w=$t(w,h)||w);const E=b!=="/"&&b.endsWith("/")?b.length-1:b.length;
24let T=x===b||!s&&x.startsWith(b)&&x.charAt(E)==="/",C=w!=null&&(w===b||!s&&w.startsWith(b)&&w.charAt(b.length)==="/"),S={isActive:T,isPending:C,isTransitioning:y},A=T?t:void 0,R;typeof r=="function"?R=r(S):R=[r,T?"active":null,C?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let N=typeof o=="function"?o(S):o;return f.createElement(bn,{...u,"aria-current":A,className:R,ref:d,style:N,to:i,viewTransition:c},typeof l=="function"?l(S):l)});I1.displayName="NavLink";var R1=f.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:s,state:o,method:i=Ks,action:c,onSubmit:l,relative:u,preventScrollReset:d,viewTransition:p,unstable_defaultShouldRevalidate:m,...g},_)=>{let{unstable_useTransitions:h}=f.useContext(ot),y=P1(),b=O1(c,{relative:u}),x=i.toLowerCase()==="get"?"get":"post",w=typeof c=="string"&&lf.test(c),E=T=>{if(l&&l(T),T.defaultPrevented)return;T.preventDefault();let C=T.nativeEvent.submitter,S=(C==null?void 0:C.getAttribute("formmethod"))||i,A=()=>y(C||T.currentTarget,{fetcherKey:t,method:S,navigate:n,replace:s,state:o,relative:u,preventScrollReset:d,viewTransition:p,unstable_defaultShouldRevalidate:m});h&&n!==!1?f.startTransition(()=>A()):A()};return f.createElement("form",{ref:_,method:x,action:b,onSubmit:r?l:E,...g,"data-discover":!w&&e==="render"?"true":void 0})});R1.displayName="Form";function k1(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function uf(e){let t=f.useContext(sr);return Ae(t,k1(e)),t}function N1(e,{target:t,replace:n,state:r,preventScrollReset:s,relative:o,viewTransition:i,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=qe(),d=We(),p=ls(e,{relative:o});return f.useCallback(m=>{if(i1(m,t)){m.preventDefault();let g=n!==void 0?n:Or(d)===Or(p),_=()=>u(e,{replace:g,state:r,preventScrollReset:s,relative:o,viewTransition:i,unstable_defaultShouldRevalidate:c});l?f.startTransition(()=>_()):_()}},[d,u,p,n,r,t,e,s,o,i,c,l])}function kL(e){rt(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=f.useRef(bi(e)),n=f.useRef(!1),r=We(),s=f.useMemo(()=>c1(r.search,n.current?null:t.current),[r.search]),o=qe(),i=f.useCallback((c,l)=>{const u=bi(typeof c=="function"?c(new URLSearchParams(s)):c);n.current=!0,o("?"+u,l)},[o,s]);return[s,i]}var j1=0,L1=()=>`__${String(++j1)}__`;function P1(){let{router:e}=uf("useSubmit"),{basename:t}=f.useContext(ot),n=XT(),r=e.fetch,s=e.navigate;return f.useCallback(async(o,i={})=>{let{action:c,method:l,encType:u,formData:d,body:p}=d1(o,t);if(i.navigate===!1){let m=i.fetcherKey||L1();await r(m,n,i.action||c,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:d,body:p,formMethod:i.method||l,formEncType:i.encType||u,flushSync:i.flushSync})}else await s(i.action||c,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:d,body:p,formMethod:i.method||l,formEncType:i.encType||u,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[r,s,t,n])}function O1(e,{relative:t}={}){let{basename:n}=f.useContext(ot),r=f.useContext(_t);Ae(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),o={...ls(e||".",{relative:t})},i=We();if(e==null){o.search=i.search;let c=new URLSearchParams(o.search),l=c.getAll("index");if(l.some(d=>d==="")){c.delete("index"),l.filter(p=>p).forEach(p=>c.append("index",p));let d=c.toString();o.search=d?`?${d}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Ot([n,o.pathname])),Or(o)}function D1(e,{relative:t}={}){let n=f.useContext(Qm);Ae(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=uf("useViewTransitionState"),s=ls(e,{relative:t});if(!n.isTransitioning)return!1;let o=$t(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=$t(n.nextLocation.pathname,r)||n.nextLocation.pathname;return _o(s.pathname,i)!=null||_o(s.pathname,o)!=null}const Lu={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_SUPABASE_KEY:"",VITE_SUPABASE_URL:""};var xo={};
24const Pu=(e,t,n)=>{if(!e)return;const r=typeof process<"u"&&xo?xo:{};return t[e]??n[e]??r[e]},M1=(e,t)=>{if(e.VITE_SUPABASE_ENV)return String(e.VITE_SUPABASE_ENV).toLowerCase().includes("prod")?"production":"development";const n=typeof process<"u"&&xo?xo:{},r=t.VITE_SUPABASE_ENV||n.VITE_SUPABASE_ENV||n.SUPABASE_ENV||t.MODE||n.NODE_ENV||"development";return String(r).toLowerCase().includes("prod")?"production":"development"},Ou=(e,t,n,r)=>{const s=t==="production"?"_PROD":"_DEV",o=[`VITE_SUPABASE_${e}${s}`,`NEXT_PUBLIC_SUPABASE_${e==="URL"?"URL":"ANON_KEY"}${s}`,`${e==="URL"?"SUPABASE_URL":"SUPABASE_KEY"}${s}`];for(const c of o){const l=Pu(c,n,r);if(l)return l}const i=[`VITE_SUPABASE_${e}`,`NEXT_PUBLIC_SUPABASE_${e==="URL"?"URL":"ANON_KEY"}`,e==="URL"?"SUPABASE_URL":"SUPABASE_KEY"];for(const c of i){const l=Pu(c,n,r);if(l)return t==="development"&&typeof window<"u"&&console.warn(`[Supabase Config] Using generic ${c} in development mode. Consider setting VITE_SUPABASE_${e}_DEV for better environment separation.`),l}return""};function df(){const e=typeof window<"u"?window:void 0,t=(e==null?void 0:e.__RUNTIME_CONFIG__)||{},n=typeof import.meta<"u"&&Lu?Lu:{},r=M1(t,n);return{supabaseEnv:r,supabaseUrl:Ou("URL",r,t,n),supabaseKey:Ou("KEY",r,t,n)}}let gt,Jo,Zs=null;const Pn=typeof globalThis<"u"?globalThis:void 0,Ca="__careerdiary_supabase_client__";gt=df();Jo=!!(gt.supabaseUrl&>.supabaseKey);var Ud,Fd;if(typeof window<"u"&&!Jo){const e=window==null?void 0:window.__RUNTIME_CONFIG__;console.error("[Supabase Config Debug]",{hasRuntimeConfig:!!e,runtimeType:typeof e,supabaseEnv:gt.supabaseEnv,supabaseUrl:gt.supabaseUrl||"MISSING",supabaseKey:gt.supabaseKey?"PRESENT ("+gt.supabaseKey.substring(0,20)+"...)":"MISSING",runtimeKeys:e?Object.keys(e).filter(t=>t.includes("SUPABASE")):[],allRuntimeKeys:e?Object.keys(e).slice(0,10):[]}),e&&console.error("[Supabase Runtime Config Values]",{VITE_SUPABASE_ENV:e.VITE_SUPABASE_ENV,VITE_SUPABASE_URL:(Ud=e.VITE_SUPABASE_URL)==null?void 0:Ud.substring(0,50),VITE_SUPABASE_KEY:e.VITE_SUPABASE_KEY?"PRESENT":"MISSING",VITE_SUPABASE_URL_PROD:(Fd=e.VITE_SUPABASE_URL_PROD)==null?void 0:Fd.substring(0,50),VITE_SUPABASE_KEY_PROD:e.VITE_SUPABASE_KEY_PROD?"PRESENT":"MISSING"})}const pf=Jo;Jo?(typeof window<"u"&&console.log("â Supabase client configured successfully",{url:gt.supabaseUrl.substring(0,30)+"...",env:gt.supabaseEnv}),Pn!=null&&Pn[Ca]?Zs=Pn[Ca]:(Zs=Mh(gt.supabaseUrl,gt.supabaseKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),Pn&&(Pn[Ca]=Zs))):typeof window<"u"&&console.warn(`Supabase environment variables (VITE_SUPABASE_URL, VITE_SUPABASE_KEY) are not set. 25The application will run in guest mode. Add these to .env.local for a full experience. 26Authentication features will not work without Supabase configuration.`);const Z=Zs,U1=Object.freeze(Object.defineProperty({__proto__:null,getRuntimeConfig:df,isSupabaseConfigured:pf,supabase:Z},Symbol.toStringTag,{value:"Module"}));var mf=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),F1=()=>typeof navigator<"u"&&navigator.product==="ReactNative",$1=()=>{try{const e=mf("@react-native-async-storage/async-storage");return(e==null?void 0:e.default)??e??null}catch{return null}},B1=()=>{const e=new Map;return{async getItem(t){return e.has(t)?e.get(t):null},async setItem(t,n){e.set(t,n)},async removeItem(t){e.delete(t)},async clear(){e.clear()}}},z1=()=>typeof window>"u"||typeof window.localStorage>"u"?null:{async getItem(e){return window.localStorage.getItem(e)},async setItem(e,t){window.localStorage.setItem(e,t)},async removeItem(e){window.localStorage.removeItem(e)},async clear(){window.localStorage.clear()}},G1=()=>{const e=$1();return e?{getItem:e.getItem.bind(e),setItem:e.setItem.bind(e),removeItem:e.removeItem.bind(e),clear:e.clear.bind(e)}:null},H1=()=>{if(F1()){const t=G1();if(t)return t}const e=z1();return e||B1()},pe=H1(),wc=async e=>{const t=await pe.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return null}},Sc=async(e,t)=>{try{const n=JSON.stringify(t);await pe.setItem(e,n)}catch(n){throw console.error("[platform/storage] Failed to save:",e,n),n}},W1=()=>typeof navigator<"u"&&navigator.product==="ReactNative",J1=()=>{try{const e=mf("expo-document-picker");return(e==null?void 0:e.default)??e??null}catch{return null}},V1=e=>
26e!=null&&e.uri?{uri:e.uri,name:e.name||e.uri.split("/").pop()||"file",type:e.mimeType||"application/octet-stream",size:typeof e.size=="number"?e.size:0}:null,Y1=()=>{if(typeof window>"u"||typeof document>"u")return null;const e=t=>new Promise(n=>{const r=document.createElement("input");r.type="file",r.accept=".pdf,.docx,application/pdf,application/vnd.openxmlformats-officedocument.wordprocessingml.document",r.multiple=t,r.style.display="none";const s=()=>{r.parentNode&&r.parentNode.removeChild(r)};r.onchange=()=>{const o=r.files;if(!o||o.length===0){s(),n(t?[]:null);return}const i=Array.from(o).map(c=>({uri:URL.createObjectURL(c),name:c.name,type:c.type||"application/octet-stream",size:c.size}));s(),n(t?i:i[0]||null)},r.onclick=()=>{setTimeout(()=>{(!r.files||r.files.length===0)&&(s(),n(t?[]:null))},500)},document.body.appendChild(r),r.click()});return{async pickDocument(){return await e(!1)??null},async pickMultipleDocuments(){return await e(!0)??[]}}},q1=()=>{const e=J1();if(!e)return null;const t=async n=>{try{const r=await e.getDocumentAsync({multiple:n,type:["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],copyToCacheDirectory:!0});if(r.type==="cancel")return n?[]:null;const o=(r.assets??[]).map(i=>V1(i)).filter(i=>!!i);return n?o:o[0]?[o[0]]:[]}catch(r){throw r}};return{async pickDocument(){const n=await t(!1);return n&&n.length>0?n[0]:null},async pickMultipleDocuments(){return await t(!0)??[]}}},K1=()=>({async pickDocument(){return null},async pickMultipleDocuments(){return[]}}),X1=()=>{if(W1()){const t=q1();if(t)return t}const e=Y1();return e||K1()};X1();var Z1=()=>{const e=new Map;return{async getItem(t){return e.has(t)?e.get(t):null},async setItem(t,n){e.set(t,n)},async removeItem(t){e.delete(t)},async clear(){e.clear()}}},Q1=()=>typeof window>"u"||typeof window.sessionStorage>"u"?null:{async getItem(e){return window.sessionStorage.getItem(e)},async setItem(e,t){window.sessionStorage.setItem(e,t)},async removeItem(e){window.sessionStorage.removeItem(e)},async clear(){window.sessionStorage.clear()}},eC=()=>{const e=Q1();return e||Z1()},NL=eC(),us={AL:"Alabama",AK:"Alaska",AZ:"Arizona",AR:"Arkansas",CA:"California",CO:"Colorado",CT:"Connecticut",DE:"Delaware",DC:"District of Columbia",FL:"Florida",GA:"Georgia",HI:"Hawaii",ID:"Idaho",IL:"Illinois",IN:"Indiana",IA:"Iowa",KS:"Kansas",KY:"Kentucky",LA:"Louisiana",ME:"Maine",MD:"Maryland",MA:"Massachusetts",MI:"Michigan",MN:"Minnesota",MS:"Mississippi",MO:"Missouri",MT:"Montana",NE:"Nebraska",NV:"Nevada",NH:"New Hampshire",NJ:"New Jersey",NM:"New Mexico",NY:"New York",NC:"North Carolina",ND:"North Dakota",OH:"Ohio",OK:"Oklahoma",OR:"Oregon",PA:"Pennsylvania",RI:"Rhode Island",SC:"South Carolina",SD:"South Dakota",TN:"Tennessee",TX:"Texas",UT:"Utah",VT:"Vermont",VA:"Virginia",WA:"Washington",WV:"West Virginia",WI:"Wisconsin",WY:"Wyoming"},Dr={AD:"Andorra",AE:"United Arab Emirates",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AQ:"Antarctica",AR:"Argentina",AS:"American Samoa",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Aland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthelemy",BM:"Bermuda",BN:"Brunei",BO:"Bolivia",BQ:"Caribbean Netherlands",BR:"Brazil",BS:"Bahamas",BT:"Bhutan",BV:"Bouvet Island",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CC:"Cocos Islands",CD:"Democratic Republic of the Congo",CF:"Central African Republic",CG:"Republic of the Congo",CH:"Switzerland",CI:"Ivory Coast",CK:"Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cabo Verde",CW:"Curacao",CX:"Christmas Island",CY:"Cyprus",CZ:"Czechia",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"Falkland Islands",FM:"Micronesia",FO:"Faroe Islands",FR:"France",GA:"Gabon",GB:"United Kingdom",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GS:"South Georgia and the South Sandwich Islands",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HM:"Heard Island and McDonald Islands",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IL:"Israel",IM:"Isle of Man",IN:"India",IO:"British Indian Ocean Territory",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"
26Cambodia",KI:"Kiribati",KM:"Comoros",KN:"Saint Kitts and Nevis",KP:"North Korea",KR:"South Korea",XK:"Kosovo",KW:"Kuwait",KY:"Cayman Islands",KZ:"Kazakhstan",LA:"Laos",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MF:"Saint Martin",MG:"Madagascar",MH:"Marshall Islands",MK:"North Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MP:"Northern Mariana Islands",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PS:"Palestinian Territory",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Reunion",RO:"Romania",RS:"Serbia",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SS:"South Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",ST:"Sao Tome and Principe",SV:"El Salvador",SX:"Sint Maarten",SY:"Syria",SZ:"Eswatini",TC:"Turks and Caicos Islands",TD:"Chad",TF:"French Southern Territories",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Turkey",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania",UA:"Ukraine",UG:"Uganda",UM:"United States Minor Outlying Islands",US:"United States",UY:"Uruguay",UZ:"Uzbekistan",VA:"Vatican",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"British Virgin Islands",VI:"U.S. Virgin Islands",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"},tC={usa:"US",us:"US","u s":"US","u s a":"US",america:"US","united states of america":"US",uk:"GB","great britain":"GB",britain:"GB",england:"GB",scotland:"GB",wales:"GB","northern ireland":"GB",uae:"AE","the netherlands":"NL",holland:"NL","czech republic":"CZ","russian federation":"RU",korea:"KR","republic of korea":"KR","viet nam":"VN",deutschland:"DE",turkiye:"TR","hong kong sar":"HK","cote d ivoire":"CI","timor leste":"TL","east timor":"TL","dr congo":"CD",drc:"CD",burma:"MM",macau:"MO","cape verde":"CV",swaziland:"SZ","north macedonia":"MK",macedonia:"MK"},nC={ab:"CA",alberta:"CA",bc:"CA","british columbia":"CA",mb:"CA",manitoba:"CA",nb:"CA","new brunswick":"CA",nl:"CA","newfoundland and labrador":"CA",ns:"CA","nova scotia":"CA",nt:"CA","northwest territories":"CA",nu:"CA",nunavut:"CA",on:"CA",ontario:"CA",pe:"CA","prince edward island":"CA",qc:"CA",quebec:"CA",sk:"CA",saskatchewan:"CA",yt:"CA",yukon:"CA",nsw:"AU","new south wales":"AU",vic:"AU",victoria:"AU",qld:"AU",queensland:"AU",tas:"AU",tasmania:"AU",act:"AU","australian capital territory":"AU","western australia":"AU","south australia":"AU","northern territory":"AU"},rC={Ã:"ss",æ:"ae",Å:"oe",ø:"o",Å:"l",Ä:"d",ð:"d",þ:"th",ı:"i"};function ds(e){return e.normalize("NFKD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase().replace(/[ÃæÅøÅÄðþı]/g,t=>rC[t]??t).replace(/[^a-z0-9]+/g," ").trim()}var sC=new Map([...Object.entries(us).flatMap(([e,t])=>[[e.toLowerCase(),e],[ds(t),e]]),["washington dc","DC"],["d c","DC"],["calif","CA"],["mass","MA"],["penn","PA"]]),oC=new Map([...Object.entries(Dr).map(([e,t])=>[ds(t),e]),...Object.entries(tC)]);function Aa(e){return sC.get(ds(e))??null}function Du(e){const t=ds(e),n=oC.get(t);if(n)return n;if(/^[a-z]{2}$/.test(t)){const r=t.toUpperCase();if(Dr[r]&&!us[r])return r}return null}function aC(e,t,n){const r=t.toUpperCase();if(r==="US"){const s=n==null?void 0:n.toUpperCase();return s&&us[s]?`${e}, ${s}`:`${e}, ${Dr.US}`}return`${e}, ${Dr[r]??r}`}var iC=/^(remote|fully remote|100% remote|hybrid|on ?site|onsite|in office|in-office|anywhere|worldwide|global|work from home|wfh|distributed|multiple locations|various locations|flexible)$/i,cC=/\b(remote|anywhere|worldwide|work from home|wfh|distributed)\b/i;function Mu(e){return typeof e=="string"&&cC.test(e)}function Ia(e){const t=e.replace(/\s+/g," ").replace(/^[\s.,]+|[\s.,]+$/g,"").replace(/^greater\s+/i,"").replace(/\s+(?:bay area|metropolitan area|metro area|metroplex|metro|area)$/i,""),n=t.replace(/[^\p{L}]/gu,"");return n&&n!==n.toLowerCase()&&n!==n.toUpperCase()?t:t.toLowerCase().replace(new RegExp("(^|[\\s\\-(/])(\\p{L})","gu"),(r,s,o)=>s+o.toUpperCase())}function lC(e){let t=e.replace(/[([][^)\]]*[)\]]/g," ");return t=t.split(/\s+[-ââ|â¢/]\s+|;/).map(r=>r.trim()).filter(r=>r&&!iC.test(r.replace(/[.:]+$/,"")))[0]??"",t=t.replace(/\b\d{5}
26(?:-\d{4})?\b/g," ").replace(/^\s*(?:remote|hybrid|on-?site)\s*(?:in|from|[:,])\s*/i,"").replace(/,\s*(?:remote|hybrid|on-?site)\s*$/i,"").replace(/\s+/g," ").trim(),t.replace(/^,+|,+$/g,"").trim()}function uC(e){if(typeof e!="string")return null;const t=lC(e.slice(0,300));if(!new RegExp("\\p{L}","u").test(t))return null;const n=t.split(",").map(u=>u.trim()).filter(Boolean);if(n.length===0)return null;if(n.length===1){const u=n[0],d=Aa(u);if(d)return{city:null,admin1Code:d,countryCode:"US"};const p=Du(u);if(p)return{city:null,admin1Code:null,countryCode:p};const m=new RegExp("^(.*\\p{L}.*?)\\s+([A-Za-z]{2})\\.?$","u").exec(u);return m&&us[m[2].toUpperCase()]?{city:Ia(m[1]),admin1Code:m[2].toUpperCase(),countryCode:"US"}:{city:Ia(u),admin1Code:null,countryCode:null}}const r=Ia(n[0]),s=n[n.length-1],o=n.length>=3?n[n.length-2]:null,i=Aa(s);if(i)return{city:r,admin1Code:i,countryCode:"US"};const c=Du(s);if(c==="US"){const u=o?Aa(o):null;return{city:r,admin1Code:u,countryCode:"US"}}if(c)return{city:r,admin1Code:null,countryCode:c};const l=nC[ds(s)];return l?{city:r,admin1Code:null,countryCode:l}:{city:r,admin1Code:null,countryCode:null}}function wr(e){const t=uC(e);if(!t)return null;const{city:n,admin1Code:r,countryCode:s}=t;return n?!s||s==="US"&&!r?null:aC(n,s,r):r?us[r]:s?Dr[s]??null:null}function jL(e){if(typeof e!="string")return[];const t=e.split(",").map(r=>r.trim()).filter(Boolean),n=[];for(let r=0;r<t.length;r+=1){if(!Mu(t[r])){let s=null,o=0;for(const i of[3,2]){if(r+i>t.length)continue;const c=t.slice(r,r+i);if(c.some(u=>Mu(u)))continue;const l=wr(c.join(", "));if(l){s=l,o=i-1;break}}if(s){n.push(s),r+=o;continue}}n.push(wr(t[r])??t[r])}return n}const Ec="careerdiary_pending_signup_intent",vc="careerdiary_pending_referral_code",Tc="careerdiary_pending_campaign_code",ps=()=>{if(!pf||!Z)throw new Error("Supabase is not configured. Please set VITE_SUPABASE_URL and VITE_SUPABASE_KEY in your environment variables.");return Z},Vn=e=>{const t=String(e||"").trim();return t?t.toUpperCase():null},dC=()=>{if(typeof window>"u")return{};const e=new URLSearchParams(window.location.search),t=Vn(e.get("ref")||e.get("referral")||e.get("r")||null),n=Vn(e.get("promo")||e.get("campaign")||null);return{referralCode:t,campaignCode:n}},wi=async(e={})=>{const t=Vn(e.referralCode),n=Vn(e.campaignCode);await pe.setItem(Ec,"true").catch(()=>{}),t&&await pe.setItem(vc,t).catch(()=>{}),n&&await pe.setItem(Tc,n).catch(()=>{})},pC=async()=>{const{referralCode:e,campaignCode:t}=dC();(e||t)&&await wi({referralCode:e,campaignCode:t})},mC=async()=>await pe.getItem(Ec).catch(()=>null)==="true",bo=async()=>{const[e,t]=await Promise.all([pe.getItem(vc).catch(()=>null),pe.getItem(Tc).catch(()=>null)]);return{referralCode:Vn(e),campaignCode:Vn(t)}},fC=async()=>{await Promise.all([pe.removeItem(Ec).catch(()=>{}),pe.removeItem(vc).catch(()=>{}),pe.removeItem(Tc).catch(()=>{})])},ff=async(e,t,n)=>{var s,o,i,c;const r=ps();try{const l=await bo(),{data:u,error:d}=await r.auth.signUp({email:e,password:t,options:{...n?{captchaToken:n}:{},data:{signup_intent:"trial",referral_code:l.referralCode||null,campaign_code:l.campaignCode||null}}});if(d)throw(s=d.message)!=null&&s.includes("fetch")||(o=d.message)!=null&&o.includes("network")||(i=d.message)!=null&&i.includes("Failed to fetch")?new Error("Unable to connect to authentication service. Please check your internet connection and try again."):d;return u}catch(l){throw l instanceof TypeError&&((c=l.message)!=null&&c.includes("fetch"))?new Error("Network error: Unable to connect to authentication service. Please check your internet connection."):l}},LL=async(e,t)=>{const n=ps(),{error:r}=await n.auth.resend({type:"signup",email:e,options:{...t?{captchaToken:t}:{}}});if(r)throw r},hC=async(e,t,n)=>{var s,o,i,c;const r=ps();try{const{data:l,error:u}=await r.auth.signInWithPassword({email:e,password:t,options:{...n?{captchaToken:n}:{}}});if(u)throw(s=u.message)!=null&&s.includes("fetch")||(o=u.message)!=null&&o.includes("network")||(i=u.message)!=null&&i.includes("Failed to fetch")?new Error("Unable to connect to authentication service. Please check your internet connection and try again."):u;return l}catch(l){throw l instanceof TypeError&&((c=l.message)!=null&&c.includes("fetch"))?new Error("Network error: Unable to connect to authentication service. Please check your internet connection."):l}},gC=async()=>
26{if(typeof window<"u"&&typeof sessionStorage<"u")try{sessionStorage.clear()}catch(e){console.warn("Error clearing sessionStorage:",e)}try{if(typeof window<"u"&&typeof window.localStorage<"u"){const e=Object.keys(window.localStorage);await Promise.all(e.filter(t=>t.includes("supabase")||t.includes("auth-token")||t.startsWith("sb-")).map(t=>pe.removeItem(t)))}}catch(e){console.warn("Error clearing storage:",e)}},yC=async()=>{if(await gC(),!Z){console.warn("Supabase client is not configured. Storage cleared.");return}Z.auth.signOut().catch(e=>{})},_C=async()=>{if(!Z)return null;const{data:e,error:t}=await Z.auth.getSession();if(t)throw t;return e.session},zt=async()=>{const e=await _C();return(e==null?void 0:e.user)??null},Cc=async e=>{const t=ps(),n=`${window.location.origin}`,{data:r,error:s}=await t.auth.signInWithOAuth({provider:e,options:{redirectTo:n}});if(s)throw s;return r},hf=async()=>{const e=ps(),t=`${window.location.origin}`,{data:n,error:r}=await e.auth.signInWithOAuth({provider:"apple",options:{redirectTo:t,skipBrowserRedirect:!1}});if(r)throw r;return n},xC=["fairygodboss","vaia","talents","bebee","jobrapido","jooble","learn4good","lensa","snagajob","ziprecruiter"],bC=[/^apply now!?/i,/^apply today!?/i,/^view job!?/i,/^see job!?/i,/^new!?/i],wC=e=>e.toLowerCase().replace(/[ââ-]/g,"-").replace(/\s+/g," ").trim(),SC=[/careers?$/i,/^careers?\b/i,/\bjobs?$/i,/^jobs?\b/i,/job openings?$/i,/hiring$/i],Uu=e=>{const t=wC(e);return t?bC.some(n=>n.test(t))||SC.some(n=>n.test(t))?!0:xC.some(n=>t.includes(n)):!1},Vo=e=>{if(typeof e!="string")return"";let t=e.trim();if(!t)return t;for(;t.includes("|");){const r=t.lastIndexOf("|"),s=t.slice(r+1).trim();if(!s||!Uu(s))break;t=t.slice(0,r).trim()}const n=t.match(/^(.*\S)\s+[ââ-]\s+([^ââ-]+)$/);return n&&Uu(n[2])&&(t=n[1].trim()),t},EC=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Fu=/^[a-z][a-z0-9]*(?:_[a-z0-9]+)+$/,vC=e=>e.replace(/_([a-z0-9])/g,(t,n)=>n.toUpperCase()),Qs=e=>{if(Array.isArray(e))return e.map(Qs);if(!EC(e))return e;const t={};for(const[n,r]of Object.entries(e))Fu.test(n)||(t[n]=Qs(r));for(const[n,r]of Object.entries(e))if(Fu.test(n)){const s=vC(n);s in t||(t[s]=Qs(r))}return t},TC=e=>Qs(e),gf=25,$u="id, user_id, job_title, company_name, job_description, tailored_resume, cover_letter, match_score, match_justification, applied_date, job_posting_id, application_url, job_url, job_location, status, notes, matching_skills, missing_skills, recommendations, tailored_match_score, tailored_match_justification, is_draft, page_count, created_at, updated_at";let Bu=!0;const Mr=e=>e?wv($u):$u,Yo=async e=>{const t=Bu,n=await e(t);return t?_v(n.error)?(Bu=!1,{...await e(!1),optionalColumnsDropped:!0}):{...n,optionalColumnsDropped:!1}:{...n,optionalColumnsDropped:!0}},yf="id, user_id, job_title, company_name, job_description, page_count, tailored_resume, change_summary, original_match_score, tailored_match_score, match_justification, matching_skills, missing_skills, applied_job_id, model_version, generation_latency_ms, created_at",_f="gemini_file_name, display_name, mime_type, size_bytes, created_at, category, supabase_storage_path, thumbnail_url, is_default, file_hash",xf="id, job_id, job_title, company_name, job_source, job_data, notes, tags, status, saved_at, updated_at",Ne=()=>{if(!Z)throw new Error("Supabase client is not configured");return Z},qo=e=>({...e,application_status:e.status||"applied"}),Si=async e=>{const t=Ne(),{data:n,error:r}=await t.from("profiles").select("profile_data, location, zipcode").eq("id",e).maybeSingle();if(r)throw r;return n?{...TC(n.profile_data||{}),location:n.location,zipcode:n.zipcode}:null},Ac=async e=>{const t=await zt();if(!t)return;const n=Ne(),{error:r}=await n.from("profiles").upsert({id:t.id,profile_data:e});if(r)throw r},zu=async e=>{const t=await zt();if(!t)return;const n=Ne(),{error:r}=await n.from("profiles").update({location:e}).eq("id",t.id);if(r)throw r},CC=async e=>{const t=await zt();if(!t)return;const n=Ne(),{error:r}=await n.from("profiles").update({zipcode:e}).eq("id",t.id);if(r)throw r},AC=async e=>{const t=Ne(),{data:n,error:r}=await Yo(s=>t.from("applied_jobs").select(Mr(s)).eq("user_id",e).order("created_at",{ascending:!1}));if(r)throw r;return(n||[]).map(s=>qo(s))},PL=async(e,t=gf,n=0)=>{const r=Ne(),{data:s,error:o}=await Yo(c=>r.from("applied_jobs").select(Mr(c)).eq("user_id",e).order("created_at",{ascending:!1}).range(n,n+t));if(o)throw o;const i=(s||[]).map(c=>qo(c));return{jobs:i.slice(0,t),hasMore:i.length>t}},bf=async e=>{const t=await zt();if(!t)return null;const n=Ne(),{application_status:r,...s}=e,o=Vo(s.job_title),{data:i,error:c}=await Yo(l=>n.from("applied_jobs").insert({user_id:t.id,...s,job_url:s.job_url||s.application_url||null,job_title:o,...r?{status:r}:{}}).select(Mr(l)).single());if(c)throw c;return i&&qo(i)}
26,OL=async(e,t)=>{const n=await zt();if(!n)throw new Error("User must be authenticated");const r=Ne(),{application_status:s,...o}=t,i=xv({...o,...s?{status:s}:{}}),{data:c,error:l,optionalColumnsDropped:u}=await Yo(p=>{const m=p?i:bv(i,ho),g=r.from("applied_jobs");return Object.keys(m).length===0?g.select(Mr(p)).eq("user_id",n.id).eq("id",e).single():g.update(m).eq("user_id",n.id).eq("id",e).select(Mr(p)).single()});if(l)throw l;if(!c)return c;const d=u?ho.filter(p=>p in i):[];return{...qo(c),unsaved_fields:d}},Gu=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[],wf=e=>({id:String(e.id||""),user_id:String(e.user_id||""),job_title:String(e.job_title||""),company_name:String(e.company_name||""),job_description:String(e.job_description||""),page_count:Number(e.page_count||0),tailored_resume:String(e.tailored_resume||""),change_summary:typeof e.change_summary=="string"?e.change_summary:null,original_match_score:typeof e.original_match_score=="number"?e.original_match_score:null,tailored_match_score:typeof e.tailored_match_score=="number"?e.tailored_match_score:null,match_justification:typeof e.match_justification=="string"?e.match_justification:null,matching_skills:Gu(e.matching_skills),missing_skills:Gu(e.missing_skills),applied_job_id:typeof e.applied_job_id=="string"?e.applied_job_id:null,model_version:typeof e.model_version=="string"?e.model_version:null,generation_latency_ms:typeof e.generation_latency_ms=="number"?e.generation_latency_ms:null,created_at:String(e.created_at||"")}),DL=async e=>{const t=Ne(),{data:n,error:r}=await t.from("tailored_resumes").select(yf).eq("user_id",e).order("created_at",{ascending:!1});if(r)throw r;return(Array.isArray(n)?n:[]).map(wf)},ML=async(e,t=gf,n=0)=>{const r=Ne(),{data:s,error:o}=await r.from("tailored_resumes").select(yf).eq("user_id",e).order("created_at",{ascending:!1}).range(n,n+t);if(o)throw o;const i=Array.isArray(s)?s:[];return{resumes:i.map(wf).slice(0,t),hasMore:i.length>t}},IC=async(e,t)=>{const n=await zt();if(!n)throw new Error("User must be authenticated");const r=Ne(),{error:s}=await r.from("tailored_resumes").update({applied_job_id:t}).eq("user_id",n.id).eq("id",e);if(s)throw s},RC=async(e,t)=>{var o;const n=Ne(),{data:r,error:s}=await n.from("corpus_files").insert({user_id:e,gemini_file_name:t.name,display_name:t.displayName,mime_type:t.mimeType,size_bytes:t.sizeBytes,category:t.category,supabase_storage_path:t.supabaseStoragePath,thumbnail_url:t.thumbnailUrl,file_hash:t.fileHash,is_default:!1,extracted_text:t.extractedText??null}).select(_f).single();if(s)throw s;return{name:r.gemini_file_name,displayName:r.display_name,createTime:r.created_at,sizeBytes:(o=r.size_bytes)==null?void 0:o.toString(),mimeType:r.mime_type,category:r.category,supabaseStoragePath:r.supabase_storage_path,thumbnailUrl:r.thumbnail_url,isDefault:r.is_default||!1,fileHash:r.file_hash,extractedText:t.extractedText}},kC=async e=>{const t=Ne(),{data:n,error:r}=await t.from("corpus_files").select("extracted_text").eq("user_id",e).eq("category","resumes").order("is_default",{ascending:!1}).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(r)throw r;const s=n==null?void 0:n.extracted_text;return typeof s=="string"&&s.trim().length>0?s:null},NC=async e=>{const t=Ne(),{data:n,error:r}=await t.from("corpus_files").select(_f).eq("user_id",e).order("is_default",{ascending:!1}).order("created_at",{ascending:!1});if(r)throw r;return(n||[]).map(s=>{var o;return{name:s.gemini_file_name,displayName:s.display_name,createTime:s.created_at,sizeBytes:(o=s.size_bytes)==null?void 0:o.toString(),mimeType:s.mime_type,category:s.category,supabaseStoragePath:s.supabase_storage_path,thumbnailUrl:s.thumbnail_url,isDefault:s.is_default||!1,fileHash:s.file_hash}})},jC=async(e,t)=>{const n=Ne(),{error:r}=await n.from("corpus_files").delete().eq("user_id",e).eq("gemini_file_name",t);if(r)throw r},LC=async e=>{const t=Ne(),{data:n,error:r}=await t.from("corpus_files").select("category").eq("gemini_file_name",e).maybeSingle();if(r)throw r;if(!n)throw new Error("File not found");const s=n.category,{error:o}=await t.from("corpus_files").update({is_default:!1}).eq("category",s);if(o)throw o;const{error:i}=await t.from("corpus_files").update({is_default:!0}).eq("gemini_file_name",e);if(i)throw i},PC=async e=>{console.log("[databaseService] getSavedJobs called with userId:",e);const t=Ne(),{data:n,error:r}=await t.from("saved_jobs").select(xf).eq("user_id",e).order("saved_at",{ascending:!1});if(r)throw console.error("[databaseService] getSavedJobs error:",r),r;return console.log("[databaseService] getSavedJobs returning:",(n==null?void 0:n.length)||0,"jobs",n),n||[]},OC=async e=>{const t=await zt();if(!t)throw new Error("User must be authenticated");console.log("[databaseService] saveJob called - userId:",t.id,"jobId:",e.job_id);const n=Ne(),r=Vo(e.job_title),{data:s,error:o}=await n.from("saved_jobs").upsert({user_id:t.id,...e,job_title:r,job_data:e.job_data&&typeof e.job_data=="object"?{...e.job_data,title:r}:e.job_data},{onConflict:"user_id,job_id"}).select(xf).single();if(o)throw console.error("[databaseService] saveJob error:",o),o;return console.log("[databaseService] saveJob success - returned data:",s),s},UL=async e=>{const t=await zt();if(!t)throw new Error("User must be authenticated");const n=Ne(),{error:r}=await n.from("saved_jobs").delete().eq("user_id",t.id).eq("job_id",e);if(r)throw r},FL=async e=>{const t=await zt();if(!t)return!1;const n=Ne(),{error:r}=await n.from("application_status_history").insert({user_id:t.id,applied_job_id:e.appliedJobId,from_status:e.fromStatus,to_status:e.toStatus,changed_at:e.changedAt||new Date().toISOString()});if(r&&r.code!=="23505")throw r;return!0},Ic="resumeTailorProfile",Rc="resumeTailorAppliedJobs",kc="resumeTailorLocation",Nc="resumeTailorZipcode",jc="resumeTailorSavedJobs",Sf=async e=>{try{await Sc(Ic,e)}catch(t){console.error("[storageService] Could not save profile to storage",t)}},Ei=async()=>{try{return await wc(Ic)}catch(e){return console.error("[storageService] Could not load profile from storage",e),null}},DC=async()=>{try{await pe.removeItem(Ic)}catch(e){console.error("Could not clear profile from storage",e)}},MC=async e=>{try{await Sc(Rc,e)}catch(t){console.error("Could not save applied jobs to storage",t)}},Ef=async()=>{try{return await wc(Rc)??[]}catch(e){return console.error("Could not load applied jobs from storage",e),[]}},UC=async()=>{try{await pe.removeItem(Rc)}catch(e){console.error("Could not clear applied jobs from storage",e)}},Hu=async e=>{try{await pe.setItem(kc,e)}catch(t){console.error("Could not save location to storage",t)}},FC=async()=>{try{return await pe.getItem(kc)}catch(e){return console.error("Could not load location from storage",e),null}},vf=async()=>{try{await pe.removeItem(kc)}catch(e){console.error("Could not clear location from storage",e)}},$C=async e=>{try{await pe.setItem(Nc,e)}catch(t){console.error("Could not save zipcode to storage",t)}},BC=async()=>{try{return await pe.getItem(Nc)}catch(e){return console.error("Could not load zipcode from storage",e),null}},Tf=async()=>{try{await pe.removeItem(Nc)}catch(e){console.error("Could not clear zipcode from storage",e)}},Lc="cd_tailor_session",zC=e=>
26{try{sessionStorage.setItem(Lc,JSON.stringify({...e,_savedAt:Date.now()}))}catch(t){console.warn("[storageService] Could not save tailoring session",t)}},GC=()=>{try{const e=sessionStorage.getItem(Lc);return e?JSON.parse(e):null}catch{return null}},HC=()=>{try{sessionStorage.removeItem(Lc)}catch{}},WC=async e=>{try{await Sc(jc,e)}catch(t){console.error("Could not save saved jobs to storage",t)}},Cf=async()=>{try{return await wc(jc)??[]}catch(e){return console.error("Could not load saved jobs from storage",e),[]}},JC=async()=>{try{await pe.removeItem(jc)}catch(e){console.error("Could not clear saved jobs from storage",e)}},Wu=new Set,Af="__CD_AuthContext__",Pc=globalThis[Af]??f.createContext(void 0);globalThis[Af]=Pc;const VC=({children:e})=>{const[t,n]=f.useState(null),[r,s]=f.useState(!1),[o,i]=f.useState(!0);f.useEffect(()=>{Jt.init()},[]),f.useEffect(()=>{var b;t!=null&&t.user&&Jt.identify(t.user.id,{email:t.user.email,created_at:t.user.created_at,provider:(b=t.user.app_metadata)==null?void 0:b.provider})},[t]);const c=f.useCallback(b=>{var w,E,T;if(!b)return!1;const x=!!Object.values(b.contactDetails||{}).find(Boolean);return!!(b.fullName&&b.fullName.trim()||b.summary&&b.summary.trim()||b.contactInfo&&b.contactInfo.trim()||b.location&&String(b.location).trim()||b.zipcode&&String(b.zipcode).trim()||x||(((w=b.experience)==null?void 0:w.length)||0)>0||(((E=b.education)==null?void 0:E.length)||0)>0||(((T=b.skills)==null?void 0:T.length)||0)>0)},[]),l=f.useCallback(async()=>{await Promise.all([pe.removeItem("careerdiary_is_guest").catch(()=>{}),DC().catch(()=>{}),UC().catch(()=>{}),JC().catch(()=>{}),vf().catch(()=>{}),Tf().catch(()=>{})])},[]),u=f.useCallback((b,x)=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("careerdiary:toast",{detail:{type:"success",message:b,description:x}}))},[]),d=f.useCallback(async b=>{var x;if((x=b==null?void 0:b.user)!=null&&x.id&&!Wu.has(b.user.id)){Wu.add(b.user.id);try{const[w,E]=await Promise.all([mC(),bo()]),T=b.user.user_metadata||{},C=E.referralCode||String(T.referral_code||T.referralCode||"").trim()||null,S=E.campaignCode||String(T.campaign_code||T.campaignCode||"").trim()||null;if(!(w||T.signup_intent==="trial"||!!C||!!S))return;const R=b.access_token;if(!R)return;const N=await fetch("/api/growth/trial/activate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${R}`},body:JSON.stringify({referralCode:C,campaignCode:S,claimantEmail:b.user.email,claimantName:T.full_name||T.name||null,source:"auth-context"})});if(!N.ok)throw new Error(`Trial activation failed (${N.status})`);await fC()}catch(w){console.warn("[AuthContext] Trial activation failed:",w)}}},[]),p=f.useCallback(async b=>{for(let w=0;w<=2;w++)try{if(await pe.getItem("careerdiary_is_guest").catch(()=>null)!=="true")return;const[T,C,S,A]=await Promise.all([Ei().catch(()=>null),Si(b).catch(()=>null),Ef().catch(()=>
26[]),Cf().catch(()=>[])]),R=c(T),N=c(C);let O=!1;R&&T&&(N||(await Ac(T),O=!0));for(const k of S)try{await bf({job_title:k.jobTitle||k.job_title||"Untitled",company_name:k.companyName||k.company_name||"Unknown",job_description:k.jobDescription||k.job_description||"",tailored_resume:k.tailoredResume||k.tailored_resume||"",cover_letter:k.coverLetter||k.cover_letter||"",match_score:k.matchScore??k.match_score??null,match_justification:k.matchJustification||k.match_justification||"",application_status:k.applicationStatus||k.application_status||k.status||"applied"})}catch($){console.warn("[AuthContext] Failed to merge applied job:",$)}for(const k of A)try{await OC({job_id:k.jobId||k.job_id||`guest_${Date.now()}_${Math.random().toString(36).slice(2)}`,job_title:k.jobTitle||k.title||k.job_title||"Untitled",company_name:k.companyName||k.company||k.company_name||"Unknown",job_source:k.jobSource||k.source||k.job_source||"guest",job_data:k.jobData||k.job_data||k})}catch($){console.warn("[AuthContext] Failed to merge saved job:",$)}await l(),(O||S.length>0||A.length>0)&&(u("Your career data has been saved to your account!"),nr("guest_data_merged",{hadProfile:R,appliedJobs:S.length,savedJobs:A.length}));return}catch(E){console.warn(`[AuthContext] Guest merge attempt ${w+1} failed:`,E),w===2&&console.error("[AuthContext] Guest merge failed after retries â guest data preserved for next login")}},[l,u,c]);f.useEffect(()=>{let b=!0;return(async()=>{try{const x=await pe.getItem("careerdiary_is_guest");b&&x==="true"&&s(!0)}catch{}})(),()=>{b=!1}},[]),f.useEffect(()=>{if(!Z){i(!1);return}const b=Z;let x=!0;const w=async()=>{await pC();const C=new URL(window.location.href),S=C.searchParams.get("code"),A=new URLSearchParams(window.location.hash.replace(/^#/,"")),R=A.get("access_token"),N=A.get("refresh_token");try{if(S){const{data:O,error:k}=await b.auth.exchangeCodeForSession(S);k?console.warn("OAuth code exchange failed:",k.message):O.session&&x&&(n(O.session),s(!1)),C.searchParams.delete("code"),C.searchParams.delete("state"),window.history.replaceState({},document.title,C.pathname+C.search)}else if(R&&N){const{data:O,error:k}=await b.auth.setSession({access_token:R,refresh_token:N});k?console.warn("Implicit OAuth session set failed:",k.message):O.session&&x&&(n(O.session),s(!1)),window.history.replaceState({},document.title,C.pathname+C.search)}}catch(O){console.warn("OAuth handling error:",O)}};(async()=>{await w();try{const{data:{session:C},error:S}=await b.auth.getSession();if(!x)return;if(S){console.warn("Failed to get session:",S.message),i(!1);return}if(n(C),C)s(!1),pe.removeItem("careerdiary_is_guest").catch(()=>{}),d(C);else try{const A=await pe.getItem("careerdiary_is_guest");x&&A==="true"&&s(!0)}catch{}}catch(C){if(!x)return;console.error("Error getting session:",C)}finally{x&&i(!1)}})();const{data:{subscription:T}}=Z.auth.onAuthStateChange(async(C,S)=>{x&&(n(S),S&&(s(!1),C==="SIGNED_IN"?(await p(S.user.id),d(S)):pe.removeItem("careerdiary_is_guest").catch(()=>{})),i(!1))});return()=>{x=!1,T.unsubscribe()}},[]);const m=f.useCallback(async()=>{await Cc("google")},[]),g=f.useCallback(async()=>{try{Jt.track("logout"),Jt.reset(),await yC(),n(null),s(!1),pe.removeItem("careerdiary_is_guest").catch(()=>{}),window.location.href="/"}catch(b){console.error("Error signing out:",b),Jt.reset(),n(null),s(!1),pe.removeItem("careerdiary_is_guest").catch(()=>{}),window.location.href="/"}},[]),_=f.useCallback(async()=>{s(!0);try{await pe.setItem("careerdiary_is_guest","true")}catch(b){console.warn("Failed to save guest state to storage:",b)}},[]),h=f.useCallback(b=>{n(b)},[]),y={session:t,isGuest:r,isAuthLoading:o,signInWithGoogle:m,signOut:g,continueAsGuest:_,setSession:h};return a.jsx(Pc.Provider,{value:y,children:e})},Qe=()=>{const e=f.useContext(Pc);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e},Oc="cd_guest_activity",Sr={name:"",email:"",resumeUploaded:!1,tailorCount:0,jobsViewed:0,lastTailorScore:null,lastTailorJobTitle:null},wo=new Set;let hn=null;const If=()=>{if(hn)return hn;try{const e=sessionStorage.getItem(Oc);hn=e?{...Sr,...JSON.parse(e)}:{...Sr}}catch{hn={...Sr}}return hn},Rf=()=>({...If()}),vi=e=>{const t={...If(),...e};hn=t;try{sessionStorage.setItem(Oc,JSON.stringify(t))}catch{}
26return wo.forEach(n=>n({...t})),t},YC=e=>(wo.add(e),()=>{wo.delete(e)}),qC=()=>{hn={...Sr};try{sessionStorage.removeItem(Oc)}catch{}wo.forEach(e=>e({...Sr}))},Ju=e=>{var r;const t=typeof e.lastTailorScore=="number"&&e.lastTailorScore>0,n=(r=e.lastTailorJobTitle)==null?void 0:r.trim();return t&&n?`You just tailored a resume for ${n} â ${e.lastTailorScore}% match.`:t?`You just tailored a resume â ${e.lastTailorScore}% match.`:e.tailorCount===1?"You just tailored a resume.":e.tailorCount>1?`You've tailored ${e.tailorCount} resumes this session.`:e.resumeUploaded?"You just uploaded your resume.":null},kf="cd_nudge_dismissals",Nf="cd_nudge_last_shown",Vu="cd_first_visit",KC=1800*1e3,jf=10080*60*1e3,XC=2,So={return_visit:10080*60*1e3},Lf="__CD_GuestNudgeContext__",Dc=globalThis[Lf]??f.createContext(void 0);globalThis[Lf]=Dc;function Yu(){try{const e=localStorage.getItem(kf);return e?JSON.parse(e):{}}catch{return{}}}function Pf(){try{const e=localStorage.getItem(Nf);return e?JSON.parse(e):{}}catch{return{}}}function ZC(e){if(So[e])try{const n=Date.now(),r=Pf();r[e]=n;const s={};for(const[o,i]of Object.entries(r)){const c=So[o];c&&n-i<c&&(s[o]=i)}localStorage.setItem(Nf,JSON.stringify(s))}catch{}}function QC(e){try{const t=Date.now(),n={};for(const[r,s]of Object.entries(e))t-s<jf&&(n[r]=s);localStorage.setItem(kf,JSON.stringify(n))}catch{}}const eA=({children:e})=>{const{isGuest:t,session:n}=Qe(),r=!!n,s=f.useRef(new Set),[o,i]=f.useState(0),[c,l]=f.useState(()=>Rf());f.useEffect(()=>YC(l),[]),f.useEffect(()=>{n&&qC()},[n]);const[u,d]=f.useState(!1),[p,m]=f.useState(!1),[g,_]=f.useState({});f.useEffect(()=>{try{const S=localStorage.getItem(Vu);if(S){const A=Number.parseInt(S,10),R=!Number.isFinite(A)||Date.now()-A>=KC;d(R)}else localStorage.setItem(Vu,Date.now().toString())}catch{}},[]);const h=f.useCallback(S=>{if(r&&!t||s.current.has(S))return!1;const R=Yu()[S];if(R&&Date.now()-R<jf)return!1;const N=So[S];if(N){const O=Pf()[S];return!(O&&Date.now()-O<N)}return o<XC},[r,t,o]),y=f.useCallback(S=>{s.current.has(S)||(s.current.add(S),ZC(S),So[S]||i(A=>A+1))},[]),b=f.useCallback(S=>{const A=Yu();A[S]=Date.now(),QC(A)},[]),x=f.useCallback(()=>c,[c]),w=f.useCallback(S=>{vi(S)},[]),E=f.useCallback((S={})=>{_(S),m(!0)},[]),T=f.useCallback(()=>{m(!1),_({})},[]),C={canShowNudge:h,recordNudgeShown:y,dismissNudge:b,getGuestData:x,updateGuestData:w,nudgesShownThisSession:o,isReturnVisit:u,slidePanelOpen:p,openSlidePanel:E,closeSlidePanel:T,slidePanelOptions:g};return a.jsx(Dc.Provider,{value:C,children:e})},on=()=>{const e=f.useContext(Dc);if(e===void 0)throw new Error("useGuestNudge must be used within a GuestNudgeProvider");return e},tA=({className:e})=>a.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 10-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 002.25-2.25v-6.75a2.25 2.25 0 00-2.25-2.25H6.75a2.25 2.25 0 00-2.25 2.25v6.75a2.25 2.25 0 002.25 2.25z"})}),nA=({featureName:e,description:t,bullets:n,triggerId:r,contextMessage:s})=>{const{openSlidePanel:o}=on(),i=f.useRef(!1);f.useEffect(()=>{i.current||(i.current=!0,te("nudge_shown",{triggerId:r,nudgeType:"account_gate",featureName:e}))},[r,e]);const c=()=>{te("nudge_cta_clicked",{triggerId:r,nudgeType:"account_gate",ctaLabel:"Create free account",featureName:e}),o({contextMessage:s??`Create a free account to use ${e} â your guest work carries over.`,triggerId:r})};return a.jsx("div",{className:"mx-auto w-full max-w-md py-10",children:a.jsxs("div",{className:"rounded-2xl border border-blue-200 dark:border-blue-800/50 bg-white/95 dark:bg-slate-900/95 p-8 text-center shadow-xl",children:[a.jsx("div",{className:"mx-auto mb-3 flex h-12 w-12 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/40","aria-hidden":"true",children:a.jsx(tA,{className:"h-6 w-6 text-[var(--color-accent)]"})}),a.jsxs("h2",{className:"text-lg font-bold text-gray-900 dark:text-white mb-2",children:[e," needs a free account"]}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-300 mb-4",children:t}),n&&n.length>0&&a.jsx("ul",{className:"mb-5 space-y-1.5 text-left text-sm text-gray-600 dark:text-slate-300",children:n.map(l=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"mt-0.5 text-[var(--color-accent)]","aria-hidden":"true",children:"â"}),a.jsx("span",{children:l})]},l))}),a.jsx("button",{type:"button",onClick:c,className:"w-full rounded-xl bg-blue-600 px-4 py-3 text-sm font-semibold text-white hover:bg-blue-700 transition-colors shadow-sm",children:"Create free account â"}),a.jsx("p",{className:"mt-3 text-xs text-gray-400 dark:text-slate-400",children:"Takes 30 seconds â everything you've done as a guest carries over."})]})})},Re=({children:e,allowGuest:t=!1,gateFeatureName:n,gateDescription:r})=>{const{session:s,isGuest:o,isAuthLoading:i}=Qe(),c=We();if(i)return a.jsx("div",{className:"min-h-screen min-h-dvh bg-gray-50 dark:bg-slate-900 flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"}),a.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading..."})]})});if(!!!(s||t&&o)){if(o){const u=n??"This feature";return a.jsx(nA,{featureName:u,description:r??`${u} is tied to your account so your work is saved and synced across devices.`,triggerId:`account_gate_${c.pathname.replace(/^\/app\//,"").replace(/[^a-z0-9]+/gi,"_")}`})}return a.jsx(Pe,{to:"/",state:{from:c},replace:!0})}return a.jsx(a.Fragment,{children:e})},Ko=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),rA=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"})}),sA=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3"})}),oA=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})}),$L=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a2.25 2.25 0 01-2.25 2.25h-1a2.25 2.25 0 01-2.25-2.25v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184"})}),BL=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),qu=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25v8.25A2.25 2.25 0 0118 20.25h-8.25A2.25 2.25 0 017.5 18v-2.25m8.25-8.25h-6.75"})}),zL=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0011.667 0l3.181-3.183m-4.991-2.696a8.25 8.25 0 00-11.667 0l-3.181 3.183"})}
26),Mc=({className:e="h-12 w-12 text-blue-600 dark:text-blue-400"})=>a.jsxs("svg",{className:`animate-spin transition-colors ${e}`,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-20",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),GL=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})}),St=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456zM16.898 20.553L16.5 21.75l-.398-1.197a3.375 3.375 0 00-2.456-2.456L12.75 18l1.197-.398a3.375 3.375 0 002.456-2.456L16.5 14.25l.398 1.197a3.375 3.375 0 002.456 2.456L20.25 18l-1.197.398a3.375 3.375 0 00-2.456 2.456z"})}),HL=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 10.5L12 3m0 0l7.5 7.5M12 3v18"})}),WL=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 13.5L12 21m0 0l-7.5-7.5M12 21V3"})}),Eo=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z"})}),JL=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L6.832 19.82a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.863 4.487zm0 0L19.5 7.125"})}),VL=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244"})}),YL=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"})}),eo=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),Of=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 9.75l4.5 4.5m0-4.5l-4.5 4.5M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),Xo=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25z"})}),qL=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})}),Ur=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"})}),KL=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"})}),Uc=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75"})}),aA=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})}),XL=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 15.75l7.5-7.5 7.5 7.5"})}),ZL=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})}),iA=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 4.5v15m6-15v15m-10.875 0h15.75c.621 0 1.125-.504 1.125-1.125V5.625c0-.621-.504-1.125-1.125-1.125H4.125C3.504 4.5 3 5.004 3 5.625v12.75c0 .621.504 1.125 1.125 1.125z"})}),Ra=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 10-9 0V10.5M6.75 10.5h10.5a1.5 1.5 0 011.5 1.5v6a1.5 1.5 0 01-1.5 1.5H6.75a1.5 1.5 0 01-1.5-1.5v-6a1.5 1.5 0 011.5-1.5z"})}),Df=({className:e})=>a.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),a.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),a.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l3.66-2.84z",fill:"#FBBC05"}),a.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),ms=({className:e})=>
26a.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z"})}),Mf=({className:e})=>a.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:a.jsx("path",{d:"M16.365 1.43c0 1.14-.493 2.27-1.177 3.08-.744.9-1.99 1.57-2.987 1.57-.12 0-.23-.02-.3-.03-.01-.06-.04-.22-.04-.39 0-1.15.572-2.27 1.206-2.98.804-.94 2.142-1.64 3.248-1.68.03.13.05.28.05.43zm4.565 15.71c-.03.07-.463 1.58-1.518 3.12-.945 1.34-1.94 2.71-3.43 2.71-1.517 0-1.9-.88-3.63-.88-1.698 0-2.302.91-3.67.91-1.377 0-2.332-1.26-3.428-2.8-1.287-1.82-2.323-4.63-2.323-7.28 0-4.28 2.797-6.55 5.552-6.55 1.448 0 2.675.95 3.6.95.865 0 2.222-1.01 3.902-1.01.613 0 2.886.06 4.374 2.19-.13.09-2.383 1.37-2.383 4.19 0 3.26 2.854 4.42 2.955 4.46z"})}),Ku=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})}),cA=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"})}),Xu=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z"})}),Zu=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.752 15.002A9.718 9.718 0 0118 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 003 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 009.002-5.998z"})}),Qu=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25A2.25 2.25 0 015.25 3h13.5A2.25 2.25 0 0121 5.25z"})}),QL=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})}),eP=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zM4 19.235v-.11a6.375 6.375 0 0112.75 0v.109A12.318 12.318 0 0110.5 21h-5A12.318 12.318 0 014 19.235z"})}),Fc=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6-2.292m0 0v14.25"})}),tP=({className:e})=>a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),lA=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),nP=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})}),rP=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),sP=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 01-.657.643 48.39 48.39 0 01-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 01-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 00-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 01-.642 5.
26056c1.518.19 3.058.309 4.616.354a.64.64 0 00.657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 01-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 005.427-.63 48.05 48.05 0 00.582-4.717.532.532 0 00-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 00.658-.663 48.422 48.422 0 00-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 01-.61-.58v0z"})}),oP=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 16.5V9.75m0 0l3 3m-3-3l-3 3M6.75 19.5a4.5 4.5 0 01-1.41-8.775 5.25 5.25 0 0110.233-2.33 3 3 0 013.758 3.848A3.752 3.752 0 0118 19.5H6.75z"})}),uA=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 1.5H8.25A2.25 2.25 0 006 3.75v16.5a2.25 2.25 0 002.25 2.25h7.5A2.25 2.25 0 0018 20.25V3.75a2.25 2.25 0 00-2.25-2.25H13.5m-3 0V3h3V1.5m-3 0h3m-3 18.75h3"})}),$c=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418"})}),aP=({className:e})=>a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 11-6 0 3 3 0 016 0z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1115 0z"})]}),iP=({className:e})=>a.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})}),cP=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"})}),lP=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zM3.75 12h.007v.008H3.75V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm-.375 5.25h.007v.008H3.75v-.008zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})}),Uf=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 14.15v4.25c0 1.094-.787 2.036-1.872 2.18-2.087.277-4.216.42-6.378.42s-4.291-.143-6.378-.42c-1.085-.144-1.872-1.086-1.872-2.18v-4.25m16.5 0a2.18 2.18 0 00.75-1.661V8.706c0-1.081-.768-2.015-1.837-2.175a48.114 48.114 0 00-3.413-.387m4.5 8.006c-.194.165-.42.295-.673.38A23.978 23.978 0 0112 15.75c-2.648 0-5.195-.429-7.577-1.22a2.016 2.016 0 01-.673-.38m0 0A2.18 2.18 0 013 12.489V8.706c0-1.081.768-2.015 1.837-2.175a48.111 48.111 0 013.413-.387m7.5 0V5.25A2.25 2.25 0 0013.5 3h-3a2.25 2.25 0 00-2.25 2.25v.894m7.5 0a48.667 48.667 0 00-7.5 0M12 12.75h.008v.008H12v-.008z"})}),uP=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 21h16.5M4.5 3h15M5.25 3v18m13.5-18v18M9 6.75h1.5M12 6.75h1.5M15 6.75h1.5M9 9.75h1.5M12 9.75h1.5M15 9.75h1.5M9 12.75h1.5M12 12.75h1.5M15 12.75h1.5M9 15.75h1.5M12 15.75h1.5M15 15.75h1.5M9 18.75h1.5M12 18.75h1.5M15 18.75h1.5"})}),dP=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"})}),pP=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18v-5.25m0 0a6.01 6.01 0 001.5-.189m-1.5.189a6.01 6.01 0 01-1.5-.189m3.75 7.478a12.06 12.06 0 01-4.5 0m4.5 0a12.05 12.05 0 003.478-.397M15.75 18.75a12.05 12.05 0 003.478-.397m0 0a12.05 12.05 0 01-3.478-.397M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}
26),dA=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z"})}),mP=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.26 10.147a60.436 60.436 0 00-.491 6.347A48.627 48.627 0 0112 20.904a48.627 48.627 0 018.232-4.41 60.46 60.46 0 00-.491-6.347m-15.482 0a50.57 50.57 0 00-2.658-.813A59.905 59.905 0 0112 3.493a59.902 59.902 0 0110.399 5.84c-.896.248-1.783.52-2.658.814m-15.482 0A50.697 50.697 0 0112 13.489a50.702 50.702 0 017.74-3.342M6.75 15a.75.75 0 100-1.5.75.75 0 000 1.5zm0 0v-3.675A55.378 55.378 0 0112 8.443a55.381 55.381 0 015.25 2.882v3.675m0 0a.75.75 0 10.75.75h-.008a.75.75 0 00-.75-.75zm-7.5 0a.75.75 0 10.75.75h-.008a.75.75 0 00-.75-.75z"})}),fP=({className:e,filled:t=!1})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:t?"currentColor":"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.593 3.322c1.1.128 1.907 1.077 1.907 2.185V21L12 17.25 4.5 21V5.507c0-1.108.806-2.057 1.907-2.185a48.507 48.507 0 0111.186 0z"})}),hP=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5"})}),gP=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 18L9 11.25l4.306 4.307a11.95 11.95 0 015.814-5.519l2.74-1.22m0 0l-5.94-2.28m5.94 2.28l-2.28 5.94"})}),pA=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607zM10.5 7.5v6m3-3h-6"})}),Ti=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 013 19.875v-6.75zM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V8.625zM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V4.125z"})}),yP=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"})}),_P=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})}),xP=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})}),Ci=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 6.75V15m6-10.5v.75M15 11.25v3M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5"})}),bP=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:e,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.217 10.9
2607a2.25 2.25 0 1 0 0 2.186m0-2.186c.18.324.283.696.283 1.093s-.103.77-.283 1.093m0-2.186 9.566-5.314m-9.566 7.5 9.566 5.314m0 0a2.25 2.25 0 1 0 3.935 2.186 2.25 2.25 0 0 0-3.935-2.186Zm0-12.814a2.25 2.25 0 1 0 3.933-2.185 2.25 2.25 0 0 0-3.933 2.185Z"})}),ue=M.forwardRef(({variant:e="primary",size:t="md",loading:n=!1,leftIcon:r,rightIcon:s,children:o,className:i="",disabled:c,as:l="button",...u},d)=>{const p="inline-flex items-center justify-center font-semibold transition-all focus:outline-none focus:ring-2 focus:ring-offset-2",m={primary:"iconic-btn-primary text-white focus:ring-[var(--color-accent)]",secondary:"bg-[var(--bg-secondary)] border border-[var(--border-default)] text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)] focus:ring-[var(--color-accent)]",danger:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500",ghost:"text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] focus:ring-[var(--color-accent)]",outline:"bg-transparent border border-[var(--border-default)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] focus:ring-[var(--color-accent)]"},g={sm:"px-3 py-2 text-sm rounded-md",md:"px-4 py-2 text-sm rounded-md",lg:"px-6 py-3 text-base rounded-md"};return a.jsxs(l,{ref:d,className:`${p} ${m[e]} ${g[t]} ${i} ${c||n?"opacity-60 cursor-not-allowed":""}`,disabled:c||n,...u,children:[n&&a.jsx(Mc,{className:"mr-2 h-4 w-4"}),r&&a.jsx("span",{className:"mr-2",children:r}),o,s&&a.jsx("span",{className:"ml-2",children:s})]})});ue.displayName="Button";class F extends f.Component{constructor(n){super(n);Le(this,"handleReset",()=>{this.setState({hasError:!1,error:void 0,errorInfo:void 0})});this.state={hasError:!1}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){var o,i,c,l,u;console.error("Error Boundary caught an error:",n,r),this.setState({errorInfo:r}),(i=(o=this.props).onError)==null||i.call(o,n,r),(n.name==="ChunkLoadError"||(c=n.message)!=null&&c.includes("Failed to fetch dynamically imported module")||(l=n.message)!=null&&l.includes("Loading chunk")||(u=n.message)!=null&&u.includes("Importing a module script failed"))&&!sessionStorage.getItem("cd_chunk_reload_attempted")&&(sessionStorage.setItem("cd_chunk_reload_attempted","1"),window.location.reload())}render(){return this.state.hasError?this.props.fallback?this.props.fallback:a.jsxs("div",{style:{padding:"2rem",textAlign:"center",backgroundColor:"#f8f9fa",borderRadius:"8px",border:"1px solid #dee2e6",margin:"1rem"},children:[a.jsx("h2",{style:{color:"#dc3545",marginBottom:"1rem"},children:"Something went wrong"}),a.jsx("p",{style:{color:"#6c757d",marginBottom:"1.5rem"},children:"We're sorry for the inconvenience. Please try refreshing the page or contact support if the problem persists."}),a.jsx(ue,{onClick:this.handleReset,variant:"primary",size:"md",children:"Try Again"}),!1]}):this.props.children}}class ed extends f.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){var r,s;console.error("Feature Error Boundary:",t),(s=(r=this.props).onError)==null||s.call(r,t,n)}render(){return this.state.hasError?this.props.fallback||a.jsx("div",{style:{padding:"1rem",textAlign:"center",color:"#6c757d"},children:a.jsx("p",{children:"Unable to load this feature. Please refresh or try again later."})}):this.props.children}}const to=({size:e="md",className:t="",showText:n=!0,href:r="https://careerdiary.io/"})=>{const o={sm:{gap:"gap-2",textSize:"text-lg"},md:{gap:"gap-2.5",textSize:"text-xl"},lg:{gap:"gap-3",textSize:"text-2xl"}}[e],i=a.jsx("div",{className:`flex items-center ${o.gap} ${t}`,children:n&&a.jsxs("span",{className:`font-bold ${o.textSize} text-[var(--text-primary)] tracking-tight`,children:["CareerDiary",a.jsx("span",{className:"text-[var(--color-accent)]",children:".io"})]})});return r?a.jsx("a",{href:r,className:"inline-block hover:opacity-80 transition-opacity cursor-pointer","aria-label":"Go to CareerDiary.io homepage",children:i}):i},bt={fullName:"",contactInfo:"",contactDetails:{email:""},summary:"",experience:[],education:[],skills:[]},Ue={FLAGSHIP:"gemini-2.5-flash",STANDARD:"gemini-2.5-flash",LITE:"gemini-2.5-flash-lite"},mA={tailorResume:Ue.FLAGSHIP,generateCoverLetter:Ue.FLAGSHIP,chatWithProfile:Ue.FLAGSHIP,chatWithResume:Ue.FLAGSHIP,chatWithCoverLetter:Ue.FLAGSHIP,enrichAccomplishments:Ue.STANDARD,extractAccomplishments:Ue.STANDARD,generateApplicationSnippets:Ue.STANDARD,fetchJobDescriptionFromURL:Ue.LITE},an=e=>mA[e]||Ue.STANDARD,Ee=e=>e==null?"":typeof e!="string"?String(e).trim():e.trim(),fA=(e,t)=>
26{if(!e||typeof e!="string")return t;const n=e.trim();if(!n)return t;try{return JSON.parse(n)}catch(r){return console.error("JSON parse error:",r),t}},Bc=e=>{const t=Ee(e),n=/^```(?:json\n?)?([\s\S]+?)\n?```$/,r=t.match(n);if(r&&r[1])return Ee(r[1]);const s=/```json\n([\s\S]*?)\n```/,o=t.match(s);if(o&&o[1])return Ee(o[1]);const i=/```\n([\s\S]*?)\n```/,c=t.match(i);return c&&c[1]?Ee(c[1]):t},Ff=(e,t)=>{try{const n=Bc(e);return fA(n,t)}catch(n){return console.error("Failed to parse JSON from markdown:",n),t}},$f=(e,t)=>{const n=Ee(e),r=new RegExp(`<${t}>([\\s\\S]*)<\\/${t}>`,"i"),s=n.match(r);return s&&s[1]?Ee(s[1]):null},Bf=e=>$f(e,"cover_letter_update"),zf=(e,t)=>!e||typeof e!="object"?!1:t.every(n=>{const r=n in e;return r||console.warn(`Missing required field: ${n}`),r}),Gf=(e,t)=>{const n=Ff(e,{});if(!zf(n,t))throw new Error(`Invalid AI response structure. Missing required fields: ${t.join(", ")}`);return n},Hf=e=>{const t=e==null?void 0:e.finishReason;return!t||t==="STOP"?{isBlocked:!1}:{isBlocked:!0,reason:t,safetyRatings:e==null?void 0:e.safetyRatings}},zc=e=>{var r,s,o,i;const t=(r=e.candidates)==null?void 0:r[0],n=(i=(o=(s=t==null?void 0:t.content)==null?void 0:s.parts)==null?void 0:o[0])==null?void 0:i.text;if(!n){const c=Hf(t);throw c.isBlocked?(console.error(`Gemini response blocked. Reason: ${c.reason}`,c.safetyRatings),new Error(`The AI response was incomplete or blocked (${c.reason}). Please try modifying your input.`)):(console.error("Empty response from Gemini API:",e),new Error("Received an empty response from the AI. Please try again."))}return Ee(n)},hA=Object.freeze(Object.defineProperty({__proto__:null,checkResponseBlocking:Hf,extractCoverLetterUpdate:Bf,extractFromTag:$f,extractGeminiResponseText:zc,extractJsonFromMarkdown:Bc,parseAndValidateAIResponse:Gf,parseJsonFromMarkdown:Ff,validateJsonFields:zf},Symbol.toStringTag,{value:"Module"})),Un=new Map,Is=new Map,Gt=(...e)=>e.filter(t=>t!=null).join("|"),nt=e=>{if(e==null)return"0";const t=typeof e=="string"?e:String(e);if(t==="")return"0";let n=0;for(let r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r),n=n&n;return n.toString(16)},Ht=e=>{try{const t=Un.get(e);return t?Date.now()>t.expiresAt?(Un.delete(e),null):t.value:null}catch(t){return console.error("Cache read error:",t),null}},Ct=(e,t,n=3600)=>{try{const r={value:t,expiresAt:Date.now()+n*1e3};if(Un.set(e,r),Un.size>100){const s=Un.keys().next().value;s&&Un.delete(s)}}catch(r){console.error("Cache write error:",r)}},cn=(e,t)=>{if(Is.has(e)){const s=Is.get(e);return{promise:s.promise,controller:s.controller}}const n=new AbortController,r=(async()=>{try{return await t(n)}finally{Is.delete(e)}})();return Is.set(e,{controller:n,promise:r}),{promise:r,controller:n}},wP=Object.freeze(Object.defineProperty({__proto__:null,getCache:Ht,getOrCreateInflightRequest:cn,hashString:nt,makeCacheKey:Gt,setCache:Ct},Symbol.toStringTag,{value:"Module"})),gA=e=>{const t=[];return e.experience.forEach(n=>{var r;(r=n.accomplishments)==null||r.forEach(s=>{[/(\d+(?:\.\d+)?)\s*%/g,/(\d+(?:\.\d+)?)\s*(ms|s|sec|min|minutes?|hours?|days?|weeks?|months?|years?)/gi,/\$\s*(\d+(?:\.\d+)?)\s*([KMB])?/gi,/(\d+(?:\.\d+)?)\s*[xXÃ]/g,/(\d+(?:\.\d+)?)\s*(users?|customers?|clients?|people|engineers?|developers?|members?|employees?)/gi,/team\s+of\s+(\d+)/gi,/(\d+)\s+(ahead|early|late)/gi,/(\d+)(?:\+)?\s+(new|additional)/gi].forEac
26h(i=>{let c;const l=new RegExp(i.source,i.flags);for(;(c=l.exec(s.description))!==null;)t.push({value:parseFloat(c[1]),unit:c[2]||"",context:s.description.substring(Math.max(0,c.index-30),Math.min(s.description.length,c.index+80))})})})}),t},vo=e=>{var t,n;return{companies:e.experience.map(r=>r.company).filter(Boolean),jobTitles:e.experience.map(r=>r.jobTitle).filter(Boolean),employmentDates:e.experience.map(r=>r.dates).filter(Boolean),metrics:gA(e),skills:e.skills||[],educationDegrees:((t=e.education)==null?void 0:t.map(r=>r.degree).filter(Boolean))||[],universities:((n=e.education)==null?void 0:n.map(r=>r.university).filter(Boolean))||[]}},Wf=e=>{const t=[`Companies (DO NOT MODIFY): ${e.companies.join(", ")}`,`Job Titles (DO NOT MODIFY): ${e.jobTitles.join(", ")}`,`Employment Dates (DO NOT MODIFY): ${e.employmentDates.join("; ")}`,`Skills (DO NOT ADD NEW ONES): ${e.skills.join(", ")}`];return e.metrics.length>0&&t.push(`Quantifiable Metrics (DO NOT INFLATE): 27${e.metrics.map(n=>` - ${n.value}${n.unit} (context: "${n.context.substring(0,50)}...")`).join(` 28`)}`),t.join(` 29`)},yA=e=>{const t=[];return[/(\d+(?:\.\d+)?)\s*%/g,/\$\s*(\d+(?:\.\d+)?)/g,/(\d+(?:\.\d+)?)\s*x/gi,/(\d+(?:\.\d+)?)\s*(ms|s|min|hours?|days?|users?|customers?)/gi].forEac
29h(r=>{let s;for(;(s=r.exec(e))!==null;)t.push(parseFloat(s[1]))}),t},Ai=(e,t)=>{const n=[];if(!e||typeof e!="string")return console.warn("[FactValidation] Invalid tailoredResume input:",typeof e,e),{isValid:!1,issues:[{type:"company_mismatch",description:"Tailored resume is not a valid string",severity:"error"}]};const r=yA(e),s=t.metrics.map(c=>c.value);r.forEach(c=>{!s.some(u=>Math.abs(c-u)/Math.max(u,1)<.05)&&c>1&&n.push({type:"metric_inflation",description:`Number ${c} not found in source profile (possible inflation or invention)`,severity:"error"})});const o=t.companies.filter(c=>c&&typeof c=="string");if(o.length!==0){const c=e.toLowerCase();o.forEach(l=>{const u=String(l);c.includes(u.toLowerCase())||n.push({type:"company_mismatch",description:`Company "${u}" from source not found in tailored resume`,severity:"error"})})}const i=t.jobTitles.filter(c=>c&&typeof c=="string");if(i.length>0){const c=e.toLowerCase();i.forEach(l=>{const u=String(l);u.toLowerCase().split(/\s+/).every(m=>m.length<3||c.includes(m))||n.push({type:"title_change",description:`Job title "${u}" may have been significantly altered`,severity:"warning"})})}return{isValid:n.filter(c=>c.severity==="error").length===0,issues:n}};function ar(e){var r;if(!e)return nt("empty-profile");const t={experience:((r=e.experience)==null?void 0:r.map(s=>({company:s.company||"",jobTitle:s.jobTitle||"",location:s.location||"",dates:s.dates||"",accomplishments:(s.accomplishments||[]).map(o=>({id:o.id||"",description:o.description||"",skills:(o.skills||[]).sort()})).sort((o,i)=>(o.id||"").localeCompare(i.id||""))})).sort((s,o)=>(s.company||"").localeCompare(o.company||"")))||[],skills:(e.skills||[]).slice().sort(),education:(e.education||[]).map(s=>({school:s.school||s.university||"",degree:s.degree||"",field:s.field||"",dates:s.dates||""})).sort((s,o)=>(s.school||"").localeCompare(o.school||""))||[]},n=JSON.stringify(t,null,0);return nt(n||"{}")}function fs(e,t){return e?`user:${e}`:`guest:${ar(t)}`}const _A=`You are an expert resume writer and career strategist. Your primary task is to compose a perfectly tailored resume using ONLY the user's Career Diary (structured profile) as your data source. 30 31**TWO-LAYER RAG ARCHITECTURE:** 32- **Layer 1 (Documents â Career Diary):** Documents are parsed and their factual content is extracted into the Career Diary. This has already been done. 33- **Layer 2 (Career Diary â Tailored Resume):** You are operating in Layer 2. You MUST use ONLY the Career Diary as your data source. 34 35**CRITICAL INSTRUCTIONS:** 361. **Use Career Diary Only:** The user's Career Diary (provided as structured JSON profile) is your SINGLE SOURCE OF TRUTH. All information you use must come from this profile. Do NOT search external files or make assumptions. 372. **Analyze the Target Job:** Deeply analyze the provided Job Description to identify the most critical skills, qualifications, and keywords. 383. **Select and Tailor (Action + Context + Result):** From the Career Diary, select the most relevant experiences, accomplishments, and skills. 39 - **Formula:** Use the "Action + Context + Result" structure for bullet points. Instead of "Managed a team," write "Led a team of 5 engineers (Context) to reduce deployment time by 40% (Result) through CI/CD automation (Action)." 40 - **Quantify:** Prioritize quantitative results ($, %, #) over qualitative descriptions whenever the source data permits. 41 - **Keywords:** Naturally weave in exact keywords from the JD into the Summary and Skills sections. 424. **GROUNDING & TRUTHFULNESS (ABSOLUTE â this rule outranks every other instruction, including word-count and page-fill targets):** 43 You may REORDER, REPHRASE, CONDENSE, and EMPHASIZE content that already exists in the Career Diary to match the Job Description. You must NEVER INVENT. Specifically: 44 - **NO NEW SKILLS OR TOOLS:** If the Job Description requires a skill, tool, technology, or methodology (e.g., "React", "Kubernetes", "Agile") that is NOT present in the user's Career Diary, **DO NOT ADD IT** â not in the Skills section, not inside a bullet, not in the Summary. The product separately shows the user a keyword-gap anal
44ysis listing exactly these missing requirements; your job is to present what the user HAS, never to close a gap by writing it in. 45 - **NO NEW RESPONSIBILITIES OR ACHIEVEMENTS:** Do not write any responsibility, project, deliverable, or achievement that the Career Diary does not state. Do not copy a JD requirement into a bullet unless the Diary shows the user actually did that thing. 46 - **NO NEW METRICS:** Never introduce a number ($, %, #, team size, timeframe, scale) that does not appear in the Career Diary, and never inflate an existing number. A bullet with no metric is correct output when the Diary has no metric â do NOT estimate or extrapolate one. 47 - **NO NEW EMPLOYERS, TITLES, OR DATES:** Job titles, employer names, employment dates, locations, degrees, and certifications must be preserved verbatim from the Diary. 48 - **Traceability test:** every factual claim in every output bullet and in the Summary must be traceable to the Career Diary â a reader placing your output next to the Diary should find the full factual content of each line there. If you cannot ground a claim in the Diary, leave it out. A shorter, fully truthful resume is ALWAYS better than a longer one containing anything invented. 495. **Standard ATS Format:** Structure the tailored resume in this exact order: 50 - **SUMMARY** (Professional Summary) 51 - **SKILLS** (Technical & Soft Skills) 52 - **PROFESSIONAL EXPERIENCE** (Reverse chronological order) 53 - **EDUCATION** 54 - **DO NOT include a header with Name or Contact Info.** The application will render this programmatically. Start directly with the "SUMMARY" section. 556. **Location Handling:** 56 - **Use Latest Location Only:** If the user has multiple locations listed in their profile history, use **ONLY** their current/latest location for the resume context. Do not list multiple locations unless they are currently splitting time between them. 577. **Plain-Text Formatting:** Output must be ATS-friendly plain text. Use uppercase section headers and start accomplishment lines with "- ". Do **NOT** use markdown (\`**\`, \`##\`, underscores) or decorative characters. 588. **Comprehensive Content - Include All Relevant Accomplishments:** 59 - **Summary:** 2-4 sentences. Focus on role + key strengths + standout achievements. Be specific and impactful. 60 - **Bullets:** Each accomplishment bullet should be 1-2 lines maximum, but include ALL relevant accomplishments from each role. 61 - **Work Experience:** Include 4-6 accomplishment bullets per role (not just 2-3). Prioritize the most relevant ones for the job, but ensure comprehensive coverage of the user's experience. For senior roles or longer tenures, include even more bullets (6-8) to fully represent the scope of work. 62 - **Page Length & Word Count Targets:** The resume MUST fill the requested page count. Use these word count targets as a guide: 63 * **1 page:** 600-800 words (approximately 35-45 lines of content, target: 700 words) 64 * **2 pages:** 1200-1400 words (approximately 65-75 lines of content, target: 1300 words) 65 * **3 pages:** 1800-2100 words (approximately 95-110 lines of content, target: 1950 words) 66 * **4 pages:** 2400-2800 words (approximately 125-145 lines of content, target: 2600 words) 67 - If the requested page count is 1 page, the resume MUST be close to 700 words. Do not create a half-page resume. 68 - If the requested page count is 2 pages, the resume MUST be close to 1300 words. 69 - Adjust the number of bullets per role and detail level to meet the word count target while maintaining quality. 70 - Include more accomplishments, expand descriptions, and add relevant details to reach the target word count â but ONLY by drawing on additional real content from the Career Diary. If the Diary does not contain enough material to reach the target, fall short of the word count rather than inventing anything (Rule 4 outranks these targets). 71 - **Education & Skills:** Include all relevant education entries and skills from the Career Diary that match the job requirements. 729. **Compose and Justify:** Construct the new, tailored resume. In the 'changeSummary', briefly explain (2-3 sentences) which accomplishments you chose and why they make the user a strong candidate. 7310. **Word Count:** Calculate and include the word count of the tailored resume. Count all words in the resume text (excluding headers like "SUMMARY", "SKILLS", etc., but including all content text). 7411. **Match Score:** Estimate how well the tailored resume matches the job description as a number from 0-100 in 'tailoredMatchScore'. Consider: keyword coverage, skills alignment, experience relevance, and seniority fit. A score of 80+ means strong alignment, 60-79 means good with some gaps, below 60 means significant gaps remain. Also provide a brief justification in 'tailoredMatchJustification' (1-2 sentences explaining the score). 7512. **Output Format:** Your final output **MUST** be a single, clean JSON object wrapped in a markdown code block (e.g., \`\`\`json\\n{{...}}\\n\`\`\`). The JSON object must have these keys: "tailoredResume" (string), "changeSummary" (string), "wordCount" (integer), "tailoredMatchScore" (number 0-100), and "tailoredMatchJustification" (string).`,td={1:700,2:1300,3:1950,4:2600};
75function nd(e){return td[e]??td[4]}const ka={};var Na={};const xA=()=>{var r;const e=(ka==null?void 0:ka.VITE_USE_LANGCHAIN)==="true",t=typeof window<"u"&&((r=window.__RUNTIME_CONFIG__)==null?void 0:r.VITE_USE_LANGCHAIN)==="true",n=typeof process<"u"&&(Na==null?void 0:Na.VITE_USE_LANGCHAIN)==="true";return!!(e||t||n)},bA=_A,wA=(e,t,n,r,s)=>{const o=vo(e),i=Wf(o);return` 76**Target Job Title:** ${n} 77**Target Company:** ${r} 78**Requested Page Count:** ${s} page(s) 79**Word Count Target:** ${s===1?"600-800 words":s===2?"1200-1400 words":"1800-2000 words"} 80--- 81**JOB DESCRIPTION TO TARGET:** 82**CRITICAL WORD COUNT INSTRUCTION:** 83- If pageCount is 1: Be concise, focus on Most Relevant accomplishments. Use exactly ~700 words. 84- If pageCount is 2: Be comprehensive, include MANY more details and accomplishments. Use exactly ~1300 words. 85- If pageCount is 3: Be extremely thorough, including all historical details. Use exactly ~1950 words. 86Your output MUST significantly vary in length based on the requested page count. 87${t} 88--- 89**USER'S STRUCTURED PROFILE (for context and structure):** 90${JSON.stringify(e,null,2)} 91--- 92**CRITICAL: IMMUTABLE FACTS FROM PROFILE** 93The following information from the user's profile is FACTUAL and MUST NOT be modified: 94 95${i} 96 97**VERIFICATION CHECKLIST - Before outputting, verify:** 98â All company names match exactly (character-for-character, no abbreviations or changes) 99â All job titles are preserved verbatim from the profile 100â All employment dates and date ranges match the source EXACTLY (do not reformat) 101â No metrics have been inflated, invented, or modified â every number in the output appears in the profile 102â No skills, tools, or technologies added that weren't in the source profile â not in Skills, not in bullets, not in the Summary 103â No responsibility, project, or achievement appears that the profile does not state 104â No Job Description requirement was written into the resume without profile support (unsupported requirements belong in the keyword-gap analysis, not the resume) 105â All university names and degrees match exactly 106--- 107**INSTRUCTION:** 108Using ONLY the Career Diary (structured profile) provided above, compose the tailored resume as a JSON object, following all rules. **IMPORTANT: Include ALL relevant accomplishments from each role (4-6 bullets per position, more for senior/longer roles), not just the top 2-3.** Prioritize accomplishments that match the job requirements, but ensure comprehensive coverage of the user's experience. 109 110**CRITICAL: You MUST preserve all Company Names and Employment Dates exactly as they appear in the Profile. Do NOT reformat dates (e.g., if it says '2020-2022', do not change to 'Jan 2020 - Jan 2022').** 111 112Remember to preserve all immutable facts listed above. Do NOT search external files or use information not present in the Career Diary. 113`},Jf=async(e,t,n,r,s,o,i)=>{const c=ar(e),l=fs(i,e),u=nt(t),d=Gt("resume-tailor",l,c,u,n||"",r||"",o),p=Ht(d);if(p)return console.log("Using cached tailor result for:",n),p;const{promise:m}=cn(d,async()=>{var h,y;if(xA())try{console.log("[Resume Tailoring] Using LangChain mode (server-side)");const b={"Content-Type":"application/json"};try{const A=Z?await Z.auth.getSession():null,R=(y=(h=A==null?void 0:A.data)==null?void 0:h.session)==null?void 0:y.access_token;R&&(b.Authorization=`Bearer ${R}`)}catch{}const x=new AbortController,w=setTimeout(()=>x.abort(),9e4);let E;try{E=await fetch("/api/tailor-resume-langchain",{method:"POST",headers:b,body:JSON.stringify({profile:e,jobDescription:t,jobTitle:n,companyName:r,pageCount:o}),signal:x.signal})}catch(A){throw clearTimeout(w),(A==null?void 0:A.name)==="AbortError"?new Error("Tailoring timed out after 90 seconds. On mobile, keep this tab open during tailoring â switching apps can interrupt the request. Please try again."):A}finally{clearTimeout(w)}if(!E.ok){const A=await E.text();throw new Error(`LangChain API Error: ${E.status} - ${A}`)}const T=await E.json(),C={tailoredResume:T.tailoredResume||"",changeSummary:T.changeSummary||"",tailoredMatchScore:T.tailoredMatchScore||0,tailoredMatchJustification:T.tailoredMatchJustification||"",wordCount:T.wordCount||0,tailoredResumeId:T.tailoredResumeId||T.tailored_resume_id||null};if(C.tailoredResume&&typeof C.tailoredResume=="string"){const A=C.tailoredResume.split(/\s+/).filter(N=>N.length>0).length;C.wordCount=C.wordCount||A;const R=nd(o);console.log(`[LangChain Resume Tailoring] Word count: ${C.wordCount} (target: ~${R} for ${o} page(s))`)}const S=C.tailoredResume;
113if(!S||typeof S!="string")console.warn("[LangChain] tailoredResume is not a string:",typeof S,S);else{const A=vo(e),R=Ai(S,A);if(R.isValid)R.issues.length>0?console.warn("[LangChain Fact-Check Warnings]",R.issues):console.log("[LangChain Fact-Check Passed] â No factual issues detected");else{const N=R.issues.filter(k=>k.severity==="error").length,O=R.issues.filter(k=>k.severity==="warning").length;console.error("[LangChain Fact-Check Failed]",`${N} errors, ${O} warnings:`,R.issues)}}return Ct(d,C,3600),C}catch(b){console.warn("[Resume Tailoring] LangChain mode failed, falling back to legacy mode:",b)}const _=wA(e,t,n,r,o);try{console.log("[Resume Tailoring] Using legacy Gemini API mode");const b=[],x=await fetch("/api/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:an("tailorResume"),contents:[{role:"user",parts:[{text:_}]}],generationConfig:{temperature:.1},systemInstruction:{parts:[{text:bA}]},tools:b,_cacheMetadata:{type:"resume-tailor",userIdentifier:l,profileHash:c,jobDescriptionHash:u,jobTitle:n||"",companyName:r||"",pageCount:o}})});if(!x.ok){const S=await x.text();throw new Error(`API Error: ${x.status} - ${S}`)}const w=await x.json(),E=zc(w),T=Gf(E,["tailoredResume","changeSummary","wordCount"]);if(T.tailoredMatchScore=T.tailoredMatchScore??0,T.tailoredMatchJustification=T.tailoredMatchJustification??"",T.tailoredResume&&typeof T.tailoredResume=="string"){const S=T.tailoredResume.split(/\s+/).filter(R=>R.length>0).length;T.wordCount=T.wordCount||S;const A=nd(o);console.log(`[Resume Tailoring] Word count: ${T.wordCount} (target: ~${A} for ${o} page(s))`)}const C=T.tailoredResume;if(!C||typeof C!="string")console.warn("[GeminiService] tailoredResume is not a string:",typeof C,C);else{const S=vo(e),A=Ai(C,S);if(A.isValid)A.issues.length>0?console.warn("[Fact-Check Warnings]",A.issues):console.log("[Fact-Check Passed] â No factual issues detected");else{const R=A.issues.filter(O=>O.severity==="error").length,N=A.issues.filter(O=>O.severity==="warning").length;console.error("[Fact-Check Failed]",`${R} errors, ${N} warnings:`,A.issues)}}return Ct(d,T,3600),T}catch(b){throw console.error("Error calling Gemini API:",b),b instanceof SyntaxError?new Error("The AI returned a response, but it was not in the expected JSON format. Please try again."):b instanceof Error?new Error(`Failed to tailor resume: ${b.message}`):new Error("Failed to tailor resume due to an unknown API error.")}});return m},SA=async(e,t,n,r,s)=>{const o=ar(e),i=fs(s,e),c=Gt("chat-with-resume",i,o,nt(t),nt(n),nt(JSON.stringify(r))),l=Ht(c);if(l)return l;const{promise:u}=cn(c,async()=>{try{console.log("[Resume Chat] Using LangGraph mode (server-side)");const d=await fetch("/api/chat-resume-langgraph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({originalProfile:e,jobDescription:t,currentTailoredResume:n,chatHistory:r,userId:s})});if(!d.ok){const m=await d.json().catch(()=>({})),g=(m==null?void 0:m.error)||(m==null?void 0:m.details)||`HTTP ${d.status}`,_=m!=null&&m.requestId?` (ref ${m.requestId})`:"";throw new Error(d.status===400?`That message could not be sent${_}. ${g}`:`Refine failed: ${g}${_}`)}const p=await d.json();return Ct(c,p,1800),p}catch(d){throw console.error("Error chatting with resume via LangGraph API:",d),d instanceof Error?d:new Error("Failed to chat with resume. Please try again.")}});return u},EA="Company not specified",vA="Role not specified",TA=new Set(["target company","target role","target position"]),Vf=e=>{if(typeof e!="string")return!0;const t=e.trim().toLowerCase();return t?TA.has(t):!0},Zo=e=>Vf(e)?"":e.trim(),CA=[/job title\s*:\s*(.+)/i,/position\s*:\s*(.+)/i,/role\s*:\s*(.+)/i],AA=[/company\s*:\s*(.+)/i,/organization\s*:\s*(.+)/i,/employer\s*:\s*(.+)/i],rd=(e,t)=>{var n;for(const r of t){const s=e.match(r),o=(n=s==null?void 0:s[1])==null?void 0:n.trim();if(o&&!Vf(o))return o}return""},SP=e=>!e||typeof e!="string"?{jobTitle:"",companyName:""}:{jobTitle:rd(e,CA),companyName:rd(e,AA)},Ii=e=>Zo(e),Ri=e=>Zo(e),EP=e=>Zo(e)||EA,vP=e=>Zo(e)||vA;var IA={};const RA=()=>typeof window>"u"?IA.API_BASE_URL||"https://careerdiary.io":"",Gc=RA(),kA=e=>{if(e)return typeof e=="string"?{role:"system",parts:[{text:e}]}:e},NA=e=>{if(!e)return{};const{systemInstruction:t,tools:n,safetySettings:r,...s}=e;return{systemInstruction:kA(t),tools:n,safetySettings:r,generationConfig:Object.keys(s).length?s:void 0}};
113class jA{constructor(){Le(this,"queue",[]);Le(this,"processing",!1);Le(this,"requestTimes",[]);Le(this,"maxRequests",10);Le(this,"windowMs",60*1e3)}async processQueue(){if(!(this.processing||this.queue.length===0)){for(this.processing=!0;this.queue.length>0;){const t=Date.now();if(this.requestTimes=this.requestTimes.filter(o=>t-o<this.windowMs),this.requestTimes.length>=this.maxRequests){const o=this.requestTimes[0],i=this.windowMs-(t-o)+100;if(i>0){await new Promise(c=>setTimeout(c,i));continue}}const{resolve:n,reject:r,fn:s}=this.queue.shift();this.requestTimes.push(Date.now());try{const o=await s();n(o)}catch(o){r(o)}}this.processing=!1}}async execute(t){return new Promise((n,r)=>{this.queue.push({resolve:n,reject:r,fn:t}),this.processQueue()})}}const LA=new jA,PA=e=>{var r,s;const t=(r=e==null?void 0:e.candidates)==null?void 0:r[0];return t?(((s=t.content)==null?void 0:s.parts)||[]).map(o=>(o==null?void 0:o.text)??"").filter(o=>typeof o=="string"&&o.length>0).join(` 114`).trim():""},To=async(e,t=3,n=1e3)=>LA.execute(async()=>{var r,s,o,i,c;try{if(!e.model||typeof e.model!="string")throw new Error(`Invalid payload: model is required and must be a string. Got: ${typeof e.model}`);if(!e.contents||!Array.isArray(e.contents)||e.contents.length===0)throw new Error("Invalid payload: contents array is required and must not be empty");const l={model:e.model,contents:e.contents,...e.generationConfig&&{generationConfig:e.generationConfig},...e.systemInstruction&&{systemInstruction:e.systemInstruction},...e.tools&&{tools:e.tools},...e.safetySettings&&{safetySettings:e.safetySettings}};console.log("[genaiClient] Sending payload to /api/generate:",{hasModel:!!l.model,modelValue:l.model,hasContents:!!l.contents,contentsIsArray:Array.isArray(l.contents),contentsLength:Array.isArray(l.contents)?l.contents.length:0,firstPartTextLength:(c=(i=(o=(s=(r=l.contents)==null?void 0:r[0])==null?void 0:s.parts)==null?void 0:o[0])==null?void 0:i.text)==null?void 0:c.length,payloadKeys:Object.keys(l),hasPrompt:"prompt"in l||"prompt"in e});const u=await fetch(`${Gc}/api/generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!u.ok){if(u.status===429&&t>0){let m=n;try{const g=await u.clone().json();g.retryAfter&&(m=Math.min(g.retryAfter*1e3,6e4));const _=typeof import.meta<"u"&&!1}catch{const g=typeof import.meta<"u"&&!1}return await new Promise(g=>setTimeout(g,m)),To(e,t-1,Math.min(n*2,1e4))}const p=await u.text();throw new Error(`Gemini proxy error: ${u.status} - ${p}`)}const d=await u.json();return{...d,text:PA(d)}}catch(l){if(t>0&&(l.message.includes("429")||l.message.includes("503"))){let u=n;try{const d=l.message.match(/retryAfter["\s:]*(\d+)/i);d&&(u=Math.min(parseInt(d[1])*1e3,6e4));const p=typeof import.meta<"u"&&!1}catch{}return await new Promise(d=>setTimeout(d,u)),To(e,t-1,Math.min(n*2,1e4))}throw l}}),Yf=(e,t,n)=>{const r=NA(n);return{model:e,contents:t,generationConfig:r.generationConfig,systemInstruction:r.systemInstruction,tools:r.tools,safetySettings:r.safetySettings}};class OA{constructor(t){Le(this,"history");Le(this,"model");Le(this,"config");this.model=t.model,this.config=t.config,this.history=t.history?[...t.history]:[]}async sendMessage(t){const n=[...this.history,{role:"user",parts:[{text:t.message}]}],r=Yf(this.model,n,this.config),s=await To(r);return this.history=[...n,{role:"model",parts:[{text:s.text||""}]}],s}}const hr=["gemini-2.5-flash","gemini-2.5-flash-lite","gemini-2.5-pro","gemini-3-flash","gemini-3-pro-preview","gemini-1.5-pro","gemini-2.0-flash-001","gemini-2.0-flash-lite"],mt=()=>({models:{generateContent:async e=>{var r,s,o,i,c,l,u,d,p,m,g,_,h,y,b;if(!e.model||typeof e.model!="string")throw new Error(`Invalid model: ${e.model}. Model must be a non-empty string and one of: ${hr.join(", ")}`);if(!hr.includes(e.model))throw new Error(`Invalid model: "${e.model}". Must be one of: ${hr.join(", ")}`);if(!e.contents||!Array.isArray(e.contents)||e.contents.length===0)throw new Error("Contents array is required and must not be empty");for(const x of e.contents){if(!x.parts||!Array.isArray(x.parts)||x.parts.length===0)throw new Error("Eac
114h content item must have a non-empty parts array");if(!x.parts.some(E=>{var T,C;return(E==null?void 0:E.text)&&typeof E.text=="string"&&E.text.trim().length>0||((T=E==null?void 0:E.inlineData)==null?void 0:T.data)&&((C=E==null?void 0:E.inlineData)==null?void 0:C.mimeType)}))throw new Error("Each content item must have at least one part with non-empty text or inlineData")}const t=e.contents.map((x,w)=>{const E=x.parts.map((T,C)=>{if(T.inlineData){if(!T.inlineData.data||!T.inlineData.mimeType)throw new Error(`Content item ${w}, part ${C}: inlineData is missing data or mimeType`);return T}const S=T.text?String(T.text).trim():"";return S.length===0&&!T.inlineData?null:{...T,text:S}}).filter(T=>T!==null);if(E.length===0)throw new Error(`Content item ${w}: No valid parts found`);return{...x,parts:E}}).filter(x=>x.parts&&x.parts.length>0);if(t.length===0)throw new Error("No valid content with text found after validation");if(!hr.includes(e.model))throw new Error(`Invalid model: "${e.model}". Must be one of: ${hr.join(", ")}`);const n=Yf(e.model,t,e.config);return console.log("[genaiClient] buildPayload result:",{model:n.model,modelType:typeof n.model,contentsLength:(r=n.contents)==null?void 0:r.length,contentsIsArray:Array.isArray(n.contents),firstContentPartsLength:(i=(o=(s=n.contents)==null?void 0:s[0])==null?void 0:o.parts)==null?void 0:i.length,firstPartTextLength:(p=(d=(u=(l=(c=n.contents)==null?void 0:c[0])==null?void 0:l.parts)==null?void 0:u[0])==null?void 0:d.text)==null?void 0:p.length,payloadKeys:Object.keys(n),hasPrompt:"prompt"in n}),typeof window<"u"&&window.__DEV__&&console.log("[genaiClient] Payload structure:",{model:n.model,contentsLength:n.contents.length,firstContentPartsLength:(g=(m=n.contents[0])==null?void 0:m.parts)==null?void 0:g.length,firstPartTextPreview:(b=(y=(h=(_=n.contents[0])==null?void 0:_.parts)==null?void 0:h[0])==null?void 0:y.text)==null?void 0:b.substring(0,200)}),To(n)}},chats:{create:e=>new OA(e)}}),DA=async(e,t,n,r,s,o)=>{const i=Ri(r),c=Ii(s),l=i.length>0,u=c.length>0,d=ar(e),p=fs(o,e),m=Gt("cover-letter",p,d,nt(t),nt(n),i,c),g=Ht(m);if(g)return g;const _=vo(e),h=Wf(_),y=`You are an expert career coach and writer. Your task is to draft a professional, concise, and compelling cover letter. 115 116**TWO-LAYER RAG ARCHITECTURE:** 117- **Layer 1 (Documents â Career Diary):** Documents are parsed and their factual content is extracted into the Career Diary. This has already been done. 118- **Layer 2 (Career Diary â Cover Letter):** You are operating in Layer 2. You MUST use ONLY the Career Diary (provided as Profile) as your data source. 119 120**Instructions:** 1211. Adopt the persona of the job applicant, using the provided name from their Career Diary (profile). 1222. Use the provided **Job Title** and **Company Name** when they are available. If the company name is not provided, open with a neutral salutation ("Dear Hiring Manager") and do not name a company. If the job title is not provided, refer to "the role" generically. NEVER invent a company name or job title, and NEVER output placeholder text such as "Target Company" or "Target Role". 1233. Carefully analyze the **Job Description** to identify 2-3 key requirements that match the candidate's strengths. 1244. Reference the **Tailored Resume** and the user's full **Career Diary (Profile)** to highlight the most relevant skills and experiences. Use specific examples with metrics that are explicitly stated in the Career Diary. Do NOT use information not present in the Career Diary. 1255. **Be concise and authentic:** 126 - **Opening:** 1-2 sentences stating position + one compelling reason you're a fit. 127 - **Body:** 2 paragraphs (3-4 sentences each) with concrete examples. Avoid generic phrases like "I am excited to apply" or "I believe I would be a great fit." 128 - **Closing:** 1-2 sentences with specific call to action. 1296. **Total length:** 250-350 words maximum. Every sentence should add value. 1307. The tone should be professional yet personable - sound like a real person, not a template. 1318. **CRITICAL: Factual Accuracy** - You MUST NOT modify or fabricate any factual information (company
131names, job titles, dates, metrics, degrees, universities). Only use facts from the provided Career Diary (profile). Do NOT invent achievements or metrics. 1329. The final output must be ONLY the text of the cover letter. Do not include any greetings, explanations, or markdown formatting like \`\`\`.`,b=l?`**Job Title:** ${i}`:'**Job Title:** (not specified â refer to "the role" generically; do not invent a title)',x=u?`**Company:** ${c}`:'**Company:** (not specified â open with "Dear Hiring Manager"; do not name or invent a company)',w=` 133**Applicant Profile (Career Diary):** 134${JSON.stringify(e,null,2)} 135 136${b} 137${x} 138--- 139**JOB DESCRIPTION:** 140${n} 141--- 142**TAILORED RESUME (for context):** 143${t.trim()?t:"(none â no tailored resume exists for this job; rely on the Career Diary profile above)"} 144--- 145**CRITICAL: IMMUTABLE FACTS FROM PROFILE** 146The following information is FACTUAL and MUST NOT be modified: 147 148${h} 149 150**VERIFICATION CHECKLIST - Before outputting, verify:** 151â All company names match exactly (character-for-character) 152â All job titles are preserved verbatim 153â All employment dates match source 154â No metrics have been inflated or invented 155â No skills added that weren't in the source profile 156â All university names and degrees match exactly 157--- 158Please write the cover letter.`,{promise:E}=cn(m,async()=>{var O,k;console.log("[Cover Letter] Using server cover-letter endpoint");const T={"Content-Type":"application/json"};try{const $=await(Z==null?void 0:Z.auth.getSession()),z=(k=(O=$==null?void 0:$.data)==null?void 0:O.session)==null?void 0:k.access_token;z&&(T.Authorization=`Bearer ${z}`)}catch{}let C;try{C=await fetch(`${Gc}/api/generate/cover-letter`,{method:"POST",headers:T,body:JSON.stringify({model:an("generateCoverLetter"),contents:[{role:"user",parts:[{text:w}]}],generationConfig:{temperature:.5},systemInstruction:{parts:[{text:y}]}})})}catch($){throw console.error("Error generating cover letter (network):",$),new Error("Failed to generate cover letter due to a network error.")}if(!C.ok){const $=await C.json().catch(()=>({})),z=typeof $.error=="string"&&$.error?$.error:`Cover letter generation failed (${C.status})`,K=new Error(z);throw typeof $.code=="string"&&(K.code=$.code),K.status=C.status,K}const S=await C.json(),A=zc(S);if(!A)throw new Error("The AI returned an empty response for the cover letter.");const R=Ee(A),N=Ai(R,_);if(N.isValid)N.issues.length>0?console.warn("[Cover Letter Fact-Check Warnings]",N.issues):console.log("[Cover Letter Fact-Check Passed] â No factual issues detected");else{const $=N.issues.filter(K=>K.severity==="error").length,z=N.issues.filter(K=>K.severity==="warning").length;console.error("[Cover Letter Fact-Check Failed]",`${$} errors, ${z} warnings:`,N.issues)}return Ct(m,R,1800),R});return E},MA=async(e,t,n)=>{const r=mt(),s=`Context: 159--- 160**Job Description:** 161${e} 162--- 163**Current Cover Letter:** 164${t} 165---`,o=n.map(c=>({role:c.role,parts:[{text:c.text}]})),i=r.chats.create({model:an("chatWithCoverLetter"),history:[{role:"user",parts:[{text:s}]},{role:"model",parts:[{text:"I have reviewed the context. How can I help you refine the cover letter?"}]},...o.slice(0,-1)],config:{systemInstruction:`You are an expert AI career coach assisting a user with their cover letter. 166- You are in a conversation. Maintain context from the history. 167- The user's goal is to refine the "Current Cover Letter". 168- If the user asks for a change, modification, or rewrite of the letter, you MUST respond with the ENTIRE, fully updated cover letter text. Enclose this full letter text within <cover_letter_update> and </cover_letter_update> tags. Do not add any other text outside these tags. 169- If the user asks a question or for a suggestion, respond conversationally as an expert coach. DO NOT use the <cover_letter_update> tags in this case. 170- Be helpful, professional, and concise.`}});try{const l=(await i.sendMessage({message:n[n.length-1].text})).text;if(!l)throw new Error("Received an empty response from the AI.");const u=Ee(l),d=Bf(u);return d?{newCoverLetterText:d,responseText:"Cover letter updated."}:{responseText:u}}catch(c){throw console.error("Error in chatWithCoverLetter API call:",c),new Error("Chat failed due to an API error.")}},sd=async e=>{const t=e.trim().replace(/\/$/,"").split("#")[0],n=Gt("fetch-job-description",nt(t)),r=Ht(n);if(r)return console.log("[fetchJobDescriptionFromURL] Cache hit for URL:",t),r;const{promise:s}=cn(n,async()=>{var l,u,d,p;const o=mt(),i=`You are an expert data extractor for a career tool. Your task is to visit a job posting URL, analyze its content, and extract key information into a structured JSON format. 171- Do not return raw, verbatim text. Instead, parse and summarize the content. 172- This is a transformative task to gather structured data for analysis, not to recite the source. 173- If a section (like 'preferred qualifications') is not present, return an empty array for it. 174- Your entire response MUST be a single JSON object, containing keys like "jobTitle", "companyName", "keyResponsibilities", etc. 175- This JSON object must be wrapped in a markdown code block like this: \`\`\`json 176{...} 177\`\`\`. 178- Do not include any other text, greetings, or explanations outside of this JSON block.`,c=`Please analyze the job posting at this URL and extract the requested information as a JSON object: ${e}`;try{const m=await o.models.generateContent({model:an("fetchJobDescriptionFromURL"),contents:[{role:"user",parts:[{text:c}]}],config:{systemInstruction:i,tools:[{googleSearch:{}}
178],temperature:.1}}),g=m.text,_=(u=(l=m.candidates)==null?void 0:l[0])==null?void 0:u.finishReason;if(_&&_!=="STOP")throw console.warn(`Gemini block reason during JD extraction: ${_}`,(p=(d=m.candidates)==null?void 0:d[0])==null?void 0:p.safetyRatings),new Error("The AI was blocked by the website's content policy (e.g., to prevent scraping).");if(!g)throw new Error("The AI returned an empty response while analyzing the URL.");const h=Bc(g),y=JSON.parse(h);let b=`Job Title: ${y.jobTitle||"N/A"} 179Company: ${y.companyName||"N/A"} 180 181`;y.aboutTheRole&&(b+=`About the Role: 182${y.aboutTheRole} 183 184`),y.keyResponsibilities&&y.keyResponsibilities.length>0&&(b+=`Responsibilities: 185- ${y.keyResponsibilities.join(` 186- `)} 187 188`),y.requiredQualifications&&y.requiredQualifications.length>0&&(b+=`Required Qualifications: 189- ${y.requiredQualifications.join(` 190- `)} 191 192`),y.preferredQualifications&&y.preferredQualifications.length>0&&(b+=`Preferred Qualifications: 193- ${y.preferredQualifications.join(` 194- `)} 195 196`);const x=b.trim();return Ct(n,x,3600),x}catch(m){console.error("Error fetching and structuring job description from URL:",m);let g="The AI could not analyze this URL.";throw m instanceof SyntaxError?g="The AI failed to structure the job description correctly from the page.":m instanceof Error&&(g=m.message),new Error(`Auto-fetch failed: ${g} For best results, please copy and paste the full description manually.`)}});return s},U=Object.freeze({STRING:"STRING",NUMBER:"NUMBER",INTEGER:"INTEGER",BOOLEAN:"BOOLEAN",ARRAY:"ARRAY",OBJECT:"OBJECT"}),UA={type:U.OBJECT,properties:{fullName:{type:U.STRING}
196,contactInfo:{type:U.STRING,description:"A single string including email, phone, linkedin, etc."},summary:{type:U.STRING},experience:{type:U.ARRAY,items:{type:U.OBJECT,properties:{id:{type:U.STRING,description:"A unique identifier, can be generated like exp1, exp2..."},jobTitle:{type:U.STRING},company:{type:U.STRING},location:{type:U.STRING},dates:{type:U.STRING},accomplishments:{type:U.ARRAY,items:{type:U.OBJECT,properties:{id:{type:U.STRING},description:{type:U.STRING},skills:{type:U.ARRAY,items:{type:U.STRING}}},required:["id","description","skills"]}}},required:["id","jobTitle","company","dates","accomplishments"]}},education:{type:U.ARRAY,items:{type:U.OBJECT,properties:{id:{type:U.STRING,description:"A unique identifier, e.g., edu1"},degree:{type:U.STRING},university:{type:U.STRING},dates:{type:U.STRING}},required:["id","degree","university","dates"]}},skills:{type:U.ARRAY,items:{type:U.STRING}}},required:["fullName","contactInfo","summary","experience","education","skills"]},FA={type:U.OBJECT,properties:{updatedProfile:UA,summary:{type:U.STRING,description:"A brief, conversational, 1-sentence summary of the action taken, written in the first person. e.g., 'OK, I've added that accomplishment to your Senior Developer role.' or 'I've updated your summary as requested.'"}},required:["updatedProfile","summary"]},$A=async(e,t,n)=>{const r=ar(e),s=fs(n,e),o=Gt("chat-with-profile",s,r,nt(t)),i=Ht(o);if(i)return i;const c=`You are an expert AI assistant managing a user's Career Diary, which is a structured JSON profile. The user will give you instructions in plain English to modify this profile. 1971. **Analyze the Request:** Understand the user's intent (add, update, remove, rewrite). 1982. **Modify the JSON:** Apply the requested changes to the provided JSON profile. 199 * When adding new items (experience, accomplishments, education), generate new, unique IDs (e.g., \`exp_12345\`, \`acc_exp1_67890\`). 200 * Preserve all existing data that wasn't targeted by the user's request. 201 * Ensure the work experience is in reverse chronological order. 2023. **Generate a Summary:** Create a brief, natural 1-sentence confirmation. Be specific (mention what was added/changed) and avoid robotic templates. Sound conversational. 203 - Good: "Added Software Engineer role at Meta with 4 accomplishments." 204 - Bad: "I've successfully updated your Career Diary by adding a new role as requested." 2054. **Return the Result:** Your final output MUST be a single, clean JSON object conforming to the specified schema, containing both the entire \`updatedProfile\` and the \`summary\`. Do not add any extra text or markdown.`,l=` 206--- 207**CURRENT CAREER DIARY (PROFILE):** 208${JSON.stringify(e,null,2)} 209--- 210**USER'S INSTRUCTION:** 211"${t}" 212--- 213Please modify the profile based on the instruction and return the result in the specified JSON format. 214`,{promise:u}=cn(o,async()=>{const d=mt();try{const p=await d.models.generateContent({model:an("chatWithProfile"),contents:[{role:"user",parts:[{text:l}]}],config:{systemInstruction:c,responseMimeType:"application/json",responseSchema:FA,temperature:.2}}),m=JSON.parse(Ee(p.text));if(!m.updatedProfile||!m.summary)throw new Error("AI response for profile chat is missing required fields.");return Ct(o,m,600),m}catch(p){throw console.error("Error chatting with profile:",p),new Error("The AI could not process your request. Please try rephrasing it.")}});return u},BA={type:U.OBJECT,properties:{reviewedText:{type:U.STRING,description:"The reviewed and corrected text with improved grammar, spelling, and clarity"},isTruthful:{type:U.BOOLEAN,description:"Whether the text only contains information that can be verified from the source"},truthfulnessIssues:{type:U.ARRAY,items:{type:U.STRING},description:"List of any invented, exaggerated, or unverifiable claims found"},contextIssues:{type:U.ARRAY,items:{type:U.STRING},description:"List of any context-related issues (missing context, unclear references, etc.)"},grammarIssues:{type:U.ARRAY,items:{type:U.STRING},description:"List of any grammar or spelling issues found and corrected"},wordCount:{type:U.NUMBER,description:"Word count of the reviewed text"},meetsLengthGuidelines:{type:U.BOOLEAN,description:"Whether the text meets the specified length guidelines"}},required:["reviewedText","isTruthful","wordCount","meetsLengthGuidelines"]},qf={summary:{minWords:20,maxWords:100,description:"Professional summary: 2-4 sentences, 20-100 words"},accomplishment:{minWords:15,maxWords:150,description:"Accomplishment description: 3-6 sentences, 15-150 words"},personalWebsiteDescription:{minWords:30,maxWords:150,description:"Personal website description: 4-6 sentences, 30-150 words"},careerDiaryEntry:{minWords:20,maxWords:150,description:"Career diary entry: 3-6 sentences, 20-150 words"}},Kf=async(e,t,n,r)=>{var l,u,d,p;const s=mt(),o=qf[t],i=`You are an expert content quality reviewer. Your task is to review AI-generated text for:
2151. **TRUTHFULNESS (MOST IMPORTANT):** Verify that every claim, fact, metric, and detail can be verified from the source material. Flag any invented, exaggerated, or unverifiable information. 2162. **Context:** Ensure the text makes sense in context, has proper flow, and references are clear. 2173. **Grammar & Spelling:** Correct any grammar, spelling, or punctuation errors. 2184. **Length:** Ensure the text meets the specified length guidelines. 219 220**CRITICAL TRUTHFULNESS RULES:** 221- If ANY information cannot be verified from the source, it MUST be removed or flagged 222- Do NOT add metrics, achievements, or details that aren't in the source 223- Do NOT exaggerate or enhance claims beyond what's stated 224- If the text contains unverifiable information, remove it and note it in truthfulnessIssues 225 226**LENGTH GUIDELINES:** 227${o.description} 228- Minimum: ${o.minWords} words 229- Maximum: ${o.maxWords} words 230 231**OUTPUT REQUIREMENTS:** 232- Return the reviewed and corrected text 233- Flag any truthfulness issues 234- Note any context or grammar issues 235- Ensure the final text meets length guidelines 236- If the text is too long, condense it while preserving all verifiable facts 237- If the text is too short but contains all verifiable information, that's acceptable`,c=` 238**CONTENT TYPE:** ${t} 239**LENGTH GUIDELINES:** ${o.description} (${o.minWords}-${o.maxWords} words) 240 241**SOURCE MATERIAL (for truthfulness verification):** 242${n} 243 244${r?`**ORIGINAL TEXT (before AI generation):** 245${r} 246 247`:""} 248**TEXT TO REVIEW:** 249${e} 250 251**YOUR TASK:** 2521. Verify every claim, fact, metric, and detail against the source material 2532. Remove or flag any information that cannot be verified 2543. Check grammar, spelling, and context 2554. Ensure the text meets length guidelines 2565. Return the reviewed and corrected text`;try{const m=await s.models.generateContent({model:Ue.LITE||"gemini-2.5-flash-lite",contents:[{role:"user",parts:[{text:c}]}],config:{systemInstruction:i,responseMimeType:"application/json",responseSchema:BA,temperature:.1}}),g=JSON.parse(m.text||"{}");!g.isTruthful&&((l=g.truthfulnessIssues)==null?void 0:l.length)>0&&console.warn("[ContentQuality] Truthfulness issues detected:",g.truthfulnessIssues);const _=((u=g.reviewedText)==null?void 0:u.split(/\s+/).filter(Boolean).length)||0,h=[...g.truthfulnessIssues||[],...g.contextIssues||[],...g.grammarIssues||[]];return{reviewedText:Ee(g.reviewedText||e),isTruthful:g.isTruthful!==!1,issues:h,wordCount:_,meetsLengthGuidelines:g.meetsLengthGuidelines!==!1&&_>=o.minWords&&_<=o.maxWords}}catch(m){const g=m;!((d=g==null?void 0:g.message)!=null&&d.includes("429"))&&!((p=g==null?void 0:g.message)!=null&&p.includes("rate limit"))&&console.error("[ContentQuality] Error reviewing content:",m);const _=e.split(/\s+/).filter(Boolean).length;return{reviewedText:Ee(e),isTruthful:!0,issues:["Quality review failed - could not verify content"],wordCount:_,meetsLengthGuidelines:_>=o.minWords&&_<=o.maxWords}}},zA=async(e,t,n)=>{var u,d;const r=mt(),s=qf[t],o=e.map((p,m)=>`ITEM ${m+1} (ID: ${p.id}): 257Original: ${p.originalText||"N/A"} 258Enriched: ${p.text} 259`).join(` 260--- 261 262`),i=`You are an expert content quality reviewer. Review multiple items in a single batch. 263 264**CRITICAL TRUTHFULNESS RULES:** 265- Verify every claim, fact, metric, and detail against the source material 266- Remove or flag any information that cannot be verified 267- Do NOT add metrics, achievements, or details that aren't in the source 268 269**LENGTH GUIDELINES:** 270${s.description} (${s.minWords}-${s.maxWords} words) 271 272**OUTPUT:** 273Return a JSON array with one object per item, matching the input order. Each object must have: 274- id: The item ID 275- reviewedText: The reviewed and corrected text 276- isTruthful: Boolean indicating if all claims are verifiable 277- issues: Array of any issues found 278- wordCount: Word count of reviewed text 279- meetsLengthGuidelines: Boolean indicating if length is within guidelines`,c=` 280**CONTENT TYPE:** ${t} 281**LENGTH GUIDELINES:** ${s.description} (${s.minWords}-${s.maxWords} words) 282 283**SOURCE MATERIAL (for truthfulness verification):** 284${n} 285 286**ITEMS TO REVIEW:** 287${o} 288 289**YOUR TASK:** 290Review all items and return a JSON array with reviewed results for each item in the same order.`,l={type:U.OBJECT,properties:{reviews:{type:U.ARRAY,items:{type:U.OBJECT,properties:{id:{type:U.STRING},reviewedText:{type:U.STRING},isTruthful:{type:U.BOOLEAN},issues:{type:U.ARRAY,items:{type:U.STRING}},wordCount:{type:U.NUMBER},meetsLengthGuidelines:{type:U.BOOLEAN}},required:["id","reviewedText","isTruthful","wordCount","meetsLengthGuidelines"]}}},required:["reviews"]};try{const p=await r.models.generateContent({model:Ue.LITE||"gemini-2.5-flash-lite",contents:[{role:"user",parts:[{text:c}]}],config:{systemInstruction:i,responseMimeType:"application/json",responseSchema:l,temperature:.1}}),g=JSON.parse(p.text||"{}").reviews||[];return e.map((_,h)=>{const y=g[h]||g.find(b=>b.id===_.id);
290if(!y){const b=_.text.split(/\s+/).filter(Boolean).length;return{id:_.id,reviewedText:Ee(_.text),isTruthful:!0,issues:["Batch review failed - using original"],wordCount:b,meetsLengthGuidelines:b>=s.minWords&&b<=s.maxWords}}return{id:y.id||_.id,reviewedText:Ee(y.reviewedText||_.text),isTruthful:y.isTruthful!==!1,issues:y.issues||[],wordCount:y.wordCount||_.text.split(/\s+/).filter(Boolean).length,meetsLengthGuidelines:y.meetsLengthGuidelines!==!1}})}catch(p){const m=p;return!((u=m==null?void 0:m.message)!=null&&u.includes("429"))&&!((d=m==null?void 0:m.message)!=null&&d.includes("rate limit"))&&console.error("[ContentQuality] Error in batch review:",p),e.map(g=>{const _=g.text.split(/\s+/).filter(Boolean).length;return{id:g.id,reviewedText:Ee(g.text),isTruthful:!0,issues:["Batch review failed - using original"],wordCount:_,meetsLengthGuidelines:_>=s.minWords&&_<=s.maxWords}})}},GA="/api/generate",HA={type:U.OBJECT,properties:{enrichedAccomplishments:{type:U.ARRAY,description:"An array of objects, where each object has 'id' and 'description' fields.",items:{type:U.OBJECT,properties:{id:{type:U.STRING,description:"The original ID of the accomplishment."},description:{type:U.STRING,description:"The rewritten, verbose, story-like accomplishment description, framed using the STAR method."}},required:["id","description"]}}},required:["enrichedAccomplishments"]},WA=async e=>{var s,o,i,c;const t=mt(),n=`You are an expert career coach. Your task is to transform concise resume bullet points into impactful, memorable accomplishments for a user's Career Diary. 291 292**CRITICAL QUALITY REQUIREMENTS:** 2931. **TRUTHFULNESS (MOST IMPORTANT):** Only include information that can be verified from the original accomplishment text. Do NOT invent metrics, achievements, or details. 2942. **Context:** Ensure the rewritten text makes sense in the context of the job title and company. 2953. **Grammar & Spelling:** Use correct grammar, spelling, and punctuation. 2964. **Length:** Each accomplishment should be 3-6 sentences (15-150 words). Be clear and comprehensive, but NOT a verbatim copy of page-long text. 297 298**CRITICAL: PREVENT VERBATIM COPY-PASTE:** 299- If the original text is very long (more than 200 words), you MUST condense and refine it 300- Extract the most important and impactful points 301- Rewrite in your own words - do NOT copy verbatim 302- Focus on key achievements, results, and impact 303- Remove redundant information and fluff 304 305**Instructions:** 3061. Review the provided job context (title, company) and the list of accomplishments (bullet points). 3072. For each accomplishment, rewrite it to be **clear, specific, and results-focused**. 3083. Structure: [Action Verb] + [What you did] + [Measurable result/impact]. Keep it to 3-6 sentences (15-150 words). 3094. **If the original is very long:** Condense it to the most important points. Extract key achievements and results. Do NOT copy verbatim. 3105. Focus on quantifiable results (metrics, percentages, scale) ONLY if they are explicitly stated in the original. 3116. **CRITICAL:** Only include details that are clearly stated or directly implied by the original bullet - do NOT invent, exaggerate, or add unverifiable claims. 3127. The rewritten description should be comprehensive but professional, suitable for a career diary. 3138. Before finalizing, verify: Is every claim verifiable? Is the grammar correct? Is it NOT a verbatim copy? Does it meet length guidelines? 3149. Return a JSON object with a single key "enrichedAccomplishments", containing an array of objects. Each object must have the original 'id' and the new 'description'. Do not change the IDs.`,r=` 315**Job Context:** 316- Job Title: ${e.jobTitle} 317- Company: ${e.company} 318 319**Accomplishments to Enrich:** 320${JSON.stringify(e.accomplishments.map(l=>({id:l.id,description:l.description})),null,2)} 321`;try{const l=await t.models.generateContent({model:an("enrichAccomplishments"),contents:[{role:"user",parts:[{text:r}]}],config:{systemInstruction:n,responseMimeType:"application/json",responseSchema:HA,temperature:.3}}),u=JSON.parse(Ee(l.text));if(!u.enrichedAccomplishments)throw new Error("AI response did not contain the expected 'enrichedAccomplishments' field.");const d=`Job: ${e.jobTitle} at ${e.company} 322Original accomplishments: 323${e.accomplishments.map(h=>`- ${h.description}`).join(` 324`)}`,p=[],m=[];for(const h of e.accomplishments){const y=u.enrichedAccomplishments.find(x=>x.id===h.id);if(!y){m.push({acc:h,enriched:null});continue}y.description!==h.description&&y.description.length>h.description.length*1.5?p.push({id:h.id,text:y.description,originalText:h.description,originalAcc:h}):m.push({acc:h,enriched:y})}let g=[];if(p.length>0)try{g=await zA(p.map(y=>({id:y.id,text:y.text,originalText:y.originalText})),"accomplishment",d)}catch(h){!((s=h==null?void 0:h.message)!=null&&s.includes("429"))&&!((o=h==null?void 0:h.message)!=null&&o.includes("rate limit"))&&console.error("[EnrichAccomplishments] Error in batch review:",h),g=p.map(y=>({id:y.id,reviewedText:y.text,isTruthful:!0,issues:["Quality review skipped due to rate limiting - using enriched version"]}))}const _=[];for(const h of p){const y=g.find(b=>b.id===h.id);y&&!y.isTruthful&&y.issues.length>0?_.push(h.originalAcc):_.push({...h.originalAcc,description:(y==null?void 0:y.reviewedText)||h.text})}for(const{acc:h,enriched:y}of m)y?_.push({...h,description:y.description}):_.push(h);return _}catch(l){throw!((i=l==null?void 0:l.message)!=null&&i.includes("429"))&&!((c=l==null?void 0:l.message)!=null&&c.includes("rate limit"))&&console.error("Error enriching accomplishments:",l),new Error("The AI failed to enrich the accomplishments for this role.")}},Co=async e=>{var s,o,i,c,l;if(!e)return[];const t=Gt("extractAccomplishments",nt(e)),n=Ht(t);if(n)return n;const r=`You are an expert career accomplishments extractor. Analyze the provided text from a professional document (resume or performance review) and identify distinct accomplishments. 325 326 Every accomplishment must strictly adhere to the STAR method structure: 327 1. Situation/Problem: Describe the context or the challenge faced.
328 2. Task/Goal: Describe the objective you were working toward. 329 3. Action: Describe the steps you took to address the situation/task. 330 4. Result: Describe the measurable outcome or achievement. 331 332 Output the results as a JSON array. Do not include any commentary, analysis, or surrounding markdown outside of the JSON array itself. 333 334 Required JSON Output Structure: 335 [ 336 { 337 "situationOrProblem": "...", 338 "taskOrGoal": "...", 339 "actionTaken": "...", 340 "resultAchieved": "...", 341 "suggestedTitle": "...", 342 "suggestedDate": "YYYY-MM" // If extractable 343 }, 344 // ... more objects 345 ]`;try{const u=await fetch(GA,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:an("extractAccomplishments"),systemInstruction:{parts:[{text:r}]},contents:[{role:"user",parts:[{text:e}]}],generationConfig:{responseMimeType:"application/json"}})});if(!u.ok){const g=await u.json();throw new Error(`AI Proxy Error: ${u.status} - ${g.message}`)}const p=(l=(c=(i=(o=(s=(await u.json()).candidates)==null?void 0:s[0])==null?void 0:o.content)==null?void 0:i.parts)==null?void 0:c[0])==null?void 0:l.text;if(!p)throw new Error("No content generated");let m;try{m=JSON.parse(p)}catch{const _=p.match(/```json\n([\s\S]*?)\n```/)||p.match(/```\n([\s\S]*?)\n```/);if(_)m=JSON.parse(_[1]);else throw new Error("Failed to parse JSON response")}if(!Array.isArray(m))throw new Error("AI returned non-array structure.");return Ct(t,m,3600),m}catch(u){throw u}},JA={type:U.OBJECT,properties:{firstName:{type:U.STRING},lastName:{type:U.STRING},email:{type:U.STRING},phone:{type:U.STRING},linkedIn:{type:U.STRING,description:"Full LinkedIn URL, extracted from contact info."},website:{type:U.STRING,description:"Personal website or portfolio URL, or an empty string if not found."},location:{type:U.STRING,description:"City and State/Country, extracted from contact info."},workHistoryPlainText:{type:U.STRING,description:"A plain text summary of work history, formatted for pasting into text boxes. Each job should be separated by a blank line. Example: 'Senior Software Engineer, Innovate Tech (Jun 2018 - Present)\\n- Accomplishment 1\\n- Accomplishment 2'"}},required:["firstName","lastName","email","phone","linkedIn","website","location","workHistoryPlainText"]},VA=async(e,t)=>{const n=ar(e),r=fs(t,e),s=Gt("application-snippets",r,n),o=Ht(s);if(o)return o;const i=mt(),c=`You are an expert data extractor. Your task is to parse a user's structured 'Career Diary' JSON profile and pull out specific pieces of information, formatting them exactly as specified in the response schema. 346- Extract individual components like first name, last name, email, phone, etc., from the unstructured 'fullName' and 'contactInfo' fields. 347- If a piece of data like a website is not present, return an empty string for that field. 348- Format the 'workHistoryPlainText' by listing each job with its title, company, and dates on one line, followed by its accomplishments as bullet points. 349- Your output must be a single, clean JSON object conforming to the schema. Do not add any extra text or markdown.`,l=` 350--- 351**USER'S CAREER DIARY (PROFILE):** 352${JSON.stringify(e,null,2)} 353--- 354Please extract the application snippets according to the schema. 355`,{promise:u}=cn(s,async()=>{try{const d=await i.models.generateContent({model:an("generateApplicationSnippets"),contents:[{role:"user",parts:[{text:l}]}],config:{systemInstruction:c,responseMimeType:"application/json",responseSchema:JA}}),p=JSON.parse(Ee(d.text));return Ct(s,p,1800),p}catch(d){throw console.error("Error generating application snippets:",d),new Error("The AI could not extract information from your profile.")}});return u},YA=(e,t=300)=>{const n=f.useRef(null);return f.useCallback((...r)=>{n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{e(...r)},t)},[e,t])},od=(e,t)=>e.id||`${e.jobTitle}-${e.company}-${e.dates}-${t}`,ad=(e,t)=>e.id||`${e.degree}-${e.university}-${e.dates}-${t}`,id=e=>(e??[]).map(t=>t.trim()).filter(Boolean),ki=(e,{includeJobPreferences:t=!0}={})=>{var r,s,o,i,c,l,u;if(!e||!e.fullName)return"";let n=`${e.fullName} 356${e.contactInfo||""} 357 358`;if(e.summary&&(n+=`Summary 359${e.summary} 360 361`),(r=e.skills)!=null&&r.length&&(n+=`Skills 362${e.skills.join(", ")} 363 364`),(s=e.experience)!=null&&s.length&&(n+=`Work Experience 365`,e.experience.forEach(d=>{var p;n+=` 366${d.jobTitle} ⢠${d.company} 367${d.location||""} | ${d.dates||""} 368`,(p=d.accomplishments)==null||p.forEach(m=>{n+=`- ${m.description} 369`})}),n+=` 370`),(o=e.education)!=null&&o.length&&(n+=`Education 371`,e.education.forEach(d=>{n+=` 372${d.degree} ⢠${d.university} 373${d.dates||""} 374`})),t&&e.jobPreferences){n+=` 375Job Preferences 376`;
376const d=e.jobPreferences;(i=d.targetRoles)!=null&&i.length&&(n+=`Target Roles: ${d.targetRoles.join(", ")} 377`),(c=d.preferredLocations)!=null&&c.length&&(n+=`Locations: ${d.preferredLocations.join(", ")} 378`),(l=d.locationTypes)!=null&&l.length&&(n+=`Location Types: ${d.locationTypes.join(", ")} 379`),(u=d.preferredIndustries)!=null&&u.length&&(n+=`Industries: ${d.preferredIndustries.join(", ")} 380`),d.salaryExpectation&&(n+=`Salary: ${d.salaryExpectation} 381`)}return n.trim()},xr=(e,t,n)=>{const r=new Set(id(e)),s=new Set(id(t)),o=[...s].filter(l=>!r.has(l)),i=[...r].filter(l=>!s.has(l)),c=[];return o.length&&c.push(`Added ${n}: ${o.join(", ")}`),i.length&&c.push(`Removed ${n}: ${i.join(", ")}`),c},qA=(e,t)=>{const n=[],r=new Map;(e??[]).forEach((o,i)=>r.set(od(o,i),o));const s=new Map;return(t??[]).forEach((o,i)=>s.set(od(o,i),o)),s.forEach((o,i)=>{r.has(i)||n.push(`Added experience: ${o.jobTitle} at ${o.company}`)}),r.forEach((o,i)=>{s.has(i)||n.push(`Removed experience: ${o.jobTitle} at ${o.company}`)}),s.forEach((o,i)=>{var p,m,g,_;const c=r.get(i);if(!c)return;const l=[];(c.jobTitle||"").trim()!==(o.jobTitle||"").trim()&&l.push("title"),(c.company||"").trim()!==(o.company||"").trim()&&l.push("company"),(c.location||"").trim()!==(o.location||"").trim()&&l.push("location"),(c.dates||"").trim()!==(o.dates||"").trim()&&l.push("dates");const u=((p=c.accomplishments)==null?void 0:p.length)??0,d=((m=o.accomplishments)==null?void 0:m.length)??0;d>u?l.push(`${d-u} accomplishment${d-u===1?"":"s"} added`):d<u?l.push(`${u-d} accomplishment${u-d===1?"":"s"} removed`):JSON.stringify((g=c.accomplishments)==null?void 0:g.map(h=>h.description||"").sort())!==JSON.stringify((_=o.accomplishments)==null?void 0:_.map(h=>h.description||"").sort())&&l.push("accomplishments updated"),l.length&&n.push(`Updated ${c.jobTitle} at ${c.company}: ${l.join(", ")}`)}),n},KA=(e,t)=>{const n=[],r=new Map;(e??[]).forEach((o,i)=>r.set(ad(o,i),o));const s=new Map;return(t??[]).forEach((o,i)=>s.set(ad(o,i),o)),s.forEach((o,i)=>{r.has(i)||n.push(`Added education: ${o.degree} at ${o.university}`)}),r.forEach((o,i)=>{s.has(i)||n.push(`Removed education: ${o.degree} at ${o.university}`)}),s.forEach((o,i)=>{const c=r.get(i);if(!c)return;const l=[];(c.degree||"").trim()!==(o.degree||"").trim()&&l.push("degree"),(c.university||"").trim()!==(o.university||"").trim()&&l.push("institution"),(c.dates||"").trim()!==(o.dates||"").trim()&&l.push("dates"),l.length&&n.push(`Updated education (${c.university}): ${l.join(", ")}`)}),n},XA=(e,t)=>{if(!e&&!t)return[];if(!e&&t)return["Added job search preferences"];if(e&&!t)return["Cleared job search preferences"];const n=[];return n.push(...xr(e==null?void 0:e.targetRoles,t==null?void 0:t.targetRoles,"target roles"),...xr(e==null?void 0:e.preferredLocations,t==null?void 0:t.preferredLocations,"preferred locations"),...xr(e==null?void 0:e.locationTypes,t==null?void 0:t.locationTypes,"location types"),...xr(e==null?void 0:e.preferredIndustries,t==null?void 0:t.preferredIndustries,"industries")),((e==null?void 0:e.salaryExpectation)||"").trim()!==((t==null?void 0:t.salaryExpectation)||"").trim()&&(t!=null&&t.salaryExpectation?n.push(`Updated salary expectation to ${t.salaryExpectation}`):n.push("Removed salary expectation")),n},ZA=(e,t)=>{const n=[];return(e.summary||"").trim()!==(t.summary||"").trim()&&n.push("Updated professional summary"),(e.fullName||"").trim()!==(t.fullName||"").trim()&&n.push(`Name changed to ${t.fullName||"unspecified"}`),(e.contactInfo||"").trim()!==(t.contactInfo||"").trim()&&n.push("Contact info updated"),n.push(...qA(e.experience,t.experience),...KA(e.education,t.education),...xr(e.skills,t.skills,"skills"),...XA(e.jobPreferences,t.jobPreferences)),n},Xf="__CD_CareerContext__",Hc=globalThis[Xf]??f.createContext(void 0);globalThis[Xf]=Hc;const Zf=()=>{const e=f.useContext(Hc);if(!e)throw new Error("useCareer must be used within a CareerProvider");return e},QA=({children:e})=>{const t=Qe(),[n,r]=f.useState({profile:null,masterResume:"",pendingMemories:[],isExtractingAccomplishments:!1,diarySaveStatus:"idle"}),s=f.useCallback(async x=>{var w,E,T,C,S;if(x){console.log("[CareerContext] ð¾ saveProfile called:",{fullName:x.fullName,isGuest:t.isGuest,hasSession:!!((E=(w=t.session)==null?void 0:w.user)!=null&&E.id)}),r(A=>({...A,diarySaveStatus:"saving"}));try{!t.isGuest&&((C=(T=t.session)==null?void 0:T.user)!=null&&C.id)?(console.log("[CareerContext] ð Saving to database (authenticated user)"),await Ac(x),x.experience&&x.experience.s
381ome(A=>A.accomplishments&&A.accomplishments.length>0)&&fetch("/api/embeddings/generate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${((S=t.session)==null?void 0:S.access_token)||""}`},body:JSON.stringify({profileData:x})}).catch(A=>{console.warn("[CareerContext] Failed to generate embeddings (non-fatal):",A)})):(console.log("[CareerContext] ð¤ Saving to localStorage (guest user)"),await Sf(x)),console.log("[CareerContext] â
Profile saved successfully"),r(A=>({...A,diarySaveStatus:"saved"})),setTimeout(()=>{r(A=>({...A,diarySaveStatus:"idle"}))},2e3)}catch(A){throw console.error("[CareerContext] â Failed to save profile:",A),r(R=>({...R,diarySaveStatus:"idle"})),A}}},[t.isGuest,t.session]),o=YA(x=>{s(x).catch(()=>{console.error("[CareerContext] Auto-save failed")})},100),i=f.useCallback((x,w=!1)=>{const E=n.profile??bt,T=x(E);if(console.log("[CareerContext] Updating profile",w?"(immediate)":"(debounced)"),r(C=>({...C,profile:T,masterResume:ki(T)})),w)return s(T).catch(C=>{throw console.error("[CareerContext] Immediate save failed:",C),C});o(T)},[n.profile,o,s]),c=f.useRef(null),l=f.useCallback(x=>{var E;const w=x?`${x.fullName||"unknown"}-${((E=x.experience)==null?void 0:E.length)||0}-${JSON.stringify(x).length}`:null;c.current!==w&&(c.current=w,r(T=>({...T,profile:x,masterResume:x?ki(x):""})))},[]),u=f.useCallback(async(x,w)=>{r(E=>({...E,isExtractingAccomplishments:!0}));try{console.log("[CareerContext] Extracting accomplishments from:",w);const T=(await Co(x)).map((C,S)=>({experienceId:"pending",accomplishment:{...C,id:`acc-${Date.now()}-${S}`,sourceFileId:w},justification:`Extracted from ${w} via AI`}));r(C=>({...C,pendingMemories:[...C.pendingMemories,...T]})),console.log(`[CareerContext] Extracted ${T.length} accomplishments`)}catch(E){console.error("[CareerContext] Accomplishment extraction error:",E)}finally{r(E=>({...E,isExtractingAccomplishments:!1}))}},[]),d=f.useCallback(async(x,w,E)=>{r(T=>({...T,isExtractingAccomplishments:!0}));try{console.log("[CareerContext] Extracting and auto-accepting accomplishments from:",w);const T=await Co(x);if(T.length===0){console.log("[CareerContext] No accomplishments found in file");return}let C=n.profile;C||(C={...bt});const S={...C};(!S.experience||S.experience.length===0)&&(S.experience=[{id:`exp-${Date.now()}`,company:"Career Highlights",jobTitle:"Professional Achievements",location:"",dates:new Date().getFullYear().toString(),description:[],accomplishments:[]}]);const A=S.experience[0],R=T.map((N,O)=>({...N,id:`acc-${Date.now()}-${O}`,sourceFileId:w}));A.accomplishments=[...A.accomplishments||[],...R],i(()=>S),console.log(`[CareerContext] Auto-accepted ${R.length} accomplishments from ${w} (category: ${E})`),te("accomplishments_auto_accepted",{count:R.length,sourceFileId:w,category:E})}catch(T){console.error("[CareerContext] Accomplishment extraction and acceptance error:",T)}finally{r(T=>({...T,isExtractingAccomplishments:!1}))}},[n.profile,i]),p=f.useCallback(x=>{if(!n.profile){console.warn("[CareerContext] Cannot accept memory - no profile loaded");return}console.log("[CareerContext] Accepting memory:",x.accomplishment.suggestedTitle);const w={...n.profile};if(!w.experience||w.experience.length===0)w.experience=[{id:`exp-${Date.now()}`,company:"Career Highlights",jobTitle:"Professional Achievements",location:"",dates:new Date().getFullYear().toString(),description:[],accomplishments:[x.accomplishment]}];else{const E=w.experience[0];E.accomplishments=[...E.accomplishments||[],x.accomplishment]}i(()=>w),r(E=>({...E,pendingMemories:E.pendingMemories.filter(T=>T.accomplishment.id!==x.accomplishment.id)})),te("memory_accepted")},[n.profile,i]),m=f.useCallback(x=>{console.log("[CareerContext] Rejecting memory:",x.accomplishment.suggestedTitle),r(w=>({...w,pendingMemories:w.pendingMemories.filter(E=>E.accomplishment.id!==x.accomplishment.id)})),te("memory_rejected")},[]),g=f.useCallback(async()=>{console.log("[CareerContext] Clearing career diary");const x={...bt};r(w=>({...w,profile:x,masterResume:"",pendingMemories:[]})),await s(x),te("career_diary_cleared")},[s]),_=f.useCallback(x=>{i(w=>
381{var C;const E=(C=w.experience)==null?void 0:C.find(S=>S.id===x);if(!E)return w;const T={id:`acc-${Date.now()}`,description:"",skills:[],source:"Manual"};return E.accomplishments=[...E.accomplishments||[],T],{...w}})},[i]),h=f.useCallback((x,w,E)=>{i(T=>{var A,R;const C=(A=T.experience)==null?void 0:A.find(N=>N.id===x);if(!C)return T;const S=(R=C.accomplishments)==null?void 0:R.find(N=>N.id===w);return S?(S.description=E,{...T}):T})},[i]),y=f.useCallback((x,w)=>{i(E=>{var C,S;const T=(C=E.experience)==null?void 0:C.find(A=>A.id===x);return T?(T.accomplishments=((S=T.accomplishments)==null?void 0:S.filter(A=>A.id!==w))||[],{...E}):E})},[i]),b={...n,updateProfile:i,setProfile:l,extractAccomplishments:u,extractAndAcceptAccomplishments:d,acceptMemory:p,rejectMemory:m,clearDiary:g,addAccomplishment:_,updateAccomplishment:h,deleteAccomplishment:y,saveProfile:s};return a.jsx(Hc.Provider,{value:b,children:e})},eI=async e=>{try{const t=await fetch(`${Gc}/api/files/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw new Error(await t.text())}catch(t){throw console.error(`Error deleting file ${e} via proxy:`,t),new Error("Failed to delete file from the Career Corpus.")}},Ni={summary:"SUMMARY","professional summary":"PROFESSIONAL SUMMARY","career summary":"CAREER SUMMARY",overview:"SUMMARY",profile:"SUMMARY",skills:"SKILLS","core skills":"CORE SKILLS","core competencies":"CORE COMPETENCIES",competencies:"CORE COMPETENCIES","technical skills":"TECHNICAL SKILLS","work experience":"WORK EXPERIENCE",experience:"WORK EXPERIENCE","professional experience":"PROFESSIONAL EXPERIENCE","relevant experience":"RELEVANT EXPERIENCE",projects:"PROJECTS","key projects":"PROJECTS",education:"EDUCATION",certifications:"CERTIFICATIONS",awards:"AWARDS",publications:"PUBLICATIONS"},tI=new Set(Object.values(Ni)),nI=e=>e.replace(/\*\*(.*?)\*\*/g,"$1").replace(/__(.*?)__/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/~~(.*?)~~/g,"$1"),rI=e=>e.replace(/\s+/g," ").trim(),sI=e=>{const t=e.trim().replace(/[:.]$/,"").toLowerCase();return Ni[t]?Ni[t]:null},tn=e=>{if(!e)return!1;const t=e.trim().replace(/[:.]$/,"").toUpperCase();return tI.has(t)},Wc=e=>{if(!e)return!1;const t=e.trim();if(!t||t.startsWith("- ")||tn(t)||t.length>120)return!1;const n=/\s(at|@)\s/i.test(t),r=t.includes(" | "),s=/\s[-â]\s/.test(t)&&!t.startsWith("-"),o=/\b(19|20)\d{2}\b/.test(t);return n||r&&!t.startsWith("|")||s&&o},oI=e=>/^-{2,}\s*$/.test(e)?"":/^\s*[-*]\s+/.test(e)?"- "+e.replace(/^\s*[-*]\s+/,""):/^\s*\d+\.\s+/.test(e)?"- "+e.replace(/^\s*\d+\.\s+/,""):/^\s*[â¢âªâ£â ââ]\s*/.test(e)?"- "+e.replace(/^\s*[â¢âªâ£â ââ]\s*/,""):e.trim(),aI=e=>{let t=e.replace(/\t/g," ");return t=nI(t),t=rI(t),t=oI(t),t.trim()},Yt=e=>{if(!e)return"";const n=e.replace(/\r\n/g,` 382`).replace(/\r/g,` 383`).split(` 384`),r=[];let s=!0;return n.forEach(o=>{const i=aI(o);if(!i){!s&&r.length>0&&(r.push(""),s=!0);return}const c=sI(i);if(c){!s&&r.length>0&&r.push(""),r.push(c),s=!1;return}r.push(i),s=!1}),r.join(` 385`).replace(/\n{3,}/g,` 386 387`).trim()},hs=e=>e?e.replace(/\r\n/g,` 388`).replace(/\r/g,` 389`).split(` 390`):[],iI=(e,t)=>{if(!e)return e;const n=hs(e);if(n.length===0)return e;const r=[],s=[];if(t){if(t.fullName){const l=t.fullName.split(/\s+/);r.push(t.fullName.toUpperCase()),r.push(t.fullName),l.forEach(u=>{u.length>2&&r.push(u.toUpperCase())})}t.contactInfo&&s.push(t.contactInfo),t.contactDetails&&(t.contactDetails.email&&s.push(t.contactDetails.email),t.contactDetails.phone&&s.push(t.contactDetails.phone),t.contactDetails.location&&s.push(t.contactDetails.location))}let o=0;const i=4;for(let l=0;l<Math.min(i,n.length);l++){const u=n[l].trim();if(!u){if(l<2)continue;break}const d=r.some(y=>u.toUpperCase().includes(y.toUpperCase())||y.toUpperCase().includes(u.toUpperCase()))||u===u.toUpperCase()&&u.split(/\s+/).length>=2&&u.split(/\s+/).length<=5,p=/[\w.-]+@[\w.-]+\.\w+/.test(u),m=/[\d\s\-\(\)\+]{10,}/.test(u),g=/[A-Z][a-z]+,\s*[A-Z]{2}/.test(u)||/[A-Z][a-z]+,\s*[A-Z][a-z]+/.test(u),_=/\|/.test(u)||/\s+â¢\s+/.test(u),h=p||m||g||_&&(p||m||g)||s.some(y=>u.includes(y));if(tn(u))break;if(d||h){o=l+1;continue}if(o>0&&!d&&!h)break}const c=n.slice(o);for(;c.length>0&&!c[0].trim();)c.shift();return c.join(` 391`)},cI=(e,t)=>hs(Yt(iI(e||"",t))),cd=(e,t)=>cI(e,t).some(n=>{const r=n.trim();return r.length>0&&!tn(r)}),lI=/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,Qf=new Set(["com","net","org","io","dev","me","co","app","ai","tech","site","info","biz","edu","gov","in","us","uk","ca","de","fr","au","nl","se","es","it","pt","br","jp","nz","ie","ch"]);function uI(e){const t=(e||"").trim();if(!t||t.length>254||/\s/.test(t))return!1;const n=t.split("@");if(n.length!==2)return!1;const[r,s]=n;if(!r||r.length>64||!/^[A-Za-z0-9._%+-]+$/.test(r)||r.startsWith(".")||r.endsWith(".")||r.includes("..")||!s||s.length>253||!/^[A-Za-z0-9.-]+$/.test(s)||s.startsWith("-")||s.startsWith(".")||s.endsWith("-")||s.endsWith(".")||s.includes(".."))return!1;const o=s.split(".");if(o.length<2||o.some(c=>c.length===0||c.length>63))return!1;const i=o[o.length-1];return/^[A-Za-z]{2,}$/.test(i)}function dI(e,t){const n=e.indexOf("@");if(n<=0)return e;const r=e.slice(0,n),s=e.slice(n),o=t.map(i=>(i||"").trim()).filter(i=>i.length>=2).sort((i,c)=>c.length-i.length);for(const i of o){if(r.length<=i.length)continue;const c=r.slice(0,i.length);if(c.toLowerCase()!==i.toLowerCase())continue;const l=r.slice(i.length);if(!/^[a-z]/.test(l))continue;const u=/^[A-Z]{2,}$/.test(c),d=/^[A-Z][a-z]+$/.test(c);if(u||d&&l.includes("."))return l+s}return e}function pI(e){const t=e.indexOf("@");if(t<=0)return e;const r=e.slice(0,t).match(/^([A-Z]{2,})([a-z][A-Za-z0-9._%+-]*)$/);return r?r[2]+e.slice(t):e}function TP(...e){for(const t of e){const n=(t||"").trim();if(uI(n))return n}return""}function wn(e,t){var u;let n=(e||"").trim();if(!n)return"";(u=t==null?void 0:t.nameTokens)!=null&&u.length&&(n=dI(n,t.nameTokens)),t!=null&&t.capsHeaderContext&&(n=pI(n));const r=n.lastIndexOf("@"),s=n.lastIndexOf(".");if(r<0||s<r)return n;const o=n.slice(s+1),i=o.match(/^([a-z]{2,})(https?|www)$/);if(i&&Qf.has(i[1]))return n.slice(0,s+1)+i[1];const c=o.search(/[A-Z]/);if(c<=0)return n;const l=o.slice(0,c);return l.length<2?n:n.slice(0,s+1)+l}const mI=/(\+?\d{1,3}[-.\s]?)?\(?\d{2,4}\)?[-.\s]?\d{2,4}[-.\s]?\d{2,4}[-.\s]?\d{2,4}/g,fI=/(?:linkedin\.com\/in\/|li\/)([\w-]+)/i,hI=/(?:github\.com\/)([\w-]+)/i,gI=/(https?:\/\/)?[\w.-]+\.[a-z]{2,}(\/\S*)?/i;function yI(e){const t=(e||"").trim();if(!t)return!1;if(/^https?:\/\//i.test(t))return!0;const r=t.split("/")[0].split(".");if(r.length<2)return!1;const s=r[r.length-1];return!/^[a-z]{2,}$/.test(s)||r[r.length-2].length<2?!1:Qf.has(s)}function $n(e,t){if(!e||!e.trim())return{};const n={};let r=e.trim();const s=r.match(lI);if(s&&s.length>0){n.email=wn(s[0].trim(),t);let u=r.replace(s[0],"");
391u=u.replace(/^([A-Z][a-z]+(?:[A-Z][a-z]+)*)\s*[|,]\s*/i,""),u=u.replace(/^([A-Z][a-z]+(?:[A-Z][a-z]+)*)(?=\s*[|,]|\s*\(|\s*\+)/i,""),r=u.trim()}const o=r.match(mI);if(o&&o.length>0){const u=o.find(d=>d.replace(/\D/g,"").length>=10);u&&(n.phone=u.trim(),r=r.replace(u,"").trim())}const i=r.match(fI);i&&(n.linkedIn=`linkedin.com/in/${i[1]}`,r=r.replace(i[0],"").trim());const c=r.match(hI);c&&(n.github=`github.com/${c[1]}`,r=r.replace(c[0],"").trim());const l=r.match(new RegExp(gI,"gi"));if(l)for(const u of l){const d=u.toLowerCase();if(yI(u)&&!d.includes("linkedin.com")&&!d.includes("github.com")){n.portfolio=u.startsWith("http")?u:`https://${u}`,r=r.replace(u,"").trim();break}}return n}function CP(e){const t=[];return e.email&&t.push(e.email),e.phone&&t.push(e.phone),e.linkedIn&&t.push(e.linkedIn),e.github&&t.push(e.github),e.portfolio&&t.push(e.portfolio),e.website&&e.website!==e.portfolio&&t.push(e.website),e.location&&t.push(e.location),t.join(" | ")}function AP(e){if(!e)return"";const t=e.match(/(?:linkedin\.com\/in\/|li\/)([\w-]+)/i);return t?`linkedin.com/in/${t[1]}`:!e.includes("/")&&!e.includes(".")?`linkedin.com/in/${e}`:e.replace(/^https?:\/\//,"")}function IP(e){if(!e)return"";const t=e.match(/(?:github\.com\/)([\w-]+)/i);return t?`github.com/${t[1]}`:!e.includes("/")&&!e.includes(".")?`github.com/${e}`:e.replace(/^https?:\/\//,"")}const _I=210,ji=297,wt=15,Jc=11,xI=_I-wt*2,On=Jc*.33*1.08,ld=ji-wt*2,bI=6,wI=1.5,SI=8,EI=10,vI=1.86,TI=1.95;function CI(e,t,n){if(!e||e.trim().length===0)return 1;const r=Math.floor(t/n);if(r<=0)return 1;const s=e.split(/\s+/);let o=1,i=0;for(const c of s){const l=c.length;i===0?i=l:i+1+l<=r?i+=1+l:(o++,i=l)}return o}function AI(e,t){let n=wt,r=1,s=0;if(t){t.fullName&&(n+=SI);const m=[];t.contactDetails?(t.contactDetails.location&&m.push(t.contactDetails.location),t.contactDetails.phone&&m.push(t.contactDetails.phone),t.contactDetails.email&&m.push(t.contactDetails.email),t.contactDetails.linkedin&&m.push(t.contactDetails.linkedin.replace(/^https?:\/\/(www\.)?linkedin\.com\/in\//,"linkedin.com/in/")),t.contactDetails.portfolio&&m.push(t.contactDetails.portfolio.replace(/^https?:\/\/(www\.)?/,""))):t.contactInfo&&m.push(t.contactInfo),m.length>0&&(n+=EI)}const o=Yt(e),i=hs(o),c=m=>{for(let g=m+1;g<i.length;g++){const _=Ee(i[g]);if(_)return _}return""};for(let m=0;m<i.length;m++){const g=Ee(i[m]);if(!g){const C=c(m);n+=tn(C)?On*1:On*.4,s++,n+On>ji-wt&&(r++,n=wt);continue}const _=tn(g),h=Wc(g),y=g.startsWith("- "),b=y?g.replace(/^-+\s*/,""):g,x=y?"- ":"",w=xI-(y?bI:0),E=_||h?TI:vI,T=CI(`${x}${b}`,w,E);for(let C=0;C<T;C++)n+On>ji-wt&&(r++,n=wt),n+=On,s++;_?n+=wI:h&&c(m).startsWith("- ")&&(n+=1.2)}const l=Math.floor(ld/On),u=n-wt,d=Math.round(u/ld*100),p=e.split(/\s+/).filter(m=>m.length>0).length;return{estimatedPages:r,totalRenderedLines:s,wordCount:p,lastPageY:n,linesPerPage:l,lastPageFillPercent:Math.min(100,Math.max(0,d))}}let _e=null;function II(e,t,n){const r=`parse_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;return _e={sessionId:r,fileName:e,fileType:t,fileSize:n,startTime:Date.now(),overallStatus:"success",operations:[],fieldResults:[],confidenceScore:0,usedOcrFallback:!1,isLinkedInPdf:!1},console.log(`[Parsing] Session started: ${r} for ${e} (${t}, ${n} bytes)`),r}function no(e,t,n,r,s,o,i){if(!_e){console.warn("[Parsing] No active session for operation recording");return}const c={operation:e,status:t,durationMs:n,inputSize:r,outputSize:s,errorMessage:o,metadata:i};_e.operations.push(c),t==="failed"?_e.overallStatus="failed":t==="partial"&&_e.overallStatus==="success"&&(_e.overallStatus="partial"),console.log(`[Parsing] ${e}: ${t} (${n}ms)`)}function RI(e,t,n,r){_e&&_e.fieldResults.push({field:e,extracted:t,confidence:n,source:r})}function kI(e){_e&&(_e.usedOcrFallback=e)}function NI(e){_e&&(_e.isLinkedInPdf=e)}function jI(e){const t=["fullName","experience","skills","education"],n={fullName:25,experience:30,skills:20,education:15,summary:5,contactInfo:5};let r=0,s=0;for(const i of e.fieldResults){const c=n[i.field]||1;r+=c,i.extracted&&(s+=c*i.confidence)}for(const i of t)e.fieldResults.find(l=>l.field===i&&l.extracted)||(s-=10);e.usedOcrFallback&&(s*=.85);const o=r>0?Math.max(0,Math.min(100,s/r*100)):0;return Math.round(o)}function ud(){if(!_e)return console.warn("[Parsing] No active session to end"),null;_e.endTime=Date.now(),_e.totalDurationMs=_e.endTime-_e.startTime,_e.confidenceScore=jI(_e);const e={..._e};return mc("resume_parsed",{sessionId:e.sessionId,fileType:e.fileType,fileSize:e.fileSize,totalDurationMs:e.totalDurationMs,overallStatus:e.overallStatus,confidenceScore:e.confidenceScore,usedOcrFallback:e.usedOcrFallback,isLinkedInPdf:e.isLinkedInPdf,operationCount:e.operations.length,fieldsExtracted:e.fieldResults.filter(t=>t.extracted).length,fieldsMissing:e.fieldResults.filter(t=>!t.extracted).length}),console.log(`[Parsing] Session ${e.sessionId} completed:`,{status:e.overallStatus,confidence:e.confidenceScore,duration:e.totalDurationMs,ocrUsed:e.usedOcrFallback}),_e=null,e}function eh(e,t,n){const r=t instanceof Error?t.message:String(t);_e&&no(e,"failed",0,0,void 0,r),Go("parsing_error",t,{operation:e,sessionId:_e==null?void 0:_e.
391sessionId,fileType:_e==null?void 0:_e.fileType,...n})}class ht{constructor(t,n){Le(this,"operation");Le(this,"startTime");Le(this,"inputSize");this.operation=t,this.startTime=Date.now(),this.inputSize=n}success(t,n){const r=Date.now()-this.startTime;no(this.operation,"success",r,this.inputSize,t,void 0,n)}partial(t,n){const r=Date.now()-this.startTime;no(this.operation,"partial",r,this.inputSize,t,void 0,n)}failed(t){const n=Date.now()-this.startTime,r=t instanceof Error?t.message:t;no(this.operation,"failed",n,this.inputSize,void 0,r)}}const LI=50,PI=10*1024*1024;async function dd(e,t,n=2){const r=await e.getPage(t),s=r.getViewport({scale:n}),o=document.createElement("canvas");o.width=s.width,o.height=s.height;const i=o.getContext("2d");if(!i)throw new Error("Failed to get canvas context");return await r.render({canvasContext:i,viewport:s}).promise,o.toDataURL("image/jpeg",.85)}async function pd(e,t){var o;const n=mt(),r=e.replace(/^data:image\/\w+;base64,/,""),s=`You are an expert OCR system. Extract ALL text from this resume image exactly as it appears. 392 393**CRITICAL INSTRUCTIONS:** 3941. Extract EVERY word, number, and symbol visible in the image 3952. Preserve the original layout and structure as much as possible 3963. Use line breaks to separate distinct lines of text 3974. Use consistent formatting for section headers 3985. Extract bullet points as "- " prefixed lines 3996. Preserve dates, company names, and job titles exactly as written 4007. Extract contact information (email, phone, URLs) accurately 4018. Do NOT add any commentary or interpretation 4029. Do NOT skip any text, even if it seems unimportant 403 404Output the extracted text only, with no additional formatting or explanation.`;try{return((o=(await n.models.generateContent({model:Ue.FLAGSHIP,contents:[{role:"user",parts:[{inlineData:{mimeType:"image/jpeg",data:r}},{text:`Extract ALL text from this resume image (page ${t}). Output the raw text only, preserving structure.`}]}],config:{systemInstruction:s,temperature:.1}})).text)==null?void 0:o.trim())||""}catch(i){throw console.error(`[OCR] Failed to extract text from page ${t}:`,i),i}}function OI(e){if(!e)return!1;const t=e.replace(/\s+/g," ").trim();if(t.length<LI)return!1;const n=/[a-zA-Z]{3,}/g,r=t.match(n);return r!==null&&r.length>=10}async function DI(e,t){const n=new ht("pdf_ocr_fallback",0);try{const r=e.numPages,s=[];console.log(`[OCR] Starting OCR extraction for ${r} pages`),kI(!0);for(let c=1;c<=r;c++){t==null||t(c,r),console.log(`[OCR] Processing page ${c}/${r}`);try{const l=await dd(e,c),u=l.length*3/4;if(u>PI){console.warn(`[OCR] Page ${c} image too large (${Math.round(u/1024/1024)}MB), reducing quality`);const d=await dd(e,c,1),p=await pd(d,c);s.push(p)}else{const d=await pd(l,c);s.push(d)}c<r&&await new Promise(d=>setTimeout(d,300))}catch(l){console.error(`[OCR] Failed to process page ${c}:`,l),s.push(`[Page ${c} extraction failed]`)}}const o=s.join(` 405 406--- Page Break --- 407 408`).trim(),i=MI(o,r);return n.success(o.length,{pageCount:r,confidence:i}),{text:o,confidence:i,pageCount:r,usedOcr:!0}}catch(r){throw n.failed(r),r}}function MI(e,t){if(!e)return 0;let n=50;const r=[/experience|employment|work history/i,/education|academic|degree/i,/skills|technologies|proficient/i,/email|phone|\d{3}[-.]?\d{3}[-.]?\d{4}/i,/[a-zA-Z]+@[a-zA-Z]+\.[a-zA-Z]+/];for(const o of r)o.test(e)&&(n+=8);const s=e.length/t;return s>500&&(n+=10),s>1e3&&(n+=10),/^\s*[-â¢*]\s/m.test(e)&&(n+=5),/^[A-Z][A-Z\s]+$/m.test(e)&&(n+=5),Math.min(95,n)}async function UI(e,t){var c;if(typeof window.pdfjsLib>"u")throw new Error("PDF parsing library is not loaded. Please refresh the page.");const n=window.pdfjsLib;n.GlobalWorkerOptions.workerSrc||(n.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.worker.min.js"),t==null||t("Loading PDF...",0);const r=await n.getDocument({data:e}).promise,s=r.numPages;t==null||t("Extracting text...",10);let o="";for(let l=1;l<=s;l++){const d=await(await r.getPage(l)).getTextContent();if((c=d==null?void 0:d.items)!=null&&c.length){const p=d.items.map(m=>m.str||"").join(" ");o+=p+` 409`}t==null||t(`Extracting page ${l}/${s}...`,10+l/s*40)}if(OI(o))return console.log("[PDF] Standard text extraction successful"),{text:o.trim(),confidence:95,pageCount:s,usedOcr:!1};console.log("[PDF] Standard extraction yielded insufficient text, falling back to OCR"),t==null||t("Scanned document detected, starting OCR...",50);const i=await DI(r,(l,u)=>{const d=50+l/u*50;t==null||t(`OCR processing page ${l}/${u}...`,d)});return t==null||t("OCR complete",100),i}const th=e=>{const t=["www.linkedin.com/in/","linkedin.com/in/","Downloaded from LinkedIn","Profile exported from LinkedIn","Skills & Endorsements","Recommendations","Volunteer Experience","Honors & Awards","Publications","Endorsed by","connections"],n=e.toLowerCase();let r=0;for(const s of t)n.includes(s.toLowerCase())&&r++;return r>=2},FI=()=>` 410This appears to be a LinkedIn profile export. Please note: 411 4121. SECTION HEADERS: LinkedIn uses these standard headers: 413 - "About" for professional summary 414 - "Experience" for work history 415 - "Education" for degrees 416 - "Skills & Endorsements" or "Skills" for skills list 417 - "Licenses & Certifications" for certifications 418 4192. EXPERIENCE FORMAT: LinkedIn experiences typically include: 420 - Job Title 421 - Company · Employment Type (Full-time, Part-time, etc.) 422 - Date range (Month Year - Month Year or Present) 423 - Location (City, State/Country) 424 - Description/accomplishments 425 4263. ENDORSEMENTS: Ignore skill endorsement counts (e.g., "Python (45+)") 427 4284. CONNECTIONS: Ignore connection count references 429 4305. RECOMMENDATIONS: While valuable, focus on extracting work experience details 431`.trim(),$I=e=>e.replace(/\s*\(\d+\+?\)/g,"").replace(/\s*·\s*(Full-time|Part-time|Contract|Freelance|Internship)/gi,"").replace(/\d+\+?\s+connections?/gi,"").replace(/Page \d+ of \d+/gi,"").replace(/\s+/g," ").trim(),RP=()=>["Make sure your LinkedIn profile is up-to-date before exporting","Include detailed descriptions for your roles and accomplishments","LinkedIn PDFs work best when exp
431orted from desktop (not mobile)","The AI will automatically extract and format your information","You can edit and refine everything after import"],BI=async e=>{const t=await fetch(e);if(!t.ok)throw new Error(`Failed to load file from uri: ${e}`);return await t.blob()},zI=async e=>{if(typeof File<"u"&&e instanceof File)return e;const t=e,n=await BI(t.uri);if(typeof File<"u")return new File([n],t.name,{type:t.type||n.type});throw new Error("File API is not available in this environment")},GI=async e=>{const t=await e.arrayBuffer(),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("")},nh=async(e,t)=>{const n=await zI(e);II(n.name,n.type||"unknown",n.size);const r=new ht("text_extraction",n.size);try{if(!n)throw new Error("No file provided for parsing.");const s=10*1024*1024;if(n.size>s)throw new Error(`File is too large (${(n.size/1024/1024).toFixed(2)}MB). Maximum size is 10MB.`);if(n.size<50)throw new Error("File appears to be empty or too small to parse.");if(n.type==="text/plain"||n.name.endsWith(".txt")){const o=new ht("text_extraction",n.size);return new Promise((i,c)=>{const l=new FileReader;l.onload=u=>{try{const d=u.target||u.currentTarget;if(!d||typeof d.result!="string")throw new Error("Failed to read text file content.");const p=d.result,m=Ee(p);if(!m||m.length<50)throw new Error("Text file is too short or empty.");o.success(m.length),r.success(m.length),i(m)}catch(d){o.failed(d),c(d)}},l.onerror=()=>{o.failed(new Error("FileReader error")),c(new Error("Failed to read the text file."))},l.readAsText(n)})}if(n.type==="application/pdf"){const o=new ht("pdf_text_extraction",n.size);try{const i=await n.arrayBuffer(),c=await UI(i,t);return th(c.text)&&NI(!0),o.success(c.text.length,{usedOcr:c.usedOcr}),r.success(c.text.length),c.text}catch(i){throw o.failed(i),i}}if(n.type==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"){const o=new ht("docx_extraction",n.size);try{const i=await n.arrayBuffer();if(typeof mammoth>"u")throw new Error("DOCX parsing library is not loaded.");let c="";try{const u=await mammoth.convertToHtml({arrayBuffer:i});if(u!=null&&u.value){const d=document.createElement("div");d.innerHTML=u.value,c=d.textContent||d.innerText||""}}catch{console.warn("HTML conversion failed, falling back to raw text")}(!c||Ee(c).length===0)&&(c=(await mammoth.extractRawText({arrayBuffer:i})).value||"");const l=Ee(c);if(!l)throw new Error("DOCX contains no readable text.");return o.success(l.length),r.success(l.length),l}catch(i){throw o.failed(i),i}}if(n.type==="application/rtf"||n.name.endsWith(".rtf")){const o=new ht("text_extraction",n.size);return new Promise((i,c)=>{const l=new FileReader;l.onload=u=>{try{const d=u.target||u.currentTarget;if(!d||typeof d.result!="string")throw new Error("Failed to read RTF file content.");const p=`[RTF SOURCE DOCUMENT] 432 433${d.result}`;o.success(p.length),r.success(p.length),i(p)}catch(d){o.failed(d),c(d)}},l.readAsText(n)})}throw new Error(`Unsupported file type: ${n.type||"unknown"}.`)}catch(s){throw r.failed(s),eh("text_extraction",s),s}},kP=(e,t,n,r,s)=>{const o=i=>{console.error(i),r&&r(i)};try{let i=22,c=276,l=80,u=120,d=40,p=40,m=20;if(s)try{const x=AI(e,n||void 0);if(x.estimatedPages!==s){const w=x.estimatedPages>s;console.log(`[exportToDocx] Page estimate: ${x.estimatedPages} (target: ${s}). Adjusting formatting...`),w?(i=21,c=252,l=40,u=80,d=20,p=20,m=10):(i=23,c=300,l=120,u=160,d=60,p=60,m=40)}}
433catch(x){console.warn("[exportToDocx] Page estimation failed (non-blocking):",x==null?void 0:x.message)}const g=[];if(n){n.fullName&&g.push(new _s({children:[new xs({text:n.fullName.toUpperCase(),bold:!0,font:"Calibri",size:32})],alignment:"center",spacing:{after:120}}));const x=[];if(n.contactDetails){if(n.contactDetails.location&&x.push(n.contactDetails.location),n.contactDetails.phone&&x.push(n.contactDetails.phone),n.contactDetails.email&&x.push(n.contactDetails.email),n.contactDetails.linkedin){const w=n.contactDetails.linkedin.replace(/^https?:\/\/(www\.)?linkedin\.com\/in\//,"linkedin.com/in/");x.push(w)}if(n.contactDetails.portfolio){const w=n.contactDetails.portfolio.replace(/^https?:\/\/(www\.)?/,"");x.push(w)}}else n.contactInfo&&x.push(n.contactInfo);x.length>0&&g.push(new _s({children:[new xs({text:x.join(" | "),font:"Calibri",size:20})],alignment:"center",spacing:{after:200}}))}const _=Yt(e),y=hs(_).map(x=>{const w=Ee(x);if(!w)return new _s({children:[new xs("")],spacing:{after:l}});const E=tn(w),T=Wc(w),C=w.startsWith("- "),S=C?w.replace(/^-+\s*/,""):w;return new _s({children:[new xs({text:C?`- ${S}`:S,bold:E||T,allCaps:E,font:"Calibri",size:i})],spacing:{before:E?u:p,after:E?d:m},indent:C?{left:540}:void 0})});g.push(...y);const b=new Uh({sections:[{properties:{},children:g}],styles:{paragraphStyles:[{id:"Normal",name:"Normal",basedOn:"Normal",next:"Normal",run:{font:"Calibri",size:i},paragraph:{spacing:{line:c}}}]}});Fh.toBlob(b).then(x=>{const w=URL.createObjectURL(x),E=document.createElement("a");E.href=w,E.download=t,document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(w)}).catch(()=>{o("Failed to generate document. The text may contain unsupported characters. Please try again or copy the text manually.")})}catch{o("Failed to initialize document generator. Please try refreshing the page.")}},ja={fontSize:Jc,margin:wt,lineSpacingMultiplier:1};function md(e,t,n,r){e.setFont("Helvetica","normal"),e.setFontSize(r.fontSize);const s=e.internal.pageSize.getHeight(),o=e.internal.pageSize.getWidth(),i=r.margin,c=o-i*2;let l=i;if(n){if(n.fullName){e.setFontSize(16),e.setFont("Helvetica","bold");const _=e.getTextWidth(n.fullName.toUpperCase());e.text(n.fullName.toUpperCase(),(o-_)/2,l),l+=8}const g=[];if(n.contactDetails){if(n.contactDetails.location&&g.push(n.contactDetails.location),n.contactDetails.phone&&g.push(n.contactDetails.phone),n.contactDetails.email&&g.push(wn(n.contactDetails.email)),n.contactDetails.linkedin){const _=n.contactDetails.linkedin.replace(/^https?:\/\/(www\.)?linkedin\.com\/in\//,"linkedin.com/in/");g.push(_)}if(n.contactDetails.portfolio){const _=n.contactDetails.portfolio.replace(/^https?:\/\/(www\.)?/,"");g.push(_)}}else n.contactInfo&&g.push(n.contactInfo);if(g.length>0){e.setFontSize(10),e.setFont("Helvetica","normal");const _=g.join(" | "),h=e.getTextWidth(_);e.text(_,(o-h)/2,l),l+=10}}e.setFontSize(r.fontSize),e.setFont("Helvetica","normal");const u=Yt(t),d=hs(u),p=e.getFontSize()*.33*1.08*r.lineSpacingMultiplier,m=g=>{for(let _=g+1;_<d.length;_++){const h=Ee(d[_]);if(h)return h}return""};for(let g=0;g<d.length;g++){const _=Ee(d[g]);if(!_){const S=m(g);l+=tn(S)?p*1:p*.4;continue}const h=tn(_),y=Wc(_),b=_.startsWith("- "),x=b?_.replace(/^-+\s*/,""):_,w=b?"- ":"",E=b?i+4:i,T=c-(b?8:0);if(e.setFont("Helvetica",h||y?"bold":"normal"),e.splitTextToSize(`${w}${x}`,T).forEach(S=>{l+p>s-i&&(e.addPage(),l=i),e.text(S,E,l),l+=p}),h){const S=l-p*.45;e.setDrawColor(100,100,100),e.setLineWidth(.3),e.line(i,S,o-i,S),e.setDrawColor(0),l+=2}else y&&m(g).startsWith("- ")&&(l+=1.2)}return e.getNumberOfPages()}const NP=(e,t,n,r,s)=>{try{const{jsPDF:o}=jspdf,i=()=>new o({orientation:"p",unit:"mm",format:"a4"});let c=i(),l=md(c,e,n,ja);if(r&&l!==r){console.log(`[exportToPdf] Initial render: ${l} pages (target: ${r}). Attempting format adjustment...`);const u=l>r;let d={...ja},p=l,m=c;const g=u?[.95,.9,.85]:[1.05,1.1,1.15],_=u?[10.5,10]:[11.5,12],h=u?[14,13,12]:[16,17,18],y=x=>{const w=i();return[w,md(w,e,n,x)]};for(const x of g){const w={...ja,lineSpacingMultiplier:x},[E,T]=y(w);if(T===r){d=w,p=T,m=E;break}Math.abs(T-r)<Math.abs(p-r)&&(d=w,p=T,m=E)}if(p!==r)for(const x of _){const w={...d,fontSize:x},[E,T]=y(w);if(T===r){d=w,p=T,m=E;break}Math.abs(T-r)<Math.abs(p-r)&&(d=w,p=T,m=E)}if(p!==r)for(const x of h){const w={...d,margin:x},[E,T]=y(w);if(T===r){d=w,p=T,m=E;break}Math.abs(T-r)<Math.abs(p-r)&&(d=w,p=T,m=E)}c=m;const b=[];d.lineSpacingMultiplier!==1&&b.push(`spacing: ${d.lineSpacingMultiplier.toFixed(2)}`),d.fontSize!==Jc&&b.push(`font: ${d.fontSize}
433pt`),d.margin!==wt&&b.push(`margin: ${d.margin}mm`),b.length>0&&console.log(`[exportToPdf] Adjusted to ${p} pages (${b.join(", ")})`),p!==r&&console.warn(`[exportToPdf] Could not achieve ${r} pages. Best result: ${p} pages.`)}c.save(t)}catch(o){const i="Failed to generate PDF. Please try again or use Copy Text.";console.error("[exportToPdf]",o),s&&s(i)}},rh="__CD_FileContext__",Vc=globalThis[rh]??f.createContext(void 0);globalThis[rh]=Vc;const HI=()=>{const e=f.useContext(Vc);if(!e)throw new Error("useFiles must be used within a FileProvider");return e},WI=({children:e})=>{Zf();const[t,n]=f.useState({corpusFiles:[],isUploadingFile:!1,fileUploadError:null}),r=f.useCallback(async(u,d,p)=>{let m="init";n(g=>({...g,isUploadingFile:!0,fileUploadError:null}));try{console.log("[FileContext] Starting upload:",u.name),m="gcs_storage",console.log("[FileContext] Step 1: Uploading to Google Cloud Storage...");const{uploadToGCS:g}=await D(async()=>{const{uploadToGCS:R}=await import("./gcsStorageService-CfuPNSR4.js");return{uploadToGCS:R}},__vite__mapDeps([0,1,2,3,4,5])),_=Date.now(),h=u.name.replace(/[^a-zA-Z0-9._-]/g,"_"),y=`${_}_${h}`,b=await g(u,d,y);console.log("[FileContext] Step 1 complete:",b),m="parse_file",console.log("[FileContext] Step 2: Parsing file content...");const x=await nh(u);console.log("[FileContext] Step 2 complete, content length:",x.length);let w,E=1;if(p)w=p,E=1,console.log("[FileContext] Using user-provided category:",w);else{m="ai_categorization",console.log("[FileContext] Step 4: AI categorization...");const{categorizeWithAI:R}=await D(async()=>{const{categorizeWithAI:O}=await import("./documentCategorizationService-CgIkAT40.js");return{categorizeWithAI:O}},__vite__mapDeps([6,1,2,3,4,5])),N=await R(x,u.name,u.type);w=N.category,E=N.confidence,console.log(`[FileContext] Step 4 complete: "${w}" (${(E*100).toFixed(0)}%)`)}m="create_metadata",console.log("[FileContext] Calculating file hash...");const T=await GI(u);console.log("[FileContext] File hash:",T);const C={name:`gcs-${_}-${h}`,displayName:u.name,createTime:new Date().toISOString(),sizeBytes:u.size.toString(),mimeType:u.type,category:w,supabaseStoragePath:b,fileHash:T,isDefault:!1,extractedText:x};m="save_to_db",console.log("[FileContext] Step 4: Saving to database with GCS path...");const S=await RC(d,C);console.log("[FileContext] Step 4 complete, saved as:",S.name,"GCS path:",b),n(R=>({...R,corpusFiles:[S,...R.corpusFiles]})),te("upload_corpus_file",{category:w,confidence:E}),console.log("[FileContext] Step 6: Extracting accomplishments for review from",w);let A=[];try{A=(await Co(x)).map((N,O)=>{let k="";return N.description?k=N.description:N.actionTaken&&N.resultAchieved?k=`${N.actionTaken} resulting in ${N.resultAchieved}`:N.actionTaken?k=N.actionTaken:N.resultAchieved?k=N.resultAchieved:k="Accomplishment extracted from document",{...N,id:`acc-${Date.now()}-${O}`,sourceFileId:S.name,source:"Extraction",description:k,skills:N.skills||[]}}),console.log(`[FileContext] Extracted ${A.length} accomplishments for review`)}catch(R){console.warn("[FileContext] Accomplishment extraction failed (non-fatal):",R),A=[]}return console.log("[FileContext] Upload complete:",S.name),{savedFile:S,extractedAccomplishments:A,fileContent:x}}catch(g){throw console.error(`[FileContext] Failed at step: ${m}`,g),Go("corpus_file_upload",g,{step:m,fileName:u.name,fileSize:u.size,fileType:u.type,userId:d}),n(_=>({..._,fileUploadError:`Upload failed at ${m}: ${g.message||"Unknown error"}`})),g}finally{n(g=>({...g,isUploadingFile:!1}))}},[]),s=f.useCallback(async(u,d)=>{try{console.log("[FileContext] Deleting file:",u);const p=t.corpusFiles.find(m=>m.name===u);if(u.startsWith("files/"))try{await eI(u),console.log("[FileContext] Deleted from Gemini")}catch(m){console.warn("[FileContext] Failed to delete from Gemini (non-blocking):",m.message)}else console.log("[FileContext] Skipping Gemini deletion (file not in Gemini)");if(p!=null&&p.supabaseStoragePath)try{const{deleteFromGCS:m}=await D(async()=>{const{deleteFromGCS:g}=await import("./gcsStorageService-CfuPNSR4.js");return{deleteFromGCS:g}},__vite__mapDeps([0,1,2,3,4,5]));await m(p.supabaseStoragePath),console.log("[FileContext] Deleted from GCS")}catch(m){console.warn("[FileContext] Failed to delete from GCS (non-blocking):",m.message)}await jC(d,u),console.log("[FileContext] Deleted from database"),n(m=>({...m,corpusFiles:m.corpusFiles.filter(g=>g.name!==u)})),te("delete_corpus_file"),console.log("[FileContext] Delete complete:",u)}catch(p){throw console.error("[FileContext] Delete failed:",p),n(m=>({...m,fileUploadError:`Delete failed: ${p.message||"Unknown error"}`})),p}},[t.corpusFiles]),o=f.useCallback(()=>{n(u=>({...u,fileUploadError:null}))},[]),i=f.useCallback(u=>{n(d=>({...d,corpusFiles:u}))},[]),c=f.useCallback(async u=>{try{console.log("[FileContext] Setting default resume:",u),await LC(u),n(d=>({...d,corpusFiles:d.corpusFiles.map(p=>({...p,isDefault:p.name===u}))})),te("set_default_resume")}catch(d){throw console.error("[FileContext] Failed to set default resume:",d),d}},[]),l={...t,uploadFile:r,deleteFile:s,clearError:o,setCorpusFiles:i,setDefaultResume:c};return a.jsx(Vc.Provider,{value:l,children:e})},Li=e=>{var t,n,r,s,o;return!!(e&&((t=e.experience)!=null&&t.length||(n=e.skills)!=null&&n.length||(r=e.education)!=null&&r.length||(s=e.summary)!=null&&s.trim()||(o=e.fullName)!=null&&o.trim()))},fd=(e,t)=>Li(e)||!Li(t),JI=/Gemini proxy error:\s*(\d{3})\s*-\s*([\s\S]*)$/,VI=e=>{const t=JI.exec(e??"");if(!t)return null;const n=Number(t[1]),r=t[2].trim();let s,o;try{const i=JSON.parse(r);i&&typeof i=="object"&&(typeof i.code=="string"&&(s=i.code),typeof i.error=="string"?o=i.error:typeof i.message=="string"&&(o=i.message))}catch{}return{status:n,code:s,serverMessage:o}},YI=e=>{const t=VI(e);if(!t)return null;const{status:n,code:r}=t;return n===403&&r===Lm?Pm():n===402||r==="AI_CREDITS_EXHAUSTED"?"You have used today's free AI credits. Sign in or upgrade to keep going, or try again tomorrow.":n===401?"Your session has expired. Sign in again and retry.":n===429?"Too many requests right now. Wait a minute and try again.":n>=500?"The AI service is temporarily unavailable. Your text is still here â try again in a moment.":null},sh=[{key:"summary",title:"Professional Summary",patterns:[/^summary$/i,/^professional summary$/i,/^career profile$/i,/^about( me)?$/i,/^profile$/i,/^objective$/i,/^career objective$/i]},{key:"experience",title:"Experience",patterns:[/^experience$/i,/^professional experience$/i,/^work experience$/i,/^employment$/i,/^work history$/i,/^professional (background|history)$/i,/^career (history|background)$/i]},{key:"education",title:"Education",patterns:[/^education$/i,/^academic background$/i,/^education & credentials$/i,/^academic (history|qualifications)$/i]},{key:"skills",title:"Skills",patterns:[/^skills$/i,/^core competencies$/i,/^technical skills$/i,/^key skills$/i,/^expertise$/i,/^technical expertise$/i]},{key:"projects",title:"Projects",patterns:[/^projects$/i,/^selected projects$/i,/^key projects$/i]},{key:"certifications",title:"Certifications",patterns:[/^certifications$/i,/^licenses$/i,/^professional certifications$/i]},{key:"awards",title:"Awards",patterns:[/^awards$/i,/^honors$/i,/^recognition$/i,/^achievements$/i]},{key:"volunteer",title:"Volunteer",patterns:[/^volunteer$/i,/^volunteer experience$/i,/^community$/i,/^community involvement$/i]}],qI=["Bachelor","Bachelors","BA","BS","BSc","AB","BEng","Master","Masters","MA","MS","MSc","MBA","MPA","MEng","Doctor","PhD","Ph.D","JD","MD","Associate","Diploma","Certificate"],hd=["January","February","March","April","May","June","July","August","September","October","November","December","Jan","Feb","Mar","Apr","Jun","Jul","Aug","Sept","Sep","Oct","Nov","Dec","Spring","Summer","Fall","Autumn","Winter"],ro=/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/i,so=/(\+?\d[\d()\s.-]{7,}\d)/,Pi=/(linkedin\.com\/[^\s]+|github\.com\/[^\s]+|portfolio|behance\.net\/[^\s]+|dribbble\.com\/[^\s]+)/i,Bt=e=>e.replace(/[\t\u00A0]/g," ").replace(/\s+/g," ").trim(),gd=e=>e.replace(/\r\n?/g,` 434`).replace(/[â¢âââ¦âª]/g,"-").replace(/\u00A0/g," ").replace(/[""]/g,'"').replace(/['']/g,"'").replace(/[ââ]/g,"-").replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\u000B\u000C]/g,` 435`).replace(/[\u0000-\u0008\u000E-\u001F\u007F-\u009F]/g,"").split(` 436`).map(t=>{const n=t.trimEnd();return n?/^[-*]\s{0,2}[A-Za-z0-9]/.test(n)?n.replace(/^[-*]\s*/,"- "):Bt(n):""}).join(` 437`).replace(/\n{3,}/g,` 438 439`),KI=e=>{const t=Bt(e).replace(/[:]+$/,"");return sh.some(n=>n.patterns.some(r=>r.test(t)))},XI=e=>{const t=Bt(e).replace(/[:]+$/,"");for(const n of sh)if(n.patterns.some(r=>r.test(t)))return{key:n.key,title:n.title};return null},ZI=e=>{const t=e.split(` 440`),n=[];let r={key:"general",title:"General",content:""};const s=()=>{const c=r.content.trim();c&&n.push({...r,content:c})};for(const c of t){if(!c.trim()){r.content+=` 441`;continue}if(KI(c)){s();const l=XI(c);r={key:(l==null?void 0:l.key)||"general",title:(l==null?void 0:l.title)||Bt(c),content:""};continue}r.content+=`${c} 442`}s();const o=[],i={};
442return n.forEach(c=>{i[c.key]?i[c.key].content+=` 443${c.content}`:i[c.key]={...c}}),Object.values(i).forEach(c=>{o.push({...c,content:c.content.trim()})}),o},oh=e=>{if(!e)return!1;const t=e.split(/\s+/).filter(Boolean);return t.length<2||t.length>5?!1:/^[A-Za-z ,.'-]+$/.test(e)},QI=e=>{const t=/[|\/â¢Â·\u2022\u2027\u00B7\-ââ]+/,n=e.split(t).map(r=>Bt(r)).filter(Boolean);for(const r of n)if(!(ro.test(r)||so.test(r)||Pi.test(r))&&oh(r))return r},e2=(e,t)=>{var p;const r=(((p=e.find(m=>m.key==="general"))==null?void 0:p.content)||t).split(` 444`).map(m=>Bt(m)).filter(Boolean).slice(0,8);let s;const o=[],i=[],c=[],l=[];for(const m of r){if(!s)if(oh(m)&&!ro.test(m)&&!so.test(m))s=m;else{const y=QI(m);y&&(s=y)}(ro.test(m)||so.test(m)||Pi.test(m))&&o.push(m);const g=m.match(ro);if(g){const y=m.slice(0,m.indexOf(g[0])),b=/[A-Z]{2,}/.test(y)&&!/[a-z]/.test(y);i.push({value:g[0],capsHeaderContext:b})}const _=m.match(so);_&&c.push(_[0]);const h=m.match(Pi);h&&l.push(h[0])}const u=(s||"").split(/\s+/).filter(Boolean),d=i.map(m=>wn(m.value,{nameTokens:u,capsHeaderContext:m.capsHeaderContext}));return{probableName:s,contactInfo:o.length?Array.from(new Set(o)).join(" | "):void 0,contactLines:o,emails:Array.from(new Set(d)),phones:Array.from(new Set(c)),links:Array.from(new Set(l))}},t2=e=>{if(!e)return[];const t=e.replace(/\n/g,",").split(/[,;|]/).map(n=>Bt(n.replace(/^-/,"").trim())).filter(Boolean);return Array.from(new Set(t)).filter(n=>n.length<=64)},n2=new RegExp(`\\b(${qI.join("|")})[A-Za-z0-9 .,&()-]*`,"i"),r2=new RegExp(`((${hd.join("|")})\\.?\\s*\\d{4})|(\\b(19|20)\\d{2}\\b(?:\\s*[-â]\\s*(?:Present|Current|((?:${hd.join("|")})\\.?\\s*)?(19|20)?\\d{2}))?)`,"i"),s2=e=>{if(!e)return[];const t=e.split(/\n{2,}/).map(r=>r.trim()).filter(Boolean),n=[];return t.forEach(r=>{const s=r.split(` 445`).map(d=>Bt(d)).filter(Boolean);if(!s.length)return;const o=s.join(" "),i=o.match(n2),c=o.match(r2);let l=i?i[0].trim():s[1]||s[0],u=s[0];l&&u&&u.toLowerCase().includes(l.toLowerCase())&&(u=s[1]||u),n.push({degree:l||"",university:u||"",dates:c?Bt(c[0]):""})}),n},gs={type:U.OBJECT,properties:{fullName:{type:U.STRING,description:"Full name as it appears on the resume (e.g., 'John Smith' or 'Jane A. Doe')"},firstName:{type:U.STRING,description:"First name extracted from fullName (e.g., 'John' from 'John Smith')"},lastName:{type:U.STRING,description:"Last name extracted from fullName (e.g., 'Smith' from 'John Smith')"},contactInfo:{type:U.STRING,description:"ONLY include contact information: email, phone, LinkedIn URL, GitHub URL, or website URL. Use format: 'email | phone | linkedin.com/in/username | github.com/username | website.com'. DO NOT include: full name, location, summary text, job description, or any other content. Extract ONLY from the header/contact section of the resume."},contactDetails:{type:U.OBJECT,description:"Structured contact information. DO NOT include location here.",properties:{email:{type:U.STRING,description:"Email address (e.g., '[email protected]')"},phone:{type:U.STRING,description:"Phone number (e.g., '+1-555-123-4567' or '(555) 123-4567')"},linkedIn:{type:U.STRING,description:"LinkedIn profile URL or handle (e.g., 'linkedin.com/in/johnsmith')"},github:{type:U.STRING,description:"GitHub profile URL or handle (e.g., 'github.com/johnsmith')"},website:{type:U.STRING,description:"Personal website or portfolio URL"}}},location:{type:U.STRING,description:"Primary location in 'City, State' or 'City, Country' format (e.g., 'San Francisco, CA' or 'New York, NY'). Extract from header or most recent job location."},summary:{type:U.STRING},experience:{type:U.ARRAY,items:{type:U.OBJECT,properties:{id:{type:U.STRING,description:"A unique identifier, can be generated like exp1, exp2..."},jobTitle:{type:U.STRING},company:{type:U.STRING},location:{type:U.STRING},dates:{type:U.STRING},description:{type:U.ARRAY,items:{type:U.STRING},description:"The original bullet points from the resume."}},required:["id","jobTitle","company","dates","description"]}},education:{type:U.ARRAY,items:{type:U.OBJECT,properties:{id:{type:U.STRING,description:"A unique identifier, e.g., edu1"},degree:{type:U.STRING},university:{type:U.STRING},dates:{type:U.STRING}},required:["id","degree","university","dates"]}},skills:{type:U.ARRAY,items:{type:U.STRING}},locked:{type:U.BOOLEAN,description:"Optional flag to freeze edits once the diary is finalized."}}},o2={type:U.OBJECT,properties:{mergedProfile:gs,mergeSummary:{type:U.STRING,description:"A concise, human-readable summary of the changes made during the merge. Focus on what was added or updated. Start with 'I have...' e.g., 'I have updated your summary, added the Senior Product Manager role, and combined your skills.'"}},required:["mergedProfile","mergeSummary"]},a2=gs.properties.experience,i2=gs.properties.education,c2=gs.properties.skills,l2="You are an expert career document manager. Your task is to intelligently merge a new resume's information into a user's existing structured 'Career Diary' profile. The master profile serves as a comprehensive, single source of truth.\n\n**Rules:**\n1. **Analyze Existing Profile:** First, understand the structure and content of the existing JSON profile provided.\n2. **Analyze New Content:** Parse the new resume text to identify all sections.\n3. **Merge Intelligently:**\n * **De-duplicate Experience:** If a job from the new text (based on company and title) already exists in the old profile, merge them. Add any new, unique bullet points from the new text as new 'accomplishments' to the existing job's entry in the `mergedProfile`. Do not remove existing accomplishments unless they are clearly redundant.\n * **Add New Experience:** If a job from the new text is completely new, add it as a new experience object to the `mergedProfile`.\n * **Organize Chronologically:** Ensure the final work experience array in the `mergedProfile` is in reverse chronological order (most recent first).\n * **Update Core Info:** Use the `fullName`, `contactInfo`, and `summary` from the **new resume text** as the primary source of truth for these fields in the `mergedProfile`.\n * **Merge Skills:** Combine the skills from both the old profile and the new resume text, ensuring there are no duplicates in the final list.\n * **Merge Education:** Add any new educational entries. De-duplicate based on degree and university.\n4. **Summarize Actions:** Create a concise `mergeSummary` explaining the key actions taken.\n5. **Output:** Your final output MUST be a single JSON object with two keys: \"mergedProfile\" and \"mergeSummary\". The `mergedProfile` must conform to the provided schema. Do not add any commentary or markdown.",u2=`You are an expert resume parser. Convert the provided normalized resume sections into a JSON object that follows the supplied schema exactly. 446 447**CRITICAL: NAME EXTRACTION:** 448- The fullName field is the MOST IMPORTANT field - extract it from the very top of the resume (usually the first line or header) 449- fullName should be the person's complete name as it appears on the resume (e.g., "John Smith", "Jane A. Doe", "Maria Garcia") 450- Extract firstName as the first word of fullName (e.g., "John" from "John Smith") 451- Extract lastName as the last word of fullName (e.g., "Smith" from "John Smith") 452- If the name appears in the header or first few lines, use that exact name 453- Do NOT use job titles, company names, or other text as the name 454- The name is typically at the very top of the resume, before any other content 455 456**CRITICAL: PREVENT VERBATIM COPY-PASTE OF LONG TEXT:** 457- Extract all information comprehensively, but do NOT copy page-long paragraphs verbatim 458- For work experience descriptions: Extract key bullet points and accomplishments. If a description is extremely long (more than 200 words), extract the most important points rather than copying everything verbatim
459- For summaries: Extract the key points. If the summary is very long, extract the most important 2-4 sentences 460- Preserve all factual information (job titles, companies, dates, locations, achievements) exactly as written 461- But for narrative text (descriptions, summaries), extract and structure the information rather than copying huge blocks verbatim 462 463**Rules:** 464- Respect every section boundary 465- Extract all accomplishments, dates, and location strings 466- Never drop important information 467- If a section is missing, return an empty array for it 468- Do not invent information 469- For long text blocks, extract key points rather than copying verbatim 470- **PRIORITY: Extract the name from the top of the resume - it's usually the first line or in the header section** 471 472Respond with JSON only.`,d2=`You specialize in extracting structured work experience from resume text. Given only the Experience section, output an array of jobs sorted from most recent to oldest. 473 474**CRITICAL: PREVENT VERBATIM COPY-PASTE OF LONG TEXT:** 475- Extract all accomplishments and responsibilities comprehensively 476- If a job description is extremely long (more than 200 words per entry), extract the most important and impactful points 477- Do NOT copy huge paragraphs or page-long text verbatim - extract key achievements, results, and responsibilities 478- Preserve dates, job titles, and company names exactly as written 479- For descriptions: Extract key bullet points. If the original is very long, condense to the most important accomplishments (3-6 sentences, 15-150 words per accomplishment) 480 481**Rules:** 482- Preserve dates exactly 483- Extract all accomplishments and responsibilities 484- Sort from most recent to oldest 485- Do not add commentary 486- Do not copy page-long text verbatim - extract and structure the information`,p2="You specialize in extracting structured education history from resume text. Given only the Education section, return an array of entries with degree, university, and date strings exactly as written. No commentary.",m2="You specialize in extracting skills lists from resumes. Return a simple array of individual skills/technologies derived from the provided section. Drop duplicates and blank strings.",f2=async(e,t)=>{const n=mt(),r=` 487--- 488**EXISTING PROFILE (CAREER DIARY):** 489${JSON.stringify(e,null,2)} 490--- 491**NEW PROFILE CANDIDATE (STRUCTURED JSON):** 492${JSON.stringify(t,null,2)} 493--- 494Please merge the new resume into the existing profile according to the rules. 495`;try{const s=await n.models.generateContent({model:Ue.STANDARD,contents:[{role:"user",parts:[{text:r}]}],config:{systemInstruction:l2,responseMimeType:"application/json",responseSchema:o2}}),o=JSON.parse((s.text||"").trim());if(!o.mergedProfile||!o.mergeSummary)throw new Error("AI response for merging is missing required fields.");return ah(o.mergedProfile.experience),o}catch(s){throw console.error("Error merging profiles:",s),new Error("The AI could not merge the new resume with your profile.")}},h2=async(e,t)=>{const n=mt(),r=new ht("llm_json_conversion",e.length);try{const s=th(e);console.log(`[ProfileService] LinkedIn PDF detected: ${s}`);const o=s?$I(gd(e)):gd(e),i=new ht("section_segmentation",o.length),c=ZI(o);if(!c||c.length===0)throw i.failed("No sections found"),new Error("Resume text could not be parsed into sections. Please ensure your resume has clear section headings (e.g., Experience, Education, Skills).");i.success(c.length);const l=new ht("identity_extraction",o.length),u=e2(c,o);l.success();const d=g2(c);if(!d||d.trim().length===0)throw new Error("Resume sections are empty. Please ensure your resume has clear section headings with content.");const p=y2(u),g=["You will be given normalized resume sections. Convert them into structured JSON that follows the schema.",p?`Identity hints: 496${p}`:"",s?FI():"","Sections:",d||""].filter(Boolean).join(` 497 498`).trim();if(!g||typeof g!="string"||g.length<10)throw new Error("Resume text is too short or cannot be parsed into sections. Please ensure your resume has clear section headings (e.g., Experience, Education, Skills).");const _=new ht("llm_json_conversion",g.length);try{const h=await Qo(n,g,u2,gs);_.success(JSON.stringify(h).length);const y=new ht("profile_enrichment",JSON.stringify(h).length),b=await x2(n,h,c,u,t);y.success(JSON.stringify(b).length);const x=ih(b),w=(T,C,S=.9)=>{const A=!!C&&(Array.isArray(C)?C.length>0:!0);let R=S;A?typeof C=="string"&&C.length<3&&(R*=.5):R=0,RI(T,A,R,"ai")};w("fullName",x.fullName,.95),w("experience",x.experience,.9),w("education",x.education,.85),w("skills",x.skills,.8),w("summary",x.summary,.85),w("contactInfo",x.contactInfo,.9),r.success(JSON.stringify(x).length);const E=ud();return E&&(x.parsingConfidence=E.confidenceScore,x.parsingSessionId=E.sessionId),x}catch(h){throw _.failed(h),h}}catch(s){r.failed(s),eh("llm_json_conversion",s),ud(),console.error("Error parsing resume to JSON:",s);const o=s instanceof Error?s.message:String(s),i=YI(o);throw i?new Error(i):o.includes("JSON")?new Error("The AI returned an invali
498d response format. Please try uploading a clearer resume or a different file format."):o.includes("timeout")?new Error("Resume parsing timed out. Your resume may be too large or complex. Try a simpler format."):new Error("The AI could not read this resume's structure. Please ensure it's a standard resume format with clear section headings.")}},g2=e=>e.length?e.map(t=>`### ${t.title} 499${t.content}`).join(` 500 501`).trim():"",y2=e=>{var s,o;const t=[],n=e.contactInfo?$n(e.contactInfo):void 0,r=[n==null?void 0:n.email,n==null?void 0:n.phone,n==null?void 0:n.linkedIn,n==null?void 0:n.github,(n==null?void 0:n.website)||(n==null?void 0:n.portfolio)].filter(Boolean);return e.probableName&&t.push(`Probable full name: ${e.probableName}`),r.length&&t.push(`Contact details detected: ${r.join(" | ")}`),(s=e.emails)!=null&&s.length&&t.push(`Emails: ${e.emails.map(i=>wn(i)).join(", ")}`),(o=e.phones)!=null&&o.length&&t.push(`Phone numbers: ${e.phones.join(", ")}`),t.join(` 502`)},Rs=(e,t)=>{var n,r;return((r=(n=e.find(s=>s.key===t))==null?void 0:n.content)==null?void 0:r.trim())??""},_2=async(e,t,n)=>{var i,c,l;const r=t.split(/\s+/).filter(Boolean).length,s=`You are an expert career writer. Transform the provided resume summary into a polished, professional narrative summary. 503 504**CRITICAL REQUIREMENTS:** 5051. **TRUTHFULNESS (MOST IMPORTANT):** Only include information that can be verified from the source text. Do NOT invent metrics, achievements, or details. 5062. **Length:** 2-4 sentences (20-100 words). Be concise and impactful, but comprehensive enough to be meaningful. 5073. **Style:** Professional, clear, and results-focused. Avoid fluff or generic statements. 5084. **Grammar & Spelling:** Use correct grammar, spelling, and punctuation. 5095. **Context:** The summary should make sense on its own and accurately represent the person's background. 510 511**CRITICAL: PREVENT VERBATIM COPY-PASTE:** 512${r>150?"- **The source text is VERY LONG** - you MUST condense it significantly. Extract only the most important points.":""} 513- If the source text is long (more than 100 words), extract and refine the most important 2-4 sentences 514- If the source text is too short, expand it ONLY with information that's clearly implied from the experience section 515- **Rewrite in a natural, narrative style - NOT verbatim copy-paste** 516- Focus on role, key strengths, and standout achievements 517- Ensure every claim can be verified from the source material 518- **Do NOT copy long paragraphs verbatim - always rewrite and condense**`,o=` 519**SOURCE SUMMARY TEXT:** 520${t} 521 522**ADDITIONAL CONTEXT (from parsed profile):** 523${((i=n.experience)==null?void 0:i.length)>0?`Most recent role: ${(c=n.experience[0])==null?void 0:c.jobTitle} at ${(l=n.experience[0])==null?void 0:l.company}`:"No experience data available"} 524 525**TASK:** 526Transform the source summary into a polished, professional narrative summary (2-4 sentences, 20-100 words) that: 527- Is NOT a verbatim copy of the source 528- Is written in natural, narrative style 529- Only includes verifiable information 530- Meets length guidelines (20-100 words) 531- Is grammatically correct and well-written 532${r>150?` 533- **IMPORTANT:** The source is very long - you MUST condense it significantly. Extract only the most important and impactful points.`:""}`;try{const u=await e.models.generateContent({model:Ue.STANDARD,contents:[{role:"user",parts:[{text:o}]}],config:{systemInstruction:s,temperature:.3}}),d=Ee(u.text||t),p=`Source summary: ${t} 534Profile context: ${JSON.stringify(n,null,2)}`,m=await Kf(d,"summary",p,t);return m.isTruthful&&m.reviewedText?m.reviewedText:d}catch(u){return console.warn("[ProfileService] Failed to generate narrative summary:",u),t}},Qo=async(e,t,n,r)=>{if(!t||typeof t!="string"||t.trim().length===0)throw new Error("Prompt is required and must be a non-empty string. Resume sections could not be parsed correctly.");if(!n||typeof n!="string"||n.trim().length===0)throw new Error("System instruction is required and must be a non-empty string.");const s=await e.models.generateContent({model:Ue.FLAGSHIP,contents:[{role:"user",parts:[{text:t.trim()}]}],config:{systemInstruction:n,responseMimeType:"application/json",responseSchema:r}});return v2(s.text)}
534,x2=async(e,t,n,r,s)=>{var _;if(s!=null&&s.skipEnrichment){const h={...t};if(!h.fullName&&r.probableName&&(h.fullName=r.probableName),h.fullName&&(h.fullName=h.fullName.trim().replace(/\s+/g," ")),h.fullName&&(!h.firstName||!h.lastName)){const y=h.fullName.trim().split(/\s+/).filter(Boolean);y.length>=2&&(h.firstName=h.firstName||y[0],h.lastName=h.lastName||y[y.length-1])}return!h.contactInfo&&r.contactInfo&&(h.contactInfo=r.contactInfo),h}const o={...t},i=Rs(n,"summary"),c=Rs(n,"experience"),l=Rs(n,"education"),u=Rs(n,"skills");if(!o.fullName&&r.probableName&&(o.fullName=r.probableName),o.fullName){o.fullName=o.fullName.trim().replace(/\s+/g," ");const h=/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/,y=/(\+?\d{1,3}[-.\s]?)?\(?\d{2,4}\)?[-.\s]?\d{2,4}[-.\s]?\d{2,4}[-.\s]?\d{2,4}[-.\s]?\d{2,4}/;(h.test(o.fullName)||y.test(o.fullName))&&(console.warn("[Name Parsing] fullName contains email/phone, clearing it"),o.fullName="")}if(o.fullName&&(!o.firstName||!o.lastName)){const h=o.fullName.trim().split(/\s+/).filter(Boolean);h.length>=2?(o.firstName=o.firstName||h[0],o.lastName=o.lastName||h[h.length-1]):h.length===1&&(o.firstName=o.firstName||h[0],o.lastName=o.lastName||"")}const d=/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/,p=/(\+?\d{1,3}[-.\s]?)?\(?\d{2,4}\)?[-.\s]?\d{2,4}[-.\s]?\d{2,4}[-.\s]?\d{2,4}[-.\s]?\d{2,4}/;if(o.firstName&&(d.test(o.firstName)||p.test(o.firstName))&&(console.warn("[Name Parsing] firstName contains invalid content, clearing it"),o.firstName=""),o.lastName&&(d.test(o.lastName)||p.test(o.lastName))&&(console.warn("[Name Parsing] lastName contains invalid content, clearing it"),o.lastName=""),!o.contactInfo&&r.contactInfo&&(o.contactInfo=r.contactInfo),o.contactInfo&&!o.contactDetails){const h=$n(o.contactInfo);(h.email||h.phone||h.linkedIn||h.github||h.website)&&(o.contactDetails=h)}if((!o.contactDetails||!o.contactDetails.email&&!o.contactDetails.phone)&&(r.emails.length>0||r.phones.length>0||r.links.length>0)){const h=[...r.emails,...r.phones,...r.links].join(" | "),y=$n(h);(y.email||y.phone||y.linkedIn||y.github||y.website)&&(o.contactDetails={...o.contactDetails,...y})}if(o.contactDetails&&(o.contactDetails.email||o.contactDetails.phone||o.contactDetails.linkedIn||o.contactDetails.github||o.contactDetails.website)){const h=[];o.contactDetails.email&&h.push(o.contactDetails.email),o.contactDetails.phone&&h.push(o.contactDetails.phone),o.contactDetails.linkedIn&&h.push(o.contactDetails.linkedIn),o.contactDetails.github&&h.push(o.contactDetails.github),o.contactDetails.website&&h.push(o.contactDetails.website),h.length>0&&(o.contactInfo=h.join(" | "))}else if(o.contactInfo){const h=$n(o.contactInfo),y=[];h.email&&y.push(h.email),h.phone&&y.push(h.phone),h.linkedIn&&y.push(h.linkedIn),h.github&&y.push(h.github);const b=h.website||h.portfolio;b&&y.push(b),y.length>0&&(o.contactInfo=y.join(" | "),o.contactDetails||(o.contactDetails=h))}if(!o.location){if(Array.isArray(o.experience)&&o.experience.length>0){const b=o.experience[0];b.location&&b.location.trim()&&(o.location=b.location.trim())}const y=(((_=n.find(b=>b.key==="general"))==null?void 0:_.content)||"").match(/([A-Z][a-z]+(?:[\s-][A-Z][a-z]+)*,\s*(?:[A-Z]{2,3}|[A-Z][a-z]+(?:\s[A-Z][a-z]+)*))(?![@\d])/);y&&(o.location=y[1])}if(i&&i.trim().length>0)try{const h=i.replace(/\n+/g," ").trim(),y=h.split(/\s+/).filter(Boolean).length;if(y>100||y<15||!o.summary)console.log("[ProfileService] Processing summary to ensure quality (raw length:",y,"words)"),o.summary=await _2(e,h,o);else if(o.summary){const b=`Source summary: ${h} 535Profile: ${JSON.stringify(o,null,2)}`,x=await Kf(o.summary,"summary",b,h);x.isTruthful&&x.reviewedText&&(o.summary=x.reviewedText)}}catch(h){console.warn("[ProfileService] Failed to process summary, using raw version:",h),o.summary=i.replace(/\n+/g," ").trim()}const m=t2(u);if(m.length){const h=Array.isArray(o.skills)?o.skills:[];o.skills=Array.from(new Set([...h,...m]))}if((!Array.isArray(o.education)||o.education.length===0)&&l){const h=s2(l).filter(y=>y.degree||y.university);h.length&&(o.education=h.map((y,b)=>({id:`edu_hint_${b}`,degree:y.degree,university:y.university,dates:y.dates})))}if((!Array.isArray(o.experience)||o.experience.length===0)&&c){const h=await b2(e,c);
535h.length&&(o.experience=h)}if((!Array.isArray(o.education)||o.education.length===0)&&l){const h=await w2(e,l);h.length&&(o.education=h)}if(!(Array.isArray(o.skills)&&o.skills.length>0)&&u){const h=await S2(e,u);h.length&&(o.skills=h)}if(!(s!=null&&s.skipEnrichment)&&Array.isArray(o.experience)&&o.experience.length>0){console.log("[ProfileService] Standardizing accomplishments for",o.experience.length,"experience entries");for(let h=0;h<o.experience.length;h++){const y=o.experience[h];if(!Array.isArray(y.accomplishments)&&Array.isArray(y.description)&&(y.accomplishments=y.description.map((b,x)=>({id:`acc_${y.id||`exp_${h}`}_${x}`,description:b,skills:[]}))),Array.isArray(y.accomplishments)&&y.accomplishments.length>0){y.accomplishments.some(x=>(x.description||"").split(/\s+/).filter(Boolean).length>200)&&console.warn(`[ProfileService] Detected very long accomplishment(s) for ${y.jobTitle} at ${y.company} - will condense during standardization`);try{console.log(`[ProfileService] Standardizing ${y.accomplishments.length} accomplishments for ${y.jobTitle} at ${y.company}`);const x=await WA({id:y.id||`exp_${h}`,jobTitle:y.jobTitle||"",company:y.company||"",location:y.location||"",dates:y.dates||"",description:y.description||[],accomplishments:y.accomplishments});y.accomplishments=x,console.log(`[ProfileService] Standardized ${x.length} accomplishments for ${y.jobTitle}`),h<o.experience.length-1&&await new Promise(w=>setTimeout(w,500))}catch(x){console.warn(`[ProfileService] Failed to standardize accomplishments for ${y.jobTitle} at ${y.company}:`,x)}}}}else if(Array.isArray(o.experience)&&o.experience.length>0){for(let h=0;h<o.experience.length;h++){const y=o.experience[h];!Array.isArray(y.accomplishments)&&Array.isArray(y.description)&&(y.accomplishments=y.description.map((b,x)=>({id:`acc_${y.id||`exp_${h}`}_${x}`,description:b,skills:[]})))}console.log("[ProfileService] Skipped accomplishment enrichment (fast path)")}return o},b2=async(e,t)=>{if(!(t!=null&&t.trim()))return[];try{return await Qo(e,`Extract detailed work experience records from the EXPERIENCE section delimited below. 536<<< 537${t} 538>>>`,d2,a2)}catch(n){return console.warn("Experience section fallback parse failed:",n),[]}},w2=async(e,t)=>{if(!(t!=null&&t.trim()))return[];try{return await Qo(e,`Extract structured education entries from the EDUCATION section shown below. 539<<< 540${t} 541>>>`,p2,i2)}catch(n){return console.warn("Education section fallback parse failed:",n),[]}},S2=async(e,t)=>{if(!(t!=null&&t.trim()))return[];try{return await Qo(e,`List individual skills, technologies, or tools found in the SKILLS section below. 542<<< 543${t} 544>>>`,m2,c2)}catch(n){return console.warn("Skills section fallback parse failed:",n),[]}},Te=e=>typeof e=="string"?e.trim():"",Bn=e=>Array.isArray(e)?e.map(t=>typeof t=="string"?t.trim():"").filter(t=>t.length>0):typeof e=="string"&&e.trim().length>0?[e.trim()]:[],ah=e=>Array.isArray(e)?(e.forEach((t,n)=>{t.id=Te(t.id)||`exp_${n}`,t.jobTitle=Te(t.jobTitle),t.company=Te(t.company),t.location=Te(t.location),t.dates=Te(t.dates);const r=Bn(t.description);t.description=r,Array.isArray(t.accomplishments)&&t.accomplishments.length>0?t.accomplishments=t.accomplishments.map((s,o)=>({id:Te(s.id)||`acc_${t.id}_${o}`,description:Te(s.description)||(r[o]??""),skills:Bn(s.skills)})):r.length>0?t.accomplishments=r.map((s,o)=>({id:`acc_${t.id}_${o}`,description:s,skills:[]})):((t.jobTitle||t.company)&&console.warn(`Experience entry "${t.jobTitle}" at "${t.company}" has no accomplishments or description. This may indicate a parsing issue.`),t.accomplishments=[])}),e):[],E2=e=>Array.isArray(e)?e.map((t,n)=>({id:Te(t.id)||`edu_${n}`,degree:Te(t.degree),university:Te(t.university),dates:Te(t.dates)})):[],ih=e=>{var n,r;const t={fullName:Te(e.fullName),contactInfo:Te(e.contactInfo),summary:Te(e.summary),experience:ah(e.experience),education:E2(e.education),skills:Array.from(new Set(Bn(e.skills))),locked:!!e.locked,jobPreferences:T2(e.jobPreferences)};if(e.firstName&&(t.firstName=Te(e.firstName)),e.lastName&&(t.lastName=Te(e.lastName)),t.fullName&&(!t.firstName||!t.lastName)){const s=t.fullName.trim().split(/\s+/).filter(
544Boolean);s.length>=2?(t.firstName=t.firstName||s[0],t.lastName=t.lastName||s[s.length-1]):s.length===1&&(t.firstName=t.firstName||s[0])}if(e.contactDetails&&typeof e.contactDetails=="object")t.contactDetails={email:wn(Te(e.contactDetails.email)||""),phone:Te(e.contactDetails.phone),linkedIn:Te(e.contactDetails.linkedIn),github:Te(e.contactDetails.github),website:Te(e.contactDetails.website||e.contactDetails.portfolio),portfolio:Te(e.contactDetails.portfolio),location:Te(e.contactDetails.location)},t.contactDetails.phone||delete t.contactDetails.phone,t.contactDetails.linkedIn||delete t.contactDetails.linkedIn,t.contactDetails.github||delete t.contactDetails.github,t.contactDetails.website||delete t.contactDetails.website,t.contactDetails.portfolio||delete t.contactDetails.portfolio,t.contactDetails.location||delete t.contactDetails.location;else if(t.contactInfo){const s=$n(t.contactInfo);s.email&&(t.contactDetails={email:s.email,...s});const o=[];s.email&&o.push(s.email),s.phone&&o.push(s.phone),s.linkedIn&&o.push(s.linkedIn),s.github&&o.push(s.github);const i=s.website||s.portfolio;i&&o.push(i),o.length>0&&(t.contactInfo=o.join(" | "))}if(e.location){const s=Te(e.location);if(s){if(!t.contactDetails){const o=(n=t.contactInfo)==null?void 0:n.match(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/);t.contactDetails={email:o?wn(o[0]):""}}t.contactDetails&&(t.contactDetails.location=s)}}else if(t.experience&&t.experience.length>0){const s=t.experience[0];if(s.location){if(!t.contactDetails){const o=(r=t.contactInfo)==null?void 0:r.match(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/);t.contactDetails={email:o?wn(o[0]):""}}t.contactDetails&&(t.contactDetails.location=s.location)}}if(t.contactDetails&&(t.contactDetails.email||t.contactDetails.phone||t.contactDetails.linkedIn||t.contactDetails.github||t.contactDetails.website)){const s=[];t.contactDetails.email&&s.push(t.contactDetails.email),t.contactDetails.phone&&s.push(t.contactDetails.phone),t.contactDetails.linkedIn&&s.push(t.contactDetails.linkedIn),t.contactDetails.github&&s.push(t.contactDetails.github);const o=t.contactDetails.website||t.contactDetails.portfolio;o&&s.push(o),s.length>0&&(t.contactInfo=s.join(" | "))}else if(t.contactInfo){const s=$n(t.contactInfo),o=[];s.email&&o.push(s.email),s.phone&&o.push(s.phone),s.linkedIn&&o.push(s.linkedIn),s.github&&o.push(s.github);const i=s.website||s.portfolio;i&&o.push(i),o.length>0&&(t.contactInfo=o.join(" | "))}return t.experience=t.experience??[],t.education=t.education??[],t.skills=t.skills??[],t},v2=e=>{if(!e)throw new Error("Empty AI response");let t=e.trim();const n=t.match(/```(?:json)?\s*([\s\S]*?)```/i);n&&n[1]&&(t=n[1].trim());const r=t.indexOf("{"),s=t.lastIndexOf("}");return(r>0||s<t.length-1)&&r!==-1&&s!==-1&&(t=t.slice(r,s+1)),JSON.parse(t)},T2=e=>{const t=e&&typeof e=="object"?e:{};return{targetRoles:Bn(t.targetRoles??t.desiredRoles),preferredLocations:Bn(t.preferredLocations??t.desiredLocations),locationTypes:Array.isArray(t.locationTypes)?t.locationTypes.filter(n=>["remote","hybrid","onsite"].includes((n||"").toLowerCase())):[],preferredIndustries:Bn(t.preferredIndustries),salaryExpectation:Te(t.salaryExpectation??t.salaryRange)}},ks=e=>ih(e),C2="You are an expert AI talent acquisition specialist. Your role is to provide a quick, unbiased assessment of the user's resume against a job description. Analyze the documents and return a JSON object with your findings, written in the second person (e.g., 'Your resume shows strong experience...').",A2={type:U.OBJECT,properties:{score:{type:U.INTEGER,description:"A match score from 0 to 100, where 100 is a perfect match. The score should reflect the user's skills, experience, and qualifications relative to the job requirements."},justification:{type:U.STRING,description:"A brief, 2-3 sentence justification explaining the score, written in the second person (e.g., 'Your experience in X is a great match.'). Highlight key strengths or gaps concisely."}},required:["score","justification"]},I2=(e,t)=>` 545Please analyze the following resume and job description. Based on your analysis, provide a match score and justification. 546 547--- 548**JOB DESCRIPTION:** 549${t} 550--- 551**RESUME:** 552${e} 553--- 554`,yd=async(e,t)=>{try{const n=mt(),r=I2(e,t),o=(await n.models.generateContent({model:Ue.STANDARD,contents:[{role:"user",parts:[{text:r}]}],config:{systemInstruction:C2,temperature:.1,responseMimeType:"application/json",responseSchema:A2}})).text;if(!o)throw new Error("Received an empty response from the AI for scoring.");const i=o.trim(),c=JSON.parse(i);if(typeof c.score!="number"||typeof c.justification!="string")throw new Error("Invalid JSON structure in AI response.");return c}catch(n){throw console.error("Error calculating conceptual match score:",n),n instanceof Error?new Error(`Failed to get match score: ${n.message}`):new Error("Failed to get match score due to an unknown API error.")}},Oi="Hacker News (YC Jobs)",R2=/\s\(YC\b|\s+is\s+hiring\b|\sâ\s|\s\|\s/i,k2=/^YC\b/i,N2=/\b(remote|hybrid|on-?site|anywhere)\b|,/i,j2=e=>{const t=R2.exec(e);return!t||t.index<=0?Oi:e.slice(0,t.index).trim()||Oi},L2=e=>{const t=e.split(/\s\|\s/).map(r=>
554r.trim()).filter(Boolean);if(t.length>=2){const r=t[t.length-1];if(t.length>=3||N2.test(r))return r}const n=[...e.matchAll(/\(([^()]+)\)/g)].map(r=>r[1].trim()).filter(r=>r&&!k2.test(r));return n.length?n[n.length-1]:""},P2=e=>{const t=(e??"").trim();return t?{company:j2(t),location:L2(t)}:{company:Oi,location:""}},La={lever:["datadog","stripe","netlify"],greenhouse:["github","airbnb","asana"],workable:["duckduckgo","canonical"]},O2="/api/jobs/search-proxy",D2="https://remotive.io/api/remote-jobs",M2="https://hacker-news.firebaseio.com/v0/jobstories.json",U2=e=>`https://hacker-news.firebaseio.com/v0/item/${e}.json`,F2=e=>e||"remote",Yn=async e=>{try{const t=await fetch(e);return t.ok?await t.json():null}catch(t){return console.warn("Fetch failed",e,t),null}},kn=e=>{const t=new Map;for(const n of e){const r=n.applyUrl||n.url||n.id||n.externalId||`temp-${Math.random()}`;t.has(r)||t.set(r,n)}return Array.from(t.values())},$2=async(e={})=>{const{searchQuery:t="",limit:n=30}=e,r=await Yn(M2);if(!Array.isArray(r)||!r.length)return[];const s=r.slice(0,60),o=[],i=t.toLowerCase();for(const c of s){const l=await Yn(U2(c));if(!l)continue;const u=l.title||"",d=l.url||"";if(!u||!d||t&&!u.toLowerCase().includes(i))continue;const{company:p,location:m}=P2(u);if(o.push({id:`hn-${c}`,externalId:String(c),source:"hacker-news",title:u,company:p,locationText:m,descriptionSnippet:(l.text||"").substring(0,200),descriptionFull:l.text||"",applyUrl:d,url:d,matchScore:0,matchJustification:""}),o.length>=n)break}return kn(o).slice(0,n)},B2=async(e={})=>{const{searchQuery:t="",location:n=null,locationType:r="remote",limit:s=20}=e,o=F2(r),i=new URLSearchParams;t&&i.append("search",t),i.append("limit",String(s));const c=`${D2}?${i.toString()}`,l=await Yn(c);if(!(l!=null&&l.jobs)||!Array.isArray(l.jobs))return[];let u=l.jobs.map(d=>({id:`remotive-${d.id}`,externalId:String(d.id),source:"remotive",title:d.title||"Unknown Job Title",company:d.company_name||"Unknown Company",locationText:d.candidate_required_location||d.location||"Remote",descriptionSnippet:(d.description||"").substring(0,200),descriptionFull:d.description||"",applyUrl:d.url||"",url:d.url||"",matchScore:0,matchJustification:""}));if(u=u.filter(d=>d.applyUrl&&d.company&&d.title),o!=="remote"&&n){const d=n.toLowerCase();u=u.filter(p=>(p.locationText||"").toLowerCase().includes(d))}return kn(u).slice(0,s)},z2=async(e,t={})=>{const{searchQuery:n="",location:r=null,limit:s=50}=t,o=`https://api.lever.co/v0/postings/${e}?mode=json`,i=await Yn(o);if(!Array.isArray(i))return[];const c=n.toLowerCase();let l=i.map(u=>{var d;return{id:`lever-${u.id}`,externalId:u.id,source:"lever",title:u.text||"Unknown Job Title",company:u.company||e,locationText:((d=u.categories)==null?void 0:d.location)||"Unknown Location",descriptionSnippet:(u.descriptionPlain||u.description||"").substring(0,200),descriptionFull:u.descriptionPlain||u.description||"",applyUrl:u.hostedUrl||"",url:u.hostedUrl||"",matchScore:0,matchJustification:""}});if(l=l.filter(u=>u.applyUrl&&u.company&&u.title),n&&(l=l.filter(u=>u.title.toLowerCase().includes(c))),r){const u=r.toLowerCase();l=l.filter(d=>(d.locationText||"").toLowerCase().includes(u))}return kn(l).slice(0,s)},G2=async(e,t={})=>{const{searchQuery:n="",location:r=null,limit:s=50}=t,o=`https://boards.greenhouse.io/${e}/embed/jobs/json`,i=await Yn(o);if(!Array.isArray(i==null?void 0:i.jobs))return[];const c=n.toLowerCase();let l=i.jobs.map(u=>{var d,p,m;return{id:`greenhouse-${u.id}`,externalId:String(u.id),source:"greenhouse",title:u.title||"Unknown Job Title",company:((p=(d=u==null?void 0:u.metadata)==null?void 0:d.find(g=>g.name==="Company"))==null?void 0:p.value)||e,locationText:((m=u.location)==null?void 0:m.name)||"Unknown Location",descriptionSnippet:(u.content||"").substring(0,200),descriptionFull:u.content||"",applyUrl:u.absolute_url||"",url:u.absolute_url||"",matchScore:0,matchJustification:""}});if(l=l.filter(u=>u.applyUrl&&u.company&&u.title),n&&(l=l.filter(u=>u.title.toLowerCase().includes(c))),r){const u=r.toLowerCase();l=l.filter(d=>(d.locationText||"").toLowerCase().includes(u))}return kn(l).slice(0,s)},H2=async(e,t={})=>{const{searchQuery:n="",location:r=null,limit:s=50}=t,o=`https://apply.workable.com/api/v3/accounts/${e}/jobs`,i=await Yn(o);if(!Array.isArray(i==null?void 0:i.jobs))return[];const c=n.toLowerCase();let l=i.jobs.map(u=>{var d,p,m;return{id:`workable-${u.shortcode}`,externalId:u.shortcode,source:"workable",title:u.title||"Unknown Job Title",company:u.company||e,locationText:((d=u.location)==null?void 0:d.city)||((p=u.location)==null?void 0:p.region)||((m=u.location)==null?void 0:m.country)||"Unknown Location",descriptionSnippet:(u.short_description||"").substring(0,200),descriptionFull:u.short_description||"",applyUrl:u.url||"",url:u.url||"",matchScore:0,matchJustification:""}});if(l=l.filter(u=>
554u.applyUrl&&u.company&&u.title),n&&(l=l.filter(u=>u.title.toLowerCase().includes(c))),r){const u=r.toLowerCase();l=l.filter(d=>(d.locationText||"").toLowerCase().includes(u))}return kn(l).slice(0,s)},W2=async(e={})=>{const{searchQuery:t="",location:n=null,locationType:r="remote",limit:s=30}=e,o=[];o.push(B2({searchQuery:t,location:n,locationType:r,limit:s})),o.push($2({searchQuery:t,limit:s})),La.lever.forEach(d=>{o.push(z2(d,{searchQuery:t,location:n,limit:s}))}),La.greenhouse.forEach(d=>{o.push(G2(d,{searchQuery:t,location:n,limit:s}))}),La.workable.forEach(d=>{o.push(H2(d,{searchQuery:t,location:n,limit:s}))});let l=(await Promise.all(o).catch(()=>[])).flat().filter(Boolean);if(r==="onsite"&&n){const d=n.toLowerCase();l=l.filter(p=>(p.locationText||"").toLowerCase().includes(d)&&!/(remote|anywhere)/i.test(p.locationText||""))}return kn(l).slice(0,s)},_d=async(e={})=>{var r;let t;try{const o=(r=(Z?await Z.auth.getSession():{data:{session:null}}).data.session)==null?void 0:r.access_token,i=await fetch(O2,{method:"POST",headers:{"Content-Type":"application/json",...o?{Authorization:`Bearer ${o}`}:{}},body:JSON.stringify({keyword:e.searchQuery||"",location:e.location||null,remoteOnly:e.locationType==="remote"||e.locationType==="hybrid",page:1,perPage:e.limit||30,radius:e.radius,radiusUnit:e.radiusUnit,datePosted:e.datePosted})});if(i.status===504){const c=await i.json().catch(()=>({}));(c==null?void 0:c.error)==="UPSTREAM_TIMEOUT"&&(t=typeof c.message=="string"&&c.message?c.message:"Job search is taking longer than usual right now. Try again in a moment.")}if(i.ok){const c=await i.json();if(c!=null&&c.jobs&&Array.isArray(c.jobs)){const l=c.jobs.map(u=>({...u,title:Vo(u.title||u.jobTitle||"Unknown Title"),locationText:u.locationText||u.location||"Remote",applyUrl:u.applyUrl||u.url||"",descriptionSnippet:u.descriptionSnippet||(u.description||"").substring(0,200),descriptionFull:u.descriptionFull||u.description||""}));return{jobs:kn(l).slice(0,e.limit||30),failedSources:c.failedSources||[]}}}}catch(s){console.warn("Job proxy unreachable, falling back to direct fetch",s)}return{jobs:await W2(e),failedSources:[],upstreamNotice:t}};async function jP(e){if(!e.length)return[];try{const t=await fetch("/api/jobs/enrich",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jobs:e})});if(!t.ok)return[];const n=await t.json();return Array.isArray(n==null?void 0:n.enriched)?n.enriched:[]}catch(t){return console.warn("Job description enrichment failed",t),[]}}const Pa=e=>e.map(t=>({...t,title:Vo(t.title||"")})),J2=e=>{var n,r,s,o;if(!e)return"";const t=[];return(n=e.targetRoles)!=null&&n.length&&t.push(`Target Roles: ${e.targetRoles.join(", ")}`),(r=e.preferredIndustries)!=null&&r.length&&t.push(`Preferred Industries: ${e.preferredIndustries.join(", ")}`),e.salaryExpectation&&t.push(`Salary Expectation: ${e.salaryExpectation}`),(s=e.preferredLocations)!=null&&s.length&&t.push(`Preferred Locations: ${e.preferredLocations.join(", ")}`),(o=e.locationTypes)!=null&&o.length&&t.push(`Location Types: ${e.locationTypes.join(", ")}`),t.length?`**JOB SEARCH PREFERENCES:** 555${t.map(i=>`- ${i}`).join(` 556`)} 557---`:""},V2=async(e,t,n)=>{var o;if(!n.length)return[];const r=mt(),s={model:Ue.LITE,contents:[{role:"user",parts:[{text:`You are a ranking assistant. Assign a matchScore (0-100) and matchJustification for each job based on the resume digest. Return JSON only. 558 559Resume Digest: 560${e} 561 562Preferences: 563${J2(t)} 564 565Jobs (Title/Company/Summary): 566${JSON.stringify(n.map(i=>{var c;return{url:i.applyUrl||i.url,title:i.title,company:i.company,summary:((c=i.descriptionFull)==null?void 0:c.substring(0,500))||i.descriptionSnippet}}),null,2)}`}]}],config:{temperature:.1,responseMimeType:"application/json"}};try{const c=(o=(await r.models.generateContent(s)).text)==null?void 0:o.trim();if(!c)return n;let l;try{l=JSON.parse(c)}catch{const{parseJsonFromMarkdown:p}=await D(async()=>{const{parseJsonFromMarkdown:m}=await Promise.resolve().then(()=>hA);return{parseJsonFromMarkdown:m}},void 0);l=p(c,null)}if(!l||!Array.isArray(l.jobs||l))return n;const u=l.jobs||l,d=new Map;return u.forEach(p=>{p!=null&&p.url&&d.set(p.url,{matchScore:typeof p.matchScore=="number"?p.matchScore:0,matchJustification:p.matchJustification||""})}),n.map(p=>{const m=d.get(p.applyUrl||p.url||"");return{...p,matchScore:(m==null?void 0:m.matchScore)??p.matchScore??0,matchJustification:(m==null?void 0:m.matchJustification)||p.matchJustification||""}})}catch(i){return console.warn("Rerank failed, returning unscored jobs",i),n}},Y2=e=>
566{if(!(typeof e!="number"||!Number.isFinite(e)||e<=0)){if(e<=1)return"today";if(e<=3)return"3days";if(e<=7)return"week";if(e<=30)return"month"}},q2=async(e,t,n,r,s,o,i)=>{if(typeof e=="object"&&e!==null){const p=e;return await _d({searchQuery:p.keyword||"",location:p.location,locationType:p.remoteOnly?"remote":"both",limit:p.perPage||25,radius:p.radius,radiusUnit:p.radiusUnit,datePosted:Y2(p.postedWithinDays)})}const c=e,l=Gt("searchJobs-real",nt(c),t||"any",n||"any",s||"none",o||10),u=Ht(l);if(u)return{jobs:Pa(u),failedSources:[]};const{promise:d}=cn(l,async()=>{const{jobs:p}=await _d({searchQuery:s||"",location:n,locationType:t,limit:(o||10)*5});if(!p.length)return{jobs:[],failedSources:[]};const m=Pa(p),_=(await V2(c,i||null,m)).slice().sort((y,b)=>(b.matchScore||0)-(y.matchScore||0)).slice(0,o||10),h=Pa(_);return Ct(l,h,600),{jobs:h,failedSources:[]}});return d},K2=q2,Fr=e=>{var l;const t=new Date;let n=null,r=null;(e.experience||[]).forEach(u=>{const d=u.dates.match(/\d{4}/g);if(!d)return;const p=parseInt(d[0]);let m=d.length>1?parseInt(d[d.length-1]):p;(u.dates.toLowerCase().includes("present")||u.isCurrent)&&(m=t.getFullYear()),(n===null||p<n)&&(n=p),(r===null||m>r)&&(r=m)});const s=n!==null&&r!==null?r-n:0,o=(e.experience||[]).reduce((u,d)=>{var p;return u+(((p=d.accomplishments)==null?void 0:p.length)||0)},0),i=((l=e.skills)==null?void 0:l.length)||0,c=(e.experience||[]).reduce((u,d)=>{const p=d.jobTitle.toLowerCase();if(!(p.includes("lead")||p.includes("manager")||p.includes("director")||p.includes("head")||p.includes("vp")||p.includes("president")||p.includes("chief")))return u;const g=d.dates.match(/\d{4}/g);if(!g)return u;let _=parseInt(g[0]),h=g.length>1?parseInt(g[g.length-1]):_;(d.dates.toLowerCase().includes("present")||d.isCurrent)&&(h=t.getFullYear());const y=Math.max(1,h-_+1);return u+y},0);return{totalYearsExperience:s,projectsCount:o,skillsCount:i,leadershipYears:c,lastUpdated:new Date().toISOString()}},X2=Object.freeze(Object.defineProperty({__proto__:null,calculateProfileMetrics:Fr},Symbol.toStringTag,{value:"Module"})),Z2=(e,t=Date.now())=>`acc_${e}_${t}`;let Q2=0;const eR=()=>{const[e,t]=f.useState([]),n=f.useCallback((l,u,d,p)=>{const m=`toast-${++Q2}`,g={id:m,type:l,message:u,description:d,duration:p||5e3};return t(_=>[..._,g]),m},[]),r=f.useCallback(l=>{t(u=>u.filter(d=>d.id!==l))},[]),s=f.useCallback((l,u,d)=>n("success",l,u,d),[n]),o=f.useCallback((l,u,d)=>n("error",l,u,d),[n]),i=f.useCallback((l,u,d)=>n("warning",l,u,d),[n]),c=f.useCallback((l,u,d)=>n("info",l,u,d),[n]);return{toasts:e,addToast:n,removeToast:r,success:s,error:o,warning:i,info:c}},tR={session:null,isGuest:!1,isAuthLoading:!0,profile:null,error:null,masterResume:"",originalResume:"",appliedJobs:[],savedJobs:[],location:null,zipcode:null,showDbSetupModal:!1,theme:"system",outputKey:0,jobUrl:"",jobDescription:"",pageCount:1,isTailoring:!1,isFetchingDescription:!1,isCalculatingScore:!1,tailoringError:null,matchScore:null,matchJustification:"",tailoredResume:"",tailoredResumeWordCount:null,coverLetter:"",changeSummary:"",tailoredMatchScore:null,tailoredScoreSettled:!1,tailoredMatchJustification:"",relevanceScore:null,originalAlignmentScore:null,alignmentImprovement:null,alignmentShowQualitative:!1,alignmentDetails:null,lastTailoredInfo:null,showSavePrompt:!1,showSuccess:!1,chatHistory:[],isChatting:!1,coverLetterChatHistory:[],isChattingCoverLetter:!1,isGeneratingCoverLetter:!1,searchQuery:"",locationType:"hybrid",isSearchingJobs:!1,isJobSearchIdle:!0,jobSearchError:null,jobListings:[],hasSearched:!1,selectedJob:null,isUpdating:!1,updateMessage:"",updateProgress:0,isStreamStalled:!1,pendingResumeUpdate:null,profileChatHistory:[],isChattingWithProfile:!1,pendingProfileChatUpdate:null,profileChatError:null,profileChatAuditLog:[],lastProfileSnapshot:null,applicationSnippets:null,isGeneratingSnippets:!1,corpusFiles:[],isUploadingFile:!1,fileUploadError:null,diarySaveStatus:"idle",pendingMemories:[],isExtractingAccomplishments:!1,isHydratingProfile:!0},nR=(e,t)=>{var n;switch(t.type){case"SET_SESSION":return{...e,session:t.payload};case"SET_GUEST":return{...e,isGuest:t.payload};case"SET_AUTH_LOADING":return{...e,isAuthLoading:t.payload};case"SET_PROFILE":{const r=t.payload;
566return{...e,profile:r,masterResume:ki(r)}}case"SET_ORIGINAL_RESUME":return{...e,originalResume:t.payload};case"SET_APPLIED_JOBS":return{...e,appliedJobs:t.payload};case"SET_SAVED_JOBS":return console.log("[reducer] SET_SAVED_JOBS dispatched with payload:",((n=t.payload)==null?void 0:n.length)||0,"jobs",t.payload),{...e,savedJobs:t.payload};case"ADD_APPLIED_JOB":return{...e,appliedJobs:[t.payload,...e.appliedJobs]};case"SET_LOCATION":return{...e,location:t.payload};case"SET_ZIPCODE":return{...e,zipcode:t.payload};case"SHOW_DB_SETUP_MODAL":return{...e,showDbSetupModal:!0};case"HIDE_DB_SETUP_MODAL":return{...e,showDbSetupModal:!1};case"SET_THEME":return{...e,theme:t.payload};case"SET_JOB_URL":return{...e,jobUrl:t.payload};case"SET_JOB_DESCRIPTION":return{...e,jobDescription:t.payload};case"SET_PAGE_COUNT":return{...e,pageCount:t.payload};case"SET_TAILORING":return{...e,isTailoring:t.payload};case"SET_FETCHING_DESCRIPTION":return{...e,isFetchingDescription:t.payload};case"SET_CALCULATING_SCORE":return{...e,isCalculatingScore:t.payload};case"SET_ERROR":return{...e,tailoringError:t.payload};case"SET_MATCH_SCORE":return{...e,matchScore:t.payload.score,matchJustification:t.payload.justification};case"SET_TAILORED_RESULTS":return{...e,...t.payload,tailoredScoreSettled:!0,outputKey:e.outputKey+1};case"SET_TAILORED_RESUME_PROVISIONAL":return{...e,tailoredResume:t.payload,tailoredScoreSettled:!1};case"DISCARD_TAILORED_RESULT":return{...e,tailoredResume:"",tailoredResumeWordCount:null,changeSummary:"",tailoredMatchScore:null,tailoredScoreSettled:!1,tailoredMatchJustification:"",originalAlignmentScore:null,alignmentImprovement:null,alignmentShowQualitative:!1,alignmentDetails:null,lastTailoredInfo:null,showSuccess:!1,outputKey:e.outputKey+1};case"SET_SHOW_SUCCESS":return{...e,showSuccess:t.payload};case"SET_SHOW_SAVE_PROMPT":return{...e,showSavePrompt:t.payload};case"SET_LAST_TAILORED_INFO":return{...e,lastTailoredInfo:t.payload};case"START_OVER":return{...e,jobUrl:"",jobDescription:"",tailoringError:null,matchScore:null,matchJustification:"",tailoredResume:"",coverLetter:"",changeSummary:"",tailoredMatchScore:null,tailoredScoreSettled:!1,tailoredMatchJustification:"",relevanceScore:null,originalAlignmentScore:null,alignmentImprovement:null,alignmentShowQualitative:!1,alignmentDetails:null,lastTailoredInfo:null,showSavePrompt:!1,chatHistory:[],coverLetterChatHistory:[],applicationSnippets:null,outputKey:e.outputKey+1};case"SET_TAILORED_RESUME":return{...e,tailoredResume:t.payload};case"SET_TAILORED_RESUME_WORD_COUNT":return{...e,tailoredResumeWordCount:t.payload};case"SET_COVER_LETTER":return{...e,coverLetter:t.payload};case"SET_CHAT_HISTORY":return{...e,chatHistory:t.payload};case"SET_IS_CHATTING":return{...e,isChatting:t.payload};case"SET_COVER_LETTER_CHAT_HISTORY":return{...e,coverLetterChatHistory:t.payload};case"SET_IS_CHATTING_COVER_LETTER":return{...e,isChattingCoverLetter:t.payload};case"SET_IS_GENERATING_COVER_LETTER":return{...e,isGeneratingCoverLetter:t.payload};case"SET_SEARCH_QUERY":return{...e,searchQuery:t.payload};case"SET_LOCATION_TYPE":return{...e,locationType:t.payload};case"SET_IS_SEARCHING_JOBS":return{...e,isSearchingJobs:t.payload,isJobSearchIdle:!1};case"SET_JOB_SEARCH_ERROR":return{...e,jobSearchError:t.payload};case"SET_JOB_LISTINGS":return{...e,jobListings:t.payload,isJobSearchIdle:!1};case"SET_SELECTED_JOB":return{...e,selectedJob:t.payload};case"SET_HAS_SEARCHED":return{...e,hasSearched:t.payload};case"SET_UPDATING":return{...e,isUpdating:t.payload.isUpdating,updateMessage:t.payload.message,updateProgress:t.payload.progress||0,isStreamStalled:t.payload.isUpdating?e.isStreamStalled:!1};case"SET_STREAM_STALLED":return{...e,isStreamStalled:!!t.payload};case"SET_PENDING_UPDATE":return{...e,pendingResumeUpdate:t.payload};case"SET_PROFILE_CHAT_HISTORY":return{...e,profileChatHistory:t.payload};case"SET_IS_CHATTING_PROFILE":return{...e,isChattingWithProfile:t.payload};case"SET_PENDING_PROFILE_CHAT_UPDATE":return{...e,pendingProfileChatUpdate:t.payload};case"SET_PROFILE_CHAT_ERROR":return{...e,profileChatError:t.payload};case"PUSH_PROFILE_CHAT_AUDIT":return{...e,profileChatAuditLog:[t.payload,...e.profileChatAuditLog].slice(0,20)};case"SET_LAST_PROFILE_SNAPSHOT":return{...e,lastProfileSnapshot:t.payload};
566case"SET_SNIPPETS":return{...e,applicationSnippets:t.payload,isGeneratingSnippets:!1};case"SET_IS_GENERATING_SNIPPETS":return{...e,isGeneratingSnippets:t.payload};case"SYNC_FILE_STATE":return{...e,corpusFiles:t.payload.corpusFiles,isUploadingFile:t.payload.isUploadingFile,fileUploadError:t.payload.fileUploadError};case"SET_DIARY_SAVE_STATUS":return{...e,diarySaveStatus:t.payload};case"SET_PENDING_MEMORIES":return{...e,pendingMemories:t.payload};case"SET_EXTRACTING_ACCOMPLISHMENTS":return{...e,isExtractingAccomplishments:t.payload};case"SET_HYDRATING_PROFILE":return{...e,isHydratingProfile:t.payload};case"CLEAR_USER_DATA":return{...e,profile:bt,masterResume:"",originalResume:"",appliedJobs:[],savedJobs:[],location:null,zipcode:null,jobListings:[],isJobSearchIdle:!0,pendingMemories:[]};default:return e}},rR=e=>{if(!e)return null;const t=e.match(/location[:-]?\s*([^\n|]+)/i);if(t)return t[1].trim();const n=e.split(/[\n|]/).map(c=>c.trim()).filter(c=>c.length>0),r=/(https?:\/\/|@|linkedin|github|portfolio|www\.|resume)/i,s=/\+?\d{1,3}[\s-]?\(?\d{2,3}\)?[\s-]?\d{3}[\s-]?\d{4}/,o=/^[A-Za-z .'-]+,\s*[A-Za-z .'-]+(?:\s*\d{4,6})?$/;for(const c of n)if(!(r.test(c)||s.test(c))&&o.test(c))return c;const i=e.match(/([A-Z][a-z]+(?:[\s-][A-Z][a-z]+)*,\s*[A-Z]{2}(?:\s*\d{5})?)/);return i?i[1].trim():null},sR=e=>{var n,r;if(!e)return"";const t=[];if(e.summary&&t.push(`Summary: 567${e.summary}`),(n=e.experience)!=null&&n.length){const s=e.experience.slice(0,2).map(o=>{var c;const i=(c=o.accomplishments)==null?void 0:c.slice(0,2).map(l=>`⢠${l.description}`).join(` 568`);return`- ${o.jobTitle} at ${o.company} (${o.dates||"Dates n/a"})${i?` 569${i}`:""}`});t.push(`Recent Roles: 570${s.join(` 571`)}`)}return(r=e.skills)!=null&&r.length&&t.push(`Key Skills: ${e.skills.slice(0,10).join(", ")}`),t.join(` 572 573`)},oR=(e,t)=>{var n,r;return e!=null&&e.trim()?e.trim():(n=t==null?void 0:t.targetRoles)!=null&&n.length?t.targetRoles[0]:(r=t==null?void 0:t.preferredIndustries)!=null&&r.length?t.preferredIndustries[0]:""},aR=/^[A-Z][A-Z0-9_]*$/,ir=(e,t)=>{const n=typeof(e==null?void 0:e.error)=="string"?e.error:"",r=typeof(e==null?void 0:e.message)=="string"?e.message:"";return n&&aR.test(n)&&r?r:n||r||t},we=(e,t)=>{if(!e)return e;let n=e;n=n.replace(/[a-zA-Z0-9._%+-]+@ [a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,"[EMAIL_REDACTED]"),n=n.replace(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,"[EMAIL_REDACTED]");const r=/(?:\+?\d{1,3}[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}/g;n=n.replace(r,"[PHONE_REDACTED]");const s=/(?:https?:\/\/)?(?:www\.)?(?:linkedin\.com\/in\/|github\.com\/|twitter\.com\/|x\.com\/)[a-zA-Z0-9_-]+/gi;return n=n.replace(s,"[SOCIAL_URL_REDACTED]"),t&&t.split(/\s+/).filter(i=>i.length>2).forEach(i=>{const c=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=new RegExp(`\\b${c}\\b`,"gi");n=n.replace(l,"[NAME_REDACTED]")}),n=n.replace(/\b(Alex|Doe|Martinez|Johnson|Smith|Sundaram)\b/g,"[NAME_REDACTED]"),n},cr=async()=>{var r;const e={"Content-Type":"application/json"},t=await(Z==null?void 0:Z.auth.getSession()),n=(r=t==null?void 0:t.data.session)==null?void 0:r.access_token;return n&&(e.Authorization=`Bearer ${n}`),e},LP=async(e,t,n,r)=>{const s=we(e,r),o=we(t||"",r),i=we(n||"",r),c=await fetch("/api/intelligence/star-refactor",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s,jobTitle:o,company:i})});if(!c.ok){const l=await c.json().catch(()=>({}));throw new Error(l.details||l.error||`AI Refactor failed (${c.status}). Please try again.`)}return c.json()},PP=async(e,t,n,r)=>{const s=we(e,r),o=we(t||"",r),i=(n||[]).map(l=>we(l,r)),c=await fetch("/api/intelligence/socratic-coach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jobTitle:s,company:o,currentAccomplishments:i})});if(!c.ok){const l=await c.json().catch(()=>({}));throw new Error(l.details||l.error||`Coaching question failed (${c.status}). Please try again.`)}return c.json()},OP=async e=>{const t=await cr(),n=await fetch("/api/intelligence/behavioral-questions",{method:"POST",headers:t,body:JSON.stringify({targetRole:we(e.targetRole,e.userName),company:we(e.company||"",e.userName),competencyFocus:we(e.competencyFocus||"",e.userName)})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(ir(r,"Failed to generate behavioral questions"))}return n.json()},DP=async e=>{const t=await cr(),n=await fetch("/api/intelligence/interview-feedback",{method:"POST",headers:t,body:JSON.stringify({question:we(e.question,e.userName),answer:we(e.answer,e.userName),targetRole:we(e.targetRole||"",e.userName),company:we(e.company||"",e.userName),competencyFocus:we(e.competencyFocus||"",e.userName)})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(ir(r,"Failed to generate interview feedback"))}return n.json()},MP=async e=>{const t=await cr(),n=await fetch("/api/intelligence/linkedin-summary",{method:"POST",headers:t,body:JSON.stringify({profileData:we(e.profileData,e.userName),accomplishments:e.accomplishments.map(r=>we(r,e.userName)),targetRole:we(e.targetRole||"",e.userName)})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(ir(r,"Failed to generate LinkedIn summaries"))}return n.json()},UP=async e=>{const t=await cr(),n=await fetch("/api/intelligence/linkedin-headline",{method:"POST",headers:t,body:JSON.stringify({currentHeadline:we(e.currentHeadline||"",e.userName),targetRole:we(e.targetRole||"",e.userName),keySkills:e.keySkills.map(r=>we(r,e.userName))})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(ir(r,"Failed to generate headline suggestions"))}return n.json()},FP=async e=>{const t=await cr(),n=await fetch("/api/intelligence/keyword-gaps",{method:"POST",headers:t,body:JSON.stringify({resumeContent:we(e.resumeContent,e.userName),jobDescription:we(e.jobDescription,e.userName)})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(ir(r,"Failed to analyze keyword gaps"))}return n.json()},$P=async e=>{const t=await cr(),n=await fetch("/api/intelligence/linkedin-post",{method:"POST",headers:t,body:JSON.stringify({diaryEntry:we(e.diaryEntry,e.userName),style:e.style})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(ir(r,"Failed to generate LinkedIn post"))}return n.json()};
573class iR extends Error{constructor(n){super(`AI credits exhausted: ${n.used}/${n.limit}`);Le(this,"status");Le(this,"code","AI_CREDITS_EXHAUSTED");Le(this,"used");Le(this,"limit");Le(this,"resetDate");this.name="TailoringQuotaError",this.status=n.status,this.used=n.used,this.limit=n.limit,this.resetDate=n.resetDate}}const cR=e=>{const t=e.fullName,n=JSON.parse(JSON.stringify(e)),r=s=>{s&&Object.keys(s).forEach(o=>{typeof s[o]=="string"?o!=="fullName"&&o!=="id"&&o!=="user_id"&&(s[o]=we(s[o],t)):typeof s[o]=="object"&&r(s[o])})};return r(n),n},ch=e=>{var n;const t=(n=e.profile)==null?void 0:n.fullName;return{...e,profile:cR(e.profile),jobDescription:we(e.jobDescription,t),jobTitle:we(e.jobTitle,t),companyName:we(e.companyName,t)}},lR=2e4,Er=(e,t)=>{try{const n=JSON.parse(t);if(e===402&&(n==null?void 0:n.code)==="AI_CREDITS_EXHAUSTED")return new iR({status:e,code:"AI_CREDITS_EXHAUSTED",used:Number((n==null?void 0:n.used)??0),limit:Number((n==null?void 0:n.limit)??0),resetDate:String((n==null?void 0:n.resetDate)||"")});if(e===403&&(n==null?void 0:n.code)===Lm)return new Error(Pm());if(n!=null&&n.error&&typeof n.error=="string")return new Error(n.error)}catch{}return new Error(e===402?"AI credits exhausted. Please try again later.":`Streaming request failed (${e}).`)},uR=async(e,t)=>{var n,r,s,o,i,c,l,u,d,p,m,g,_,h,y,b,x,w,E;try{const T=ch(e),C={"Content-Type":"application/json"};try{const z=Z?await Z.auth.getSession():null,K=(r=(n=z==null?void 0:z.data)==null?void 0:n.session)==null?void 0:r.access_token;K&&(C.Authorization=`Bearer ${K}`)}catch{}const S=await fetch("/api/tailor-resume-langchain/stream",{method:"POST",headers:C,body:JSON.stringify(T)});if(!S.ok){const z=await S.text();throw Er(S.status,z)}if(!S.body||typeof S.body.getReader!="function"){console.warn("[Streaming] ReadableStream not supported, falling back to non-streaming endpoint"),(s=t.onProgress)==null||s.call(t,"Generating resume...",10);const z=await fetch("/api/tailor-resume-langchain",{method:"POST",headers:C,body:JSON.stringify(T)});if(!z.ok){const V=await z.text();throw Er(z.status,V)}const K=await z.json();(o=t.onProgress)==null||o.call(t,"Complete",100),(i=t.onComplete)==null||i.call(t,K);return}const A=S.body.getReader(),R=new TextDecoder;let N="",O=!1,k=null;const $=()=>{var z;k&&clearTimeout(k),O&&(O=!1,(z=t.onStall)==null||z.call(t,!1)),k=setTimeout(()=>{var K;O=!0,(K=t.onStall)==null||K.call(t,!0)},lR)};$();try{for(;;){const{done:z,value:K}=await A.read();if(z)break;$(),N+=R.decode(K,{stream:!0});const V=N.split(` 574`);N=V.pop()||"";for(const ie of V)if(!(!ie.trim()||ie.startsWith(":"))&&ie.startsWith("data: "))try{const Q=ie.slice(6),J=JSON.parse(Q);switch(J.type){case"progress":(c=t.onProgress)==null||c.call(t,J.stage,J.percent);break;case"token":(l=t.onToken)==null||l.call(t,J.content);break;case"complete":(u=t.onComplete)==null||u.call(t,J.result);break;case"error":(d=t.onError)==null||d.call(t,J.message);break;case"stage":(p=t.onProgress)==null||p.call(t,J.stage,J.percent);break;case"final":(m=t.onComplete)==null||m.call(t,{...J.result,tailoredResumeId:J.result.tailoredResumeId||J.result.tailored_resume_id||null});break;default:console.warn("[Streaming] Unknown event type:",J)}}catch(Q){console.error("[Streaming] Failed to parse SSE event:",ie,Q)}}}finally{k&&clearTimeout(k),O&&((g=t.onStall)==null||g.call(t,!1))}if(N.trim().startsWith("data:")){const z=N.split(` 575`);for(const K of z)if(!(!K.trim()||K.startsWith(":"))&&K.startsWith("data: "))try{const V=JSON.parse(K.slice(6));switch(V.type){case"progress":(_=t.onProgress)==null||_.call(t,V.stage,V.percent);break;case"token":(h=t.onToken)==null||h.call(t,V.content);break;case"complete":(y=t.onComplete)==null||y.call(t,V.result);break;case"error":(b=t.onError)==null||b.call(t,V.message);break;case"stage":(x=t.onProgress)==null||x.call(t,V.stage,V.percent);break;case"final":(w=t.onComplete)==null||w.call(t,{...V.result,tailoredResumeId:V.result.tailoredResumeId||V.result.tailored_resume_id||null});break}}catch(V){console.error("[Streaming] Failed to parse trailing SSE event:",K,V)}}}catch(T){const C=T instanceof Error?T.message:"Unknown streaming error";throw console.error("[Streaming] Stream failed:",T),(E=t.onError)==null||E.call(t,C),T}};class BP{constructor(){Le(this,"abortController",null)}async start(t,n){var r,s,o,i,c,l,u,d,p,m,g,_;this.abortController=new AbortController;try{const h=ch(t),y={"Content-Type":"application/json"};try{const R=Z?await Z.auth.getSession():null,N=(s=(r=R==null?void 0:R.data)==null?void 0:r.session)==null?void 0:s.access_token;N&&(y.Authorization=`Bearer ${N}`)}catch{}const b=await fetch("/api/tailor-resume-langchain/stream",{method:"POST",headers:y,body:JSON.stringify(h),signal:this.abortController.signal});if(!b.ok){const R=await b.text();throw Er(b.status,R)}if(!b.body||typeof b.body.getReader!="function"){console.warn("[Streaming] ReadableStream not supported, falling back to non-streaming endpoint"),(o=n.onProgress)==null||o.call(n,"Generating resume...",10);const R=await fetch("/api/tailor-resume-langchain",{method:"POST",headers:y,body:JSON.stringify(h),signal:(i=this.abortController)==null?void 0:i.signal});if(!R.ok){const O=await R.text();throw Er(R.status,O)}const N=await R.json();(c=n.onProgress)==null||c.call(n,"Complete",100),(l=n.onComplete)==null||l.call(n,N);return}const x=b.body.getReader(),w=new TextDecoder;let E="",T=!1,C=!1,S=!1;const A=setTimeout(async()=>{var R,N,O,k,$,z;if(!S&&!T&&!C){console.warn("[Streaming] No data received after 15s, falling back to non-streaming");
575try{x.cancel()}catch{}try{(R=n.onProgress)==null||R.call(n,"Generating resume...",10);const K=await fetch("/api/tailor-resume-langchain",{method:"POST",headers:y,body:JSON.stringify(h),signal:(N=this.abortController)==null?void 0:N.signal});if(K.ok){const V=await K.json();(O=n.onProgress)==null||O.call(n,"Complete",100),(k=n.onComplete)==null||k.call(n,V)}else{const V=await K.text();($=n.onError)==null||$.call(n,Er(K.status,V).message)}}catch(K){(z=n.onError)==null||z.call(n,K instanceof Error?K.message:"Fallback request failed")}}},15e3);for(;;){const{done:R,value:N}=await x.read();if(S=!0,clearTimeout(A),R){!T&&!C&&(console.error("[Streaming] Stream ended without complete or error event"),(u=n.onError)==null||u.call(n,"Stream ended unexpectedly without a result"));break}E+=w.decode(N,{stream:!0});const O=E.split(` 576`);E=O.pop()||"";for(const k of O)if(!(!k.trim()||k.startsWith(":"))&&k.startsWith("data: "))try{const $=k.slice(6),z=JSON.parse($);switch(z.type){case"progress":case"stage":(d=n.onProgress)==null||d.call(n,z.stage,z.percent);break;case"token":(p=n.onToken)==null||p.call(n,z.content);break;case"complete":case"final":T=!0,(m=n.onComplete)==null||m.call(n,z.result);break;case"error":C=!0,(g=n.onError)==null||g.call(n,z.message);break}}catch($){console.error("[Streaming] Failed to parse SSE event:",k,$)}}}catch(h){if(h instanceof Error&&h.name==="AbortError"){console.log("[Streaming] Request cancelled by user");return}const y=h instanceof Error?h.message:"Unknown streaming error";throw console.error("[Streaming] Stream failed:",h),(_=n.onError)==null||_.call(n,y),h}finally{this.abortController=null}}cancel(){this.abortController&&(console.log("[Streaming] Cancelling stream..."),this.abortController.abort(),this.abortController=null)}isActive(){return this.abortController!==null}}const dR=[/(\d+)\+?\s*years?\s*(?:of\s*)?(?:experience\s*(?:in|with)\s*)?([^.,;\n]+)/gi,/(?:proficient|experience|expertise|knowledge)\s*(?:in|with)\s*([^.,;\n]+)/gi,/(?:required|preferred|must have)\s*[:\-]?\s*([^.\n]+)/gi,/(?:skills?|technologies?)\s*[:\-]?\s*([^.\n]+)/gi,/\b(React|Angular|Vue|Node\.?js|TypeScript|JavaScript|Python|Java|Go|Rust|SQL|AWS|GCP|Azure|Kubernetes|Docker|GraphQL|REST|CI\/CD|Agile|Scrum)\b/gi],pR=[{level:"executive",patterns:[/\b(chief|ceo|cto|coo|cfo|vp|vice president|president)\b/i]},{level:"director",patterns:[/\b(director|head of)\b/i]},{level:"lead",patterns:[/\b(lead|principal|staff|senior staff)\b/i,/\b(?:engineer|developer|designer|analyst|scientist|programmer|architect|manager|consultant)\s+IV\b/i]},{level:"senior",patterns:[/\b(senior|sr\.?|sr\s)\b/i,/\b(?:engineer|developer|designer|analyst|scientist|programmer|architect|manager|consultant)\s+III\b/i]},{level:"mid",patterns:[/\b(mid[- ]?level|midlevel|experienced)\b/i,/\b(?:engineer|developer|designer|analyst|scientist|programmer|architect|manager|consultant)\s+II\b/i]},{level:"junior",patterns:[/\b(junior|jr\.?|entry[- ]?level|associate)\b/i]},{level:"intern",patterns:[/\b(intern|internship)\b/i]}],mR=/(\d+)\s*[-+]?\s*years?\s*(?:of\s*)?(?:experience|exp)/i;function fR(e){const t=e.match(mR);return t?parseInt(t[1],10):void 0}function hR(e,t){const n=[t,e].filter(Boolean).join(" ").toLowerCase();for(const{level:r,patterns:s}of pR)if(s.some(o=>o.test(n)))return r;return"unknown"}function gR(e){return e.toLowerCase().replace(/[^\w\s\-./]/g," ").split(/\s+/).filter(t=>t.length>=2&&!/^\d+$/.test(t))}function yR(e){return e.split(/[,;]/).map(t=>t.trim()).filter(t=>t.length>1&&t.length<50)}function lh(e){const t=[],n=e.toLowerCase();for(const r of dR){let s;for(r.lastIndex=0;(s=r.exec(n))!==null;){const o=(s[2]??s[1]).trim(),i=yR(o);for(const c of i.length?i:[o])c.length>2&&c.length<80&&t.push(c)}}return[...new Set(t)]}function _R(e,t){const n=[t,e].filter(Boolean).join(` 577`),r=gR(n),s=lh(n),o=new Set,i=[];for(const c of s){const l=c.toLowerCase().trim();o.has(l)||(o.add(l),i.push(l))}for(const c of r)!o.has(c)&&c.length>2&&(o.add(c),i.push(c));return i.slice(0,80)}function xR(e,t){const n=t.toLowerCase(),r=[],s=[];for(const o of e){const i=n.indexOf(o.toLowerCase());if(i<0){r.push(o);continue}const c=n.slice(Math.max(0,i-120),i);/preferred|nice to have|bonus|plus/i.test(c)?s.push(o):r.push(o)}return{required:r,preferred:s}}
577function uh(e,t){const n=(e||"").trim(),r=(t||"").trim(),s=lh(n),{required:o,preferred:i}=xR(s,n),c=_R(n,r),l=hR(n,r),u=fR(n);return{requiredSkills:[...new Set(o)].slice(0,30),preferredSkills:[...new Set(i)].slice(0,20),keywords:c,experienceLevel:l,yearsRequired:u}}const xd=["intern","junior","mid","senior","lead","director","executive","unknown"];function bd(e){const t=xd.indexOf(e);return t>=0?t:xd.length}function Di(e){var s;const n=Fr(e).totalYearsExperience??0,r=((s=e.experience)==null?void 0:s.map(o=>{var i;return((i=o.jobTitle)==null?void 0:i.toLowerCase())??""}).filter(Boolean))??[];return n>=15||r.some(o=>/director|vp|chief|president|head of/i.test(o))?"director":n>=10||r.some(o=>/lead|principal|staff|manager/i.test(o))?"lead":n>=5||r.some(o=>/senior|sr\.?/i.test(o))?"senior":n>=2||r.some(o=>/mid|experienced/i.test(o))?"mid":n>=1||r.some(o=>/junior|associate|entry/i.test(o))?"junior":r.some(o=>/intern/i.test(o))?"intern":n>=3?"senior":n>=1?"mid":"junior"}function bR(e,t){var _,h;const n=(t.title??"").toLowerCase(),r=(t.description??"").toLowerCase(),s=((_=e.experience)==null?void 0:_.map(y=>{var b;return(b=y.jobTitle)==null?void 0:b.toLowerCase()}).filter(Boolean))??[],o=e.skills??[],i=((h=e.jobPreferences)==null?void 0:h.targetRoles)??[],c=[...s,...o,...i].map(y=>y.toLowerCase());if(c.length===0)return{score:50,domainMatch:!1};let l=0,u=!1;for(const y of c){const b=y.split(/\s+/).filter(E=>E.length>=2);if(!b.length)continue;if(n===y){l=Math.max(l,100);continue}if(n.includes(y)||y.includes(n)){l=Math.max(l,90);continue}b.every(E=>n.includes(E)||r.includes(E))&&(l=Math.max(l,80));const w=b.filter(E=>n.includes(E)||r.includes(E)).length;w>0&&(l=Math.max(l,40+w/Math.max(b.length,1)*40))}const d=[[/manager|director|coordinator|supervisor|lead|head of/i,["pmp","project management","program management","leadership","stakeholder management","agile","safe","scrum","budget management","change management","itil","risk management","vendor management","it governance","strategic planning"]],[/engineer|developer|architect|devops|sre/i,["software","python","java","javascript","react","node","aws","docker","kubernetes","ci/cd","git","sql","typescript","go","rust"]],[/analyst|data|scientist/i,["data analysis","sql","python","machine learning","business intelligence","data visualization","statistics","tableau","power bi"]],[/designer|ux|ui/i,["figma","sketch","ui/ux","user research","wireframing","prototyping","css","design"]]],p=o.map(y=>y.toLowerCase());for(const[y,b]of d){if(!y.test(n))continue;const x=p.filter(w=>b.some(E=>w.includes(E)||E.includes(w))).length;x>=3?(l=Math.max(l,60),u=!0):x>=1&&(l=Math.max(l,45),u=!0);break}return l>0?{score:Math.min(100,l),domainMatch:u}:s.map(y=>y.split(/\s+/)[0]).filter(Boolean).some(y=>n.includes(y))?{score:60,domainMatch:u}:{score:20,domainMatch:u}}function wR(e,t){if(!e.length)return 50;const n=t.title??"",r=t.description??"",s=r.length<50?Tm(t.title??"").join(" "):"",o=`${r} ${s}`.trim();let i=0;for(const u of e)hi(u,n)?i+=2:hi(u,o)&&(i+=1);const c=i/(e.length*2),l=Math.min(c*1.5,1)*100;return Math.round(l)}function SR(e,t){const n=Di(e),r=t.experienceLevel,s=t.yearsRequired,i=Fr(e).totalYearsExperience??0,c=bd(n),l=bd(r);if(r==="unknown"&&s==null)return 70;if(s!=null){const d=s-i;return d<=0?100:d<=2?85:d<=4?70:d<=6?50:Math.max(0,40-d*5)}const u=l-c;return u<=0?100:u===1?80:u===2?60:Math.max(0,40-u*15)}function ER(e,t){var o,i,c;if(!e)return 50;let n=50;const r=(t.locationText??t.location??"").toLowerCase(),s=t.remote??/remote|anywhere|distributed/i.test(r);if((o=e.locationTypes)!=null&&o.length){const l=e.locationTypes.some(p=>p==="remote"),u=e.locationTypes.some(p=>p==="onsite"),d=e.locationTypes.some(p=>p==="hybrid");l&&s?n+=25:l&&!s&&(n-=25),u&&!s?n+=25:u&&s&&!/hybrid/i.test(r)&&(n-=25),d&&/hybrid/i.test(r)?n+=25:d&&!s&&!/hybrid/i.test(r)&&(n-=15)}return(i=e.preferredLocations)!=null&&i.length&&r&&(e.preferredLocations.some(u=>r.includes(u.toLowerCase()))?n+=15:n-=15),(c=e.preferredIndustries)!=null&&c.length&&(e.preferredIndustries.some(u=>r.includes(u.toLowerCase())||(t.description??"").toLowerCase().includes(u.toLowerCase()))?n+=10:n-=10),Math.max(0,Math.min(100,n))}function vR(e,t){var i;const n=t.title??"",r=((i=e.experience)==null?void 0:i.map(c=>
577c.jobTitle).filter(Boolean))??[],s=sS(r),o=s.size>0?[...s][0]:void 0;return oS(n,o)}function TR(e,t,n,r,s){if(vR(e,t))return{score:0,breakdown:{roleFunction:0,skillsMatch:0,seniorityLevel:0,preferences:0,signalAdjustment:0},details:{matchedSkills:[],missingSkills:[],inferredSkills:[],jobLevel:"unknown",userLevel:Di(e),titleMatchType:"none",domainMatch:!1},isRelevant:!1};const o=e.jobPreferences,i=uh(t.description??"",t.title),c=(t.description??"").length<50?Tm(t.title??""):[],l=`${t.title??""} ${t.description??""} ${c.join(" ")}`.toLowerCase(),u=(e.skills??[]).filter(O=>hi(O,l)),d=[...i.requiredSkills,...i.preferredSkills,...c].filter(Boolean).filter((O,k,$)=>$.indexOf(O)===k),p=(e.skills??[]).map(O=>O.toLowerCase()),m=d.filter(O=>!p.some(k=>k.includes(O.toLowerCase())||O.toLowerCase().includes(k))).slice(0,5),g=bR(e,t),_=wR(e.skills??[],t),h=SR(e,i),y=ER(o,t),b=Di(e),x=i.experienceLevel,w=Math.round(g.score*.3+_*.4+h*.2+y*.1);let E=0;const T=Math.max(0,Math.min(100,w+E)),C=(s==null?void 0:s.trim().toLowerCase())??"",S=C.split(/\s+/).filter(O=>O.length>=2),A=(t.title??"").toLowerCase(),R=C.length>=2?cS(C,A):0,N=C.length>=2&&A.includes(C)||R>=90?"exact":S.length>0&&S.every(O=>A.includes(O))||R>=80?"partial":"none";return{score:T,breakdown:{roleFunction:Math.round(g.score),skillsMatch:Math.round(_),seniorityLevel:Math.round(h),preferences:Math.round(y),signalAdjustment:E},details:{matchedSkills:u,missingSkills:m,inferredSkills:c,jobLevel:x,userLevel:b,titleMatchType:N,domainMatch:g.domainMatch},isRelevant:T>=50}}function zP(e,t,n){if(e.breakdown.skillsMatch>=n.fallbackThreshold)return e;const r=Math.round(e.breakdown.skillsMatch*(1-n.semanticWeight)+t*n.semanticWeight),s=Math.round(e.breakdown.roleFunction*.3+r*.4+e.breakdown.seniorityLevel*.2+e.breakdown.preferences*.1),o=e.breakdown.signalAdjustment,i=Math.max(0,Math.min(100,s+o)),c=i-e.score;return{score:i,breakdown:{...e.breakdown,skillsMatch:r,semanticBoost:c},details:e.details,isRelevant:i>=50}}function dh(e){return e.toLowerCase().replace(/[^\w\s\-./]/g," ").replace(/\s+/g," ").trim()}function wd(e,t){if(!t||t.length<2)return!1;const n=dh(t);if(n.length<2)return!1;const r=n.split(/\s+/).filter(o=>o.length>1);return r.length?r.filter(o=>e.includes(o)).length>=Math.max(1,Math.ceil(r.length*.6)):e.includes(n)}function CR(e,t,n){const r=(e??"").trim(),s=dh(r),o=uh(t??"",n),i=[...o.requiredSkills,...o.preferredSkills].filter(Boolean),c=o.keywords.slice(0,50),l=c.length,u=[],d=[];for(const h of i)wd(s,h)?u.push(h):d.push(h);let p=0;for(const h of c)wd(s,h)&&(p+=1);const m=i.length>0?u.length/i.length:0,g=l>0?p/l:0;return{score:Math.round(Math.max(0,Math.min(100,m*60+g*40))),skillsFound:u,skillsMissing:d,keywordsFound:p,totalKeywords:l}}const AR=(e,t)=>typeof e=="number"?e:t,IR=(e,t,n,r)=>{const s=AR(t,r),o=typeof e=="number"&&typeof t=="number",i=o?e:null,c=i??n;return{before:c,after:s,improvement:s-c,originalAlignmentScore:i,scale:o?"alignment_v2":"legacy_mixed"}},GP=(e,t)=>t&&typeof e=="number"?e:null,HP=(e,t)=>t>e?e:t;function RR(e){if(!e)return"";if(!/<[a-z][\s\S]*>/i.test(e))return e;let t=e;return t=t.replace(/<br\s*\/?>/gi,` 578`),t=t.replace(/<\/?(p|div|h[1-6]|li|tr)[\s>]/gi,` 579`),t=t.replace(/<\/?(ul|ol)[\s>]/gi,` 580`),t=t.replace(/<[^>]+>/g,""),t=t.replace(/&/g,"&"),t=t.replace(/</g,"<"),t=t.replace(/>/g,">"),t=t.replace(/"/g,'"'),t=t.replace(/'/g,"'"),t=t.replace(/ /g," "),t=t.replace(/\n{3,}/g,` 581 582`),t.trim()}const kR=14,NR=["engineer","engineering","developer","programmer","architect","administrator","analyst","scientist","researcher","statistician","economist","manager","management","director","supervisor","coordinator","lead","head","president","officer","chief","partner","principal","associate","fellow","designer","writer","editor","copywriter","producer","artist","illustrator","consultant","advisor","strategist","specialist","generalist","expert","accountant","auditor","controller","bookkeeper","actuary","underwriter","recruiter","sourcer","marketer","seller","salesperson","representative","technician","operator","mechanic","electrician","machinist","welder","nurse","physician","doctor","therapist","pharmacist","paramedic","clinician","teacher","instructor","professor","tutor","trainer","counselor","attorney","lawyer","paralegal","clerk","assistant","secretary","re
582ceptionist","agent","broker","buyer","planner","scheduler","dispatcher","driver","chef","cook","barista","server","bartender","housekeeper","janitor","intern","apprentice","trainee","volunteer","contractor","freelancer","evangelist","advocate","ambassador","liaison","facilitator","moderator","librarian","archivist","curator","translator","interpreter","inspector","investigator","auditor","examiner","appraiser","surveyor","scrum","sre","devops","sdet","qa"],jR=new Set(["CEO","CTO","CFO","COO","CIO","CISO","CMO","CPO","CHRO","CRO","VP","SVP","EVP","GM","PM","TPM","EM","PMM","SDE","SDET","SRE","QA","BA","DBA","UX","UI","RN","LPN","CNA","NP","PA"]),LR=[/^job\s+(description|details|summary|posting|overview|information|id)\b/i,/^(about|about\s+(us|the\s+(role|job|team|company|position))|overview|summary)\b\s*[:.]?$/i,/^(responsibilities|duties|requirements|qualifications|benefits|perks|compensation)\b\s*[:.]?$/i,/^(what\s+you.?ll\s+do|who\s+you\s+are|why\s+(us|join)|our\s+(team|mission|values))\b/i,/^(full\s+job\s+description|the\s+role|role\s+overview|position\s+summary)\b\s*[:.]?$/i,/^(apply|apply\s+now|apply\s+today|easy\s+apply|view\s+job|save\s+job|share|new)\s*!?$/i,/^\d+(\.\d+)?\s*(out\s+of\s+\d+\s*)?stars?\b/i,/^(posted|updated|closes?)\b/i],PR=/^[A-Za-z][A-Za-z /&-]{0,28}:\s*\S/,OR=/^(job\s*title|position(?:\s*title)?|role|title|job|opening|vacancy|req(?:uisition)?\s*title)$/i,ph=/^\s*(job\s*title|position(?:\s*title)?|role|title|opening|vacancy)\s*[:\-ââ]\s*(.+)$/i,DR=/\b(?:looking\s+for|hiring|seeking|recruiting|in\s+search\s+of)\s+(?:an?\s+|our\s+(?:next\s+|first\s+)?|the\s+)?([A-Z][^.,;!?]{2,70}?)\s+(?:to|who|that|which|with|for|in|at|based)\b/,MR=/^(remote|hybrid|on-?site|in-?office|flexible|anywhere)\b[\s,()/|-]*$/i,UR=/^[A-Z][A-Za-z .'-]+,\s*[A-Z]{2}$/,FR=/\s[-ââ|]\s/,Yc=e=>MR.test(e)||UR.test(e)&&!FR.test(e),mh=Yc,Mi=e=>e.replace(/^\s*#{1,6}\s*/,"").replace(/^\s*[-*â¢Â·]\s+/,"").replace(/\*\*/g,"").replace(/^_+|_+$/g,"").trim(),fh=e=>e.split(/\s+/).filter(Boolean),$r=e=>{const t=e.toLowerCase();return NR.some(n=>new RegExp(`\\b${n}\\b`).test(t))?!0:fh(e).some(n=>jR.has(n.replace(/[^A-Za-z]/g,"")))},$R=e=>/[.!?](\s|$)/.test(e.replace(/\b[A-Z]\./g,""))?!0:fh(e).length>12,hh=e=>LR.some(t=>t.test(e)),Sd=e=>!(!e||e.length>100||hh(e)||mh(e)||$R(e)||PR.test(e)&&!ph.test(e)||e.includes("·")),Ns=(e,t)=>{const n=e.match(/^(.*\S)\s+(?:[-ââ|]|at)\s+(.+)$/);if(!n)return e;const[,r,s]=n,o=s.trim().toLowerCase().replace(/\s*\(.*\)$/,"");return!r||r.length<2?e:t.some(c=>{const l=c.trim().toLowerCase().replace(/\s*\(.*\)$/,"");return l===o&&l!==e.trim().toLowerCase()})?r.trim():e},BR=/^(.+?)\s+[ââ|]\s+(.+?)\s*\(([^()]+)\)\s*$/,gh=e=>{const t=Mi(e??"").match(BR);if(!t)return null;const n=t[1].trim(),r=t[2].trim(),s=t[3].trim();return!n||!r||r.length>60||!$r(n)||$r(r)||Yc(r)?null:{title:n,company:r,location:s}},Ao=e=>{var i,c,l;const t=(e??"").split(` 583`),n=t.slice(0,kR).map(Mi),r=n.filter(u=>u.length>0),s=t.map(u=>Mi(u));for(const u of n){const d=u.match(ph);if(d&&((i=d[2])!=null&&i.trim())){const p=d[2].trim();if(!mh(p))return Ns(p,s)}}for(let u=0;u<r.length-1;u+=1)if(OR.test(r[u].replace(/[:\s]+$/,""))){const d=r[u+1];if(d&&d.length<=100&&!hh(d))return Ns(d,s)}for(const u of r)if(Sd(u)&&$r(u))return((c=gh(u))==null?void 0:c.title)??Ns(u,s);for(const u of r){const d=u.match(DR),p=(l=d==null?void 0:d[1])==null?void 0:l.trim();if(p&&$r(p))return p}const o=r.find(u=>Sd(u)&&u.length>2);return o?Ns(o,s):""},Ed=/^(about|overview|responsibilities|requirements|qualifications|benefits|description|summary|location|salary|apply|who|what|why|how|we|our|the|join|you|your)$/i,zR=new Set(["of","the","and","&","for","de","la"]),vd=e=>{const t=e.trim().replace(/[.,;:]+$/,"");if(!t||t.length>60||/[.!?]\s/.test(t))return!1;const n=t.split(/\s+/);return n.length>6||n.length===1&&Ed.test(n[0])?!1:n.every(r=>/^[A-Z0-9]/.test(r)||zR.has(r.toLowerCase()))&&!Ed.test(n[0])},Ui=e=>{const t=e.split(` 584`);let n="";for(const l of t.map(u=>u.trim()).filter(Boolean).slice(0,3)){const u=gh(l);if(u){n=u.company;break}}const r=[/company:\s*(.+)/i,/organization:\s*(.+)/i,/employer:\s*(.+)/i],s=/\bat\s+([A-Z][A-Za-z0-9&.'-]*(?:\s+(?:[A-Z][A-Za-z0-9&.'-]*|of|the|and|&)){0,4})/,o=l=>{for(const u of t.slice(0,10)){const d=u.match(l);if(d&&d[1])return d[1].trim().replace(/[.,;:]+$/,"")}return""};for(const l of r){const u=o(l);if(u)return u}const i=t.map(l=>
584l.trim()).filter(Boolean),c=Ao(e).trim();for(const l of i.slice(0,3)){if(l===c||$r(l)||Yc(l))continue;const u=l.replace(/\s*\([^)]*\)\s*$/,"").trim();if(u&&u!==l&&vd(u))return u;if(vd(l))return l.replace(/[.,;:]+$/,"")}return n||o(s)},GR=e=>{const t=e.split(` 585`);for(const r of t.slice(0,10)){const s=r.match(/location:\s*(.+)/i);if(s&&s[1]){const o=s[1].trim();return wr(o)??o}}const n=t.map(r=>r.trim()).filter(Boolean);for(const r of n.slice(0,8)){if(r.length>60)continue;const s=wr(r);if(s&&/,/.test(r))return s}for(const r of n.slice(0,3)){const s=r.match(/\(([^)]+)\)/);if(!s)continue;const o=s[1].split(",").map(i=>i.trim()).filter(i=>i&&!/^(remote|hybrid|on-?site|in-?office|flexible)$/i.test(i));if(o.length>0&&/^[A-Z]/.test(o[0])){const i=o.join(", ");return wr(i)??i}}return""},gr=e=>(e??"").trim(),HR=({pastedJd:e,lastTailoredInfo:t})=>{const n=gr(e),r=gr(t==null?void 0:t.jobDescription),s=!!t&&r.length>0;return n&&(!s||n!==r)?{kind:"pasted",jobDescription:n,jobTitle:Ao(n).trim(),companyName:Ui(n).trim()}:s&&t?{kind:"tailored",jobDescription:r,jobTitle:gr(t.jobTitle),companyName:gr(t.companyName),tailoredResume:gr(t.tailoredResume)||void 0}:{kind:"none"}},Oa={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_SUPABASE_KEY:"",VITE_SUPABASE_URL:""},yh="__CD_AppContext__",qc=globalThis[yh]??f.createContext(void 0);globalThis[yh]=qc;const WR=({children:e})=>{var el,tl,nl,rl,sl,ol,al,il;const[t,n]=f.useReducer(nR,tR),r=Qe(),s=HI(),o=Zf(),i=((tl=(el=t.session)==null?void 0:el.user)==null?void 0:tl.id)??null,c=eR(),l=f.useRef(t.profile);f.useEffect(()=>{l.current=t.profile},[t.profile]),f.useEffect(()=>{const v=I=>{const L=I.detail;if(!(L!=null&&L.message))return;const B=L.type||"info";c[B](L.message,L.description,L.duration)};return window.addEventListener("careerdiary:toast",v),()=>window.removeEventListener("careerdiary:toast",v)},[c]),f.useEffect(()=>{let v=!0;return(async()=>{try{const j=(typeof window<"u"?window.localStorage.getItem("careerdiary_is_guest"):null)==="true",L=r.session?!1:r.isGuest||j;if(!v)return;console.log("[AppContext] Auth sync:",{hasSession:!!r.session,isGuest:r.isGuest,persistedGuest:j,effectiveGuest:L,isAuthLoading:r.isAuthLoading,isHydrating:t.isHydratingProfile,hasProfile:!!l.current}),n({type:"SET_SESSION",payload:r.session}),n({type:"SET_GUEST",payload:L}),n({type:"SET_AUTH_LOADING",payload:r.isAuthLoading});const B=l.current,W=B&&(B.fullName||B.experience&&B.experience.length>0);!r.isAuthLoading&&!r.session&&!L&&!t.isHydratingProfile&&(W?console.warn("[AppContext] Profile has data but no auth/guest flag and not hydrating.",{isGuest:r.isGuest,persistedGuest:j,isHydrating:t.isHydratingProfile}):(console.log("[AppContext] Clearing state: no auth, no guest flag, and no data"),o.setProfile(bt),s.setCorpusFiles([]))),j&&!r.isGuest&&!r.session&&r.continueAsGuest().catch(()=>{})}catch{if(!v)return;n({type:"SET_SESSION",payload:r.session}),n({type:"SET_GUEST",payload:r.isGuest}),n({type:"SET_AUTH_LOADING",payload:r.isAuthLoading})}})(),()=>{v=!1}},[r.session,r.isGuest,r.isAuthLoading,r.continueAsGuest,t.isHydratingProfile,o.setProfile,s.setCorpusFiles]),f.useEffect(()=>{n({type:"SYNC_FILE_STATE",payload:{corpusFiles:s.corpusFiles,isUploadingFile:s.isUploadingFile,fileUploadError:s.fileUploadError}})},[s.corpusFiles,s.isUploadingFile,s.fileUploadError]);const u=f.useRef(null),d=f.useRef(null),p=f.useRef(null),m=f.useRef(!1),g=f.useRef(null),_=f.useRef(t.profile);_.current=t.profile,f.useEffect(()=>{const v=JSON.stringify(o.profile);u.current!==v&&(u.current=v,n({type:"SET_PROFILE",payload:o.profile}));const I=JSON.stringify(o.pendingMemories);d.current!==I&&(d.current=I,n({type:"SET_PENDING_MEMORIES",payload:o.pendingMemories})),p.current!==o.isExtractingAccomplishments&&(p.current=o.isExtractingAccomplishments,n({type:"SET_EXTRACTING_ACCOMPLISHMENTS",payload:o.isExtractingAccomplishments})),t.diarySaveStatus!==o.diarySaveStatus&&n({type:"SET_DIARY_SAVE_STATUS",payload:o.diarySaveStatus})},[o.profile,o.pendingMemories,o.isExtractingAccomplishments,o.diarySaveStatus,t.diarySaveStatus]),f.useEffect(()=>{var v;i&&!r.isAuthLoading&&((v=r.session)!=null&&v.access_token)&&NC(i).then(s.setCorpusFiles).catch(I=>{var j;if((j=I.message)!=null&&j.includes("Authentication required")){s.setCorpusFiles([]);return}console.error("[AppContext] Failed to load files:",I)})},[i,r.isAuthLoading,s.setCorpusFiles]),f.useEffect(()=>{var v;!i||r.isAuthLoading||!((v=r.session)!=null&&v.access_token)||t.isGuest||t.originalResume&&t.originalResume.trim().length>0||g.current!==i&&(g.current=i,kC(i).then(I=>{I&&n({type:"SET_ORIGINAL_RESUME",payload:I})}).catch(I=>{var j;(j=I==null?void 0:I.message)!=null&&j.includes("Authentication required")||console.warn("[AppContext] Failed to hydrate original resume text:",(I==null?void 0:I.message)||I)}))},[i,r.isAuthLoading,(nl=r.session)==null?void 0:nl.access_token,t.isGuest,t.originalResume]),f.useEffect(()=>{var v;i&&!r.isAuthLoading&&((v=r.session)!=null&&v.access_token)&&Si(i).then(I=>{fd(I,_.current)&&o.setProfile(I||bt)}).catch(I=>{var j;if((j=I.message)!=null&&j.includes("Authentication required")){if(Li(_.current))return;o.setProfile(bt);return}console.error("[AppContext] Failed to load profile:",I)})},[i,r.isAuthLoading,o.setProfile]);const h=f.useCallback(async v=>{v&&(!t.isGuest&&i?await Ac(v):await Sf(v))},[t.isGuest,i]),y=f.useCallback(v=>{n({type:"SET_DIARY_SAVE_STATUS",payload:v})},[]),b=f.useCallback(()=>{setTimeout(()=>{n({type:"SET_DIARY_SAVE_STATUS",payload:"idle"})},2e3)},[]),x=f.useCallback(async v=>{var I,j;y("saving");try{if(await h(v),i)try{const{invalidateUserCaches:L}=await D(async()=>{const{invalidateUserCaches:X}=await import("./cacheInvalidation-vYihG1NY.js");
585return{invalidateUserCaches:X}},[]),B=await(Z==null?void 0:Z.auth.getSession()),W=(j=(I=B==null?void 0:B.data)==null?void 0:I.session)==null?void 0:j.access_token;L(i,v,W).catch(()=>{})}catch{console.debug("[AppContext] Cache invalidation skipped (non-fatal)")}if(!t.isGuest&&i&&(v!=null&&v.fullName))try{const{portfolioService:L}=await D(async()=>{const{portfolioService:X}=await import("./portfolioService-BRz6BRcD.js");return{portfolioService:X}},__vite__mapDeps([7,1,2,3,4,5])),{calculateProfileMetrics:B}=await D(async()=>{const{calculateProfileMetrics:X}=await Promise.resolve().then(()=>X2);return{calculateProfileMetrics:X}},void 0);if(await L.getMyPortfolio()){const X={...v,metrics:B(v)};await L.updatePortfolio({profile_snapshot:X})}}catch{}y("saved"),b()}catch(L){throw console.error("Failed to save profile",L),y("idle"),L}},[h,y,b,t.isGuest,i]),w=f.useCallback(async v=>{var I;if(v)try{const[j,L,B]=await Promise.all([Si(v).catch(H=>{var re;if((re=H.message)!=null&&re.includes("Authentication required"))return null;throw H}),AC(v).catch(H=>{var re;if((re=H.message)!=null&&re.includes("Authentication required"))return[];throw H}),PC(v).catch(H=>{var re;if((re=H.message)!=null&&re.includes("Authentication required"))return[];throw H})]),W=(j==null?void 0:j.location)||null,X=(j==null?void 0:j.zipcode)||null,Y=j||bt;!Y.metrics&&((I=Y.experience)==null?void 0:I.length)>0&&(Y.metrics=Fr(Y)),fd(j,_.current)&&(n({type:"SET_PROFILE",payload:Y}),o.setProfile(Y)),n({type:"SET_LOCATION",payload:W}),n({type:"SET_ZIPCODE",payload:X}),n({type:"SET_APPLIED_JOBS",payload:L}),console.log("[AppContext] Setting savedJobs:",B.length,B),n({type:"SET_SAVED_JOBS",payload:B})}catch{n({type:"SET_ERROR",payload:{type:"api",message:"Failed to load data"}})}finally{n({type:"SET_HYDRATING_PROFILE",payload:!1})}},[o.setProfile]),E=f.useCallback(async()=>{await r.signOut(),n({type:"CLEAR_USER_DATA"}),te("user_sign_out",{})},[r]),T=f.useCallback(async()=>{var I,j;console.log("[AppContext] ð¤ handleContinueAsGuest called"),await r.continueAsGuest();const v=await Ei();if(v&&(v.fullName||((I=v.experience)==null?void 0:I.length)>0))console.log("[AppContext] ð¥ Loaded guest profile:",{fullName:v.fullName,experienceCount:((j=v.experience)==null?void 0:j.length)||0}),n({type:"SET_PROFILE",payload:v}),o.setProfile(v);else if(!t.profile||!t.profile.fullName){console.log("[AppContext] ð¥ No stored profile, using BLANK");const L=bt;n({type:"SET_PROFILE",payload:L}),o.setProfile(L)}else console.log("[AppContext] âï¸ Keeping existing profile in state");n({type:"SET_APPLIED_JOBS",payload:await Ef()}),n({type:"SET_SAVED_JOBS",payload:await Cf()}),n({type:"SET_LOCATION",payload:await FC()}),n({type:"SET_ZIPCODE",payload:await BC()}),te("continue_as_guest",{}),console.log("[AppContext] â
Guest session initialized")},[r,o,t.profile]);f.useEffect(()=>{var I;if(m.current||r.isAuthLoading)return;if((I=t.session)!=null&&I.user){m.current=!0;return}(async()=>{if(!m.current){m.current=!0,console.log("[AppContext] ð Starting guest profile bootstrap...");try{const j=typeof window<"u"?window.localStorage.getItem("careerdiary_is_guest"):null;console.log("[AppContext] ð´ Guest flag:",j);const[L]=await Promise.all([Ei().catch(()=>null)]);console.log("[AppContext] ð¦ Stored profile found:",{hasProfile:!!L,fullName:(L==null?void 0:L.fullName)||"none"}),j==="true"||L?(console.log("[AppContext] â
Continuing as guest (flag or profile exists)"),await T()):console.log("[AppContext] âï¸ No guest session found, skipping bootstrap")}catch(j){console.error("[AppContext] â Guest bootstrap failed:",j)}finally{n({type:"SET_HYDRATING_PROFILE",payload:!1})}}})()},[r.isAuthLoading,(rl=t.session)==null?void 0:rl.user,T]),f.useEffect(()=>{var v;(v=t.session)!=null&&v.user&&!t.isGuest&&w(t.session.user.id)},[(ol=(sl=t.session)==null?void 0:sl.user)==null?void 0:ol.id,t.isGuest,w]),f.useEffect(()=>{const v=GC();v!=null&&v.tailoredResume&&(n({type:"SET_TAILORED_RESULTS",payload:{tailoredResume:v.tailoredResume,changeSummary:v.changeSummary||"",tailoredMatchScore:v.tailoredMatchScore??null,tailoredMatchJustification:v.tailoredMatchJustification||"",relevanceScore:v.relevanceScore??null,originalAlignmentScore:v.originalAlignmentScore??null,alignmentImprovement:v.alignmentImprovement??null,alignmentShowQualitative:v.alignmentShowQualitative??!1,alignmentDetails:v.alignmentDetails??null}}),v.jobDescription&&n({type:"SET_JOB_DESCRIPTION",payload:v.jobDescription}),v.jobUrl&&n({type:"SET_JOB_URL",payload:v.jobUrl}),v.pageCount&&n({type:"SET_PAGE_COUNT",payload:v.pageCount}),v.matchScore!==void 0&&n({type:"SET_MATCH_SCORE",payload:{score:v.matchScore,justification:v.matchJustification||""}}),v.lastTailoredInfo&&n({type:"SET_LAST_TAILORED_INFO",payload:v.lastTailoredInfo}),n({type:"SET_SHOW_SAVE_PROMPT",payload:!0}
585),console.log("[AppContext] ð Restored tailoring session from sessionStorage"))},[]),f.useEffect(()=>{t.tailoredResume&&zC({tailoredResume:t.tailoredResume,jobDescription:t.jobDescription,jobUrl:t.jobUrl,changeSummary:t.changeSummary,lastTailoredInfo:t.lastTailoredInfo,tailoredMatchScore:t.tailoredMatchScore,tailoredMatchJustification:t.tailoredMatchJustification,relevanceScore:t.relevanceScore,originalAlignmentScore:t.originalAlignmentScore,alignmentImprovement:t.alignmentImprovement,alignmentShowQualitative:t.alignmentShowQualitative,alignmentDetails:t.alignmentDetails,pageCount:t.pageCount,matchScore:t.matchScore,matchJustification:t.matchJustification})},[t.tailoredResume,t.jobDescription,t.jobUrl,t.changeSummary,t.lastTailoredInfo,t.tailoredMatchScore,t.tailoredMatchJustification,t.relevanceScore,t.originalAlignmentScore,t.alignmentImprovement,t.alignmentShowQualitative,t.alignmentDetails,t.pageCount,t.matchScore,t.matchJustification]);const C=f.useCallback(v=>{pe.setItem("theme",v).catch(()=>{}),n({type:"SET_THEME",payload:v})},[]);f.useEffect(()=>{let v=!0;return(async()=>{const I=await pe.getItem("theme").catch(()=>null)||"light";v&&n({type:"SET_THEME",payload:I})})(),()=>{v=!1}},[]);const S=f.useCallback(async v=>{var I;n({type:"SET_LOCATION",payload:v}),!t.isGuest&&((I=t.session)!=null&&I.user)?(await zu(v),pe.setItem("location_manually_set","true").catch(()=>{})):(await Hu(v),pe.setItem("location_manually_set","true").catch(()=>{}))},[t.isGuest,t.session]),A=f.useCallback(async v=>{var I;n({type:"SET_ZIPCODE",payload:v}),!t.isGuest&&((I=t.session)!=null&&I.user)?await CC(v):await $C(v)},[t.isGuest,t.session]),R=f.useCallback(async v=>{var j;if(!v)return;if(!(await pe.getItem("location_manually_set").catch(()=>null)==="true")){const L=rR(v.contactInfo);L&&L!==t.location&&(n({type:"SET_LOCATION",payload:L}),!t.isGuest&&((j=t.session)!=null&&j.user)?await zu(L):await Hu(L))}},[t.location,t.isGuest,t.session]),N=f.useCallback(async v=>{var L,B,W,X,Y;n({type:"SET_ERROR",payload:null});const I=10*1024*1024,j=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/msword","text/plain","application/rtf"];if(v.size>I){const H=(v.size/1024/1024).toFixed(2);n({type:"SET_ERROR",payload:{type:"file",message:`File too large(${H}MB).Maximum file size is 10MB.`}});return}if(!j.includes(v.type)){n({type:"SET_ERROR",payload:{type:"file",message:"Unsupported file type.Please upload PDF, DOCX, DOC, TXT, or RTF files."}});return}n({type:"SET_UPDATING",payload:{isUpdating:!0,message:"Initializing parser..."}});try{const H=await nh(v,(de,le)=>{n({type:"SET_UPDATING",payload:{isUpdating:!0,message:de,progress:le}})});n({type:"SET_UPDATING",payload:{isUpdating:!0,message:"AI extracting resume structure...",progress:60}});const re=await h2(H,{skipEnrichment:!0}),se=t.profile&&t.profile.fullName?"Finalizing Career Diary...":"Creating Career Diary...";n({type:"SET_UPDATING",payload:{isUpdating:!0,message:se,progress:90}});const be=cd(H,re);if(be||console.warn('[AppContext] Parsed upload has no renderable resume body (likely a scanned/empty PDF); not setting it as the "before".'),n({type:"SET_ORIGINAL_RESUME",payload:be?H:""}),n({type:"SET_MATCH_SCORE",payload:{score:null,justification:""}}),n({type:"SET_PROFILE",payload:re}),o.setProfile(re),await R(re),await x(re),te("profile_updated",{method:"file_upload"}),vi({resumeUploaded:!0,name:((L=re.fullName)==null?void 0:L.trim())||"",email:((W=(B=re.contactDetails)==null?void 0:B.email)==null?void 0:W.trim())||""}),!t.isGuest&&((Y=(X=t.session)==null?void 0:X.user)!=null&&Y.id))try{await s.uploadFile(v,t.session.user.id,"resumes")}catch(de){console.warn("[AppContext] Failed to save resume to corpus (non-fatal):",(de==null?void 0:de.message)||de)}n({type:"SET_UPDATING",payload:{isUpdating:!1,message:""}})}catch(H){throw n({type:"SET_ERROR",payload:{type:"file",message:H.message}}),n({type:"SET_UPDATING",payload:{isUpdating:!1,message:""}}),H}},[t.profile,t.isGuest,t.session,h,R,o,s]),O=f.useCallback(async()=>{if(!(!t.pendingResumeUpdate||!t.profile)){n({type:"SET_UPDATING",payload:{isUpdating:!0,message:"Merging profiles..."}});try{let v=t.pendingResumeUpdate.mergedProfile??null;v||(v=(await f2(t.profile,t.pendingResumeUpdate.newProfile)).mergedProfile),n({type:"SET_PROFILE",payload:v}),o.setProfile(v),await R(v),await x(v),te("profile_merged")}catch(v){n({type:"SET_ERROR",payload:{type:"api",message:v.message}})}finally{n({type:"SET_PENDING_UPDATE",payload:null}),n({type:"SET_UPDATING",payload:{isUpdating:!1,message:""}})}}},[t.pendingResumeUpdate,t.profile,x,R,o]),k=f.useCallback(async()=>
585{if(!t.pendingResumeUpdate)return;const v=t.pendingResumeUpdate.newProfile;n({type:"SET_PROFILE",payload:v}),o.setProfile(v),await R(v),await x(v),n({type:"SET_PENDING_UPDATE",payload:null}),te("profile_replaced")},[t.pendingResumeUpdate,x,R,o]),$=f.useCallback((v,I=!1)=>o.updateProfile(j=>{const L=v(j);return L.metrics=Fr(L),L},I),[o]),z=f.useCallback(()=>{n({type:"SET_PENDING_UPDATE",payload:null})},[]),K=f.useCallback(async()=>{var I,j;const v={...bt};if(n({type:"SET_PENDING_UPDATE",payload:null}),n({type:"SET_PENDING_PROFILE_CHAT_UPDATE",payload:null}),n({type:"SET_PROFILE_CHAT_HISTORY",payload:[]}),n({type:"SET_PROFILE_CHAT_ERROR",payload:null}),n({type:"SET_LAST_PROFILE_SNAPSHOT",payload:null}),n({type:"SET_LOCATION",payload:null}),n({type:"SET_ZIPCODE",payload:null}),n({type:"SET_PROFILE",payload:v}),o.setProfile(v),await vf(),await Tf(),!t.isGuest&&((j=(I=t.session)==null?void 0:I.user)!=null&&j.id)&&t.corpusFiles.length>0)try{console.log("[AppContext] Deleting all documents when clearing diary:",t.corpusFiles.length,"files");const L=t.corpusFiles.map(B=>s.deleteFile(B.name,t.session.user.id).catch(W=>(console.warn(`[AppContext] Failed to delete file ${B.name} during diary clear:`,(W==null?void 0:W.message)||W),null)));await Promise.all(L),console.log("[AppContext] All documents deleted successfully")}catch(L){console.error("[AppContext] Error deleting documents during diary clear:",L)}try{await x(v),te("diary_cleared")}catch(L){const B=(L==null?void 0:L.message)||"Failed to clear the diary.";throw n({type:"SET_ERROR",payload:{type:"api",message:B}}),L}},[x,o,t.isGuest,t.session,t.corpusFiles,s]),V=f.useCallback(v=>{$(I=>{const j=I.experience.findIndex(B=>B.id===v);if(j===-1)return I;const L=[...I.experience];return L[j]={...L[j],accomplishments:[...L[j].accomplishments,{id:Z2(v),description:"",skills:[]}]},{...I,experience:L}})},[$]),ie=f.useCallback((v,I,j)=>{$(L=>{const B=L.experience.findIndex(Y=>Y.id===v);if(B===-1)return L;const W=[...L.experience],X=W[B].accomplishments.findIndex(Y=>Y.id===I);return X===-1?L:(W[B]={...W[B],accomplishments:W[B].accomplishments.map((Y,H)=>H===X?{...Y,description:j}:Y)},{...L,experience:W})})},[$]),Q=f.useCallback((v,I)=>{$(j=>{const L=j.experience.findIndex(W=>W.id===v);if(L===-1)return j;const B=[...j.experience];return B[L]={...B[L],accomplishments:B[L].accomplishments.filter(W=>W.id!==I)},{...j,experience:B}})},[$]),J=f.useCallback(async v=>{if(!t.profile||t.isChattingWithProfile)return;const I=t.profile;n({type:"SET_IS_CHATTING_PROFILE",payload:!0}),n({type:"SET_PROFILE_CHAT_ERROR",payload:null});const j=[...t.profileChatHistory,{role:"user",text:v}];n({type:"SET_PROFILE_CHAT_HISTORY",payload:j});const L=async()=>{var X,Y;let W=0;for(;;)try{const H=((Y=(X=t.session)==null?void 0:X.user)==null?void 0:Y.id)||null,re=await $A(I,v,H);return W>0&&te("profile_chat_retry_success",{attempt:W+1}),re}catch(H){if(W+1>=2)throw H;W+=1,te("profile_chat_retry",{attempt:W+1}),await new Promise(re=>setTimeout(re,400*W))}};try{const{updatedProfile:B,summary:W}=await L(),X=ks(B),Y=ZA(I,X);if(Y.length===0){const se="â No changes detected. Try rephrasing or be more specific.";n({type:"SET_PROFILE_CHAT_ERROR",payload:se}),n({type:"SET_PROFILE_CHAT_HISTORY",payload:[...j,{role:"model",text:se}]});return}const H=ks(I),re=JSON.parse(JSON.stringify(H));n({type:"SET_LAST_PROFILE_SNAPSHOT",payload:re}),n({type:"SET_PROFILE",payload:X}),o.setProfile(X),await R(X),await x(X),n({type:"PUSH_PROFILE_CHAT_AUDIT",payload:{timestamp:new Date().toISOString(),summary:W,diffSummary:Y,prompt:v}}),n({type:"SET_PROFILE_CHAT_HISTORY",payload:[...j,{role:"model",text:`â ${W}`}]}),te("profile_chat_edit")}catch(B){const W=(B==null?void 0:B.message)||"The assistant could not process your request.";n({type:"SET_ERROR",payload:{type:"api",message:W}}),n({type:"SET_PROFILE_CHAT_ERROR",payload:W}),n({type:"SET_PROFILE_CHAT_HISTORY",payload:[...j,{role:"model",text:`â Error: ${W}`}]})}finally{n({type:"SET_IS_CHATTING_PROFILE",payload:!1})}},[t.profile,t.profileChatHistory,t.isChattingWithProfile,t.session,x,R,o]),me=f.useCallback(async()=>
585{if(!t.pendingProfileChatUpdate||!t.profile)return;const{updatedProfile:v,summary:I,diffSummary:j,prompt:L}=t.pendingProfileChatUpdate,B=ks(t.profile),W=JSON.parse(JSON.stringify(B));n({type:"SET_LAST_PROFILE_SNAPSHOT",payload:W}),n({type:"SET_PROFILE",payload:v}),o.setProfile(v),await R(v),await x(v),n({type:"PUSH_PROFILE_CHAT_AUDIT",payload:{timestamp:new Date().toISOString(),summary:I,diffSummary:j,prompt:L}}),n({type:"SET_PENDING_PROFILE_CHAT_UPDATE",payload:null}),n({type:"SET_PROFILE_CHAT_ERROR",payload:null}),te("profile_chat_apply")},[t.pendingProfileChatUpdate,t.profile,x,R,o]),ce=f.useCallback(()=>{n({type:"SET_PENDING_PROFILE_CHAT_UPDATE",payload:null}),n({type:"SET_PROFILE_CHAT_ERROR",payload:null})},[]),xe=f.useCallback(async()=>{if(!t.lastProfileSnapshot)return;const v=ks(t.lastProfileSnapshot),I=JSON.parse(JSON.stringify(v));n({type:"SET_PROFILE",payload:I}),o.setProfile(I),await R(I),await x(I),n({type:"SET_LAST_PROFILE_SNAPSHOT",payload:null}),n({type:"SET_PROFILE_CHAT_ERROR",payload:null}),te("profile_chat_undo")},[t.lastProfileSnapshot,x,R,o]),ve=f.useCallback(async()=>{if(t.jobUrl){n({type:"SET_FETCHING_DESCRIPTION",payload:!0}),n({type:"SET_ERROR",payload:null});try{const v=await sd(t.jobUrl);n({type:"SET_JOB_DESCRIPTION",payload:v}),te("fetch_job_description",{success:!0})}catch(v){n({type:"SET_ERROR",payload:{type:"job",message:v.message}}),te("fetch_job_description",{success:!1})}finally{n({type:"SET_FETCHING_DESCRIPTION",payload:!1})}}},[t.jobUrl]),Be=f.useCallback(async()=>{var I,j;const v=t.originalResume||t.masterResume;if(!(!v||!t.jobDescription)){console.log("[Match Score] Calculating initial score:",{hasOriginalResume:!!t.originalResume,originalResumeLength:((I=t.originalResume)==null?void 0:I.length)||0,masterResumeLength:((j=t.masterResume)==null?void 0:j.length)||0,usingOriginal:!!t.originalResume}),n({type:"SET_CALCULATING_SCORE",payload:!0}),n({type:"SET_ERROR",payload:null});try{const L=Yt(v),{score:B,justification:W}=await yd(L,t.jobDescription);n({type:"SET_MATCH_SCORE",payload:{score:B,justification:W}}),te("calculate_initial_score",{score:B,usedOriginalResume:!!t.originalResume})}catch(L){n({type:"SET_ERROR",payload:{type:"api",message:L.message}})}finally{n({type:"SET_CALCULATING_SCORE",payload:!1})}}},[t.originalResume,t.masterResume,t.jobDescription]),Ge=f.useCallback(async(v,I,j)=>{const L=Yt(v.tailoredResume||""),B=v.wordCount||(v.tailoredResume?v.tailoredResume.split(/\s+/).filter(de=>de.length>0).length:0);n({type:"SET_TAILORED_RESUME_WORD_COUNT",payload:B});let W=0,X=0,Y=0,H=!1,re=null,se=null;if(t.profile&&t.jobDescription){const de={title:I,description:t.jobDescription};W=TR(t.profile,de).score;const Ie=CR(L,t.jobDescription,I),Ce=IR(v.originalMatchScore,v.tailoredMatchScore,W,Math.max(Ie.score,W));X=Ce.after,re=Ce.originalAlignmentScore,Y=Ce.improvement,H=Y<5,se={skillsFound:Ie.skillsFound,keywordsFound:Ie.keywordsFound,totalKeywords:Ie.totalKeywords}}else X=0;const be={jobTitle:I,companyName:j,jobDescription:t.jobDescription,tailoredResume:L,
585coverLetter:"",tailoredResumeId:v.tailoredResumeId||null,matchScore:t.matchScore,matchJustification:t.matchJustification,tailoredMatchScore:X,tailoredMatchJustification:v.tailoredMatchJustification||"",jobUrl:t.jobUrl||null};n({type:"SET_TAILORED_RESULTS",payload:{tailoredResume:L,changeSummary:v.changeSummary||"",tailoredMatchScore:X,tailoredMatchJustification:v.tailoredMatchJustification||"",relevanceScore:W,originalAlignmentScore:re,alignmentImprovement:Y,alignmentShowQualitative:H,alignmentDetails:se}}),n({type:"SET_LAST_TAILORED_INFO",payload:be}),n({type:"SET_SHOW_SUCCESS",payload:!0}),setTimeout(()=>n({type:"SET_SHOW_SUCCESS",payload:!1}),3e3),n({type:"SET_SHOW_SAVE_PROMPT",payload:!0}),vi({tailorCount:Rf().tailorCount+1,lastTailorScore:X>0?X:null,lastTailorJobTitle:(I==null?void 0:I.trim())||null}),nr("resume_tailored",{match_score:X,initial_score:re??W,score_improvement:Y,score_scale:re!==null?"alignment_v2":"legacy_mixed",relevance_score:W,word_count:B,has_company:!!j,has_job_title:!!I})},[t.jobDescription,t.profile,t.matchScore,t.matchJustification]),ee=f.useCallback(async()=>{var v,I;if(!t.profile||!t.jobDescription){n({type:"SET_ERROR",payload:{type:t.profile?"job":"resume",message:"Profile and job description are required."}});return}n({type:"SET_TAILORING",payload:!0}),n({type:"SET_ERROR",payload:null}),n({type:"SET_SHOW_SAVE_PROMPT",payload:!1});try{const j=Ao(t.jobDescription),L=Ui(t.jobDescription),B=t.corpusFiles.map(se=>se.name),W=((I=(v=t.session)==null?void 0:v.user)==null?void 0:I.id)||null,X=typeof import.meta<"u"&&(Oa==null?void 0:Oa.VITE_USE_LANGCHAIN)==="true";let Y="",H=null;X&&typeof window<"u"?await uR({profile:t.profile,jobDescription:t.jobDescription,jobTitle:j,companyName:L,pageCount:t.pageCount},{onToken:se=>{Y+=se},onProgress:(se,be)=>{console.debug("[Streaming Progress]",se,be)},onComplete:se=>{H=se,se!=null&&se.tailoredResume&&(Y=se.tailoredResume,n({type:"SET_TAILORED_RESUME_PROVISIONAL",payload:Y}))},onError:se=>{throw new Error(se||"Streaming failed")},onStall:se=>{n({type:"SET_STREAM_STALLED",payload:se})}}):(H=await Jf(t.profile,t.jobDescription,j,L,B,t.pageCount,W),Y=(H==null?void 0:H.tailoredResume)||"");const re={tailoredResume:Y,changeSummary:(H==null?void 0:H.changeSummary)||"",tailoredMatchScore:typeof(H==null?void 0:H.tailoredMatchScore)=="number"?H.tailoredMatchScore:void 0,originalMatchScore:typeof(H==null?void 0:H.originalMatchScore)=="number"?H.originalMatchScore:void 0,tailoredMatchJustification:(H==null?void 0:H.tailoredMatchJustification)||"",wordCount:(H==null?void 0:H.wordCount)||0,tailoredResumeId:(H==null?void 0:H.tailoredResumeId)||(H==null?void 0:H.tailored_resume_id)||null};await Ge(re,j,L)}catch(j){n({type:"SET_ERROR",payload:{type:"api",message:j.message}}),te("tailor_resume_error",{message:j.message})}finally{n({type:"SET_TAILORING",payload:!1})}},[t.profile,t.jobDescription,t.corpusFiles,t.pageCount,Ge]),ge=f.useCallback(()=>{HC(),n({type:"START_OVER"})},[]),He=f.useCallback(async v=>{var j,L,B,W;if(!t.profile)return;n({type:"SET_IS_CHATTING",payload:!0});const I=[...t.chatHistory,{role:"user",text:v}];n({type:"SET_CHAT_HISTORY",payload:I});try{const X=((L=(j=t.session)==null?void 0:j.user)==null?void 0:L.id)||null,Y=await SA(t.profile,t.jobDescription,t.tailoredResume,I,X);if(Y&&typeof Y=="object"&&"newResumeText"in Y&&Y.newResumeText&&typeof Y.newResumeText=="string"){const re=Yt(Y.newResumeText);n({type:"SET_TAILORED_RESULTS",payload:{tailoredResume:re,changeSummary:t.changeSummary||"Resume updated via chat"}});let se="Updated";if(Y.responseText&&Y.responseText.trim()){const be=Y.responseText.split(` 586`).filter(le=>le.trim()),de=((B=be[0])==null?void 0:B.trim())||"";if(de.toLowerCase().startsWith("i ")||de.toLowerCase().startsWith("i've ")||de.toLowerCase().startsWith("i have ")||de.length>60||be.length>2){const le=[/(?:updated|modified|changed|adjusted|refined|improved|enhanced|revised|edited)\s+(?:the\s+)?(.{0,50})/i,/(?:removed|added|replaced|combined|merged|split)\s+(.{0,50})/i];let Ie=!1;for(const Ce of le){const at=de.match(Ce);if(at&&at[1]){const xt=at[1].trim().substring(0,50).replace(/[.,;:!?]$/,"");if(xt&&xt.length>3){se=xt,Ie=!0;break}}}if(!Ie){const Ce=["summary","experience","skills","education","section","bullet","point","accomplishment"];for(const at of Ce){const xt=de.toLowerCase().indexOf(at);if(xt!==-1){const dn=de.substring(Math.max(0,xt-20),xt+at.length+30).trim();if(dn.length>5&&dn.length<60){se=dn,Ie=!0;break}}}}}else se=de.length>80?de.substring(0,77)+"...":de}n({type:"SET_CHAT_HISTORY",payload:[...I,{role:"model",text:`â ${se}`}]})}else{const re=((W=Y.responseText)==null?void 0:W.trim())||"";if(re){const se=re.split(` 587`)[0].trim();se.length<=80&&!se.toLowerCase().includes("i have")&&!se.toLowerCase().includes("i can")&&n({type:"SET_CHAT_HISTORY",payload:[...I,{role:"model",text:se}]})}}te("resume_chat_sent")}catch(X){console.error("Resume chat error:",X),n({type:"SET_CHAT_HISTORY",payload:[...I,{role:"model",text:`â Error: ${X.message}`}]})}finally{n({type:"SET_IS_CHATTING",payload:!1})}},[t.profile,t.jobDescription,t.tailoredResume,t.chatHistory]),Je=f.useCallback(async v=>{var j,L;if(!t.profile)return;const I=HR({pastedJd:(v==null?void 0:v.jobDescription)??t.jobDescription,lastTailoredInfo:t.lastTailoredInfo});if(I.kind==="none"){typeof window<"u"&&window.dispatchEvent(new CustomEvent("careerdiary:toast",{detail:{type:"warning",message:"Paste a job description first"}}));return}n({type:"SET_IS_GENERATING_COVER_LETTER",payload:!0});try{const{tailoredResume:B,jobDescription:W,jobTitle:X,companyName:Y}=I,H=((L=(j=t.session)==null?void 0:j.user)==null?void 0:L.id)||null,re=await DA(t.profile,B??"",W,X,Y,H);n({type:"SET_COVER_LETTER",payload:re}),I.kind==="tailored"&&t.lastTailoredInfo&&n({type:"SET_LAST_TAILORED_INFO",payload:{...t.lastTailoredInfo,coverLetter:re}}),te("generate_cover_letter",{source:I.kind})}catch(B){const W=B==null?void 0:B.code,X=W==="COVER_LETTER_DAILY_LIMIT_REACHED"?"Daily cover letter limit reached":W==="COVER_LETTER_SIGNUP_REQUIRED"?"Create a free account to generate cover letters":"Could not generate cover letter",Y=W==="COVER_LETTER_DAILY_LIMIT_REACHED"?"Upgrade to Pro for unlimited cover letters.":B!=null&&B.message&&B.message!==X?B.message:void 0;typeof window<"u"&&window.dispatchEvent(new CustomEvent("careerdiary:toast",{detail:{type:"error",message:X,description:Y}}))}finally{n({type:"SET_IS_GENERATING_COVER_LETTER",payload:!1})}},[t.profile,t.jobDescription,t.lastTailoredInfo,(il=(al=t.session)==null?void 0:al.user)==null?void 0:il.id]),Ke=f.useCallback(async v=>{var j,L;n({type:"SET_IS_CHATTING_COVER_LETTER",payload:!0});const I=[...t.coverLetterChatHistory,{role:"user",text:v}];n({type:"SET_COVER_LETTER_CHAT_HISTORY",payload:I});try{const B=await MA(t.jobDescription,t.coverLetter,I);if(B&&typeof B=="object"&&"newCoverLetterText"in B&&B.newCoverLetterText&&typeof B.newCoverLetterText=="string"){n({type:"SET_COVER_LETTER",payload:B.newCoverLetterText});let X="Updated";if(B.responseText&&B.responseText.trim()){const Y=B.responseText.split(` 588`).filter(re=>re.trim()),H=((j=Y[0])==null?void 0:j.trim())||"";if(H.toLowerCase().startsWith("i ")||H.toLowerCase().startsWith("i've ")||H.toLowerCase().startsWith("i have ")||H.length>60||Y.length>2){const re=[/(?:updated|modified|changed|adjusted|refined|improved|enhanced|revised|edited|rewrote|rewritten)\s+(?:the\s+)?(.{0,50})/i,/(?:removed|added|replaced|combined|merged|split|shortened|lengthened|expanded)\s+(.{0,50})/i];let se=!1;for(const be of re){const de=H.match(be);if(de&&de[1]){const le=de[1].trim().substring(0,50).replace(/[.,;:!?]$/,"");if(le&&le.length>3){X=le,se=!0;break}}}if(!se){const be=["opening","paragraph","body","closing","salutation","signature","tone","content","sentence"];for(const de of be){const le=H.toLowerCase().indexOf(de);if(le!==-1){const Ie=H.substring(Math.max(0,le-20),le+de.length+30).trim();if(Ie.length>5&&Ie.length<60){X=Ie,se=!0;break}}}}}else X=H.length>80?H.substring(0,77)+"...":H}n({type:"SET_COVER_LETTER_CHAT_HISTORY",payload:[...I,{role:"model",text:`â ${X}`}]})}else{const X=((L=B.responseText)==null?void 0:L.trim())||"";if(X){const Y=X.split(` 589`)[0].trim();Y.length<=80&&!Y.toLowerCase().includes("i have")&&!Y.toLowerCase().includes("i can")&&n({type:"SET_COVER_LETTER_CHAT_HISTORY",payload:[...I,{role:"model",text:Y}]})}}te("cover_letter_chat_sent")}catch(B){console.error("Cover letter chat error:",B),n({type:"SET_COVER_LETTER_CHAT_HISTORY",payload:[...I,{role:"model",text:`â Error: ${B.message}`}]})}finally{n({type:"SET_IS_CHATTING_COVER_LETTER",payload:!1})}}
589,[t.jobDescription,t.coverLetter,t.coverLetterChatHistory]),De=f.useCallback(async v=>{var Ie;if(!t.lastTailoredInfo)return;const{jobTitle:I,companyName:j,jobDescription:L,tailoredResume:B,tailoredResumeId:W,coverLetter:X,matchScore:Y,matchJustification:H,jobUrl:re}=t.lastTailoredInfo,se=I||Ao(L||""),be=j||Ui(L||""),de=GR(L||""),le={job_title:se,company_name:be,job_location:de||null,job_description:L,tailored_resume:B,cover_letter:X,match_score:Y,match_justification:H,notes:v||"",job_url:re||null,application_status:"saved"};if(!t.isGuest&&((Ie=t.session)!=null&&Ie.user)){const Ce=await bf(le);Ce&&(W&&await IC(W,Ce.id),n({type:"ADD_APPLIED_JOB",payload:Ce}))}else{const Ce=new Date().toISOString(),xt=[{...le,id:`guest_${Date.now()}`,created_at:Ce},...t.appliedJobs];await MC(xt),n({type:"SET_APPLIED_JOBS",payload:xt});const dn=`tailor_${Date.now()}`,jh={id:dn,externalId:dn,source:"other",title:Ri(se),company:Ii(be),locationText:de||"Unknown",descriptionSnippet:(L||"").slice(0,240),descriptionFull:L,applyUrl:"",url:""},cl=[{id:`temp_${Date.now()}`,user_id:"guest",job_id:dn,job_title:Ri(se),company_name:Ii(be),job_source:"other",job_data:jh,notes:v||"",saved_at:Ce,updated_at:Ce,status:"saved",status_updated_at:Ce},...t.savedJobs];n({type:"SET_SAVED_JOBS",payload:cl}),await WC(cl)}n({type:"SET_SHOW_SAVE_PROMPT",payload:!1}),te("save_application",{has_notes:!!v})},[t.lastTailoredInfo,t.isGuest,t.session,t.appliedJobs,t.savedJobs]),un=f.useCallback(async()=>{var v,I;if(t.profile){n({type:"SET_IS_GENERATING_SNIPPETS",payload:!0});try{const j=((I=(v=t.session)==null?void 0:v.user)==null?void 0:I.id)||null,L=await VA(t.profile,j);n({type:"SET_SNIPPETS",payload:L}),te("generate_snippets")}catch{n({type:"SET_IS_GENERATING_SNIPPETS",payload:!1})}}},[t.profile]),lr=f.useCallback(async v=>{var I;if(!t.masterResume){n({type:"SET_JOB_SEARCH_ERROR",payload:"Please create your Career Diary first."});return}n({type:"SET_IS_SEARCHING_JOBS",payload:!0}),n({type:"SET_JOB_SEARCH_ERROR",payload:null}),v&&n({type:"SET_JOB_LISTINGS",payload:[]});
589try{const j=v?[]:t.jobListings,L=sR(t.profile)||t.masterResume,B=((I=t.profile)==null?void 0:I.jobPreferences)??null,W=oR(t.searchQuery,B),{jobs:X}=await K2(L,t.locationType,t.location,j,W,3,B),Y=v?X:[...t.jobListings,...X],H=Array.from(new Map(Y.map(be=>[be.url||`${be.jobTitle}-${be.company}`,be])).values());let re=H;const se=H.filter(be=>!be.matchScore||!be.matchJustification).slice(0,5);if(se.length>0){const be=await Promise.allSettled(se.map(async le=>{if(!le.description)return null;const Ie=Yt(t.originalResume||t.masterResume||L),{score:Ce,justification:at}=await yd(Ie,le.description);return{key:le.url||`${le.jobTitle}-${le.company}`,score:Ce,justification:at}})),de=new Map;be.forEach((le,Ie)=>{var Ce,at;le.status==="fulfilled"&&le.value?de.set(le.value.key,{score:le.value.score,justification:le.value.justification}):le.status==="rejected"&&console.warn("Failed to rescore job listing",((Ce=se[Ie])==null?void 0:Ce.url)||((at=se[Ie])==null?void 0:at.jobTitle),le.reason)}),re=H.map(le=>{const Ie=le.url||`${le.jobTitle}-${le.company}`;if(de.has(Ie)){const Ce=de.get(Ie);return{...le,matchScore:Ce.score,matchJustification:Ce.justification}}return le})}n({type:"SET_JOB_LISTINGS",payload:re}),n({type:"SET_HAS_SEARCHED",payload:!0}),te("search_jobs",{query:t.searchQuery,location_type:t.locationType})}catch(j){n({type:"SET_JOB_SEARCH_ERROR",payload:j.message})}finally{n({type:"SET_IS_SEARCHING_JOBS",payload:!1})}},[t.masterResume,t.locationType,t.searchQuery,t.location,t.jobListings,t.profile]),oe=f.useCallback(async(v,I)=>{n({type:"START_OVER"}),n({type:"SET_JOB_URL",payload:v.url}),I(),n({type:"SET_FETCHING_DESCRIPTION",payload:!0});try{const j=await sd(v.url);n({type:"SET_JOB_DESCRIPTION",payload:j})}catch{n({type:"SET_JOB_DESCRIPTION",payload:`Job Title: ${v.jobTitle} 590Company: ${v.company} 591Location: ${v.location} 592 593${RR(v.description||"")}`}),n({type:"SET_ERROR",payload:{type:"job",message:"Auto-fetch failed. Using description from job card."}})}finally{n({type:"SET_FETCHING_DESCRIPTION",payload:!1})}},[]),je=f.useCallback(async(v,I)=>{var B;if(t.isGuest||!((B=t.session)!=null&&B.user))return;const j=10*1024*1024,L=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/msword","text/plain","application/rtf"];if(v.size>j){const W=(v.size/1024/1024).toFixed(2);console.error(`[AppContext] File too large: ${W}MB`),n({type:"SET_ERROR",payload:{type:"file",message:`File too large (${W}MB). Maximum file size is 10MB.`}});return}if(!L.includes(v.type)){console.error(`[AppContext] Unsupported file type: ${v.type}`),n({type:"SET_ERROR",payload:{type:"file",message:"Unsupported file type. Please upload PDF, DOCX, DOC, TXT, or RTF files."}});return}try{return await s.uploadFile(v,t.session.user.id,I)}catch(W){console.error("[AppContext] File upload error:",W),n({type:"SET_ERROR",payload:{type:"file",message:W.message||"Upload failed"}});return}},[t.isGuest,t.session,s.uploadFile]),et=f.useCallback(async v=>{var I;t.isGuest||!((I=t.session)!=null&&I.user)||await s.deleteFile(v,t.session.user.id)},[t.isGuest,t.session,s.deleteFile]),ze=f.useCallback(async(v,I)=>{n({type:"SET_EXTRACTING_ACCOMPLISHMENTS",payload:!0});try{const L=(await Co(v)).map((B,W)=>({experienceId:"pending",accomplishment:{...B,id:`acc-${Date.now()}-${W}`,sourceFileId:I},justification:`Extracted from ${I} via AI`}));n({type:"SET_PENDING_MEMORIES",payload:[...t.pendingMemories,...L]}),console.log(`Extracted ${L.length} accomplishments from ${I}`)}catch(j){console.error("Accomplishment extraction error:",j)}finally{n({type:"SET_EXTRACTING_ACCOMPLISHMENTS",payload:!1})}},[t.pendingMemories]),ur=f.useCallback(v=>{if(!t.profile)return;const I={...t.profile};if(!I.experience||I.experience.length===0)I.experience=[{id:`exp-${Date.now()}`,company:"Career Highlights",jobTitle:"Professional Achievements",location:"",dates:new Date().getFullYear().toString(),description:[],accomplishments:[v.accomplishment]}];else{const j=I.experience[0];j.accomplishments=[...j.accomplishments||[],v.accomplishment]}$(()=>I),n({type:"SET_PENDING_MEMORIES",payload:t.pendingMemories.filter(j=>j.accomplishment.id!==v.accomplishment.id)}
593),console.log("Accepted memory:",v.accomplishment.suggestedTitle)},[t.profile,t.pendingMemories,$]),ys=f.useCallback(v=>{n({type:"SET_PENDING_MEMORIES",payload:t.pendingMemories.filter(I=>I.accomplishment.id!==v.accomplishment.id)}),console.log("Rejected memory:",v.accomplishment.suggestedTitle)},[t.pendingMemories]),Nn=f.useCallback(async v=>{if(!t.profile||v.length===0)return;const j={...t.profile};(!j.experience||j.experience.length===0)&&(j.experience=[{id:`exp-${Date.now()}`,company:"Career Highlights",jobTitle:"Professional Achievements",location:"",dates:new Date().getFullYear().toString(),description:[],accomplishments:[]}]);const L=j.experience[0];L.accomplishments=[...L.accomplishments||[],...v],$(()=>j),await x(j),console.log(`[AppContext] Accepted ${v.length} accomplishments from document upload`),te("accomplishments_accepted_from_document",{count:v.length})},[t.profile,$,x]),dr=f.useCallback((v,I)=>{v&&cd(v,I)&&n({type:"SET_ORIGINAL_RESUME",payload:v})},[n]),kh=f.useMemo(()=>({updateProfile:v=>{$(I=>({...I,...v}))},handleSignOut:E,handleContinueAsGuest:T,handleSetTheme:C,handleLoadUserData:w,handleFileParse:N,setOriginalResumeText:dr,handleMergeResumeUpdate:O,handleReplaceResumeUpdate:k,handleCancelResumeUpdate:z,handleAddAccomplishment:V,handleUpdateAccomplishment:ie,handleDeleteAccomplishment:Q,handleSendProfileChatMessage:J,handleLocationChange:S,handleZipcodeChange:A,handleFetchJobDescription:ve,handleCalculateInitialScore:Be,handleApplyTailoringResult:Ge,handleTailorResume:ee,handleStartOver:ge,handleSendMessage:He,handleGenerateCoverLetter:Je,handleSendCoverLetterMessage:Ke,handleSaveApplication:De,handleGenerateSnippets:un,handleSearchJobs:lr,handleSelectJobAndFetch:oe,handleUploadCorpusFile:je,handleDeleteCorpusFile:et,handleProfileMutation:$,handleClearCareerDiary:K,handleApplyProfileChatUpdate:me,handleRejectProfileChatUpdate:ce,handleUndoLastProfileChatUpdate:xe,handleExtractAccomplishments:ze,handleAcceptMemory:ur,handleRejectMemory:ys,handleAcceptAccomplishments:Nn}),[$,E,T,C,w,N,dr,O,k,z,V,ie,Q,J,S,A,ve,Be,Ge,ee,ge,He,Je,Ke,De,un,lr,oe,je,et,$,K,me,ce,xe,ze,ur,ys,Nn]),Nh={state:t,actions:kh,dispatch:n,toast:c};return a.jsx(qc.Provider,{value:Nh,children:e})},ln=()=>{const e=f.useContext(qc);if(e===void 0)throw new Error("useAppContext must be used within an AppProvider");return e},Kc=(e,t,n=!0)=>{f.useEffect(()=>{if(!n)return;const r=s=>{e.current&&!e.current.contains(s.target)&&t()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[e,t,n])},_h=()=>{const{state:e,actions:t}=ln(),{theme:n}=e,{handleSetTheme:r}=t,[s,o]=f.useState(!1),i=f.useRef(null);Kc(i,()=>o(!1));const c=[{value:"light",label:"Light",icon:a.jsx(Xu,{className:"h-5 w-5"})},{value:"dark",label:"Dark",icon:a.jsx(Zu,{className:"h-5 w-5"})},{value:"system",label:"System",icon:a.jsx(Qu,{className:"h-5 w-5"})}],l=n==="light"?a.jsx(Xu,{className:"h-6 w-6"}):n==="dark"?a.jsx(Zu,{className:"h-6 w-6"}):a.jsx(Qu,{className:"h-6 w-6"});return a.jsxs("div",{className:"relative",ref:i,children:[a.jsx(ue,{onClick:()=>o(!s),variant:"ghost",size:"sm",className:"p-2 text-[var(--text-secondary)] hover:bg-gray-100 dark:hover:bg-slate-800 rounded-full h-auto",title:"Change theme","aria-label":"Theme",children:l}),s&&a.jsx("div",{className:"absolute right-0 mt-2 w-36 bg-white dark:bg-[var(--bg-tertiary)] rounded-md shadow-xl dark:shadow-[0_12px_30px_rgba(0,0,0,0.6)] py-1 z-50 border border-[var(--border-default)] dark:border-[var(--border-default)]/70 transition-colors",children:c.map(u=>a.jsxs(ue,{onClick:()=>{r(u.value),o(!1)},variant:"ghost",size:"sm",className:`flex items-center w-full text-left px-4 py-2 text-sm text-[var(--text-secondary)] dark:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)] dark:hover:bg-[var(--bg-secondary)] border-none justify-start h-auto rounded-none ${n===u.value?"font-bold text-[var(--color-accent)]":""}`,children:[u.icon," ",a.jsx("span",{className:"ml-2",children:u.label})]},u.value))})]})},JR=2500,VR=({honeypotValue:e,elapsedMs:t})=>e.trim()!==""?{blocked:!0,reason:"honeypot"}:t<JR?{blocked:!0,reason:"too_fast"}:{blocked:!1,reason:null}
593,YR={position:"absolute",left:"-9999px",top:"auto",width:"1px",height:"1px",overflow:"hidden"},xh=(e=!0)=>{const t=f.useRef(Date.now()),n=f.useRef(null);return f.useEffect(()=>{e&&(t.current=Date.now())},[e]),{evaluate:f.useCallback(()=>{var o;return VR({honeypotValue:((o=n.current)==null?void 0:o.value)??"",elapsedMs:Date.now()-t.current})},[]),honeypotProps:{ref:n,type:"text",name:"website",tabIndex:-1,autoComplete:"off","aria-hidden":!0,style:YR,defaultValue:""}}},qR={},bh=()=>{const e=typeof window<"u"?window.__RUNTIME_CONFIG__||{}:{},t=qR||{},n=e.VITE_TURNSTILE_SITE_KEY||e.TURNSTILE_SITE_KEY||t.VITE_TURNSTILE_SITE_KEY||"";return typeof n=="string"?n.trim():""},wh="The verification check hasn't appeared yet. Give it a moment and try again â or continue with Google.",KR=e=>!e.responded&&!e.responseInputPresent&&e.containerHeight===0,XR="Please complete the verification challenge below, then try again.",ZR=e=>e.siteKeyConfigured?e.token?{blocked:!1,message:null}:{blocked:!0,message:e.unavailable?wh:XR}:{blocked:!1,message:null},QR="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",ek=25e3,tk='input[name="cf-turnstile-response"]';let yr=null;const nk=()=>window.turnstile?Promise.resolve():yr||(yr=new Promise((e,t)=>{const n=document.createElement("script");n.src=QR,n.async=!1,n.onload=()=>e(),n.onerror=()=>{yr=null,t(new Error("Failed to load Turnstile"))},document.head.appendChild(n)}),yr),Xc=f.forwardRef(({siteKey:e,onToken:t,onUnavailable:n,className:r},s)=>{const o=f.useRef(null),i=f.useRef(null),c=f.useRef(t);c.current=t;const l=f.useRef(n);l.current=n;const u=f.useRef(!1);return f.useImperativeHandle(s,()=>({reset:()=>{var d;c.current(null),i.current!==null&&((d=window.turnstile)==null||d.reset(i.current))}})),f.useEffect(()=>{let d=!1,p;u.current=!1;const m=g=>{var _;d||u.current||(u.current=!0,c.current(null),(_=l.current)==null||_.call(l,g))};return nk().then(()=>{if(!(d||!o.current||!window.turnstile)){try{i.current=window.turnstile.render(o.current,{sitekey:e,theme:"auto",callback:g=>{u.current=!0,c.current(g)},"expired-callback":()=>c.current(null),"error-callback":()=>{var g;u.current=!0,c.current(null),(g=l.current)==null||g.call(l,"render_failed")}})}catch{m("render_failed");return}p=setTimeout(()=>{const g=o.current;KR({responded:u.current,responseInputPresent:!!(g!=null&&g.querySelector(tk)),containerHeight:(g==null?void 0:g.offsetHeight)??0})&&m("never_mounted")},ek)}}).catch(()=>{m("script_failed")}),()=>{var g;if(d=!0,p&&clearTimeout(p),i.current!==null){try{(g=window.turnstile)==null||g.remove(i.current)}catch{}i.current=null}}},[e]),a.jsx("div",{ref:o,className:r})});Xc.displayName="TurnstileWidget";const rk=({onContinueAsGuest:e,onNavigateToGuide:t})=>{const[n,r]=f.useState("signUp"),[s,o]=f.useState(""),[i,c]=f.useState(""),[l,u]=f.useState(!1),[d,p]=f.useState(null),[m,g]=f.useState(!1),[_,h]=f.useState(!1),y=f.useRef(null),b=f.useRef(null),{evaluate:x,honeypotProps:w}=xh(),E=bh(),[T,C]=f.useState(null),S=f.useRef(null),A=O=>{r(O),p(null),setTimeout(()=>{var k;(k=y.current)==null||k.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>{var $;($=b.current)==null||$.focus()},500)},50)};f.useEffect(()=>{h(!0)},[]);const R=async O=>{var k;O.preventDefault(),u(!0),p(null),g(!1);try{if(n==="signIn"){if(E&&!T){p("Please complete the verification challenge below, then try again.");return}const{session:$}=await hC(s,i,T??void 0);$?te("login",{method:"email"}):p("Invalid credentials. Please try again.")}else{const $=x();if($.blocked){te("signup_bot_blocked",{reason:$.reason,surface:"landing_page"}),p("Something went wrong. Please try again.");return}if(E&&!T){p("Please complete the verification challenge below, then try again.");return}await wi(await bo()),await ff(s,i,T??void 0),g(!0)}}catch($){(k=S.current)==null||k.reset();const z=$.message;z.includes("already registered")?p("This email is already registered. Try signing in instead!"):z.includes("Invalid")?p("Invalid email or password. Please check and try again."):z.includes("Unable to connect")||z.includes("Network error")||z.includes("Failed to fetch")?p("Unable to connect to our servers. Please check your internet connection and try again."):p(z)}finally{u(!1)}},N=async O=>{u(!0),p(null);try{n==="signUp"&&await wi(await bo()),O==="apple"?await hf():await Cc(O)}catch(k){p(k.message),u(!1)}};return a.jsxs("div",{className:"min-h-screen min-h-dvh bg-gray-50 dark:bg-gray-950 text-gray-900 dark:text-white transition-colors overflow-x-hidden flex flex-col",children:[a.jsxs("div",{className:"fixed inset-0 pointer-events-none",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-gray-50 via-white to-gray-50 dark:from-gray-950 dark:via-gray-900 dark:to-gray-950 opacity-50"}),a.jsx("div",{className:"absolute top-0 right-0 w-1/2 h-1/2 bg-gradient-to-b from-blue-500/5 to-transparent blur-3xl"})]}),a.jsx("header",{className:"sticky top-0 z-50 border-b border-gray-200/30 dark:border-gray-800/30 bg-gray-50/90 dark:bg-gray-950/90 backdrop-blur-xl transition-all",children:a.jsxs("div",{className:"mx-auto flex w-full max-w-6xl items-center justify-between px-4 py-4 md:px-8 safe-area-top",children:[a.jsxs("div",{className:"transition-all hover:scale-105",children:[a.jsx("div",{className:"sm:hidden",children:a.jsx(to,{size:"md",showText:!0,className:"text-gray-900 dark:text-white"})}),a.jsx("div",{className:"hidden sm:block",children:a.jsx(to,{size:"lg",className:"text-gray-900 dark:text-white"})})]}),a.jsxs("div",{className:"flex items-center gap-2 md:gap-4 flex-shrink-0",children:[a.jsx("div",{className:"hidden md:block",children:a.jsx(_h,{})}),a.jsxs(ue,{onClick:e,variant:"primary",size:"md",className:"rounded-full font-semibold shadow-lg hover:shadow-xl transition-all",children:[a.jsx("span",{className:"hidden sm:inline",children:"Try Free"}),a.jsx("span",{className:"sm:hidden",children:"Try"}),a.jsx("span",{className:"ml-1",children:"â"})]}),a.jsx(ue,{onClick:()=>A("signIn"),variant:"ghost",size:"md",className:"rounded-full",children:"Sign In"})]})]})}),a.jsx("main",{className:`relative mx-auto w-full max-w-7xl px-4 py-8 md:px-8 md:py-12 transition-all duration-slowest ${_?"opacity-100 translate-y-0":"opacity-0 translate-y-8"}`,children:a.jsxs("div",{className:"grid gap-8 md:gap-12 lg:gap-16 md:grid-cols-2 xl:grid-cols-[1.1fr,0.9fr] items-start",children:[a.jsxs("div",{className:"space-y-10 pt-0 max-w-2xl",children:[a.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 text-blue-600 dar
593k:text-blue-400 text-sm font-semibold backdrop-blur-sm animate-fadeIn",children:[a.jsxs("span",{className:"relative flex h-2.5 w-2.5",children:[a.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-blue-600 dark:bg-blue-400 opacity-75"}),a.jsx("span",{className:"relative inline-flex rounded-full h-2.5 w-2.5 bg-blue-600 dark:bg-blue-400"})]}),"AI-Powered Career Management"]}),a.jsxs("div",{className:"space-y-6 animate-fadeIn animation-delay-200",children:[a.jsxs("h1",{className:"text-4xl sm:text-5xl md:text-6xl lg:text-6xl font-bold tracking-tight text-gray-900 dark:text-white leading-tight md:leading-[1.1] max-w-2xl",children:["Tailor Resumes in",a.jsx("br",{}),a.jsx("span",{className:"text-blue-600 dark:text-blue-400 inline-block",children:"30 Seconds"}),a.jsx("br",{}),"Not 3 Hours"]}),a.jsx("p",{className:"text-xl md:text-xl text-gray-600 dark:text-gray-400 max-w-2xl leading-relaxed",children:"AI-powered resume optimization that matches your experience to job requirements. Get ATS-ready resumes instantly."})]}),a.jsx("div",{className:"space-y-4 animate-fadeIn",style:{animationDelay:"400ms"},children:[{icon:a.jsx(dA,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"}),text:"AI-tailored resumes in 30 seconds"},{icon:a.jsx(eo,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"}),text:"Higher match scores = more callbacks"},{icon:a.jsx(Ti,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"}),text:"Track your entire career journey"}].map((O,k)=>a.jsxs("div",{className:"flex items-center gap-4 group",children:[a.jsx("div",{className:"flex-shrink-0 w-11 h-11 rounded-xl bg-blue-50 dark:bg-blue-900/20 flex items-center justify-center border border-blue-200 dark:border-blue-800 group-hover:scale-110 transition-all",children:O.icon}),a.jsx("span",{className:"font-semibold text-gray-900 dark:text-white group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors",children:O.text})]},k))}),a.jsxs("div",{className:"animate-fadeIn pt-4",style:{animationDelay:"600ms"},children:[a.jsxs(ue,{onClick:e,variant:"primary",size:"lg",className:"w-full sm:w-auto font-bold text-lg py-4 px-8 rounded-xl shadow-xl hover:shadow-2xl hover:scale-[1.02] transition-all duration-base",children:[a.jsx(St,{className:"w-5 h-5 mr-2"}),"Try it Free â No Account Needed"]}),a.jsxs("p",{className:"mt-3 text-sm text-[var(--text-secondary)]/60 flex items-center gap-2",children:[a.jsx(Ra,{className:"w-4 h-4"}),a.jsx("span",{children:"No credit card required ⢠Start in seconds"})]})]})]}),a.jsx("div",{ref:y,className:"lg:sticky lg:top-20 xl:top-24 animate-fadeIn animation-delay-400 w-full max-w-lg justify-self-end",children:a.jsx("div",{className:"relative bg-white dark:bg-gray-900 rounded-xl p-6 md:p-8 shadow-xl border border-gray-200 dark:border-gray-800 hover:border-blue-500/30 transition-all duration-300 group",children:a.jsx("div",{className:"relative",children:m?a.jsxs("div",{className:"text-center space-y-6 animate-fadeIn",children:[a.jsx("div",{className:"mx-auto w-20 h-20 rounded-full bg-gradient-to-br from-[var(--color-accent)]/20 to-[var(--color-accent)]/10 flex items-center justify-center animate-bounce",children:a.jsx(Uc,{className:"w-12 h-12 text-[var(--color-accent)]"})}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h2",{className:"text-3xl font-bold text-[var(--text-primary)]",children:"Check your inbox!"}),a.jsxs("p",{className:"text-[var(--text-secondary)] leading-relaxed",children:["We've sent a magic link to ",a.jsx("strong",{className:"text-[var(--color-accent)]",children:s}),a.jsx("br",{}),"Click it to activate your account and start crafting winning resumes!"]})]}),a.jsx(ue,{onClick:()=>g(!1),variant:"ghost",size:"sm",children:"â Back to sign up"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex mb-6 border-b border-[var(--border-default)]",children:[a.jsx("button",{type:"button",onClick:()=>{r("signIn"),p(null)},className:`flex-1 py-3 text-sm font-semibold transition-colors ${n==="signIn"?"text-[var(--color-accent)] border-b-2 border-[var(--color-accent)]":"text-[var(--text-secondary)]/60 hover:text-[var(--text-secondary)]"}`,children:"Sign In"}),a.jsx("button",{type:"button",onClick:()=>{r("signUp"),p(null)},className:`flex-1 py-3 text-sm font-semibold transition-colors ${n==="signUp"?"text-[var(--color-accent)] border-b-2 border-[var(--color-accent)]":"text-[var(--text-secondary)]/60 hover:text-[var(--text-secondary)]"}`,children:"Sign Up"})]}),a.jsxs("div",{className:"text-center space-y-3 mb-8",children:[a.jsx("h2",{className:"text-3xl font-bold text-[var(--text-primary)]",children:n==="signUp"?"Start Free Today":"Welcome Back"}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)]/70 leading-relaxed",children:n==="signUp"?"Join thousands of professionals landing their dream jobs":"Continue your journey to career success"})]}),d&&a.jsxs("div",{className:"bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 text-red-700 dark:text-red-300 p-4 rounded-xl mb-6 text-sm flex items-start gap-3",children:[a.jsx(Ku,{className:"h-5 w-5 flex-shrink-0 mt-1"}),a.jsx("span",{children:d})]}),a.jsxs("div",{className:"space-y-3 mb-6",children:[a.jsx(ue,{onClick:()=>N("google"),disabled:l,variant:"secondary",size:"lg",leftIcon:a.jsx(Df,{className:"h-5 w-5"}),className:"w-full",children:"Continue with Google"}),a.jsxs("button",{type:"button",onClick:()=>N("apple"),disabled:l,"aria-label":"Continue with Apple",className:"w-full inline-flex items-center justify-center gap-3 px-6 py-3 text-base font-semibold rounded-md transition-all bg-black text-white border border-black hover:bg-black/90 dark:bg-white dark:text-black dark:border-white dark:hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[var(--color-accent)] disabled:opacity-60 disabled:cursor-not-allowed",children:[a.jsx(Mf,{className:"h-5 w-5"}),"Continue with Apple"]}),a.jsx(ue,{onClick:()=>N("linkedin_oidc"),disabled:l,variant:"secondary",size:"lg",leftIcon:a.jsx(ms,{className:"h-5 w-5 text-[var(--brand-linkedin)]"}),className:"w-full",children:"Continue with LinkedIn"})]}),a.jsxs("div",{className:"relative my-8",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("div",{className:"w-full border-t border-[var(--border-default)]"})}),a.jsx("div",{className:"relative flex justify-center text-sm",children:a.jsx("span",{className:"px-4 bg-[var(--bg-secondary)] text-[var(--text-secondary)]/60 font-medium",children:"or use email"})})]}),a.jsxs("form",{onSubmit:R,className:"space-y-5",children:[a.jsx("input",{...w}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"block text-sm font-bold text-[var(--text-primary)]",htmlFor:"email",children:"Email Address"}),a.jsx("input",{ref:b,id:"email",name:"email",type:"email",value:s,onChange:O=>o(O.target.value),className:"w-full p-4 border border-[var(--border-default)] rounded-xl focus:ring-4 focus:ring-[var(--color-accent)]/20 focus:border-[var(--color-accent)] transition-all duration-base bg-[var(--bg-secondary)] text-[var(--text-primary)] placeholder:text-[var(--text-secondary)]/50 hover:border-[var(--color-accent)]/50",placeholder:"[email protected]",required:!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"block text-sm font-bold text-[var(--text-primary)]",htmlFor:"password",children:"Password"}),a.jsx("input",{id:"password",name:"password",type:"password",value:i,onChange:O=>c(O.target.value),className:"w-full p-4 border border-[var(--border-default)] rounded-xl focus:ring-4 focus:ring-[var(--color-accent)]/20 focus:border-[var(--color-accent)] transition-all duration-base bg-[var(--bg-secondary)] text-[var(--text-primary)] placeholder:text-[var(--text-secondary)]/50 hover:border-[var(--color-accent)]/50",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",required:!0,minLength:6}),n==="signUp"&&i.length>0&&i.length<6&&a.jsxs("p",{className:"text-xs text-amber-600 dar
593k:text-amber-400 flex items-center gap-1",children:[a.jsx(Ku,{className:"w-4 h-4"})," At least 6 characters required"]})]}),E&&a.jsx(Xc,{ref:S,siteKey:E,onToken:C,className:"flex justify-center"}),a.jsxs(ue,{type:"submit",disabled:l,loading:l,variant:"primary",size:"lg",className:"w-full font-bold py-4 text-lg",children:[n==="signUp"?"Create Free Account":"Sign In",a.jsx("span",{className:"ml-2",children:"â"})]})]}),a.jsxs("div",{className:"mt-6 text-center text-sm text-[var(--text-secondary)]",children:[n==="signUp"?"Already have an account?":"Don't have an account?"," ",a.jsx(ue,{onClick:()=>{r(n==="signUp"?"signIn":"signUp"),p(null)},variant:"ghost",size:"sm",className:"font-bold",children:n==="signUp"?"Sign In":"Sign Up Free"})]}),a.jsxs("div",{className:"mt-6 text-center border-t border-[var(--border-default)] pt-6",children:[a.jsx("p",{className:"text-xs text-[var(--text-secondary)]/60 mb-3",children:"Just want to explore?"}),a.jsxs(ue,{onClick:e,variant:"secondary",size:"md",className:"font-semibold w-full hover:bg-[var(--color-accent)]/10 hover:border-[var(--color-accent)]/30",children:[a.jsx(St,{className:"w-4 h-4 mr-2 text-[var(--color-accent)]"}),a.jsx("span",{children:"Try Free Without Account"}),a.jsx("span",{className:"ml-2",children:"â"})]})]}),a.jsx("div",{className:"mt-6 text-center text-xs text-[var(--text-secondary)]/60",children:a.jsxs("span",{className:"inline-flex items-center gap-2 px-3 py-2 rounded-full bg-[var(--bg-primary)]",children:[a.jsx(Ra,{className:"w-4 h-4"}),a.jsx("span",{children:"Secure ⢠No credit card ⢠Cancel anytime"})]})})]})})})})]})}),a.jsxs("section",{className:"relative mx-auto w-full max-w-6xl px-4 py-12 md:px-8 animate-fadeIn",style:{animationDelay:"800ms"},children:[a.jsxs("div",{className:"text-center space-y-3 mb-12",children:[a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-gray-900 dark:text-white",children:"Everything You Need to Land Your Next Role"}),a.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto",children:"All-in-one platform for job seekers. No credit card. No hidden fees. Just results."})]}),a.jsx("div",{className:"grid md:grid-cols-3 gap-6",children:[{icon:a.jsx(St,{className:"w-7 h-7"}),title:"AI Resume Tailoring",desc:"Automatically optimize your resume for each job posting. Our AI matches your experience to job requirements and incorporates ATS keywords in 30 seconds.",link:"/tailor-resume-to-job-description"},{icon:a.jsx(Xo,{className:"w-7 h-7"}),title:"Career Diary",desc:"Track accomplishments, metrics, and wins as they happen. Never struggle to remember your achievements during resume updates again.",link:"/career-diary-journal"},{icon:a.jsx(Ti,{className:"w-7 h-7"}),title:"Application Tracker",desc:"Manage your entire job search pipeline. Track applications, interviews, and follow-ups in one organized dashboard.",link:"/job-application-tracker"}].map((O,k)=>a.jsxs("div",{className:"relative p-6 bg-white dark:bg-gray-900 rounded-2xl border border-gray-200 dark:border-gray-800 hover:border-blue-500/50 transition-all duration-300 group hover:shadow-xl",children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-500/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity rounded-2xl"}),a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-14 h-14 rounded-xl bg-blue-50 dark:bg-blue-900/20 flex items-center justify-center text-blue-600 dark:text-blue-400 mb-4 group-hover:scale-110 transition-transform",children:O.icon}),a.jsx("h3",{className:"text-xl font-bold text-gray-900 dark:text-white mb-2",children:O.title}),a.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mb-4",children:O.desc}),a.jsxs("a",{href:O.link,className:"text-sm font-semibold text-blue-600 dark:text-blue-400 hover:underline inline-flex items-center gap-1 group-hover:gap-2 transition-all",children:["Learn more ",a.jsx("span",{children:"â"})]})]})]},k))})]}),a.jsxs("section",{className:"relative mx-auto w-full max-w-6xl px-4 py-16 md:px-8 my-12",children:[a.jsxs("div",{className:"text-center space-y-3 mb-12",children:[a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-gray-900 dark:text-white",children:"How It Works"}),a.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto",children:"From generic resume to tailored application in 3 simple steps"})]}),a.jsx("div",{className:"space-y-12",children:[{step:"01",title:"Build Your Career Diary",desc:"Upload your existing resume or enter your experience manually. Our AI extracts every accomplishment, skill, and metric into your personal Career Diaryâa living database of your professional achievements.",icon:a.jsx(Ko,{className:"w-8 h-8"}),details:["One-click PDF upload","Smart parsing of experience","Organized by role and timeline"]},{step:"02",title:"Paste the Job Description",desc:"Copy any job posting and paste it into CareerDiary. Our AI instantly analyzes the requirements, identifies key skills, and scores your match percentage so you know
593where you stand.",icon:a.jsx(Ur,{className:"w-8 h-8"}),details:["ATS keyword extraction","Real-time match scoring","Gap analysis and recommendations"]},{step:"03",title:"Get Your Tailored Resume",desc:'Click "Tailor" and watch as AI rewrites your resume to perfectly match the job. Every bullet point is optimized with relevant keywords while staying 100% truthful to your actual experience.',icon:a.jsx(St,{className:"w-8 h-8"}),details:["30-second AI tailoring","ATS-optimized formatting","Instant download in PDF/DOCX"]}].map((O,k)=>a.jsxs("div",{className:"grid md:grid-cols-[auto,1fr] gap-6 items-start group",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsxs("div",{className:"w-20 h-20 rounded-2xl bg-blue-50 dark:bg-blue-900/20 border-2 border-blue-200 dark:border-blue-800 flex items-center justify-center text-blue-600 dark:text-blue-400 relative group-hover:scale-110 group-hover:bg-blue-600 group-hover:border-blue-600 group-hover:text-white transition-all",children:[O.icon,a.jsx("div",{className:"absolute -top-3 -right-3 w-10 h-10 rounded-full bg-white dark:bg-gray-900 border-2 border-blue-200 dark:border-blue-800 flex items-center justify-center text-sm font-black shadow-lg text-blue-600 group-hover:border-blue-600",children:O.step})]})}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:O.title}),a.jsx("p",{className:"text-gray-600 dark:text-gray-400 leading-relaxed",children:O.desc}),a.jsx("ul",{className:"space-y-2",children:O.details.map(($,z)=>a.jsxs("li",{className:"flex items-center gap-3 text-sm text-gray-600 dark:text-gray-400",children:[a.jsx(eo,{className:"w-5 h-5 text-blue-600 dark:text-blue-400 flex-shrink-0"}),a.jsx("span",{children:$})]},z))})]})]},k))})]}),a.jsxs("section",{className:"relative mx-auto w-full max-w-4xl px-4 py-12 md:px-8 my-12",children:[a.jsxs("div",{className:"text-center space-y-3 mb-12",children:[a.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-gray-900 dark:text-white",children:"Frequently Asked Questions"}),a.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400",children:"Everything you need to know about CareerDiary"})]}),a.jsx("div",{className:"space-y-4",children:[{q:"How does the AI resume tailoring work?",a:"Our AI reads your Career Diary and the job description, then rewrites your resume to emphasize relevant experience and incorporate ATS keywords. It only uses your actual achievementsânothing is fabricated."},{q:"Will my resume pass ATS systems?",a:"Yes. We optimize for ATS compatibility by using clean formatting, incorporating relevant keywords from job descriptions, and avoiding graphics or tables that confuse parsing systems."},{q:"Is my data private and secure?",a:"Absolutely. Your resumes and career data are stored securely and never shared with third parties. You can delete your account and all data at any time."},{q:"Can I use my own resume instead of the AI version?",a:"Of course! CareerDiary is a tool to help you, not replace you. You can edit any AI-generated content, export your Career Diary, or write resumes manually."},{q:"Do I need to create an account?",a:"No. You can try all features as a guest without signing up. Create an account only if you want to save your Career Diary and application history."},{q:"How accurate is the match score?",a:"The match score analyzes keyword overlap, required skills, and experience relevance between your resume and the job description. It helps you understand where you stand and what to emphasize when tailoring."}].map((O,k)=>a.jsxs("details",{className:"group bg-white dark:bg-gray-900 rounded-xl border border-gray-200 dark:border-gray-800 hover:border-blue-500/50 transition-all overflow-hidden",children:[a.jsxs("summary",{className:"cursor-pointer p-6 font-bold text-gray-900 dark:text-white flex items-center justify-between list-none",children:[a.jsx("span",{className:"text-lg",children:O.q}),a.jsx("span",{className:"text-blue-600 dark:text-blue-400 transform group-open:rotate-180 transition-transform text-2xl",children:"â"})]}),a.jsx("div",{className:"px-6 pb-6 text-gray-600 dark:text-gray-400 leading-relaxed border-t border-gray-100 dark:border-gray-800 pt-4",children:O.a})]},k))})]}),a.jsx("footer",{className:"relative border-t border-[var(--border-default)] bg-[var(--bg-secondary)] transition-colors mt-16",children:a.jsxs("div",{className:"mx-auto max-w-7xl px-4 py-12 md:px-8",children:[a.jsxs("div",{className:"grid md:grid-cols-4 gap-8 mb-8",children:[a.jsxs("div",{className:"md:col-span-1 space-y-4",children:[a.jsx(to,{size:"sm",className:"text-[var(--text-primary)] hover:scale-105 transition-transform duration-base"}),a.jsx("p",{className:"text-sm text-[var(--text-secondary)]/70 leading-relaxed",children:"AI-powered career management platform for modern job seekers."})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-sm font-bold text-[var(--text-primary)] uppercase tracking-wide",children:"Features"}),a.jsxs("ul",{className:"space-y-2 text-sm text-[var(--text-secondary)]/70",children:[a.jsx("li",{children:a.jsx("a",{href:"/tailor-resume-to-job-description",className:"hover:text-[var(--color-accent)] transition-colors",children:"Resume Tailor"})}),a.jsx("li",{children:a.jsx("a",{href:"/ats-resume-checker",className:"hover:text-[var(--color-accent)] transition-colors",children:"ATS Resume Checker"})}),a.jsx("li",{children:a.jsx("a",{href:"/tools/resume-or-market",className:"hover:text-[var(--color-accent)] transition-colors",children:"Resume or the Market?"})}),a.jsx("li",{children:a.jsx("a",{href:"/ai-cover-letter-generator",className:"hover:text-[var(--color-accent)] transition-colors",children:"Cover Letter Generator"})}),a.jsx("li",{children:a.jsx("a",{href:"/career-diary-journal",className:"hover:text-[var(--color-accent)] transition-colors",children:"Career Diary"})}),a.jsx("li",{children:a.jsx("a",{href:"/job-application-tracker",className:"hover:text-[var(--color-accent)] transition-colors",children:"Application Tracker"})})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-sm font-bold text-[var(--text-primary)] uppercase tracking-wide",children:"Resources"}),a.jsxs("ul",{className:"space-y-2 text-sm text-[var(--text-secondary)]/70",children:[a.jsx("li",{children:a.jsx(ue,{onClick:t,variant:"ghost",size:"sm",className:"p-0 h-auto font-normal hover:text-[var(--color-accent)]",children:"User Guide"})}),a.jsx("li",{children:a.jsx("a",{href:"/tailor-resume-to-job-description",className:"hover:text-[var(--color-accent)] transition-colors",children:"How to Tailor Resumes"})}),a.jsx("li",{children:a.jsx("a",{href:"/free-resume-tailoring",className:"hover:text-[var(--color-accent)] transition-colors",children:"Free Resume Tools"})})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-sm font-bold text-[var(--text-primary)] uppercase tracking-wide",children:"Legal"}),a.jsxs("ul",{className:"space-y-2 text-sm text-[var(--text-secondary)]/70",children:[a.jsx("li",{children:a.jsx("a",{href:"/privacy",className:"hover:text-[var(--color-accent)] transition-colors",children:"Privacy Policy"})}),a.jsx("li",{children:a.jsx("a",{href:"/terms",className:"hover:text-[var(--color-accent)] transition-colors",children:"Terms of Service"})}),a.jsx("li",{children:a.jsx("a",{href:"mailto:[email protected]",className:"hover:text-[var(--color-accent)] transition-colors",children:"Contact Support"})})]})]})]}),a.jsxs("div",{className:"pt-8 border-t border-[var(--border-default)] flex flex-col md:flex-row items-center justify-between gap-4",children:[a.jsx("p",{className:"text-sm text-[var(--text-secondary)]/60",children:"© 2026 CareerDiary.io. Built with care for job seekers."}),a.jsxs("div",{className:"flex items-center gap-4 text-xs text-[var(--text-secondary)]/60",children:[a.jsxs("span",{className:"inline-flex items-center gap-2",children:[a.jsx(Ra,{className:"w-4 h-4"}),"Secure & Private"]}),a.jsxs("span",{className:"inline-flex items-center gap-2",children:[a.jsx(eo,{className:"w-4 h-4"}),"100% Free"]})]})]})]})})]})},Da="seo-structured-data";function It(e,t,n){if(!n)return;let r=document.querySelector(`meta[${e}="${t}"]`);r||(r=document.createElement("meta"),r.setAttribute(e,t),document.head.appendChild(r)),r.setAttribute("content",n)}function sk(e){if(!e)return;let t=document.querySelector('link[rel="canonical"]');t||(t=document.createElement("link"),t.setAttribute("rel","canonical"),document.head.appendChild(t)),t.setAttribute("href",e)}function ok(e){const{title:t,description:n,canonical:r,ogImage:s,ogUrl:o,type:i="website",structuredData:c}=e;f.useEffect(()=>{if(document.title=t,It("name","description",n),It("property","og:title",t),It("property","og:description",n),It("property","og:type",i),o&&It("property","og:url",o),s&&It("property","og:image",s),It("name","twitter:title",t),It("name","twitter:description",n),s&&It("name","twitter:image",s),r&&sk(r),c&&typeof c=="object"){const l=document.getElementById(Da);l&&l.remove();const u=document.createElement("script");u.id=Da,u.type="application/ld+json",u.text=JSON.stringify(c),document.head.appendChild(u)}return()=>{const l=document.getElementById(Da);l&&l.remove()}},[t,n,r,s,o,i])}const Br=({children:e,variant:t="default",padding:n="md",className:r=""})=>{const s={default:"bg-[var(--bg-secondary)] border border-[var(--border-default)]",soft:"iconic-surface-soft",glass:"iconic-surface"},o={sm:"p-4",md:"p-6",lg:"p-8"};return a.jsx("div",{className:`${s[t]} ${o[n]} rounded-2xl ${r}`,children:e})};function WP(e){return e?/^[\w.+-]+@[\w.-]+\.\w{2,}$/i.test(e.trim()):!1}function Sh(e){return e?/@privaterelay\.appleid\.com$/i.test(e.trim()):!1}function ak(e){const t=String(e||"").trim();return t?Sh(t)?"Apple private email":t:"No email on file"}function JP(e){if(!e)return!1;const t=e.replace(/\D/g,"");return t.length===10||t.length===11}function VP(e){if(!e)return!1;try{return new URL(e.startsWith("http")?e:`https://${e}`),!0}catch{return!1}}function YP(e){if(!e)return"";const t=e.replace(/\D/g,"");return t.length===10?`(${t.slice(0,3)}) ${t.slice(3,6)}-${t.slice(6)}`:t.length===11&&t[0]==="1"?`+1 (${t.slice(1,4)}) ${t.slice(4,7)}-${t.slice(7)}`:e}function qP(e){if(!e)return"";let t=e.trim();return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`https://${t}`),t=t.replace(/\/$/,""),t}const Ma=e=>typeof e=="string"?e.trim().split(/\s+/)[0]??"":"",ik=({profileFullName:e,metadataName:t,email:n})=>{var i;const r=Ma(e);if(r)return r;const s=Ma(t);if(s)return s;if(Sh(n))return"";const o=(i=n==null?void 0:n.split("@")[0])==null?void 0:i.trim();return o?Ma(o.replace(/[._-]+/g," ")):""},js=["upload_resume","review_profile","set_preferences","search_first_job","tailor_resume"],Eh=e=>`careerdiary_onboarding:${e}`,ck=e=>{if(typeof window>"u")return{completedSteps:[]};try{const t=window.localStorage.getItem(Eh(e));if(!t)return{completedSteps:[]};const n=JSON.parse(t);return{completedSteps:Array.isArray(n.completedSteps)?n.completedSteps:[],dismissedAt:n.dismissedAt,completedAt:n.completedAt}}catch{return{completedSteps:[]}}},Ua=(e,t)=>{typeof window>"u"||window.localStorage.setItem(Eh(e),JSON.stringify(t))};function vh(){var h,y,b,x;const{state:e}=ln(),t=(h=e.session)==null?void 0:h.user,[n,r]=f.useState({completedSteps:[]}),[s,o]=f.useState(!0);f.useEffect(()=>{if(!(t!=null&&t.id)){r({completedSteps:[]}),o(!1);return}
593r(ck(t.id)),o(!1)},[t==null?void 0:t.id]);const i=f.useMemo(()=>{var S,A,R,N,O,k,$,z;const w=new Set,E=e.profile;E&&(E.fullName||E.summary||(S=E.skills)!=null&&S.length||(A=E.experience)!=null&&A.length)&&w.add("upload_resume");const C=E==null?void 0:E.jobPreferences;return C&&((((R=C.targetRoles)==null?void 0:R.length)??0)>0||(((N=C.preferredLocations)==null?void 0:N.length)??0)>0||(((O=C.locationTypes)==null?void 0:O.length)??0)>0||C.salaryExpectation||C.searchRadius!=null)&&w.add("set_preferences"),((((k=e.jobListings)==null?void 0:k.length)??0)>0||((($=e.savedJobs)==null?void 0:$.length)??0)>0)&&w.add("search_first_job"),(e.lastTailoredInfo||(((z=e.appliedJobs)==null?void 0:z.length)??0)>0)&&w.add("tailor_resume"),w},[(y=e.appliedJobs)==null?void 0:y.length,(b=e.jobListings)==null?void 0:b.length,e.lastTailoredInfo,e.profile,(x=e.savedJobs)==null?void 0:x.length]),c=f.useMemo(()=>{const w=new Set(n.completedSteps);return i.forEach(E=>w.add(E)),js.filter(E=>w.has(E))},[i,n.completedSteps]),l=c.length===js.length||!!n.completedAt;f.useEffect(()=>{if(!(t!=null&&t.id)||!l||n.completedAt)return;const w={...n,completedSteps:js,completedAt:new Date().toISOString()};Ua(t.id,w),r(w)},[l,n,t==null?void 0:t.id]);const u=f.useMemo(()=>{var S,A;if(!(t!=null&&t.id)||s||l||n.dismissedAt)return!1;const w=t.created_at?new Date(t.created_at).getTime():null,E=w?Date.now()-w<1440*60*1e3:!1,T=e.profile,C=!!(T!=null&&T.fullName||T!=null&&T.summary||(S=T==null?void 0:T.skills)!=null&&S.length||(A=T==null?void 0:T.experience)!=null&&A.length);return E&&!C},[e.profile,l,s,n.dismissedAt,t==null?void 0:t.created_at,t==null?void 0:t.id]),d=f.useCallback(w=>{t!=null&&t.id&&r(E=>{const T=w(E);return Ua(t.id,T),T})},[t==null?void 0:t.id]),p=f.useCallback(w=>{d(E=>({...E,completedSteps:Array.from(new Set([...E.completedSteps,w]))}))},[d]),m=f.useCallback(()=>{d(w=>({...w,completedSteps:js,completedAt:new Date().toISOString(),dismissedAt:void 0}))},[d]),g=f.useCallback(()=>{d(w=>({...w,dismissedAt:new Date().toISOString()}))},[d]),_=f.useCallback(()=>{if(!(t!=null&&t.id))return;const w={completedSteps:[]};Ua(t.id,w),r(w)},[t==null?void 0:t.id]);return{isComplete:l,shouldShow:u,isLoading:s,completedSteps:c,completeStep:p,markComplete:m,dismiss:g,reset:_}}function Th(e){const t=Array.isArray(e.scoreBreakdown)?e.scoreBreakdown:[];return{totalScore:Number(e.score??e.totalScore??0),generatedAt:e.createdAt??e.generatedAt??new Date().toISOString(),summary:e.summary??"",grade:e.grade??"",readinessBand:e.readinessBand??"building",strengths:Array.isArray(e.strengths)?e.strengths:[],improvementAreas:Array.isArray(e.gaps)?e.gaps:Array.isArray(e.improvementAreas)?e.improvementAreas:[],dimensions:t.map(n=>({id:n.key??n.id??"",label:n.label??"",score:Number(n.score??0),maxScore:Number(n.maxScore??100),weight:Number(n.weight??0),detail:Array.isArray(n.notes)?n.notes.join(" · "):n.detail??"",suggestions:Array.isArray(n.gaps)?n.gaps:Array.isArray(n.suggestions)?n.suggestions:[]}))}}const ea=async()=>{var r;const e={"Content-Type":"application/json"},t=await(Z==null?void 0:Z.auth.getSession()),n=(r=t==null?void 0:t.data.session)==null?void 0:r.access_token;return n&&(e.Authorization=`Bearer ${n}`),e},lk=async()=>{const e=await fetch("/api/growth/readiness/current",{headers:await ea()});if(!e.ok)throw new Error("Failed to load career score");return Th(await e.json())},KP=async(e="career-score")=>{const t=await fetch("/api/growth/readiness/share",{method:"POST",headers:await ea(),body:JSON.stringify({source:e})});if(!t.ok)throw new Error("Failed to create share link");return t.json()},XP=async e=>{const t=await fetch(`/api/growth/readiness/public/${e}`);if(!t.ok)throw new Error("Failed to load shared score");return Th(await t.json())},ZP=async()=>{var n;const e=await fetch("/api/growth/referrals/dashboard",{headers:await ea()});if(!e.ok)throw new Error("Failed to load referral dashboard");const t=await e.json();return{referralCode:t.referralCode??"",referralLink:t.referralLink??"",vanityCode:t.vanityCode??null,proExpiresAt:t.proExpiresAt??null,totalDaysEarned:Number(t.totalDaysEarned??0),referralCount:Number(t.referralCount??((n=t.stats)==null?void 0:n.signups)??0),stats:t.stats??{shares:Number(t.claimedByCount??0),clicks:Number(t.claimedByCount??0),signups:Number(t.convertedClaims??t.claimedByCount??0),activations:Number(t.successfulClaims??0)},recentEvents:t.recentEvents??(t.recentClaims??[]).map(r=>({event_type:r.status??"claim",created_at:r.created_at??r.claimedAt??new Date().toISOString(),referred_user_id:r.claimant_user_id??r.claimantUserId??null,source:r.source??null}))}},QP=async e=>{const t=await fetch(`/api/growth/landing/${encodeURIComponent(e)}`);
593if(!t.ok)throw new Error("Failed to load landing data");return t.json()},e5=async e=>{const t=await fetch("/api/growth/referrals/vanity",{method:"POST",headers:await ea(),body:JSON.stringify({vanityCode:e})});if(!t.ok){const n=await t.json().catch(()=>null);throw new Error((n==null?void 0:n.error)||"Failed to save vanity code")}return t.json()},Ch=e=>!e.dismissed&&!e.hasDiaryContent&&!e.isHydratingProfile&&(e.hasSession||e.isGuest)&&!e.isAuthLoading,uk=e=>e.devPreview||!e.dismissed&&(e.inProgress||Ch(e)),dk=4;const Td=`Senior Product Manager, AI Platform â Verra Mobility 594We're looking for a PM to own our AI/ML platform roadmap: embeddings-powered matching, A/B experimentation, and product-led growth. React/Node a plus. You'll partner with engineering and drive measurable activation and retention gains.`,Fa=!1,pk=({value:e})=>{const n=2*Math.PI*74,r=n-n*Math.max(0,Math.min(100,e))/100;return a.jsxs("div",{className:"relative h-44 w-44",children:[a.jsxs("svg",{width:"176",height:"176",viewBox:"0 0 176 176",className:"-rotate-90",children:[a.jsx("circle",{cx:"88",cy:"88",r:74,fill:"none",stroke:"var(--line)",strokeWidth:"12"}),a.jsx("circle",{cx:"88",cy:"88",r:74,fill:"none",stroke:"var(--ever-500)",strokeWidth:"12",strokeLinecap:"round",strokeDasharray:n,strokeDashoffset:r,style:{transition:"stroke-dashoffset 900ms cubic-bezier(.2,.6,.2,1)"}})]}),a.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[a.jsx("span",{className:"font-mono text-5xl font-semibold tabular-nums text-[var(--ink)]",children:e}),a.jsx("span",{className:"font-mono text-xs text-[var(--ink-3)]",children:"/ 100"})]})]})},mk=({devPreview:e=!1})=>{var He,Je,Ke,De,un,lr;const t=qe(),{state:n,actions:r}=ln(),{session:s,isGuest:o,isAuthLoading:i}=Qe(),{markComplete:c}=vh(),l=`careerdiary_firstrun_done:${((He=s==null?void 0:s.user)==null?void 0:He.id)||"guest"}`,u="careerdiary_firstrun_done:guest",[d,p]=f.useState(()=>{if(e)return!1;try{return localStorage.getItem(l)==="true"||localStorage.getItem(u)==="true"}catch{return!1}}),[m,g]=f.useState(!1),[_,h]=f.useState(0),[y,b]=f.useState(!1),[x,w]=f.useState(!1),[E,T]=f.useState(null),[C,S]=f.useState(""),[A,R]=f.useState(""),[N,O]=f.useState(null),[k,$]=f.useState(null),[z,K]=f.useState(0),V=f.useRef(null),ie=f.useRef(null),Q=!!(n.profile&&((Je=n.profile.experience)!=null&&Je.length||(Ke=n.profile.skills)!=null&&Ke.length||n.profile.summary)),J=n.profile,me={devPreview:e,dismissed:d,inProgress:m,hasDiaryContent:Q,isHydratingProfile:!!n.isHydratingProfile,hasSession:!!s,isGuest:!!o,isAuthLoading:!!i},ce=Ch(me),xe=uk(me);f.useEffect(()=>{ce&&g(!0)},[ce]),f.useEffect(()=>{var oe;xe&&((oe=ie.current)==null||oe.focus())},[xe,_]),f.useEffect(()=>{if(_!==1){K(0);return}const oe=[300,700,1100].map((je,et)=>setTimeout(()=>K(ze=>Math.max(ze,et+1)),je));return()=>oe.forEach(clearTimeout)},[_]),f.useEffect(()=>{if(_!==2||N)return;let oe=!1;return w(!0),lk().then(je=>{oe||O(je)}).catch(()=>{oe||T("Could not load your score â you can continue and view it later.")}).finally(()=>w(!1)),()=>{oe=!0}},[_,N]);const ve=oe=>{if(p(!0),g(!1),!e){try{localStorage.setItem(l,"true"),localStorage.setItem(u,"true")}catch{}if(oe)try{c()}catch{}t("/app/home")}},Be=async oe=>{T(null),b(!0);try{if(!Fa)if(oe){const je=oe.size>10485760,et=/\.(pdf|docx?|txt|rtf)$/i.test(oe.name);if(je||!et){T(je?"That file is over 10MB â try a smaller PDF or DOCX.":"Unsupported file â use a PDF or DOCX, or paste the text."),b(!1);return}await r.handleFileParse(oe)}else if(C.trim())await r.handleFileParse(new File([C],"resume.txt",{type:"text/plain"}));else{b(!1);return}h(1)}catch{T("We couldnât read that resume. Try a PDF or DOCX, or paste the text.")}finally{b(!1)}},Ge=async()=>{var oe;T(null),b(!0);try{if(!Fa){const je=A.match(/^(.*?)(?:\n|â|-|,)/),et=je?je[1].trim().slice(0,80):"Target Role",ze=await Jf(n.profile,A||Td,et,"Target Company",[],1,((oe=s==null?void 0:s.user)==null?void 0:oe.id)??null);$({tailoredMatchScore:(ze==null?void 0:ze.tailoredMatchScore)??0,changeSummary:(ze==null?void 0:ze.changeSummary)??"",tailoredResume:(ze==null?void 0:ze.tailoredResume)??""})}}catch{T("Tailoring hit a snag â you can try again from the Tailor page.")}finally{b(!1)}},ee=f.useMemo(()=>{var ze,ur;const oe=((ze=J==null?void 0:J.experience)==null?void 0:ze.length)??0,je=((ur=J==null?void 0:J.skills)==null?void 0:ur.length)??0,et=((J==null?void 0:J.experience)??[]).reduce((ys,Nn)=>{var dr;return ys+(((dr=Nn==null?void 0:Nn.accomplishments)==null?void 0:dr.length)??0)},0);return{roles:oe,skills:je,accomplishments:et}},[J]);if(!xe)return null;const ge=({n:oe})=>a.jsxs("div",{className:"font-mono text-xs font-semibold uppercase tracking-[0.1em] text-[var(--ink-3)]",children:["Step ",oe," of ",dk]});return a.jsxs("div",{ref:ie,tabIndex:-1,onKeyDown:oe=>
594{oe.key==="Escape"&&ve(!1)},className:"fixed inset-0 z-50 overflow-y-auto bg-[var(--paper)] outline-none",role:"dialog","aria-modal":"true","aria-busy":y||x,"aria-label":"Get started with CareerDiary",children:[a.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between border-b border-[var(--line)] bg-[var(--paper)]/85 px-6 py-4 backdrop-blur-sm",children:[a.jsxs("span",{className:"font-display text-lg font-semibold text-[var(--ink)]",children:["CareerDiary",a.jsx("span",{className:"text-[var(--ever-500)]",children:".io"})]}),a.jsxs("button",{type:"button",onClick:()=>ve(!1),className:"font-mono text-xs font-semibold uppercase tracking-[0.08em] text-[var(--ink-3)] hover:text-[var(--ink)] transition-colors",children:[_===0?"I'll do this later":"Skip setup"," â"]})]}),a.jsxs("div",{className:"mx-auto w-full max-w-3xl px-6 py-10 md:py-14",children:[E&&a.jsx("div",{role:"alert",className:"mb-6 rounded-lg border border-[var(--amber)] bg-[var(--amber-bg)] px-4 py-3 text-sm text-[var(--ink-2)]",children:E}),_===0&&a.jsxs("div",{className:"space-y-6",children:[a.jsx(ge,{n:1}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-display text-4xl font-semibold text-[var(--ink)]",children:"Letâs build your Career Diary"}),a.jsx("p",{className:"mt-2 max-w-xl text-[var(--ink-2)]",children:"Drop in your resume â weâll build the rest. This becomes the source every tailored resume is generated from."})]}),a.jsxs("button",{type:"button",onClick:()=>{var oe;return(oe=V.current)==null?void 0:oe.click()},disabled:y,className:"flex w-full flex-col items-center justify-center gap-3 rounded-2xl border border-dashed border-[var(--line-strong)] bg-[var(--surface)] py-14 transition-colors hover:border-[var(--ever-400)] disabled:opacity-60",children:[a.jsx("span",{className:"inline-flex rounded-xl bg-[var(--ever-050)] p-3 text-[var(--ever-600)]",children:a.jsx(rA,{className:"h-7 w-7"})}),a.jsx("span",{className:"text-lg font-semibold text-[var(--ink)]",children:y?"Reading your resumeâ¦":"Upload your resume"}),a.jsx("span",{className:"text-sm text-[var(--ink-3)]",children:"PDF or DOCX · drag & drop or click"})]}),a.jsx("input",{ref:V,type:"file",accept:".pdf,.doc,.docx,.txt,.rtf",className:"hidden",onChange:oe=>{var et;const je=(et=oe.target.files)==null?void 0:et[0];je&&Be(je),oe.target.value=""}}),a.jsxs("div",{className:"flex items-center gap-4 text-[var(--ink-3)]",children:[a.jsx("div",{className:"h-px flex-1 bg-[var(--line)]"}),a.jsx("span",{className:"font-mono text-xs",children:"or paste it"}),a.jsx("div",{className:"h-px flex-1 bg-[var(--line)]"})]}),a.jsx("textarea",{value:C,onChange:oe=>S(oe.target.value),placeholder:"Paste your resume text hereâ¦",className:"min-h-[120px] w-full rounded-lg border border-[var(--line-strong)] bg-[var(--surface)] px-4 py-3 text-sm text-[var(--ink)] focus:border-[var(--ever-500)] focus:outline-none focus:ring-2 focus:ring-[var(--ever-050)]"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ue,{variant:"primary",size:"lg",disabled:y||!C.trim()&&!Fa,onClick:()=>{Be()},children:y?"Buildingâ¦":"Build my Diary â"}),a.jsx("button",{type:"button",onClick:()=>ve(!1),className:"text-sm text-[var(--ink-3)] hover:text-[var(--ink)]",children:"Iâll do this later"})]})]}),_===1&&a.jsxs("div",{className:"space-y-6",children:[a.jsx(ge,{n:2}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-display text-4xl font-semibold text-[var(--ink)]",children:"Weâre building your Career Diary"}),a.jsxs("p",{className:"mt-2 max-w-xl text-[var(--ink-2)]",children:["Every win, role and skill â pulled straight from your resume. ",a.jsx("span",{className:"text-[var(--ever-700)] font-medium",children:"This is your Career Diary: saved once, reused on every resume."})]})]}),a.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[{label:"roles",value:ee.roles},{label:"skills",value:ee.skills},{label:"accomplishments",value:ee.accomplishments}].map((oe,je)=>a.jsxs("div",{className:`rounded-xl border border-[var(--ever-100)] bg-[var(--ever-050)] p-5 transition-all duration-500 ${z>je?"opacity-100 translate-y-0":"opacity-0 translate-y-2"}`,children:[a.jsxs("div",{className:"flex items-center gap-2 text-[var(--ever-700)]",children:[a.jsx(eo,{className:"h-5 w-5"}),a.jsx("span",{className:"font-mono text-2xl font-semibold tabular-nums",children:oe.value})]}),a.jsx("div",{className:"mt-1 font-mono text-xs uppercase tracking-[0.08em] text-[var(--ink-3)]",children:oe.label})]},oe.label))}),a.jsxs("div",{className:"rounded-xl border border-[var(--line)] bg-[var(--surface)] p-5",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[var(--ink-2)]",children:[a.jsx(Ko,{className:"h-5 w-5 text-[var(--ever-600)]"}),a.jsx("span",{className:"font-semibold text-[var(--ink)]",children:(J==null?void 0:J.fullName)||"Your Diary"})]}),(J==null?void 0:J.summary)&&a.jsx("p",{className:"mt-2 text-sm text-[var(--ink-2)] line-clamp-3",children:J.summary})]}),a.jsx(ue,{variant:"primary",size:"lg",onClick:()=>h(2),children:"Continue â"})]}),_===2&&a.jsxs("div",{className:"space-y-6",children:[a.jsx(ge,{n:3}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-display text-4xl font-semibold text-[var(--ink)]",children:"Hereâs where you stand"}),a.jsx("p",{className:"mt-2 max-w-xl text-[var(--ink-2)]",children:"A starting point, not a verdict â hereâs the fastest way to climb."})]}),a.jsxs("div",{className:"flex flex-col items-center gap-5 rounded-2xl border border-[var(--line)] bg-[var(--surface)] p-8 sm:flex-row sm:items-center sm:gap-8",children:[a.jsx(pk,{value:(N==null?void 0:N.totalScore)??0}),a.jsxs("div",{className:"flex-1 text-center sm:text-left",children:[a.jsx("div",{className:"font-mono text-xs font-semibold uppercase tracking-[0.08em] text-[var(--ever-700)]",children:N!=null&&N.readinessBand?`${N.readinessBand} · grade ${N.grade}`:x?"Calculatingâ¦":"Readiness"}),a.jsx("p",{className:"mt-2 text-[var(--ink-2)]",children:(N==null?void 0:N.summary)||"Your readiness score reflects how application-ready your Diary is."}),((De=N==null?void 0:N.improvementAreas)==null?void 0:De[0])&&a.jsxs("p",{className:"mt-3 inline-flex rounded-full bg-[var(--ever-050)] px-3 py-1 font-mono text-xs font-semibold text-[var(--ever-700)]",children:["â ",N.improvementAreas[0]]})]})]}),a.jsx(ue,{variant:"primary",size:"lg",onClick:()=>h(3),children:"Continue â"})]}),_===3&&a.jsxs("div",{className:"space-y-6",children:[a.jsx(ge,{n:4}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-display text-4xl font-semibold text-[var(--ink)]",children:"Your first tailored resume"}),a.jsxs("p",{className:"mt-2 max-w-xl text-[var(--ink-2)]",children:["Paste a job you want â weâll tailor your Diary to it in about a minute. ",!k&&"Not sure? Use our sample."]})]}),k?a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-4 roun
594ded-2xl border border-[var(--ever-300)] bg-[var(--surface)] p-5",children:[a.jsxs("div",{className:"flex items-baseline gap-1",children:[a.jsx("span",{className:"font-mono text-4xl font-semibold tabular-nums text-[var(--ink)]",children:k.tailoredMatchScore}),a.jsx("span",{className:"font-mono text-sm text-[var(--ink-3)]",children:"/ 100 match"})]}),a.jsx("span",{className:"inline-flex items-center gap-1 rounded-full bg-[var(--ever-050)] px-3 py-1 font-mono text-xs font-semibold text-[var(--ever-700)]",children:"⦠Tailored to the role"})]}),a.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[a.jsxs("div",{className:"rounded-xl border border-[var(--line)] bg-[var(--surface-sunk)] p-5 opacity-80",children:[a.jsx("div",{className:"font-mono text-xs uppercase tracking-[0.06em] text-[var(--ink-3)]",children:"Before â your base"}),a.jsx("pre",{className:"mt-3 whitespace-pre-wrap font-sans text-xs leading-relaxed text-[var(--ink-3)]",children:n.originalResume||n.masterResume||""})]}),a.jsxs("div",{className:"rounded-xl border border-[var(--ever-300)] bg-[var(--surface)] p-5",children:[a.jsx("div",{className:"font-mono text-xs uppercase tracking-[0.06em] text-[var(--ever-700)]",children:"⦠After â tailored"}),a.jsx("pre",{className:"mt-3 whitespace-pre-wrap font-sans text-xs leading-relaxed text-[var(--ink-2)]",children:k.tailoredResume})]})]}),k.changeSummary&&a.jsxs("div",{className:"rounded-xl border border-[var(--line)] bg-[var(--surface-sunk)] p-5",children:[a.jsx("div",{className:"font-sans text-base font-semibold text-[var(--ink)]",children:"What changed, and why"}),a.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ink-2)]",children:k.changeSummary})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[a.jsx(ue,{variant:"primary",size:"lg",onClick:()=>ve(!0),children:"Go to your home â"}),a.jsx("span",{className:"font-mono text-xs text-[var(--ever-700)]",children:"â Your Diary is built and working"})]})]}):a.jsxs(a.Fragment,{children:[a.jsx("textarea",{value:A,onChange:oe=>R(oe.target.value),placeholder:"Paste a job descriptionâ¦",className:"min-h-[160px] w-full rounded-lg border border-[var(--line-strong)] bg-[var(--surface)] px-4 py-3 text-sm text-[var(--ink)] focus:border-[var(--ever-500)] focus:outline-none focus:ring-2 focus:ring-[var(--ever-050)]"}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsx(ue,{variant:"primary",size:"lg",disabled:y||!((lr=(un=n.profile)==null?void 0:un.experience)!=null&&lr.length),onClick:()=>{Ge()},children:y?"Tailoringâ¦":"Tailor my resume â"}),!A.trim()&&a.jsx("button",{type:"button",onClick:()=>R(Td),className:"text-sm text-[var(--ink-3)] hover:text-[var(--ink)]",children:"Use a sample job"}),a.jsx("button",{type:"button",onClick:()=>ve(!1),className:"ml-auto text-sm text-[var(--ink-3)] hover:text-[var(--ink)]",children:"Skip to home â"})]})]})]})]})]})},fk=({promptEvent:e,onInstall:t})=>e?a.jsx(Br,{variant:"glass",className:"border border-[var(--border-default)]/70 bg-gradient-to-br from-emerald-500/12 via-white to-white dark:from-emerald-500/10 dark:via-slate-900 dark:to-slate-900",children:a.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-2xl bg-emerald-500/10 p-3 text-emerald-600 dark:text-emerald-300",children:a.jsx(uA,{className:"h-6 w-6"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full bg-emerald-500/10 px-3 py-1 text-xs font-semibold uppercase tracking-[0.18em] text-emerald-700 dark:text-emerald-300",children:[a.jsx(St,{className:"h-4 w-4"}),"PWA Ready"]}),a.jsx("h3",{className:"mt-3 text-xl font-bold text-[var(--text-primary)]",children:"Install CareerDiary on this device"}),a.jsx("p",{className:"mt-2 text-sm text-[var(--text-secondary)]",children:"Save the app to your home screen for faster access to diary updates, resume tailoring, and career planning."})]})]}),a.jsx(ue,{variant:"primary",size:"md",onClick:()=>{t()},children:"Install App"})]})}
594):null,hk=({tone:e="evergreen",icon:t,title:n,onDismiss:r,dismissAriaLabel:s="Dismiss",compact:o=!1,className:i="",children:c})=>{const l=e==="amber"?"border-[var(--amber)] bg-[var(--amber-bg)]":"border-[var(--ever-100)] bg-[var(--ever-050)]";return a.jsxs("div",{role:"status",className:`relative rounded-2xl border ${l} ${o?"p-4":"p-5"} animate-nudge-up ${i}`,children:[r&&a.jsx("button",{type:"button",onClick:r,"aria-label":s,className:"absolute right-3 top-3 rounded-full p-1 text-[var(--ink-3)] transition-colors hover:bg-[var(--surface)] hover:text-[var(--ink)]",children:a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),n&&a.jsxs("h3",{className:"flex items-center gap-2 pr-8 text-base font-semibold text-[var(--ink)]",children:[t,n]}),a.jsx("div",{className:n?"mt-1.5":"",children:c})]})},mn="return_visit",gk=()=>{const{isReturnVisit:e,canShowNudge:t,recordNudgeShown:n,dismissNudge:r,openSlidePanel:s}=on(),[o,i]=f.useState(!1),c=f.useRef(0),l=f.useRef(!1);if(f.useEffect(()=>{e&&!l.current&&t(mn)&&(l.current=!0,i(!0),n(mn),c.current=Date.now(),te("nudge_shown",{triggerId:mn,nudgeType:"return_visit",sessionNudgeCount:0}))},[e,t,n]),!o)return null;const u=()=>{te("nudge_cta_clicked",{triggerId:mn,nudgeType:"return_visit",ctaLabel:"Secure My Data"}),s({contextMessage:"Your career data will be synced across all your devices.",triggerId:mn})},d=()=>{te("nudge_dismissed",{triggerId:mn,nudgeType:"return_visit",timeVisibleMs:Date.now()-c.current}),r(mn),i(!1)};return a.jsxs(hk,{title:"Sync your career data",onDismiss:d,dismissAriaLabel:"Dismiss banner",children:[a.jsx("p",{className:"text-sm text-[var(--ink-2)]",children:"Your career data is only on this browser. Create an account to sync it everywhere â plus 7 days of Pro."}),a.jsx("div",{className:"mt-3",children:a.jsx(ue,{variant:"primary",size:"sm",onClick:u,children:"Secure My Data â"})})]})},Fi=({className:e="",label:t="Pro"})=>a.jsx("span",{className:`inline-flex items-center rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.18em] text-emerald-700 dark:border-emerald-900/40 dark:bg-emerald-950/30 dark:text-emerald-300 ${e}`,children:t});async function Cd(){var e;try{if(!Z)return{};const{data:t}=await Z.auth.getSession(),n=(e=t==null?void 0:t.session)==null?void 0:e.access_token;return n?{Authorization:`Bearer ${n}`}:{}}catch{return{}}}const ta=()=>{var h;const[e,t]=f.useState({used:0,limit:2,period:"daily",resetDate:Ls("daily"),tier:"anon",proCreditsExpiresAt:null}),[n,r]=f.useState(!0),s=f.useCallback(async()=>{const y={"Content-Type":"application/json",...await Cd()},b=await fetch("/api/usage/quotas",{headers:y});if(!b.ok)throw new Error(`Usage API error: ${b.status}`);const x=await b.json(),w=x.aiCredits;w&&t({used:w.used??0,limit:w.limit??2,period:w.period??"daily",resetDate:w.resetDate?new Date(w.resetDate):Ls(w.period??"daily"),lastReset:w.lastReset?new Date(w.lastReset):void 0,tier:x.tier??"anon",proCreditsExpiresAt:x.proCreditsExpiresAt?new Date(x.proCreditsExpiresAt):null})},[]);f.useEffect(()=>{(async()=>{try{await s()}catch(b){console.error("Failed to load usage data:",b)}finally{r(!1)}})()},[s]);const o=f.useCallback(async(y=1)=>{t(b=>({...b,used:Math.min(b.used+y,b.limit)}));try{const b={"Content-Type":"application/json",...await Cd()},x=await fetch("/api/usage/increment",{method:"POST",headers:b,body:JSON.stringify({quota_key:"ai_credits",amount:y})});if(!x.ok){await s();return}const w=await x.json(),E=w.aiCredits;E&&t({used:E.used??0,limit:E.limit??e.limit,period:E.period??"daily",resetDate:E.resetDate?new Date(E.resetDate):Ls(E.period??"daily"),lastReset:E.lastReset?new Date(E.lastReset):e.lastReset,tier:w.tier??e.tier,proCreditsExpiresAt:w.proCreditsExpiresAt?new Date(w.proCreditsExpiresAt):e.proCreditsExpiresAt??null})}catch(b){console.error("Failed to increment usage:",b),await s()}},[s,e.limit]),i=f.useCallback(()=>{t(y=>({...y,used:0,resetDate:Ls(y.period),lastReset:new Date}))},[]),c=e.used<e.limit,l=Math.max(e.limit-e.used,0),u=Math.min(e.used/e.limit*100,100),d=e.tier==="paid",p=!!e.proCreditsExpiresAt&&e.proCreditsExpiresAt.getTime()>Date.now(),m=!!e.proCreditsExpiresAt&&e.proCreditsExpiresAt.getTime()<=Date.now(),g=((h=e.proCreditsExpiresAt)==null?void 0:h.getTime())??0,_=p?Math.max(0,Math.ceil((g-Date.now())/(1440*60*1e3))):0;return{usage:e,isLoading:n,incrementUsage:o,resetUsage:i,refreshUsage:s,hasCredits:c,remainingCredits:l,usagePercentage:u,isPaid:d,isTrialActive:p,isTrialExpired:m,trialDaysRemaining:_}};function Ls(e){const t=new Date;if(e==="daily"){const i=Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),0,0,0,0);return new Date(i+1440*60*1e3)}const n=t.getUTCFullYear(),r=t.getUTCMonth(),s=r===11?0:r+1,o=r===11?n+1:n;return new Date(Date.UTC(o,s,1,0,0,0,0))}const $a=54,Ad=12,yk=6,_k=({segments:e,total:t,bandLabel:n,size:r=148})=>{const s=e.filter(c=>c.scored),o=2*Math.PI*$a,i=o/(s.length||1);return a.jsxs("div",{className:"relative shrink-0",style:{width:r,height:r},role:"img","aria-label":`Career score ${t} out of 100, ${n}`,children:[a.jsx("svg",{viewBox:"0 0 128 128",width:r,height:r,className:"-rotate-90",children:s.map((c,l)=>{const u=l*i,d=Math.max(0,Math.min(100,c.score??0))/100,p=Math.max(0,i-yk);return a.jsxs("g",{children:[a.jsx("circle",{cx:"64",cy:"64",r:$a,fill:"none",stroke:"var(--line)",strokeWidth:Ad,strokeLinecap:"round",strokeDasharray:`${p} ${o-p}`,strokeDashoffset:-u}),d>0&&a.jsx("circle",{cx:"64",cy:"64",r:$a,fill:"none",stroke:"var(--ever-500)",strokeWidth:Ad,strokeLinecap:"round",strokeDasharray:`${p*d} ${o-p*d}`,strokeDashoffset:-u,className:"transition-[stroke-dasharray] duration-700"})]},c.key)})}),a.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[a.jsx("span",{className:"font-mono text-3xl font-semibold tabular-nums text-[var(--text-primary)]",children:t}),a.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.08em] text-[var(--ink-3)]",children:n})]})]})},xk=["[email protected]","[email protected]"],bk=e=>e?xk.includes(e.toLowerCase()):!1,wk=async()=>{var s;const e={"Content-Type":"application/json"},t=await(Z==null?void 0:Z.auth.getSession()),n=(s=t==null?void 0:t.data.session)==null?void 0:s.access_token;n&&(e.Authorization=`Bearer ${n}`);const r=await fetch("/api/intelligence/career-score",{headers:e});if(!r.ok)throw new Error(`Career score request failed (${r.status})`);return await r.json()},Sk=.2,Ek=Object.freeze({"Professional summary":{label:"Add a two-line professional summary",to:"/app/diary",rawPoints:20},"3+ experience entries":{label:"Add another role to your diary",to:"/app/diary",rawPoints:30},"1+ education entries":{label:"Add where you studied",to:"/app/diary",rawPoints:15},"Skills listed":{label:"List the skills you want to be hired for",to:"/app/diary",rawPoints:15},"LinkedIn URL":{label:"Add your LinkedIn URL",to:"/app/profile",rawPoints:10},"Phone number":{label:"Add a phone number",to:"/app/profile",rawPoints:10},"5+ diary entries":{label:"Write one thing that went well this month",to:"/app/diary",rawPoints:50},"10+ accomplishments logged":{label:"Add one accomplishment to a role",to:"/app/diary",rawPoints:30},"Activity in the last 30 days":{label:"Log one recent win",to:"/app/diary",rawPoints:20},"Applied to 1+ job in last 30 days":{label:"Track an application you have sent",to:"/app/applications",rawPoints:40},"Applied to 5+ jobs in last 30 days":{label:"Track the rest of this monthâs applications",to:"/app/applications",rawPoints:30},"1+ active interview":{label:"Move an application to interviewing",to:"/app/applications",rawPoints:30},"Match scores computed for applications":{label:"Tailor a resume for a job you saved",to:"/app/tailor",rawPoints:0},"Average match score â¥70":{label:"Tailor again for a closer-matching role",to:"/app/tailor",rawPoints:0},"Tailored resume in last 30 days":{label:"Tailor your resume for one job",to:"/app/tailor",rawPoints:60},"Resume tailored for most recent saved job":{label:"Tailor for the job you saved most recently",to:"/app/tailor",rawPoints:40}}),vk=Object.freeze([{key:"resume",label:"Resume",blurb:"How recently you tailored for a real job.",to:"/app/tailor"}
594,{key:"diary",label:"Diary",blurb:"The evidence everything else is generated from.",to:"/app/diary"},{key:"applications",label:"Applications",blurb:"What you have in flight right now.",to:"/app/applications"},{key:"profile",label:"Profile",blurb:"The basics every document draws on.",to:"/app/diary"},{key:"fit",label:"Fit",blurb:"Grows as your tailoring improves.",to:"/app/tailor",gauge:!0}]),Tk=Object.freeze([{key:"interview_readiness",label:"Interview readiness",blurb:"Not counted in your score yet.",to:"/app/interview-prep",teaseWithRole:e=>`Practise the questions ${e} interviews tend to ask, answered from your diary.`,teaseStatic:"Practise real questions, answered from the evidence in your diary."},{key:"portfolio",label:"Portfolio",blurb:"Not counted in your score yet.",to:"/app/portfolio-settings",teaseWithRole:e=>`A public page that reads like a ${e}, built from the diary you already have.`,teaseStatic:"One public link, built from the diary you already have."}]),Ck={resume:"resumeFreshness",diary:"diaryRichness",applications:"activeApplications",profile:"profileCompleteness",fit:"matchScoreAverage"},Ak={profile:"Your resume upload covers this.",diary:"Your resume upload started this."},Ik=e=>{if(!e)return null;const t=e.items.find(r=>!r.done);if(!t)return null;const n=Ek[t.label];return n?{label:n.label,to:n.to,points:Math.round(n.rawPoints*Sk)}:null},Rk=(e,t={})=>{const n=(t.role||"").trim(),r=vk.map(o=>{var u;const i=(u=e==null?void 0:e.breakdown)==null?void 0:u[Ck[o.key]],c=typeof(i==null?void 0:i.score)=="number"?i.score:0,l=o.gauge?null:Ik(i);return{key:o.key,label:o.label,blurb:o.blurb,score:c,scored:!0,gauge:!!o.gauge,pro:!1,done:!o.gauge&&l===null&&c>0,action:l,endowedReason:c>0?Ak[o.key]??null:null}}),s=Tk.map(o=>({key:o.key,label:o.label,blurb:o.blurb,score:null,scored:!1,gauge:!1,pro:!0,done:!1,action:{label:n?o.teaseWithRole(n):o.teaseStatic,to:o.to,points:0},endowedReason:null}));return[...r,...s]},$i=Object.freeze([{band:"exploring",min:0,label:"Exploring"},{band:"building",min:25,label:"Building"},{band:"ready",min:50,label:"Ready"},{band:"strong",min:75,label:"Strong"}]),kk=10,Nk=e=>{let t=$i[0];for(const n of $i)e>=n.min&&(t=n);return{band:t.band,label:t.label}},jk=(e,t)=>{const n=Math.max(0,Math.round((e==null?void 0:e.totalScore)??0)),{band:r,label:s}=Nk(n),o=$i.find(u=>u.min>n),i=o?o.min-n:null,c=i!==null&&i<=kk,l=t.find(u=>u.endowedReason&&(u.score??0)>0);return{total:n,band:r,bandLabel:s,nextBandLabel:c&&o?o.label:null,pointsToNextBand:c?i:null,endowed:n>0&&!!l,endowedReason:n>0?(l==null?void 0:l.endowedReason)??null:null}},Lk=Im,Pk=Rm,Ok={resume:pn.RESUME_TAILOR,diary:pn.CAREER_DIARY,applications:pn.APPLICATION_TRACKER,profile:pn.CAREER_DIARY,fit:pn.RESUME_TAILOR,interview_readiness:pn.INTERVIEW_PREP,portfolio:pn.PORTFOLIO},Dk=(e,t,n,r)=>{nr(Lk,{total:e,band:t,audience:n,surface:"web",endowed:r})},Mk=(e,t)=>{var n;nr(Pk,{feature:Ok[e.key]??e.key,segment_key:e.key,target:((n=e.action)==null?void 0:n.to)??null,scored:e.scored,pro:e.pro,audience:t,surface:"web"})},Id=e=>`score-segment-${e}`,Uk=()=>{var T,C;const e=qe(),{state:t}=ln(),{session:n,isGuest:r}=Qe(),{usage:s}=ta(),[o,i]=f.useState(null),[c,l]=f.useState(!1),[u,d]=f.useState(!1),p=f.useRef(!1),m=s.tier==="paid"||bk((T=n==null?void 0:n.user)==null?void 0:T.email);f.useEffect(()=>{if(r||!n){l(!0);return}let S=!1;return(async()=>{try{const A=await wk();S||i(A)}catch{S||d(!0)}finally{S||l(!0)}})(),()=>{S=!0}},[r,n]);const g=f.useMemo(()=>{var S,A,R,N,O,k,$,z,K;return((S=t.lastTailoredInfo)==null?void 0:S.jobTitle)||((R=(A=t.appliedJobs)==null?void 0:A[0])==null?void 0:R.job_title)||((k=(O=(N=t.profile)==null?void 0:N.jobPreferences)==null?void 0:O.targetRoles)==null?void 0:k[0])||((K=(z=($=t.profile)==null?void 0:$.experience)==null?void 0:z[0])==null?void 0:K.jobTitle)||null},[(C=t.lastTailoredInfo)==null?void 0:C.jobTitle,t.appliedJobs,t.profile]),_=f.useMemo(()=>Rk(o,{role:g}),[o,g,m]),h=f.useMemo(()=>jk(o,_),[o,_]);f.useEffect(()=>{!c||u||!o||p.current||(p.current=!0,Dk(h.total,h.band,r?"guest":"user",h.endowed))},[c,u,o,h,r]);const y=f.useCallback(S=>{var R;Mk(S,r?"guest":"user");const A=(R=S.action)==null?void 0:R.to;A&&e(A)},[e,r]);if(r||!n||!c||u||!o)return null;const b=_.filter(S=>S.scored&&!S.gauge&&!S.done),x=_.filter(S=>S.scored&&!S.gauge&&S.done),w=_.filter(S=>S.scored&&S.gauge),E=_.filter(S=>!S.scored);return a.jsx(Br,{variant:"default",children:a.jsxs("div",{id:"career-score",className:"space-y-5 p-1 sm:p-2","data-testid":"career-score-hub",children:[a.jsxs("div",{className:"flex flex-col items-center gap-5 sm:flex-row sm:items-center",children:[a.jsx(_k,{segments:_,total:h.total,bandLabel:h.bandLabel}),a.jsxs("div",{className:"min-w-0 flex-1 space-y-2 text-center sm:text-left",children:[a.jsx("div",{className:"font-mono text-xs font-semibold uppercase tracking-[0.08em] text-[var(--ever-700)]",children:"Career score"}),h.endowedReason&&a.jsxs("p",{className:"text-sm leading-6 text-[var(--text-secondary)]",children:["You started at ",h.total,", not zero. ",h.endowedReason]}),h.nextBandLabel&&h.pointsToNextBand!==null&&a.jsxs("p",{className:"text-sm font-medium text-[var(--text-primary)]",children:[h.pointsToNextBand," point",h.pointsToNextBand===1?"":"s"," from ",h.nextBandLabel,"."]}),!h.endowedReason&&!h.nextBandLabel&&a.jsx("p",{className:"text-sm leading-6 text-[var(--text-secondary)]",children:"Every area below is one small thing away from mov
594ing."})]})]}),b.length>0&&a.jsx("ul",{className:"space-y-2",children:b.map(S=>{var A,R;return a.jsx("li",{children:a.jsxs("button",{type:"button",onClick:()=>y(S),"data-testid":Id(S.key),"data-segment-target":((A=S.action)==null?void 0:A.to)??"",className:"flex w-full items-center gap-3 rounded-lg border border-[var(--line)] bg-[var(--surface)] px-3 py-2.5 text-left transition-colors hover:border-[var(--ever-300)]",children:[a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"block text-sm font-medium text-[var(--text-primary)]",children:[S.label,a.jsxs("span",{className:"ml-2 font-mono text-xs text-[var(--ink-3)] tabular-nums",children:[S.score,"/100"]})]}),a.jsx("span",{className:"mt-0.5 block text-sm leading-6 text-[var(--text-secondary)]",children:(R=S.action)==null?void 0:R.label})]}),S.action&&S.action.points>0&&a.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-[var(--ever-700)] tabular-nums",children:["+",S.action.points]})]})},S.key)})}),w.map(S=>a.jsxs("div",{"data-testid":`score-gauge-${S.key}`,className:"rounded-lg border border-dotted border-[var(--line)] px-3 py-2.5",children:[a.jsxs("div",{className:"flex items-baseline gap-2",children:[a.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:S.label}),a.jsxs("span",{className:"font-mono text-xs text-[var(--ink-3)] tabular-nums",children:[S.score,"/100"]})]}),a.jsx("div",{className:"mt-2 h-1.5 w-full overflow-hidden rounded-full bg-[var(--surface-sunk)]",children:a.jsx("div",{className:"h-full rounded-full bg-[var(--ever-400)] transition-[width] duration-700",style:{width:`${Math.max(0,Math.min(100,S.score??0))}%`}})}),a.jsx("p",{className:"mt-1.5 text-sm leading-6 text-[var(--text-secondary)]",children:S.blurb})]},S.key)),x.length>0&&a.jsxs("p",{className:"font-mono text-xs text-[var(--ink-3)]",children:[x.map(S=>S.label).join(" · ")," â done â"]}),E.length>0&&a.jsxs("div",{className:"space-y-2 border-t border-[var(--line)] pt-4",children:[a.jsx("div",{className:"font-mono text-xs uppercase tracking-[0.08em] text-[var(--ink-3)]",children:"Not counted yet"}),E.map(S=>{var A,R;return a.jsx("button",{type:"button",onClick:()=>y(S),"data-testid":Id(S.key),"data-segment-target":((A=S.action)==null?void 0:A.to)??"",className:"flex w-full items-center gap-3 rounded-lg border border-dashed border-[var(--line)] px-3 py-2.5 text-left transition-colors hover:border-[var(--ever-300)]",children:a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"block text-sm font-medium text-[var(--text-primary)]",children:[S.label,!m&&a.jsx("span",{className:"ml-2 rounded-full bg-[var(--ever-050)] px-2 py-0.5 font-mono text-[10px] font-semibold uppercase tracking-[0.06em] text-[var(--ever-700)]",children:"Pro"})]}),a.jsx("span",{className:"mt-0.5 block text-sm text-[var(--text-secondary)]",children:(R=S.action)==null?void 0:R.label})]})},S.key)})]})]})})},Fk=async()=>{var o;const e={"Content-Type":"application/json"},t=await(Z==null?void 0:Z.auth.getSession()),n=(o=t==null?void 0:t.data.session)==null?void 0:o.access_token;n&&(e.Authorization=`Bearer ${n}`);const r=await fetch("/api/engagement/recap",{headers:e});if(!r.ok)throw new Error(`Recap request failed (${r.status})`);const s=await r.json();return Array.isArray(s.items)?s.items:[]},t5=async()=>{var s;const e={"Content-Type":"application/json"},t=await(Z==null?void 0:Z.auth.getSession()),n=(s=t==null?void 0:t.data.session)==null?void 0:s.access_token;n&&(e.Authorization=`Bearer ${n}`);const r=await fetch("/api/engagement/effort",{headers:e});if(!r.ok)throw new Error(`Effort request failed (${r.status})`);return await r.json()},n5=async()=>{var o;const e={"Content-Type":"application/json"},t=await(Z==null?void 0:Z.auth.getSession()),n=(o=t==null?void 0:t.data.session)==null?void 0:o.access_token;n&&(e.Authorization=`Bearer ${n}`);const r=await fetch("/api/engagement/pipeline",{headers:e});if(!r.ok)throw new Error(`Pipeline request failed (${r.status})`);const s=await r.json();return Array.isArray(s.applications)?s.applications:[]},$k=km,Bk=Nm,zk=e=>{nr($k,{item_types:e.map(t=>t.type),item_count:e.length,surface:"web"})},Gk=e=>{nr(Bk,{feature:e.feature,type:e.type,target:e.to,surface:"web"})},Hk=()=>{const e=qe(),{session:t,isGuest:n}=Qe(),[r,s]=f.useState([]),o=f.useRef(!1);f.useEffect(()=>{if(n||!t)return;let c=!1;return(async()=>{try{const l=await Fk();c||s(l)}catch{}})(),()=>{c=!0}},[n,t]),f.useEffect(()=>{r.length===0||o.current||(o.current=!0,zk(r))},[r]);const i=f.useCallback(c=>{var d;Gk(c);const[l,u]=c.to.split("#");if(u&&l==="/app/home"){(d=document.getElementById(u))==null||d.scrollIntoView({behavior:"smooth",block:"start"});return}e(c.to)},[e]);return r.length===0?null:a.jsx(Br,{variant:"default",children:a.jsxs("div",{className:"space-y-3 p-1 sm:p-2","data-testid":"since-you-left",children:[a.jsx("div",{className:"font-mono text-xs font-semibold uppercase tracking-[0.08em] text-[var(--ever-700)]",children:"Since you left"}),a.jsx("ul",{className:"space-y-2",children:r.map((c,l)=>a.jsx("li",{children:a.jsxs("button",{type:"button",onClick:()=>i(c),"data-testid":`recap-item-${c.type}`,"data-recap-target":c.to,className:"flex w-full items-start gap-2 rounded-lg px-2 py-1.5 text-left transition-colors hover:bg-[var(--surface-sunk)]",children:[a.jsx("span",{className:"min-w-0 flex-1 text-sm leading-6 text-[var(--text-primary)]",children:c.text}
594),a.jsx("span",{"aria-hidden":!0,className:"mt-0.5 shrink-0 text-sm text-[var(--ink-3)]",children:"â"})]})},`${c.type}-${l}`))})]})})},Wk=async()=>{if(typeof window>"u"||!("serviceWorker"in navigator))return null;try{return await navigator.serviceWorker.register("/sw.js")}catch(e){return console.warn("Service worker registration failed",e),null}},Jk=[{title:"Tailor",to:"/app/tailor",icon:St},{title:"Job Search",to:"/app/search",icon:Ur},{title:"Diary",to:"/app/diary",icon:Fc},{title:"Cover Letter",to:"/app/cover-letter",icon:Uc},{title:"Applications",to:"/app/applications",icon:Uf},{title:"Resume Library",to:"/app/resume-library",icon:Ko}],Vk=[{title:"Portfolio",to:"/app/portfolio/edit",icon:$c},{title:"Career GPS",to:"/app/intelligence/career-gps",icon:Ci},{title:"Interview Prep",to:"/app/interview-prep",icon:Xo},{title:"LinkedIn",to:"/app/linkedin",icon:ms}],Yk={upload_resume:"add your resume to build your Diary",review_profile:"review your Diary details",set_preferences:"set your job preferences",search_first_job:"search for a role you want",tailor_resume:"tailor your first resume"},Ba=["upload_resume","review_profile","set_preferences","search_first_job","tailor_resume"];function qk(e){const{hasDiary:t,hasTailored:n,appliedCount:r}=e;return t?!n&&r===0?{eyebrow:"Next best action",title:"Tailor your resume to a job",blurb:"Your Diary is ready. Paste a job description and turn it into a targeted, ATS-ready resume in ~30 seconds.",ctaLabel:"Start tailoring",ctaTo:"/app/tailor",secondary:[{label:"View Diary",to:"/app/diary"},{label:"Career Readiness",to:"/app/career-score"}]}:n&&r===0?{eyebrow:"Next best action",title:"Apply, then track it",blurb:"You have a tailored resume. Add a cover letter, then log the application so nothing slips â or find more roles like it.",ctaLabel:"Track an application",ctaTo:"/app/applications",secondary:[{label:"Cover Letter",to:"/app/cover-letter"},{label:"Find similar roles",to:"/app/search"}]}:{eyebrow:"Keep your pipeline moving",title:`${r} application${r===1?"":"s"} in progress`,blurb:"Stay on top of follow-ups, and keep applying to strong-match roles while your momentum is high.",ctaLabel:"Review pipeline",ctaTo:"/app/applications",secondary:[{label:"Tailor for a new job",to:"/app/tailor"},{label:"Find more roles",to:"/app/search"}]}:{eyebrow:"Start here",title:"Build your Diary from a resume",blurb:"Drop in your resume and we build your Career Diary â the source every tailored resume is generated from. Takes about 30 seconds.",ctaLabel:"Build my Diary",ctaTo:"/app/diary",secondary:[]}}const Kk=()=>{const e=qe(),{continueAsGuest:t,session:n,isAuthLoading:r}=Qe();f.useEffect(()=>{r||n&&e("/app/home",{replace:!0})},[n,r,e]);const s=async()=>{await t(),e("/app/home")},o=()=>{e("/guide")};return r||n?null:a.jsx(rk,{onContinueAsGuest:s,onNavigateToGuide:o})},Ah=()=>{var O,k,$,z,K;const e=qe(),{session:t,isGuest:n,isAuthLoading:r}=Qe(),[s,o]=M.useState(null),[i,c]=M.useState(null);ok({title:"Home | CareerDiary",description:"Jump back into resume tailoring, job search, your career diary, and applications.",canonical:"https://careerdiary.io/app/home"}),f.useEffect(()=>{r||!t&&!n&&e("/",{replace:!0})},[r,n,e,t]),f.useEffect(()=>{(async()=>{var ce;if(!t)return;const ie=await(Z==null?void 0:Z.auth.getSession()),Q=(ce=ie==null?void 0:ie.data.session)==null?void 0:ce.access_token;if(!Q)return;const J=await fetch("/api/diary/streak",{headers:{"Content-Type":"application/json",Authorization:`Bearer ${Q}`}});if(!J.ok)return;const me=await J.json();o(me)})()},[t]),f.useEffect(()=>{Wk();const V=ie=>{ie.preventDefault(),c(ie)};return window.addEventListener("beforeinstallprompt",V),()=>window.removeEventListener("beforeinstallprompt",V)},[]);const l=async()=>{i&&(await i.prompt(),await i.userChoice.catch(()=>{}),c(null))},{state:u}=ln(),{completedSteps:d}=vh(),{isPaid:p}=ta(),{isReturnVisit:m}=on(),g=u.profile,_=!!(g&&((O=g.experience)!=null&&O.length||(k=g.skills)!=null&&k.length||g.summary)),h=!!u.lastTailoredInfo,y=(($=u.appliedJobs)==null?void 0:$.length)??0,b=qk({hasDiary:_,hasTailored:h,appliedCount:y}),x=d.length,w=Math.round(x/Ba.length*100),E=x>=Ba.length,T=Ba.find(V=>!d.includes(V));if(r||!t&&!n)return null;const C=(z=t==null?void 0:t.user)==null?void 0:z.user_metadata,S=ik({profileFullName:g==null?void 0:g.fullName,metadataName:(C==null?void 0:C.full_name)||(C==null?void 0:C.name),email:(K=t==null?void 0:t.user)==null?void 0:K.email}),N=!_&&!h&&y===0&&!E||!m?S?`Welcome, ${S}`:"Welcome to CareerDiary":S?`Welcome back, ${S}`:"Welcome back";return a.jsxs("div",{className:"mx-auto w-full max-w-6xl space-y-8",children:[a.jsx(mk,{}),a.jsx(gk,{}),a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsx("h1",{className:"text-2xl font-semibold text-[var(--text-primary)]",children:N}),s&&s.current_streak>0&&a.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full bg-[var(--ever-050)] px-3 py-1 font-mono text-sm font-semibold text-[var(--ever-700)]",children:[a.jsx(St,{className:"h-4 w-4"}),s.current_streak," day streak"]})]}),a.jsx(Hk,{}),a.jsx(Br,{variant:"default",className:"overflow-hidden bg-gradient-to-br from-[var(--ever-050)] via-[var(--surface)] to-[var(--surface)]",children:a.jsxs("div",{className:"space-y-5 p-1 sm:p-2",children:[a.jsx("div",{className:"font-mono text-xs font-semibold uppercase tracking-[0.08em] text-[var(--ever-700)]",children:b.eyebrow}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-display text-3xl font-semibold text-[var(--text-primary)]",children:b.title}),a.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-[var(--text-secondary)]",children:b.blurb})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsxs(ue,{variant:"primary",size:"lg",className:"rounded-full px-6",onClick:()=>e(b.ctaTo),children:[b.ctaLabel," â"]}),b.secondary.map(V=>a.jsx(ue,{variant:"ghost",size:"md",onClick:()=>e(V.to),children:V.label},V.to))]}),a.jsxs("div",{className:"pt-2",children:[a.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-[var(--surface-sunk)]",children:a.jsx("div",{className:"h-full rounded-full bg-[var(--ever-500)] transition-[width] duration-500",style:{width:`${Math.max(w,6)}%`}})}),a.jsx("p",{className:"mt-2 font-mono text-xs text-[var(--ink-3)]",children:E?"Career setup complete â â your Diary is working for you":`Career setup ${w}% · next: ${T?Yk[T]:""}`})]})]})}),a.jsx(Uk,{}),a.jsxs("section",{children:[a.jsx("div",{className:"mb-3 font-mono text-xs font-semibold uppercase tracking-[0.08em] text-[var(--ink-3)]",children:"Your toolkit"}),a.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-6",children:Jk.map(({title:V,to:ie,icon:Q})=>a.jsx("button",{type:"button",onClick:()=>e(ie),className:"text-left",children:a.jsx(Br,{variant:"default",padding:"sm",className:"h-full transition-transform hover:-translate-y-0.5 hover:border-[var(--ever-300)]",children:a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx("span",{className:"inline-flex w-fit roun
594ded-md bg-[var(--ever-050)] p-2 text-[var(--ever-600)]",children:a.jsx(Q,{className:"h-4 w-4"})}),a.jsx("span",{className:"text-sm font-semibold text-[var(--text-primary)]",children:V})]})})},ie))})]}),a.jsxs("section",{className:"rounded-2xl border border-[var(--line)] bg-[var(--surface-sunk)] p-4 sm:p-5",children:[a.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[a.jsx("span",{className:"font-mono text-xs font-semibold uppercase tracking-[0.08em] text-[var(--ink-3)]",children:"Go further with Pro"}),!p&&a.jsx(Fi,{})]}),a.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:Vk.map(({title:V,to:ie,icon:Q})=>a.jsx("button",{type:"button",onClick:()=>e(ie),className:"text-left",children:a.jsxs("div",{className:"flex h-full items-center gap-3 rounded-xl border border-[var(--line)] bg-[var(--surface)] px-3 py-3 transition-colors hover:border-[var(--ever-300)]",children:[a.jsx("span",{className:"inline-flex rounded-md bg-[var(--ever-050)] p-2 text-[var(--ever-600)]",children:a.jsx(Q,{className:"h-4 w-4"})}),a.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:V})]})},ie))})]}),a.jsx(fk,{promptEvent:i,onInstall:l})]})},Xk=Object.freeze(Object.defineProperty({__proto__:null,AppHomePage:Ah,HomePage:Kk},Symbol.toStringTag,{value:"Module"})),Zk=M.lazy(()=>D(()=>import("./ResumeTailorPage-CU5guW79.js"),__vite__mapDeps([8,1,2,9,10,11,12,13,14,15,16,17,18,19,3,4,5,20,21,22,23])).then(e=>({default:e.ResumeTailorPage}))),Qk=()=>{const e=qe(),t=We(),{session:n,isGuest:r}=Qe(),{openSlidePanel:s}=on(),o=()=>{s({contextMessage:"Create a free account to unlock this â everything youâve done as a guest carries over.",triggerId:"page_account_gate"})},i=()=>{e("/app/diary")},c=()=>{e("/app/search")},l=()=>{e("/app/saved-jobs")},u=t.state,d=u==null?void 0:u.jobDescription,[p]=M.useState(()=>{var m;return(m=t.state)==null?void 0:m.resumeText});return M.useEffect(()=>{if(!p)return;const m={...t.state??{}};delete m.resumeText,e(`${t.pathname}${t.search}`,{replace:!0,state:m})},[]),a.jsx(Zk,{session:n,isGuest:r,onInitiateAuth:o,onNavigateToDiary:i,onNavigateToJobSearch:c,onNavigateToTracker:l,initialJobDescription:d,initialResumeText:p})},eN=M.lazy(()=>D(()=>import("./JobSearchPage-CyZU0MSZ.js"),__vite__mapDeps([24,1,2,25,26,27,28,29,17,22,18,3,4,5])).then(e=>({default:e.JobSearchPage}))),tN=()=>a.jsx(eN,{}),nN=M.lazy(()=>D(()=>import("./CareerDiaryPage-X49wOAd_.js"),__vite__mapDeps([30,1,2,31,23,6,3,4,5,21,22,0,29,17,32,33])).then(e=>({default:e.CareerDiaryPage}))),rN=()=>{const e=qe(),t=We(),{isGuest:n}=Qe(),{openSlidePanel:r}=on(),[s]=M.useState(()=>{var c;return(c=t.state)==null?void 0:c.loggedWin});M.useEffect(()=>{if(!s)return;const c={...t.state??{}};delete c.loggedWin,e(`${t.pathname}${t.search}`,{replace:!0,state:c})},[]);const o=()=>{e("/app/tailor")},i=()=>{r({contextMessage:"Create a free account to unlock this â everything youâve done as a guest carries over.",triggerId:"page_account_gate"})};return a.jsx(nN,{onNavigateToWorkspace:o,isGuest:n,onInitiateAuth:i,initialWin:s})},sN=M.lazy(()=>D(()=>import("./CorpusManager-hyu7sh-i.js"),__vite__mapDeps([34,1,2,6,3,4,5])).then(e=>({default:e.CorpusManager}))),oN=()=>{const e=qe(),t=()=>{e("/app/diary")};return a.jsx(sN,{onBack:t})},aN=M.lazy(()=>D(()=>import("./PublicPortfolioPageV2-CLnyVvLL.js"),__vite__mapDeps([35,1,2,7,3,4,5])).then(e=>({default:e.PublicPortfolioPageV2}))),Rd=()=>a.jsx(aN,{}),iN=M.lazy(()=>D(()=>import("./EditorialLandingPage-D8CbLyn1.js"),__vite__mapDeps([36,1,2,37,38,3,4,5,39])).then(e=>({default:e.EditorialLandingPage}))),cN=M.lazy(()=>D(()=>import("./AuthPage-C4zkbYET.js"),__vite__mapDeps([40,1,2,3,4,5])).then(e=>({default:e.AuthPage}))),lN=M.lazy(()=>D(()=>import("./ReferralLandingPage-5R6E5KlK.js"),__vite__mapDeps([41,1,2,13,3,4,5])).then(e=>({default:e.ReferralLandingPage}))),uN=()=>a.jsx(iN,{}),za=()=>{const e=qe(),t=We(),{continueAsGuest:n,session:r,isAuthLoading:s}=Qe();M.useEffect(()=>{s||r&&e("/app/home",{replace:!0})},[s,e,r]);const o=t.state,i=(o==null?void 0:o.mode)==="signup"||t.pathname==="/signup"?"signUp":"signIn";return a.jsx(cN,{initialMode:i,onContinueAsGuest:async()=>{await n(),e("/app/home",{replace:!0})}})},Ga=({kind:e})=>a.jsx(lN,{kind:e}),dN=M.lazy(()=>D(()=>import("./ApplicationTrackerPage-D1vu9Qb-.js"),__vite__mapDeps([42,1,2,22,27,43,16,17,12,32,3,4,5])).then(e=>({default:e.ApplicationTrackerPage}))),pN=()=>a.jsx(dN,{}),mN=M.lazy(()=>D(()=>import("./ResumeLibraryPage-CPfnc_Gp.js"),__vite__mapDeps([44,1,2,22,13,27,28,3,4,5])).then(e=>({default:e.ResumeLibraryPage}
594))),fN=()=>a.jsx(mN,{}),hN=M.lazy(()=>D(()=>import("./JobDetailPage-BL2sCZ6Z.js"),__vite__mapDeps([45,1,2,26,27,28,22,3,4,5])).then(e=>({default:e.JobDetailPage}))),gN=()=>a.jsx(hN,{}),yN=M.lazy(()=>D(()=>import("./CoverLetterPage-Ih35fNAU.js"),__vite__mapDeps([46,1,2,13,14,22,11,12,16,17,29,3,4,5])).then(e=>({default:e.CoverLetterPage}))),_N=()=>a.jsx(yN,{}),xN=M.lazy(()=>D(()=>import("./SettingsPage-CkBpfUX7.js"),__vite__mapDeps([47,1,2,22,48,43,3,4,5])).then(e=>({default:e.SettingsPage}))),bN=()=>a.jsx(xN,{}),wN=M.lazy(()=>D(()=>import("./ProfilePage-CZ8R0EDG.js"),__vite__mapDeps([49,1,2,9,31,23,48,3,4,5])).then(e=>({default:e.ProfilePage}))),SN=()=>{const e=qe(),{session:t,isGuest:n}=Qe(),{openSlidePanel:r}=on(),s=()=>{r({contextMessage:"Create a free account to unlock this â everything youâve done as a guest carries over.",triggerId:"page_account_gate"})},o=()=>{e("/app/diary")},i=()=>{e("/app/tailor")};return a.jsx(wN,{session:t,isGuest:n,onInitiateAuth:s,onNavigateToDiary:o,onNavigateToTailor:i})},EN=M.lazy(()=>D(()=>import("./PortfolioEditorPage-DpbnGrE6.js"),__vite__mapDeps([50,1,2,51,7,3,4,5,18,13,52,29,17])).then(e=>({default:e.PortfolioEditorPage}))),vN=()=>a.jsx(EN,{}),TN=M.lazy(()=>D(()=>import("./SavedJobsPage-a2vTVdb_.js"),__vite__mapDeps([53,1,2,25,26,27,28,54,22,3,4,5])).then(e=>({default:e.SavedJobsPage}))),CN=()=>{const e=qe(),t=()=>{e("/app/tailor")};return a.jsx(TN,{onNavigateToProfile:t})},AN=()=>a.jsx(Ah,{}),IN=M.lazy(()=>D(()=>import("./DashboardDemo-q_u31AWG.js").then(e=>e.D),__vite__mapDeps([55,1,2])).then(e=>({default:e.DashboardDemo})));M.lazy(()=>D(()=>import("./TailorResultPreview-BK65Lq2Z.js"),__vite__mapDeps([56,1,2,10,9,3,4,5])).then(e=>({default:e.TailorResultPreview})));M.lazy(()=>D(()=>import("./FirstRunPreview-ROWbuAP-.js"),__vite__mapDeps([57,1,2,3,4,5])).then(e=>({default:e.FirstRunPreview})));const RN=M.lazy(()=>D(()=>import("./NativeAuthPage-BDyBUq_U.js"),__vite__mapDeps([58,1,2,3,4,5])).then(e=>({default:e.NativeAuthPage}))),kN=M.lazy(()=>D(()=>import("./CareerGPSPage-ZODWO-mQ.js").then(e=>e.C),__vite__mapDeps([59,1,2,52,60])).then(e=>({default:e.CareerGPSPage}))),NN=M.lazy(()=>D(()=>import("./ATSSimulatorPage-D2748nfU.js"),__vite__mapDeps([61,1,2,52,62,3,4,5])).then(e=>({default:e.ATSSimulatorPage}))),kd=M.lazy(()=>D(()=>import("./UsageBillingPage-DOd1h4VP.js"),__vite__mapDeps([63,1,2,22,15,38,3,4,5])).then(e=>({default:e.UsageBillingPage}))),jN=M.lazy(()=>D(()=>import("./InterviewPrepPage-D_XJhU9H.js"),__vite__mapDeps([64,1,2,11,12,52,29,17,3,4,5])).then(e=>({default:e.InterviewPrepPage}))),LN=M.lazy(()=>D(()=>import("./LinkedInPage-ClxI2pYf.js"),__vite__mapDeps([65,1,2,13,3,4,5])).then(e=>({default:e.LinkedInPage}))),PN=M.lazy(()=>D(()=>import("./CareerReadinessPage-DzYQHsDA.js"),__vite__mapDeps([66,1,2,3,4,5])).then(e=>({default:e.CareerReadinessPage}))),ON=M.lazy(()=>D(()=>import("./PublicCareerScorePage-CAlDPROH.js"),__vite__mapDeps([67,1,2,3,4,5])).then(e=>({default:e.PublicCareerScorePage}))),DN=M.lazy(()=>D(()=>import("./UserGuidePage-B_EV2KFg.js"),__vite__mapDeps([68,1,2,3,4,5])).then(e=>({default:e.UserGuidePage}))),MN=M.lazy(()=>D(()=>import("./ResumeHistoryPage-p60nxP8T.js"),__vite__mapDeps([69,1,2,3,4,5])).then(e=>({default:e.ResumeHistoryPage}))),UN=M.lazy(()=>D(()=>import("./PortfolioSettingsPage-B-cJN_cm.js"),__vite__mapDeps([51,1,2,7,3,4,5,18,13,52,29,17])).then(e=>({default:e.PortfolioSettingsPage}))),FN=M.lazy(()=>D(()=>import("./PrivacyPolicyPage-3cFZb0Va.js"),__vite__mapDeps([70,1,2,71,3,4,5])).then(e=>({default:e.PrivacyPolicyPage}))),$N=M.lazy(()=>D(()=>import("./ExtensionPrivacyPage-BZviVdhm.js"),__vite__mapDeps([72,1,2,3,4,5])).then(e=>({default:e.ExtensionPrivacyPage}))),BN=M.lazy(()=>D(()=>import("./TermsOfServicePage-6nhMP905.js"),__vite__mapDeps([73,1,2,3,4,5])).then(e=>({default:e.TermsOfServicePage}))),zN=M.lazy(()=>D(()=>import("./SupportPage-Bp5o0WmM.js"),__vite__mapDeps([74,1,2,3,4,5])).then(e=>({default:e.SupportPage}))),GN=M.lazy(()=>D(()=>import("./PricingPage-CRp6m4sL.js"),__vite__mapDeps([75,1,2,37,38,3,4,5])).then(e=>({default:e.PricingPage}))),HN=M.lazy(()=>D(()=>import("./AboutPage-C1FT0lbh.js"),__vite__mapDeps([76,1,2,3,4,5])).then(e=>({default:e.AboutPage}))),WN=M.lazy(()=>D(()=>
594import("./AIResumeBuilderPage-BnuzojZi.js"),__vite__mapDeps([77,1,2,78,3,4,5])).then(e=>({default:e.AIResumeBuilderPage}))),JN=M.lazy(()=>D(()=>import("./TailorResumeToJobPage-DoFxOpyo.js"),__vite__mapDeps([79,1,2,78,71,80,3,4,5])).then(e=>({default:e.TailorResumeToJobPage}))),VN=M.lazy(()=>D(()=>import("./ATSResumeCheckerPage-5aEnoKKy.js"),__vite__mapDeps([81,1,2,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.ATSResumeCheckerPage}))),YN=M.lazy(()=>D(()=>import("./ResumeOrMarketPage-B97G37b5.js"),__vite__mapDeps([85,1,2,78,83,3,4,5])).then(e=>({default:e.ResumeOrMarketPage}))),qN=M.lazy(()=>D(()=>import("./CareerAccomplishmentTrackerPage-DSTX3dkh.js"),__vite__mapDeps([86,1,2,78,33,71,80,3,4,5])).then(e=>({default:e.CareerAccomplishmentTrackerPage}))),KN=M.lazy(()=>D(()=>import("./JobApplicationTrackerPage-DA6bnTcl.js"),__vite__mapDeps([87,1,2,78,3,4,5])).then(e=>({default:e.JobApplicationTrackerPage}))),XN=M.lazy(()=>D(()=>import("./AICoverLetterGeneratorPage-DUYwmcQA.js"),__vite__mapDeps([88,1,2,78,3,4,5])).then(e=>({default:e.AICoverLetterGeneratorPage}))),ZN=M.lazy(()=>D(()=>import("./ResumeMatchScorePage-k2ydCV5g.js"),__vite__mapDeps([89,1,2,78,3,4,5])).then(e=>({default:e.ResumeMatchScorePage}))),QN=M.lazy(()=>D(()=>import("./CareerDiaryJournalPage-DI6024pZ.js"),__vite__mapDeps([90,1,2,78,3,4,5])).then(e=>({default:e.CareerDiaryJournalPage}))),ej=M.lazy(()=>D(()=>import("./WatchConfirmPage-Ldjpj-bO.js"),__vite__mapDeps([91,1,2,3,4,5])).then(e=>({default:e.WatchConfirmPage}))),tj=M.lazy(()=>D(()=>import("./FreeResumeTailoringPage-D2cHoOb8.js"),__vite__mapDeps([92,1,2,78,84,3,4,5])).then(e=>({default:e.FreeResumeTailoringPage}))),nj=M.lazy(()=>D(()=>import("./JobscanAlternativePage-BaKgzGyL.js"),__vite__mapDeps([93,1,2,94,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.JobscanAlternativePage}))),rj=M.lazy(()=>D(()=>import("./TealAlternativePage-wojT0gtw.js"),__vite__mapDeps([95,1,2,94,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.TealAlternativePage}))),sj=M.lazy(()=>D(()=>import("./ReziAlternativePage-Dl5Cte0J.js"),__vite__mapDeps([96,1,2,94,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.ReziAlternativePage}))),oj=M.lazy(()=>D(()=>import("./EnhancvAlternativePage-BPaHOzXk.js"),__vite__mapDeps([97,1,2,94,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.EnhancvAlternativePage}))),aj=M.lazy(()=>D(()=>import("./AtsCheckerSoftwareEngineerPage-DWCpfw13.js"),__vite__mapDeps([98,1,2,99,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.AtsCheckerSoftwareEngineerPage}))),ij=M.lazy(()=>D(()=>import("./AtsCheckerDataScientistPage-DRkR7VQz.js"),__vite__mapDeps([100,1,2,99,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.AtsCheckerDataScientistPage}))),cj=M.lazy(()=>D(()=>import("./AtsCheckerProductManagerPage-Cr8wHAAO.js"),__vite__mapDeps([101,1,2,99,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.AtsCheckerProductManagerPage}))),lj=M.lazy(()=>D(()=>import("./AtsCheckerDevopsEngineerPage-BoJwI8b3.js"),__vite__mapDeps([102,1,2,99,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.AtsCheckerDevopsEngineerPage}))),uj=M.lazy(()=>D(()=>import("./AtsCheckerConsultantPage-Dhp7IVxd.js"),__vite__mapDeps([103,1,2,99,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.AtsCheckerConsultantPage}))),dj=M.lazy(()=>D(()=>import("./AtsWorkdayPage-AHt3_zGO.js"),__vite__mapDeps([104,1,2,105,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.AtsWorkdayPage}))),pj=M.lazy(()=>D(()=>import("./AtsGreenhousePage-DUcNUYtJ.js"),__vite__mapDeps([106,1,2,105,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.AtsGreenhousePage}))),mj=M.lazy(()=>D(()=>import("./AtsLeverPage-Do6g3yU3.js"),__vite__mapDeps([107,1,2,105,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.AtsLeverPage}))),fj=M.lazy(()=>D(()=>import("./AtsTaleoPage-PrTSilAG.js"),__vite__mapDeps([108,1,2,105,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.AtsTaleoPage}))),hj=M.lazy(()=>D(()=>import("./ResumeParsingStudyPage-CoNfwvcT.js"),__vite__mapDeps([109,1,2,78,3,4,5])).then(e=>({default:e.ResumeParsingStudyPage}))),gj=M.lazy(()=>D(()=>import("./IsMyResumeAtsFriendlyPage-CVAPn9IJ.js"),__vite__mapDeps([110,1,2,111,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.IsMyResumeAtsFriendlyPage}
594))),yj=M.lazy(()=>D(()=>import("./AtsResumeKeywordsPage-BO0r8K4L.js"),__vite__mapDeps([112,1,2,111,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.AtsResumeKeywordsPage}))),_j=M.lazy(()=>D(()=>import("./ResumeCheckerNoUploadPage-Dt1qqDVc.js"),__vite__mapDeps([113,1,2,111,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.ResumeCheckerNoUploadPage}))),xj=M.lazy(()=>D(()=>import("./AiResumeNoFakeExperiencePage-ka0TmFG2.js"),__vite__mapDeps([114,1,2,111,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.AiResumeNoFakeExperiencePage}))),bj=M.lazy(()=>D(()=>import("./WhyDoesMyResumeLookWrongPage-D_ipRcUO.js"),__vite__mapDeps([115,1,2,111,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.WhyDoesMyResumeLookWrongPage}))),wj=M.lazy(()=>D(()=>import("./BragDocumentPage-lzdSnKxY.js"),__vite__mapDeps([116,1,2,111,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.BragDocumentPage}))),Sj=M.lazy(()=>D(()=>import("./AccomplishmentLogPage-B8tcaafB.js"),__vite__mapDeps([117,1,2,111,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.AccomplishmentLogPage}))),Ej=M.lazy(()=>D(()=>import("./WhatDoesAnAtsSeePage-DQyHII17.js"),__vite__mapDeps([118,1,2,111,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.WhatDoesAnAtsSeePage}))),vj=M.lazy(()=>D(()=>import("./ChatGptWroteMyResumePage-qbPFCQcc.js"),__vite__mapDeps([119,1,2,111,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.ChatGptWroteMyResumePage}))),Tj=M.lazy(()=>D(()=>import("./ResumeCheckerAfterAiRewritePage-DlUPhw4h.js"),__vite__mapDeps([120,1,2,111,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.ResumeCheckerAfterAiRewritePage}))),Cj=M.lazy(()=>D(()=>import("./FreeJobApplicationTrackerPage-BhKU_Pm8.js"),__vite__mapDeps([121,1,2,111,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.FreeJobApplicationTrackerPage}))),Aj=M.lazy(()=>D(()=>import("./JobAlertsMatchedToResumePage-DOlP0bda.js"),__vite__mapDeps([122,1,2,111,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.JobAlertsMatchedToResumePage}))),Ij=M.lazy(()=>D(()=>import("./KickresumeAlternativePage-B69nq6N7.js"),__vite__mapDeps([123,1,2,111,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.KickresumeAlternativePage}))),Rj=M.lazy(()=>D(()=>import("./ResumeWordedAlternativePage-D6-h3F5t.js"),__vite__mapDeps([124,1,2,111,78,82,62,83,16,17,84,3,4,5])).then(e=>({default:e.ResumeWordedAlternativePage}))),kj=M.lazy(()=>D(()=>import("./FeaturesHubPage-DpHuvblb.js"),__vite__mapDeps([125,1,2,78,3,4,5])).then(e=>({default:e.FeaturesHubPage}))),Nj=M.lazy(()=>D(()=>import("./ResumeTailoringFeaturePage-DaIXeGdS.js"),__vite__mapDeps([126,1,2,127,78,38,3,4,5])).then(e=>({default:e.ResumeTailoringFeaturePage}))),jj=M.lazy(()=>D(()=>import("./CareerDiaryFeaturePage-4Xfh-zUR.js"),__vite__mapDeps([128,1,2,127,78,38,3,4,5])).then(e=>({default:e.CareerDiaryFeaturePage}))),Lj=M.lazy(()=>D(()=>import("./ApplicationTrackerFeaturePage-j2tGwpdt.js"),__vite__mapDeps([129,1,2,127,78,38,3,4,5])).then(e=>({default:e.ApplicationTrackerFeaturePage}))),Pj=M.lazy(()=>D(()=>import("./CareerGpsFeaturePage-DLRIetDr.js"),__vite__mapDeps([130,1,2,127,78,38,3,4,5])).then(e=>({default:e.CareerGpsFeaturePage}))),Oj=M.lazy(()=>D(()=>import("./AtsSimulatorFeaturePage-BpPKo0XA.js"),__vite__mapDeps([131,1,2,127,78,38,3,4,5])).then(e=>({default:e.AtsSimulatorFeaturePage}))),Dj=M.lazy(()=>D(()=>import("./InterviewPrepFeaturePage-D7l5KZu8.js"),__vite__mapDeps([132,1,2,127,78,38,3,4,5])).then(e=>({default:e.InterviewPrepFeaturePage}))),Mj=M.lazy(()=>D(()=>import("./CareerScoreFeaturePage-CXp5NTpk.js"),__vite__mapDeps([133,1,2,127,78,38,3,4,5])).then(e=>({default:e.CareerScoreFeaturePage}))),Uj=M.lazy(()=>D(()=>import("./CoverLettersFeaturePage-CYUG5kqq.js"),__vite__mapDeps([134,1,2,127,78,38,3,4,5])).then(e=>({default:e.CoverLettersFeaturePage}))),Fj=M.lazy(()=>D(()=>import("./PortfolioFeaturePage-Dhrhh2Kw.js"),__vite__mapDeps([135,1,2,127,78,38,3,4,5])).then(e=>({default:e.PortfolioFeaturePage}))),$j=M.lazy(()=>D(()=>import("./AppsFeaturePage-CyMSfF6h.js"),__vite__mapDeps([136,1,2,127,78,38,3,4,5])).then(e=>({default:e.AppsFeaturePage}))),Bj=M.lazy(()=>D(()=>import("./FounderDashboardPage-LRDVxbqK.js"),__vite__mapDeps([137,1,2,22,60,13,3,4,5])).then(e=>({default:e.FounderDashboardPage}))),zj=()=>a.jsx("div",{className:"min-h-[200px] flex items-center justify-center",children:a.jsx(Mc,{})}),Gj=()=>a.jsx(F,{children:a.jsx(f.Suspense,{fallback:a.jsx(zj,{}),children:a.jsxs(n1,{children:[a.jsx(P,{path:"/resume-tailor",element:a.jsx(Pe,{to:"/tailor-resume-to-job-description",replace:!0})}),a.jsx(P,{path:"/ai-resume-builder",element:a.jsx(F,{children:a.jsx(WN,{})})}),a.jsx(P,{path:"/tailor-resume-to-job-description",element:a.jsx(F,{children:a.jsx(JN,{})})}),a.jsx(P,{path:"/ats-resume-checker",element:a.jsx(F,{children:a.jsx(VN,{})})}),a.jsx(P,{path:"/ats-resume-checker/software-engineer",element:a.jsx(F,{children:a.jsx(aj,{})})}),a.jsx(P,{path:"/ats-resume-checker/data-scientist",element:a.jsx(F,{children:a.jsx(ij,{})})}),a.jsx(P,{path:"/ats-resume-checker/product-manager",element:a.jsx(F,{children:a.jsx(cj,{})})}),a.jsx(P,{path:"/ats-resume-checker/devops-engineer",element:a.jsx(F,{children:a.jsx(lj,{})})}),a.jsx(P,{path:"/ats-resume-checker/consultant",element:a.jsx(F,{children:a.jsx(uj,{})})}),a.jsx(P,{path:"/ats/workday",element:a.jsx(F,{children:a.jsx(dj,{})})}),a.jsx(P,{path:"/ats/greenhouse",element:a.jsx(F,{children:a.jsx(pj,{})})}),a.jsx(P,{path:"/ats/lever",element:a.jsx(F,{children:a.jsx(mj,{})})}),a.jsx(P,{path:"/ats/taleo",element:a.jsx(F,{children:a.jsx(fj,{})})}),a.jsx(P,{path:"/resume-parsing-study",element:a.jsx(F,{children:a.jsx(hj,{})})}),a.jsx(P,{path:"/is-my-resume-ats-friendly",element:a.jsx(F,{children:a.jsx(gj,{})})}),a.jsx(P,{path:"/ats-resume-keywords",element:a.jsx(F,{children:a.jsx(yj,{})})}),a.jsx(P,{path:"/resume-checker-no-upload",element:a.jsx(F,{children:a.jsx(_j,{})})}),a.jsx(P,{path:"/ai-resume-help-without-fake-experience",element:a.jsx(F,{children:a.jsx(xj,{})})}),a.jsx(P,{path:"/why-does-my-resume-look-wrong",element:a.jsx(F,{children:a.jsx(bj,{})})}),a.jsx(P,{path:"/brag-document",element:a.jsx(F,{children:a.jsx(wj,{})})}
594),a.jsx(P,{path:"/accomplishment-log",element:a.jsx(F,{children:a.jsx(Sj,{})})}),a.jsx(P,{path:"/what-does-an-ats-see",element:a.jsx(F,{children:a.jsx(Ej,{})})}),a.jsx(P,{path:"/chatgpt-wrote-my-resume-now-what",element:a.jsx(F,{children:a.jsx(vj,{})})}),a.jsx(P,{path:"/resume-checker-after-ai-rewrite",element:a.jsx(F,{children:a.jsx(Tj,{})})}),a.jsx(P,{path:"/free-job-application-tracker",element:a.jsx(F,{children:a.jsx(Cj,{})})}),a.jsx(P,{path:"/job-alerts-matched-to-your-resume",element:a.jsx(F,{children:a.jsx(Aj,{})})}),a.jsx(P,{path:"/kickresume-alternative",element:a.jsx(F,{children:a.jsx(Ij,{})})}),a.jsx(P,{path:"/resume-worded-alternative",element:a.jsx(F,{children:a.jsx(Rj,{})})}),a.jsx(P,{path:"/features",element:a.jsx(F,{children:a.jsx(kj,{})})}),a.jsx(P,{path:"/features/resume-tailoring",element:a.jsx(F,{children:a.jsx(Nj,{})})}),a.jsx(P,{path:"/features/career-diary",element:a.jsx(F,{children:a.jsx(jj,{})})}),a.jsx(P,{path:"/features/application-tracker",element:a.jsx(F,{children:a.jsx(Lj,{})})}),a.jsx(P,{path:"/features/career-gps",element:a.jsx(F,{children:a.jsx(Pj,{})})}),a.jsx(P,{path:"/features/ats-simulator",element:a.jsx(F,{children:a.jsx(Oj,{})})}),a.jsx(P,{path:"/features/interview-prep",element:a.jsx(F,{children:a.jsx(Dj,{})})}),a.jsx(P,{path:"/features/career-score",element:a.jsx(F,{children:a.jsx(Mj,{})})}),a.jsx(P,{path:"/features/cover-letters",element:a.jsx(F,{children:a.jsx(Uj,{})})}),a.jsx(P,{path:"/features/portfolio",element:a.jsx(F,{children:a.jsx(Fj,{})})}),a.jsx(P,{path:"/features/apps",element:a.jsx(F,{children:a.jsx($j,{})})}),a.jsx(P,{path:"/tools/resume-or-market",element:a.jsx(F,{children:a.jsx(YN,{})})}),a.jsx(P,{path:"/jobscan-alternative",element:a.jsx(F,{children:a.jsx(nj,{})})}),a.jsx(P,{path:"/teal-alternative",element:a.jsx(F,{children:a.jsx(rj,{})})}),a.jsx(P,{path:"/rezi-alternative",element:a.jsx(F,{children:a.jsx(sj,{})})}),a.jsx(P,{path:"/enhancv-alternative",element:a.jsx(F,{children:a.jsx(oj,{})})}),a.jsx(P,{path:"/career-accomplishment-tracker",element:a.jsx(F,{children:a.jsx(qN,{})})}),a.jsx(P,{path:"/job-application-tracker",element:a.jsx(F,{children:a.jsx(KN,{})})}),a.jsx(P,{path:"/ai-cover-letter-generator",element:a.jsx(F,{children:a.jsx(XN,{})})}),a.jsx(P,{path:"/resume-match-score",element:a.jsx(F,{children:a.jsx(ZN,{})})}),a.jsx(P,{path:"/career-diary-journal",element:a.jsx(F,{children:a.jsx(QN,{})})}),a.jsx(P,{path:"/free-resume-tailoring",element:a.jsx(F,{children:a.jsx(tj,{})})}),a.jsx(P,{path:"/watch/confirm",element:a.jsx(F,{children:a.jsx(ej,{})})}),a.jsx(P,{path:"/guide",element:a.jsx(F,{children:a.jsx(DN,{onBack:()=>window.history.back()})})}),a.jsx(P,{path:"/privacy",element:a.jsx(F,{children:a.jsx(FN,{onBack:()=>window.history.back()})})}),a.jsx(P,{path:"/extension/privacy",element:a.jsx(F,{children:a.jsx($N,{onBack:()=>window.history.back()})})}),a.jsx(P,{path:"/terms",element:a.jsx(F,{children:a.jsx(BN,{onBack:()=>window.history.back()})})}),a.jsx(P,{path:"/support",element:a.jsx(F,{children:a.jsx(zN,{onBack:()=>window.history.back()})})}),a.jsx(P,{path:"/pricing",element:a.jsx(F,{children:a.jsx(GN,{})})}),a.jsx(P,{path:"/about",element:a.jsx(F,{children:a.jsx(HN,{})})}),a.jsx(P,{path:"/dashboard-demo",element:a.jsx(F,{children:a.jsx(IN,{})})}),!1,!1,a.jsx(P,{path:"/login",element:a.jsx(F,{children:a.jsx(za,{})})}),a.jsx(P,{path:"/auth",element:a.jsx(F,{children:a.jsx(za,{})})}),a.jsx(P,{path:"/signup",element:a.jsx(F,{children:a.jsx(za,{})})}),a.jsx(P,{path:"/auth/native",element:a.jsx(F,{children:a.jsx(RN,{})})}),a.jsx(P,{path:"/r/:code",element:a.jsx(F,{children:a.jsx(Ga,{kind:"referral"})})}),a.jsx(P,{path:"/ref/:code",element:a.jsx(F,{children:a.jsx(Ga,{kind:"referral"})})}),a.jsx(P,{path:"/promo/:code",element:a.jsx(F,{children:a.jsx(Ga,{kind:"promo"})})}),a.jsx(P,{path:"/app/home",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(AN,{})})})}),a.jsx(P,{path:"/dashboard",element:a.jsx(Pe,{to:"/app/home",replace:!0})}),a.jsx(P,{path:"/app/tailor",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(Qk,{})})})}),a.jsx(P,{path:"/app/resume-tailor/history",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(MN,{})})})}),a.jsx(P,{path:"/app/diary",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(rN,{})})})}),a.jsx(P,{path:"/app/search",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(tN,{})})})}),a.jsx(P,{path:"/app/jobs",element:a.jsx(Pe,{to:"/app/search",replace:!0})}),a.jsx(P,{path:"/app/jobs/:jobId",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(gN,{})})})}),a.jsx(P,{path:"/app/applications",element:a.jsx(Re,{allowGuest:!1,gateFeatureName:"Application Tracker",gateDescription:"Track every application's status, notes, and follow-ups in one place â saved to your account so nothing gets lost.",children:a.jsx(F,{children:a.jsx(pN,{})})})}),a.jsx(P,{path:"/app/job-tracker",element:a.jsx(Pe,{to:"/app/applications",replace:!0})}),a.jsx(P,{path:"/app/tracker",element:a.jsx(Pe,{to:"/app/applications",replace:!0})}),a.jsx(P,{path:"/app/ats-simulator",element:a.jsx(Pe,{to:"/app/intelligence/ats-simulator",replace:!0})}),a.jsx(P,{path:"/app/star-builder",element:a.jsx(Pe,{to:"/app/interview-prep",replace:!0})}),a.jsx(P,{path:"/app/career-gps",element:a.jsx(Pe,{to:"/app/intelligence/career-gps",replace:!0})}),a.jsx(P,{path:"/app/resume-library",element:a.jsx(Re,{allowGuest:!1,gateFeatureName:"Resume Library",gateDescription:"Every resume you tailor is auto-saved to your library so you can re-download, compare, and reuse them for future applications.",children:a.jsx(F,{children:a.jsx(fN,{})})})}),a.jsx(P,{path:"/app/resumes",element:a.jsx(Pe,{to:"/app/resume-library",replace:!0})}),a.jsx(P,{path:"/app/saved-jobs",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(CN,{})})})}),a.jsx(P,{path:"/app/cover-letter",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(_N,{})})})}),a.jsx(P,{path:"/app/profile",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(SN,{})})})}
594),a.jsx(P,{path:"/app/settings",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(bN,{})})})}),a.jsx(P,{path:"/settings/billing",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(kd,{})})})}),a.jsx(P,{path:"/app/settings/billing",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(kd,{})})})}),a.jsx(P,{path:"/app/portfolio/edit",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(vN,{})})})}),a.jsx(P,{path:"/app/corpus",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(oN,{})})})}),a.jsx(P,{path:"/app/intelligence/career-gps",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(kN,{})})})}),a.jsx(P,{path:"/app/intelligence/ats-simulator",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(NN,{})})})}),a.jsx(P,{path:"/app/interview-prep",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(jN,{})})})}),a.jsx(P,{path:"/app/linkedin",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(LN,{})})})}),a.jsx(P,{path:"/app/career-score",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(PN,{})})})}),a.jsx(P,{path:"/app/portfolio-settings",element:a.jsx(Re,{allowGuest:!0,children:a.jsx(F,{children:a.jsx(UN,{})})})}),a.jsx(P,{path:"/app/founder",element:a.jsx(Re,{children:a.jsx(F,{children:a.jsx(Bj,{})})})}),a.jsx(P,{path:"/app",element:a.jsx(Pe,{to:"/app/home",replace:!0})}),a.jsx(P,{path:"/score/:shareId",element:a.jsx(F,{children:a.jsx(ON,{})})}),a.jsx(P,{path:"/portfolio/:slug",element:a.jsx(F,{children:a.jsx(Rd,{})})}),a.jsx(P,{path:"/",element:a.jsx(F,{children:a.jsx(uN,{})})}),a.jsx(P,{path:"/signin",element:a.jsx(Pe,{to:"/auth",replace:!0})}),a.jsx(P,{path:"/sign-in",element:a.jsx(Pe,{to:"/auth",replace:!0})}),a.jsx(P,{path:"/sign-up",element:a.jsx(Pe,{to:"/auth",replace:!0})}),a.jsx(P,{path:"/register",element:a.jsx(Pe,{to:"/auth",replace:!0})}),a.jsx(P,{path:"/landing",element:a.jsx(Pe,{to:"/",replace:!0})}),a.jsx(P,{path:"/home",element:a.jsx(Pe,{to:"/",replace:!0})}),a.jsx(P,{path:"/dashboard",element:a.jsx(Pe,{to:"/app/home",replace:!0})}),a.jsx(P,{path:"/:slug",element:a.jsx(F,{children:a.jsx(Rd,{})})}),a.jsx(P,{path:"*",element:a.jsx(Pe,{to:"/",replace:!0})})]})})}),Nt={"/app/home":()=>{D(()=>Promise.resolve().then(()=>Xk),void 0)},"/app/diary":()=>{D(()=>import("./CareerDiaryPage-X49wOAd_.js"),__vite__mapDeps([30,1,2,31,23,6,3,4,5,21,22,0,29,17,32,33]))},"/app/career-score":()=>{D(()=>import("./CareerReadinessPage-DzYQHsDA.js"),__vite__mapDeps([66,1,2,3,4,5]))},"/app/profile":()=>{D(()=>import("./ProfilePage-CZ8R0EDG.js"),__vite__mapDeps([49,1,2,9,31,23,48,3,4,5]))},"/app/tailor":()=>{D(()=>import("./ResumeTailorPage-CU5guW79.js"),__vite__mapDeps([8,1,2,9,10,11,12,13,14,15,16,17,18,19,3,4,5,20,21,22,23]))},"/app/cover-letter":()=>{D(()=>import("./CoverLetterPage-Ih35fNAU.js"),__vite__mapDeps([46,1,2,13,14,22,11,12,16,17,29,3,4,5]))},"/app/portfolio/edit":()=>{D(()=>import("./PortfolioEditorPage-DpbnGrE6.js"),__vite__mapDeps([50,1,2,51,7,3,4,5,18,13,52,29,17]))},"/app/settings":()=>{D(()=>import("./SettingsPage-CkBpfUX7.js"),__vite__mapDeps([47,1,2,22,48,43,3,4,5]))}},Hj=({to:e,icon:t,label:n})=>{const r=We(),s=r.pathname===e||r.pathname.startsWith(e+"/");return a.jsxs(bn,{to:e,className:"rt-nav-pill","data-active":s,"aria-current":s?"page":void 0,onMouseEnter:()=>{var o;return(o=Nt[e])==null?void 0:o.call(Nt)},onFocus:()=>{var o;return(o=Nt[e])==null?void 0:o.call(Nt)},children:[t,a.jsx("span",{children:n})]})},Ps=({label:e,icon:t,items:n,isProGroup:r,isGuest:s,onInitiateAuth:o,showProBadges:i})=>{const[c,l]=f.useState(!1),u=f.useRef(null),d=f.useRef(null),p=f.useRef(null),m=We();Kc(u,()=>l(!1)),f.useEffect(()=>{l(!1)},[m.pathname]),f.useEffect(()=>{var y;if(!c)return;const h=(y=d.current)==null?void 0:y.querySelector('[data-menuitem="true"]');h==null||h.focus()},[c]);const g=n.some(h=>m.pathname===h.to||m.pathname.startsWith(h.to+"/")),_=`nav-menu-${e.replace(/[^a-z]/gi,"").toLowerCase()}`;return a.jsxs("div",{className:"relative",ref:u,children:[a.jsxs(ue,{ref:p,type:"button",onClick:()=>l(h=>!h),onKeyDown:h=>{var y;h.key==="Escape"&&(l(!1),(y=p.current)==null||y.focus()),h.key==="ArrowDown"&&(h.preventDefault(),l(!0))},variant:"ghost",className:"rt-nav-pill h-auto border-none","data-active":g,"aria-expanded":c,"aria-haspopup":"menu","aria-controls":c?_:void 0,"aria-label":`${e} menu`,children:[t,a.jsx("span",{children:e}),r&&i&&a.jsx(Fi,{className:"ml-0.5"}),a.jsx(aA,{className:`h-3 w-3 transition-transform ${c?"rotate-180":""}`})]}),c&&a.jsxs("div",{id:_,ref:d,role:"menu","aria-label":e,className:"absolute top-full left-0 mt-2 w-56 rounded-lg border border-[var(--line)] bg-[var(--surface)] py-1 shadow-[var(--e3)] z-50",onKeyDown:h=>{var y;h.key==="Escape"&&(h.stopPropagation(),l(!1),(y=p.current)==null||y.focus())},children:[r&&a.jsx("div",{className:"px-3 py-2 mb-1 border-b border-[var(--line)] text-[10px] font-bold uppercase tracking-[0.12em] text-[var(--ink-3)]",children:"Go further with Pro"}),n.map(h=>{const y=m.pathname===h.to||m.pathname.startsWith(h.to+"/");return s&&h.requiresAuth?a.jsxs("button",{type:"button",role:"menuitem","data-menuitem":"true",tabIndex:0,onClick:()=>{l(!1),o()},className:"w-full flex items-center gap-3 px-4 py-3 text-sm text-[var(--ink-3)] hover:bg-[var(--surface-sunk)] transition-colors text-left",children:[h.icon,a.jsx("span",{children:h.label}),a.jsx("span",{className:"ml-auto text-[10px] uppercase tracking-wide text-[var(--ink-3)]",children:"Sign in"})]},h.to):a.jsxs(bn,{to:h.to,role:"menuitem","data-menuitem":"true",tabIndex:0,onClick:()=>l(!1),onMouseEnter:()=>{var b;return(b=Nt[h.to])==null?void 0:b.call(Nt)},className:`flex items-center gap-3 px-4 py-3 text-sm transition-colors ${y?"bg-[var(--ever-050)] text-[var(--ever-700)]":"text-[var(--ink-2)] hover:bg-[var(--surface-sunk)] hover:text-[var(--ink)]"}`,children:[h.icon,a.jsx("span",{children:h.label}),h.isPro&&i&&a.jsx(Fi,{className:"ml-auto"})]},h.to)})]})]})},Wj=({session:e,onSignOut:t})=>{const[n,r]=f.useState(!1),s=f.useRef(null);return Kc(s,()=>r(!1)),e?a.jsxs("div",{className:"relative",ref:s,children:[a.jsx(ue,{onClick:()=>r(!n),variant:"secondary",size:"sm",className:"w-10 h-10 rounded-full p-0 bg-[var(--surface)] text-[var(--ink-2)] hover:bg-[var(--surface-sunk)] shadow-sm border border-[var(--line)]","aria-label":"User menu",children:a.jsx(Eo,{className:"h-6 w-6"})}),n&&a.jsxs("div",{className:"absolute right-0 mt-2 w-56 rounded-xl border border-[var(--line)] bg-[var(--surface)] py-1 shadow-[var(--e3)] z-20 animate-fadeIn",children:[a.jsxs("div",{className:"px-4 py-3 text-sm border-b border-[var(--line)]",children:[a.jsx("p",{className:"font-semibold text-[var(--ink)]",children:"Account"}),a.jsx("p",{className:"text-[var(--ink-3)] truncate",children:ak(e.user.email)})]}),a.jsxs("div",{className:"py-1",children:[a.jsx(bn,{to:"/app/profile",className:"block px-4 py-2 text-sm text-[var(--ink-2)] hover:bg-[var(--surface-sunk)]",children:"Profile"}
594),a.jsx(bn,{to:"/app/settings",className:"block px-4 py-2 text-sm text-[var(--ink-2)] hover:bg-[var(--surface-sunk)]",children:"Settings"}),a.jsx(bn,{to:"/app/settings/billing",className:"block px-4 py-2 text-sm text-[var(--ink-2)] hover:bg-[var(--surface-sunk)]",children:"Billing & Usage"}),a.jsx(ue,{onClick:t,variant:"ghost",size:"sm",className:"w-full justify-start px-4 py-2 text-sm text-[var(--rust)] hover:bg-[var(--rust-bg)] transition-colors h-auto",children:"Sign Out"})]})]})]}):null},Jj=({session:e,isGuest:t,onSignOut:n,onInitiateAuth:r})=>{const{isPaid:s}=ta(),o=!s,i=[{to:"/app/diary",icon:a.jsx(Fc,{className:"h-4 w-4"}),label:"Diary"},{to:"/app/career-score",icon:a.jsx(Ti,{className:"h-4 w-4"}),label:"Career Readiness"},{to:"/app/profile",icon:a.jsx(Eo,{className:"h-4 w-4"}),label:"Profile"}],c=[{to:"/app/tailor",icon:a.jsx(St,{className:"h-4 w-4"}),label:"Tailor"},{to:"/app/cover-letter",icon:a.jsx(Uc,{className:"h-4 w-4"}),label:"Cover Letter"},{to:"/app/resume-library",icon:a.jsx(Ko,{className:"h-4 w-4"}),label:"Resume Library",requiresAuth:!0}],l=[{to:"/app/search",icon:a.jsx(Ur,{className:"h-4 w-4"}),label:"Job Search"},{to:"/app/applications",icon:a.jsx(Uf,{className:"h-4 w-4"}),label:"Application Tracker",requiresAuth:!0}],u=[{to:"/app/portfolio/edit",icon:a.jsx($c,{className:"h-4 w-4"}),label:"Portfolio",isPro:!0},{to:"/app/intelligence/career-gps",icon:a.jsx(Ci,{className:"h-4 w-4"}),label:"Career GPS",isPro:!0},{to:"/app/intelligence/ats-simulator",icon:a.jsx(pA,{className:"h-4 w-4"}),label:"ATS Simulator",isPro:!0},{to:"/app/interview-prep",icon:a.jsx(Xo,{className:"h-4 w-4"}),label:"Interview Prep",isPro:!0},{to:"/app/linkedin",icon:a.jsx(ms,{className:"h-4 w-4"}),label:"LinkedIn",isPro:!0}];return a.jsx("header",{className:"rt-app-header fixed top-0 left-0 right-0 z-30 w-full border-b border-[var(--line)] bg-[var(--surface)]/80 backdrop-blur-xl",children:a.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:a.jsxs("div",{className:"flex h-16 items-center justify-between gap-4",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx(to,{size:"md",showText:!0,href:"/app/home"})}),a.jsxs("nav",{className:"hidden md:flex items-center space-x-1 bg-[var(--surface-sunk)] p-1 rounded-full border border-[var(--line)]",children:[a.jsx(Hj,{to:"/app/home",icon:a.jsx(iA,{className:"h-4 w-4"}),label:"Home"}),a.jsx(Ps,{label:"My Career",icon:a.jsx(Eo,{className:"h-4 w-4"}),items:i,isGuest:t,onInitiateAuth:r,showProBadges:o}),a.jsx(Ps,{label:"Tailor & Apply",icon:a.jsx(St,{className:"h-4 w-4"}),items:c,isGuest:t,onInitiateAuth:r,showProBadges:o}),a.jsx(Ps,{label:"Find Jobs",icon:a.jsx(Ur,{className:"h-4 w-4"}),items:l,isGuest:t,onInitiateAuth:r,showProBadges:o}),a.jsx(Ps,{label:"Coach",icon:a.jsx(Ci,{className:"h-4 w-4"}),items:u,isProGroup:!0,isGuest:t,onInitiateAuth:r,showProBadges:o})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"h-6 w-px bg-[var(--line)] hidden sm:block"}),a.jsx(_h,{}),t?a.jsx(ue,{onClick:r,variant:"primary",size:"md",className:"rounded-full px-5 h-auto py-2",children:"Get Started"}):a.jsx(Wj,{session:e,onSignOut:n})]})]})})})},Vj=({currentView:e,onViewChange:t})=>{const n=[{view:"diary",icon:Fc,label:"Diary"},{view:"tailor",icon:Eo,label:"Tailor"},{view:"search",icon:Ur,label:"Search"},{view:"interview-prep",icon:Xo,label:"Interview"},{view:"linkedin",icon:ms,label:"LinkedIn"},{view:"portfolio-settings",icon:$c,label:"Website"}];return a.jsx("nav",{className:"mobile-nav md:hidden fixed bottom-0 left-0 right-0 bg-white dark:bg-slate-900 border-t border-[var(--border-default)] z-40 safe-area-bottom",children:a.jsx("div",{className:"flex items-center justify-around h-16 px-2",children:n.map(({view:r,icon:s,label:o})=>{const i=e===r;return a.jsxs(ue,{type:"button",onClick:()=>t(r),variant:"ghost",size:"md",className:`flex flex-col items-center justify-center flex-1 h-full transition-colors border-none p-0 bg-transparent hover:bg-transparent ${i?"text-blue-600 dark:text-blue-400":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"}`,"aria-label":`Switch to ${o}`,"aria-current":i?"page":void 0,children:[a.jsx(s,{className:"h-6 w-6"}
594),a.jsx("span",{className:"text-xs font-medium mt-1",children:o})]},r)})})})},Nd=`-- This script creates and updates the necessary tables for CareerDiary. 595-- It's safe to run even if the tables or columns already exist. 596 597-- Create 'profiles' table if it doesn't exist 598CREATE TABLE IF NOT EXISTS public.profiles ( 599 id UUID PRIMARY KEY REFERENCES auth.users(id), 600 profile_data JSONB, 601 location VARCHAR(255) 602); 603 604-- Create 'applied_jobs' table if it doesn't exist 605CREATE TABLE IF NOT EXISTS public.applied_jobs ( 606 id UUID PRIMARY KEY DEFAULT gen_random_uuid(), 607 user_id UUID REFERENCES auth.users(id), 608 created_at TIMESTAMP WITH TIME ZONE DEFAULT timezone('utc'::text, now()) NOT NULL, 609 job_title VARCHAR(255), 610 company_name VARCHAR(255), 611 job_description TEXT, 612 tailored_resume TEXT, 613 cover_letter TEXT, 614 match_score INT, 615 match_justification TEXT 616); 617 618-- Create 'corpus_files' table if it doesn't exist 619CREATE TABLE IF NOT EXISTS public.corpus_files ( 620 id UUID PRIMARY KEY DEFAULT gen_random_uuid(), 621 user_id UUID REFERENCES auth.users(id), 622 created_at TIMESTAMP WITH TIME ZONE DEFAULT timezone('utc'::text, now()) NOT NULL, 623 gemini_file_name VARCHAR(255) UNIQUE, 624 display_name VARCHAR(255), 625 mime_type VARCHAR(100), 626 size_bytes BIGINT 627); 628`,jd=`-- This script enables Row Level Security (RLS) and creates security policies. 629-- It's safe to run multiple times. 630 631-- Enable RLS on tables (this command is idempotent) 632ALTER TABLE public.profiles ENABLE ROW LEVEL SECURITY; 633ALTER TABLE public.applied_jobs ENABLE ROW LEVEL SECURITY; 634ALTER TABLE public.corpus_files ENABLE ROW LEVEL SECURITY; 635 636-- Policies for 'profiles' table (safe to re-run) 637DROP POLICY IF EXISTS "Allow users to view their own profile" ON public.profiles; 638CREATE POLICY "Allow users to view their own profile" 639ON public.profiles FOR SELECT 640USING ( auth.uid() = id ); 641 642DROP POLICY IF EXISTS "Allow users to insert their own profile" ON public.profiles; 643CREATE POLICY "Allow users to insert their own profile" 644ON public.profiles FOR INSERT 645WITH CHECK ( auth.uid() = id ); 646 647DROP POLICY IF EXISTS "Allow users to update their own profile" ON public.profiles; 648CREATE POLICY "Allow users to update their own profile" 649ON public.profiles FOR UPDATE 650USING ( auth.uid() = id ); 651 652 653-- Policies for 'applied_jobs' table (safe to re-run) 654DROP POLICY IF EXISTS "Allow users to view their own jobs" ON public.applied_jobs; 655CREATE POLICY "Allow users to view their own jobs" 656ON public.applied_jobs FOR SELECT 657USING ( auth.uid() = user_id ); 658 659DROP POLICY IF EXISTS "Allow users to insert their own jobs" ON public.applied_jobs; 660CREATE POLICY "Allow users to insert their own jobs" 661ON public.applied_jobs FOR INSERT 662WITH CHECK ( auth.uid() = user_id ); 663 664 665-- Policies for 'corpus_files' table (safe to re-run) 666DROP POLICY IF EXISTS "Allow users to view their own files" ON public.corpus_files; 667CREATE POLICY "Allow users to view their own files" 668ON public.corpus_files FOR SELECT 669USING ( auth.uid() = user_id ); 670 671DROP POLICY IF EXISTS "Allow users to insert their own files" ON public.corpus_files; 672CREATE POLICY "Allow users to insert their own files" 673ON public.corpus_files FOR INSERT 674WITH CHECK ( auth.uid() = user_id ); 675 676DROP POLICY IF EXISTS "Allow users to delete their own files" ON public.corpus_files; 677CREATE POLICY "Allow users to delete their own files" 678ON public.corpus_files FOR DELETE 679USING ( auth.uid() = user_id ); 680`,Yj=({onClose:e})=>{const[t,n]=f.useState(null),r=s=>{const o=s==="tables"?Nd:jd;navigator.clipboard.writeText(o),n(s),setTimeout(()=>n(null),2e3)};return a.jsx("div",{className:"fixed inset-0 bg-gray-900 bg-opacity-80 flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-white rounded-xl shadow-2xl w-full max-w-3xl max-h-[90vh] flex flex-col",children:[a.jsxs("div",{className:"p-6 border-b flex justify-between items-center",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Final Setup: Database Configuration"}),a.jsx("p",{className:"text-sm text-gray-600",children:"To use authentication and save data, you need to set up a free Supabase project."})]}),a.jsx(ue,{onClick:e,variant:"ghost",size:"sm",className:"p-1 text-gray-400 hover:text-gray-600 h-auto","aria-label":"Close",children:a.jsx(Of,{className:"h-8 w-8"})})]}),a.jsxs("div",{className:"p-6 space-y-6 overflow-y-auto",children:[a.jsx("div",{className:"bg-blue-50 border-l-4 border-blue-400 p-4",children:a.jsxs("div",{className:"flex",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx(cA,{className:"h-5 w-5 text-blue-400"})}),a.jsxs("div",{className:"ml-3",children:[a.jsx("p",{className:"text-sm font-bold text-blue-800",children:"Why am I seeing this?"}),a.jsx("p",{className:"mt-1 text-sm text-blue-700",children:"You're seeing this page because you've successfully logged in, but the app couldn't find the database tables needed to store your profile and job applications. Please follow the steps below to complete the one-time setup."})]})]})}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-lg",children:"Step 1: Create a Supabase Project"}),a.jsxs("p",{className:"text-sm text-gray-700",children:["Go to ",a.jsx("a",{href:"https://supabase.com/",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 font-semibold hover:underline",children:"Supabase"}),", sign up for a free account, and create a new project. It only takes a few minutes."]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-lg",children:"Step 2: Add Your Supabase Ke
680ys"}),a.jsxs("p",{className:"text-sm text-gray-700 mb-2",children:["In your Supabase project dashboard, go to ",a.jsx("span",{className:"font-mono bg-gray-100 p-1 rounded-md text-xs",children:"Project Settings > API"}),". Find your ",a.jsx("strong",{children:"Project URL"})," and your ",a.jsxs("strong",{children:[a.jsx("code",{className:"font-mono bg-gray-100 p-1 rounded-md text-xs",children:"anon (public)"})," key"]}),"."]}),a.jsxs("div",{className:"bg-blue-50 p-4 rounded-lg border border-blue-200",children:[a.jsx("h4",{className:"font-semibold text-blue-800",children:"How to Add Secrets:"}),a.jsxs("p",{className:"text-sm text-blue-700 mt-1",children:["Look for a ",a.jsx("strong",{children:'"Secrets"'})," tab or an icon that looks like a key (ð) in the sidebar of this editor. Click it, and add two new secrets:"]}),a.jsxs("ul",{className:"list-disc list-inside text-sm space-y-1 mt-2 pl-4",children:[a.jsxs("li",{children:["Name: ",a.jsx("code",{className:"font-mono bg-white p-1 rounded-md text-xs",children:"SUPABASE_URL"}),", Value: your ",a.jsx("strong",{children:"Project URL"})]}),a.jsxs("li",{children:["Name: ",a.jsx("code",{className:"font-mono bg-white p-1 rounded-md text-xs",children:"SUPABASE_KEY"}),", Value: your ",a.jsx("strong",{children:"anon (public) key"})]})]}),a.jsx("p",{className:"text-xs text-blue-600 mt-3 font-semibold",children:"After adding the secrets, you must reload the application for the changes to take effect."})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-lg",children:"Step 3: Create Database Tables"}),a.jsxs("p",{className:"text-sm text-gray-700 mb-2",children:["In the Supabase dashboard, navigate to the ",a.jsx("span",{className:"font-mono bg-gray-100 p-1 rounded-md text-xs",children:"SQL Editor"}),'. Create a "New query" and paste the following SQL to create and update your tables. Then click "Run".']}),a.jsxs("div",{className:"relative bg-gray-800 text-white p-4 rounded-lg my-2 font-mono text-xs",children:[a.jsxs(ue,{onClick:()=>r("tables"),variant:"secondary",size:"sm",className:"absolute top-2 right-2 bg-gray-700 hover:bg-gray-600 text-white border-none py-1 h-auto px-2 rounded-md flex items-center gap-2 text-xs",children:[a.jsx(qu,{className:"h-4 w-4"}),a.jsx("span",{children:t==="tables"?"Copied!":"Copy Script"})]}),a.jsx("pre",{children:a.jsx("code",{children:Nd})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-lg",children:"Step 4: Secure Your Tables with Policies"}),a.jsxs("p",{className:"text-sm text-gray-700 mb-2",children:["For security, Supabase uses Row Level Security. Run the following SQL script in the ",a.jsx("span",{className:"font-mono bg-gray-100 p-1 rounded-md text-xs",children:"SQL Editor"}),' to ensure users can only access their own data. Then click "Run".']}),a.jsxs("div",{className:"relative bg-gray-800 text-white p-4 rounded-lg font-mono text-xs",children:[a.jsxs(ue,{onClick:()=>r("policies"),variant:"secondary",size:"sm",className:"absolute top-2 right-2 bg-gray-700 hover:bg-gray-600 text-white border-none py-1 h-auto px-2 rounded-md flex items-center gap-2 text-xs",children:[a.jsx(qu,{className:"h-4 w-4"}),a.jsx("span",{children:t==="policies"?"Copied!":"Copy Script"})]}),a.jsx("pre",{children:a.jsx("code",{children:jd})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-lg",children:"Step 5: Enable Social Logins (Optional)"}),a.jsxs("p",{className:"text-sm text-gray-700 mb-2",children:["To allow users to sign in with Google or LinkedIn, go to ",a.jsx("span",{className:"font-mono bg-gray-100 p-1 rounded-md text-xs",children:"Authentication > Providers"})," in Supabase. You'll need to follow the official Supabase guides to set up OAuth credentials for each."]})]})]}),a.jsxs("div",{className:"p-4 bg-gray-50 text-center rounded-b-xl border-t",children:[a.jsx("p",{className:"text-sm text-gray-700 font-semibold mb-3",children:"After running the SQL scripts in your Supabase project, click the button below."}),a.jsx(ue,{onClick:e,variant:"primary",size:"lg",className:"w-full max-w-xs mx-auto",children:"I've run the scripts, finish setup!"})]})]})})},Os=[{title:"Welcome to CareerDiary!",content:"This quick tour will show you how to land your next job faster. Let's explore the key features.",highlight:null},{title:"1. Your Master Resume",content:"This is your career diary. Upload your most comprehensive resume here. It's the source for all tailored versions. You can edit it with the structured editor anytime.",highlight:"input-master-resume"},{title:"2. The Job Description",content:"Paste a job description here, or use the 'Fetch' button to automatically extract it from a URL like LinkedIn.",highlight:"input-job-description"},{title:"3. Tailor with AI",content:"Click 'Tailor Resume' and our AI will rewrite your master resume to perfectly match the job, highlighting your most relevant skills and experience.",highlight:"button-tailor"},{title:"4. Your AI-Powered Results",content:"Your new resume appears here. You can see a summary of changes, check the improved match score, and even generate a cover letter.",highlight:"output-results"},{title:"5. Refine with Chat",content:"Don't like something? Use the AI chat to ask for changes. For example, 'Make the summary more concise' or 'Emphasize my Python skills'.",highlight:"refine-chat"},{title:"6. Find Your Next Job",content:"Switch to the 'Job Search' tab. Our AI will use your master resume to find roles that are a great fit for you. Ready to get started?",highlight:"nav-job-search"}],qj=({onClose:e})=>{const[t,n]=f.useState(0),r=()=>n(i=>Math.min(i+1,Os.length-1)),s=()=>n(i=>Math.max(i-1,0)),o=Os[t];return a.jsx("div",{className:"fixed inset-0 bg-transparent flex items-center justify-center z-[100] p-4 pointer-events-none",children:a.jsxs("div",{className:"relative bg-white dark:bg-slate-800 rounded-xl shadow-2xl w-full max-w-lg text-center p-8 transform transition-all animate-fade-in-up pointer-events-auto",children:[a.jsx(ue,{onClick:e,variant:"ghost",size:"sm",className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 dark:text-slate-400 dark:hover:text-slate-200 h-auto p-0 border-none bg-transparent hover:bg-transparent","aria-label":"Close tour",children:a.jsx(Of,{className:"w-8 h-8"})}),a.jsx("div",{className:"flex justify-center mb-4",children:a.jsx("div",{className:"p-3 bg-blue-100 dar
680k:bg-blue-500/20 rounded-full",children:a.jsx(St,{className:"w-8 h-8 text-blue-600 dark:text-blue-400"})})}),a.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-slate-100 mb-2",children:o.title}),a.jsx("p",{className:"text-gray-600 dark:text-slate-300 mb-6",children:o.content}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(ue,{onClick:s,disabled:t===0,variant:"ghost",size:"sm",className:"flex items-center space-x-2 text-sm font-semibold text-gray-500 hover:text-gray-800 disabled:opacity-50 dark:text-slate-400 dark:hover:text-slate-100 h-auto p-0 border-none bg-transparent hover:bg-transparent",leftIcon:a.jsx(oA,{className:"w-4 h-4"}),children:a.jsx("span",{children:"Prev"})}),a.jsx("div",{className:"flex items-center space-x-2",children:Os.map((i,c)=>a.jsx("div",{className:`w-2.5 h-2.5 rounded-full transition-colors ${c===t?"bg-blue-600":"bg-gray-300 dark:bg-slate-600"}`},c))}),t===Os.length-1?a.jsx(ue,{onClick:e,variant:"primary",size:"md",className:"bg-blue-600 text-white font-bold py-2 px-6 rounded-lg hover:bg-blue-700 h-auto border-none",children:"Get Started"}):a.jsx(ue,{onClick:r,variant:"ghost",size:"sm",className:"flex items-center space-x-2 text-sm font-semibold text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 h-auto p-0 border-none bg-transparent hover:bg-transparent",rightIcon:a.jsx(sA,{className:"h-4 w-4"}),children:a.jsx("span",{children:"Next"})})]})]})})},Kj=({type:e})=>{switch(e){case"success":return a.jsx("svg",{className:"w-5 h-5 text-green-400",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})});case"error":return a.jsx("svg",{className:"w-5 h-5 text-red-400",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})});case"warning":return a.jsx("svg",{className:"w-5 h-5 text-yellow-400",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})});case"info":return a.jsx("svg",{className:"w-5 h-5 text-blue-400",fill:"currentColor",viewBox:"0 0 20 20",children:a.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}},Xj=({toast:e,onClose:t})=>{const[n,r]=f.useState(!1);f.useEffect(()=>{const o=e.duration||5e3,i=setTimeout(()=>{r(!0),setTimeout(()=>t(e.id),300)},o);return()=>clearTimeout(i)},[e,t]);const s={success:"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800",error:"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800",warning:"bg-yellow-50 dark:bg-yellow-900/20 border-yellow-200 dark:border-yellow-800",info:"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800"}[e.type];return a.jsxs("div",{className:`flex items-start gap-3 p-4 rounded-lg border shadow-lg max-w-md w-full backdrop-blur-sm ${s} transition-all duration-base ${n?"opacity-0 translate-x-full":"opacity-100 translate-x-0"}`,role:"alert","aria-live":"polite",children:[a.jsx(Kj,{type:e.type}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:e.message}),e.description&&a.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-slate-400",children:e.description})]}),a.jsx(ue,{onClick:()=>{r(!0),setTimeout(()=>t(e.id),300)},variant:"ghost",size:"sm",className:"flex-shrink-0 text-gray-400 hover:text-gray-600 dark:hover:text-slate-300 transition-colors h-auto p-0 border-none","aria-label":"Close notification",children:a.jsx(lA,{className:"h-5 w-5"})})]})},Zj=({toasts:e,onClose:t})=>a.jsx("div",{className:"fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none","aria-live":"polite","aria-atomic":"false",children:a.jsx("div",{className:"pointer-events-auto space-y-2",children:e.map(n=>a.jsx(Xj,{toast:n,onClose:t},n.id))})});
680class Qj extends Error{constructor(t,n){super(t),this.code=n,this.name="WatchedSearchError"}}const na=async()=>{var r;const e={"Content-Type":"application/json"},t=await(Z==null?void 0:Z.auth.getSession()),n=(r=t==null?void 0:t.data.session)==null?void 0:r.access_token;return n&&(e.Authorization=`Bearer ${n}`),e},Zc=async e=>{const t=await e.json().catch(()=>({})),n=t.code==="limit_reached"||t.code==="duplicate"?t.code:"unknown";throw new Qj(t.error||`Request failed (${e.status})`,n)},r5=async()=>{const e=await fetch("/api/watched-searches",{headers:await na()});return e.ok||await Zc(e),e.json()},s5=async e=>{var r;const t=await fetch("/api/watched-searches",{method:"POST",headers:await na(),body:JSON.stringify({title:e.title,location:e.location,intentText:(r=e.intentText)!=null&&r.trim()?e.intentText.trim():void 0})});return t.ok||await Zc(t),(await t.json()).watch},o5=async e=>{const t=await fetch(`/api/watched-searches/${encodeURIComponent(e)}`,{method:"DELETE",headers:await na()});!t.ok&&t.status!==404&&await Zc(t)},eL=async e=>{try{await fetch("/api/watched-searches/digest-click",{method:"POST",headers:await na(),body:JSON.stringify({campaign:e})})}catch{}},tL=()=>{const{state:e}=ln(),{theme:t}=e;f.useEffect(()=>{const n=document.documentElement,r=window.matchMedia("(prefers-color-scheme: dark)"),s=i=>{n.classList.remove("light","dark"),n.classList.add(i),n.style.colorScheme=i;let c=document.querySelector('meta[name="theme-color"]');c||(c=document.createElement("meta"),c.setAttribute("name","theme-color"),document.head.appendChild(c)),c.setAttribute("content",i==="dark"?"#14110E":"#FAF9F5"),document.body.style.borderTop=i==="dark"?"1px solid rgba(70, 63, 54, 0.4)":"1px solid rgba(38, 28, 16, 0.06)"},o=()=>t==="dark"?"dark":t==="light"?"light":r.matches?"dark":"light";if(s(o()),t==="system"){const i=()=>s(o());return r.addEventListener("change",i),()=>r.removeEventListener("change",i)}},[t])},nL=({isActive:e,particles:t})=>e?a.jsx("div",{className:"fixed inset-0 z-50 pointer-events-none overflow-hidden","aria-hidden":"true",children:t.map(n=>a.jsx("div",{className:"absolute animate-confetti",style:{left:n.left,top:"-10px",animationDelay:n.delay,animationDuration:n.duration},children:n.id%3===0?a.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:n.color}}):n.id%3===1?a.jsx("div",{className:"w-2 h-2 rotate-45",style:{backgroundColor:n.color}}):a.jsx("div",{className:"w-1 h-4 rounded-full",style:{backgroundColor:n.color}})},n.id))}):null,Ih="__CD_CelebrationContext__",Qc=globalThis[Ih]??f.createContext(null);globalThis[Ih]=Qc;const Ld=["#2563eb","#3b82f6","#10B981","#F59E0B","#8B5CF6"],Bi=({children:e})=>{const[t,n]=f.useState(!1),[r,s]=f.useState([]),[o,i]=f.useState(null),c=f.useCallback((u="confetti")=>{if(u==="confetti"){const d=Array.from({length:50}).map((p,m)=>({id:m,left:`${Math.random()*100}%`,delay:`${Math.random()*.5}s`,duration:`${2+Math.random()*2}s`,color:Ld[Math.floor(Math.random()*Ld.length)]}));s(d),n(!0),setTimeout(()=>{n(!1),s([])},3e3)}},[]),l=f.useCallback(u=>{i(u),setTimeout(()=>{i(null)},3e3)},[]);return M.useEffect(()=>{const u=d=>{const p=d,{type:m,message:g}=p.detail||{};m==="confetti"&&c("confetti"),g&&l(g)};return window.addEventListener("celebrate",u),()=>window.removeEventListener("celebrate",u)},[c,l]),a.jsxs(Qc.Provider,{value:{celebrate:c,showSuccessMessage:l},children:[e,a.jsx(nL,{isActive:t,particles:r}),o&&a.jsx("div",{className:"fixed top-20 left-1/2 transform -translate-x-1/2 z-50 animate-toast-in",children:a.jsxs("div",{className:"bg-green-500 text-white px-6 py-3 rounded-full shadow-lg font-semibold flex items-center gap-2",children:[a.jsx("span",{className:"text-xl",children:"ð"}),a.jsx("span",{children:o})]})})]})},Rh=()=>{const e=f.useContext(Qc);return e||{celebrate:()=>{},showSuccessMessage:()=>{}}},a5=Object.freeze(Object.defineProperty({__proto__:null,CelebrationProvider:Bi,default:Bi,useCelebration:Rh},Symbol.toStringTag,{value:"Module"})),_r=(e,t)=>{switch(t){case"submit":return e==="idle"?"pending":e;case"succeed":return e==="pending"?"succeeded":e;case"fail":return e==="pending"?"idle":e;case"reset":return e==="succeeded"?"succeeded":"idle";default:return e}},rL=e=>e==="idle",sL=6e4,i5=(e,t,n=sL)=>{if(e===null)return{coolingDown:!1,secondsRemaining:0};const r=e+n-t;return r<=0?{coolingDown:!1,secondsRemaining:0}:{coolingDown:!0,secondsRemaining:Math.ceil(r/1e3)}},Pd=e=>{if(!e)return null;const t=e.replace(/^[#?]/,"");if(!t)return null;let n;try{n=new URLSearchParams(t)}catch{return null}const r=n.get("error_code"),s=n.get("error");
680return!r&&!s?null:{code:r||s||"unknown",description:n.get("error_description")||""}},c5=e=>!!e&&(e.code==="otp_expired"||e.code==="access_denied"),l5="This confirmation link has expired or was already used. Enter your email to get a new one.",u5="A new confirmation email is on its way. It can take a minute to arrive â check your spam folder too.",oL="We sent an email very recently. Please wait a minute before requesting another one.",d5=e=>e.code==="over_email_send_rate_limit"||e.status===429||/rate limit/i.test(e.message||"")?oL:/captcha/i.test(e.message||"")||e.code==="captcha_failed"?"Verification did not go through. Please complete the challenge and try again.":e.message||"We couldn't resend the email. Please try again.",aL=new Set(["gmail.com","outlook.com","yahoo.com","hotmail.com","icloud.com","protonmail.com","live.com","aol.com","me.com","mac.com"]);function zi(e){const t=e.trim().split("@");return t.length===2?t[1].toLowerCase():""}function iL(e){const t=zi(e);return t.length>0&&!aL.has(t)}const cL=({isOpen:e,onClose:t,contextMessage:n,triggerId:r})=>{const s=f.useId(),{getGuestData:o}=on(),{celebrate:i}=Rh(),c=o(),[l,u]=f.useState(c.name),[d,p]=f.useState(c.email),[m,g]=f.useState(""),[_,h]=f.useState(!1),[y,b]=f.useState(null),[x,w]=f.useState(!1),[E,T]=f.useState(!1),C=f.useRef(0),S=f.useRef(null),A=f.useRef(null),R=f.useRef(null),N=f.useRef(null),{evaluate:O,honeypotProps:k}=xh(e),$=bh(),[z,K]=f.useState(null),[V,ie]=f.useState(!1),Q=f.useRef(null),J=f.useRef("idle");f.useEffect(()=>{if(e){const ee=o();u(ee.name||""),p(ee.email||""),g(""),b(null),w(!1),J.current="idle",C.current=Date.now(),te("signup_panel_opened",{source:r,prefilledFields:[ee.name?"name":null,ee.email?"email":null].filter(Boolean)})}},[e,o,r]),f.useEffect(()=>{d&&iL(d)?(T(!0),te("work_email_detected",{domain:zi(d),changed:!1})):T(!1)},[d]),f.useEffect(()=>{if(e){const ee=setTimeout(()=>{var ge;!d&&A.current?A.current.focus():m||(ge=S.current)==null||ge.focus()},150);return()=>clearTimeout(ee)}},[e,d,m]),f.useEffect(()=>{if(!e)return;const ee=ge=>{ge.key==="Escape"&&me()};return document.addEventListener("keydown",ee),()=>document.removeEventListener("keydown",ee)},[e]),f.useEffect(()=>{if(!e)return;const ee=document.getElementById(s);if(!ee)return;const ge=ee.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),He=ge[0],Je=ge[ge.length-1],Ke=De=>{De.key==="Tab"&&(De.shiftKey?document.activeElement===He&&(De.preventDefault(),Je==null||Je.focus()):document.activeElement===Je&&(De.preventDefault(),He==null||He.focus()))};return document.addEventListener("keydown",Ke),()=>document.removeEventListener("keydown",Ke)},[e,s]);const me=f.useCallback(()=>{const ee=Date.now()-C.current;te("signup_panel_closed",{source:r,completedSignup:x,method:null,timeOpenMs:ee}),t()},[t,r,x]),ce=f.useCallback(async ee=>{try{await fetch("/api/growth/trial/activate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ee}`},body:JSON.stringify({source:"guest-conversion-nudge"})})}catch{}},[]),xe=f.useCallback((ee,ge)=>{window.dispatchEvent(new CustomEvent("careerdiary:toast",{detail:{type:"success",message:ee,description:ge}}))},[]),ve=f.useCallback(async ee=>{var Je;if(ee.preventDefault(),!d||!m||!rL(J.current))return;J.current=_r(J.current,"submit");const ge=O();if(ge.blocked){te("signup_bot_blocked",{reason:ge.reason,surface:"signup_slide_panel"}),b("Something went wrong. Please try again."),J.current=_r(J.current,"fail");return}const He=ZR({siteKeyConfigured:!!$,token:z,unavailable:V});if(He.blocked){b(He.message),J.current=_r(J.current,"fail");return}h(!0),b(null);try{const Ke=await ff(d,m,z??void 0);J.current=_r(J.current,"succeed"),te("guest_converted",{method:"email",source:r,sessionDurationMs:Date.now()-C.current,tailorCount:c.tailorCount,jobsViewed:c.jobsViewed}),te("signup_panel_closed",{source:r,completedSignup:!0,method:"email",timeOpenMs:Date.now()-C.current});const De=Ke==null?void 0:Ke.session;De!=null&&De.access_token&&await ce(De.access_token),i("confetti");const un=(l==null?void 0:l.split(" ")[0])||"there";xe(`Welcome, ${un}!`,"Check your email to verify â but you're all set to keep going."),w(!0),t()}catch(Ke){(Je=Q.current)==null||Je.reset();const De=Ke.message||"Sign-up failed. Please try again.";De.includes("already registered")?b("This email is already registered. Try signing in instead."):b(De)}finally{J.current=_r(J.current,"fail"),h(!1)}},[d,m,l,r,c,ce,i,xe,t,O,$,z,V]),Be=f.useCallback(async ee=>{h(!0),b(null);try{te("signup_panel_closed",{source:r,completedSignup:!0,method:ee,timeOpenMs:Date.now()-C.current}),ee==="apple"?await hf():await Cc(ee),t()}catch(ge){b(ge.message),h(!1)}},[r,t]),Ge=f.useCallback(()=>{te("work_email_detected",{domain:zi(d),changed:!0}),p(""),T(!1),setTimeout(()=>{var ee;return(ee=N.current)==null?void 0:ee.focus()},50)},[d]);return e?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-40 bg-black/40 backdrop-blur-sm animate-backdrop-in","aria-hidden":"true",onClick:me}),a.jsxs("div",{id:s,role:"dialog","aria-modal":"true","aria-label":"Save your career diary",className:"fixed bottom-0 left-0 right-0 z-50 mx-auto max-w-lg animate-panel-up rounded-t-3xl bg-white dark:bg-slate-900 shadow-2xl ring-1 ring-gray-200 dark:ring-slate-700 sm:bottom-8 sm:rounded-3xl",children:[a.jsx("div",{className:"flex justify-center pt-3 pb-1",children:a.jsx("div",{className:"h-1 w-10 rounded-full bg-gray-300 dark:bg-slate-600"})}),a.jsxs("div",{className:"px-6 pb-8 pt-4 sm:px-8",children:[a.jsxs("div",{className:"flex items-start justify-between mb-4",children:[a.jsx("div",{}),a.jsx("button",{ref:R,type:"button","aria-label":"Close signup panel",onClick:me,className:"rounded-full p-1.5 text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-slate-800 dark:hover:text-slate-200 transition-colors",children:a.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),(n||Ju(c))&&a.jsx("div",{className:"mb-5 rounded-xl bg-blue-50 dark:bg-blue-950/40 border border-blue-200 dark:border-blue-800/50 px-4 py-3",children:a.jsx("p",{className:"text-sm font-medium text-blue-800 dark:text-blue-200",children:n||Ju(c)})}),a.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-white mb-1",children:"Almost there â confirm your info"}),a.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 mb-5",children:"No credit card · 7 days Pro free"}),y&&a.jsx("div",{role:"alert",className:"mb-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-700 px-4 py-3 text-sm text-red-700 dark:text-red-300",children:y}),a.jsxs("form",{onSubmit:ve,noValidate:!0,className:"space-y-3",children:[a.jsx("input",{...k}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"sp-name",className:"block text-sm font-medium text-gray-700 dark:text-slate-300 mb-1",children:"Full name"}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{id:"sp-name",ref:A,type:"text",autoComplete:"name",value:l,onCh
680ange:ee=>u(ee.target.value),placeholder:"Your name",className:`w-full rounded-xl border bg-white dark:bg-slate-800 px-4 py-2.5 text-sm text-gray-900 dark:text-white placeholder-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20 transition ${l?"border-green-300 dark:border-green-700 pr-10":"border-gray-300 dark:border-slate-600"}`,"aria-label":"Full name"}),l&&a.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-green-500","aria-hidden":"true",children:a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})})]})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"sp-email",className:"block text-sm font-medium text-gray-700 dark:text-slate-300 mb-1",children:"Email"}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{id:"sp-email",ref:N,type:"email",autoComplete:"email",required:!0,value:d,onChange:ee=>p(ee.target.value),placeholder:"[email protected]",className:`w-full rounded-xl border bg-white dark:bg-slate-800 px-4 py-2.5 text-sm text-gray-900 dark:text-white placeholder-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20 transition ${d?"border-green-300 dark:border-green-700 pr-10":"border-gray-300 dark:border-slate-600"}`,"aria-label":"Email address"}),d&&a.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-green-500","aria-hidden":"true",children:a.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})})]}),E&&a.jsx("button",{type:"button",onClick:Ge,className:"mt-1 text-xs text-blue-600 dark:text-blue-400 underline underline-offset-2 hover:text-blue-700 dark:hover:text-blue-300 transition-colors",children:"Use a different email?"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"sp-password",className:"block text-sm font-medium text-gray-700 dark:text-slate-300 mb-1",children:"Password"}),a.jsx("input",{id:"sp-password",ref:S,type:"password",autoComplete:"new-password",required:!0,value:m,onChange:ee=>g(ee.target.value),placeholder:"Choose a password",className:"w-full rounded-xl border border-gray-300 dark:border-slate-600 bg-white dark:bg-slate-800 px-4 py-2.5 text-sm text-gray-900 dark:text-white placeholder-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20 transition","aria-label":"Password",minLength:6})]}),$&&a.jsx(Xc,{onUnavailable:ee=>{ie(!0),te("turnstile_unavailable",{reason:ee,surface:"signup_slide_panel",source:r})},ref:Q,siteKey:$,onToken:K,className:"flex justify-center"}),V&&a.jsx("p",{role:"alert",className:"text-sm text-amber-700 dark:text-amber-300 text-center",children:wh}),a.jsx("button",{type:"submit",disabled:_||!d||!m,className:"w-full rounded-xl bg-blue-600 px-4 py-3 text-sm font-semibold text-white shadow hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:_?"Creating accountâ¦":"Create My Account â"})]}),a.jsxs("div",{className:"my-5 flex items-center gap-3",children:[a.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-slate-700"}),a.jsx("span",{className:"text-xs text-gray-400 dark:text-slate-500",children:"or continue with"}),a.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-slate-700"})]}),a.jsxs("button",{type:"button",disabled:_,onClick:()=>{Be("apple")},"aria-label":"Continue with Apple",className:"mb-3 w-full inline-flex items-center justify-center gap-2 rounded-xl px-4 py-2.5 text-sm font-semibold transition-colors bg-black text-white border border-black hover:bg-black/90 dark:bg-white dark:text-black dark:border-white dark:hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-1 focus:ring-blue-500 disabled:opacity-50",children:[a.jsx(Mf,{className:"h-4 w-4 flex-shrink-0"}),a.jsx("span",{children:"Continue with Apple"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("button",{type:"button",disabled:_,onClick:()=>{Be("google")},className:"flex items-center justify-center gap-2 rounded-xl border border-gray-300 dark:border-slate-600 bg-white dark:bg-slate-800 px-4 py-2.5 text-sm font-medium text-gray-700 dark:text-slate-200 hover:bg-gray-50 dark:hover:bg-slate-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 disabled:opacity-50 transition-colors","aria-label":"Sign up with Google",children:[a.jsx(Df,{className:"h-4 w-4 flex-shrink-0"}),a.jsx("span",{children:"Google"})]}),a.jsxs("button",{type:"button",disabled:_,onClick:()=>{Be("linkedin_oidc")},className:"flex items-center justify-center gap-2 rounded-xl border border-gray-300 dark:border-slate-600 bg-white dark:bg-slate-800 px-4 py-2.5 text-sm font-medium text-gray-700 dark:text-slate-200 hover:bg-gray-50 dark:hover:bg-slate-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 disabled:opacity-50 transition-colors","aria-label":"Sign up with LinkedIn",children:[a.jsx(ms,{className:"h-4 w-4 flex-shrink-0"}),a.jsx("span",{children:"LinkedIn"})]})]}),a.jsx("p",{className:"mt-5 text-center text-xs text-gray-400 dark:text-slate-500",children:"No credit card · 7 days Pro free · Cancel anytime"})]})]})]}):null},lL=[{value:"bug",label:"Bug",emoji:"ð"},{value:"feature_request",label:"Feature Request",emoji:"ð¡"},{value:"feedback",label:"Feedback",emoji:"ð¬"}],uL=[{value:"angry",emoji:"ð¡",label:"Frustrated"},{value:"neutral",emoji:"ð",label:"Neutral"},{value:"happy",emoji:"ð",label:"Happy"},{value:"love",emoji:"ð¤©",label:"Amazed"}],Od={name:"",email:"",type:"feedback",message:"",mood:null},dL=()=>{var y,b;const{session:e}=Qe(),{state:t,toast:n}=ln(),[r,s]=f.useState(!1),[o,i]=f.useState(!1),[c,l]=f.useState(Od),[u,d]=f.useState(!1),p=f.useRef(null),m=f.useRef(null);f.useEffect(()=>{r&&!u&&(l(x=>{var w,E;return{...x,name:((w=t.profile)==null?void 0:w.fullName)||x.name,email:((E=e==null?void 0:e.user)==null?void 0:E.email)||x.email}}),d(!0)),r||d(!1)},[r,u,(y=t.profile)==null?void 0:y.fullName,(b=e==null?void 0:e.user)==null?void 0:b.email]),f.useEffect(()=>{if(!r)return;const x=w=>{w.key==="Escape"&&s(!1)};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[r]);const g=f.useCallback(x=>{p.current&&!p.current.contains(x.target)&&m.current&&!m.current.contains(x.target)&&s(!1)},[]),_=async x=>{var w;if(x.preventDefault(),!c.email.trim()){n.error("Email is required");return}if(!c.message.trim()){n.error("Message is required");return}i(!0);try{const E={userName:c.name.trim()||void 0,userEmail:c.email.trim(),feedbackType:c.type,message:c.message.trim(),mood:c.mood||void 0,pageUrl:window.location.pathname,userAgent:navigator.userAgent,userId:((w=e==null?void 0:e.user)==null?void 0:w.id)||void 0},T=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)});if(!T.ok){const C=await T.json().catch(()=>null);throw new Error((C==null?void 0:C.error)||`Request failed (${T.status})`)}n.success("Thanks for your feedback!"),l(Od),s(!1)}catch(E){const T=E instanceof Error?E.message:"Something went wrong";n.error("Failed to send feedback",T)}finally{i(!1)}},h=(x,w)=>{l(E=>({...E,[x]:w}
680))};return a.jsxs(a.Fragment,{children:[r&&a.jsx("div",{className:"fixed inset-0 z-[9990] bg-black/20 dark:bg-black/40 transition-opacity",onClick:g,"aria-hidden":"true"}),a.jsx("button",{ref:m,onClick:()=>s(x=>!x),className:` 681 fixed bottom-6 right-6 z-[9995] 682 w-12 h-12 sm:w-14 sm:h-14 683 rounded-full shadow-lg 684 bg-blue-600 hover:bg-blue-700 active:bg-blue-800 685 text-white 686 flex items-center justify-center 687 transition-all duration-200 688 hover:shadow-xl hover:scale-105 689 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900 690 ${r?"rotate-45 scale-95":""} 691 `,"aria-label":r?"Close feedback form":"Send feedback","aria-expanded":r,children:r?a.jsx("svg",{className:"w-5 h-5 sm:w-6 sm:h-6",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}):a.jsx("svg",{className:"w-5 h-5 sm:w-6 sm:h-6",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.087.16 2.185.283 3.293.369V21l4.076-4.076a1.526 1.526 0 0 1 1.037-.443 48.282 48.282 0 0 0 5.68-.494c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.
691123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z"})})}),r&&a.jsxs("div",{ref:p,className:` 692 fixed z-[9995] 693 bottom-20 right-4 sm:bottom-24 sm:right-6 694 w-[calc(100vw-2rem)] sm:w-[400px] 695 max-h-[calc(100vh-8rem)] 696 overflow-y-auto 697 bg-white dark:bg-gray-800 698 rounded-2xl 699 shadow-2xl 700 border border-gray-200 dark:border-gray-700 701 animate-slide-up 702 `,role:"dialog","aria-modal":"true","aria-label":"Feedback form",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-3",children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Send Feedback"}),a.jsx("button",{onClick:()=>s(!1),className:"p-1 rounded-lg text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors","aria-label":"Close",children:a.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("form",{onSubmit:_,className:"px-5 pb-5 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"feedback-name",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Name"}),a.jsx("input",{id:"feedback-name",type:"text",value:c.name,onChange:x=>h("name",x.target.value),placeholder:"Your name",className:` 703 w-full px-3 py-2 text-sm 704 rounded-lg border border-gray-300 dark:border-gray-600 705 bg-white dark:bg-gray-700 706 text-gray-900 dark:text-white 707 placeholder-gray-400 dark:placeholder-gray-500 708 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent 709 transition-colors 710 `})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"feedback-email",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Email ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{id:"feedback-email",type:"email",required:!0,value:c.email,onChange:x=>h("email",x.target.value),placeholder:"[email protected]",className:` 711 w-full px-3 py-2 text-sm 712 rounded-lg border border-gray-300 dark:border-gray-600 713 bg-white dark:bg-gray-700 714 text-gray-900 dark:text-white 715 placeholder-gray-400 dark:placeholder-gray-500 716 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent 717 transition-colors 718 `})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Type"}),a.jsx("div",{className:"flex gap-2",children:lL.map(({value:x,label:w,emoji:E})=>a.jsxs("button",{type:"button",onClick:()=>h("type",x),className:` 719 flex-1 px-2 py-2 text-xs sm:text-sm font-medium rounded-lg 720 border transition-all duration-150 721 ${c.type===x?"bg-blue-50 dark:bg-blue-900/30 border-blue-300 dark:border-blue-600 text-blue-700 dark:text-blue-300 ring-1 ring-blue-200 dark:ring-blue-700":"border-gray-200 dark:border-gray-600 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700"} 722 `,children:[a.jsx("span",{className:"mr-1",children:E}),a.jsx("span",{className:"hidden sm:inline",children:w}),a.jsx("span",{className:"sm:hidden",children:w.split(" ")[0]})]},x))})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"feedback-message",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["Message ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("textarea",{id:"feedback-message",required:!0,rows:4,value:c.message,onChange:x=>h("message",x.target.value),placeholder:"Tell us what's on your mind...",className:` 723 w-full px-3 py-2 text-sm 724 rounded-lg border border-gray-300 dark:border-gray-600 725 bg-white dark:bg-gray-700 726 text-gray-900 dark:text-white 727 placeholder-gray-400 dark:placeholder-gray-500 728 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent 729 transition-colors resize-none 730 `})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:["How are you feeling? ",a.jsx("span",{className:"text-gray-400 dark:text-gray-500 font-normal",children:"(optional)"})]}),a.jsx("div",{className:"flex gap-2",children:uL.map(({value:x,emoji:w,label:E})=>a.jsx("button",{type:"button",onClick:()=>h("mood",c.mood===x?null:x),title:E,className:` 731 w-10 h-10 text-lg rounded-lg 732 flex items-center justify-center 733 border transition-all duration-150 734 ${c.mood===x?"bg-blue-50 dark:bg-blue-900/30 border-blue-300 dark:border-blue-600 scale-110 ring-1 ring-blue-200 dark:ring-blue-700":"border-gray-200 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700 hover:scale-105"} 735 `,"aria-label":E,"aria-pressed":c.mood===x,children:w},x))})]}),a.jsx("button",{type:"submit",disabled:o,className:` 736 w-full py-2.5 px-4 737 text-sm font-semibold text-white 738 bg-blue-600 hover:bg-blue-700 active:bg-blue-800 739 rounded-xl 740 transition-all duration-150 741 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800 742 flex items-center justify-center gap-2 743 ${o?"opacity-70 cursor-not-allowed":""} 744 `,children:o?a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Sending..."]}):"Send Feedback"})]})]}),a.jsx("style",{children:` 745 @keyframes slide-up { 746 from { 747 opacity: 0; 748 transform: translateY(16px) scale(0.96); 749 } 750 to { 751 opacity: 1; 752 transform: translateY(0) scale(1); 753 } 754 } 755 .animate-slide-up { 756 animation: slide-up 0.2s ease-out; 757 } 758 `})]})},pL=M.lazy(()=>D(()=>import("./ReviewMemoriesModal-DQhYfIxs.js"),__vite__mapDeps([138,1,2,3,4,5])).then(e=>({default:e.ReviewMemoriesModal}))),mL=M.lazy(()=>D(()=>import("./PendingMemoriesNotification-DR4J-vTK.js"),__vite__mapDeps([139,1,2,3,4,5])).then(e=>({default:e.PendingMemoriesNotification}))),fL=()=>a.jsx("div",{className:"min-h-screen min-h-dvh bg-gray-50 dark:bg-slate-900 flex items-center justify-center",children:a.jsx(Mc,{})}),hL=()=>{var R,N,O;const{state:e,actions:t,dispatch:n,toast:r}=ln(),{session:s,isGuest:o,isAuthLoading:i,showDbSetupModal:c}=e,{slidePanelOpen:l,closeSlidePanel:u,slidePanelOptions:d,openSlidePanel:p}=on(),{handleSignOut:m,handleLoadUserData:g}=t,{usage:_}=ta(),h=We(),y=qe(),[b,x]=M.useState(!1),[w,E]=M.useState(!1);tL(),f.useEffect(()=>{if(s!=null&&s.user){$l({id:s.user.id,email:s.user.email||void 0}),Fl("billing_tier",_.tier),ei("billing",{tier:_.tier});return}$l(null),Fl("billing_tier","anon"),ei("billing",{tier:"anon"})},[(R=s==null?void 0:s.user)==null?void 0:R.email,(N=s==null?void 0:s.user)==null?void 0:N.id,_.tier]),f.useEffect(()=>{sessionStorage.removeItem("cd_chunk_reload_attempted")},[]),f.useEffect(()=>oT(),[]),f.useEffect(()=>{(async()=>{const $=window.location.hash,z=Pd($)??Pd(window.location.search);if(z&&!window.location.pathname.startsWith("/auth")){window.history.replaceState(null,"",window.location.pathname),y("/auth",{replace:!0,state:{authRedirectError:z,mode:"signup"}});return}if($&&($.includes("access_token")||$.includes("refresh_token")))try{const K=new URLSearchParams($.substring(1)),V=K.get("access_token"),ie=K.get("refresh_token");if(V&&ie&&Z){const{error:Q}=await Z.auth.setSession({access_token:V,refresh_token:ie});if(Q){console.error("Error setting session from OAuth callback:",Q);return}window.history.replaceState(null,"",window.location.pathname+window.location.search),y("/app/home",{replace:!0})}}catch(K){console.error("Error handling OAuth callback:",K)}})()},[y]),f.useEffect(()=>{E(!1)},[h.pathname,s,o,i]),f.useEffect(()=>{const $=!!!(s||o)&&h.pathname!=="/guide"?"landing":h.pathname.replace(/^\//,"").replace(/\//g,"-")||"home";eT($)},[h.pathname,s,o]),f.useEffect(()=>{if(!(s!=null&&s.user))return;const k=new URLSearchParams(window.location.search).get("utm_campaign");k==="watch-digest"&&sessionStorage.getItem("cd_digest_click_recorded")!=="1"&&(sessionStorage.setItem("cd_digest_click_recorded","1"),te("digest_clicked",{c
758ampaign:k}),eL(k))},[(O=s==null?void 0:s.user)==null?void 0:O.id,h.pathname]);const T=()=>{E(!1),localStorage.setItem("welcomeTourCompleted","true")},C=()=>{n({type:"HIDE_DB_SETUP_MODAL"}),s!=null&&s.user&&g(s.user.id)},S=()=>{p({contextMessage:"Create a free account to unlock this â everything youâve done as a guest carries over.",triggerId:"nav_account_gate"})};if(i)return a.jsx(fL,{});const A=h.pathname.startsWith("/app/")&&(s||o);return a.jsxs("div",{className:"rt-app min-h-screen min-h-dvh font-sans text-gray-800 dark:text-slate-200",children:[a.jsx(Zj,{toasts:r.toasts,onClose:r.removeToast}),a.jsx(cL,{isOpen:l,onClose:u,contextMessage:d.contextMessage,triggerId:d.triggerId}),c&&a.jsx(Yj,{onClose:C}),w&&a.jsx(qj,{onClose:T}),a.jsxs(f.Suspense,{fallback:null,children:[a.jsx(ed,{fallback:null,children:a.jsx(mL,{onReview:()=>x(!0)})}),a.jsx(ed,{fallback:null,children:a.jsx(pL,{isOpen:b,onClose:()=>x(!1)})})]}),A&&a.jsx(a.Fragment,{children:a.jsx(Jj,{session:s,isGuest:o,onSignOut:m,onInitiateAuth:S})}),a.jsx("main",{className:A?"main-content w-full max-w-[95vw] xl:max-w-[92vw] 2xl:max-w-[90vw] mx-auto px-3 sm:px-4 lg:px-6 xl:px-8 pt-[65px] max-[640px]:pt-[92px] pb-20 md:pb-6":"",children:a.jsx(Gj,{})}),A&&a.jsx(dL,{}),A&&a.jsx(Vj,{currentView:h.pathname.replace("/app/",""),onViewChange:k=>{const z={tailor:"/app/tailor",diary:"/app/diary",search:"/app/search","interview-prep":"/app/interview-prep",linkedin:"/app/linkedin","portfolio-settings":"/app/portfolio-settings","portfolio/edit":"/app/portfolio/edit"}[k]||"/app/tailor";y(z)}})]})},gL=()=>a.jsx(A1,{children:a.jsx(Zw,{fallback:a.jsx("div",{className:"min-h-screen min-h-dvh bg-gray-50 dark:bg-slate-900 flex items-center justify-center px-6 text-center text-gray-700 dark:text-slate-200",children:"Something went wrong. Please refresh and try again."}),children:a.jsx(F,{children:a.jsx(Bi,{children:a.jsx(eA,{children:a.jsx(hL,{})})})})})}),Ha={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_SUPABASE_KEY:"",VITE_SUPABASE_URL:""};Cv();const yL=new $h({defaultOptions:{queries:{staleTime:900*1e3,gcTime:1800*1e3,retry:1,refetchOnWindowFocus:!1}}}),zr=(e,t="")=>{const n=typeof window<"u"?window.__RUNTIME_CONFIG__:void 0,r=n==null?void 0:n[e];if(typeof r=="string"&&r.length>0)return r;const s=Ha==null?void 0:Ha[e];return typeof s=="string"&&s.length>0?s:t},Io=zr("VITE_SENTRY_DSN"),_L=zr("VITE_SENTRY_ENVIRONMENT","production"),xL=zr("VITE_SENTRY_RELEASE",zr("VITE_APP_VERSION","careerdiary-web@unknown")),bL=zr("VITE_SENTRY_TRACES_SAMPLE_RATE","0.1"),Dd=Number.parseFloat(bL);Io&&Vw({dsn:Io,environment:_L,release:xL,integrations:[zw()],tracesSampleRate:Number.isFinite(Dd)?Dd:.1});window.addEventListener("error",e=>{var t,n,r,s,o,i;if((t=e.filename)!=null&&t.includes("content_script")||(n=e.filename)!=null&&n.includes("extension://")||(r=e.filename)!=null&&r.includes("chrome-extension://")||(s=e.filename)!=null&&s.includes("moz-extension://")||(o=e.message)!=null&&o.includes("reading 'control'")||(i=e.message)!=null&&i.includes("shouldOfferCompletionListForField")){e.preventDefault();return}Go("uncaught_error",new Error(e.message),{filename:e.filename,lineno:e.lineno,colno:e.colno}),Io&&Po(new Error(e.message))});window.addEventListener("unhandledrejection",e=>{var n;const t=((n=e.reason)==null?void 0:n.message)||String(e.reason||"");if(t.includes("reading 'control'")||t.includes("shouldOfferCompletionListForField")||t.includes("content_script")){e.preventDefault();return}Go("unhandled_rejection",e.reason,{promise:e.promise}),Io&&Po(e.reason instanceof Error?e.reason:new Error(t||"Unhandled promise rejection"))});const Md=document.getElementById("root");if(Md){const e=Hh.createRoot(Md),t=a.jsx(Bh,{client:yL,children:a.jsx(VC,{children:a.jsx(QA,{children:a.jsx(WI,{children:a.jsx(WR,{children:a.jsx(gL,{})})})})})});e.render(t)}export{UP as $,WL as A,ue as B,rP as C,qe as D,_P as E,ta as F,mk as G,Uc as H,Fi as I,bn as J,nr as K,Mc as L,Ci as M,eR as N,JL as O,qL as P,LP as Q,OP as R,St as S,KL as T,GL as U,DP as V,Xo as W,lA as X,YL as Y,MP as Z,D as _,Kc as a,uA as a$,$P as a0,ms as a1,ZP as a2,$L as a3,VL as a4,eP as a5,e5 as a6,lk as a7,nA as a8,zL as a9,te as aA,rA as aB,pP as aC,Ra as aD,Ao as aE,Ku as aF,bP as aG,nP as aH,SE as aI,wE as aJ,bE as aK,GR as aL,wr as aM,Mu as aN,Z2 as aO,dA as aP,QL as aQ,HI as aR,AP as aS,IP as aT,qP as aU,$n as aV,cA as aW,ZL as aX,WP as aY,YP as aZ,JP as a_,KP as aa,RL as ab,XP as ac,oA as ad,_h as ae,Ko as af,Eo as ag,to as ah,Ee as ai,ir as aj,mt as ak,Ue as al,cI as am,tn as an,Wc as ao,AI as ap,GP as aq,HP as ar,bk as as,vE as at,TE as au,EE as av,tP as aw,Fr as ax,aP as ay,on as az,kL as b,uI as b$,VP as b0,iP as b1,CP as b2,RP as b3,t5 as b4,jL as b5,PP as b6,qu as b7,wn as b8,BP as b9,ak as bA,AC as bB,DL as bC,Vo as bD,yP as bE,o5 as bF,Gc as bG,TR as bH,zP as bI,cS as bJ,oS as bK,pe as bL,NL as bM,lP as bN,cP as bO,q2 as bP,jP as bQ,RR as bR,fP as bS,Cf as bT,WC as bU,OC as bV,UL as bW,uP as bX,dP as bY,iA as bZ,xh as b_,iR as ba,hk as bb,r5 as bc,s5 as bd,Qj as be,Ri as bf,Ii as bg,Ui as bh,NP as bi,kP as bj,TP as bk,EP as bl,vP as bm,mP as bn,sP as bo,hP as bp,nh as bq,Ht as br,ZI as bs,h2 as bt,Ct as bu,BL as bv,SP as bw,OL as bx,bf as by,vh as bz,Xc as c,Pd as c0,c5 as c1,i5 as c2,l5 as c3,wh as c4,Df as c5,Mf as c6,LL as c7,u5 as c8,d5 as c9,rL as ca,_r as cb,hC as cc,wi as cd,bo as ce,ff as cf,hf as cg,Cc as ch,QP as ci,pn as cj,CE as ck,IE as cl,RE as cm,AE as cn,n5 as co,zt as cp,PL as cq,FL as cr,ML as cs,xP as ct,oP as cu,Si as cv,U1 as cw,wP as cx,a5 as cy,df as d,ZR as e,we as f,bh as g,Br as h,sA as i,HL as j,XL as k,aA as l,Qe as m,TC as n,We as o,ok as p,gP as q,eo as r,Z as s,FP as t,ln as u,$c as v,Uf as w,Ti as x,Ur as y,Of as z};
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.