posthog-js
Advanced tools
| { | ||
| "name": "posthog-js-customizations", | ||
| "version": "1.0.0", | ||
| "private": true, | ||
| "description": "Subpath entry point exposing the optional posthog-js customizations (setAllPersonProfilePropertiesAsPersonPropertiesForFlags, before-send helpers, redux/kea loggers). ESM-only; consumed by bundlers via the `module` field.", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/PostHog/posthog-js", | ||
| "directory": "packages/browser/customizations" | ||
| }, | ||
| "main": "../dist/customizations.js", | ||
| "module": "../dist/customizations.js", | ||
| "types": "../dist/customizations.d.ts" | ||
| } |
Sorry, the diff of this file is too big to display
| var e={LIB_VERSION:"1.397.0",LIB_NAME:"web"};function r(){return r=Object.assign?Object.assign.bind():function(e){for(var r=1;arguments.length>r;r++){var n=arguments[r];for(var t in n)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},r.apply(null,arguments)}function n(e,r){return-1!==e.indexOf(r)}var t=Object.prototype,i=t.hasOwnProperty,o=t.toString,a=Array.isArray||function(e){return"[object Array]"===o.call(e)},u=e=>e===Object(e)&&!a(e),l=e=>{if(u(e)){for(var r in e)if(i.call(e,r))return!1;return!0}return!1},s=e=>void 0===e,c=e=>s(e)||(e=>null===e)(e),d=e=>"[object Number]"==o.call(e)&&e==e,f=e=>e instanceof FormData;function v(e,r,n,t,i){return r>n&&(t.warn("min cannot be greater than max."),r=n),d(e)?e>n?(t.warn(" cannot be greater than max: "+n+". Using max value instead."),n):r>e?(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),v(n,r,n,t))}class h{constructor(e){this.Ee={},this.Pe=e.Pe,this.Fe=v(e.bucketSize,0,100,e.Ae),this.$e=v(e.refillRate,0,this.Fe,e.Ae),this.De=v(e.refillInterval,0,864e5,e.Ae)}Ne(e,r){var n=Math.floor((r-e.lastAccess)/this.De);n>0&&(e.tokens=Math.min(e.tokens+n*this.$e,this.Fe),e.lastAccess=e.lastAccess+n*this.De)}consumeRateLimit(e){var r,n=Date.now(),t=String(e),i=this.Ee[t];return i?this.Ne(i,n):this.Ee[t]=i={tokens:this.Fe,lastAccess:n},0===i.tokens||(i.tokens--,0===i.tokens&&(null==(r=this.Pe)||r.call(this,e)),0===i.tokens)}stop(){this.Ee={}}}var p="Mobile",g="iOS",w="Android",m="Tablet",_=w+" "+m,x="iPad",b="Apple",E=b+" Watch",R="Safari",y="BlackBerry",M="Samsung",S=M+"Browser",k=M+" Internet",A="Chrome",O=A+" OS",P=A+" "+g,B="Internet Explorer",D=B+" "+p,N="Opera",U=N+" Mini",I="Edge",T="Microsoft "+I,C="Firefox",W=C+" "+g,z="Nintendo",F="PlayStation",j="Xbox",G=w+" "+p,L=p+" "+R,K="Windows",V=K+" Phone",H="Nokia",X="Ouya",Y="Generic",q=Y+" "+p.toLowerCase(),J=Y+" "+m.toLowerCase(),Q="Konqueror",Z="Oculus Browser",ee="Vivaldi",re="Yandex",ne="Whale",te="DuckDuckGo",ie="Pale Moon",oe="Waterfox",ae="Brave",ue="Google Search App",le="(\\d+(\\.\\d+)?)",se=new RegExp("Version/"+le),ce=new RegExp(j,"i"),de=new RegExp(F+" \\w+","i"),fe=new RegExp(z+" \\w+","i"),ve=new RegExp(y+"|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"},pe=function(e,r,t,i){r=r||"";var o=function(e){return null!=e&&e.brave?ae:null}(t);return o||(null!=i&&i.detectGoogleSearchApp&&n(e,"GSA/")?ue:n(e," OPR/")&&n(e,"Mini")?U:n(e," OPR/")?N:ve.test(e)?y:n(e,"IE"+p)||n(e,"WPDesktop")?D:n(e,"OculusBrowser")?Z:n(e,S)?k:n(e,I)||n(e,"Edg/")?T:n(e,ee+"/")?ee:n(e,"YaBrowser/")?re:n(e,ne+"/")?ne:n(e,te+"/")||n(e,"Ddg/")?te:n(e,"FBIOS")?"Facebook "+p:n(e,"UCWEB")||n(e,"UCBrowser")?"UC Browser":n(e,"CriOS")?P:n(e,"CrMo")||n(e,A)?A:n(e,w)&&n(e,R)?G:n(e,"FxiOS")?W:n(e.toLowerCase(),Q.toLowerCase())?Q:n(e,ae+"/")?ae:((e,r)=>r&&n(r,b)||function(e){return n(e,R)&&!n(e,A)&&!n(e,w)}(e))(e,r)?n(e,p)?L:R:n(e,"PaleMoon/")?ie:n(e,oe+"/")?oe:n(e,C)?C:n(e,"MSIE")||n(e,"Trident/")?B:n(e,"Gecko")?C:"")},ge={[D]:[new RegExp("rv:"+le)],[T]:[new RegExp(I+"?\\/"+le)],[A]:[new RegExp("("+A+"|CrMo)\\/"+le)],[P]:[new RegExp("CriOS\\/"+le)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+le)],[R]:[se],[L]:[se],[N]:[new RegExp("(Opera|OPR)\\/"+le)],[C]:[new RegExp(C+"\\/"+le)],[W]:[new RegExp("FxiOS\\/"+le)],[Q]:[new RegExp("Konqueror[:/]?"+le,"i")],[y]:[new RegExp(y+" "+le),se],[G]:[new RegExp("android\\s"+le,"i")],[k]:[new RegExp(S+"\\/"+le)],[Z]:[new RegExp("OculusBrowser\\/"+le)],[ee]:[new RegExp(ee+"\\/"+le)],[re]:[new RegExp("YaBrowser\\/"+le)],[ne]:[new RegExp(ne+"\\/"+le)],[ae]:[new RegExp(ae+"\\/"+le)],[te]:[new RegExp("(DuckDuckGo|Ddg)\\/"+le)],[ie]:[new RegExp("PaleMoon\\/"+le)],[oe]:[new RegExp(oe+"\\/"+le)],[ue]:[new RegExp("GSA\\/"+le)],[B]:[new RegExp("(rv:|MSIE )"+le)],Mozilla:[new RegExp("rv:"+le)]},we=function(e,r,n,t){var i=pe(e,r,n,t),o=ge[i];if(s(o))return null;for(var a=0;o.length>a;a++){var u=e.match(o[a]);if(u)return parseFloat(u[u.length-2])}return null},me=[[new RegExp(j+"; "+j+" (.*?)[);]","i"),e=>[j,e&&e[1]||""]],[new RegExp(z,"i"),[z,""]],[new RegExp(F,"i"),[F,""]],[ve,[y,""]],[new RegExp(K,"i"),(e,r)=>{if(/Phone/.test(r)||/WPDesktop/.test(r))return[V,""];if(new RegExp(p).test(r)&&!/IEMobile\b/.test(r))return[K+" "+p,""];var n=/Windows NT ([0-9.]+)/i.exec(r);if(n&&n[1]){var t=he[n[1]]||"";return/arm/i.test(r)&&(t="RT"),[K,t]}return[K,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[g,[e[3],e[4],e[5]||"0"].join(".")]:[g,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var r="";return e&&e.length>=3&&(r=s(e[2])?e[3]:e[2]),["watchOS",r]}],[new RegExp("("+w+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+w+")","i"),e=>e&&e[2]?[w,[e[2],e[3],e[4]||"0"].join(".")]:[w,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var r=["Mac OS X",""];return e&&e[1]&&(r[1]=[e[1],e[2],e[3]||"0"].join(".")),r}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[O,""]],[/Linux|debian/i,["Linux",""]]],_e=function(e){return fe.test(e)?z:de.test(e)?F:ce.test(e)?j:new RegExp(X,"i").test(e)?X:new RegExp("("+V+"|WPDesktop)","i").test(e)?V:/iPad/.test(e)?x:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?E:ve.test(e)?y:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(H,"i").test(e)?H:/(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(p).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)?w:_:new RegExp("(pda|"+p+")","i").test(e)?q:new RegExp(m,"i").test(e)&&!new RegExp(m+" pc","i").test(e)?J:""},xe="undefined"!=typeof window?window:void 0,be="undefined"!=typeof globalThis?globalThis:xe;"undefined"==typeof self&&(be.self=be),"undefined"==typeof File&&(be.File=function(){});var Ee=null==be?void 0:be.navigator,Re=null==be?void 0:be.document,ye=null==be?void 0:be.location;null!=be&&be.XMLHttpRequest&&new be.XMLHttpRequest;var $e=null==Ee?void 0:Ee.userAgent,Me=null!=xe?xe:{},Se=function(e,r){var{debugEnabled:n}=void 0===r?{}:r,t={k(r){if(xe&&(Me.POSTHOG_DEBUG||n)&&!s(xe.console)&&xe.console){for(var t=("__rrweb_original__"in xe.console[r]?xe.console[r].__rrweb_original__:xe.console[r]),i=arguments.length,o=new Array(i>1?i-1:0),a=1;i>a;a++)o[a-1]=arguments[a];t(e,...o)}},debug(){for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];t.k("debug",...r)},info(){for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];t.k("log",...r)},warn(){for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];t.k("warn",...r)},error(){for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];t.k("error",...r)},critical(){for(var r=arguments.length,n=new Array(r),t=0;r>t;t++)n[t]=arguments[t];console.error(e,...n)},uninitializedWarning(e){t.error("You must initialize PostHog before calling "+e)},createLogger:(r,n)=>Se(e+" "+r,n)};return t},ke=Se("[PostHog.js]"),Ae=ke.createLogger;function Oe(e,r){if(!c(e))if(a(e))e.forEach(r);else if(f(e))e.forEach(((e,n)=>r(e,n)));else for(var n in e)i.call(e,n)&&r(e[n],n)}var Pe=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;r>t;t++)n[t-1]=arguments[t];for(var i of n)for(var o in i)void 0!==i[o]&&(e[o]=i[o]);return e},Be=e=>{var r=null==Re?void 0:Re.createElement("a");return s(r)?null:(r.href=e,r)},De=function(e,r,n){if(!e||!r||!r.length)return e;for(var t=e.split("#"),i=t[1],o=(t[0]||"").split("?"),u=o[1],l=o[0],s=(u||"").split("&"),c=[],d=0;s.length>d;d++){var f=s[d].split("=");a(f)&&(r.includes(f[0])?c.push(f[0]+"="+n):c.push(s[d]))}var v=l;return null!=u&&(v+="?"+c.join("&")),null!=i&&(v+="#"+i),v};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return d(e)&&isFinite(e)&&Math.floor(e)===e});class Ne{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)||0>e||0>r||0>n||0>t||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 Ne(i)}toString(){for(var e="",r=0;this.bytes.length>r;r++)e=e+(this.bytes[r]>>>4).toString(16)+(15&this.bytes[r]).toString(16),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 Ne(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var r=0;16>r;r++){var n=this.bytes[r]-e.bytes[r];if(0!==n)return Math.sign(n)}return 0}}class Ue{constructor(){this.S=0,this.C=0,this.I=new Ce}generate(){var e=this.generateOrAbort();if(s(e)){this.S=0;var r=this.generateOrAbort();if(s(r))throw new Error("Could not generate UUID after timestamp reset");return r}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.M();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return Ne.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var Ie,Te=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var r=0;e.length>r;r++)e[r]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};xe&&!s(xe.crypto)&&crypto.getRandomValues&&(Te=e=>crypto.getRandomValues(e));class Ce{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(Te(this.R),this.O=0),this.R[this.O++]}}var We=()=>(Ie||(Ie=new Ue)).generate(),ze="",Fe=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function je(e,r){if(r){var n=function(e,r){if(void 0===r&&(r=Re),ze)return ze;if(!r)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),t=Math.min(n.length,8),i="dmn_chk_"+We().toString();!ze&&t--;){var o=n.slice(t).join("."),a=i+"=1;domain=."+o+";path=/";r.cookie=a+";max-age=3",r.cookie.includes(i)&&(r.cookie=a+";max-age=0",ze=o)}return ze}(e);if(!n){var t=(e=>{var r=e.match(Fe);return r?r[0]:""})(e);t!==n&&ke.info("Warning: cookie subdomain discovery mismatch",t,n),n=t}return n?"; domain=."+n:""}return""}var Ge={N:()=>!!Re,D(e){ke.error("cookieStore error: "+e)},A(e){if(Re){try{for(var r=e+"=",n=Re.cookie.split(";").filter((e=>e.length)),t=0;n.length>t;t++){for(var i=n[t];" "==i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(r))return decodeURIComponent(i.substring(r.length,i.length))}}catch(e){}return null}},F(e){var r;try{r=JSON.parse(Ge.A(e))||{}}catch(e){}return r},q(e,r,n,t,i){if(!Re)return!1;try{var o="",a="",u=je(Re.location.hostname,t);if(n){var l=new Date;l.setTime(l.getTime()+864e5*n),o="; expires="+l.toUTCString()}i&&(a="; secure");var s=e+"="+encodeURIComponent(JSON.stringify(r))+o+"; SameSite=Lax; path=/"+u+a;return s.length>3686.4&&ke.warn("cookieStore warning: large cookie, len="+s.length),Re.cookie=s,!0}catch(e){return!1}},P(e,r){if(null!=Re&&Re.cookie)try{Ge.q(e,"",-1,r)}catch(e){return}}},Le=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ke=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Le],Ve=["$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"],He="<masked>",Xe=["li_fat_id"];function Ye(e,r,n){if(!Re)return{};var t,i,o,u=r?[...Le,...n||[]]:[],l=(t=De(Re.URL,u,He),i=Ke.concat(e||[]),o={},Oe(i,(function(e){var r=function(e,r){for(var n,t=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;t.length>i;i++){var o=t[i].split("=");if(o[0]===r){n=o;break}}if(!a(n)||2>n.length)return"";var u=n[1];try{u=decodeURIComponent(u)}catch(e){ke.error("Skipping decoding for malformed query param: "+u)}return u.replace(/\+/g," ")}(t,e);o[e]=r||null})),o),s=function(){var e={};return Oe(Xe,(function(r){var n=Ge.A(r);e[r]=n||null})),e}();return Pe(s,l)}function qe(){return navigator.language||navigator.userLanguage}var Je="$direct";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,t,i){var a,u,l,s;if(void 0===i&&(i=!1),!$e)return{};var c,f,v,h,g,w,b,R,y,M,S,k,A=r?[...Le,...n||[]]:[],[O,P]=function(e){for(var r=0;me.length>r;r++){var[n,t]=me[r],i=n.exec(e),o=i&&("function"==typeof t?t(i,e):t);if(o)return o}return["",""]}($e),B=null!=(c="undefined"!=typeof navigator?navigator:void 0)&&c.brave?{brave:!0}:{},D={detectGoogleSearchApp:t},N=Pe((S={$os:O,$os_version:P,$browser:pe($e,navigator.vendor,B,D),$device:_e($e),$device_type:(h=$e,g={userAgentDataPlatform:null==(a=navigator)||null==(a=a.userAgentData)?void 0:a.platform,maxTouchPoints:null==(u=navigator)?void 0:u.maxTouchPoints,screenWidth:null==xe||null==(l=xe.screen)?void 0:l.width,screenHeight:null==xe||null==(s=xe.screen)?void 0:s.height,devicePixelRatio:null==xe?void 0:xe.devicePixelRatio},M=_e(h),M===x||M===_||"Kobo"===M||"Kindle Fire"===M||M===J?m:M===z||M===j||M===F||M===X?"Console":M===E?"Wearable":M?p:"Android"===(null==g?void 0:g.userAgentDataPlatform)&&(null!==(w=null==g?void 0:g.maxTouchPoints)&&void 0!==w?w:0)>0?600>Math.min(null!==(b=null==g?void 0:g.screenWidth)&&void 0!==b?b:0,null!==(R=null==g?void 0:g.screenHeight)&&void 0!==R?R:0)/(null!==(y=null==g?void 0:g.devicePixelRatio)&&void 0!==y?y:1)?p:m:"Desktop"),$timezone:Qe(),$timezone_offset:Ze()},k={},Oe(S,(function(e,r){("[object String]"==o.call(e)&&e.length>0||d(e))&&(k[r]=e)})),k),{$current_url:De(i?(v=null==ye?void 0:ye.href,v?v.split("#")[0]:v):null==ye?void 0:ye.href,A,He),$host:null==ye?void 0:ye.host,$pathname:null==ye?void 0:ye.pathname,$raw_user_agent:$e.length>1e3?$e.substring(0,997)+"...":$e,$browser_version:we($e,navigator.vendor,B,D),$browser_language:qe(),$browser_language_prefix:(f=qe(),"string"==typeof f?f.split("-")[0]:void 0),$screen_height:null==xe?void 0:xe.screen.height,$screen_width:null==xe?void 0:xe.screen.width,$viewport_height:null==xe?void 0:xe.innerHeight,$viewport_width:null==xe?void 0:xe.innerWidth,$lib:e.LIB_NAME,$lib_version:e.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return e.SDK_DIST_CHANNEL&&(N.$sdk_dist_channel=e.SDK_DIST_CHANNEL),N}var rr=e=>{var r,t=Pe({},er(e.config.mask_personal_data_properties,e.config.custom_personal_data_properties,e.config.detect_google_search_app,e.config.disable_capture_url_hashes),Ye(e.config.custom_campaign_params,e.config.mask_personal_data_properties,e.config.custom_personal_data_properties),{$referrer:(null==Re?void 0:Re.referrer)||Je,$referring_domain:null!=Re&&Re.referrer&&(null==(r=Be(Re.referrer))?void 0:r.host)||Je}),i={};Oe(t,(function(e,r){(n(Ke,r)||n(Ve,r))&&(i[r]=e)})),e.setPersonPropertiesForFlags(i)};function nr(e,r){return[...e||[],...a(r)?r:[r]]}function tr(e,r){return(s(e)?1:e)*r}function ir(e,r){return function(e){for(var r=0,n=0;e.length>n;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return Math.abs(r)}(e)%100<v(100*r,0,100,ke)}function or(e){return n=>n&&ir(n.properties.distinct_id,e)?r({},n,{properties:r({},n.properties,{$sample_type:["sampleByDistinctId"],$sample_threshold:e})}):null}function ar(e){return n=>n&&ir(n.properties.$session_id,e)?r({},n,{properties:r({},n.properties,{$sample_type:nr(n.properties.$sample_type,"sampleBySessionId"),$sample_threshold:tr(n.properties.$sample_threshold,e)})}):null}function ur(e,t){return i=>{var o,a,u;return i?n(e,i.event)?100*Math.random()<v(100*t,0,100,ke)?r({},i,{properties:r({},i.properties,{$sample_type:nr(null==(o=i.properties)?void 0:o.$sample_type,"sampleByEvent"),$sample_threshold:tr(null==(a=i.properties)?void 0:a.$sample_threshold,t),$sampled_events:nr(null==(u=i.properties)?void 0:u.$sampled_events,e)})}):null:i:null}}var lr=e=>(console.log("Would have sent event:",e),null),sr=["type"];function cr(e){var{type:r,executionTimeMs:n}=e;return r+(c(n)?"":" ("+n.toFixed(2)+"ms)")}var dr=Ae("[PostHog Action RateLimiting]");function fr(e,r){console.log(e,r)}var vr=e=>(r,n)=>{var t;null==e||null==(t=e.sessionRecording)||t.tryAddCustomEvent("app-state",{title:r,stateEvent:n})};function hr(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],d=r[o];if(s(a))t[o]=d;else if(s(d))t[o]=a;else if(!(a===d||c(a)&&c(d)))if(u(a)&&u(d))if(n>1){var f=hr(a,d,n-1);l(f)||(t[o]=f)}else t[o]="max depth reached, checking for changed value";else t[o]=d}return t}var pr,gr,wr,mr=(pr=null,gr=0,wr=null,{info(e){wr!==e&&(gr=0,wr=e),gr++,pr&&clearTimeout(pr),pr=setTimeout((()=>{dr.info(1===gr?'action "'+e+'" has been rate limited':'action "'+e+'" has been rate limited ('+gr+" times)"),gr=0,pr=null}),1e3)}});function _r(e){void 0===e&&(e={});var r=xr(e);return{name:"posthog-kea-logger",events:{beforeReduxStore(e){e.middleware.push(r)}}}}function xr(e){void 0===e&&(e={});var{maskAction:r,maskState:n,titleFunction:t=cr,logger:i=fr,include:o={prevState:!0,nextState:!1,changedState:!0},rateLimiterRefillRate:a=1,rateLimiterBucketSize:u=10,__stateComparisonDepth:l}=e,s=new h({refillRate:a,bucketSize:u,refillInterval:1e3,Ae:dr});return e=>a=>u=>{var c=u,d=e.getState(),f=performance.now(),v=a(c),h=performance.now()-f,p=e.getState(),g=r?r(c):c;if(!g)return v;if(s.consumeRateLimit(c.type))mr.info(c.type);else try{var w=n?n(d,g):d,m=n?n(p,g):p,_=o.changedState?hr(w,m,null!=l?l:5):void 0,{type:x}=g,b={type:x,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,sr),timestamp:Date.now(),executionTimeMs:h,prevState:o.prevState?w:void 0,nextState:o.nextState?m:void 0,changedState:o.changedState?_:void 0},E=t(b);i(E,b)}catch(e){dr.error("Error logging state:",e)}return v}}export{fr as browserConsoleLogger,_r as posthogKeaLogger,xr as posthogReduxLogger,lr as printAndDropEverything,or as sampleByDistinctId,ur as sampleByEvent,ar as sampleBySessionId,vr as sessionRecordingLoggerForPostHogInstance,rr as setAllPersonProfilePropertiesAsPersonPropertiesForFlags}; | ||
| //# sourceMappingURL=customizations.js.map |
Sorry, the diff of this file is too big to display
| export * from '../customizations'; |
| export * from '../customizations'; |
| "use strict"; | ||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| var desc = Object.getOwnPropertyDescriptor(m, k); | ||
| if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
| desc = { enumerable: true, get: function() { return m[k]; } }; | ||
| } | ||
| Object.defineProperty(o, k2, desc); | ||
| }) : (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| o[k2] = m[k]; | ||
| })); | ||
| var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
| for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| // ES module entrypoint backing the `posthog-js/customizations` subpath, so | ||
| // consumers can import customizations without reaching into the tsc build | ||
| // output (`posthog-js/lib/src/customizations`), which is CJS-only and does not | ||
| // resolve under native ESM or Node16 module resolution. | ||
| __exportStar(require("../customizations"), exports); | ||
| //# sourceMappingURL=customizations.es.js.map |
| {"version":3,"file":"customizations.es.js","sourceRoot":"","sources":["../../../src/entrypoints/customizations.es.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2EAA2E;AAC3E,0EAA0E;AAC1E,+EAA+E;AAC/E,wDAAwD;AACxD,oDAAiC","sourcesContent":["// ES module entrypoint backing the `posthog-js/customizations` subpath, so\n// consumers can import customizations without reaching into the tsc build\n// output (`posthog-js/lib/src/customizations`), which is CJS-only and does not\n// resolve under native ESM or Node16 module resolution.\nexport * from '../customizations'\n"]} |
@@ -1,2 +0,2 @@ | ||
| !function(){"use strict";var e={LIB_VERSION:"1.396.9",LIB_NAME:"web"};function r(){return r=Object.assign?Object.assign.bind():function(e){for(var r=1;arguments.length>r;r++){var n=arguments[r];for(var t in n)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},r.apply(null,arguments)}function n(e,r){return-1!==e.indexOf(r)}var t=Object.prototype,i=t.hasOwnProperty,o=t.toString,a=Array.isArray||function(e){return"[object Array]"===o.call(e)},l=e=>e===Object(e)&&!a(e),u=e=>{if(l(e)){for(var r in e)if(i.call(e,r))return!1;return!0}return!1},s=e=>void 0===e,c=e=>s(e)||(e=>null===e)(e),d=e=>"[object Number]"==o.call(e)&&e==e,f=e=>e instanceof FormData;function v(e,r,n,t,i){return r>n&&(t.warn("min cannot be greater than max."),r=n),d(e)?e>n?(t.warn(" cannot be greater than max: "+n+". Using max value instead."),n):r>e?(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),v(n,r,n,t))}class h{constructor(e){this.Ee={},this.Pe=e.Pe,this.Fe=v(e.bucketSize,0,100,e.Ae),this.$e=v(e.refillRate,0,this.Fe,e.Ae),this.De=v(e.refillInterval,0,864e5,e.Ae)}Ne(e,r){var n=Math.floor((r-e.lastAccess)/this.De);n>0&&(e.tokens=Math.min(e.tokens+n*this.$e,this.Fe),e.lastAccess=e.lastAccess+n*this.De)}consumeRateLimit(e){var r,n=Date.now(),t=String(e),i=this.Ee[t];return i?this.Ne(i,n):this.Ee[t]=i={tokens:this.Fe,lastAccess:n},0===i.tokens||(i.tokens--,0===i.tokens&&(null==(r=this.Pe)||r.call(this,e)),0===i.tokens)}stop(){this.Ee={}}}var p="Mobile",g="iOS",w="Android",m="Tablet",_=w+" "+m,x="iPad",b="Apple",E=b+" Watch",R="Safari",y="BlackBerry",S="Samsung",M=S+"Browser",k=S+" Internet",P="Chrome",A=P+" OS",O=P+" "+g,B="Internet Explorer",D=B+" "+p,I="Opera",N=I+" Mini",U="Edge",T="Microsoft "+U,C="Firefox",W=C+" "+g,F="Nintendo",L="PlayStation",j="Xbox",z=w+" "+p,G=p+" "+R,K="Windows",V=K+" Phone",H="Nokia",X="Ouya",Y="Generic",q=Y+" "+p.toLowerCase(),J=Y+" "+m.toLowerCase(),Q="Konqueror",Z="Oculus Browser",ee="Vivaldi",re="Yandex",ne="Whale",te="DuckDuckGo",ie="Pale Moon",oe="Waterfox",ae="Brave",le="Google Search App",ue="(\\d+(\\.\\d+)?)",se=new RegExp("Version/"+ue),ce=new RegExp(j,"i"),de=new RegExp(L+" \\w+","i"),fe=new RegExp(F+" \\w+","i"),ve=new RegExp(y+"|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"},pe=function(e,r,t,i){r=r||"";var o=function(e){return null!=e&&e.brave?ae:null}(t);return o||(null!=i&&i.detectGoogleSearchApp&&n(e,"GSA/")?le:n(e," OPR/")&&n(e,"Mini")?N:n(e," OPR/")?I:ve.test(e)?y:n(e,"IE"+p)||n(e,"WPDesktop")?D:n(e,"OculusBrowser")?Z:n(e,M)?k:n(e,U)||n(e,"Edg/")?T:n(e,ee+"/")?ee:n(e,"YaBrowser/")?re:n(e,ne+"/")?ne:n(e,te+"/")||n(e,"Ddg/")?te:n(e,"FBIOS")?"Facebook "+p:n(e,"UCWEB")||n(e,"UCBrowser")?"UC Browser":n(e,"CriOS")?O:n(e,"CrMo")||n(e,P)?P:n(e,w)&&n(e,R)?z:n(e,"FxiOS")?W:n(e.toLowerCase(),Q.toLowerCase())?Q:n(e,ae+"/")?ae:((e,r)=>r&&n(r,b)||function(e){return n(e,R)&&!n(e,P)&&!n(e,w)}(e))(e,r)?n(e,p)?G:R:n(e,"PaleMoon/")?ie:n(e,oe+"/")?oe:n(e,C)?C:n(e,"MSIE")||n(e,"Trident/")?B:n(e,"Gecko")?C:"")},ge={[D]:[new RegExp("rv:"+ue)],[T]:[new RegExp(U+"?\\/"+ue)],[P]:[new RegExp("("+P+"|CrMo)\\/"+ue)],[O]:[new RegExp("CriOS\\/"+ue)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ue)],[R]:[se],[G]:[se],[I]:[new RegExp("(Opera|OPR)\\/"+ue)],[C]:[new RegExp(C+"\\/"+ue)],[W]:[new RegExp("FxiOS\\/"+ue)],[Q]:[new RegExp("Konqueror[:/]?"+ue,"i")],[y]:[new RegExp(y+" "+ue),se],[z]:[new RegExp("android\\s"+ue,"i")],[k]:[new RegExp(M+"\\/"+ue)],[Z]:[new RegExp("OculusBrowser\\/"+ue)],[ee]:[new RegExp(ee+"\\/"+ue)],[re]:[new RegExp("YaBrowser\\/"+ue)],[ne]:[new RegExp(ne+"\\/"+ue)],[ae]:[new RegExp(ae+"\\/"+ue)],[te]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ue)],[ie]:[new RegExp("PaleMoon\\/"+ue)],[oe]:[new RegExp(oe+"\\/"+ue)],[le]:[new RegExp("GSA\\/"+ue)],[B]:[new RegExp("(rv:|MSIE )"+ue)],Mozilla:[new RegExp("rv:"+ue)]},we=function(e,r,n,t){var i=pe(e,r,n,t),o=ge[i];if(s(o))return null;for(var a=0;o.length>a;a++){var l=e.match(o[a]);if(l)return parseFloat(l[l.length-2])}return null},me=[[new RegExp(j+"; "+j+" (.*?)[);]","i"),e=>[j,e&&e[1]||""]],[new RegExp(F,"i"),[F,""]],[new RegExp(L,"i"),[L,""]],[ve,[y,""]],[new RegExp(K,"i"),(e,r)=>{if(/Phone/.test(r)||/WPDesktop/.test(r))return[V,""];if(new RegExp(p).test(r)&&!/IEMobile\b/.test(r))return[K+" "+p,""];var n=/Windows NT ([0-9.]+)/i.exec(r);if(n&&n[1]){var t=he[n[1]]||"";return/arm/i.test(r)&&(t="RT"),[K,t]}return[K,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[g,[e[3],e[4],e[5]||"0"].join(".")]:[g,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var r="";return e&&e.length>=3&&(r=s(e[2])?e[3]:e[2]),["watchOS",r]}],[new RegExp("("+w+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+w+")","i"),e=>e&&e[2]?[w,[e[2],e[3],e[4]||"0"].join(".")]:[w,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var r=["Mac OS X",""];return e&&e[1]&&(r[1]=[e[1],e[2],e[3]||"0"].join(".")),r}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[A,""]],[/Linux|debian/i,["Linux",""]]],_e=function(e){return fe.test(e)?F:de.test(e)?L:ce.test(e)?j:new RegExp(X,"i").test(e)?X:new RegExp("("+V+"|WPDesktop)","i").test(e)?V:/iPad/.test(e)?x:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?E:ve.test(e)?y:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(H,"i").test(e)?H:/(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(p).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)?w:_:new RegExp("(pda|"+p+")","i").test(e)?q:new RegExp(m,"i").test(e)&&!new RegExp(m+" pc","i").test(e)?J:""},xe="undefined"!=typeof window?window:void 0,be="undefined"!=typeof globalThis?globalThis:xe;"undefined"==typeof self&&(be.self=be),"undefined"==typeof File&&(be.File=function(){});var Ee=null==be?void 0:be.navigator,Re=null==be?void 0:be.document,ye=null==be?void 0:be.location;null!=be&&be.XMLHttpRequest&&new be.XMLHttpRequest;var $e=null==Ee?void 0:Ee.userAgent,Se=null!=xe?xe:{},Me=function(e,r){var{debugEnabled:n}=void 0===r?{}:r,t={k(r){if(xe&&(Se.POSTHOG_DEBUG||n)&&!s(xe.console)&&xe.console){for(var t=("__rrweb_original__"in xe.console[r]?xe.console[r].__rrweb_original__:xe.console[r]),i=arguments.length,o=new Array(i>1?i-1:0),a=1;i>a;a++)o[a-1]=arguments[a];t(e,...o)}},debug(){for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];t.k("debug",...r)},info(){for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];t.k("log",...r)},warn(){for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];t.k("warn",...r)},error(){for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];t.k("error",...r)},critical(){for(var r=arguments.length,n=new Array(r),t=0;r>t;t++)n[t]=arguments[t];console.error(e,...n)},uninitializedWarning(e){t.error("You must initialize PostHog before calling "+e)},createLogger:(r,n)=>Me(e+" "+r,n)};return t},ke=Me("[PostHog.js]"),Pe=ke.createLogger;function Ae(e,r){if(!c(e))if(a(e))e.forEach(r);else if(f(e))e.forEach(((e,n)=>r(e,n)));else for(var n in e)i.call(e,n)&&r(e[n],n)}var Oe=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;r>t;t++)n[t-1]=arguments[t];for(var i of n)for(var o in i)void 0!==i[o]&&(e[o]=i[o]);return e},Be=e=>{var r=null==Re?void 0:Re.createElement("a");return s(r)?null:(r.href=e,r)},De=function(e,r,n){if(!e||!r||!r.length)return e;for(var t=e.split("#"),i=t[1],o=(t[0]||"").split("?"),l=o[1],u=o[0],s=(l||"").split("&"),c=[],d=0;s.length>d;d++){var f=s[d].split("=");a(f)&&(r.includes(f[0])?c.push(f[0]+"="+n):c.push(s[d]))}var v=u;return null!=l&&(v+="?"+c.join("&")),null!=i&&(v+="#"+i),v};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return d(e)&&isFinite(e)&&Math.floor(e)===e});class Ie{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)||0>e||0>r||0>n||0>t||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 Ie(i)}toString(){for(var e="",r=0;this.bytes.length>r;r++)e=e+(this.bytes[r]>>>4).toString(16)+(15&this.bytes[r]).toString(16),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 Ie(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var r=0;16>r;r++){var n=this.bytes[r]-e.bytes[r];if(0!==n)return Math.sign(n)}return 0}}class Ne{constructor(){this.S=0,this.C=0,this.I=new Ce}generate(){var e=this.generateOrAbort();if(s(e)){this.S=0;var r=this.generateOrAbort();if(s(r))throw new Error("Could not generate UUID after timestamp reset");return r}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.M();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return Ie.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var Ue,Te=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var r=0;e.length>r;r++)e[r]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};xe&&!s(xe.crypto)&&crypto.getRandomValues&&(Te=e=>crypto.getRandomValues(e));class Ce{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(Te(this.R),this.O=0),this.R[this.O++]}}var We=()=>(Ue||(Ue=new Ne)).generate(),Fe="",Le=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function je(e,r){if(r){var n=function(e,r){if(void 0===r&&(r=Re),Fe)return Fe;if(!r)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),t=Math.min(n.length,8),i="dmn_chk_"+We().toString();!Fe&&t--;){var o=n.slice(t).join("."),a=i+"=1;domain=."+o+";path=/";r.cookie=a+";max-age=3",r.cookie.includes(i)&&(r.cookie=a+";max-age=0",Fe=o)}return Fe}(e);if(!n){var t=(e=>{var r=e.match(Le);return r?r[0]:""})(e);t!==n&&ke.info("Warning: cookie subdomain discovery mismatch",t,n),n=t}return n?"; domain=."+n:""}return""}var ze={N:()=>!!Re,D(e){ke.error("cookieStore error: "+e)},A(e){if(Re){try{for(var r=e+"=",n=Re.cookie.split(";").filter((e=>e.length)),t=0;n.length>t;t++){for(var i=n[t];" "==i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(r))return decodeURIComponent(i.substring(r.length,i.length))}}catch(e){}return null}},F(e){var r;try{r=JSON.parse(ze.A(e))||{}}catch(e){}return r},q(e,r,n,t,i){if(!Re)return!1;try{var o="",a="",l=je(Re.location.hostname,t);if(n){var u=new Date;u.setTime(u.getTime()+864e5*n),o="; expires="+u.toUTCString()}i&&(a="; secure");var s=e+"="+encodeURIComponent(JSON.stringify(r))+o+"; SameSite=Lax; path=/"+l+a;return s.length>3686.4&&ke.warn("cookieStore warning: large cookie, len="+s.length),Re.cookie=s,!0}catch(e){return!1}},P(e,r){if(null!=Re&&Re.cookie)try{ze.q(e,"",-1,r)}catch(e){return}}},Ge=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ke=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ge],Ve=["$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"],He="<masked>",Xe=["li_fat_id"];function Ye(e,r,n){if(!Re)return{};var t,i,o,l=r?[...Ge,...n||[]]:[],u=(t=De(Re.URL,l,He),i=Ke.concat(e||[]),o={},Ae(i,(function(e){var r=function(e,r){for(var n,t=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;t.length>i;i++){var o=t[i].split("=");if(o[0]===r){n=o;break}}if(!a(n)||2>n.length)return"";var l=n[1];try{l=decodeURIComponent(l)}catch(e){ke.error("Skipping decoding for malformed query param: "+l)}return l.replace(/\+/g," ")}(t,e);o[e]=r||null})),o),s=function(){var e={};return Ae(Xe,(function(r){var n=ze.A(r);e[r]=n||null})),e}();return Oe(s,u)}function qe(){return navigator.language||navigator.userLanguage}var Je="$direct";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,t,i){var a,l,u,s;if(void 0===i&&(i=!1),!$e)return{};var c,f,v,h,g,w,b,R,y,S,M,k,P=r?[...Ge,...n||[]]:[],[A,O]=function(e){for(var r=0;me.length>r;r++){var[n,t]=me[r],i=n.exec(e),o=i&&("function"==typeof t?t(i,e):t);if(o)return o}return["",""]}($e),B=null!=(c="undefined"!=typeof navigator?navigator:void 0)&&c.brave?{brave:!0}:{},D={detectGoogleSearchApp:t},I=Oe((M={$os:A,$os_version:O,$browser:pe($e,navigator.vendor,B,D),$device:_e($e),$device_type:(h=$e,g={userAgentDataPlatform:null==(a=navigator)||null==(a=a.userAgentData)?void 0:a.platform,maxTouchPoints:null==(l=navigator)?void 0:l.maxTouchPoints,screenWidth:null==xe||null==(u=xe.screen)?void 0:u.width,screenHeight:null==xe||null==(s=xe.screen)?void 0:s.height,devicePixelRatio:null==xe?void 0:xe.devicePixelRatio},S=_e(h),S===x||S===_||"Kobo"===S||"Kindle Fire"===S||S===J?m:S===F||S===j||S===L||S===X?"Console":S===E?"Wearable":S?p:"Android"===(null==g?void 0:g.userAgentDataPlatform)&&(null!==(w=null==g?void 0:g.maxTouchPoints)&&void 0!==w?w:0)>0?600>Math.min(null!==(b=null==g?void 0:g.screenWidth)&&void 0!==b?b:0,null!==(R=null==g?void 0:g.screenHeight)&&void 0!==R?R:0)/(null!==(y=null==g?void 0:g.devicePixelRatio)&&void 0!==y?y:1)?p:m:"Desktop"),$timezone:Qe(),$timezone_offset:Ze()},k={},Ae(M,(function(e,r){("[object String]"==o.call(e)&&e.length>0||d(e))&&(k[r]=e)})),k),{$current_url:De(i?(v=null==ye?void 0:ye.href,v?v.split("#")[0]:v):null==ye?void 0:ye.href,P,He),$host:null==ye?void 0:ye.host,$pathname:null==ye?void 0:ye.pathname,$raw_user_agent:$e.length>1e3?$e.substring(0,997)+"...":$e,$browser_version:we($e,navigator.vendor,B,D),$browser_language:qe(),$browser_language_prefix:(f=qe(),"string"==typeof f?f.split("-")[0]:void 0),$screen_height:null==xe?void 0:xe.screen.height,$screen_width:null==xe?void 0:xe.screen.width,$viewport_height:null==xe?void 0:xe.innerHeight,$viewport_width:null==xe?void 0:xe.innerWidth,$lib:e.LIB_NAME,$lib_version:e.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return e.SDK_DIST_CHANNEL&&(I.$sdk_dist_channel=e.SDK_DIST_CHANNEL),I}function rr(e,r){return[...e||[],...a(r)?r:[r]]}function nr(e,r){return(s(e)?1:e)*r}function tr(e,r){return function(e){for(var r=0,n=0;e.length>n;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return Math.abs(r)}(e)%100<v(100*r,0,100,ke)}var ir=["type"];function or(e){var{type:r,executionTimeMs:n}=e;return r+(c(n)?"":" ("+n.toFixed(2)+"ms)")}var ar=Pe("[PostHog Action RateLimiting]");function lr(e,r){console.log(e,r)}function ur(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],d=r[o];if(s(a))t[o]=d;else if(s(d))t[o]=a;else if(!(a===d||c(a)&&c(d)))if(l(a)&&l(d))if(n>1){var f=ur(a,d,n-1);u(f)||(t[o]=f)}else t[o]="max depth reached, checking for changed value";else t[o]=d}return t}var sr,cr,dr,fr=(sr=null,cr=0,dr=null,{info(e){dr!==e&&(cr=0,dr=e),cr++,sr&&clearTimeout(sr),sr=setTimeout((()=>{ar.info(1===cr?'action "'+e+'" has been rate limited':'action "'+e+'" has been rate limited ('+cr+" times)"),cr=0,sr=null}),1e3)}});function vr(e){void 0===e&&(e={});var{maskAction:r,maskState:n,titleFunction:t=or,logger:i=lr,include:o={prevState:!0,nextState:!1,changedState:!0},rateLimiterRefillRate:a=1,rateLimiterBucketSize:l=10,__stateComparisonDepth:u}=e,s=new h({refillRate:a,bucketSize:l,refillInterval:1e3,Ae:ar});return e=>a=>l=>{var c=l,d=e.getState(),f=performance.now(),v=a(c),h=performance.now()-f,p=e.getState(),g=r?r(c):c;if(!g)return v;if(s.consumeRateLimit(c.type))fr.info(c.type);else try{var w=n?n(d,g):d,m=n?n(p,g):p,_=o.changedState?ur(w,m,null!=u?u:5):void 0,{type:x}=g,b={type:x,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},E=t(b);i(E,b)}catch(e){ar.error("Error logging state:",e)}return v}}Se.posthogCustomizations=Object.freeze({__proto__:null,browserConsoleLogger:lr,posthogKeaLogger(e){void 0===e&&(e={});var r=vr(e);return{name:"posthog-kea-logger",events:{beforeReduxStore(e){e.middleware.push(r)}}}},posthogReduxLogger:vr,printAndDropEverything:e=>(console.log("Would have sent event:",e),null),sampleByDistinctId:e=>n=>n&&tr(n.properties.distinct_id,e)?r({},n,{properties:r({},n.properties,{$sample_type:["sampleByDistinctId"],$sample_threshold:e})}):null,sampleByEvent:(e,t)=>i=>{var o,a,l;return i?n(e,i.event)?100*Math.random()<v(100*t,0,100,ke)?r({},i,{properties:r({},i.properties,{$sample_type:rr(null==(o=i.properties)?void 0:o.$sample_type,"sampleByEvent"),$sample_threshold:nr(null==(a=i.properties)?void 0:a.$sample_threshold,t),$sampled_events:rr(null==(l=i.properties)?void 0:l.$sampled_events,e)})}):null:i:null},sampleBySessionId:e=>n=>n&&tr(n.properties.$session_id,e)?r({},n,{properties:r({},n.properties,{$sample_type:rr(n.properties.$sample_type,"sampleBySessionId"),$sample_threshold:nr(n.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,t=Oe({},er(e.config.mask_personal_data_properties,e.config.custom_personal_data_properties,e.config.detect_google_search_app,e.config.disable_capture_url_hashes),Ye(e.config.custom_campaign_params,e.config.mask_personal_data_properties,e.config.custom_personal_data_properties),{$referrer:(null==Re?void 0:Re.referrer)||Je,$referring_domain:null!=Re&&Re.referrer&&(null==(r=Be(Re.referrer))?void 0:r.host)||Je}),i={};Ae(t,(function(e,r){(n(Ke,r)||n(Ve,r))&&(i[r]=e)})),e.setPersonPropertiesForFlags(i)}})}(); | ||
| !function(){"use strict";var e={LIB_VERSION:"1.397.0",LIB_NAME:"web"};function r(){return r=Object.assign?Object.assign.bind():function(e){for(var r=1;arguments.length>r;r++){var n=arguments[r];for(var t in n)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},r.apply(null,arguments)}function n(e,r){return-1!==e.indexOf(r)}var t=Object.prototype,i=t.hasOwnProperty,o=t.toString,a=Array.isArray||function(e){return"[object Array]"===o.call(e)},l=e=>e===Object(e)&&!a(e),u=e=>{if(l(e)){for(var r in e)if(i.call(e,r))return!1;return!0}return!1},s=e=>void 0===e,c=e=>s(e)||(e=>null===e)(e),d=e=>"[object Number]"==o.call(e)&&e==e,f=e=>e instanceof FormData;function v(e,r,n,t,i){return r>n&&(t.warn("min cannot be greater than max."),r=n),d(e)?e>n?(t.warn(" cannot be greater than max: "+n+". Using max value instead."),n):r>e?(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),v(n,r,n,t))}class h{constructor(e){this.Ee={},this.Pe=e.Pe,this.Fe=v(e.bucketSize,0,100,e.Ae),this.$e=v(e.refillRate,0,this.Fe,e.Ae),this.De=v(e.refillInterval,0,864e5,e.Ae)}Ne(e,r){var n=Math.floor((r-e.lastAccess)/this.De);n>0&&(e.tokens=Math.min(e.tokens+n*this.$e,this.Fe),e.lastAccess=e.lastAccess+n*this.De)}consumeRateLimit(e){var r,n=Date.now(),t=String(e),i=this.Ee[t];return i?this.Ne(i,n):this.Ee[t]=i={tokens:this.Fe,lastAccess:n},0===i.tokens||(i.tokens--,0===i.tokens&&(null==(r=this.Pe)||r.call(this,e)),0===i.tokens)}stop(){this.Ee={}}}var p="Mobile",g="iOS",w="Android",m="Tablet",_=w+" "+m,x="iPad",b="Apple",E=b+" Watch",R="Safari",y="BlackBerry",S="Samsung",M=S+"Browser",k=S+" Internet",P="Chrome",A=P+" OS",O=P+" "+g,B="Internet Explorer",D=B+" "+p,I="Opera",N=I+" Mini",U="Edge",T="Microsoft "+U,C="Firefox",W=C+" "+g,F="Nintendo",L="PlayStation",j="Xbox",z=w+" "+p,G=p+" "+R,K="Windows",V=K+" Phone",H="Nokia",X="Ouya",Y="Generic",q=Y+" "+p.toLowerCase(),J=Y+" "+m.toLowerCase(),Q="Konqueror",Z="Oculus Browser",ee="Vivaldi",re="Yandex",ne="Whale",te="DuckDuckGo",ie="Pale Moon",oe="Waterfox",ae="Brave",le="Google Search App",ue="(\\d+(\\.\\d+)?)",se=new RegExp("Version/"+ue),ce=new RegExp(j,"i"),de=new RegExp(L+" \\w+","i"),fe=new RegExp(F+" \\w+","i"),ve=new RegExp(y+"|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"},pe=function(e,r,t,i){r=r||"";var o=function(e){return null!=e&&e.brave?ae:null}(t);return o||(null!=i&&i.detectGoogleSearchApp&&n(e,"GSA/")?le:n(e," OPR/")&&n(e,"Mini")?N:n(e," OPR/")?I:ve.test(e)?y:n(e,"IE"+p)||n(e,"WPDesktop")?D:n(e,"OculusBrowser")?Z:n(e,M)?k:n(e,U)||n(e,"Edg/")?T:n(e,ee+"/")?ee:n(e,"YaBrowser/")?re:n(e,ne+"/")?ne:n(e,te+"/")||n(e,"Ddg/")?te:n(e,"FBIOS")?"Facebook "+p:n(e,"UCWEB")||n(e,"UCBrowser")?"UC Browser":n(e,"CriOS")?O:n(e,"CrMo")||n(e,P)?P:n(e,w)&&n(e,R)?z:n(e,"FxiOS")?W:n(e.toLowerCase(),Q.toLowerCase())?Q:n(e,ae+"/")?ae:((e,r)=>r&&n(r,b)||function(e){return n(e,R)&&!n(e,P)&&!n(e,w)}(e))(e,r)?n(e,p)?G:R:n(e,"PaleMoon/")?ie:n(e,oe+"/")?oe:n(e,C)?C:n(e,"MSIE")||n(e,"Trident/")?B:n(e,"Gecko")?C:"")},ge={[D]:[new RegExp("rv:"+ue)],[T]:[new RegExp(U+"?\\/"+ue)],[P]:[new RegExp("("+P+"|CrMo)\\/"+ue)],[O]:[new RegExp("CriOS\\/"+ue)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ue)],[R]:[se],[G]:[se],[I]:[new RegExp("(Opera|OPR)\\/"+ue)],[C]:[new RegExp(C+"\\/"+ue)],[W]:[new RegExp("FxiOS\\/"+ue)],[Q]:[new RegExp("Konqueror[:/]?"+ue,"i")],[y]:[new RegExp(y+" "+ue),se],[z]:[new RegExp("android\\s"+ue,"i")],[k]:[new RegExp(M+"\\/"+ue)],[Z]:[new RegExp("OculusBrowser\\/"+ue)],[ee]:[new RegExp(ee+"\\/"+ue)],[re]:[new RegExp("YaBrowser\\/"+ue)],[ne]:[new RegExp(ne+"\\/"+ue)],[ae]:[new RegExp(ae+"\\/"+ue)],[te]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ue)],[ie]:[new RegExp("PaleMoon\\/"+ue)],[oe]:[new RegExp(oe+"\\/"+ue)],[le]:[new RegExp("GSA\\/"+ue)],[B]:[new RegExp("(rv:|MSIE )"+ue)],Mozilla:[new RegExp("rv:"+ue)]},we=function(e,r,n,t){var i=pe(e,r,n,t),o=ge[i];if(s(o))return null;for(var a=0;o.length>a;a++){var l=e.match(o[a]);if(l)return parseFloat(l[l.length-2])}return null},me=[[new RegExp(j+"; "+j+" (.*?)[);]","i"),e=>[j,e&&e[1]||""]],[new RegExp(F,"i"),[F,""]],[new RegExp(L,"i"),[L,""]],[ve,[y,""]],[new RegExp(K,"i"),(e,r)=>{if(/Phone/.test(r)||/WPDesktop/.test(r))return[V,""];if(new RegExp(p).test(r)&&!/IEMobile\b/.test(r))return[K+" "+p,""];var n=/Windows NT ([0-9.]+)/i.exec(r);if(n&&n[1]){var t=he[n[1]]||"";return/arm/i.test(r)&&(t="RT"),[K,t]}return[K,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[g,[e[3],e[4],e[5]||"0"].join(".")]:[g,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var r="";return e&&e.length>=3&&(r=s(e[2])?e[3]:e[2]),["watchOS",r]}],[new RegExp("("+w+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+w+")","i"),e=>e&&e[2]?[w,[e[2],e[3],e[4]||"0"].join(".")]:[w,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var r=["Mac OS X",""];return e&&e[1]&&(r[1]=[e[1],e[2],e[3]||"0"].join(".")),r}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[A,""]],[/Linux|debian/i,["Linux",""]]],_e=function(e){return fe.test(e)?F:de.test(e)?L:ce.test(e)?j:new RegExp(X,"i").test(e)?X:new RegExp("("+V+"|WPDesktop)","i").test(e)?V:/iPad/.test(e)?x:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?E:ve.test(e)?y:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(H,"i").test(e)?H:/(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(p).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)?w:_:new RegExp("(pda|"+p+")","i").test(e)?q:new RegExp(m,"i").test(e)&&!new RegExp(m+" pc","i").test(e)?J:""},xe="undefined"!=typeof window?window:void 0,be="undefined"!=typeof globalThis?globalThis:xe;"undefined"==typeof self&&(be.self=be),"undefined"==typeof File&&(be.File=function(){});var Ee=null==be?void 0:be.navigator,Re=null==be?void 0:be.document,ye=null==be?void 0:be.location;null!=be&&be.XMLHttpRequest&&new be.XMLHttpRequest;var $e=null==Ee?void 0:Ee.userAgent,Se=null!=xe?xe:{},Me=function(e,r){var{debugEnabled:n}=void 0===r?{}:r,t={k(r){if(xe&&(Se.POSTHOG_DEBUG||n)&&!s(xe.console)&&xe.console){for(var t=("__rrweb_original__"in xe.console[r]?xe.console[r].__rrweb_original__:xe.console[r]),i=arguments.length,o=new Array(i>1?i-1:0),a=1;i>a;a++)o[a-1]=arguments[a];t(e,...o)}},debug(){for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];t.k("debug",...r)},info(){for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];t.k("log",...r)},warn(){for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];t.k("warn",...r)},error(){for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];t.k("error",...r)},critical(){for(var r=arguments.length,n=new Array(r),t=0;r>t;t++)n[t]=arguments[t];console.error(e,...n)},uninitializedWarning(e){t.error("You must initialize PostHog before calling "+e)},createLogger:(r,n)=>Me(e+" "+r,n)};return t},ke=Me("[PostHog.js]"),Pe=ke.createLogger;function Ae(e,r){if(!c(e))if(a(e))e.forEach(r);else if(f(e))e.forEach(((e,n)=>r(e,n)));else for(var n in e)i.call(e,n)&&r(e[n],n)}var Oe=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;r>t;t++)n[t-1]=arguments[t];for(var i of n)for(var o in i)void 0!==i[o]&&(e[o]=i[o]);return e},Be=e=>{var r=null==Re?void 0:Re.createElement("a");return s(r)?null:(r.href=e,r)},De=function(e,r,n){if(!e||!r||!r.length)return e;for(var t=e.split("#"),i=t[1],o=(t[0]||"").split("?"),l=o[1],u=o[0],s=(l||"").split("&"),c=[],d=0;s.length>d;d++){var f=s[d].split("=");a(f)&&(r.includes(f[0])?c.push(f[0]+"="+n):c.push(s[d]))}var v=u;return null!=l&&(v+="?"+c.join("&")),null!=i&&(v+="#"+i),v};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return d(e)&&isFinite(e)&&Math.floor(e)===e});class Ie{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)||0>e||0>r||0>n||0>t||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 Ie(i)}toString(){for(var e="",r=0;this.bytes.length>r;r++)e=e+(this.bytes[r]>>>4).toString(16)+(15&this.bytes[r]).toString(16),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 Ie(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var r=0;16>r;r++){var n=this.bytes[r]-e.bytes[r];if(0!==n)return Math.sign(n)}return 0}}class Ne{constructor(){this.S=0,this.C=0,this.I=new Ce}generate(){var e=this.generateOrAbort();if(s(e)){this.S=0;var r=this.generateOrAbort();if(s(r))throw new Error("Could not generate UUID after timestamp reset");return r}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.M();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return Ie.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var Ue,Te=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var r=0;e.length>r;r++)e[r]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};xe&&!s(xe.crypto)&&crypto.getRandomValues&&(Te=e=>crypto.getRandomValues(e));class Ce{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(Te(this.R),this.O=0),this.R[this.O++]}}var We=()=>(Ue||(Ue=new Ne)).generate(),Fe="",Le=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function je(e,r){if(r){var n=function(e,r){if(void 0===r&&(r=Re),Fe)return Fe;if(!r)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),t=Math.min(n.length,8),i="dmn_chk_"+We().toString();!Fe&&t--;){var o=n.slice(t).join("."),a=i+"=1;domain=."+o+";path=/";r.cookie=a+";max-age=3",r.cookie.includes(i)&&(r.cookie=a+";max-age=0",Fe=o)}return Fe}(e);if(!n){var t=(e=>{var r=e.match(Le);return r?r[0]:""})(e);t!==n&&ke.info("Warning: cookie subdomain discovery mismatch",t,n),n=t}return n?"; domain=."+n:""}return""}var ze={N:()=>!!Re,D(e){ke.error("cookieStore error: "+e)},A(e){if(Re){try{for(var r=e+"=",n=Re.cookie.split(";").filter((e=>e.length)),t=0;n.length>t;t++){for(var i=n[t];" "==i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(r))return decodeURIComponent(i.substring(r.length,i.length))}}catch(e){}return null}},F(e){var r;try{r=JSON.parse(ze.A(e))||{}}catch(e){}return r},q(e,r,n,t,i){if(!Re)return!1;try{var o="",a="",l=je(Re.location.hostname,t);if(n){var u=new Date;u.setTime(u.getTime()+864e5*n),o="; expires="+u.toUTCString()}i&&(a="; secure");var s=e+"="+encodeURIComponent(JSON.stringify(r))+o+"; SameSite=Lax; path=/"+l+a;return s.length>3686.4&&ke.warn("cookieStore warning: large cookie, len="+s.length),Re.cookie=s,!0}catch(e){return!1}},P(e,r){if(null!=Re&&Re.cookie)try{ze.q(e,"",-1,r)}catch(e){return}}},Ge=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ke=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ge],Ve=["$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"],He="<masked>",Xe=["li_fat_id"];function Ye(e,r,n){if(!Re)return{};var t,i,o,l=r?[...Ge,...n||[]]:[],u=(t=De(Re.URL,l,He),i=Ke.concat(e||[]),o={},Ae(i,(function(e){var r=function(e,r){for(var n,t=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;t.length>i;i++){var o=t[i].split("=");if(o[0]===r){n=o;break}}if(!a(n)||2>n.length)return"";var l=n[1];try{l=decodeURIComponent(l)}catch(e){ke.error("Skipping decoding for malformed query param: "+l)}return l.replace(/\+/g," ")}(t,e);o[e]=r||null})),o),s=function(){var e={};return Ae(Xe,(function(r){var n=ze.A(r);e[r]=n||null})),e}();return Oe(s,u)}function qe(){return navigator.language||navigator.userLanguage}var Je="$direct";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,t,i){var a,l,u,s;if(void 0===i&&(i=!1),!$e)return{};var c,f,v,h,g,w,b,R,y,S,M,k,P=r?[...Ge,...n||[]]:[],[A,O]=function(e){for(var r=0;me.length>r;r++){var[n,t]=me[r],i=n.exec(e),o=i&&("function"==typeof t?t(i,e):t);if(o)return o}return["",""]}($e),B=null!=(c="undefined"!=typeof navigator?navigator:void 0)&&c.brave?{brave:!0}:{},D={detectGoogleSearchApp:t},I=Oe((M={$os:A,$os_version:O,$browser:pe($e,navigator.vendor,B,D),$device:_e($e),$device_type:(h=$e,g={userAgentDataPlatform:null==(a=navigator)||null==(a=a.userAgentData)?void 0:a.platform,maxTouchPoints:null==(l=navigator)?void 0:l.maxTouchPoints,screenWidth:null==xe||null==(u=xe.screen)?void 0:u.width,screenHeight:null==xe||null==(s=xe.screen)?void 0:s.height,devicePixelRatio:null==xe?void 0:xe.devicePixelRatio},S=_e(h),S===x||S===_||"Kobo"===S||"Kindle Fire"===S||S===J?m:S===F||S===j||S===L||S===X?"Console":S===E?"Wearable":S?p:"Android"===(null==g?void 0:g.userAgentDataPlatform)&&(null!==(w=null==g?void 0:g.maxTouchPoints)&&void 0!==w?w:0)>0?600>Math.min(null!==(b=null==g?void 0:g.screenWidth)&&void 0!==b?b:0,null!==(R=null==g?void 0:g.screenHeight)&&void 0!==R?R:0)/(null!==(y=null==g?void 0:g.devicePixelRatio)&&void 0!==y?y:1)?p:m:"Desktop"),$timezone:Qe(),$timezone_offset:Ze()},k={},Ae(M,(function(e,r){("[object String]"==o.call(e)&&e.length>0||d(e))&&(k[r]=e)})),k),{$current_url:De(i?(v=null==ye?void 0:ye.href,v?v.split("#")[0]:v):null==ye?void 0:ye.href,P,He),$host:null==ye?void 0:ye.host,$pathname:null==ye?void 0:ye.pathname,$raw_user_agent:$e.length>1e3?$e.substring(0,997)+"...":$e,$browser_version:we($e,navigator.vendor,B,D),$browser_language:qe(),$browser_language_prefix:(f=qe(),"string"==typeof f?f.split("-")[0]:void 0),$screen_height:null==xe?void 0:xe.screen.height,$screen_width:null==xe?void 0:xe.screen.width,$viewport_height:null==xe?void 0:xe.innerHeight,$viewport_width:null==xe?void 0:xe.innerWidth,$lib:e.LIB_NAME,$lib_version:e.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return e.SDK_DIST_CHANNEL&&(I.$sdk_dist_channel=e.SDK_DIST_CHANNEL),I}function rr(e,r){return[...e||[],...a(r)?r:[r]]}function nr(e,r){return(s(e)?1:e)*r}function tr(e,r){return function(e){for(var r=0,n=0;e.length>n;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return Math.abs(r)}(e)%100<v(100*r,0,100,ke)}var ir=["type"];function or(e){var{type:r,executionTimeMs:n}=e;return r+(c(n)?"":" ("+n.toFixed(2)+"ms)")}var ar=Pe("[PostHog Action RateLimiting]");function lr(e,r){console.log(e,r)}function ur(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],d=r[o];if(s(a))t[o]=d;else if(s(d))t[o]=a;else if(!(a===d||c(a)&&c(d)))if(l(a)&&l(d))if(n>1){var f=ur(a,d,n-1);u(f)||(t[o]=f)}else t[o]="max depth reached, checking for changed value";else t[o]=d}return t}var sr,cr,dr,fr=(sr=null,cr=0,dr=null,{info(e){dr!==e&&(cr=0,dr=e),cr++,sr&&clearTimeout(sr),sr=setTimeout((()=>{ar.info(1===cr?'action "'+e+'" has been rate limited':'action "'+e+'" has been rate limited ('+cr+" times)"),cr=0,sr=null}),1e3)}});function vr(e){void 0===e&&(e={});var{maskAction:r,maskState:n,titleFunction:t=or,logger:i=lr,include:o={prevState:!0,nextState:!1,changedState:!0},rateLimiterRefillRate:a=1,rateLimiterBucketSize:l=10,__stateComparisonDepth:u}=e,s=new h({refillRate:a,bucketSize:l,refillInterval:1e3,Ae:ar});return e=>a=>l=>{var c=l,d=e.getState(),f=performance.now(),v=a(c),h=performance.now()-f,p=e.getState(),g=r?r(c):c;if(!g)return v;if(s.consumeRateLimit(c.type))fr.info(c.type);else try{var w=n?n(d,g):d,m=n?n(p,g):p,_=o.changedState?ur(w,m,null!=u?u:5):void 0,{type:x}=g,b={type:x,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},E=t(b);i(E,b)}catch(e){ar.error("Error logging state:",e)}return v}}Se.posthogCustomizations=Object.freeze({__proto__:null,browserConsoleLogger:lr,posthogKeaLogger(e){void 0===e&&(e={});var r=vr(e);return{name:"posthog-kea-logger",events:{beforeReduxStore(e){e.middleware.push(r)}}}},posthogReduxLogger:vr,printAndDropEverything:e=>(console.log("Would have sent event:",e),null),sampleByDistinctId:e=>n=>n&&tr(n.properties.distinct_id,e)?r({},n,{properties:r({},n.properties,{$sample_type:["sampleByDistinctId"],$sample_threshold:e})}):null,sampleByEvent:(e,t)=>i=>{var o,a,l;return i?n(e,i.event)?100*Math.random()<v(100*t,0,100,ke)?r({},i,{properties:r({},i.properties,{$sample_type:rr(null==(o=i.properties)?void 0:o.$sample_type,"sampleByEvent"),$sample_threshold:nr(null==(a=i.properties)?void 0:a.$sample_threshold,t),$sampled_events:rr(null==(l=i.properties)?void 0:l.$sampled_events,e)})}):null:i:null},sampleBySessionId:e=>n=>n&&tr(n.properties.$session_id,e)?r({},n,{properties:r({},n.properties,{$sample_type:rr(n.properties.$sample_type,"sampleBySessionId"),$sample_threshold:nr(n.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,t=Oe({},er(e.config.mask_personal_data_properties,e.config.custom_personal_data_properties,e.config.detect_google_search_app,e.config.disable_capture_url_hashes),Ye(e.config.custom_campaign_params,e.config.mask_personal_data_properties,e.config.custom_personal_data_properties),{$referrer:(null==Re?void 0:Re.referrer)||Je,$referring_domain:null!=Re&&Re.referrer&&(null==(r=Be(Re.referrer))?void 0:r.host)||Je}),i={};Ae(t,(function(e,r){(n(Ke,r)||n(Ve,r))&&(i[r]=e)})),e.setPersonPropertiesForFlags(i)}})}(); | ||
| //# sourceMappingURL=customizations.full.js.map |
@@ -1,2 +0,6 @@ | ||
| import { PostHog } from '../posthog-core'; | ||
| export declare const setAllPersonProfilePropertiesAsPersonPropertiesForFlags: (posthog: PostHog) => void; | ||
| import type { PostHogConfig, PostHogInterface } from '../types'; | ||
| type PostHogWithFlags = Pick<PostHogInterface, 'setPersonPropertiesForFlags'> & { | ||
| config: Pick<PostHogConfig, 'mask_personal_data_properties' | 'custom_personal_data_properties' | 'detect_google_search_app' | 'disable_capture_url_hashes' | 'custom_campaign_params'>; | ||
| }; | ||
| export declare const setAllPersonProfilePropertiesAsPersonPropertiesForFlags: (posthog: PostHogWithFlags) => void; | ||
| export {}; |
@@ -34,3 +34,6 @@ import { PostHog } from './posthog-core'; | ||
| import type { SessionRecordingCanvasOptions, PerformanceCaptureConfig, InitiatorType, JsonType, Properties, EventName, CapturedNetworkRequest, SessionRecordingOptions, FeatureFlagDetail, ToolbarParams, PostHogConfig as BasePostHogConfig, PostHog as BasePostHogInterface, RequestResponse } from '@posthog/types'; | ||
| export type PostHogInterface = Omit<BasePostHogInterface, 'config' | 'init'>; | ||
| export type PostHogInterface = Omit<BasePostHogInterface, 'config' | 'init' | 'set_config'> & { | ||
| config: PostHogConfig; | ||
| set_config(config: Partial<PostHogConfig>): void; | ||
| }; | ||
| export type PostHogConfig = Omit<BasePostHogConfig, 'loaded'> & { | ||
@@ -37,0 +40,0 @@ loaded: (posthog: PostHogInterface) => void; |
+2
-1
| { | ||
| "name": "posthog-js", | ||
| "version": "1.396.9", | ||
| "version": "1.397.0", | ||
| "bugs": { | ||
@@ -59,2 +59,3 @@ "url": "https://github.com/PostHog/posthog-js/issues" | ||
| "react/slim/package.json", | ||
| "customizations/package.json", | ||
| "rrweb/package.json", | ||
@@ -61,0 +62,0 @@ "rrweb-types/package.json", |
@@ -1,2 +0,6 @@ | ||
| import { PostHog } from '../posthog-core'; | ||
| export declare const setAllPersonProfilePropertiesAsPersonPropertiesForFlags: (posthog: PostHog) => void; | ||
| import type { PostHogConfig, PostHogInterface } from '../types'; | ||
| type PostHogWithFlags = Pick<PostHogInterface, 'setPersonPropertiesForFlags'> & { | ||
| config: Pick<PostHogConfig, 'mask_personal_data_properties' | 'custom_personal_data_properties' | 'detect_google_search_app' | 'disable_capture_url_hashes' | 'custom_campaign_params'>; | ||
| }; | ||
| export declare const setAllPersonProfilePropertiesAsPersonPropertiesForFlags: (posthog: PostHogWithFlags) => void; | ||
| export {}; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"setAllPersonProfilePropertiesAsPersonPropertiesForFlags.js","sourceRoot":"","sources":["../../../src/customizations/setAllPersonProfilePropertiesAsPersonPropertiesForFlags.ts"],"names":[],"mappings":";;;AACA,oDAM6B;AAC7B,kCAAuC;AACvC,sCAAwC;AAEjC,IAAM,uDAAuD,GAAG,UAAC,OAAgB;IACpF,IAAM,aAAa,GAAG,IAAA,cAAM,EACxB,EAAE,EACF,IAAA,gCAAkB,EACd,OAAO,CAAC,MAAM,CAAC,6BAA6B,EAC5C,OAAO,CAAC,MAAM,CAAC,+BAA+B,EAC9C,OAAO,CAAC,MAAM,CAAC,wBAAwB,EACvC,OAAO,CAAC,MAAM,CAAC,0BAA0B,CAC5C,EACD,IAAA,+BAAiB,EACb,OAAO,CAAC,MAAM,CAAC,sBAAsB,EACrC,OAAO,CAAC,MAAM,CAAC,6BAA6B,EAC5C,OAAO,CAAC,MAAM,CAAC,+BAA+B,CACjD,EACD,IAAA,6BAAe,GAAE,CACpB,CAAA;IACD,IAAM,gBAAgB,GAA2B,EAAE,CAAA;IACnD,IAAA,YAAI,EAAC,aAAa,EAAE,UAAU,CAAC,EAAE,CAAS;QACtC,IAAI,IAAA,eAAQ,EAAC,6BAAe,EAAE,CAAC,CAAC,IAAI,IAAA,eAAQ,EAAC,wCAA0B,EAAE,CAAC,CAAC,EAAE,CAAC;YAC1E,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QAC3B,CAAC;IACL,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,2BAA2B,CAAC,gBAAgB,CAAC,CAAA;AACzD,CAAC,CAAA;AAxBY,QAAA,uDAAuD,2DAwBnE","sourcesContent":["import { PostHog } from '../posthog-core'\nimport {\n CAMPAIGN_PARAMS,\n getCampaignParams,\n EVENT_TO_PERSON_PROPERTIES,\n getEventProperties,\n getReferrerInfo,\n} from '../utils/event-utils'\nimport { each, extend } from '../utils'\nimport { includes } from '@posthog/core'\n\nexport const setAllPersonProfilePropertiesAsPersonPropertiesForFlags = (posthog: PostHog): void => {\n const allProperties = extend(\n {},\n getEventProperties(\n posthog.config.mask_personal_data_properties,\n posthog.config.custom_personal_data_properties,\n posthog.config.detect_google_search_app,\n posthog.config.disable_capture_url_hashes\n ),\n getCampaignParams(\n posthog.config.custom_campaign_params,\n posthog.config.mask_personal_data_properties,\n posthog.config.custom_personal_data_properties\n ),\n getReferrerInfo()\n )\n const personProperties: Record<string, string> = {}\n each(allProperties, function (v, k: string) {\n if (includes(CAMPAIGN_PARAMS, k) || includes(EVENT_TO_PERSON_PROPERTIES, k)) {\n personProperties[k] = v\n }\n })\n\n posthog.setPersonPropertiesForFlags(personProperties)\n}\n"]} | ||
| {"version":3,"file":"setAllPersonProfilePropertiesAsPersonPropertiesForFlags.js","sourceRoot":"","sources":["../../../src/customizations/setAllPersonProfilePropertiesAsPersonPropertiesForFlags.ts"],"names":[],"mappings":";;;AACA,oDAM6B;AAC7B,kCAAuC;AACvC,sCAAwC;AAkBjC,IAAM,uDAAuD,GAAG,UAAC,OAAyB;IAC7F,IAAM,aAAa,GAAG,IAAA,cAAM,EACxB,EAAE,EACF,IAAA,gCAAkB,EACd,OAAO,CAAC,MAAM,CAAC,6BAA6B,EAC5C,OAAO,CAAC,MAAM,CAAC,+BAA+B,EAC9C,OAAO,CAAC,MAAM,CAAC,wBAAwB,EACvC,OAAO,CAAC,MAAM,CAAC,0BAA0B,CAC5C,EACD,IAAA,+BAAiB,EACb,OAAO,CAAC,MAAM,CAAC,sBAAsB,EACrC,OAAO,CAAC,MAAM,CAAC,6BAA6B,EAC5C,OAAO,CAAC,MAAM,CAAC,+BAA+B,CACjD,EACD,IAAA,6BAAe,GAAE,CACpB,CAAA;IACD,IAAM,gBAAgB,GAA2B,EAAE,CAAA;IACnD,IAAA,YAAI,EAAC,aAAa,EAAE,UAAU,CAAC,EAAE,CAAS;QACtC,IAAI,IAAA,eAAQ,EAAC,6BAAe,EAAE,CAAC,CAAC,IAAI,IAAA,eAAQ,EAAC,wCAA0B,EAAE,CAAC,CAAC,EAAE,CAAC;YAC1E,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QAC3B,CAAC;IACL,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,2BAA2B,CAAC,gBAAgB,CAAC,CAAA;AACzD,CAAC,CAAA;AAxBY,QAAA,uDAAuD,2DAwBnE","sourcesContent":["import type { PostHogConfig, PostHogInterface } from '../types'\nimport {\n CAMPAIGN_PARAMS,\n getCampaignParams,\n EVENT_TO_PERSON_PROPERTIES,\n getEventProperties,\n getReferrerInfo,\n} from '../utils/event-utils'\nimport { each, extend } from '../utils'\nimport { includes } from '@posthog/core'\n\n// only the members the function reads — typed structurally (not as the PostHog\n// class) so it accepts both the singleton and the instance handed to the `loaded`\n// callback, where the docs recommend calling it. Picking scalar config keys keeps\n// nominal class types (config.__extensionClasses) out of the signature, which\n// would otherwise be incompatible across the lib/ and dist/ declaration copies.\ntype PostHogWithFlags = Pick<PostHogInterface, 'setPersonPropertiesForFlags'> & {\n config: Pick<\n PostHogConfig,\n | 'mask_personal_data_properties'\n | 'custom_personal_data_properties'\n | 'detect_google_search_app'\n | 'disable_capture_url_hashes'\n | 'custom_campaign_params'\n >\n}\n\nexport const setAllPersonProfilePropertiesAsPersonPropertiesForFlags = (posthog: PostHogWithFlags): void => {\n const allProperties = extend(\n {},\n getEventProperties(\n posthog.config.mask_personal_data_properties,\n posthog.config.custom_personal_data_properties,\n posthog.config.detect_google_search_app,\n posthog.config.disable_capture_url_hashes\n ),\n getCampaignParams(\n posthog.config.custom_campaign_params,\n posthog.config.mask_personal_data_properties,\n posthog.config.custom_personal_data_properties\n ),\n getReferrerInfo()\n )\n const personProperties: Record<string, string> = {}\n each(allProperties, function (v, k: string) {\n if (includes(CAMPAIGN_PARAMS, k) || includes(EVENT_TO_PERSON_PROPERTIES, k)) {\n personProperties[k] = v\n }\n })\n\n posthog.setPersonPropertiesForFlags(personProperties)\n}\n"]} |
@@ -34,3 +34,6 @@ import { PostHog } from './posthog-core'; | ||
| import type { SessionRecordingCanvasOptions, PerformanceCaptureConfig, InitiatorType, JsonType, Properties, EventName, CapturedNetworkRequest, SessionRecordingOptions, FeatureFlagDetail, ToolbarParams, PostHogConfig as BasePostHogConfig, PostHog as BasePostHogInterface, RequestResponse } from '@posthog/types'; | ||
| export type PostHogInterface = Omit<BasePostHogInterface, 'config' | 'init'>; | ||
| export type PostHogInterface = Omit<BasePostHogInterface, 'config' | 'init' | 'set_config'> & { | ||
| config: PostHogConfig; | ||
| set_config(config: Partial<PostHogConfig>): void; | ||
| }; | ||
| export type PostHogConfig = Omit<BasePostHogConfig, 'loaded'> & { | ||
@@ -37,0 +40,0 @@ loaded: (posthog: PostHogInterface) => void; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,0DAA0D;AAC1D,sGAAsG;;;AAgiBtG,2EAA2E;AAC3E,yEAAyE;AACzE,iFAAiF;AACpE,QAAA,cAAc,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAU,CAAA;AAuE/E,QAAA,WAAW,GAAG;IACvB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,QAAQ;CACV,CAAA","sourcesContent":["// Portions of this file are derived from getsentry/sentry-javascript\n// Copyright (c) 2012 Functional Software, Inc. dba Sentry\n// Licensed under the MIT License: https://github.com/getsentry/sentry-javascript/blob/develop/LICENSE\n\nimport { PostHog } from './posthog-core'\nimport { Survey } from './posthog-surveys-types'\nimport { ConversationsRemoteConfig } from './posthog-conversations-types'\n\n// only importing types here, so won't affect the bundle\n// eslint-disable-next-line posthog-js/no-external-replay-imports\nimport type { SAMPLED } from './extensions/replay/external/triggerMatching'\n\n// Extension class types for __extensionClasses (type-only, no bundle impact)\nimport type { ExtensionConstructor } from './extensions/types'\nimport type { Autocapture } from './autocapture'\nimport type { DeadClicksAutocapture } from './extensions/dead-clicks-autocapture'\nimport type { ExceptionObserver } from './extensions/exception-autocapture'\nimport type { HistoryAutocapture } from './extensions/history-autocapture'\nimport type { TracingHeaders } from './extensions/tracing-headers'\nimport type { WebVitalsAutocapture } from './extensions/web-vitals'\nimport type { SessionRecording } from './extensions/replay/session-recording'\nimport type { Heatmaps } from './heatmaps'\nimport type { PostHogProductTours } from './posthog-product-tours'\nimport type { SiteApps } from './site-apps'\nimport type { PostHogSurveys } from './posthog-surveys'\nimport type { Toolbar } from './extensions/toolbar'\nimport type { PostHogExceptions } from './posthog-exceptions'\nimport type { WebExperiments } from './web-experiments'\nimport type { PostHogConversations } from './extensions/conversations/posthog-conversations'\nimport type { PostHogFeatureFlags } from './posthog-featureflags'\nimport type { PostHogLogs } from './posthog-logs'\n\n// ============================================================================\n// Re-export public types from @posthog/types\n// ============================================================================\n\n// Common types\nexport type { Property, Properties, JsonType, JsonRecord } from '@posthog/types'\n\n// Capture types\nexport type { KnownEventName, EventName, CaptureResult, CaptureOptions, BeforeSendFn } from '@posthog/types'\n\n// Feature flag types\nexport type {\n FeatureFlagsCallback,\n FeatureFlagDetail,\n FeatureFlagMetadata,\n EvaluationReason,\n FeatureFlagResult,\n FeatureFlagOptions,\n RemoteConfigFeatureFlagCallback,\n EarlyAccessFeature,\n EarlyAccessFeatureStage,\n EarlyAccessFeatureCallback,\n EarlyAccessFeatureResponse,\n FeatureFlagOverrides,\n FeatureFlagPayloadOverrides,\n FeatureFlagOverrideOptions,\n OverrideFeatureFlagsOptions,\n} from '@posthog/types'\n\n// Request types\nexport type { Headers, RequestResponse, RequestCallback } from '@posthog/types'\n\n// Session recording types\nexport type {\n SessionRecordingCanvasOptions,\n InitiatorType,\n NetworkRequest,\n CapturedNetworkRequest,\n SessionIdChangedCallback,\n SeverityLevel,\n} from '@posthog/types'\n\n// Config types\nexport type {\n AutocaptureCompatibleElement,\n DomAutocaptureEvents,\n AutocaptureConfig,\n RageclickConfig,\n BootstrapConfig,\n SupportedWebVitalsMetrics,\n PerformanceCaptureConfig,\n DeadClickCandidate,\n ExceptionAutoCaptureConfig,\n ExceptionStepsConfig,\n DeadClicksAutoCaptureConfig,\n HeatmapConfig,\n ConfigDefaults,\n ExternalIntegrationKind,\n ErrorTrackingOptions,\n MaskInputOptions,\n SlimDOMOptions,\n SessionRecordingOptions,\n RequestQueueConfig,\n} from '@posthog/types'\n\n// Toolbar types\nexport type { ToolbarUserIntent, ToolbarSource, ToolbarVersion, ToolbarParams } from '@posthog/types'\n\n// Log capture types\nexport type {\n LogSeverityLevel,\n OtlpSeverityText,\n OtlpSeverityEntry,\n LogAttributeValue,\n LogAttributes,\n CaptureLogOptions,\n Logger,\n OtlpAnyValue,\n OtlpKeyValue,\n OtlpLogRecord,\n OtlpLogsPayload,\n} from '@posthog/types'\nexport type { LogSdkContext } from '@posthog/core'\n\n// Re-export KnownUnsafeEditableEvent from @posthog/core for backwards compatibility\nexport type { KnownUnsafeEditableEvent } from '@posthog/core'\n\n// ============================================================================\n// Browser-specific types that depend on local imports\n// These cannot be moved to @posthog/types as they reference browser-specific code\n// ============================================================================\n\n// Import types for internal use in this file\nimport type {\n SessionRecordingCanvasOptions,\n PerformanceCaptureConfig,\n InitiatorType,\n JsonType,\n Properties,\n EventName,\n CapturedNetworkRequest,\n SessionRecordingOptions,\n FeatureFlagDetail,\n ToolbarParams,\n PostHogConfig as BasePostHogConfig,\n PostHog as BasePostHogInterface,\n RequestResponse,\n} from '@posthog/types'\n\n/* Small override from the base class to make it more specific to the browser/src/posthog-core.ts file\n * This guarantees we'll be able to use `PostHogConfig` as implemented in the browser/src/posthog-core.ts file\n * using the proper `loaded` function signature.\n */\nexport type PostHogInterface = Omit<BasePostHogInterface, 'config' | 'init'>\n\n/*\n * Specify that `loaded` should be using the PostHog instance type\n * as implemented by the browser/src/posthog-core.ts file rather than the @posthog/types type\n */\nexport type PostHogConfig = Omit<BasePostHogConfig, 'loaded'> & {\n loaded: (posthog: PostHogInterface) => void\n\n /**\n * Disables capturing the `$device_model` super-property.\n *\n * When capturing is enabled (the default), PostHog resolves the hardware model once during init\n * via `navigator.userAgentData.getHighEntropyValues(['model'])` and registers it as the raw OEM\n * code (e.g. `Pixel 7`). This is Chromium-only and only meaningful on Android — it resolves to\n * `undefined` on Safari/Firefox and to an empty string on desktop, in which cases nothing is\n * registered.\n *\n * This opt-out is offered because `getHighEntropyValues` is still experimental and Chromium-only\n * (not yet a cross-browser standard); set it to `true` to skip the call entirely.\n *\n * @default false\n */\n disableDeviceModel?: boolean\n\n /**\n * Internal: Extension class overrides for tree-shaking support.\n * When provided, these classes are used instead of the default imports.\n * This enables entrypoints to control which extensions are bundled.\n * @internal\n */\n __extensionClasses?: {\n exceptions?: ExtensionConstructor<PostHogExceptions>\n historyAutocapture?: ExtensionConstructor<HistoryAutocapture>\n tracingHeaders?: ExtensionConstructor<TracingHeaders>\n siteApps?: ExtensionConstructor<SiteApps>\n sessionRecording?: ExtensionConstructor<SessionRecording>\n autocapture?: ExtensionConstructor<Autocapture>\n productTours?: ExtensionConstructor<PostHogProductTours>\n heatmaps?: ExtensionConstructor<Heatmaps>\n webVitalsAutocapture?: ExtensionConstructor<WebVitalsAutocapture>\n exceptionObserver?: ExtensionConstructor<ExceptionObserver>\n deadClicksAutocapture?: ExtensionConstructor<DeadClicksAutocapture>\n surveys?: ExtensionConstructor<PostHogSurveys>\n toolbar?: ExtensionConstructor<Toolbar>\n experiments?: ExtensionConstructor<WebExperiments>\n conversations?: ExtensionConstructor<PostHogConversations>\n featureFlags?: ExtensionConstructor<PostHogFeatureFlags>\n logs?: ExtensionConstructor<PostHogLogs>\n }\n}\n\n// See https://nextjs.org/docs/app/api-reference/functions/fetch#fetchurl-options\ntype NextOptions = { revalidate: false | 0 | number; tags: string[] }\n\nexport interface RequestWithOptions {\n url: string\n // Data can be a single object or an array of objects when batched\n data?: Record<string, any> | Record<string, any>[]\n headers?: Record<string, any>\n transport?: 'XHR' | 'fetch' | 'sendBeacon'\n method?: 'POST' | 'GET'\n urlQueryArgs?: { compression: Compression }\n callback?: (response: RequestResponse) => void\n timeout?: number\n noRetries?: boolean\n disableTransport?: ('XHR' | 'fetch' | 'sendBeacon')[]\n compression?: Compression | 'best-available'\n fetchOptions?: {\n cache?: RequestInit['cache']\n next?: NextOptions\n }\n /**\n * When set, `_send_request` invokes `callback` with a synthetic response\n * on the paths that otherwise drop a request without notifying the caller\n * (client not loaded, server rate limit). Opt-in so existing callers keep\n * their current behavior; the logs pipeline uses it to keep records for a\n * later retry instead of losing them silently.\n */\n fireCallbackOnDrop?: boolean\n}\n\n// Queued request types - the same as a request but with additional queueing information\nexport interface QueuedRequestWithOptions extends RequestWithOptions {\n /** key of queue, e.g. 'sessionRecording' vs 'event' */\n batchKey?: string\n}\n\n// Used explicitly for retriable requests\nexport interface RetriableRequestWithOptions extends QueuedRequestWithOptions {\n retriesPerformedSoFar?: number\n}\n\nexport type FlagVariant = { flag: string; variant: string }\n\n/** the config stored in persistence when session recording remote config is received */\nexport type SessionRecordingPersistedConfig = Omit<\n SessionRecordingRemoteConfig,\n | 'recordCanvas'\n | 'canvasFps'\n | 'canvasQuality'\n | 'networkPayloadCapture'\n | 'sampleRate'\n | 'minimumDurationMilliseconds'\n> & {\n /**\n * Used to determine if the persisted config is still valid or we need to wait for a new one\n * only accepts undefined since older versions of the library didn't set this.\n */\n cache_timestamp?: number\n enabled: boolean\n networkPayloadCapture: SessionRecordingRemoteConfig['networkPayloadCapture'] & {\n capturePerformance: RemoteConfig['capturePerformance']\n }\n canvasRecording: {\n enabled: SessionRecordingRemoteConfig['recordCanvas']\n fps: SessionRecordingRemoteConfig['canvasFps']\n quality: SessionRecordingRemoteConfig['canvasQuality']\n }\n // we don't allow string config here\n sampleRate: number | null\n minimumDurationMilliseconds: number | null | undefined\n}\n\nexport type SessionRecordingRemoteConfig = SessionRecordingCanvasOptions & {\n endpoint?: string\n consoleLogRecordingEnabled?: boolean\n // the API returns a decimal between 0 and 1 as a string\n sampleRate?: string | null\n minimumDurationMilliseconds?: number\n linkedFlag?: string | FlagVariant | null\n networkPayloadCapture?: Pick<NetworkRecordOptions, 'recordBody' | 'recordHeaders'>\n masking?: Pick<SessionRecordingOptions, 'maskAllInputs' | 'maskTextSelector' | 'blockSelector'>\n urlTriggers?: SessionRecordingUrlTrigger[]\n scriptConfig?: { script?: string | undefined }\n urlBlocklist?: SessionRecordingUrlTrigger[]\n eventTriggers?: string[]\n /**\n * Controls how event, url, sampling, and linked flag triggers are combined\n *\n * `any` means that if any of the triggers match, the session will be recorded\n * `all` means that all the triggers must match for the session to be recorded\n *\n * originally it was (event || url) && (sampling || linked flag)\n * which nobody wanted, now the default is all\n */\n triggerMatchType?: 'any' | 'all'\n /**\n * Config version - defaults to 1 (legacy)\n * When version is 2, triggerGroups is used instead of individual trigger fields\n */\n version?: 1 | 2\n /**\n * V2 Trigger Groups - multiple named trigger groups with their own conditions and sample rates\n * Only used when version === 2\n */\n triggerGroups?: SessionRecordingTriggerGroup[]\n}\n\n/**\n * Remote configuration for the PostHog instance\n *\n * All of these settings can be configured directly in your PostHog instance\n * Any configuration set in the client overrides the information from the server\n */\nexport interface RemoteConfig {\n /**\n * Supported compression algorithms\n */\n supportedCompression: Compression[]\n\n /**\n * If set, disables autocapture\n */\n autocapture_opt_out?: boolean\n\n /**\n * originally capturePerformance was replay only and so boolean true\n * is equivalent to { network_timing: true }\n * now capture performance can be separately enabled within replay\n * and as a standalone web vitals tracker\n * people can have them enabled separately\n * they work standalone but enhance each other\n * TODO: deprecate this so we make a new config that doesn't need this explanation\n */\n capturePerformance?: boolean | PerformanceCaptureConfig\n\n /**\n * Whether we should use a custom endpoint for analytics\n *\n * @default { endpoint: \"/e\" }\n */\n analytics?: {\n endpoint?: string\n }\n\n /**\n * Whether the `$elements_chain` property should be sent as a string or as an array\n *\n * @default false\n */\n elementsChainAsString?: boolean\n\n /**\n * Error tracking configuration options\n */\n errorTracking?: {\n autocaptureExceptions?: boolean\n captureExtensionExceptions?: boolean\n suppressionRules?: ErrorTrackingSuppressionRule[]\n }\n\n /**\n * Whether capturing logs to the logs product is enabled\n */\n logs?: {\n captureConsoleLogs?: boolean\n }\n\n /**\n * This is currently in development and may have breaking changes without a major version bump\n */\n autocaptureExceptions?: boolean | { endpoint?: string }\n\n /**\n * Session recording configuration options\n */\n sessionRecording?: SessionRecordingRemoteConfig | false\n\n /**\n * Whether surveys are enabled\n */\n surveys?: boolean | Survey[]\n\n /**\n * Whether product tours are enabled\n */\n productTours?: boolean\n\n /**\n * Parameters for the toolbar\n */\n toolbarParams: ToolbarParams\n\n /**\n * @deprecated renamed to toolbarParams, still present on older API responses\n */\n editorParams?: ToolbarParams\n\n /**\n * @deprecated, moved to toolbarParams\n */\n toolbarVersion: 'toolbar'\n\n /**\n * Whether the user is authenticated\n */\n isAuthenticated: boolean\n\n /**\n * List of site apps with their IDs and URLs\n */\n siteApps: { id: string; url: string }[]\n\n /**\n * Whether heatmaps are enabled\n */\n heatmaps?: boolean\n\n /**\n * Whether to only capture identified users by default\n */\n defaultIdentifiedOnly?: boolean\n\n /**\n * Whether to capture dead clicks\n */\n captureDeadClicks?: boolean\n\n /**\n * Indicates if the team has any flags enabled (if not we don't need to load them)\n */\n hasFeatureFlags?: boolean\n\n /**\n * Conversations widget configuration\n */\n conversations?: boolean | ConversationsRemoteConfig\n}\n\n/**\n * Flags returns feature flags and their payloads\n */\nexport interface FlagsResponse extends RemoteConfig {\n featureFlags: Record<string, string | boolean>\n featureFlagPayloads: Record<string, JsonType>\n errorsWhileComputingFlags: boolean\n requestId?: string\n flags: Record<string, FeatureFlagDetail>\n evaluatedAt?: number\n}\n\nexport type SiteAppGlobals = {\n event: {\n uuid: string\n event: EventName\n properties: Properties\n timestamp?: Date\n elements_chain?: string\n distinct_id?: string\n }\n person: {\n properties: Properties\n }\n groups: Record<string, { id: string; type: string; properties: Properties }>\n}\n\nexport type SiteAppLoader = {\n id: string\n init: (config: { posthog: PostHog; callback: (success: boolean) => void }) => {\n processEvent?: (globals: SiteAppGlobals) => void\n }\n}\n\nexport type SiteApp = {\n id: string\n loaded: boolean\n errored: boolean\n processedBuffer: boolean\n processEvent?: (globals: SiteAppGlobals) => void\n}\n\nexport interface PersistentStore {\n _is_supported: () => boolean\n _error: (error: any) => void\n _parse: (name: string) => any\n _get: (name: string) => any\n // Returns whether the write was accepted without throwing. Backends that\n // swallow quota/serialization errors return false so callers can avoid\n // caching a write that never landed. This is best-effort, not a durable\n // -persistence guarantee — e.g. Safari private mode has historically\n // reported success on a write that did not persist.\n _set: (\n name: string,\n value: any,\n expire_days?: number | null,\n cross_subdomain?: boolean,\n secure?: boolean,\n debug?: boolean\n ) => boolean\n _remove: (name: string, cross_subdomain?: boolean) => void\n}\n\nexport type EventHandler = (event: Event) => boolean | void\n\nexport type SnippetArrayItem = [method: string, ...args: any[]]\n\nexport type NetworkRecordOptions = {\n initiatorTypes?: InitiatorType[]\n maskRequestFn?: (data: CapturedNetworkRequest) => CapturedNetworkRequest | undefined\n recordHeaders?: boolean | { request: boolean; response: boolean }\n recordBody?: boolean | string[] | { request: boolean | string[]; response: boolean | string[] }\n recordInitialRequests?: boolean\n /**\n * whether to record PerformanceEntry events for network requests\n */\n recordPerformance?: boolean\n /**\n * the PerformanceObserver will only observe these entry types\n */\n performanceEntryTypeToObserve: string[]\n /**\n * the maximum size of the request/response body to record\n * NB this will be at most 1MB even if set larger\n */\n payloadSizeLimitBytes: number\n /**\n * when true, read bodies through a streaming reader that stops at payloadSizeLimitBytes\n * instead of buffering the whole body and then enforcing the limit. Reads only a clone of\n * the body, so it never consumes the stream the page itself reads.\n * @default false\n */\n streamNetworkBody?: boolean\n /**\n * some domains we should never record the payload\n * for example other companies session replay ingestion payloads aren't super useful but are gigantic\n * if this isn't provided we use a default list\n * if this is provided - we add the provided list to the default list\n * i.e. we never record the payloads on the default deny list\n */\n payloadHostDenyList?: string[]\n}\n\nexport type ErrorEventArgs = [\n event: string | Event,\n source?: string | undefined,\n lineno?: number | undefined,\n colno?: number | undefined,\n error?: Error | undefined,\n]\n\n// levels originally copied from Sentry to work with the sentry integration\n// and to avoid relying on a frequently changing @sentry/types dependency\n// but provided as an array of literal types, so we can constrain the level below\nexport const severityLevels = ['fatal', 'error', 'warning', 'log', 'info', 'debug'] as const\n\nexport interface SessionRecordingUrlTrigger {\n url: string\n matching: 'regex'\n}\n\n/**\n * V2 event trigger - always an object with name, optionally with property filters.\n * The server normalizes bare event name strings to this shape before sending.\n */\nexport interface SessionRecordingEventTrigger {\n name: string\n properties?: SessionRecordingTriggerPropertyFilter[]\n}\n\nexport interface SessionRecordingTriggerPropertyFilter {\n key: string\n type: 'event' | 'person'\n operator?: 'exact' | 'is_not' | 'icontains' | 'not_icontains' | 'regex' | 'not_regex' | 'gt' | 'lt'\n value?: string | number | boolean | string[]\n}\n\n/**\n * V2 Trigger Group - represents a single trigger group with its own conditions and sample rate\n */\nexport interface SessionRecordingTriggerGroup {\n id: string\n name: string\n sampleRate: number\n minDurationMs?: number\n conditions: {\n matchType: 'any' | 'all'\n events?: SessionRecordingEventTrigger[]\n urls?: SessionRecordingUrlTrigger[]\n flag?: string | FlagVariant\n properties?: SessionRecordingTriggerPropertyFilter[]\n }\n}\n\nexport type PropertyMatchType = 'regex' | 'not_regex' | 'exact' | 'is_not' | 'icontains' | 'not_icontains'\n\nexport interface ErrorTrackingSuppressionRule {\n type: 'AND' | 'OR'\n values: ErrorTrackingSuppressionRuleValue[]\n}\n\nexport interface ErrorTrackingSuppressionRuleValue {\n key: '$exception_types' | '$exception_values'\n operator: PropertyMatchType\n value: string | string[]\n type: string\n}\n\nexport type SessionStartReason =\n | 'sampling_overridden'\n | 'recording_initialized'\n | 'linked_flag_matched'\n | 'linked_flag_overridden'\n | typeof SAMPLED\n | 'session_id_changed'\n | 'url_trigger_matched'\n | 'event_trigger_matched'\n\nexport type OverrideConfig = {\n sampling: boolean\n linked_flag: boolean\n url_trigger: boolean\n event_trigger: boolean\n}\n\nexport const Compression = {\n GZipJS: 'gzip-js',\n Base64: 'base64',\n} as const\nexport type Compression = (typeof Compression)[keyof typeof Compression]\n"]} | ||
| {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,0DAA0D;AAC1D,sGAAsG;;;AAqiBtG,2EAA2E;AAC3E,yEAAyE;AACzE,iFAAiF;AACpE,QAAA,cAAc,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAU,CAAA;AAuE/E,QAAA,WAAW,GAAG;IACvB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,QAAQ;CACV,CAAA","sourcesContent":["// Portions of this file are derived from getsentry/sentry-javascript\n// Copyright (c) 2012 Functional Software, Inc. dba Sentry\n// Licensed under the MIT License: https://github.com/getsentry/sentry-javascript/blob/develop/LICENSE\n\nimport { PostHog } from './posthog-core'\nimport { Survey } from './posthog-surveys-types'\nimport { ConversationsRemoteConfig } from './posthog-conversations-types'\n\n// only importing types here, so won't affect the bundle\n// eslint-disable-next-line posthog-js/no-external-replay-imports\nimport type { SAMPLED } from './extensions/replay/external/triggerMatching'\n\n// Extension class types for __extensionClasses (type-only, no bundle impact)\nimport type { ExtensionConstructor } from './extensions/types'\nimport type { Autocapture } from './autocapture'\nimport type { DeadClicksAutocapture } from './extensions/dead-clicks-autocapture'\nimport type { ExceptionObserver } from './extensions/exception-autocapture'\nimport type { HistoryAutocapture } from './extensions/history-autocapture'\nimport type { TracingHeaders } from './extensions/tracing-headers'\nimport type { WebVitalsAutocapture } from './extensions/web-vitals'\nimport type { SessionRecording } from './extensions/replay/session-recording'\nimport type { Heatmaps } from './heatmaps'\nimport type { PostHogProductTours } from './posthog-product-tours'\nimport type { SiteApps } from './site-apps'\nimport type { PostHogSurveys } from './posthog-surveys'\nimport type { Toolbar } from './extensions/toolbar'\nimport type { PostHogExceptions } from './posthog-exceptions'\nimport type { WebExperiments } from './web-experiments'\nimport type { PostHogConversations } from './extensions/conversations/posthog-conversations'\nimport type { PostHogFeatureFlags } from './posthog-featureflags'\nimport type { PostHogLogs } from './posthog-logs'\n\n// ============================================================================\n// Re-export public types from @posthog/types\n// ============================================================================\n\n// Common types\nexport type { Property, Properties, JsonType, JsonRecord } from '@posthog/types'\n\n// Capture types\nexport type { KnownEventName, EventName, CaptureResult, CaptureOptions, BeforeSendFn } from '@posthog/types'\n\n// Feature flag types\nexport type {\n FeatureFlagsCallback,\n FeatureFlagDetail,\n FeatureFlagMetadata,\n EvaluationReason,\n FeatureFlagResult,\n FeatureFlagOptions,\n RemoteConfigFeatureFlagCallback,\n EarlyAccessFeature,\n EarlyAccessFeatureStage,\n EarlyAccessFeatureCallback,\n EarlyAccessFeatureResponse,\n FeatureFlagOverrides,\n FeatureFlagPayloadOverrides,\n FeatureFlagOverrideOptions,\n OverrideFeatureFlagsOptions,\n} from '@posthog/types'\n\n// Request types\nexport type { Headers, RequestResponse, RequestCallback } from '@posthog/types'\n\n// Session recording types\nexport type {\n SessionRecordingCanvasOptions,\n InitiatorType,\n NetworkRequest,\n CapturedNetworkRequest,\n SessionIdChangedCallback,\n SeverityLevel,\n} from '@posthog/types'\n\n// Config types\nexport type {\n AutocaptureCompatibleElement,\n DomAutocaptureEvents,\n AutocaptureConfig,\n RageclickConfig,\n BootstrapConfig,\n SupportedWebVitalsMetrics,\n PerformanceCaptureConfig,\n DeadClickCandidate,\n ExceptionAutoCaptureConfig,\n ExceptionStepsConfig,\n DeadClicksAutoCaptureConfig,\n HeatmapConfig,\n ConfigDefaults,\n ExternalIntegrationKind,\n ErrorTrackingOptions,\n MaskInputOptions,\n SlimDOMOptions,\n SessionRecordingOptions,\n RequestQueueConfig,\n} from '@posthog/types'\n\n// Toolbar types\nexport type { ToolbarUserIntent, ToolbarSource, ToolbarVersion, ToolbarParams } from '@posthog/types'\n\n// Log capture types\nexport type {\n LogSeverityLevel,\n OtlpSeverityText,\n OtlpSeverityEntry,\n LogAttributeValue,\n LogAttributes,\n CaptureLogOptions,\n Logger,\n OtlpAnyValue,\n OtlpKeyValue,\n OtlpLogRecord,\n OtlpLogsPayload,\n} from '@posthog/types'\nexport type { LogSdkContext } from '@posthog/core'\n\n// Re-export KnownUnsafeEditableEvent from @posthog/core for backwards compatibility\nexport type { KnownUnsafeEditableEvent } from '@posthog/core'\n\n// ============================================================================\n// Browser-specific types that depend on local imports\n// These cannot be moved to @posthog/types as they reference browser-specific code\n// ============================================================================\n\n// Import types for internal use in this file\nimport type {\n SessionRecordingCanvasOptions,\n PerformanceCaptureConfig,\n InitiatorType,\n JsonType,\n Properties,\n EventName,\n CapturedNetworkRequest,\n SessionRecordingOptions,\n FeatureFlagDetail,\n ToolbarParams,\n PostHogConfig as BasePostHogConfig,\n PostHog as BasePostHogInterface,\n RequestResponse,\n} from '@posthog/types'\n\n/* Small override from the base class to make it more specific to the browser/src/posthog-core.ts file\n * This guarantees we'll be able to use `PostHogConfig` as implemented in the browser/src/posthog-core.ts file\n * using the proper `loaded` function signature.\n */\nexport type PostHogInterface = Omit<BasePostHogInterface, 'config' | 'init' | 'set_config'> & {\n // re-declared (rather than kept from the base interface) so they use the\n // browser-specific `PostHogConfig` below, matching the class implementation\n config: PostHogConfig\n set_config(config: Partial<PostHogConfig>): void\n}\n\n/*\n * Specify that `loaded` should be using the PostHog instance type\n * as implemented by the browser/src/posthog-core.ts file rather than the @posthog/types type\n */\nexport type PostHogConfig = Omit<BasePostHogConfig, 'loaded'> & {\n loaded: (posthog: PostHogInterface) => void\n\n /**\n * Disables capturing the `$device_model` super-property.\n *\n * When capturing is enabled (the default), PostHog resolves the hardware model once during init\n * via `navigator.userAgentData.getHighEntropyValues(['model'])` and registers it as the raw OEM\n * code (e.g. `Pixel 7`). This is Chromium-only and only meaningful on Android — it resolves to\n * `undefined` on Safari/Firefox and to an empty string on desktop, in which cases nothing is\n * registered.\n *\n * This opt-out is offered because `getHighEntropyValues` is still experimental and Chromium-only\n * (not yet a cross-browser standard); set it to `true` to skip the call entirely.\n *\n * @default false\n */\n disableDeviceModel?: boolean\n\n /**\n * Internal: Extension class overrides for tree-shaking support.\n * When provided, these classes are used instead of the default imports.\n * This enables entrypoints to control which extensions are bundled.\n * @internal\n */\n __extensionClasses?: {\n exceptions?: ExtensionConstructor<PostHogExceptions>\n historyAutocapture?: ExtensionConstructor<HistoryAutocapture>\n tracingHeaders?: ExtensionConstructor<TracingHeaders>\n siteApps?: ExtensionConstructor<SiteApps>\n sessionRecording?: ExtensionConstructor<SessionRecording>\n autocapture?: ExtensionConstructor<Autocapture>\n productTours?: ExtensionConstructor<PostHogProductTours>\n heatmaps?: ExtensionConstructor<Heatmaps>\n webVitalsAutocapture?: ExtensionConstructor<WebVitalsAutocapture>\n exceptionObserver?: ExtensionConstructor<ExceptionObserver>\n deadClicksAutocapture?: ExtensionConstructor<DeadClicksAutocapture>\n surveys?: ExtensionConstructor<PostHogSurveys>\n toolbar?: ExtensionConstructor<Toolbar>\n experiments?: ExtensionConstructor<WebExperiments>\n conversations?: ExtensionConstructor<PostHogConversations>\n featureFlags?: ExtensionConstructor<PostHogFeatureFlags>\n logs?: ExtensionConstructor<PostHogLogs>\n }\n}\n\n// See https://nextjs.org/docs/app/api-reference/functions/fetch#fetchurl-options\ntype NextOptions = { revalidate: false | 0 | number; tags: string[] }\n\nexport interface RequestWithOptions {\n url: string\n // Data can be a single object or an array of objects when batched\n data?: Record<string, any> | Record<string, any>[]\n headers?: Record<string, any>\n transport?: 'XHR' | 'fetch' | 'sendBeacon'\n method?: 'POST' | 'GET'\n urlQueryArgs?: { compression: Compression }\n callback?: (response: RequestResponse) => void\n timeout?: number\n noRetries?: boolean\n disableTransport?: ('XHR' | 'fetch' | 'sendBeacon')[]\n compression?: Compression | 'best-available'\n fetchOptions?: {\n cache?: RequestInit['cache']\n next?: NextOptions\n }\n /**\n * When set, `_send_request` invokes `callback` with a synthetic response\n * on the paths that otherwise drop a request without notifying the caller\n * (client not loaded, server rate limit). Opt-in so existing callers keep\n * their current behavior; the logs pipeline uses it to keep records for a\n * later retry instead of losing them silently.\n */\n fireCallbackOnDrop?: boolean\n}\n\n// Queued request types - the same as a request but with additional queueing information\nexport interface QueuedRequestWithOptions extends RequestWithOptions {\n /** key of queue, e.g. 'sessionRecording' vs 'event' */\n batchKey?: string\n}\n\n// Used explicitly for retriable requests\nexport interface RetriableRequestWithOptions extends QueuedRequestWithOptions {\n retriesPerformedSoFar?: number\n}\n\nexport type FlagVariant = { flag: string; variant: string }\n\n/** the config stored in persistence when session recording remote config is received */\nexport type SessionRecordingPersistedConfig = Omit<\n SessionRecordingRemoteConfig,\n | 'recordCanvas'\n | 'canvasFps'\n | 'canvasQuality'\n | 'networkPayloadCapture'\n | 'sampleRate'\n | 'minimumDurationMilliseconds'\n> & {\n /**\n * Used to determine if the persisted config is still valid or we need to wait for a new one\n * only accepts undefined since older versions of the library didn't set this.\n */\n cache_timestamp?: number\n enabled: boolean\n networkPayloadCapture: SessionRecordingRemoteConfig['networkPayloadCapture'] & {\n capturePerformance: RemoteConfig['capturePerformance']\n }\n canvasRecording: {\n enabled: SessionRecordingRemoteConfig['recordCanvas']\n fps: SessionRecordingRemoteConfig['canvasFps']\n quality: SessionRecordingRemoteConfig['canvasQuality']\n }\n // we don't allow string config here\n sampleRate: number | null\n minimumDurationMilliseconds: number | null | undefined\n}\n\nexport type SessionRecordingRemoteConfig = SessionRecordingCanvasOptions & {\n endpoint?: string\n consoleLogRecordingEnabled?: boolean\n // the API returns a decimal between 0 and 1 as a string\n sampleRate?: string | null\n minimumDurationMilliseconds?: number\n linkedFlag?: string | FlagVariant | null\n networkPayloadCapture?: Pick<NetworkRecordOptions, 'recordBody' | 'recordHeaders'>\n masking?: Pick<SessionRecordingOptions, 'maskAllInputs' | 'maskTextSelector' | 'blockSelector'>\n urlTriggers?: SessionRecordingUrlTrigger[]\n scriptConfig?: { script?: string | undefined }\n urlBlocklist?: SessionRecordingUrlTrigger[]\n eventTriggers?: string[]\n /**\n * Controls how event, url, sampling, and linked flag triggers are combined\n *\n * `any` means that if any of the triggers match, the session will be recorded\n * `all` means that all the triggers must match for the session to be recorded\n *\n * originally it was (event || url) && (sampling || linked flag)\n * which nobody wanted, now the default is all\n */\n triggerMatchType?: 'any' | 'all'\n /**\n * Config version - defaults to 1 (legacy)\n * When version is 2, triggerGroups is used instead of individual trigger fields\n */\n version?: 1 | 2\n /**\n * V2 Trigger Groups - multiple named trigger groups with their own conditions and sample rates\n * Only used when version === 2\n */\n triggerGroups?: SessionRecordingTriggerGroup[]\n}\n\n/**\n * Remote configuration for the PostHog instance\n *\n * All of these settings can be configured directly in your PostHog instance\n * Any configuration set in the client overrides the information from the server\n */\nexport interface RemoteConfig {\n /**\n * Supported compression algorithms\n */\n supportedCompression: Compression[]\n\n /**\n * If set, disables autocapture\n */\n autocapture_opt_out?: boolean\n\n /**\n * originally capturePerformance was replay only and so boolean true\n * is equivalent to { network_timing: true }\n * now capture performance can be separately enabled within replay\n * and as a standalone web vitals tracker\n * people can have them enabled separately\n * they work standalone but enhance each other\n * TODO: deprecate this so we make a new config that doesn't need this explanation\n */\n capturePerformance?: boolean | PerformanceCaptureConfig\n\n /**\n * Whether we should use a custom endpoint for analytics\n *\n * @default { endpoint: \"/e\" }\n */\n analytics?: {\n endpoint?: string\n }\n\n /**\n * Whether the `$elements_chain` property should be sent as a string or as an array\n *\n * @default false\n */\n elementsChainAsString?: boolean\n\n /**\n * Error tracking configuration options\n */\n errorTracking?: {\n autocaptureExceptions?: boolean\n captureExtensionExceptions?: boolean\n suppressionRules?: ErrorTrackingSuppressionRule[]\n }\n\n /**\n * Whether capturing logs to the logs product is enabled\n */\n logs?: {\n captureConsoleLogs?: boolean\n }\n\n /**\n * This is currently in development and may have breaking changes without a major version bump\n */\n autocaptureExceptions?: boolean | { endpoint?: string }\n\n /**\n * Session recording configuration options\n */\n sessionRecording?: SessionRecordingRemoteConfig | false\n\n /**\n * Whether surveys are enabled\n */\n surveys?: boolean | Survey[]\n\n /**\n * Whether product tours are enabled\n */\n productTours?: boolean\n\n /**\n * Parameters for the toolbar\n */\n toolbarParams: ToolbarParams\n\n /**\n * @deprecated renamed to toolbarParams, still present on older API responses\n */\n editorParams?: ToolbarParams\n\n /**\n * @deprecated, moved to toolbarParams\n */\n toolbarVersion: 'toolbar'\n\n /**\n * Whether the user is authenticated\n */\n isAuthenticated: boolean\n\n /**\n * List of site apps with their IDs and URLs\n */\n siteApps: { id: string; url: string }[]\n\n /**\n * Whether heatmaps are enabled\n */\n heatmaps?: boolean\n\n /**\n * Whether to only capture identified users by default\n */\n defaultIdentifiedOnly?: boolean\n\n /**\n * Whether to capture dead clicks\n */\n captureDeadClicks?: boolean\n\n /**\n * Indicates if the team has any flags enabled (if not we don't need to load them)\n */\n hasFeatureFlags?: boolean\n\n /**\n * Conversations widget configuration\n */\n conversations?: boolean | ConversationsRemoteConfig\n}\n\n/**\n * Flags returns feature flags and their payloads\n */\nexport interface FlagsResponse extends RemoteConfig {\n featureFlags: Record<string, string | boolean>\n featureFlagPayloads: Record<string, JsonType>\n errorsWhileComputingFlags: boolean\n requestId?: string\n flags: Record<string, FeatureFlagDetail>\n evaluatedAt?: number\n}\n\nexport type SiteAppGlobals = {\n event: {\n uuid: string\n event: EventName\n properties: Properties\n timestamp?: Date\n elements_chain?: string\n distinct_id?: string\n }\n person: {\n properties: Properties\n }\n groups: Record<string, { id: string; type: string; properties: Properties }>\n}\n\nexport type SiteAppLoader = {\n id: string\n init: (config: { posthog: PostHog; callback: (success: boolean) => void }) => {\n processEvent?: (globals: SiteAppGlobals) => void\n }\n}\n\nexport type SiteApp = {\n id: string\n loaded: boolean\n errored: boolean\n processedBuffer: boolean\n processEvent?: (globals: SiteAppGlobals) => void\n}\n\nexport interface PersistentStore {\n _is_supported: () => boolean\n _error: (error: any) => void\n _parse: (name: string) => any\n _get: (name: string) => any\n // Returns whether the write was accepted without throwing. Backends that\n // swallow quota/serialization errors return false so callers can avoid\n // caching a write that never landed. This is best-effort, not a durable\n // -persistence guarantee — e.g. Safari private mode has historically\n // reported success on a write that did not persist.\n _set: (\n name: string,\n value: any,\n expire_days?: number | null,\n cross_subdomain?: boolean,\n secure?: boolean,\n debug?: boolean\n ) => boolean\n _remove: (name: string, cross_subdomain?: boolean) => void\n}\n\nexport type EventHandler = (event: Event) => boolean | void\n\nexport type SnippetArrayItem = [method: string, ...args: any[]]\n\nexport type NetworkRecordOptions = {\n initiatorTypes?: InitiatorType[]\n maskRequestFn?: (data: CapturedNetworkRequest) => CapturedNetworkRequest | undefined\n recordHeaders?: boolean | { request: boolean; response: boolean }\n recordBody?: boolean | string[] | { request: boolean | string[]; response: boolean | string[] }\n recordInitialRequests?: boolean\n /**\n * whether to record PerformanceEntry events for network requests\n */\n recordPerformance?: boolean\n /**\n * the PerformanceObserver will only observe these entry types\n */\n performanceEntryTypeToObserve: string[]\n /**\n * the maximum size of the request/response body to record\n * NB this will be at most 1MB even if set larger\n */\n payloadSizeLimitBytes: number\n /**\n * when true, read bodies through a streaming reader that stops at payloadSizeLimitBytes\n * instead of buffering the whole body and then enforcing the limit. Reads only a clone of\n * the body, so it never consumes the stream the page itself reads.\n * @default false\n */\n streamNetworkBody?: boolean\n /**\n * some domains we should never record the payload\n * for example other companies session replay ingestion payloads aren't super useful but are gigantic\n * if this isn't provided we use a default list\n * if this is provided - we add the provided list to the default list\n * i.e. we never record the payloads on the default deny list\n */\n payloadHostDenyList?: string[]\n}\n\nexport type ErrorEventArgs = [\n event: string | Event,\n source?: string | undefined,\n lineno?: number | undefined,\n colno?: number | undefined,\n error?: Error | undefined,\n]\n\n// levels originally copied from Sentry to work with the sentry integration\n// and to avoid relying on a frequently changing @sentry/types dependency\n// but provided as an array of literal types, so we can constrain the level below\nexport const severityLevels = ['fatal', 'error', 'warning', 'log', 'info', 'debug'] as const\n\nexport interface SessionRecordingUrlTrigger {\n url: string\n matching: 'regex'\n}\n\n/**\n * V2 event trigger - always an object with name, optionally with property filters.\n * The server normalizes bare event name strings to this shape before sending.\n */\nexport interface SessionRecordingEventTrigger {\n name: string\n properties?: SessionRecordingTriggerPropertyFilter[]\n}\n\nexport interface SessionRecordingTriggerPropertyFilter {\n key: string\n type: 'event' | 'person'\n operator?: 'exact' | 'is_not' | 'icontains' | 'not_icontains' | 'regex' | 'not_regex' | 'gt' | 'lt'\n value?: string | number | boolean | string[]\n}\n\n/**\n * V2 Trigger Group - represents a single trigger group with its own conditions and sample rate\n */\nexport interface SessionRecordingTriggerGroup {\n id: string\n name: string\n sampleRate: number\n minDurationMs?: number\n conditions: {\n matchType: 'any' | 'all'\n events?: SessionRecordingEventTrigger[]\n urls?: SessionRecordingUrlTrigger[]\n flag?: string | FlagVariant\n properties?: SessionRecordingTriggerPropertyFilter[]\n }\n}\n\nexport type PropertyMatchType = 'regex' | 'not_regex' | 'exact' | 'is_not' | 'icontains' | 'not_icontains'\n\nexport interface ErrorTrackingSuppressionRule {\n type: 'AND' | 'OR'\n values: ErrorTrackingSuppressionRuleValue[]\n}\n\nexport interface ErrorTrackingSuppressionRuleValue {\n key: '$exception_types' | '$exception_values'\n operator: PropertyMatchType\n value: string | string[]\n type: string\n}\n\nexport type SessionStartReason =\n | 'sampling_overridden'\n | 'recording_initialized'\n | 'linked_flag_matched'\n | 'linked_flag_overridden'\n | typeof SAMPLED\n | 'session_id_changed'\n | 'url_trigger_matched'\n | 'event_trigger_matched'\n\nexport type OverrideConfig = {\n sampling: boolean\n linked_flag: boolean\n url_trigger: boolean\n event_trigger: boolean\n}\n\nexport const Compression = {\n GZipJS: 'gzip-js',\n Base64: 'base64',\n} as const\nexport type Compression = (typeof Compression)[keyof typeof Compression]\n"]} |
+2
-1
| { | ||
| "name": "posthog-js", | ||
| "version": "1.396.9", | ||
| "version": "1.397.0", | ||
| "bugs": { | ||
@@ -25,2 +25,3 @@ "url": "https://github.com/PostHog/posthog-js/issues" | ||
| "react/slim/package.json", | ||
| "customizations/package.json", | ||
| "rrweb/package.json", | ||
@@ -27,0 +28,0 @@ "rrweb-types/package.json", |
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
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Telemetry
Supply chain riskThis package contains telemetry which tracks how it is used.
Found 5 instances
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 3 instances
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Telemetry
Supply chain riskThis package contains telemetry which tracks how it is used.
Found 2 instances
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 3 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
39231648
0.67%791
1.02%119093
2.31%40
2.56%5
150%