(function(){(function(){var i=window.CoverLetterGen;if(!i||!i.fieldFiller||!i.storage)return;function d(t){if(!t)return!1;if(t.offsetParent!==null)return!0;var e=window.getComputedStyle(t);if(e.display==="none"||e.visibility==="hidden")return!1;if(e.position==="fixed"||e.position==="sticky")return!0;var n=t.getBoundingClientRect();return n.width>0||n.height>0}function l(){try{var t=new URL(window.location.href);return t.hostname==="emp.jobylon.com"}catch{return!1}}function s(){var t="",e="",n=document.querySelector("h1");n&&(n.innerText||n.textContent)&&(t=(n.innerText||n.textContent||"").trim());var r=document.querySelector("[class*='job-title'], [class*='JobTitle'], [class*='position'], [class*='title']");r&&!t&&(r.innerText||r.textContent)&&(t=(r.innerText||r.textContent||"").trim());var o=document.querySelector("[class*='company'], [class*='Company'], [class*='employer']");return o&&(o.innerText||o.textContent)&&(e=(o.innerText||o.textContent||"").trim()),t||(t="Unknown role"),e||(e="Unknown company"),{company:e,role:t,jobUrl:typeof window<"u"&&window.location?window.location.href:""}}function p(){for(var t=document.querySelectorAll("article, section, [role='main'], main, [class*='content'], [class*='description'], [class*='job-description']"),e="",n=0;n<t.length;n++){var r=t[n],o=(r.innerText||r.textContent||"").trim();o.length>e.length&&o.length>200&&(e=o)}return e}function y(){for(var t=i.formFiller&&i.formFiller.getFieldLabel?i.formFiller.getFieldLabel:function(u){for(var a=u.parentElement,m=0;m<5&&a;m++){if(a.tagName==="LABEL")return(a.textContent||"").trim();var f=a.querySelector("label");if(f)return(f.textContent||"").trim();a=a.parentElement}return(u.getAttribute("placeholder")||"").trim()},e=document.querySelectorAll("textarea"),n=0;n<e.length;n++){var r=e[n];if(d(r)){var o=t(r),v=(r.getAttribute("placeholder")||"").trim(),b=(o+" "+v).toLowerCase();if(/cover\s*letter|letter\s*\/\s*message|note\s+to|message\s+to|paste\s*(your|a)\s*cover|why\s+(you|this)/i.test(b))return r}}return null}function c(){if(l()){var t=document.querySelector('button[type="submit"], [type="submit"], input[type="submit"], button:not([id]), [role="button"]');t&&!t.dataset.clgSubmitWatched&&(t.dataset.clgSubmitWatched="1",t.addEventListener("click",function(){var e=s();chrome.runtime.sendMessage({action:"addJobToTracker",payload:{company:e.company,role:e.role,status:"applied",jobUrl:e.jobUrl||(window.location?window.location.href:""),source:"Jobylon"}},function(){chrome.runtime.lastError})},!0))}}i.adapters=i.adapters||{},i.adapters.jobylon={name:"jobylon",isActive:l,getCoverLetterTarget:y,getJobDescriptionFromPage:p,getJobInfo:s,runSetup:c},c()})();
//# sourceMappingURL=jobylon.js-Y_H4L8YE.js.map
})()
