(()=>{var R=Object.defineProperty,b=Object.defineProperties;var T=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var C=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var A=(o,e,i)=>e in o?R(o,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[e]=i,c=(o,e)=>{for(var i in e||(e={}))C.call(e,i)&&A(o,i,e[i]);if(h)for(var i of h(e))U.call(e,i)&&A(o,i,e[i]);return o},d=(o,e)=>b(o,T(e));(function(){let o=document.currentScript,e="dub_id",i="dub_partner_data",S=90*24*60*60*1e3,p=window.location.hostname,f=o.getAttribute("data-api-host")||"https://api.dub.co",m=(()=>{let r={domain:p==="localhost"?void 0:`.${p.replace(/^www\./,"")}`,path:"/",sameSite:"Lax",expires:new Date(Date.now()+S).toUTCString()},n=o.getAttribute("data-cookie-options");if(!n)return r;let t=JSON.parse(n);return t.expiresInDays&&(t.expires=new Date(Date.now()+t.expiresInDays*24*60*60*1e3).toUTCString(),delete t.expiresInDays),c(c({},r),t)})(),O=(()=>{let r=o.getAttribute("data-short-domain"),n=o.getAttribute("data-domains");if(n)try{let t=JSON.parse(n);return d(c({},t),{refer:t.refer||r})}catch(t){}return{refer:r}})(),l=O.refer,k=o.getAttribute("data-attribution-model")||"last-click",I=o.getAttribute("data-query-param")||"via",u=new URLSearchParams(location.search).get(I),a={get(r){var n;return(n=document.cookie.split(";").map(t=>t.trim().split("=")).find(([t])=>t===r))==null?void 0:n[1]},set(r,n){let t=Object.entries(m).filter(([,s])=>s).map(([s,w])=>`${s}=${w}`).join("; ");document.cookie=`${r}=${n}; ${t}`}},g=!1;function D(r,n){g||(g=!0,fetch(`${f}/track/click`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:l,key:r,url:window.location.href,referrer:document.referrer})}).then(t=>t.ok&&t.json()).then(t=>{if(t){if(n&&n!==t.clickId){console.warn(`Client-tracked click ID ${t.clickId} does not match server-tracked click ID ${n}, skipping...`);return}if(a.set(e,t.clickId),t.partner){let s=d(c({},t),{partner:d(c({},t.partner),{name:encodeURIComponent(t.partner.name),image:encodeURIComponent(t.partner.image)})});a.set(i,JSON.stringify(s))}}}))}function _(){let r=new URLSearchParams(location.search),n=()=>!a.get(e)||k!=="first-click",t=r.get(e);t&&n()&&a.set(e,t),u&&l&&n()&&D(u,t)}window._dubAnalytics={c:a,i:e,h:p,a:f,o:m,d:l,m:k,p:I,v:u,n:O},_()})();})();