clarity-js 0.7.25 → 0.7.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(){"use strict";var t=Object.freeze({__proto__:null,get queue(){return ht},get start(){return ft},get stop(){return vt},get track(){return ct}}),n=Object.freeze({__proto__:null,get check(){return _t},get compute(){return Et},get data(){return it},get start(){return kt},get stop(){return It},get trigger(){return St}}),e=Object.freeze({__proto__:null,get compute(){return zt},get data(){return Mt},get log(){return jt},get reset(){return qt},get start(){return Ot},get stop(){return Tt},get updates(){return xt}}),r=Object.freeze({__proto__:null,get callbacks(){return At},get clear(){return Vt},get consent(){return Bt},get data(){return Ct},get electron(){return Nt},get id(){return Ut},get metadata(){return Ht},get save(){return Lt},get shortid(){return Jt},get start(){return Dt},get stop(){return Pt}}),o=Object.freeze({__proto__:null,get data(){return $t},get envelope(){return en},get start(){return tn},get stop(){return nn}}),a={projectId:null,delay:1e3,lean:!1,track:!0,content:!0,drop:[],mask:[],unmask:[],regions:[],cookies:[],fraud:!0,checksum:[],report:null,upload:null,fallback:null,upgrade:null,action:null,dob:null};function u(t){return window.Zone&&"__symbol__"in window.Zone?window.Zone.__symbol__(t):t}var c=0;function i(t){void 0===t&&(t=null);var n=t&&t.timeStamp>0?t.timeStamp:performance.now();return Math.max(Math.round(n-c),0)}var s="0.7.25";var l=!0,d=null,p=null;function f(t,n,e){return function(){if(l&&null===d)try{d=new RegExp("\\p{N}","gu"),p=new RegExp("\\p{L}","gu"),new RegExp("\\p{Sc}","gu")}catch(t){l=!1}}(),t?t.replace(p,n).replace(d,e):t}var h=[],v=null;function g(){}var m=[];function y(){}function b(){}var w=Object.freeze({__proto__:null,checkDocumentStyles:function(t){},compute:function(){},data:v,hashText:y,keys:m,log:g,observe:function(){},reset:function(){},start:function(){},state:h,stop:function(){},trigger:b}),k=null;function _(t,n){On()&&t&&"string"==typeof t&&t.length<255&&(k=n&&"string"==typeof n&&n.length<255?{key:t,value:n}:{value:t},wt(24))}var S,E=null,I=null;function M(t){t in E||(E[t]=0),t in I||(I[t]=0),E[t]++,I[t]++}function x(t,n){null!==n&&(t in E||(E[t]=0),t in I||(I[t]=0),E[t]+=n,I[t]+=n)}function O(t,n){null!==n&&!1===isNaN(n)&&(t in E||(E[t]=0),(n>E[t]||0===E[t])&&(I[t]=n,E[t]=n))}function T(t,n,e){return window.setTimeout(an(t),n,e)}function j(t){return window.clearTimeout(t)}var z=0,q=0,C=null;function A(){C&&j(C),C=T(N,q),z=i()}function N(){var t=i();S={gap:t-z},wt(25),S.gap<3e5?C=T(N,q):In&&(_("clarity","suspend"),Bn(),["mousemove","touchstart"].forEach((function(t){return cn(document,t,jn)})),["resize","scroll","pageshow"].forEach((function(t){return cn(window,t,jn)})))}var R=Object.freeze({__proto__:null,get data(){return S},reset:A,start:function(){q=6e4,z=0},stop:function(){j(C),z=0,q=0}}),D=null;function P(t){On()&&a.lean&&(a.lean=!1,D={key:t},Lt(),a.upgrade&&a.upgrade(t),wt(3))}var H=Object.freeze({__proto__:null,get data(){return D},start:function(){!a.lean&&a.upgrade&&a.upgrade("Config"),D=null},stop:function(){D=null},upgrade:P});function U(t,n,e,r){return new(e||(e=Promise))((function(o,a){function u(t){try{i(r.next(t))}catch(t){a(t)}}function c(t){try{i(r.throw(t))}catch(t){a(t)}}function i(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(u,c)}i((r=r.apply(t,n||[])).next())}))}function B(t,n){var e,r,o,a,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(i){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}var V=null;function L(t,n){W(t,"string"==typeof n?[n]:n)}function X(t,n,e,r){return void 0===n&&(n=null),void 0===e&&(e=null),void 0===r&&(r=null),U(this,void 0,void 0,(function(){var o,a;return B(this,(function(u){switch(u.label){case 0:return a={},[4,G(t)];case 1:return a.userId=u.sent(),a.userHint=r||((c=t)&&c.length>=5?"".concat(c.substring(0,2)).concat(f(c.substring(2),"*","*")):f(c,"*","*")),W("userId",[(o=a).userId]),W("userHint",[o.userHint]),W("userType",[Y(t)]),n&&(W("sessionId",[n]),o.sessionId=n),e&&(W("pageId",[e]),o.pageId=e),[2,o]}var c}))}))}function W(t,n){if(On()&&t&&n&&"string"==typeof t&&t.length<255){for(var e=(t in V?V[t]:[]),r=0;r<n.length;r++)"string"==typeof n[r]&&n[r].length<255&&e.push(n[r]);V[t]=e}}function J(){wt(34)}function Z(){V={}}function G(t){return U(this,void 0,void 0,(function(){var n;return B(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),crypto&&t?[4,crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t))]:[3,2];case 1:return n=e.sent(),[2,Array.prototype.map.call(new Uint8Array(n),(function(t){return("00"+t.toString(16)).slice(-2)})).join("")];case 2:return[2,""];case 3:return[3,5];case 4:return e.sent(),[2,""];case 5:return[2]}}))}))}function Y(t){return t&&t.indexOf("@")>0?"email":"string"}var F="CompressionStream"in window;function K(t){return U(this,void 0,void 0,(function(){var n,e;return B(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),F?(n=new ReadableStream({start:function(n){return U(this,void 0,void 0,(function(){return B(this,(function(e){return n.enqueue(t),n.close(),[2]}))}))}}).pipeThrough(new TextEncoderStream).pipeThrough(new window.CompressionStream("gzip")),e=Uint8Array.bind,[4,Q(n)]):[3,2];case 1:return[2,new(e.apply(Uint8Array,[void 0,r.sent()]))];case 2:return[3,4];case 3:return r.sent(),[3,4];case 4:return[2,null]}}))}))}function Q(t){return U(this,void 0,void 0,(function(){var n,e,r,o,a;return B(this,(function(u){switch(u.label){case 0:n=t.getReader(),e=[],r=!1,o=[],u.label=1;case 1:return r?[3,3]:[4,n.read()];case 2:return a=u.sent(),r=a.done,o=a.value,r?[2,e]:(e.push.apply(e,o),[3,1]);case 3:return[2,e]}}))}))}var $=[w,e,Object.freeze({__proto__:null,compute:J,get data(){return V},identify:X,reset:Z,set:L,start:function(){Z()},stop:function(){Z()}}),n,w,r,o,t,R,H,w];function tt(){E={},I={},M(5),$.forEach((function(t){return an(t.start)()}))}function nt(){$.slice().reverse().forEach((function(t){return an(t.stop)()})),E={},I={}}function et(){J(),zt(),wt(0),Et()}var rt,ot,at,ut,ct,it,st=0,lt=0,dt=null,pt=0;function ft(){ut=!0,st=0,lt=0,pt=0,rt=[],ot=[],at={},ct=null}function ht(t,n){if(void 0===n&&(n=!0),ut){var e=i(),r=t.length>1?t[1]:null,o=JSON.stringify(t);switch(r){case 5:st+=o.length;case 37:case 6:case 43:case 45:case 46:lt+=o.length,rt.push(o);break;default:ot.push(o)}M(25);var u=function(){var t=!1===a.lean&&st>0?100:$t.sequence*a.delay;return"string"==typeof a.upload?Math.max(Math.min(t,3e4),100):a.delay}();e-pt>2*u&&(j(dt),dt=null),n&&null===dt&&(25!==r&&A(),dt=T(gt,u),pt=e,_t(lt))}}function vt(){j(dt),gt(!0),st=0,lt=0,pt=0,rt=[],ot=[],at={},ct=null,ut=!1}function gt(t){return void 0===t&&(t=!1),U(this,void 0,void 0,(function(){var n,e,r,o,u,c,i,s;return B(this,(function(l){switch(l.label){case 0:return dt=null,(n=!1===a.lean&&lt>0&&(lt<1048576||$t.sequence>0))&&O(1,1),et(),e=!0===t,r=JSON.stringify(en(e)),o="[".concat(ot.join(),"]"),u=n?"[".concat(rt.join(),"]"):"",c=function(t){return t.p.length>0?'{"e":'.concat(t.e,',"a":').concat(t.a,',"p":').concat(t.p,"}"):'{"e":'.concat(t.e,',"a":').concat(t.a,"}")}({e:r,a:o,p:u}),e?(s=null,[3,3]):[3,1];case 1:return[4,K(c)];case 2:s=l.sent(),l.label=3;case 3:return x(2,(i=s)?i.length:c.length),mt(c,i,$t.sequence,e),ot=[],n&&(rt=[],lt=0,st=0),[2]}}))}))}function mt(t,n,e,r){if(void 0===r&&(r=!1),"string"==typeof a.upload){var o=a.upload,u=!1;if(r&&"sendBeacon"in navigator)try{(u=navigator.sendBeacon.bind(navigator)(o,t))&&bt(e)}catch(t){}if(!1===u){e in at?at[e].attempts++:at[e]={data:t,attempts:1};var c=new XMLHttpRequest;c.open("POST",o,!0),c.timeout=15e3,c.ontimeout=function(){on(new Error("".concat("Timeout"," : ").concat(o)))},null!==e&&(c.onreadystatechange=function(){an(yt)(c,e)}),c.withCredentials=!0,n?(c.setRequestHeader("Accept","application/x-clarity-gzip"),c.send(n)):c.send(t)}}else if(a.upload){(0,a.upload)(t),bt(e)}}function yt(t,n){var e=at[n];t&&4===t.readyState&&e&&((t.status<200||t.status>208)&&e.attempts<=1?t.status>=400&&t.status<500?St(6):(0===t.status&&(a.upload=a.fallback?a.fallback:a.upload),mt(e.data,null,n)):(ct={sequence:n,attempts:e.attempts,status:t.status},e.attempts>1&&wt(2),200===t.status&&t.responseText&&function(t){for(var n=t&&t.length>0?t.split("\n"):[],e=0,r=n;e<r.length;e++){var o=r[e],u=o&&o.length>0?o.split(/ (.*)/):[""];switch(u[0]){case"END":St(6);break;case"UPGRADE":P("Auto");break;case"ACTION":a.action&&u.length>1&&a.action(u[1]);break;case"EXTRACT":u.length>1&&u[1]}}}(t.responseText),0===t.status&&(mt(e.data,null,n,!0),St(3)),t.status>=200&&t.status<=208&&bt(n),delete at[n]))}function bt(t){1===t&&Lt()}function wt(t){var n=[i(),t];switch(t){case 4:var e=h;e&&((n=[e.time,e.event]).push(e.data.visible),n.push(e.data.docWidth),n.push(e.data.docHeight),n.push(e.data.screenWidth),n.push(e.data.screenHeight),n.push(e.data.scrollX),n.push(e.data.scrollY),n.push(e.data.pointerX),n.push(e.data.pointerY),n.push(e.data.activityTime),ht(n,!1));break;case 25:n.push(S.gap),ht(n);break;case 35:n.push(it.check),ht(n,!1);break;case 3:n.push(D.key),ht(n);break;case 2:n.push(ct.sequence),n.push(ct.attempts),n.push(ct.status),ht(n,!1);break;case 24:k.key&&n.push(k.key),n.push(k.value),ht(n);break;case 34:var r=Object.keys(V);if(r.length>0){for(var o=0,a=r;o<a.length;o++){var u=a[o];n.push(u),n.push(V[u])}Z(),ht(n,!1)}break;case 0:var c=Object.keys(I);if(c.length>0){for(var s=0,l=c;s<l.length;s++){var d=l[s],p=parseInt(d,10);n.push(p),n.push(Math.round(I[d]))}I={},ht(n,!1)}break;case 1:var f=Object.keys(xt);if(f.length>0){for(var g=0,y=f;g<y.length;g++){var b=y[g];p=parseInt(b,10);n.push(p),n.push(xt[b])}qt(),ht(n,!1)}break;case 36:var w=Object.keys(v);if(w.length>0){for(var _=0,E=w;_<E.length;_++){var M=E[_];p=parseInt(M,10);n.push(p),n.push([].concat.apply([],v[M]))}ht(n,!1)}break;case 40:m.forEach((function(t){n.push(t);var e=[];for(var r in v[t]){var o=parseInt(r,10);e.push(o),e.push(v[t][r])}n.push(e)})),ht(n,!1)}}function kt(){it={check:0}}function _t(t){if(0===it.check){var n=it.check;n=$t.sequence>=128?1:n,n=$t.pageNum>=128?7:n,n=i()>72e5?2:n,(n=t>10485760?2:n)!==it.check&&St(n)}}function St(t){it.check=t,Vt(),Bn()}function Et(){0!==it.check&&wt(35)}function It(){it=null}var Mt=null,xt=null;function Ot(){Mt={},xt={}}function Tt(){Mt={},xt={}}function jt(t,n){n&&(n="".concat(n),t in Mt||(Mt[t]=[]),Mt[t].indexOf(n)<0&&(Mt[t].push(n),t in xt||(xt[t]=[]),xt[t].push(n),Mt[t].length>128&&St(5)))}function zt(){wt(1)}function qt(){xt={}}var Ct=null,At=[],Nt=0,Rt=null;function Dt(){Rt=null;var t=navigator&&"userAgent"in navigator?navigator.userAgent:"",n=document&&document.title?document.title:"";Nt=t.indexOf("Electron")>0?1:0;var e,r=function(){var t={session:Jt(),ts:Math.round(Date.now()),count:1,upgrade:null,upload:""},n=Yt("_clsk");if(n){var e=n.split("|");e.length>=5&&t.ts-Zt(e[1])<18e5&&(t.session=e[0],t.count=Zt(e[2])+1,t.upgrade=Zt(e[3]),t.upload=e.length>=6?"".concat("https://").concat(e[5],"/").concat(e[4]):"".concat("https://").concat(e[4]))}return t}(),o=Gt(),u=a.projectId||function(t,n){void 0===n&&(n=null);for(var e,r=5381,o=r,a=0;a<t.length;a+=2)r=(r<<5)+r^t.charCodeAt(a),a+1<t.length&&(o=(o<<5)+o^t.charCodeAt(a+1));return e=Math.abs(r+11579*o),(n?e%Math.pow(2,n):e).toString(36)}(location.host);Ct={projectId:u,userId:o.id,sessionId:r.session,pageNum:r.count},a.lean=a.track&&null!==r.upgrade?0===r.upgrade:a.lean,a.upload=a.track&&"string"==typeof a.upload&&r.upload&&r.upload.length>"https://".length?r.upload:a.upload,jt(0,t),jt(3,n),jt(1,function(t,n){if(void 0===n&&(n=!1),n)return"".concat("https://").concat("Electron");var e=a.drop;if(e&&e.length>0&&t&&t.indexOf("?")>0){var r=t.split("?");return r[0]+"?"+r[1].split("&").map((function(t){return e.some((function(n){return 0===t.indexOf("".concat(n,"="))}))?"".concat(t.split("=")[0],"=").concat("*na*"):t})).join("&")}return t}(location.href,!!Nt)),jt(2,document.referrer),jt(15,function(){var t=Jt();if(a.track&&Xt(window,"sessionStorage")){var n=sessionStorage.getItem("_cltk");t=n||t,sessionStorage.setItem("_cltk",t)}return t}()),jt(16,document.documentElement.lang),jt(17,document.dir),jt(26,"".concat(window.devicePixelRatio)),jt(28,o.dob.toString()),jt(29,o.version.toString()),O(0,r.ts),O(1,0),O(35,Nt),navigator&&(jt(9,navigator.language),O(33,navigator.hardwareConcurrency),O(32,navigator.maxTouchPoints),O(34,Math.round(navigator.deviceMemory)),(e=navigator.userAgentData)&&e.getHighEntropyValues?e.getHighEntropyValues(["model","platform","platformVersion","uaFullVersion"]).then((function(t){var n;jt(22,t.platform),jt(23,t.platformVersion),null===(n=t.brands)||void 0===n||n.forEach((function(t){jt(24,t.name+"~"+t.version)})),jt(25,t.model),O(27,t.mobile?1:0)})):jt(22,navigator.platform)),screen&&(O(14,Math.round(screen.width)),O(15,Math.round(screen.height)),O(16,Math.round(screen.colorDepth)));for(var c=0,i=a.cookies;c<i.length;c++){var s=i[c],l=Yt(s);l&&L(s,l)}Wt(o)}function Pt(){Rt=null,Ct=null}function Ht(t,n){void 0===n&&(n=!0);var e=a.lean?0:1;Ct&&(e||!1===n)?t(Ct,!a.lean):At.push({callback:t,wait:n})}function Ut(){return Ct?[Ct.userId,Ct.sessionId,Ct.pageNum].join("."):""}function Bt(t){if(void 0===t&&(t=!0),!t)return Kt("_clsk","",0),Kt("_clck","",0),Bn(),void window.setTimeout(Un,250);On()&&(a.track=!0,Wt(Gt(),1))}function Vt(){Kt("_clsk","",0)}function Lt(){var t=Math.round(Date.now()),n=a.upload&&"string"==typeof a.upload?a.upload.replace("https://",""):"",e=a.lean?0:1;!function(t){At.length>0&&At.forEach((function(n){!n.callback||n.wait&&!t||n.callback(Ct,!a.lean)}))}(e),Kt("_clsk",[Ct.sessionId,t,Ct.pageNum,e,n].join("|"),1)}function Xt(t,n){try{return!!t[n]}catch(t){return!1}}function Wt(t,n){void 0===n&&(n=null),n=null===n?t.consent:n;var e=Math.ceil((Date.now()+31536e6)/864e5),r=0===t.dob?null===a.dob?0:a.dob:t.dob;(null===t.expiry||Math.abs(e-t.expiry)>=1||t.consent!==n||t.dob!==r)&&Kt("_clck",[Ct.userId,2,e.toString(36),n,r].join("|"),365)}function Jt(){var t=Math.floor(Math.random()*Math.pow(2,32));return window&&window.crypto&&window.crypto.getRandomValues&&Uint32Array&&(t=window.crypto.getRandomValues(new Uint32Array(1))[0]),t.toString(36)}function Zt(t,n){return void 0===n&&(n=10),parseInt(t,n)}function Gt(){var t={id:Jt(),version:0,expiry:null,consent:0,dob:0},n=Yt("_clck");if(n&&n.length>0){for(var e=n.split("|"),r=0,o=0,u=document.cookie.split(";");o<u.length;o++){r+="_clck"===u[o].split("=")[0].trim()?1:0}if(1===e.length||r>1){var c="".concat(";").concat("expires=").concat(new Date(0).toUTCString()).concat(";path=/");document.cookie="".concat("_clck","=").concat(c),document.cookie="".concat("_clsk","=").concat(c)}e.length>1&&(t.version=Zt(e[1])),e.length>2&&(t.expiry=Zt(e[2],36)),e.length>3&&1===Zt(e[3])&&(t.consent=1),e.length>4&&Zt(e[1])>1&&(t.dob=Zt(e[4])),a.track=a.track||1===t.consent,t.id=a.track?e[0]:t.id}return t}function Yt(t){var n;if(Xt(document,"cookie")){var e=document.cookie.split(";");if(e)for(var r=0;r<e.length;r++){var o=e[r].split("=");if(o.length>1&&o[0]&&o[0].trim()===t){for(var a=Ft(o[1]),u=a[0],c=a[1];u;)u=(n=Ft(c))[0],c=n[1];return c}}}return null}function Ft(t){try{var n=decodeURIComponent(t);return[n!=t,n]}catch(t){}return[!1,t]}function Kt(t,n,e){if(a.track&&(navigator&&navigator.cookieEnabled||Xt(document,"cookie"))){var r=function(t){return encodeURIComponent(t)}(n),o=new Date;o.setDate(o.getDate()+e);var u=o?"expires="+o.toUTCString():"",c="".concat(t,"=").concat(r).concat(";").concat(u).concat(";path=/");try{if(null===Rt){for(var i=location.hostname?location.hostname.split("."):[],s=i.length-1;s>=0;s--)if(Rt=".".concat(i[s]).concat(Rt||""),s<i.length-1&&(document.cookie="".concat(c).concat(";").concat("domain=").concat(Rt),Yt(t)===n))return;Rt=""}}catch(t){Rt=""}document.cookie=Rt?"".concat(c).concat(";").concat("domain=").concat(Rt):c}}var Qt,$t=null;function tn(){var t=Ct;$t={version:s,sequence:0,start:0,duration:0,projectId:t.projectId,userId:t.userId,sessionId:t.sessionId,pageNum:t.pageNum,upload:0,end:0}}function nn(){$t=null}function en(t){return $t.start=$t.start+$t.duration,$t.duration=i()-$t.start,$t.sequence++,$t.upload=t&&"sendBeacon"in navigator?1:0,$t.end=t?1:0,[$t.version,$t.sequence,$t.start,$t.duration,$t.projectId,$t.userId,$t.sessionId,$t.pageNum,$t.upload,$t.end]}function rn(){Qt=[]}function on(t){if(Qt&&-1===Qt.indexOf(t.message)){var n=a.report;if(n&&n.length>0){var e={v:$t.version,p:$t.projectId,u:$t.userId,s:$t.sessionId,n:$t.pageNum};t.message&&(e.m=t.message),t.stack&&(e.e=t.stack);var r=new XMLHttpRequest;r.open("POST",n,!0),r.send(JSON.stringify(e)),Qt.push(t.message)}}return t}function an(t){return function(){var n=performance.now();try{t.apply(this,arguments)}catch(t){throw on(t)}var e=performance.now()-n;x(4,e),e>30&&(M(7),O(6,e))}}var un=[];function cn(t,n,e,r){void 0===r&&(r=!1),e=an(e);try{t[u("addEventListener")](n,e,r),un.push({event:n,target:t,listener:e,capture:r})}catch(t){}}function sn(){for(var t=0,n=un;t<n.length;t++){var e=n[t];try{e.target[u("removeEventListener")](e.event,e.listener,e.capture)}catch(t){}}un=[]}var ln=null,dn=null,pn=null,fn=0;function hn(){return!(fn++>20)}function vn(){fn=0,pn!==mn()&&(Bn(),window.setTimeout(gn,250))}function gn(){Un(),O(29,1)}function mn(){return location.href?location.href.replace(location.hash,""):location.href}var yn=[],bn=null,wn=null,kn=null;function _n(){wn&&(kn(),wn=null,null===bn&&En())}function Sn(){yn=[],bn=null,wn=null}function En(){var t=yn.shift();t&&(bn=t,t.task().then((function(){t.id===Ut()&&(t.resolve(),bn=null,En())})).catch((function(n){t.id===Ut()&&(n&&(n.name,n.message,n.stack),bn=null,En())})))}var In=!1;function Mn(){In=!0,c=performance.now(),Sn(),sn(),rn(),pn=mn(),fn=0,cn(window,"popstate",vn),null===ln&&(ln=history.pushState,history.pushState=function(){ln.apply(this,arguments),On()&&hn()&&vn()}),null===dn&&(dn=history.replaceState,history.replaceState=function(){dn.apply(this,arguments),On()&&hn()&&vn()})}function xn(){pn=null,fn=0,rn(),sn(),Sn(),c=0,In=!1}function On(){return In}function Tn(t){if(null===t||In)return!1;for(var n in t)n in a&&(a[n]=t[n]);return!0}function jn(){Un(),_("clarity","restart")}var zn,qn=null;function Cn(){qn=null}function An(t){qn={fetchStart:Math.round(t.fetchStart),connectStart:Math.round(t.connectStart),connectEnd:Math.round(t.connectEnd),requestStart:Math.round(t.requestStart),responseStart:Math.round(t.responseStart),responseEnd:Math.round(t.responseEnd),domInteractive:Math.round(t.domInteractive),domComplete:Math.round(t.domComplete),loadEventStart:Math.round(t.loadEventStart),loadEventEnd:Math.round(t.loadEventEnd),redirectCount:Math.round(t.redirectCount),size:t.transferSize?t.transferSize:0,type:t.type,protocol:t.nextHopProtocol,encodedSize:t.encodedBodySize?t.encodedBodySize:0,decodedSize:t.decodedBodySize?t.decodedBodySize:0},function(t){U(this,void 0,void 0,(function(){var n,e;return B(this,(function(r){return n=i(),e=[n,t],29===t&&(e.push(qn.fetchStart),e.push(qn.connectStart),e.push(qn.connectEnd),e.push(qn.requestStart),e.push(qn.responseStart),e.push(qn.responseEnd),e.push(qn.domInteractive),e.push(qn.domComplete),e.push(qn.loadEventStart),e.push(qn.loadEventEnd),e.push(qn.redirectCount),e.push(qn.size),e.push(qn.type),e.push(qn.protocol),e.push(qn.encodedSize),e.push(qn.decodedSize),Cn(),ht(e)),[2]}))}))}(29)}var Nn=["navigation","resource","longtask","first-input","layout-shift","largest-contentful-paint"];function Rn(){try{zn&&zn.disconnect(),zn=new PerformanceObserver(an(Dn));for(var t=0,n=Nn;t<n.length;t++){var e=n[t];PerformanceObserver.supportedEntryTypes.indexOf(e)>=0&&("layout-shift"===e&&x(9,0),zn.observe({type:e,buffered:!0}))}}catch(t){}}function Dn(t){!function(t){for(var n=(!("visibilityState"in document)||"visible"===document.visibilityState),e=0;e<t.length;e++){var r=t[e];switch(r.entryType){case"navigation":An(r);break;case"resource":var o=r.name;jt(4,Pn(o)),o!==a.upload&&o!==a.fallback||O(28,r.duration);break;case"longtask":M(7);break;case"first-input":n&&O(10,r.processingStart-r.startTime);break;case"layout-shift":n&&!r.hadRecentInput&&x(9,1e3*r.value);break;case"largest-contentful-paint":n&&O(8,r.startTime)}}}(t.getEntries())}function Pn(t){var n=document.createElement("a");return n.href=t,n.host}var Hn=[w,w,w,Object.freeze({__proto__:null,start:function(){Cn(),function(){navigator&&"connection"in navigator&&jt(27,navigator.connection.effectiveType),window.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&("complete"!==document.readyState?cn(window,"load",T.bind(this,Rn,0)):Rn())}()},stop:function(){zn&&zn.disconnect(),zn=null,Cn()}})];function Un(t){void 0===t&&(t=null),function(){try{return!1===In&&"undefined"!=typeof Promise&&window.MutationObserver&&document.createTreeWalker&&"now"in Date&&"now"in performance&&"undefined"!=typeof WeakMap}catch(t){return!1}}()&&(Tn(t),Mn(),tt(),Hn.forEach((function(t){return an(t.start)()})),null===t&&Wn())}function Bn(){On()&&(Hn.slice().reverse().forEach((function(t){return an(t.stop)()})),nt(),xn(),void 0!==Ln&&(Ln[Xn]=function(){(Ln[Xn].q=Ln[Xn].q||[]).push(arguments),"start"===arguments[0]&&Ln[Xn].q.unshift(Ln[Xn].q.pop())&&Wn()}))}var Vn=Object.freeze({__proto__:null,consent:Bt,event:_,hashText:y,identify:X,metadata:Ht,pause:function(){On()&&(_("clarity","pause"),null===wn&&(wn=new Promise((function(t){kn=t}))))},resume:function(){On()&&(_n(),_("clarity","resume"))},set:L,start:Un,stop:Bn,upgrade:P,version:s}),Ln=window,Xn="clarity";function Wn(){if(void 0!==Ln){if(Ln[Xn]&&Ln[Xn].v)return console.warn("Error CL001: Multiple Clarity tags detected.");var t=Ln[Xn]&&Ln[Xn].q||[];for(Ln[Xn]=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return Vn[t].apply(Vn,n)},Ln[Xn].v=s;t.length>0;)Ln[Xn].apply(Ln,t.shift())}}Wn()}();
1
+ !function(){"use strict";var t=Object.freeze({__proto__:null,get queue(){return ht},get start(){return ft},get stop(){return vt},get track(){return ct}}),n=Object.freeze({__proto__:null,get check(){return _t},get compute(){return Et},get data(){return it},get start(){return kt},get stop(){return It},get trigger(){return St}}),e=Object.freeze({__proto__:null,get compute(){return zt},get data(){return Mt},get log(){return jt},get reset(){return qt},get start(){return Ot},get stop(){return Tt},get updates(){return xt}}),r=Object.freeze({__proto__:null,get callbacks(){return Ct},get clear(){return Lt},get consent(){return Vt},get data(){return At},get electron(){return Nt},get id(){return Ut},get metadata(){return Ht},get save(){return Bt},get shortid(){return Jt},get start(){return Dt},get stop(){return Pt}}),o=Object.freeze({__proto__:null,get data(){return $t},get envelope(){return en},get start(){return tn},get stop(){return nn}}),a={projectId:null,delay:1e3,lean:!1,track:!0,content:!0,drop:[],mask:[],unmask:[],regions:[],cookies:[],fraud:!0,checksum:[],report:null,upload:null,fallback:null,upgrade:null,action:null,dob:null};function u(t){return window.Zone&&"__symbol__"in window.Zone?window.Zone.__symbol__(t):t}var c=0;function i(t){void 0===t&&(t=null);var n=t&&t.timeStamp>0?t.timeStamp:performance.now();return Math.max(Math.round(n-c),0)}var s="0.7.26";var l=!0,d=null,p=null;function f(t,n,e){return function(){if(l&&null===d)try{d=new RegExp("\\p{N}","gu"),p=new RegExp("\\p{L}","gu"),new RegExp("\\p{Sc}","gu")}catch(t){l=!1}}(),t?t.replace(p,n).replace(d,e):t}var h=[],v=null;function g(){}var m=[];function y(){}function b(){}var w=Object.freeze({__proto__:null,checkDocumentStyles:function(t){},compute:function(){},data:v,hashText:y,keys:m,log:g,observe:function(){},reset:function(){},start:function(){},state:h,stop:function(){},trigger:b}),k=null;function _(t,n){On()&&t&&"string"==typeof t&&t.length<255&&(k=n&&"string"==typeof n&&n.length<255?{key:t,value:n}:{value:t},wt(24))}var S,E=null,I=null;function M(t){t in E||(E[t]=0),t in I||(I[t]=0),E[t]++,I[t]++}function x(t,n){null!==n&&(t in E||(E[t]=0),t in I||(I[t]=0),E[t]+=n,I[t]+=n)}function O(t,n){null!==n&&!1===isNaN(n)&&(t in E||(E[t]=0),(n>E[t]||0===E[t])&&(I[t]=n,E[t]=n))}function T(t,n,e){return window.setTimeout(an(t),n,e)}function j(t){return window.clearTimeout(t)}var z=0,q=0,A=null;function C(){A&&j(A),A=T(N,q),z=i()}function N(){var t=i();S={gap:t-z},wt(25),S.gap<3e5?A=T(N,q):In&&(_("clarity","suspend"),Vn(),["mousemove","touchstart"].forEach((function(t){return cn(document,t,jn)})),["resize","scroll","pageshow"].forEach((function(t){return cn(window,t,jn)})))}var R=Object.freeze({__proto__:null,get data(){return S},reset:C,start:function(){q=6e4,z=0},stop:function(){j(A),z=0,q=0}}),D=null;function P(t){On()&&a.lean&&(a.lean=!1,D={key:t},Bt(),a.upgrade&&a.upgrade(t),wt(3))}var H=Object.freeze({__proto__:null,get data(){return D},start:function(){!a.lean&&a.upgrade&&a.upgrade("Config"),D=null},stop:function(){D=null},upgrade:P});function U(t,n,e,r){return new(e||(e=Promise))((function(o,a){function u(t){try{i(r.next(t))}catch(t){a(t)}}function c(t){try{i(r.throw(t))}catch(t){a(t)}}function i(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(u,c)}i((r=r.apply(t,n||[])).next())}))}function V(t,n){var e,r,o,a,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(i){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){u.label=c[1];break}if(6===c[0]&&u.label<o[1]){u.label=o[1],o=c;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(c);break}o[2]&&u.ops.pop(),u.trys.pop();continue}c=n.call(t,u)}catch(t){c=[6,t],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}var L=null;function B(t,n){W(t,"string"==typeof n?[n]:n)}function X(t,n,e,r){return void 0===n&&(n=null),void 0===e&&(e=null),void 0===r&&(r=null),U(this,void 0,void 0,(function(){var o,a;return V(this,(function(u){switch(u.label){case 0:return a={},[4,G(t)];case 1:return a.userId=u.sent(),a.userHint=r||((c=t)&&c.length>=5?"".concat(c.substring(0,2)).concat(f(c.substring(2),"*","*")):f(c,"*","*")),W("userId",[(o=a).userId]),W("userHint",[o.userHint]),W("userType",[Y(t)]),n&&(W("sessionId",[n]),o.sessionId=n),e&&(W("pageId",[e]),o.pageId=e),[2,o]}var c}))}))}function W(t,n){if(On()&&t&&n&&"string"==typeof t&&t.length<255){for(var e=(t in L?L[t]:[]),r=0;r<n.length;r++)"string"==typeof n[r]&&n[r].length<255&&e.push(n[r]);L[t]=e}}function J(){wt(34)}function Z(){L={}}function G(t){return U(this,void 0,void 0,(function(){var n;return V(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),crypto&&t?[4,crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t))]:[3,2];case 1:return n=e.sent(),[2,Array.prototype.map.call(new Uint8Array(n),(function(t){return("00"+t.toString(16)).slice(-2)})).join("")];case 2:return[2,""];case 3:return[3,5];case 4:return e.sent(),[2,""];case 5:return[2]}}))}))}function Y(t){return t&&t.indexOf("@")>0?"email":"string"}var F="CompressionStream"in window;function K(t){return U(this,void 0,void 0,(function(){var n,e;return V(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),F?(n=new ReadableStream({start:function(n){return U(this,void 0,void 0,(function(){return V(this,(function(e){return n.enqueue(t),n.close(),[2]}))}))}}).pipeThrough(new TextEncoderStream).pipeThrough(new window.CompressionStream("gzip")),e=Uint8Array.bind,[4,Q(n)]):[3,2];case 1:return[2,new(e.apply(Uint8Array,[void 0,r.sent()]))];case 2:return[3,4];case 3:return r.sent(),[3,4];case 4:return[2,null]}}))}))}function Q(t){return U(this,void 0,void 0,(function(){var n,e,r,o,a;return V(this,(function(u){switch(u.label){case 0:n=t.getReader(),e=[],r=!1,o=[],u.label=1;case 1:return r?[3,3]:[4,n.read()];case 2:return a=u.sent(),r=a.done,o=a.value,r?[2,e]:(e.push.apply(e,o),[3,1]);case 3:return[2,e]}}))}))}var $=[w,e,Object.freeze({__proto__:null,compute:J,get data(){return L},identify:X,reset:Z,set:B,start:function(){Z()},stop:function(){Z()}}),n,w,r,o,t,R,H,w];function tt(){E={},I={},M(5),$.forEach((function(t){return an(t.start)()}))}function nt(){$.slice().reverse().forEach((function(t){return an(t.stop)()})),E={},I={}}function et(){J(),zt(),wt(0),Et()}var rt,ot,at,ut,ct,it,st=0,lt=0,dt=null,pt=0;function ft(){ut=!0,st=0,lt=0,pt=0,rt=[],ot=[],at={},ct=null}function ht(t,n){if(void 0===n&&(n=!0),ut){var e=i(),r=t.length>1?t[1]:null,o=JSON.stringify(t);switch(r){case 5:st+=o.length;case 37:case 6:case 43:case 45:case 46:lt+=o.length,rt.push(o);break;default:ot.push(o)}M(25);var u=function(){var t=!1===a.lean&&st>0?100:$t.sequence*a.delay;return"string"==typeof a.upload?Math.max(Math.min(t,3e4),100):a.delay}();e-pt>2*u&&(j(dt),dt=null),n&&null===dt&&(25!==r&&C(),dt=T(gt,u),pt=e,_t(lt))}}function vt(){j(dt),gt(!0),st=0,lt=0,pt=0,rt=[],ot=[],at={},ct=null,ut=!1}function gt(t){return void 0===t&&(t=!1),U(this,void 0,void 0,(function(){var n,e,r,o,u,c,i,s;return V(this,(function(l){switch(l.label){case 0:return dt=null,(n=!1===a.lean&&lt>0&&(lt<1048576||$t.sequence>0))&&O(1,1),et(),e=!0===t,r=JSON.stringify(en(e)),o="[".concat(ot.join(),"]"),u=n?"[".concat(rt.join(),"]"):"",c=function(t){return t.p.length>0?'{"e":'.concat(t.e,',"a":').concat(t.a,',"p":').concat(t.p,"}"):'{"e":'.concat(t.e,',"a":').concat(t.a,"}")}({e:r,a:o,p:u}),e?(s=null,[3,3]):[3,1];case 1:return[4,K(c)];case 2:s=l.sent(),l.label=3;case 3:return x(2,(i=s)?i.length:c.length),mt(c,i,$t.sequence,e),ot=[],n&&(rt=[],lt=0,st=0),[2]}}))}))}function mt(t,n,e,r){if(void 0===r&&(r=!1),"string"==typeof a.upload){var o=a.upload,u=!1;if(r&&"sendBeacon"in navigator)try{(u=navigator.sendBeacon.bind(navigator)(o,t))&&bt(e)}catch(t){}if(!1===u){e in at?at[e].attempts++:at[e]={data:t,attempts:1};var c=new XMLHttpRequest;c.open("POST",o,!0),c.timeout=15e3,c.ontimeout=function(){on(new Error("".concat("Timeout"," : ").concat(o)))},null!==e&&(c.onreadystatechange=function(){an(yt)(c,e)}),c.withCredentials=!0,n?(c.setRequestHeader("Accept","application/x-clarity-gzip"),c.send(n)):c.send(t)}}else if(a.upload){(0,a.upload)(t),bt(e)}}function yt(t,n){var e=at[n];t&&4===t.readyState&&e&&((t.status<200||t.status>208)&&e.attempts<=1?t.status>=400&&t.status<500?St(6):(0===t.status&&(a.upload=a.fallback?a.fallback:a.upload),mt(e.data,null,n)):(ct={sequence:n,attempts:e.attempts,status:t.status},e.attempts>1&&wt(2),200===t.status&&t.responseText&&function(t){for(var n=t&&t.length>0?t.split("\n"):[],e=0,r=n;e<r.length;e++){var o=r[e],u=o&&o.length>0?o.split(/ (.*)/):[""];switch(u[0]){case"END":St(6);break;case"UPGRADE":P("Auto");break;case"ACTION":a.action&&u.length>1&&a.action(u[1]);break;case"EXTRACT":u.length>1&&u[1]}}}(t.responseText),0===t.status&&(mt(e.data,null,n,!0),St(3)),t.status>=200&&t.status<=208&&bt(n),delete at[n]))}function bt(t){1===t&&Bt()}function wt(t){var n=[i(),t];switch(t){case 4:var e=h;e&&((n=[e.time,e.event]).push(e.data.visible),n.push(e.data.docWidth),n.push(e.data.docHeight),n.push(e.data.screenWidth),n.push(e.data.screenHeight),n.push(e.data.scrollX),n.push(e.data.scrollY),n.push(e.data.pointerX),n.push(e.data.pointerY),n.push(e.data.activityTime),ht(n,!1));break;case 25:n.push(S.gap),ht(n);break;case 35:n.push(it.check),ht(n,!1);break;case 3:n.push(D.key),ht(n);break;case 2:n.push(ct.sequence),n.push(ct.attempts),n.push(ct.status),ht(n,!1);break;case 24:k.key&&n.push(k.key),n.push(k.value),ht(n);break;case 34:var r=Object.keys(L);if(r.length>0){for(var o=0,a=r;o<a.length;o++){var u=a[o];n.push(u),n.push(L[u])}Z(),ht(n,!1)}break;case 0:var c=Object.keys(I);if(c.length>0){for(var s=0,l=c;s<l.length;s++){var d=l[s],p=parseInt(d,10);n.push(p),n.push(Math.round(I[d]))}I={},ht(n,!1)}break;case 1:var f=Object.keys(xt);if(f.length>0){for(var g=0,y=f;g<y.length;g++){var b=y[g];p=parseInt(b,10);n.push(p),n.push(xt[b])}qt(),ht(n,!1)}break;case 36:var w=Object.keys(v);if(w.length>0){for(var _=0,E=w;_<E.length;_++){var M=E[_];p=parseInt(M,10);n.push(p),n.push([].concat.apply([],v[M]))}ht(n,!1)}break;case 40:m.forEach((function(t){n.push(t);var e=[];for(var r in v[t]){var o=parseInt(r,10);e.push(o),e.push(v[t][r])}n.push(e)})),ht(n,!1)}}function kt(){it={check:0}}function _t(t){if(0===it.check){var n=it.check;n=$t.sequence>=128?1:n,n=$t.pageNum>=128?7:n,n=i()>72e5?2:n,(n=t>10485760?2:n)!==it.check&&St(n)}}function St(t){it.check=t,Lt(),Vn()}function Et(){0!==it.check&&wt(35)}function It(){it=null}var Mt=null,xt=null;function Ot(){Mt={},xt={}}function Tt(){Mt={},xt={}}function jt(t,n){n&&(n="".concat(n),t in Mt||(Mt[t]=[]),Mt[t].indexOf(n)<0&&(Mt[t].push(n),t in xt||(xt[t]=[]),xt[t].push(n),Mt[t].length>128&&St(5)))}function zt(){wt(1)}function qt(){xt={}}var At=null,Ct=[],Nt=0,Rt=null;function Dt(){Rt=null;var t=navigator&&"userAgent"in navigator?navigator.userAgent:"",n=document&&document.title?document.title:"";Nt=t.indexOf("Electron")>0?1:0;var e,r=function(){var t={session:Jt(),ts:Math.round(Date.now()),count:1,upgrade:null,upload:""},n=Yt("_clsk");if(n){var e=n.split("|");e.length>=5&&t.ts-Zt(e[1])<18e5&&(t.session=e[0],t.count=Zt(e[2])+1,t.upgrade=Zt(e[3]),t.upload=e.length>=6?"".concat("https://").concat(e[5],"/").concat(e[4]):"".concat("https://").concat(e[4]))}return t}(),o=Gt(),u=a.projectId||function(t,n){void 0===n&&(n=null);for(var e,r=5381,o=r,a=0;a<t.length;a+=2)r=(r<<5)+r^t.charCodeAt(a),a+1<t.length&&(o=(o<<5)+o^t.charCodeAt(a+1));return e=Math.abs(r+11579*o),(n?e%Math.pow(2,n):e).toString(36)}(location.host);At={projectId:u,userId:o.id,sessionId:r.session,pageNum:r.count},a.lean=a.track&&null!==r.upgrade?0===r.upgrade:a.lean,a.upload=a.track&&"string"==typeof a.upload&&r.upload&&r.upload.length>"https://".length?r.upload:a.upload,jt(0,t),jt(3,n),jt(1,function(t,n){if(void 0===n&&(n=!1),n)return"".concat("https://").concat("Electron");var e=a.drop;if(e&&e.length>0&&t&&t.indexOf("?")>0){var r=t.split("?");return r[0]+"?"+r[1].split("&").map((function(t){return e.some((function(n){return 0===t.indexOf("".concat(n,"="))}))?"".concat(t.split("=")[0],"=").concat("*na*"):t})).join("&")}return t}(location.href,!!Nt)),jt(2,document.referrer),jt(15,function(){var t=Jt();if(a.track&&Xt(window,"sessionStorage")){var n=sessionStorage.getItem("_cltk");t=n||t,sessionStorage.setItem("_cltk",t)}return t}()),jt(16,document.documentElement.lang),jt(17,document.dir),jt(26,"".concat(window.devicePixelRatio)),jt(28,o.dob.toString()),jt(29,o.version.toString()),O(0,r.ts),O(1,0),O(35,Nt),navigator&&(jt(9,navigator.language),O(33,navigator.hardwareConcurrency),O(32,navigator.maxTouchPoints),O(34,Math.round(navigator.deviceMemory)),(e=navigator.userAgentData)&&e.getHighEntropyValues?e.getHighEntropyValues(["model","platform","platformVersion","uaFullVersion"]).then((function(t){var n;jt(22,t.platform),jt(23,t.platformVersion),null===(n=t.brands)||void 0===n||n.forEach((function(t){jt(24,t.name+"~"+t.version)})),jt(25,t.model),O(27,t.mobile?1:0)})):jt(22,navigator.platform)),screen&&(O(14,Math.round(screen.width)),O(15,Math.round(screen.height)),O(16,Math.round(screen.colorDepth)));for(var c=0,i=a.cookies;c<i.length;c++){var s=i[c],l=Yt(s);l&&B(s,l)}Wt(o)}function Pt(){Rt=null,At=null}function Ht(t,n){void 0===n&&(n=!0);var e=a.lean?0:1;At&&(e||!1===n)?t(At,!a.lean):Ct.push({callback:t,wait:n})}function Ut(){return At?[At.userId,At.sessionId,At.pageNum].join("."):""}function Vt(t){if(void 0===t&&(t=!0),!t)return a.track=!1,Kt("_clsk","",-Number.MAX_VALUE),Kt("_clck","",-Number.MAX_VALUE),Vn(),void window.setTimeout(Un,250);On()&&(a.track=!0,Wt(Gt(),1))}function Lt(){Kt("_clsk","",0)}function Bt(){var t=Math.round(Date.now()),n=a.upload&&"string"==typeof a.upload?a.upload.replace("https://",""):"",e=a.lean?0:1;!function(t){Ct.length>0&&Ct.forEach((function(n){!n.callback||n.wait&&!t||n.callback(At,!a.lean)}))}(e),Kt("_clsk",[At.sessionId,t,At.pageNum,e,n].join("|"),1)}function Xt(t,n){try{return!!t[n]}catch(t){return!1}}function Wt(t,n){void 0===n&&(n=null),n=null===n?t.consent:n;var e=Math.ceil((Date.now()+31536e6)/864e5),r=0===t.dob?null===a.dob?0:a.dob:t.dob;(null===t.expiry||Math.abs(e-t.expiry)>=1||t.consent!==n||t.dob!==r)&&Kt("_clck",[At.userId,2,e.toString(36),n,r].join("|"),365)}function Jt(){var t=Math.floor(Math.random()*Math.pow(2,32));return window&&window.crypto&&window.crypto.getRandomValues&&Uint32Array&&(t=window.crypto.getRandomValues(new Uint32Array(1))[0]),t.toString(36)}function Zt(t,n){return void 0===n&&(n=10),parseInt(t,n)}function Gt(){var t={id:Jt(),version:0,expiry:null,consent:0,dob:0},n=Yt("_clck");if(n&&n.length>0){for(var e=n.split("|"),r=0,o=0,u=document.cookie.split(";");o<u.length;o++){r+="_clck"===u[o].split("=")[0].trim()?1:0}if(1===e.length||r>1){var c="".concat(";").concat("expires=").concat(new Date(0).toUTCString()).concat(";path=/");document.cookie="".concat("_clck","=").concat(c),document.cookie="".concat("_clsk","=").concat(c)}e.length>1&&(t.version=Zt(e[1])),e.length>2&&(t.expiry=Zt(e[2],36)),e.length>3&&1===Zt(e[3])&&(t.consent=1),e.length>4&&Zt(e[1])>1&&(t.dob=Zt(e[4])),a.track=a.track||1===t.consent,t.id=a.track?e[0]:t.id}return t}function Yt(t){var n;if(Xt(document,"cookie")){var e=document.cookie.split(";");if(e)for(var r=0;r<e.length;r++){var o=e[r].split("=");if(o.length>1&&o[0]&&o[0].trim()===t){for(var a=Ft(o[1]),u=a[0],c=a[1];u;)u=(n=Ft(c))[0],c=n[1];return c}}}return null}function Ft(t){try{var n=decodeURIComponent(t);return[n!=t,n]}catch(t){}return[!1,t]}function Kt(t,n,e){if((a.track||""==n)&&(navigator&&navigator.cookieEnabled||Xt(document,"cookie"))){var r=function(t){return encodeURIComponent(t)}(n),o=new Date;o.setDate(o.getDate()+e);var u=o?"expires="+o.toUTCString():"",c="".concat(t,"=").concat(r).concat(";").concat(u).concat(";path=/");try{if(null===Rt){for(var i=location.hostname?location.hostname.split("."):[],s=i.length-1;s>=0;s--)if(Rt=".".concat(i[s]).concat(Rt||""),s<i.length-1&&(document.cookie="".concat(c).concat(";").concat("domain=").concat(Rt),Yt(t)===n))return;Rt=""}}catch(t){Rt=""}document.cookie=Rt?"".concat(c).concat(";").concat("domain=").concat(Rt):c}}var Qt,$t=null;function tn(){var t=At;$t={version:s,sequence:0,start:0,duration:0,projectId:t.projectId,userId:t.userId,sessionId:t.sessionId,pageNum:t.pageNum,upload:0,end:0}}function nn(){$t=null}function en(t){return $t.start=$t.start+$t.duration,$t.duration=i()-$t.start,$t.sequence++,$t.upload=t&&"sendBeacon"in navigator?1:0,$t.end=t?1:0,[$t.version,$t.sequence,$t.start,$t.duration,$t.projectId,$t.userId,$t.sessionId,$t.pageNum,$t.upload,$t.end]}function rn(){Qt=[]}function on(t){if(Qt&&-1===Qt.indexOf(t.message)){var n=a.report;if(n&&n.length>0){var e={v:$t.version,p:$t.projectId,u:$t.userId,s:$t.sessionId,n:$t.pageNum};t.message&&(e.m=t.message),t.stack&&(e.e=t.stack);var r=new XMLHttpRequest;r.open("POST",n,!0),r.send(JSON.stringify(e)),Qt.push(t.message)}}return t}function an(t){return function(){var n=performance.now();try{t.apply(this,arguments)}catch(t){throw on(t)}var e=performance.now()-n;x(4,e),e>30&&(M(7),O(6,e))}}var un=[];function cn(t,n,e,r){void 0===r&&(r=!1),e=an(e);try{t[u("addEventListener")](n,e,r),un.push({event:n,target:t,listener:e,capture:r})}catch(t){}}function sn(){for(var t=0,n=un;t<n.length;t++){var e=n[t];try{e.target[u("removeEventListener")](e.event,e.listener,e.capture)}catch(t){}}un=[]}var ln=null,dn=null,pn=null,fn=0;function hn(){return!(fn++>20)}function vn(){fn=0,pn!==mn()&&(Vn(),window.setTimeout(gn,250))}function gn(){Un(),O(29,1)}function mn(){return location.href?location.href.replace(location.hash,""):location.href}var yn=[],bn=null,wn=null,kn=null;function _n(){wn&&(kn(),wn=null,null===bn&&En())}function Sn(){yn=[],bn=null,wn=null}function En(){var t=yn.shift();t&&(bn=t,t.task().then((function(){t.id===Ut()&&(t.resolve(),bn=null,En())})).catch((function(n){t.id===Ut()&&(n&&(n.name,n.message,n.stack),bn=null,En())})))}var In=!1;function Mn(){In=!0,c=performance.now(),Sn(),sn(),rn(),pn=mn(),fn=0,cn(window,"popstate",vn),null===ln&&(ln=history.pushState,history.pushState=function(){ln.apply(this,arguments),On()&&hn()&&vn()}),null===dn&&(dn=history.replaceState,history.replaceState=function(){dn.apply(this,arguments),On()&&hn()&&vn()})}function xn(){pn=null,fn=0,rn(),sn(),Sn(),c=0,In=!1}function On(){return In}function Tn(t){if(null===t||In)return!1;for(var n in t)n in a&&(a[n]=t[n]);return!0}function jn(){Un(),_("clarity","restart")}var zn,qn=null;function An(){qn=null}function Cn(t){qn={fetchStart:Math.round(t.fetchStart),connectStart:Math.round(t.connectStart),connectEnd:Math.round(t.connectEnd),requestStart:Math.round(t.requestStart),responseStart:Math.round(t.responseStart),responseEnd:Math.round(t.responseEnd),domInteractive:Math.round(t.domInteractive),domComplete:Math.round(t.domComplete),loadEventStart:Math.round(t.loadEventStart),loadEventEnd:Math.round(t.loadEventEnd),redirectCount:Math.round(t.redirectCount),size:t.transferSize?t.transferSize:0,type:t.type,protocol:t.nextHopProtocol,encodedSize:t.encodedBodySize?t.encodedBodySize:0,decodedSize:t.decodedBodySize?t.decodedBodySize:0},function(t){U(this,void 0,void 0,(function(){var n,e;return V(this,(function(r){return n=i(),e=[n,t],29===t&&(e.push(qn.fetchStart),e.push(qn.connectStart),e.push(qn.connectEnd),e.push(qn.requestStart),e.push(qn.responseStart),e.push(qn.responseEnd),e.push(qn.domInteractive),e.push(qn.domComplete),e.push(qn.loadEventStart),e.push(qn.loadEventEnd),e.push(qn.redirectCount),e.push(qn.size),e.push(qn.type),e.push(qn.protocol),e.push(qn.encodedSize),e.push(qn.decodedSize),An(),ht(e)),[2]}))}))}(29)}var Nn=["navigation","resource","longtask","first-input","layout-shift","largest-contentful-paint"];function Rn(){try{zn&&zn.disconnect(),zn=new PerformanceObserver(an(Dn));for(var t=0,n=Nn;t<n.length;t++){var e=n[t];PerformanceObserver.supportedEntryTypes.indexOf(e)>=0&&("layout-shift"===e&&x(9,0),zn.observe({type:e,buffered:!0}))}}catch(t){}}function Dn(t){!function(t){for(var n=(!("visibilityState"in document)||"visible"===document.visibilityState),e=0;e<t.length;e++){var r=t[e];switch(r.entryType){case"navigation":Cn(r);break;case"resource":var o=r.name;jt(4,Pn(o)),o!==a.upload&&o!==a.fallback||O(28,r.duration);break;case"longtask":M(7);break;case"first-input":n&&O(10,r.processingStart-r.startTime);break;case"layout-shift":n&&!r.hadRecentInput&&x(9,1e3*r.value);break;case"largest-contentful-paint":n&&O(8,r.startTime)}}}(t.getEntries())}function Pn(t){var n=document.createElement("a");return n.href=t,n.host}var Hn=[w,w,w,Object.freeze({__proto__:null,start:function(){An(),function(){navigator&&"connection"in navigator&&jt(27,navigator.connection.effectiveType),window.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&("complete"!==document.readyState?cn(window,"load",T.bind(this,Rn,0)):Rn())}()},stop:function(){zn&&zn.disconnect(),zn=null,An()}})];function Un(t){void 0===t&&(t=null),function(){try{return!1===In&&"undefined"!=typeof Promise&&window.MutationObserver&&document.createTreeWalker&&"now"in Date&&"now"in performance&&"undefined"!=typeof WeakMap}catch(t){return!1}}()&&(Tn(t),Mn(),tt(),Hn.forEach((function(t){return an(t.start)()})),null===t&&Wn())}function Vn(){On()&&(Hn.slice().reverse().forEach((function(t){return an(t.stop)()})),nt(),xn(),void 0!==Bn&&(Bn[Xn]=function(){(Bn[Xn].q=Bn[Xn].q||[]).push(arguments),"start"===arguments[0]&&Bn[Xn].q.unshift(Bn[Xn].q.pop())&&Wn()}))}var Ln=Object.freeze({__proto__:null,consent:Vt,event:_,hashText:y,identify:X,metadata:Ht,pause:function(){On()&&(_("clarity","pause"),null===wn&&(wn=new Promise((function(t){kn=t}))))},resume:function(){On()&&(_n(),_("clarity","resume"))},set:B,start:Un,stop:Vn,upgrade:P,version:s}),Bn=window,Xn="clarity";function Wn(){if(void 0!==Bn){if(Bn[Xn]&&Bn[Xn].v)return console.warn("Error CL001: Multiple Clarity tags detected.");var t=Bn[Xn]&&Bn[Xn].q||[];for(Bn[Xn]=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return Ln[t].apply(Ln,n)},Bn[Xn].v=s;t.length>0;)Bn[Xn].apply(Bn,t.shift())}}Wn()}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clarity-js",
3
- "version": "0.7.25",
3
+ "version": "0.7.26",
4
4
  "description": "An analytics library that uses web page interactions to generate aggregated insights",
