posthog-js
Advanced tools
@@ -1,2 +0,2 @@ | ||
| !function(){"use strict";var e="undefined"!=typeof window?window:void 0,r="undefined"!=typeof globalThis?globalThis:e;"undefined"==typeof self&&(r.self=r),"undefined"==typeof File&&(r.File=function(){});var n=Array.prototype.forEach,t=null==r?void 0:r.navigator,i=null==r?void 0:r.document,o=null==r?void 0:r.location;null==r||r.fetch,null!=r&&r.XMLHttpRequest&&"withCredentials"in new r.XMLHttpRequest&&r.XMLHttpRequest,null==r||r.AbortController;var a=null==t?void 0:t.userAgent,u=null!=e?e:{},l={LIB_VERSION:"1.356.2"};function s(){return s=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},s.apply(null,arguments)}function c(e,r){return-1!==e.indexOf(r)}var f=Array.isArray,v=Object.prototype,d=v.hasOwnProperty,h=v.toString,p=f||function(e){return"[object Array]"===h.call(e)},g=e=>e===Object(e)&&!p(e),w=e=>{if(g(e)){for(var r in e)if(d.call(e,r))return!1;return!0}return!1},m=e=>void 0===e,_=e=>m(e)||(e=>null===e)(e),b=e=>"[object Number]"==h.call(e)&&e==e,x=e=>e instanceof FormData;function y(e,r,n,t,i){return r>n&&(t.warn("min cannot be greater than max."),r=n),b(e)?e>n?(t.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e<r?(t.warn(" cannot be less than min: "+r+". Using min value instead."),r):e:(t.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+i),y(n,r,n,t))}class E{constructor(e){this.t={},this.i=e.i,this.o=y(e.bucketSize,0,100,e.u),this.l=y(e.refillRate,0,this.o,e.u),this.v=y(e.refillInterval,0,864e5,e.u)}h(e,r){var n=r-e.lastAccess,t=Math.floor(n/this.v);if(t>0){var i=t*this.l;e.tokens=Math.min(e.tokens+i,this.o),e.lastAccess=e.lastAccess+t*this.v}}consumeRateLimit(e){var r,n=Date.now(),t=String(e),i=this.t[t];return i?this.h(i,n):(i={tokens:this.o,lastAccess:n},this.t[t]=i),0===i.tokens||(i.tokens--,0===i.tokens&&(null==(r=this.i)||r.call(this,e)),0===i.tokens)}stop(){this.t={}}}var R="Mobile",M="iOS",S="Android",k="Tablet",P=S+" "+k,A="iPad",O="Apple",B=O+" Watch",I="Safari",U="BlackBerry",N="Samsung",T=N+"Browser",D=N+" Internet",C="Chrome",F=C+" OS",W=C+" "+M,j="Internet Explorer",z=j+" "+R,L="Opera",K=L+" Mini",V="Edge",G="Microsoft "+V,H="Firefox",X=H+" "+M,q="Nintendo",Y="PlayStation",J="Xbox",Q=S+" "+R,Z=R+" "+I,ee="Windows",re=ee+" Phone",ne="Nokia",te="Ouya",ie="Generic",oe=ie+" "+R.toLowerCase(),ae=ie+" "+k.toLowerCase(),ue="Konqueror",le="(\\d+(\\.\\d+)?)",se=new RegExp("Version/"+le),ce=new RegExp(J,"i"),fe=new RegExp(Y+" \\w+","i"),ve=new RegExp(q+" \\w+","i"),de=new RegExp(U+"|PlayBook|BB10","i"),he={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};var pe=(e,r)=>r&&c(r,O)||function(e){return c(e,I)&&!c(e,C)&&!c(e,S)}(e),ge=function(e,r){return r=r||"",c(e," OPR/")&&c(e,"Mini")?K:c(e," OPR/")?L:de.test(e)?U:c(e,"IE"+R)||c(e,"WPDesktop")?z:c(e,T)?D:c(e,V)||c(e,"Edg/")?G:c(e,"FBIOS")?"Facebook "+R:c(e,"UCWEB")||c(e,"UCBrowser")?"UC Browser":c(e,"CriOS")?W:c(e,"CrMo")||c(e,C)?C:c(e,S)&&c(e,I)?Q:c(e,"FxiOS")?X:c(e.toLowerCase(),ue.toLowerCase())?ue:pe(e,r)?c(e,R)?Z:I:c(e,H)?H:c(e,"MSIE")||c(e,"Trident/")?j:c(e,"Gecko")?H:""},we={[z]:[new RegExp("rv:"+le)],[G]:[new RegExp(V+"?\\/"+le)],[C]:[new RegExp("("+C+"|CrMo)\\/"+le)],[W]:[new RegExp("CriOS\\/"+le)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+le)],[I]:[se],[Z]:[se],[L]:[new RegExp("(Opera|OPR)\\/"+le)],[H]:[new RegExp(H+"\\/"+le)],[X]:[new RegExp("FxiOS\\/"+le)],[ue]:[new RegExp("Konqueror[:/]?"+le,"i")],[U]:[new RegExp(U+" "+le),se],[Q]:[new RegExp("android\\s"+le,"i")],[D]:[new RegExp(T+"\\/"+le)],[j]:[new RegExp("(rv:|MSIE )"+le)],Mozilla:[new RegExp("rv:"+le)]},me=function(e,r){var n=ge(e,r),t=we[n];if(m(t))return null;for(var i=0;i<t.length;i++){var o=t[i],a=e.match(o);if(a)return parseFloat(a[a.length-2])}return null},_e=[[new RegExp(J+"; "+J+" (.*?)[);]","i"),e=>[J,e&&e[1]||""]],[new RegExp(q,"i"),[q,""]],[new RegExp(Y,"i"),[Y,""]],[de,[U,""]],[new RegExp(ee,"i"),(e,r)=>{if(/Phone/.test(r)||/WPDesktop/.test(r))return[re,""];if(new RegExp(R).test(r)&&!/IEMobile\b/.test(r))return[ee+" "+R,""];var n=/Windows NT ([0-9.]+)/i.exec(r);if(n&&n[1]){var t=n[1],i=he[t]||"";return/arm/i.test(r)&&(i="RT"),[ee,i]}return[ee,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var r=[e[3],e[4],e[5]||"0"];return[M,r.join(".")]}return[M,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var r="";return e&&e.length>=3&&(r=m(e[2])?e[3]:e[2]),["watchOS",r]}],[new RegExp("("+S+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+S+")","i"),e=>{if(e&&e[2]){var r=[e[2],e[3],e[4]||"0"];return[S,r.join(".")]}return[S,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var r=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];r[1]=n.join(".")}return r}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[F,""]],[/Linux|debian/i,["Linux",""]]],be=function(e){return ve.test(e)?q:fe.test(e)?Y:ce.test(e)?J:new RegExp(te,"i").test(e)?te:new RegExp("("+re+"|WPDesktop)","i").test(e)?re:/iPad/.test(e)?A:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?B:de.test(e)?U:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ne,"i").test(e)?ne:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(R).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?S:P:new RegExp("(pda|"+R+")","i").test(e)?oe:new RegExp(k,"i").test(e)&&!new RegExp(k+" pc","i").test(e)?ae:""},xe=function(r,n){var{debugEnabled:t}=void 0===n?{}:n,i={p:function(n){if(e&&(u.POSTHOG_DEBUG||t)&&!m(e.console)&&e.console){for(var i=("__rrweb_original__"in e.console[n]?e.console[n].__rrweb_original__:e.console[n]),o=arguments.length,a=new Array(o>1?o-1:0),l=1;l<o;l++)a[l-1]=arguments[l];i(r,...a)}},info:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];i.p("log",...r)},warn:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];i.p("warn",...r)},error:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];i.p("error",...r)},critical:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];console.error(r,...n)},uninitializedWarning:e=>{i.error("You must initialize PostHog before calling "+e)},createLogger:(e,n)=>xe(r+" "+e,n)};return i},ye=xe("[PostHog.js]"),Ee=ye.createLogger,Re={};function $e(e,r,t){if(p(e))if(n&&e.forEach===n)e.forEach(r,t);else if("length"in e&&e.length===+e.length)for(var i=0,o=e.length;i<o;i++)if(i in e&&r.call(t,e[i],i)===Re)return}function Me(e,r,n){if(!_(e)){if(p(e))return $e(e,r,n);if(x(e)){for(var t of e.entries())if(r.call(n,t[1],t[0])===Re)return}else for(var i in e)if(d.call(e,i)&&r.call(n,e[i],i)===Re)return}}var Se=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return $e(n,(function(r){for(var n in r)void 0!==r[n]&&(e[n]=r[n])})),e},ke=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return $e(n,(function(r){$e(r,(function(r){e.push(r)}))})),e},Pe=function(e){var r={};return Me(e,(function(e,n){var t;t=e,("[object String]"==h.call(t)&&e.length>0||b(e))&&(r[n]=e)})),r},Ae=e=>{var r=null==i?void 0:i.createElement("a");return m(r)?null:(r.href=e,r)},Oe=function(e,r){for(var n,t=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<t.length;i++){var o=t[i].split("=");if(o[0]===r){n=o;break}}if(!p(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch(e){ye.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Be=function(e,r,n){if(!e||!r||!r.length)return e;for(var t=e.split("#"),i=t[0]||"",o=t[1],a=i.split("?"),u=a[1],l=a[0],s=(u||"").split("&"),c=[],f=0;f<s.length;f++){var v=s[f].split("=");p(v)&&(r.includes(v[0])?c.push(v[0]+"="+n):c.push(s[f]))}var d=l;return null!=u&&(d+="?"+c.join("&")),null!=o&&(d+="#"+o),d};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return b(e)&&isFinite(e)&&Math.floor(e)===e});var Ie="0123456789abcdef";class Ue{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,r,n,t){if(!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(t)||e<0||r<0||n<0||t<0||e>0xffffffffffff||r>4095||n>1073741823||t>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=e/Math.pow(2,40),i[1]=e/Math.pow(2,32),i[2]=e/Math.pow(2,24),i[3]=e/Math.pow(2,16),i[4]=e/Math.pow(2,8),i[5]=e,i[6]=112|r>>>8,i[7]=r,i[8]=128|n>>>24,i[9]=n>>>16,i[10]=n>>>8,i[11]=n,i[12]=t>>>24,i[13]=t>>>16,i[14]=t>>>8,i[15]=t,new Ue(i)}toString(){for(var e="",r=0;r<this.bytes.length;r++)e=e+Ie.charAt(this.bytes[r]>>>4)+Ie.charAt(15&this.bytes[r]),3!==r&&5!==r&&7!==r&&9!==r||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Ue(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var r=0;r<16;r++){var n=this.bytes[r]-e.bytes[r];if(0!==n)return Math.sign(n)}return 0}}class Ne{constructor(){this.m=0,this.R=0,this.$=new Ce}generate(){var e=this.generateOrAbort();if(m(e)){this.m=0;var r=this.generateOrAbort();if(m(r))throw new Error("Could not generate UUID after timestamp reset");return r}return e}generateOrAbort(){var e=Date.now();if(e>this.m)this.m=e,this.M();else{if(!(e+1e4>this.m))return;this.R++,this.R>4398046511103&&(this.m++,this.M())}return Ue.fromFieldsV7(this.m,Math.trunc(this.R/Math.pow(2,30)),this.R&Math.pow(2,30)-1,this.$.nextUint32())}M(){this.R=1024*this.$.nextUint32()+(1023&this.$.nextUint32())}}var Te,De=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var r=0;r<e.length;r++)e[r]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};e&&!m(e.crypto)&&crypto.getRandomValues&&(De=e=>crypto.getRandomValues(e));class Ce{constructor(){this.S=new Uint32Array(8),this.k=1/0}nextUint32(){return this.k>=this.S.length&&(De(this.S),this.k=0),this.S[this.k++]}}var Fe=()=>We().toString(),We=()=>(Te||(Te=new Ne)).generate(),je="";var ze=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Le(e,r){if(r){var n=function(e,r){if(void 0===r&&(r=i),je)return je;if(!r)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),t=Math.min(n.length,8),o="dmn_chk_"+Fe();!je&&t--;){var a=n.slice(t).join("."),u=o+"=1;domain=."+a+";path=/";r.cookie=u+";max-age=3",r.cookie.includes(o)&&(r.cookie=u+";max-age=0",je=a)}return je}(e);if(!n){var t=(e=>{var r=e.match(ze);return r?r[0]:""})(e);t!==n&&ye.info("Warning: cookie subdomain discovery mismatch",t,n),n=t}return n?"; domain=."+n:""}return""}var Ke={P:()=>!!i,A:function(e){ye.error("cookieStore error: "+e)},O:function(e){if(i){try{for(var r=e+"=",n=i.cookie.split(";").filter((e=>e.length)),t=0;t<n.length;t++){for(var o=n[t];" "==o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(r))return decodeURIComponent(o.substring(r.length,o.length))}}catch(e){}return null}},B:function(e){var r;try{r=JSON.parse(Ke.O(e))||{}}catch(e){}return r},I:function(e,r,n,t,o){if(i)try{var a="",u="",l=Le(i.location.hostname,t);if(n){var s=new Date;s.setTime(s.getTime()+24*n*60*60*1e3),a="; expires="+s.toUTCString()}o&&(u="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(r))+a+"; SameSite=Lax; path=/"+l+u;return c.length>3686.4&&ye.warn("cookieStore warning: large cookie, len="+c.length),i.cookie=c,c}catch(e){return}},U:function(e,r){if(null!=i&&i.cookie)try{Ke.I(e,"",-1,r)}catch(e){return}}},Ve=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ge=ke(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Ve),He=["$app_build","$app_name","$app_namespace","$app_version","$browser","$browser_version","$device_type","$current_url","$pathname","$os","$os_name","$os_version","$referring_domain","$referrer","$screen_height","$screen_width","$viewport_height","$viewport_width","$raw_user_agent"],Xe="<masked>",qe=["li_fat_id"];function Ye(e,r,n){if(!i)return{};var t,o,a,u,l=r?ke([],Ve,n||[]):[],s=(t=Be(i.URL,l,Xe),o=e,a=Ge.concat(o||[]),u={},Me(a,(function(e){var r=Oe(t,e);u[e]=r||null})),u),c=function(){var e={};return Me(qe,(function(r){var n=Ke.O(r);e[r]=n||null})),e}();return Se(c,s)}function Je(){return navigator.language||navigator.userLanguage}function Qe(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Ze(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function er(r,n){var t,i;if(!a)return{};var u,s,c=r?ke([],Ve,n||[]):[],[f,v]=function(e){for(var r=0;r<_e.length;r++){var[n,t]=_e[r],i=n.exec(e),o=i&&("function"==typeof t?t(i,e):t);if(o)return o}return["",""]}(a),d=(u=be(a))===A||u===P||"Kobo"===u||"Kindle Fire"===u||u===ae?k:u===q||u===J||u===Y||u===te?"Console":u===B?"Wearable":u?R:"Desktop";if("Desktop"===d&&"Android"===(null==(t=navigator)||null==(t=t.userAgentData)?void 0:t.platform)&&(null==(i=navigator)?void 0:i.maxTouchPoints)>0){var h,p,g,w,m,_=null!==(h=null==e||null==(p=e.screen)?void 0:p.width)&&void 0!==h?h:0,b=null!==(g=null==e||null==(w=e.screen)?void 0:w.height)&&void 0!==g?g:0;d=Math.min(_,b)/(null!==(m=null==e?void 0:e.devicePixelRatio)&&void 0!==m?m:1)>=600?"Tablet":"Mobile"}return Se(Pe({$os:f,$os_version:v,$browser:ge(a,navigator.vendor),$device:be(a),$device_type:d,$timezone:Qe(),$timezone_offset:Ze()}),{$current_url:Be(null==o?void 0:o.href,c,Xe),$host:null==o?void 0:o.host,$pathname:null==o?void 0:o.pathname,$raw_user_agent:a.length>1e3?a.substring(0,997)+"...":a,$browser_version:me(a,navigator.vendor),$browser_language:Je(),$browser_language_prefix:(s=Je(),"string"==typeof s?s.split("-")[0]:void 0),$screen_height:null==e?void 0:e.screen.height,$screen_width:null==e?void 0:e.screen.width,$viewport_height:null==e?void 0:e.innerHeight,$viewport_width:null==e?void 0:e.innerWidth,$lib:"web",$lib_version:l.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}function rr(e,r){return[...e||[],...p(r)?r:[r]]}function nr(e,r){return(m(e)?1:e)*r}function tr(e,r){return function(e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return Math.abs(r)}(e)%100<y(100*r,0,100,ye)}var ir=["type"];function or(e){var{type:r,executionTimeMs:n}=e;return""+r+(_(n)?"":" ("+n.toFixed(2)+"ms)")}var ar=Ee("[PostHog Action RateLimiting]");function ur(e,r){console.log(e,r)}function lr(e,r,n){if(void 0===n&&(n=5),"object"!=typeof e||"object"!=typeof r)return{};if(e===r)return{};if(!e&&r)return r;if(!r||!e)return{};var t={},i=new Set([...Object.keys(e),...Object.keys(r)]);for(var o of i){var a=e[o],u=r[o];if(m(a))t[o]=u;else if(m(u))t[o]=a;else if(!(a===u||_(a)&&_(u)))if(g(a)&&g(u))if(n>1){var l=lr(a,u,n-1);w(l)||(t[o]=l)}else t[o]="max depth reached, checking for changed value";else t[o]=u}return t}var sr,cr,fr,vr=(sr=null,cr=0,fr=null,{info:e=>{fr!==e&&(cr=0,fr=e),cr++,sr&&clearTimeout(sr),sr=setTimeout((()=>{var r=cr;1===r?ar.info('action "'+e+'" has been rate limited'):ar.info('action "'+e+'" has been rate limited ('+r+" times)"),cr=0,sr=null}),1e3)}});function dr(e){void 0===e&&(e={});var{maskAction:r,maskState:n,titleFunction:t=or,logger:i=ur,include:o={prevState:!0,nextState:!1,changedState:!0},rateLimiterRefillRate:a=1,rateLimiterBucketSize:u=10,__stateComparisonDepth:l}=e,s=new E({refillRate:a,bucketSize:u,refillInterval:1e3,u:ar});return e=>a=>u=>{var c=u,f=e.getState(),v=performance.now(),d=a(c),h=performance.now()-v,p=e.getState(),g=r?r(c):c;if(!g)return d;if(s.consumeRateLimit(c.type))vr.info(c.type);else try{var w=n?n(f,g):f,m=n?n(p,g):p,_=o.changedState?lr(w,m,null!=l?l:5):void 0,{type:b}=g,x={type:b,payload:function(e,r){if(null==e)return{};var n={};for(var t in e)if({}.hasOwnProperty.call(e,t)){if(-1!==r.indexOf(t))continue;n[t]=e[t]}return n}(g,ir),timestamp:Date.now(),executionTimeMs:h,prevState:o.prevState?w:void 0,nextState:o.nextState?m:void 0,changedState:o.changedState?_:void 0},y=t(x);i(y,x)}catch(e){ar.error("Error logging state:",e)}return d}}var hr=Object.freeze({__proto__:null,browserConsoleLogger:ur,posthogKeaLogger:function(e){void 0===e&&(e={});var r=dr(e);return{name:"posthog-kea-logger",events:{beforeReduxStore(e){e.middleware.push(r)}}}},posthogReduxLogger:dr,printAndDropEverything:e=>(console.log("Would have sent event:",e),null),sampleByDistinctId:function(e){return r=>r&&tr(r.properties.distinct_id,e)?s({},r,{properties:s({},r.properties,{$sample_type:["sampleByDistinctId"],$sample_threshold:e})}):null},sampleByEvent:function(e,r){return n=>{var t,i,o;return n?c(e,n.event)?100*Math.random()<y(100*r,0,100,ye)?s({},n,{properties:s({},n.properties,{$sample_type:rr(null==(t=n.properties)?void 0:t.$sample_type,"sampleByEvent"),$sample_threshold:nr(null==(i=n.properties)?void 0:i.$sample_threshold,r),$sampled_events:rr(null==(o=n.properties)?void 0:o.$sampled_events,e)})}):null:n:null}},sampleBySessionId:function(e){return r=>r&&tr(r.properties.$session_id,e)?s({},r,{properties:s({},r.properties,{$sample_type:rr(r.properties.$sample_type,"sampleBySessionId"),$sample_threshold:nr(r.properties.$sample_threshold,e)})}):null},sessionRecordingLoggerForPostHogInstance:e=>(r,n)=>{var t;null==e||null==(t=e.sessionRecording)||t.tryAddCustomEvent("app-state",{title:r,stateEvent:n})},setAllPersonProfilePropertiesAsPersonPropertiesForFlags:e=>{var r,n=Se({},er(e.config.mask_personal_data_properties,e.config.custom_personal_data_properties),Ye(e.config.custom_campaign_params,e.config.mask_personal_data_properties,e.config.custom_personal_data_properties),{$referrer:(null==i?void 0:i.referrer)||"$direct",$referring_domain:null!=i&&i.referrer&&(null==(r=Ae(i.referrer))?void 0:r.host)||"$direct"}),t={};Me(n,(function(e,r){(c(Ge,r)||c(He,r))&&(t[r]=e)})),e.setPersonPropertiesForFlags(t)}});u.posthogCustomizations=hr}(); | ||
| !function(){"use strict";var e="undefined"!=typeof window?window:void 0,r="undefined"!=typeof globalThis?globalThis:e;"undefined"==typeof self&&(r.self=r),"undefined"==typeof File&&(r.File=function(){});var n=Array.prototype.forEach,t=null==r?void 0:r.navigator,i=null==r?void 0:r.document,o=null==r?void 0:r.location;null==r||r.fetch,null!=r&&r.XMLHttpRequest&&"withCredentials"in new r.XMLHttpRequest&&r.XMLHttpRequest,null==r||r.AbortController;var a=null==t?void 0:t.userAgent,u=null!=e?e:{},l={LIB_VERSION:"1.357.0"};function s(){return s=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},s.apply(null,arguments)}function c(e,r){return-1!==e.indexOf(r)}var f=Array.isArray,v=Object.prototype,d=v.hasOwnProperty,h=v.toString,p=f||function(e){return"[object Array]"===h.call(e)},g=e=>e===Object(e)&&!p(e),w=e=>{if(g(e)){for(var r in e)if(d.call(e,r))return!1;return!0}return!1},m=e=>void 0===e,_=e=>m(e)||(e=>null===e)(e),b=e=>"[object Number]"==h.call(e)&&e==e,x=e=>e instanceof FormData;function y(e,r,n,t,i){return r>n&&(t.warn("min cannot be greater than max."),r=n),b(e)?e>n?(t.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e<r?(t.warn(" cannot be less than min: "+r+". Using min value instead."),r):e:(t.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+i),y(n,r,n,t))}class E{constructor(e){this.t={},this.i=e.i,this.o=y(e.bucketSize,0,100,e.u),this.l=y(e.refillRate,0,this.o,e.u),this.v=y(e.refillInterval,0,864e5,e.u)}h(e,r){var n=r-e.lastAccess,t=Math.floor(n/this.v);if(t>0){var i=t*this.l;e.tokens=Math.min(e.tokens+i,this.o),e.lastAccess=e.lastAccess+t*this.v}}consumeRateLimit(e){var r,n=Date.now(),t=String(e),i=this.t[t];return i?this.h(i,n):(i={tokens:this.o,lastAccess:n},this.t[t]=i),0===i.tokens||(i.tokens--,0===i.tokens&&(null==(r=this.i)||r.call(this,e)),0===i.tokens)}stop(){this.t={}}}var R="Mobile",M="iOS",S="Android",k="Tablet",P=S+" "+k,A="iPad",O="Apple",B=O+" Watch",I="Safari",U="BlackBerry",N="Samsung",T=N+"Browser",D=N+" Internet",C="Chrome",F=C+" OS",W=C+" "+M,j="Internet Explorer",z=j+" "+R,L="Opera",K=L+" Mini",V="Edge",G="Microsoft "+V,H="Firefox",X=H+" "+M,q="Nintendo",Y="PlayStation",J="Xbox",Q=S+" "+R,Z=R+" "+I,ee="Windows",re=ee+" Phone",ne="Nokia",te="Ouya",ie="Generic",oe=ie+" "+R.toLowerCase(),ae=ie+" "+k.toLowerCase(),ue="Konqueror",le="(\\d+(\\.\\d+)?)",se=new RegExp("Version/"+le),ce=new RegExp(J,"i"),fe=new RegExp(Y+" \\w+","i"),ve=new RegExp(q+" \\w+","i"),de=new RegExp(U+"|PlayBook|BB10","i"),he={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};var pe=(e,r)=>r&&c(r,O)||function(e){return c(e,I)&&!c(e,C)&&!c(e,S)}(e),ge=function(e,r){return r=r||"",c(e," OPR/")&&c(e,"Mini")?K:c(e," OPR/")?L:de.test(e)?U:c(e,"IE"+R)||c(e,"WPDesktop")?z:c(e,T)?D:c(e,V)||c(e,"Edg/")?G:c(e,"FBIOS")?"Facebook "+R:c(e,"UCWEB")||c(e,"UCBrowser")?"UC Browser":c(e,"CriOS")?W:c(e,"CrMo")||c(e,C)?C:c(e,S)&&c(e,I)?Q:c(e,"FxiOS")?X:c(e.toLowerCase(),ue.toLowerCase())?ue:pe(e,r)?c(e,R)?Z:I:c(e,H)?H:c(e,"MSIE")||c(e,"Trident/")?j:c(e,"Gecko")?H:""},we={[z]:[new RegExp("rv:"+le)],[G]:[new RegExp(V+"?\\/"+le)],[C]:[new RegExp("("+C+"|CrMo)\\/"+le)],[W]:[new RegExp("CriOS\\/"+le)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+le)],[I]:[se],[Z]:[se],[L]:[new RegExp("(Opera|OPR)\\/"+le)],[H]:[new RegExp(H+"\\/"+le)],[X]:[new RegExp("FxiOS\\/"+le)],[ue]:[new RegExp("Konqueror[:/]?"+le,"i")],[U]:[new RegExp(U+" "+le),se],[Q]:[new RegExp("android\\s"+le,"i")],[D]:[new RegExp(T+"\\/"+le)],[j]:[new RegExp("(rv:|MSIE )"+le)],Mozilla:[new RegExp("rv:"+le)]},me=function(e,r){var n=ge(e,r),t=we[n];if(m(t))return null;for(var i=0;i<t.length;i++){var o=t[i],a=e.match(o);if(a)return parseFloat(a[a.length-2])}return null},_e=[[new RegExp(J+"; "+J+" (.*?)[);]","i"),e=>[J,e&&e[1]||""]],[new RegExp(q,"i"),[q,""]],[new RegExp(Y,"i"),[Y,""]],[de,[U,""]],[new RegExp(ee,"i"),(e,r)=>{if(/Phone/.test(r)||/WPDesktop/.test(r))return[re,""];if(new RegExp(R).test(r)&&!/IEMobile\b/.test(r))return[ee+" "+R,""];var n=/Windows NT ([0-9.]+)/i.exec(r);if(n&&n[1]){var t=n[1],i=he[t]||"";return/arm/i.test(r)&&(i="RT"),[ee,i]}return[ee,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var r=[e[3],e[4],e[5]||"0"];return[M,r.join(".")]}return[M,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var r="";return e&&e.length>=3&&(r=m(e[2])?e[3]:e[2]),["watchOS",r]}],[new RegExp("("+S+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+S+")","i"),e=>{if(e&&e[2]){var r=[e[2],e[3],e[4]||"0"];return[S,r.join(".")]}return[S,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var r=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];r[1]=n.join(".")}return r}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[F,""]],[/Linux|debian/i,["Linux",""]]],be=function(e){return ve.test(e)?q:fe.test(e)?Y:ce.test(e)?J:new RegExp(te,"i").test(e)?te:new RegExp("("+re+"|WPDesktop)","i").test(e)?re:/iPad/.test(e)?A:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?B:de.test(e)?U:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ne,"i").test(e)?ne:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(R).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?S:P:new RegExp("(pda|"+R+")","i").test(e)?oe:new RegExp(k,"i").test(e)&&!new RegExp(k+" pc","i").test(e)?ae:""},xe=function(r,n){var{debugEnabled:t}=void 0===n?{}:n,i={p:function(n){if(e&&(u.POSTHOG_DEBUG||t)&&!m(e.console)&&e.console){for(var i=("__rrweb_original__"in e.console[n]?e.console[n].__rrweb_original__:e.console[n]),o=arguments.length,a=new Array(o>1?o-1:0),l=1;l<o;l++)a[l-1]=arguments[l];i(r,...a)}},info:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];i.p("log",...r)},warn:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];i.p("warn",...r)},error:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];i.p("error",...r)},critical:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];console.error(r,...n)},uninitializedWarning:e=>{i.error("You must initialize PostHog before calling "+e)},createLogger:(e,n)=>xe(r+" "+e,n)};return i},ye=xe("[PostHog.js]"),Ee=ye.createLogger,Re={};function $e(e,r,t){if(p(e))if(n&&e.forEach===n)e.forEach(r,t);else if("length"in e&&e.length===+e.length)for(var i=0,o=e.length;i<o;i++)if(i in e&&r.call(t,e[i],i)===Re)return}function Me(e,r,n){if(!_(e)){if(p(e))return $e(e,r,n);if(x(e)){for(var t of e.entries())if(r.call(n,t[1],t[0])===Re)return}else for(var i in e)if(d.call(e,i)&&r.call(n,e[i],i)===Re)return}}var Se=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return $e(n,(function(r){for(var n in r)void 0!==r[n]&&(e[n]=r[n])})),e},ke=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return $e(n,(function(r){$e(r,(function(r){e.push(r)}))})),e},Pe=function(e){var r={};return Me(e,(function(e,n){var t;t=e,("[object String]"==h.call(t)&&e.length>0||b(e))&&(r[n]=e)})),r},Ae=e=>{var r=null==i?void 0:i.createElement("a");return m(r)?null:(r.href=e,r)},Oe=function(e,r){for(var n,t=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<t.length;i++){var o=t[i].split("=");if(o[0]===r){n=o;break}}if(!p(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch(e){ye.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Be=function(e,r,n){if(!e||!r||!r.length)return e;for(var t=e.split("#"),i=t[0]||"",o=t[1],a=i.split("?"),u=a[1],l=a[0],s=(u||"").split("&"),c=[],f=0;f<s.length;f++){var v=s[f].split("=");p(v)&&(r.includes(v[0])?c.push(v[0]+"="+n):c.push(s[f]))}var d=l;return null!=u&&(d+="?"+c.join("&")),null!=o&&(d+="#"+o),d};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return b(e)&&isFinite(e)&&Math.floor(e)===e});var Ie="0123456789abcdef";class Ue{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,r,n,t){if(!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(t)||e<0||r<0||n<0||t<0||e>0xffffffffffff||r>4095||n>1073741823||t>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=e/Math.pow(2,40),i[1]=e/Math.pow(2,32),i[2]=e/Math.pow(2,24),i[3]=e/Math.pow(2,16),i[4]=e/Math.pow(2,8),i[5]=e,i[6]=112|r>>>8,i[7]=r,i[8]=128|n>>>24,i[9]=n>>>16,i[10]=n>>>8,i[11]=n,i[12]=t>>>24,i[13]=t>>>16,i[14]=t>>>8,i[15]=t,new Ue(i)}toString(){for(var e="",r=0;r<this.bytes.length;r++)e=e+Ie.charAt(this.bytes[r]>>>4)+Ie.charAt(15&this.bytes[r]),3!==r&&5!==r&&7!==r&&9!==r||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Ue(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var r=0;r<16;r++){var n=this.bytes[r]-e.bytes[r];if(0!==n)return Math.sign(n)}return 0}}class Ne{constructor(){this.m=0,this.R=0,this.$=new Ce}generate(){var e=this.generateOrAbort();if(m(e)){this.m=0;var r=this.generateOrAbort();if(m(r))throw new Error("Could not generate UUID after timestamp reset");return r}return e}generateOrAbort(){var e=Date.now();if(e>this.m)this.m=e,this.M();else{if(!(e+1e4>this.m))return;this.R++,this.R>4398046511103&&(this.m++,this.M())}return Ue.fromFieldsV7(this.m,Math.trunc(this.R/Math.pow(2,30)),this.R&Math.pow(2,30)-1,this.$.nextUint32())}M(){this.R=1024*this.$.nextUint32()+(1023&this.$.nextUint32())}}var Te,De=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var r=0;r<e.length;r++)e[r]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};e&&!m(e.crypto)&&crypto.getRandomValues&&(De=e=>crypto.getRandomValues(e));class Ce{constructor(){this.S=new Uint32Array(8),this.k=1/0}nextUint32(){return this.k>=this.S.length&&(De(this.S),this.k=0),this.S[this.k++]}}var Fe=()=>We().toString(),We=()=>(Te||(Te=new Ne)).generate(),je="";var ze=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Le(e,r){if(r){var n=function(e,r){if(void 0===r&&(r=i),je)return je;if(!r)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),t=Math.min(n.length,8),o="dmn_chk_"+Fe();!je&&t--;){var a=n.slice(t).join("."),u=o+"=1;domain=."+a+";path=/";r.cookie=u+";max-age=3",r.cookie.includes(o)&&(r.cookie=u+";max-age=0",je=a)}return je}(e);if(!n){var t=(e=>{var r=e.match(ze);return r?r[0]:""})(e);t!==n&&ye.info("Warning: cookie subdomain discovery mismatch",t,n),n=t}return n?"; domain=."+n:""}return""}var Ke={P:()=>!!i,A:function(e){ye.error("cookieStore error: "+e)},O:function(e){if(i){try{for(var r=e+"=",n=i.cookie.split(";").filter((e=>e.length)),t=0;t<n.length;t++){for(var o=n[t];" "==o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(r))return decodeURIComponent(o.substring(r.length,o.length))}}catch(e){}return null}},B:function(e){var r;try{r=JSON.parse(Ke.O(e))||{}}catch(e){}return r},I:function(e,r,n,t,o){if(i)try{var a="",u="",l=Le(i.location.hostname,t);if(n){var s=new Date;s.setTime(s.getTime()+24*n*60*60*1e3),a="; expires="+s.toUTCString()}o&&(u="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(r))+a+"; SameSite=Lax; path=/"+l+u;return c.length>3686.4&&ye.warn("cookieStore warning: large cookie, len="+c.length),i.cookie=c,c}catch(e){return}},U:function(e,r){if(null!=i&&i.cookie)try{Ke.I(e,"",-1,r)}catch(e){return}}},Ve=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ge=ke(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Ve),He=["$app_build","$app_name","$app_namespace","$app_version","$browser","$browser_version","$device_type","$current_url","$pathname","$os","$os_name","$os_version","$referring_domain","$referrer","$screen_height","$screen_width","$viewport_height","$viewport_width","$raw_user_agent"],Xe="<masked>",qe=["li_fat_id"];function Ye(e,r,n){if(!i)return{};var t,o,a,u,l=r?ke([],Ve,n||[]):[],s=(t=Be(i.URL,l,Xe),o=e,a=Ge.concat(o||[]),u={},Me(a,(function(e){var r=Oe(t,e);u[e]=r||null})),u),c=function(){var e={};return Me(qe,(function(r){var n=Ke.O(r);e[r]=n||null})),e}();return Se(c,s)}function Je(){return navigator.language||navigator.userLanguage}function Qe(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Ze(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function er(r,n){var t,i;if(!a)return{};var u,s,c=r?ke([],Ve,n||[]):[],[f,v]=function(e){for(var r=0;r<_e.length;r++){var[n,t]=_e[r],i=n.exec(e),o=i&&("function"==typeof t?t(i,e):t);if(o)return o}return["",""]}(a),d=(u=be(a))===A||u===P||"Kobo"===u||"Kindle Fire"===u||u===ae?k:u===q||u===J||u===Y||u===te?"Console":u===B?"Wearable":u?R:"Desktop";if("Desktop"===d&&"Android"===(null==(t=navigator)||null==(t=t.userAgentData)?void 0:t.platform)&&(null==(i=navigator)?void 0:i.maxTouchPoints)>0){var h,p,g,w,m,_=null!==(h=null==e||null==(p=e.screen)?void 0:p.width)&&void 0!==h?h:0,b=null!==(g=null==e||null==(w=e.screen)?void 0:w.height)&&void 0!==g?g:0;d=Math.min(_,b)/(null!==(m=null==e?void 0:e.devicePixelRatio)&&void 0!==m?m:1)>=600?"Tablet":"Mobile"}return Se(Pe({$os:f,$os_version:v,$browser:ge(a,navigator.vendor),$device:be(a),$device_type:d,$timezone:Qe(),$timezone_offset:Ze()}),{$current_url:Be(null==o?void 0:o.href,c,Xe),$host:null==o?void 0:o.host,$pathname:null==o?void 0:o.pathname,$raw_user_agent:a.length>1e3?a.substring(0,997)+"...":a,$browser_version:me(a,navigator.vendor),$browser_language:Je(),$browser_language_prefix:(s=Je(),"string"==typeof s?s.split("-")[0]:void 0),$screen_height:null==e?void 0:e.screen.height,$screen_width:null==e?void 0:e.screen.width,$viewport_height:null==e?void 0:e.innerHeight,$viewport_width:null==e?void 0:e.innerWidth,$lib:"web",$lib_version:l.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}function rr(e,r){return[...e||[],...p(r)?r:[r]]}function nr(e,r){return(m(e)?1:e)*r}function tr(e,r){return function(e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return Math.abs(r)}(e)%100<y(100*r,0,100,ye)}var ir=["type"];function or(e){var{type:r,executionTimeMs:n}=e;return""+r+(_(n)?"":" ("+n.toFixed(2)+"ms)")}var ar=Ee("[PostHog Action RateLimiting]");function ur(e,r){console.log(e,r)}function lr(e,r,n){if(void 0===n&&(n=5),"object"!=typeof e||"object"!=typeof r)return{};if(e===r)return{};if(!e&&r)return r;if(!r||!e)return{};var t={},i=new Set([...Object.keys(e),...Object.keys(r)]);for(var o of i){var a=e[o],u=r[o];if(m(a))t[o]=u;else if(m(u))t[o]=a;else if(!(a===u||_(a)&&_(u)))if(g(a)&&g(u))if(n>1){var l=lr(a,u,n-1);w(l)||(t[o]=l)}else t[o]="max depth reached, checking for changed value";else t[o]=u}return t}var sr,cr,fr,vr=(sr=null,cr=0,fr=null,{info:e=>{fr!==e&&(cr=0,fr=e),cr++,sr&&clearTimeout(sr),sr=setTimeout((()=>{var r=cr;1===r?ar.info('action "'+e+'" has been rate limited'):ar.info('action "'+e+'" has been rate limited ('+r+" times)"),cr=0,sr=null}),1e3)}});function dr(e){void 0===e&&(e={});var{maskAction:r,maskState:n,titleFunction:t=or,logger:i=ur,include:o={prevState:!0,nextState:!1,changedState:!0},rateLimiterRefillRate:a=1,rateLimiterBucketSize:u=10,__stateComparisonDepth:l}=e,s=new E({refillRate:a,bucketSize:u,refillInterval:1e3,u:ar});return e=>a=>u=>{var c=u,f=e.getState(),v=performance.now(),d=a(c),h=performance.now()-v,p=e.getState(),g=r?r(c):c;if(!g)return d;if(s.consumeRateLimit(c.type))vr.info(c.type);else try{var w=n?n(f,g):f,m=n?n(p,g):p,_=o.changedState?lr(w,m,null!=l?l:5):void 0,{type:b}=g,x={type:b,payload:function(e,r){if(null==e)return{};var n={};for(var t in e)if({}.hasOwnProperty.call(e,t)){if(-1!==r.indexOf(t))continue;n[t]=e[t]}return n}(g,ir),timestamp:Date.now(),executionTimeMs:h,prevState:o.prevState?w:void 0,nextState:o.nextState?m:void 0,changedState:o.changedState?_:void 0},y=t(x);i(y,x)}catch(e){ar.error("Error logging state:",e)}return d}}var hr=Object.freeze({__proto__:null,browserConsoleLogger:ur,posthogKeaLogger:function(e){void 0===e&&(e={});var r=dr(e);return{name:"posthog-kea-logger",events:{beforeReduxStore(e){e.middleware.push(r)}}}},posthogReduxLogger:dr,printAndDropEverything:e=>(console.log("Would have sent event:",e),null),sampleByDistinctId:function(e){return r=>r&&tr(r.properties.distinct_id,e)?s({},r,{properties:s({},r.properties,{$sample_type:["sampleByDistinctId"],$sample_threshold:e})}):null},sampleByEvent:function(e,r){return n=>{var t,i,o;return n?c(e,n.event)?100*Math.random()<y(100*r,0,100,ye)?s({},n,{properties:s({},n.properties,{$sample_type:rr(null==(t=n.properties)?void 0:t.$sample_type,"sampleByEvent"),$sample_threshold:nr(null==(i=n.properties)?void 0:i.$sample_threshold,r),$sampled_events:rr(null==(o=n.properties)?void 0:o.$sampled_events,e)})}):null:n:null}},sampleBySessionId:function(e){return r=>r&&tr(r.properties.$session_id,e)?s({},r,{properties:s({},r.properties,{$sample_type:rr(r.properties.$sample_type,"sampleBySessionId"),$sample_threshold:nr(r.properties.$sample_threshold,e)})}):null},sessionRecordingLoggerForPostHogInstance:e=>(r,n)=>{var t;null==e||null==(t=e.sessionRecording)||t.tryAddCustomEvent("app-state",{title:r,stateEvent:n})},setAllPersonProfilePropertiesAsPersonPropertiesForFlags:e=>{var r,n=Se({},er(e.config.mask_personal_data_properties,e.config.custom_personal_data_properties),Ye(e.config.custom_campaign_params,e.config.mask_personal_data_properties,e.config.custom_personal_data_properties),{$referrer:(null==i?void 0:i.referrer)||"$direct",$referring_domain:null!=i&&i.referrer&&(null==(r=Ae(i.referrer))?void 0:r.host)||"$direct"}),t={};Me(n,(function(e,r){(c(Ge,r)||c(He,r))&&(t[r]=e)})),e.setPersonPropertiesForFlags(t)}});u.posthogCustomizations=hr}(); | ||
| //# sourceMappingURL=customizations.full.js.map |
@@ -31,2 +31,3 @@ import { PostHog } from '../../posthog-core'; | ||
| private _resetSampling; | ||
| private _validateSampleRate; | ||
| private _persistRemoteConfig; | ||
@@ -33,0 +34,0 @@ onRemoteConfig(response: RemoteConfig): void; |
+4
-4
| { | ||
| "name": "posthog-js", | ||
| "version": "1.356.2", | ||
| "version": "1.357.0", | ||
| "description": "Posthog-js allows you to automatically capture usage and send events to PostHog.", | ||
@@ -81,5 +81,5 @@ "repository": "https://github.com/PostHog/posthog-js", | ||
| "@posthog-tooling/rollup-utils": "workspace:*", | ||
| "@posthog/rrweb-plugin-console-record": "^0.0.44", | ||
| "@posthog/rrweb-record": "^0.0.44", | ||
| "@posthog/rrweb-types": "^0.0.44", | ||
| "@posthog/rrweb-plugin-console-record": "^0.0.45", | ||
| "@posthog/rrweb-record": "^0.0.45", | ||
| "@posthog/rrweb-types": "^0.0.45", | ||
| "@rollup/plugin-babel": "^6.0.4", | ||
@@ -86,0 +86,0 @@ "@rollup/plugin-commonjs": "^28.0.6", |
@@ -31,2 +31,3 @@ import { PostHog } from '../../posthog-core'; | ||
| private _resetSampling; | ||
| private _validateSampleRate; | ||
| private _persistRemoteConfig; | ||
@@ -33,0 +34,0 @@ onRemoteConfig(response: RemoteConfig): void; |
@@ -144,2 +144,13 @@ "use strict"; | ||
| }; | ||
| SessionRecording.prototype._validateSampleRate = function (rate, source) { | ||
| if ((0, core_1.isNullish)(rate)) { | ||
| return null; | ||
| } | ||
| var parsed = (0, core_1.isNumber)(rate) ? rate : parseFloat(rate); | ||
| if (!(0, core_1.isValidSampleRate)(parsed)) { | ||
| logger.warn("".concat(source, " must be between 0 and 1. Ignoring invalid value:"), rate); | ||
| return null; | ||
| } | ||
| return parsed; | ||
| }; | ||
| SessionRecording.prototype._persistRemoteConfig = function (response) { | ||
@@ -152,5 +163,7 @@ var _this = this; | ||
| var _a; | ||
| var _b; | ||
| var sessionRecordingConfigResponse = response.sessionRecording === false ? undefined : response.sessionRecording; | ||
| var receivedSampleRate = sessionRecordingConfigResponse === null || sessionRecordingConfigResponse === void 0 ? void 0 : sessionRecordingConfigResponse.sampleRate; | ||
| var parsedSampleRate = (0, core_1.isNullish)(receivedSampleRate) ? null : parseFloat(receivedSampleRate); | ||
| var localSampleRate = _this._validateSampleRate((_b = _this._instance.config.session_recording) === null || _b === void 0 ? void 0 : _b.sampleRate, 'session_recording.sampleRate'); | ||
| var remoteSampleRate = _this._validateSampleRate(sessionRecordingConfigResponse === null || sessionRecordingConfigResponse === void 0 ? void 0 : sessionRecordingConfigResponse.sampleRate, 'remote config sampleRate'); | ||
| var parsedSampleRate = localSampleRate !== null && localSampleRate !== void 0 ? localSampleRate : remoteSampleRate; | ||
| if ((0, core_1.isNullish)(parsedSampleRate)) { | ||
@@ -157,0 +170,0 @@ _this._resetSampling(); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"session-recording.js","sourceRoot":"","sources":["../../../../src/extensions/replay/session-recording.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,6CAOwB;AAExB,qDAAwD;AAIxD,sCAAsD;AACtD,6CAAiD;AACjD,+CAK4B;AAC5B,wFAAwF;AACxF,8DAAwH;AAExH,IAAM,aAAa,GAAG,oBAAoB,CAAA;AAC1C,IAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,aAAa,CAAC,CAAA;AAE1C;IAkCI,0BAA6B,SAAkB;QAAlB,cAAS,GAAT,SAAS,CAAS;QAjC/C,uCAAkC,GAAY,KAAK,CAAA;QAE3C,mBAAc,GAAY,KAAK,CAAA;QAC/B,+BAA0B,GA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;;YACI,OAAO,CACH,CAAA,MAAA,IAAI,CAAC,2BAA2B,0CAAE,kBAAkB,KAAI;gBACpD,iBAAiB,EAAE,IAAI,CAAC,MAAM;aACjC,CACJ,CAAA;QACL,CAAC;;;OAAA;IAED;;;;;;;OAOG;IACH,4CAAiB,GAAjB,UAAkB,GAAW,EAAE,OAAY;;QACvC,OAAO,CAAC,CAAC,CAAA,MAAA,IAAI,CAAC,2BAA2B,0CAAE,iBAAiB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA,CAAA;IAC9E,CAAC;IACL,uBAAC;AAAD,CAAC,AAtUD,IAsUC;AAtUY,4CAAgB","sourcesContent":["import {\n SESSION_RECORDING_IS_SAMPLED,\n SESSION_RECORDING_OVERRIDE_SAMPLING,\n SESSION_RECORDING_OVERRIDE_LINKED_FLAG,\n SESSION_RECORDING_OVERRIDE_EVENT_TRIGGER,\n SESSION_RECORDING_OVERRIDE_URL_TRIGGER,\n SESSION_RECORDING_REMOTE_CONFIG,\n} from '../../constants'\nimport { PostHog } from '../../posthog-core'\nimport { RemoteConfigLoader } from '../../remote-config'\nimport { Properties, RemoteConfig, SessionRecordingPersistedConfig, SessionStartReason } from '../../types'\nimport { type eventWithTime } from './types/rrweb-types'\n\nimport { isNullish, isUndefined } from '@posthog/core'\nimport { createLogger } from '../../utils/logger'\nimport {\n assignableWindow,\n LazyLoadedSessionRecordingInterface,\n PostHogExtensionKind,\n window,\n} from '../../utils/globals'\nimport { RECORDING_REMOTE_CONFIG_TTL_MS } from './external/lazy-loaded-session-recorder'\nimport { DISABLED, LAZY_LOADING, PENDING_CONFIG, SessionRecordingStatus, TriggerType } from './external/triggerMatching'\n\nconst LOGGER_PREFIX = '[SessionRecording]'\nconst logger = createLogger(LOGGER_PREFIX)\n\nexport class SessionRecording {\n _forceAllowLocalhostNetworkCapture: boolean = false\n\n private _receivedFlags: boolean = false\n private _hasRequestedConfigRefresh: boolean = false\n\n private _persistFlagsOnSessionListener: (() => void) | undefined = undefined\n private _lazyLoadedSessionRecording: LazyLoadedSessionRecordingInterface | undefined\n\n public get started(): boolean {\n return !!this._lazyLoadedSessionRecording?.isStarted\n }\n\n /**\n * defaults to pending_config until a remote config response is received\n * transitions to lazy_loading while the recording script is being loaded\n * once loaded, status is delegated to the lazy-loaded recorder (active, buffering, disabled, etc.)\n */\n get status(): SessionRecordingStatus {\n if (this._lazyLoadedSessionRecording) {\n return this._lazyLoadedSessionRecording.status\n }\n\n if (!this._receivedFlags) {\n return PENDING_CONFIG\n }\n\n if (!this._isRecordingEnabled) {\n return DISABLED\n }\n\n return LAZY_LOADING\n }\n\n constructor(private readonly _instance: PostHog) {\n if (!this._instance.sessionManager) {\n logger.error('started without valid sessionManager')\n throw new Error(LOGGER_PREFIX + ' started without valid sessionManager. This is a bug.')\n }\n\n if (this._instance.config.cookieless_mode === 'always') {\n throw new Error(LOGGER_PREFIX + ' cannot be used with cookieless_mode=\"always\"')\n }\n }\n\n private get _isRecordingEnabled() {\n const enabled_server_side = !!this._instance.get_property(SESSION_RECORDING_REMOTE_CONFIG)?.enabled\n const enabled_client_side = !this._instance.config.disable_session_recording\n const isDisabled = this._instance.config.disable_session_recording || this._instance.consent.isOptedOut()\n return window && enabled_server_side && enabled_client_side && !isDisabled\n }\n\n startIfEnabledOrStop(startReason?: SessionStartReason) {\n // Wait for fresh remote config before starting recording\n if (!this._receivedFlags) {\n return\n }\n\n if (this._isRecordingEnabled && this._lazyLoadedSessionRecording?.isStarted) {\n return\n }\n\n // According to the rrweb docs, rrweb is not supported on IE11 and below:\n // \"rrweb does not support IE11 and below because it uses the MutationObserver API, which was supported by these browsers.\"\n // https://github.com/rrweb-io/rrweb/blob/master/guide.md#compatibility-note\n //\n // However, MutationObserver does exist on IE11, it just doesn't work well and does not detect all changes.\n // Instead, when we load \"recorder.js\", the first JS error is about \"Object.assign\" and \"Array.from\" being undefined.\n // Thus instead of MutationObserver, we look for this function and block recording if it's undefined.\n const canRunReplay = !isUndefined(Object.assign) && !isUndefined(Array.from)\n if (this._isRecordingEnabled && canRunReplay) {\n this._lazyLoadAndStart(startReason)\n logger.info('starting')\n } else {\n this.stopRecording()\n }\n }\n\n /**\n * session recording waits until it receives remote config before loading the script\n * this is to ensure we can control the script name remotely\n * and because we wait until we have local and remote config to determine if we should start at all\n * if start is called and there is no remote config then we wait until there is\n */\n private _lazyLoadAndStart(startReason?: SessionStartReason) {\n // by checking `_isRecordingEnabled` here we know that\n // we have stored remote config and client config to read\n // replay waits for both local and remote config before starting\n if (!this._isRecordingEnabled) {\n return\n }\n\n // If recorder.js is already loaded (if array.full.js snippet is used or posthog-js/dist/recorder is\n // imported), don't load the script. Otherwise, remotely import recorder.js from cdn since it hasn't been loaded.\n if (\n !assignableWindow?.__PosthogExtensions__?.rrweb?.record ||\n !assignableWindow.__PosthogExtensions__?.initSessionRecording\n ) {\n assignableWindow.__PosthogExtensions__?.loadExternalDependency?.(\n this._instance,\n this._scriptName,\n (err) => {\n if (err) {\n return logger.error('could not load recorder', err)\n }\n this._onScriptLoaded(startReason)\n }\n )\n } else {\n this._onScriptLoaded(startReason)\n }\n }\n\n stopRecording() {\n this._persistFlagsOnSessionListener?.()\n this._persistFlagsOnSessionListener = undefined\n this._lazyLoadedSessionRecording?.stop()\n }\n\n private _resetSampling() {\n this._instance.persistence?.unregister(SESSION_RECORDING_IS_SAMPLED)\n }\n\n private _persistRemoteConfig(response: RemoteConfig): void {\n if (this._instance.persistence) {\n const persistence = this._instance.persistence\n\n const persistResponse = () => {\n const sessionRecordingConfigResponse =\n response.sessionRecording === false ? undefined : response.sessionRecording\n\n const receivedSampleRate = sessionRecordingConfigResponse?.sampleRate\n\n const parsedSampleRate = isNullish(receivedSampleRate) ? null : parseFloat(receivedSampleRate)\n if (isNullish(parsedSampleRate)) {\n this._resetSampling()\n }\n\n const receivedMinimumDuration = sessionRecordingConfigResponse?.minimumDurationMilliseconds\n\n persistence.register({\n [SESSION_RECORDING_REMOTE_CONFIG]: {\n cache_timestamp: Date.now(),\n enabled: !!sessionRecordingConfigResponse,\n ...sessionRecordingConfigResponse,\n networkPayloadCapture: {\n capturePerformance: response.capturePerformance,\n ...sessionRecordingConfigResponse?.networkPayloadCapture,\n },\n canvasRecording: {\n enabled: sessionRecordingConfigResponse?.recordCanvas,\n fps: sessionRecordingConfigResponse?.canvasFps,\n quality: sessionRecordingConfigResponse?.canvasQuality,\n },\n sampleRate: parsedSampleRate,\n minimumDurationMilliseconds: isUndefined(receivedMinimumDuration)\n ? null\n : receivedMinimumDuration,\n endpoint: sessionRecordingConfigResponse?.endpoint,\n triggerMatchType: sessionRecordingConfigResponse?.triggerMatchType,\n masking: sessionRecordingConfigResponse?.masking,\n urlTriggers: sessionRecordingConfigResponse?.urlTriggers,\n } satisfies SessionRecordingPersistedConfig,\n })\n }\n\n persistResponse()\n\n // in case we see multiple flags responses, we should only use the response from the most recent one\n this._persistFlagsOnSessionListener?.()\n // we 100% know there is a session manager by this point\n this._persistFlagsOnSessionListener = this._instance.sessionManager?.onSessionId(persistResponse)\n }\n }\n\n onRemoteConfig(response: RemoteConfig) {\n if (!('sessionRecording' in response)) {\n // if sessionRecording is not in the response, we do nothing\n logger.info('skipping remote config with no sessionRecording', response)\n return\n }\n if (response.sessionRecording === false) {\n // remotely disabled\n this._receivedFlags = true\n return\n }\n\n this._hasRequestedConfigRefresh = false\n this._persistRemoteConfig(response)\n this._receivedFlags = true\n this.startIfEnabledOrStop()\n }\n\n log(message: string, level: 'log' | 'warn' | 'error' = 'log') {\n if (this._lazyLoadedSessionRecording?.log) {\n this._lazyLoadedSessionRecording.log(message, level)\n } else {\n logger.warn('log called before recorder was ready')\n }\n }\n\n private get _scriptName(): PostHogExtensionKind {\n const remoteConfig: SessionRecordingPersistedConfig | undefined = this._instance?.persistence?.get_property(\n SESSION_RECORDING_REMOTE_CONFIG\n )\n return (remoteConfig?.scriptConfig?.script as PostHogExtensionKind) || 'lazy-recorder'\n }\n\n private _isRemoteConfigFresh(): boolean {\n const persistedConfig = this._instance.get_property(SESSION_RECORDING_REMOTE_CONFIG)\n if (!persistedConfig) {\n return false\n }\n const config = typeof persistedConfig === 'object' ? persistedConfig : JSON.parse(persistedConfig)\n const cacheTimestamp = config.cache_timestamp ?? Date.now()\n return Date.now() - cacheTimestamp <= RECORDING_REMOTE_CONFIG_TTL_MS\n }\n\n private _onScriptLoaded(startReason?: SessionStartReason) {\n if (!assignableWindow.__PosthogExtensions__?.initSessionRecording) {\n throw Error('Called on script loaded before session recording is available')\n }\n\n if (!this._lazyLoadedSessionRecording) {\n this._lazyLoadedSessionRecording = assignableWindow.__PosthogExtensions__?.initSessionRecording(\n this._instance\n )\n ;(this._lazyLoadedSessionRecording as any)._forceAllowLocalhostNetworkCapture =\n this._forceAllowLocalhostNetworkCapture\n }\n\n if (!this._isRemoteConfigFresh()) {\n if (!this._hasRequestedConfigRefresh) {\n this._hasRequestedConfigRefresh = true\n logger.info('persisted remote config is stale, requesting fresh config before starting')\n new RemoteConfigLoader(this._instance).load()\n }\n return\n }\n\n this._lazyLoadedSessionRecording.start(startReason)\n }\n\n /**\n * this is maintained on the public API only because it has always been on the public API\n * if you are calling this directly you are certainly doing something wrong\n * @deprecated\n */\n onRRwebEmit(rawEvent: eventWithTime) {\n this._lazyLoadedSessionRecording?.onRRwebEmit?.(rawEvent)\n }\n\n /**\n * this ignores the linked flag config and (if other conditions are met) causes capture to start\n *\n * It is not usual to call this directly,\n * instead call `posthog.startSessionRecording({linked_flag: true})`\n * */\n public overrideLinkedFlag() {\n if (!this._lazyLoadedSessionRecording) {\n this._instance.persistence?.register({\n [SESSION_RECORDING_OVERRIDE_LINKED_FLAG]: true,\n })\n }\n\n this._lazyLoadedSessionRecording?.overrideLinkedFlag()\n }\n\n /**\n * this ignores the sampling config and (if other conditions are met) causes capture to start\n *\n * It is not usual to call this directly,\n * instead call `posthog.startSessionRecording({sampling: true})`\n * */\n public overrideSampling() {\n if (!this._lazyLoadedSessionRecording) {\n this._instance.persistence?.register({\n [SESSION_RECORDING_OVERRIDE_SAMPLING]: true,\n })\n }\n\n this._lazyLoadedSessionRecording?.overrideSampling()\n }\n\n /**\n * this ignores the URL/Event trigger config and (if other conditions are met) causes capture to start\n *\n * It is not usual to call this directly,\n * instead call `posthog.startSessionRecording({trigger: 'url' | 'event'})`\n * */\n public overrideTrigger(triggerType: TriggerType) {\n if (!this._lazyLoadedSessionRecording) {\n this._instance.persistence?.register({\n [triggerType === 'url'\n ? SESSION_RECORDING_OVERRIDE_URL_TRIGGER\n : SESSION_RECORDING_OVERRIDE_EVENT_TRIGGER]: true,\n })\n }\n\n this._lazyLoadedSessionRecording?.overrideTrigger(triggerType)\n }\n\n /*\n * whenever we capture an event, we add these properties to the event\n * these are used to debug issues with the session recording\n * when looking at the event feed for a session\n */\n get sdkDebugProperties(): Properties {\n return (\n this._lazyLoadedSessionRecording?.sdkDebugProperties || {\n $recording_status: this.status,\n }\n )\n }\n\n /**\n * This adds a custom event to the session recording\n *\n * It is not intended for arbitrary public use - playback only displays known custom events\n * And is exposed on the public interface only so that other parts of the SDK are able to use it\n *\n * if you are calling this from client code, you're probably looking for `posthog.capture('$custom_event', {...})`\n */\n tryAddCustomEvent(tag: string, payload: any): boolean {\n return !!this._lazyLoadedSessionRecording?.tryAddCustomEvent(tag, payload)\n }\n}\n"]} | ||
| {"version":3,"file":"session-recording.js","sourceRoot":"","sources":["../../../../src/extensions/replay/session-recording.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,6CAOwB;AAExB,qDAAwD;AAIxD,sCAAmF;AACnF,6CAAiD;AACjD,+CAK4B;AAC5B,wFAAwF;AACxF,8DAAwH;AAExH,IAAM,aAAa,GAAG,oBAAoB,CAAA;AAC1C,IAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,aAAa,CAAC,CAAA;AAE1C;IAkCI,0BAA6B,SAAkB;QAAlB,cAAS,GAAT,SAAS,CAAS;QAjC/C,uCAAkC,GAAY,KAAK,CAAA;QAE3C,mBAAc,GAAY,KAAK,CAAA;QAC/B,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,CAAC,2BAA2B,EAAE,CAAC;YACpC,MAAA,IAAI,CAAC,SAAS,CAAC,WAAW,0CAAE,QAAQ;gBAChC,GAAC,+CAAmC,IAAG,IAAI;oBAC7C,CAAA;QACN,CAAC;QAED,MAAA,IAAI,CAAC,2BAA2B,0CAAE,gBAAgB,EAAE,CAAA;IACxD,CAAC;IAED;;;;;SAKK;IACE,0CAAe,GAAtB,UAAuB,WAAwB;;;QAC3C,IAAI,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC;YACpC,MAAA,IAAI,CAAC,SAAS,CAAC,WAAW,0CAAE,QAAQ;gBAChC,GAAC,WAAW,KAAK,KAAK;oBAClB,CAAC,CAAC,kDAAsC;oBACxC,CAAC,CAAC,oDAAwC,IAAG,IAAI;oBACvD,CAAA;QACN,CAAC;QAED,MAAA,IAAI,CAAC,2BAA2B,0CAAE,eAAe,CAAC,WAAW,CAAC,CAAA;IAClE,CAAC;IAOD,sBAAI,gDAAkB;QALtB;;;;WAIG;aACH;;YACI,OAAO,CACH,CAAA,MAAA,IAAI,CAAC,2BAA2B,0CAAE,kBAAkB,KAAI;gBACpD,iBAAiB,EAAE,IAAI,CAAC,MAAM;aACjC,CACJ,CAAA;QACL,CAAC;;;OAAA;IAED;;;;;;;OAOG;IACH,4CAAiB,GAAjB,UAAkB,GAAW,EAAE,OAAY;;QACvC,OAAO,CAAC,CAAC,CAAA,MAAA,IAAI,CAAC,2BAA2B,0CAAE,iBAAiB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA,CAAA;IAC9E,CAAC;IACL,uBAAC;AAAD,CAAC,AAxVD,IAwVC;AAxVY,4CAAgB","sourcesContent":["import {\n SESSION_RECORDING_IS_SAMPLED,\n SESSION_RECORDING_OVERRIDE_SAMPLING,\n SESSION_RECORDING_OVERRIDE_LINKED_FLAG,\n SESSION_RECORDING_OVERRIDE_EVENT_TRIGGER,\n SESSION_RECORDING_OVERRIDE_URL_TRIGGER,\n SESSION_RECORDING_REMOTE_CONFIG,\n} from '../../constants'\nimport { PostHog } from '../../posthog-core'\nimport { RemoteConfigLoader } from '../../remote-config'\nimport { Properties, RemoteConfig, SessionRecordingPersistedConfig, SessionStartReason } from '../../types'\nimport { type eventWithTime } from './types/rrweb-types'\n\nimport { isNullish, isNumber, isUndefined, isValidSampleRate } from '@posthog/core'\nimport { createLogger } from '../../utils/logger'\nimport {\n assignableWindow,\n LazyLoadedSessionRecordingInterface,\n PostHogExtensionKind,\n window,\n} from '../../utils/globals'\nimport { RECORDING_REMOTE_CONFIG_TTL_MS } from './external/lazy-loaded-session-recorder'\nimport { DISABLED, LAZY_LOADING, PENDING_CONFIG, SessionRecordingStatus, TriggerType } from './external/triggerMatching'\n\nconst LOGGER_PREFIX = '[SessionRecording]'\nconst logger = createLogger(LOGGER_PREFIX)\n\nexport class SessionRecording {\n _forceAllowLocalhostNetworkCapture: boolean = false\n\n private _receivedFlags: boolean = false\n private _hasRequestedConfigRefresh: boolean = false\n\n private _persistFlagsOnSessionListener: (() => void) | undefined = undefined\n private _lazyLoadedSessionRecording: LazyLoadedSessionRecordingInterface | undefined\n\n public get started(): boolean {\n return !!this._lazyLoadedSessionRecording?.isStarted\n }\n\n /**\n * defaults to pending_config until a remote config response is received\n * transitions to lazy_loading while the recording script is being loaded\n * once loaded, status is delegated to the lazy-loaded recorder (active, buffering, disabled, etc.)\n */\n get status(): SessionRecordingStatus {\n if (this._lazyLoadedSessionRecording) {\n return this._lazyLoadedSessionRecording.status\n }\n\n if (!this._receivedFlags) {\n return PENDING_CONFIG\n }\n\n if (!this._isRecordingEnabled) {\n return DISABLED\n }\n\n return LAZY_LOADING\n }\n\n constructor(private readonly _instance: PostHog) {\n if (!this._instance.sessionManager) {\n logger.error('started without valid sessionManager')\n throw new Error(LOGGER_PREFIX + ' started without valid sessionManager. This is a bug.')\n }\n\n if (this._instance.config.cookieless_mode === 'always') {\n throw new Error(LOGGER_PREFIX + ' cannot be used with cookieless_mode=\"always\"')\n }\n }\n\n private get _isRecordingEnabled() {\n const enabled_server_side = !!this._instance.get_property(SESSION_RECORDING_REMOTE_CONFIG)?.enabled\n const enabled_client_side = !this._instance.config.disable_session_recording\n const isDisabled = this._instance.config.disable_session_recording || this._instance.consent.isOptedOut()\n return window && enabled_server_side && enabled_client_side && !isDisabled\n }\n\n startIfEnabledOrStop(startReason?: SessionStartReason) {\n // Wait for fresh remote config before starting recording\n if (!this._receivedFlags) {\n return\n }\n\n if (this._isRecordingEnabled && this._lazyLoadedSessionRecording?.isStarted) {\n return\n }\n\n // According to the rrweb docs, rrweb is not supported on IE11 and below:\n // \"rrweb does not support IE11 and below because it uses the MutationObserver API, which was supported by these browsers.\"\n // https://github.com/rrweb-io/rrweb/blob/master/guide.md#compatibility-note\n //\n // However, MutationObserver does exist on IE11, it just doesn't work well and does not detect all changes.\n // Instead, when we load \"recorder.js\", the first JS error is about \"Object.assign\" and \"Array.from\" being undefined.\n // Thus instead of MutationObserver, we look for this function and block recording if it's undefined.\n const canRunReplay = !isUndefined(Object.assign) && !isUndefined(Array.from)\n if (this._isRecordingEnabled && canRunReplay) {\n this._lazyLoadAndStart(startReason)\n logger.info('starting')\n } else {\n this.stopRecording()\n }\n }\n\n /**\n * session recording waits until it receives remote config before loading the script\n * this is to ensure we can control the script name remotely\n * and because we wait until we have local and remote config to determine if we should start at all\n * if start is called and there is no remote config then we wait until there is\n */\n private _lazyLoadAndStart(startReason?: SessionStartReason) {\n // by checking `_isRecordingEnabled` here we know that\n // we have stored remote config and client config to read\n // replay waits for both local and remote config before starting\n if (!this._isRecordingEnabled) {\n return\n }\n\n // If recorder.js is already loaded (if array.full.js snippet is used or posthog-js/dist/recorder is\n // imported), don't load the script. Otherwise, remotely import recorder.js from cdn since it hasn't been loaded.\n if (\n !assignableWindow?.__PosthogExtensions__?.rrweb?.record ||\n !assignableWindow.__PosthogExtensions__?.initSessionRecording\n ) {\n assignableWindow.__PosthogExtensions__?.loadExternalDependency?.(\n this._instance,\n this._scriptName,\n (err) => {\n if (err) {\n return logger.error('could not load recorder', err)\n }\n this._onScriptLoaded(startReason)\n }\n )\n } else {\n this._onScriptLoaded(startReason)\n }\n }\n\n stopRecording() {\n this._persistFlagsOnSessionListener?.()\n this._persistFlagsOnSessionListener = undefined\n this._lazyLoadedSessionRecording?.stop()\n }\n\n private _resetSampling() {\n this._instance.persistence?.unregister(SESSION_RECORDING_IS_SAMPLED)\n }\n\n private _validateSampleRate(rate: unknown, source: string): number | null {\n if (isNullish(rate)) {\n return null\n }\n const parsed = isNumber(rate) ? rate : parseFloat(rate as string)\n if (!isValidSampleRate(parsed)) {\n logger.warn(`${source} must be between 0 and 1. Ignoring invalid value:`, rate)\n return null\n }\n return parsed\n }\n\n private _persistRemoteConfig(response: RemoteConfig): void {\n if (this._instance.persistence) {\n const persistence = this._instance.persistence\n\n const persistResponse = () => {\n const sessionRecordingConfigResponse =\n response.sessionRecording === false ? undefined : response.sessionRecording\n\n const localSampleRate = this._validateSampleRate(\n this._instance.config.session_recording?.sampleRate,\n 'session_recording.sampleRate'\n )\n const remoteSampleRate = this._validateSampleRate(\n sessionRecordingConfigResponse?.sampleRate,\n 'remote config sampleRate'\n )\n const parsedSampleRate = localSampleRate ?? remoteSampleRate\n if (isNullish(parsedSampleRate)) {\n this._resetSampling()\n }\n\n const receivedMinimumDuration = sessionRecordingConfigResponse?.minimumDurationMilliseconds\n\n persistence.register({\n [SESSION_RECORDING_REMOTE_CONFIG]: {\n cache_timestamp: Date.now(),\n enabled: !!sessionRecordingConfigResponse,\n ...sessionRecordingConfigResponse,\n networkPayloadCapture: {\n capturePerformance: response.capturePerformance,\n ...sessionRecordingConfigResponse?.networkPayloadCapture,\n },\n canvasRecording: {\n enabled: sessionRecordingConfigResponse?.recordCanvas,\n fps: sessionRecordingConfigResponse?.canvasFps,\n quality: sessionRecordingConfigResponse?.canvasQuality,\n },\n sampleRate: parsedSampleRate,\n minimumDurationMilliseconds: isUndefined(receivedMinimumDuration)\n ? null\n : receivedMinimumDuration,\n endpoint: sessionRecordingConfigResponse?.endpoint,\n triggerMatchType: sessionRecordingConfigResponse?.triggerMatchType,\n masking: sessionRecordingConfigResponse?.masking,\n urlTriggers: sessionRecordingConfigResponse?.urlTriggers,\n } satisfies SessionRecordingPersistedConfig,\n })\n }\n\n persistResponse()\n\n // in case we see multiple flags responses, we should only use the response from the most recent one\n this._persistFlagsOnSessionListener?.()\n // we 100% know there is a session manager by this point\n this._persistFlagsOnSessionListener = this._instance.sessionManager?.onSessionId(persistResponse)\n }\n }\n\n onRemoteConfig(response: RemoteConfig) {\n if (!('sessionRecording' in response)) {\n // if sessionRecording is not in the response, we do nothing\n logger.info('skipping remote config with no sessionRecording', response)\n return\n }\n if (response.sessionRecording === false) {\n // remotely disabled\n this._receivedFlags = true\n return\n }\n\n this._hasRequestedConfigRefresh = false\n this._persistRemoteConfig(response)\n this._receivedFlags = true\n this.startIfEnabledOrStop()\n }\n\n log(message: string, level: 'log' | 'warn' | 'error' = 'log') {\n if (this._lazyLoadedSessionRecording?.log) {\n this._lazyLoadedSessionRecording.log(message, level)\n } else {\n logger.warn('log called before recorder was ready')\n }\n }\n\n private get _scriptName(): PostHogExtensionKind {\n const remoteConfig: SessionRecordingPersistedConfig | undefined = this._instance?.persistence?.get_property(\n SESSION_RECORDING_REMOTE_CONFIG\n )\n return (remoteConfig?.scriptConfig?.script as PostHogExtensionKind) || 'lazy-recorder'\n }\n\n private _isRemoteConfigFresh(): boolean {\n const persistedConfig = this._instance.get_property(SESSION_RECORDING_REMOTE_CONFIG)\n if (!persistedConfig) {\n return false\n }\n const config = typeof persistedConfig === 'object' ? persistedConfig : JSON.parse(persistedConfig)\n const cacheTimestamp = config.cache_timestamp ?? Date.now()\n return Date.now() - cacheTimestamp <= RECORDING_REMOTE_CONFIG_TTL_MS\n }\n\n private _onScriptLoaded(startReason?: SessionStartReason) {\n if (!assignableWindow.__PosthogExtensions__?.initSessionRecording) {\n throw Error('Called on script loaded before session recording is available')\n }\n\n if (!this._lazyLoadedSessionRecording) {\n this._lazyLoadedSessionRecording = assignableWindow.__PosthogExtensions__?.initSessionRecording(\n this._instance\n )\n ;(this._lazyLoadedSessionRecording as any)._forceAllowLocalhostNetworkCapture =\n this._forceAllowLocalhostNetworkCapture\n }\n\n if (!this._isRemoteConfigFresh()) {\n if (!this._hasRequestedConfigRefresh) {\n this._hasRequestedConfigRefresh = true\n logger.info('persisted remote config is stale, requesting fresh config before starting')\n new RemoteConfigLoader(this._instance).load()\n }\n return\n }\n\n this._lazyLoadedSessionRecording.start(startReason)\n }\n\n /**\n * this is maintained on the public API only because it has always been on the public API\n * if you are calling this directly you are certainly doing something wrong\n * @deprecated\n */\n onRRwebEmit(rawEvent: eventWithTime) {\n this._lazyLoadedSessionRecording?.onRRwebEmit?.(rawEvent)\n }\n\n /**\n * this ignores the linked flag config and (if other conditions are met) causes capture to start\n *\n * It is not usual to call this directly,\n * instead call `posthog.startSessionRecording({linked_flag: true})`\n * */\n public overrideLinkedFlag() {\n if (!this._lazyLoadedSessionRecording) {\n this._instance.persistence?.register({\n [SESSION_RECORDING_OVERRIDE_LINKED_FLAG]: true,\n })\n }\n\n this._lazyLoadedSessionRecording?.overrideLinkedFlag()\n }\n\n /**\n * this ignores the sampling config and (if other conditions are met) causes capture to start\n *\n * It is not usual to call this directly,\n * instead call `posthog.startSessionRecording({sampling: true})`\n * */\n public overrideSampling() {\n if (!this._lazyLoadedSessionRecording) {\n this._instance.persistence?.register({\n [SESSION_RECORDING_OVERRIDE_SAMPLING]: true,\n })\n }\n\n this._lazyLoadedSessionRecording?.overrideSampling()\n }\n\n /**\n * this ignores the URL/Event trigger config and (if other conditions are met) causes capture to start\n *\n * It is not usual to call this directly,\n * instead call `posthog.startSessionRecording({trigger: 'url' | 'event'})`\n * */\n public overrideTrigger(triggerType: TriggerType) {\n if (!this._lazyLoadedSessionRecording) {\n this._instance.persistence?.register({\n [triggerType === 'url'\n ? SESSION_RECORDING_OVERRIDE_URL_TRIGGER\n : SESSION_RECORDING_OVERRIDE_EVENT_TRIGGER]: true,\n })\n }\n\n this._lazyLoadedSessionRecording?.overrideTrigger(triggerType)\n }\n\n /*\n * whenever we capture an event, we add these properties to the event\n * these are used to debug issues with the session recording\n * when looking at the event feed for a session\n */\n get sdkDebugProperties(): Properties {\n return (\n this._lazyLoadedSessionRecording?.sdkDebugProperties || {\n $recording_status: this.status,\n }\n )\n }\n\n /**\n * This adds a custom event to the session recording\n *\n * It is not intended for arbitrary public use - playback only displays known custom events\n * And is exposed on the public interface only so that other parts of the SDK are able to use it\n *\n * if you are calling this from client code, you're probably looking for `posthog.capture('$custom_event', {...})`\n */\n tryAddCustomEvent(tag: string, payload: any): boolean {\n return !!this._lazyLoadedSessionRecording?.tryAddCustomEvent(tag, payload)\n }\n}\n"]} |
+5
-5
| { | ||
| "name": "posthog-js", | ||
| "version": "1.356.2", | ||
| "version": "1.357.0", | ||
| "description": "Posthog-js allows you to automatically capture usage and send events to PostHog.", | ||
@@ -32,3 +32,3 @@ "repository": "https://github.com/PostHog/posthog-js", | ||
| "@posthog/core": "1.23.1", | ||
| "@posthog/types": "1.356.2" | ||
| "@posthog/types": "1.357.0" | ||
| }, | ||
@@ -45,5 +45,5 @@ "devDependencies": { | ||
| "@playwright/test": "^1.52.0", | ||
| "@posthog/rrweb-plugin-console-record": "^0.0.44", | ||
| "@posthog/rrweb-record": "^0.0.44", | ||
| "@posthog/rrweb-types": "^0.0.44", | ||
| "@posthog/rrweb-plugin-console-record": "^0.0.45", | ||
| "@posthog/rrweb-record": "^0.0.45", | ||
| "@posthog/rrweb-types": "^0.0.45", | ||
| "@rollup/plugin-babel": "^6.0.4", | ||
@@ -50,0 +50,0 @@ "@rollup/plugin-commonjs": "^28.0.6", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
34307163
0.1%94104
0.04%+ Added
- Removed
Updated