(function(){
    var T='/incl/assets.php',C='_vid',D=730;
    
    function uuid(){return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0;return(c==='x'?r:(r&0x3|0x8)).toString(16)})}
    
    function sC(n,v,d){var e=new Date(Date.now()+d*864e5).toUTCString();document.cookie=n+'='+encodeURIComponent(v)+';expires='+e+';path=/;SameSite=Lax'+(location.protocol==='https:'?';Secure':'')}
    function gC(n){var m=document.cookie.match(new RegExp('(^| )'+n+'=([^;]+)'));return m?decodeURIComponent(m[2]):null}
    function sL(n,v){try{localStorage.setItem(n,v)}catch(e){}}
    function gL(n){try{return localStorage.getItem(n)}catch(e){return null}}
    
    function gV(){
        var v=gC(C)||gL(C);
        if(!v)v=uuid();
        sC(C,v,D);sL(C,v);
        return v;
    }
    
    function gF(){
        var c=[];
        c.push(screen.width+'x'+screen.height);
        c.push(screen.colorDepth);
        c.push(window.devicePixelRatio||1);
        c.push(Intl.DateTimeFormat().resolvedOptions().timeZone||new Date().getTimezoneOffset());
        c.push(navigator.language);
        c.push(navigator.platform);
        c.push(navigator.hardwareConcurrency||0);
        c.push(navigator.deviceMemory||0);
        c.push(navigator.userAgent);
        c.push('ontouchstart'in window?1:0);
        c.push(navigator.maxTouchPoints||0);
        
        try{
            var cv=document.createElement('canvas');
            var gl=cv.getContext('webgl')||cv.getContext('experimental-webgl');
            if(gl){var d=gl.getExtension('WEBGL_debug_renderer_info');if(d){c.push(gl.getParameter(d.UNMASKED_VENDOR_WEBGL));c.push(gl.getParameter(d.UNMASKED_RENDERER_WEBGL))}}
        }catch(e){}
        
        try{
            var cv=document.createElement('canvas');cv.width=200;cv.height=50;
            var ctx=cv.getContext('2d');
            ctx.textBaseline='top';ctx.font='14px Arial';
            ctx.fillStyle='#f60';ctx.fillRect(0,0,100,50);
            ctx.fillStyle='#069';ctx.fillText('Cwm fjord veg balks',2,15);
            ctx.fillStyle='rgba(102,204,0,0.7)';ctx.fillText('Cwm fjord veg balks',4,17);
            c.push(cv.toDataURL().slice(-50));
        }catch(e){}
        
        try{var a=new(window.AudioContext||window.webkitAudioContext)();c.push(a.sampleRate);a.close()}catch(e){}
        
        var s=c.join('|||'),h1=0xdeadbeef,h2=0x41c6ce57;
        for(var i=0;i<s.length;i++){var ch=s.charCodeAt(i);h1=Math.imul(h1^ch,2654435761);h2=Math.imul(h2^ch,1597334677)}
        h1=Math.imul(h1^(h1>>>16),2246822507)^Math.imul(h2^(h2>>>13),3266489909);
        h2=Math.imul(h2^(h2>>>16),2246822507)^Math.imul(h1^(h1>>>13),3266489909);
        return(4294967296*(2097151&h2)+(h1>>>0)).toString(36);
    }
    
    function isApple(){
        return /iPhone|iPad|iPod|Macintosh/.test(navigator.userAgent) && navigator.maxTouchPoints>0;
    }
    
    function track(){
        var p=new URLSearchParams(location.search);
        var data={
            vid:gV(),
            fp:gF(),
            fps:'js',
            apple:isApple()?1:0,
            d:location.hostname,
            u:location.href,
            r:document.referrer||'',
            adv:p.get('adv')||'',
            key:p.get('key')||'',
            gclid:p.get('gclid')||'',
            gad_campaignid:p.get('gad_campaignid')||'',
            gad_source:p.get('gad_source')||'',
            gbraid:p.get('gbraid')||'',
            utm_source:p.get('utm_source')||'',
            utm_medium:p.get('utm_medium')||'',
            utm_campaign:p.get('utm_campaign')||'',
            utm_term:p.get('utm_term')||'',
            utm_content:p.get('utm_content')||'',
            sw:screen.width,
            sh:screen.height,
            tz:Intl.DateTimeFormat().resolvedOptions().timeZone||'',
            lang:navigator.language||'',
            t:Date.now()
        };
        
        if(navigator.sendBeacon){
            navigator.sendBeacon(T,JSON.stringify(data));
        }else{
            var img=new Image();
            img.src=T+'?d='+encodeURIComponent(JSON.stringify(data));
        }
    }
    
    if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',track)}else{track()}
    
    window.Tracker={getVid:gV,getFP:gF,track:track};
})();