const t=["utm_source","utm_medium","utm_campaign","utm_id","utm_term","utm_content"],e="sc_lead_utm";function n(){const n=Object.fromEntries(t.map(t=>[t,null]));if("undefined"==typeof window)return n;let u=!1;try{const e=new URLSearchParams(window.location.search);for(const r of t){const t=e.get(r);t&&(n[r]=t,u=!0)}}catch{}const r=function(){try{return"undefined"!=typeof window?window.sessionStorage:null}catch{return null}}();if(u&&r){try{r.setItem(e,JSON.stringify(n))}catch{}return n}if(r)try{const u=r.getItem(e);if(u){const e=JSON.parse(u);for(const u of t)e[u]&&(n[u]=e[u])}}catch{}return n}function u(){const t=n();let e=null,u=null,r=null;if("undefined"!=typeof window){try{e=window.location.href||null,u=window.location.pathname||null}catch{}try{r=document.referrer||null}catch{}}return{page_url:e,pathname:u,referrer:r,utm_source:t.utm_source,utm_medium:t.utm_medium,utm_campaign:t.utm_campaign,utm_id:t.utm_id,utm_term:t.utm_term,utm_content:t.utm_content}}function r(t){const e={},n=(n,u)=>{const r=t[n];r&&(e[n]={title:u,value:r})};return n("page_url","Page URL"),n("pathname","Pathname"),n("referrer","Referrer"),n("utm_source","UTM Source"),n("utm_medium","UTM Medium"),n("utm_campaign","UTM Campaign"),n("utm_id","UTM ID"),n("utm_term","UTM Term"),n("utm_content","UTM Content"),e}export{r as b,u as c};