5
5
  "author": "Microsoft Corp.",
6
6
  "license": "MIT",
package/rollup.config.ts CHANGED
@@ -15,7 +15,7 @@ export default [
15
15
  plugins: [
16
16
  alias({
17
17
  entries: [
18
- { find: '@src/layout/style', replacement: '@src/insight/blank' }
18
+ { find: '@src/layout/style', replacement: '@src/insight/style' }
19
19
  ]
20
20
  }),
21
21
  resolve(),
@@ -1,2 +1,2 @@
1
- let version = "0.7.25";
1
+ let version = "0.7.26";
2
2
  export default version;
@@ -109,8 +109,9 @@ export function id(): string {
109
109
 
110
110
  export function consent(status: boolean = true): void {
111
111
  if (!status) {
112
- setCookie(Constant.SessionKey, Constant.Empty, 0);
113
- setCookie(Constant.CookieKey, Constant.Empty, 0);
112
+ config.track = false;
113
+ setCookie(Constant.SessionKey, Constant.Empty, -Number.MAX_VALUE);
114
+ setCookie(Constant.CookieKey, Constant.Empty, -Number.MAX_VALUE);
114
115
  clarity.stop();
115
116
  window.setTimeout(clarity.start, Setting.RestartDelay);
116
117
  return;
@@ -279,7 +280,9 @@ function encodeCookieValue(value: string): string {
279
280
  }
280
281
 
281
282
  function setCookie(key: string, value: string, time: number): void {
282
- if (config.track && ((navigator && navigator.cookieEnabled) || supported(document, Constant.Cookie))) {
283
+ // only write cookies if we are currently in a cookie writing mode (and they are supported)
284
+ // OR if we are trying to write an empty cookie (i.e. clear the cookie value out)
285
+ if ((config.track || value == Constant.Empty) && ((navigator && navigator.cookieEnabled) || supported(document, Constant.Cookie))) {
283
286
  // Some browsers automatically url encode cookie values if they are not url encoded.
284
287
  // We therefore encode and decode cookie values ourselves.
285
288
  let encodedValue = encodeCookieValue(value);
@@ -0,0 +1,52 @@
1
+ import { Metric } from "@clarity-types/data";
2
+ import { StyleSheetState } from "@clarity-types/layout";
3
+ import * as core from "@src/core";
4
+ import * as metric from "@src/data/metric";
5
+
6
+ export let state: StyleSheetState[] = [];
7
+ let replace: (text?: string) => Promise<CSSStyleSheet> = null;
8
+ let replaceSync: (text?: string) => void = null;
9
+
10
+ export function start(): void {
11
+ reset();
12
+
13
+ if (replace === null) {
14
+ replace = CSSStyleSheet.prototype.replace;
15
+ CSSStyleSheet.prototype.replace = function(): Promise<CSSStyleSheet> {
16
+ if (core.active()) {
17
+ metric.max(Metric.ConstructedStyles, 1);
18
+ }
19
+ return replace.apply(this, arguments);
20
+ };
21
+ }
22
+
23
+ if (replaceSync === null) {
24
+ replaceSync = CSSStyleSheet.prototype.replaceSync;
25
+ CSSStyleSheet.prototype.replaceSync = function(): void {
26
+ if (core.active()) {
27
+ metric.max(Metric.ConstructedStyles, 1);
28
+ }
29
+ return replaceSync.apply(this, arguments);
30
+ };
31
+ }
32
+ }
33
+
34
+ export function checkDocumentStyles(documentNode: Document): void {
35
+ if (!documentNode?.adoptedStyleSheets) {
36
+ // if we don't have adoptedStyledSheets on the Node passed to us, we can short circuit.
37
+ return;
38
+ }
39
+ metric.max(Metric.ConstructedStyles, 1);
40
+ }
41
+
42
+ export function compute(): void {
43
+ checkDocumentStyles(document);
44
+ }
45
+
46
+ export function reset(): void {
47
+ state = [];
48
+ }
49
+
50
+ export function stop(): void {
51
+ reset();
52
+ }
@@ -90,12 +90,6 @@ export default function (node: Node, source: Source): Node {
90
90
  // In some cases, external libraries like vue-fragment, can modify parentNode property to not be in sync with the DOM
91
91
  // For correctness, we first look at parentElement and if it not present then fall back to using parentNode
92
92
  parent = node.parentElement ? node.parentElement : (node.parentNode ? node.parentNode as HTMLElement : null);
93
- // For HTML slots, the parentElement doesn't actually match what is rendered. If we have an assignedSlot, we use that
94
- // as the parent to ensure our visualizations match the browser behavior for end users.
95
- var slottedParent = (node as HTMLElement).assignedSlot;
96
- if (slottedParent) {
97
- parent = slottedParent;
98
- }
99
93
  // If we encounter a node that is part of SVG namespace, prefix the tag with SVG_PREFIX
100
94
  if (element.namespaceURI === Constant.SvgNamespace) { tag = Constant.SvgPrefix + tag; }
101
95
 
@@ -1,16 +1,18 @@
1
- import { Event } from "@clarity-types/data";
1
+ import { Event, Metric } from "@clarity-types/data";
2
2
  import { StyleSheetOperation, StyleSheetState } from "@clarity-types/layout";
3
3
  import { time } from "@src/core/time";
4
- import { shortid } from "@src/data/metadata";
4
+ import { shortid, data as metadataFields } from "@src/data/metadata";
5
5
  import encode from "@src/layout/encode";
6
6
  import { getId, getNode } from "@src/layout/dom";
7
7
  import * as core from "@src/core";
8
8
  import { getCssRules } from "./node";
9
+ import * as metric from "@src/data/metric";
9
10
 
10
11
  export let state: StyleSheetState[] = [];
11
12
  let replace: (text?: string) => Promise<CSSStyleSheet> = null;
12
13
  let replaceSync: (text?: string) => void = null;
13
14
  const styleSheetId = 'claritySheetId';
15
+ const styleSheetPageNum = 'claritySheetNum';
14
16
  let styleSheetMap = {};
15
17
 
16
18
  export function start(): void {
@@ -20,12 +22,8 @@ export function start(): void {
20
22
  replace = CSSStyleSheet.prototype.replace;
21
23
  CSSStyleSheet.prototype.replace = function(): Promise<CSSStyleSheet> {
22
24
  if (core.active()) {
23
- if (!this[styleSheetId]) {
24
- this[styleSheetId] = shortid();
25
- // need to pass a create style sheet event (don't add it to any nodes, but do create it)
26
- trackStyleChange(time(), this[styleSheetId], StyleSheetOperation.Create);
27
- }
28
-
25
+ metric.max(Metric.ConstructedStyles, 1);
26
+ bootStrapStyleSheet(this);
29
27
  trackStyleChange(time(), this[styleSheetId], StyleSheetOperation.Replace, arguments[0]);
30
28
  }
31
29
  return replace.apply(this, arguments);
@@ -36,11 +34,8 @@ export function start(): void {
36
34
  replaceSync = CSSStyleSheet.prototype.replaceSync;
37
35
  CSSStyleSheet.prototype.replaceSync = function(): void {
38
36
  if (core.active()) {
39
- if (!this[styleSheetId]) {
40
- this[styleSheetId] = shortid();
41
- // need to pass a create style sheet event (don't add it to any nodes, but do create it)
42
- trackStyleChange(time(), this[styleSheetId], StyleSheetOperation.Create);
43
- }
37
+ metric.max(Metric.ConstructedStyles, 1);
38
+ bootStrapStyleSheet(this);
44
39
  trackStyleChange(time(), this[styleSheetId], StyleSheetOperation.ReplaceSync, arguments[0]);
45
40
  }
46
41
  return replaceSync.apply(this, arguments);
@@ -48,15 +43,31 @@ export function start(): void {
48
43
  }
49
44
  }
50
45
 
46
+ function bootStrapStyleSheet(styleSheet: CSSStyleSheet): void {
47
+ // If we haven't seen this style sheet on this page yet, we create a reference to it for the visualizer.
48
+ // For SPA or times in which Clarity restarts on a given page, our visualizer would lose context
49
+ // on the previously created style sheet for page N-1.
50
+ const pageNum = metadataFields.pageNum;
51
+ if (styleSheet[styleSheetPageNum] !== pageNum) {
52
+ styleSheet[styleSheetPageNum] = pageNum;
53
+ styleSheet[styleSheetId] = shortid();
54
+ // need to pass a create style sheet event (don't add it to any nodes, but do create it)
55
+ trackStyleChange(time(), styleSheet[styleSheetId], StyleSheetOperation.Create);
56
+ }
57
+ }
58
+
51
59
  export function checkDocumentStyles(documentNode: Document): void {
52
60
  if (!documentNode?.adoptedStyleSheets) {
53
61
  // if we don't have adoptedStyledSheets on the Node passed to us, we can short circuit.
54
62
  return;
55
63
  }
64
+ metric.max(Metric.ConstructedStyles, 1);
56
65
  let currentStyleSheets: string[] = [];
57
66
  for (var styleSheet of documentNode.adoptedStyleSheets) {
58
- // if we haven't seen this style sheet, create it and pass a replaceSync with its contents
59
- if (!styleSheet[styleSheetId]) {
67
+ const pageNum = metadataFields.pageNum;
68
+ // if we haven't seen this style sheet, create it and call replaceSync with its contents to bootstrap it
69
+ if (styleSheet[styleSheetPageNum] !== pageNum) {
70
+ styleSheet[styleSheetPageNum] = pageNum;
60
71
  styleSheet[styleSheetId] = shortid();
61
72
  trackStyleChange(time(), styleSheet[styleSheetId], StyleSheetOperation.Create);
62
73
  trackStyleChange(time(), styleSheet[styleSheetId], StyleSheetOperation.ReplaceSync, getCssRules(styleSheet));
@@ -82,7 +93,6 @@ export function compute(): void {
82
93
 
83
94
  export function reset(): void {
84
95
  state = [];
85
-
86
96
  }
87
97
 
88
98
  export function stop(): void {
@@ -4,41 +4,25 @@ import * as task from "@src/core/task";
4
4
  import node from "@src/layout/node";
5
5
 
6
6
  export default async function(root: Node, timer: Timer, source: Source): Promise<void> {
7
- let primaryQueue = [root];
8
- let slottedNodesQueue: Node[] = [];
9
- for (var currentQueue of [primaryQueue, slottedNodesQueue]) {
10
- while (currentQueue.length > 0) {
11
- let entry = currentQueue.shift();
12
- let next = entry.firstChild;
13
-
14
- while (next) {
15
- // During traversal there is not a guarantee that the assigned child here is being found after the slot to which it is placed
16
- // as the typical parent/child methods don't reflect what is rendered. We need to make sure all other mutations and
17
- // discoveries are processed before we process a slotted element. Once we are processing the slottedNodesQueue we can
18
- // skip this effort and go directly to our breadth first traversal.
19
- if (currentQueue == primaryQueue) {
20
- var slottedParent = (next as HTMLElement).assignedSlot;
21
- if (slottedParent) {
22
- slottedNodesQueue.push(next);
23
- } else {
24
- currentQueue.push(next);
25
- }
26
- } else {
27
- currentQueue.push(next);
28
- }
29
- next = next.nextSibling;
30
- }
31
-
32
- // Check the status of current task to see if we should yield before continuing
33
- let state = task.state(timer);
34
- if (state === Task.Wait) { state = await task.suspend(timer); }
35
- if (state === Task.Stop) { break; }
36
-
37
- // Check if processing a node gives us a pointer to one of its sub nodes for traversal
38
- // E.g. an element node may give us a pointer to traverse shadowDom if shadowRoot property is set
39
- // Or, an iframe from the same origin could give a pointer to it's document for traversing contents of iframe.
40
- let subnode = node(entry, source);
41
- if (subnode) { currentQueue.push(subnode); }
7
+ let queue = [root];
8
+ while (queue.length > 0) {
9
+ let entry = queue.shift();
10
+ let next = entry.firstChild;
11
+
12
+ while (next) {
13
+ queue.push(next);
14
+ next = next.nextSibling;
42
15
  }
16
+
17
+ // Check the status of current task to see if we should yield before continuing
18
+ let state = task.state(timer);
19
+ if (state === Task.Wait) { state = await task.suspend(timer); }
20
+ if (state === Task.Stop) { break; }
21
+
22
+ // Check if processing a node gives us a pointer to one of its sub nodes for traversal
23
+ // E.g. an element node may give us a pointer to traverse shadowDom if shadowRoot property is set
24
+ // Or, an iframe from the same origin could give a pointer to it's document for traversing contents of iframe.
25
+ let subnode = node(entry, source);
26
+ if (subnode) { queue.push(subnode); }
43
27
  }
44
- }
28
+ }
package/types/data.d.ts CHANGED
@@ -109,7 +109,8 @@ export const enum Metric {
109
109
  MaxTouchPoints = 32,
110
110
  HardwareConcurrency = 33,
111
111
  DeviceMemory = 34,
112
- Electron = 35
112
+ Electron = 35,
113
+ ConstructedStyles = 36
113
114
  }
114
115
 
115
116
  export const enum Dimension {