"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9243],{19243:(r,t,e)=>{e.d(t,{TQ:()=>o,UJ:()=>u,dL:()=>a,parseAuthenticationResults:()=>l,parseSpamLLM:()=>d,parseSpamScore:()=>n});var s=e(48543);let i={fail:6,softfail:5,permerror:4,temperror:3,neutral:2,none:1,pass:0};function a(r){return!!r&&(r.dmarc?.result==="fail"||r.spf?.result==="fail"&&r.dkim?.result!=="pass")}function l(r){let t,e={},s=/spf=(\w+)(?:\s+\([^)]*\))?(?:\s+smtp\.(mailfrom|helo)=([^\s;]+))?/g,a=[];for(;null!==(t=s.exec(r));)a.push({result:t[1],identity:t[2],domain:t[3]});if(a.length>0){let r=r=>i[r]??-1,t=a.reduce((t,e)=>r(e.result)>r(t.result)||r(e.result)===r(t.result)&&"mailfrom"!==t.identity&&"mailfrom"===e.identity?e:t);e.spf={result:t.result,domain:t.domain,...a.length>1?{all:a}:{}}}let l=r.match(/dkim=(\w+)(?:\s+header\.d=([^\s]+))?(?:\s+header\.s=([^\s]+))?/);l&&(e.dkim={result:l[1],domain:l[2],selector:l[3]});let n=r.match(/dmarc=(\w+)(?:\s+header\.from=([^\s]+))?(?:\s+policy\.dmarc=(\w+))?/);n&&(e.dmarc={result:n[1],domain:n[2],policy:n[3]});let o=r.match(/iprev=(\w+)(?:\s+policy\.iprev=([\d.]+))?/);return o&&(e.iprev={result:o[1],ip:o[2]}),e}function n(r){let t=r.match(/^(Yes|No|spam|ham),?\s+score=([-\d.]+)/i);if(t)return{status:t[1].toLowerCase(),score:parseFloat(t[2])};let e=r.match(/score[=:]?\s*([-\d.]+)/i);if(e){let r=parseFloat(e[1]);return{score:r,status:r>5?"spam":"ham"}}return null}function o(r){switch(r){case"pass":return{color:"text-green-700 dark:text-green-400",icon:"check",bgColor:"bg-gray-50 dark:bg-gray-800",borderColor:"border-l-4 border-green-600 dark:border-green-500"};case"fail":case"permerror":return{color:"text-red-700 dark:text-red-400",icon:"x",bgColor:"bg-gray-50 dark:bg-gray-800",borderColor:"border-l-4 border-red-600 dark:border-red-500"};case"softfail":case"neutral":case"temperror":return{color:"text-warning",icon:"alert",bgColor:"bg-gray-50 dark:bg-gray-800",borderColor:"border-l-4 border-warning"};default:return{color:"text-gray-700 dark:text-gray-400",icon:"minus",bgColor:"bg-gray-50 dark:bg-gray-800",borderColor:"border-l-4 border-gray-400 dark:border-gray-600"}}}function d(r){let t=r.trim().match(/^(LEGITIMATE|SPAM|SUSPICIOUS)\s*\((.+)\)\s*$/i);return t?{verdict:t[1].toUpperCase(),explanation:t[2].trim()}:null}function u(r){let t={};if(r["List-Id"]&&(t.listId=Array.isArray(r["List-Id"])?r["List-Id"][0]:r["List-Id"]),r["List-Unsubscribe"]){let e=Array.isArray(r["List-Unsubscribe"])?r["List-Unsubscribe"][0]:r["List-Unsubscribe"],i=(0,s.z4)(e);i.preferred&&(t.listUnsubscribe=i)}return r["List-Help"]&&(t.listHelp=Array.isArray(r["List-Help"])?r["List-Help"][0]:r["List-Help"]),r["List-Post"]&&(t.listPost=Array.isArray(r["List-Post"])?r["List-Post"][0]:r["List-Post"]),t}},48543:(r,t,e)=>{function s(r){if(!r||r.length>254||/[\r\n\0<>]/.test(r)||!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(r))return!1;let[t,e]=r.split("@");return!(t.length>64||e.length>255||e.startsWith(".")||e.endsWith(".")||e.includes(".."))}function i(r){if(!r?.trim())return{valid:!0,invalidEmails:[]};let t=r.split(",").map(r=>r.trim()).filter(Boolean).filter(r=>!s(r));return{valid:0===t.length,invalidEmails:t}}function a(r){return r?.trim()?r.length>254?"Email address is too long (max 254 characters)":/[\r\n\0<>]/.test(r)?"Email address contains invalid characters":s(r)?null:"Please enter a valid email address":"Email address is required"}function l(r){if(!r?.trim())return!1;if(r.startsWith("mailto:"))return s(r.substring(7).split("?")[0]);try{let t=new URL(r);return["http:","https:"].includes(t.protocol)}catch{return!1}}function n(r){if(!r?.trim())return{};let t=r.match(/<([^>]+)>/g);if(!t)return{};let e=t.map(r=>r.slice(1,-1).trim()),s=e.find(r=>(r.startsWith("http://")||r.startsWith("https://"))&&l(r)),i=e.find(r=>r.startsWith("mailto:")&&l(r));return{http:s,mailto:i,preferred:s?"http":i?"mailto":void 0}}function o(r){let t,e;if(!r?.startsWith("mailto:"))return null;let i=r.slice(7),a=i.indexOf("?"),l=-1===a?i:i.slice(0,a),n=-1===a?"":i.slice(a+1),o=r=>{try{return decodeURIComponent(r)}catch{return r}},d=l.split(",").map(r=>o(r).trim()).filter(r=>s(r));for(let r of n.split("&")){let i=r.indexOf("=");if(-1===i)continue;let a=r.slice(0,i).toLowerCase(),l=o(r.slice(i+1));"subject"===a?t=l:"body"===a?e=l:"to"===a&&s(l.trim())&&d.push(l.trim())}return d.length>0?{to:d,subject:t,body:e}:null}e.d(t,{B9:()=>s,Hs:()=>o,Mn:()=>a,Tc:()=>l,ZY:()=>i,z4:()=>n})}}]);